UNB Components Code Reference

UnbEnvironment class

Environment functions for compatibility with different server environments and to query information about the client (browser).

Public methods

S BackLangPath

Gets the path to the language pages root, relative to the currently requested web page.

S BackLibPath

Gets the path to the library files, relative to the currently requested web page.

S BackPath

Gets the path to the project root, relative to the currently requested web page.

S BestXHtml

Gets the client's best supported XHTML MIME type.

S EnableHttpCompression

Enables HTTP output compression.

S GetClientAddress

Gets the client IP address

S GetClientLanguages

Gets the client's language preferences.

S GetClientPlatform

Gets the client's platform identifier containing the client application (browser) and operating system as known.

S GetClientVersion

Gets the version of the client's browser application.

S GetReferer

Gets the referer URL for this request.

S GetSearchTerms

Gets the search terms found in the referer, e.g. if clicked on a search engine link.

S GetServerPlatform

Gets the local server's operating system class.

S IsBrowser

Determines whether it is likely that the client is using a real browser with a human sitting in front of it, rather than an automated bot or other application.

S IsClientPlatform

Determines whether the client platform matches the specified selector.

S IsMobile

Determines whether the client is on a mobile platform like a smartphone or PDA.

S IsRefererMyDomain

Gets a value indicating whether the referer URL is on the same domain as this page.

S IsXml

Gets a value indicating whether the client's best supported XHTML MIME type is XML-based.

S LibPath

Gets the path to the library files, relative to the project root.

S PageBaseName

Gets the full path and file base name of the currently requested web page relative to the project root and without the .php extension.

S PageLanguage

Gets the language code of the currently requested web page.

S ProjectRootToDocRoot

Gets the path to the project root, relative to the web server's DOCUMENT_ROOT.

S SetFirstPathLanguage

Sets whether the first path level shall be considered as the language selection.

S SetupEnvironment

Sets up the environment for UNB.

S SetupErrorReporting

Configures PHP error reporting.

S SetupMagicQuotesGPC

Configures PHP magic quoting for GET/POST/COOKIE variables.

S SetupMagicQuotesRuntime

Configures PHP magic quoting at runtime.

S SetupMultibyte

Configures PHP multibyte string functions. This is strongly recommended to use to ensure UNB works as expected.

S SetupNull

Filters all NUL bytes out of input parameters.

S SetupRegisterGlobals

Configures PHP register globals setting.

Private methods

   Class constructor

Private constructor, does nothing but preventing an unwanted instantiation of this class.

S DeNulArray

Removes NUL characters from each array key and value, recursing into sub-arrays.

S DeSlashArray

Applies stripslashes() to each array key and value, recursing into sub-arrays.

S FindProjectRoot

Automatically finds related directories around.

S strdifferindex

Find at what character index both strings differ first.

Private fields

backlibpath  –  default: null

Path to the library files, relative to the currently requested web page. E.g. "../../unb_lib/"

backpath  –  default: null

Path to the project root, relative to the currently requested web page. E.g. "../../"

clientIsBrowser  –  default: null

clientIsMobile  –  default: null

clientPlatform  –  default: null

clientVersion  –  default: null

didSetup  –  default: false

Remembers whether the environment has already been set up.

firstPathLanguage  –  default: false

Specifies whether the first path level shall be considered as the language selection.

libpath  –  default: null

Path to the library files, relative to the project root. E.g. "unb_lib/"

pageBaseName  –  default: null

pageLanguage  –  default: null

projectRootToDocRoot  –  default: null

Path to the project root, relative to the web server's DOCUMENT_ROOT. E.g. "project/"

searchTerms  –  default: null

Implementation file: environment.class.php, line 11

© 2011 Yves Goergen. UNB Components Homepage. Reference generated on 2011-02-22.