BrowserManager

Extends\org\turbocommons\src\main\php\model\BaseStrictClass

An abstraction of the browser entity an all its related operations and properties Browser entity is normally available only on client side or front end view applications, but some of its features can also make sense on a server side app. So depending on the implementation language, this class may or may not have some of its methods implemented.

package

Default

Methods

Protection to prevent accessing undefined properties to this class

__get(string $name): void
inherited
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Arguments

$name

string

The property name

Protection to prevent creating extra properties to this class

__set(string $name,string $value): void
inherited
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Arguments

$name

string

The property name

$value

string

The property value

Deletes the specified cookie from browser. Note that the cookie will only be deleted if belongs to the same path as specified.

deleteCookie(string $key,string $path = '/')
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
returns

boolean True if cookie was deleted or false if cookie could not be deleted or was not found.

Arguments

$key

string

The name of the cookie we want to delete

$path

string

Define the path where the cookie is set. By default it is the whole domain: '/'. If the cookie is not set on this path, we must pass the right one or the delete will fail.

Get the value for an existing cookie.

getCookie(string $key)
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
returns

string Cookie value or null if cookie does not exist

Arguments

$key

string

the name of the cookie we want to get

Get the current page full url, including 'https://', domain and any uri get parameters

getCurrentUrl(): string
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Response

string

A well formed url

Tries to detect the language that is set as preferred by the user on the current browser.

getPreferredLanguage()

NOTE: Getting browser language is not accurate. It is always better to use server side language detection

Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
returns

A two digits string containing the detected browser language. For example 'es', 'en', ...

Check if the specified cookie exists

isCookie(string $key)
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
returns

boolean True if cookie with specified name exists, false otherwise

Arguments

$key

string

the name for the cookie we want to find

Set the value for a cookie or create it if not exist

setCookie(string $key,string $value,mixed $expires = '',string $path = "/",string $domain = '',boolean $secure = false)

Adapted from the jquery.cookie plugin by Klaus Hartl: https://github.com/carhartl/jquery-cookie

Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
returns

boolean True if cookie was created, false otherwise. An exception may be thrown if invalid parameters are specified

Arguments

$key

string

the name for the cookie we want to create

$value

string

the value we want to set to the new cookie.

$expires

mixed

The lifetime of the cookie. Value can be a Number which will be interpreted as days from time of creation or a Date object. If omitted or '' string, the cookie becomes a session cookie.

$path

string

Define the path where the cookie is valid. By default it is the whole domain: '/'. A specific path can be passed (/ca/Home/) or a '' string to set it as the current site http path.

$domain

string

Define the domain where the cookie is valid. Default: domain of page where the cookie was created.

$secure

boolean

If true, the cookie transmission requires a secure protocol (https). Default: false.