eZ Publish  [trunk]
eZSys Class Reference

List of all members.

Public Member Functions

 __construct (array $serverParams=array())
 Initialize the object with settings taken from the current script run.
 __get ($propertyName)
 Magic function to get access readonly properties (protected)
 __isset ($propertyName)
 Magic function to see if readonly properties (protected) exists.
 attribute ($attr)
 Returns the attribute value for $attr or null if the attribute does not exist.
 attributes ()
 Make sure that certain attribute keys are available in $this->Attributes.
 hasAttribute ($attr)
 Checks if the attribute $attr is set.

Static Public Member Functions

static addAccessPath ($path, $name= 'undefined', $siteaccess=true)
 Appends the access path (parts of url that identifies siteaccess), used by eZSys::indexFile() NOTE: Does not make sense to use for siteaccess, as you would want to clear current path and set new one normally, so preferably use eZSys::setAccessPath() in this case.
static backupFilename ()
 Returns the backup filename for this platform.
static cacheDirectory ()
 Returns the current cache directory.
static clearAccessPath ($siteaccess=true)
 Clears the access path, used by eZSys::indexFile().
static clientIP ()
 Returns the client IP whether he's behind a proxy or not.
static createShellArgument ($argumentText, array $replaceList)
 Replaces % elements in $argumentText using $replaceList, and also properly escape the argument.
static environmentVariable ($variableName, $quiet=false)
 Returns an environment variable or null if it is not available.
static envSeparator ()
 Returns the string used as environment separator on the current system.
static escapeShellArgument ($argument)
 Returns an escaped string to be used as a shell argument.
static ezcrc32 ($string)
 A wrapper for PHP's crc32 function.
static fileSeparator ()
 Returns the string used as the file separator on the current system.
static filesystemType ()
 Returns the filesystem type.
static globBrace ($pattern, $flags=0)
 Wraps around the built-in glob() function to provide same functionality for systems (e.g Solaris) that does not support GLOB_BRACE.
static hasEnvironmentVariable ($variableName)
 Checks if an environment variable is available.
static hostname ()
 Returns the current hostname.
static indexDir ($withAccessList=true)
 Returns the filepath for the index file.
static indexFile ($withAccessPath=true)
 Returns the filepath for the index file with the access path appended.
static indexFileName ()
 Returns the filepath for the index file.
static init ($index= 'index.php', $forceVirtualHost=null)
 Initializes some variables according to some global PHP values.
static instance ()
 Returns a shared instance of the eZSys class.
static isDebugEnabled ()
 Returns true if debugging of internals is enabled, this will display which server variables are read.
static isPHPVersionSufficient ($requiredVersion)
 Checks if the given version is greater than or equal to the current PHP version.
static isShellExecution ()
 Determines if the current process has been started from the web or the shell.
static isSSLNow ()
 Determines if SSL is enabled and protocol HTTPS is used.
static lineSeparator ()
 Returns the string used as line separator on the current system.
static magickQuotes ()
 Should return true when magick quotes are enabled, but instead return null.
static mergeArgumentElements (array $argumentElements)
 Merges an argument list created by eZSys::splitArgumentIntoElements() back into a text string.
static osName ()
 Returns the current OS name or false if it can not be determined.
static osType ()
 Returns the OS type.
static path ($quiet=false)
 Returns the server's path string.
static phpVersion ()
 Returns the PHP version as an array with the version elements.
static phpVersionText ()
 The PHP version as text.
static protocolSchema ()
 Returns the schema of the request.
static queryString ()
 Returns the query string for the current request.
static removeMagicQuotes ()
 Removes magic quotes.
static requestURI ()
 Returns the URI used for parsing modules, views and parameters.
static rootDir ()
 Returns the absolute path to the eZ Publish root directory.
static serverPort ()
 Returns the server port or 80 as default if the server port can not be retrieved from the hostname or the server variable 'SERVER_PORT'.
static serverProtocol ()
 Returns the current server protocol depending on if SSL is enabled or not.
static serverURL ()
 Returns the server URL (protocol and hostname and port)
static serverVariable ($variableName, $quiet=false)
 Returns the value of $_SERVER[$variableName] if it is set.
static setAccessPath (array $path=array(), $name= 'undefined', $siteaccess=true)
 Set access path (parts of url that identifies siteaccess), used by eZSys::indexFile().
static setEnvironmentVariable ($variableName, $variableValue)
 Sets an environment variable for the current process/page view.
static setInstance (eZSys $instance=null)
 Sets eZSys instance or clears it if left undefined.
static setIsDebugEnabled ($debug)
 Sets whether internal debugging is enabled or not.
static setServerVariable ($variableName, $variableValue)
 Sets a server variable in the global array $_SERVER.
static siteDir ()
 Returns the path to where all the code resides.
static splitArgumentIntoElements ($argumentText)
 Splits $argumentText on boundaries formed by one or more spaces and save them into an array of separate arguments.
static storageDirectory ()
 Returns the current storage directory.
static varDirectory ()
 Returns the path of the current var directory.
static wwwDir ()
 Returns the relative directory path of the vhless setup.

Public Attributes

 $EnvSeparator
 $FileSeparator
 $FileSystemType
 $IndexFile
 $LineSeparator
 $OSType
 $RequestURI
 $RootDir
 $ShellEscapeCharacter
 $SiteDir
 $WWWDir

Static Protected Member Functions

static getValidwwwDir ($phpSelf, $scriptFileName, $index)
 Generate wwwdir from phpSelf if valid accoring to scriptFileName and return null if invalid and false if there is no index in phpSelf.
static simulateGlobBrace ($filenames)
 Expands a list of filenames like GLOB_BRACE does.

Protected Attributes

 $AccessPath
 $Params
 $QueryString

Static Protected Attributes

static $instance = null

Detailed Description

Definition at line 32 of file ezsys.php.


Constructor & Destructor Documentation

eZSys::__construct ( array $  serverParams = array())

Initialize the object with settings taken from the current script run.

Parameters:
array$serverParamsFor unit testing use, see first few lines for content

Definition at line 151 of file ezsys.php.


Member Function Documentation

eZSys::__get ( propertyName)

Magic function to get access readonly properties (protected)

Parameters:
string$propertyName
Returns:
mixed
Exceptions:
ezcBasePropertyNotFoundException

Definition at line 1168 of file ezsys.php.

eZSys::__isset ( propertyName)

Magic function to see if readonly properties (protected) exists.

Parameters:
string$propertyNameOption name to check for.
Returns:
bool Whether the option exists.

Definition at line 1183 of file ezsys.php.

static eZSys::addAccessPath ( path,
name = 'undefined',
siteaccess = true 
) [static]

Appends the access path (parts of url that identifies siteaccess), used by eZSys::indexFile() NOTE: Does not make sense to use for siteaccess, as you would want to clear current path and set new one normally, so preferably use eZSys::setAccessPath() in this case.

Parameters:
array | string$path
string$nameAn identifer of the name of the path provided $AccessPath
bool$siteaccessHints if path is siteaccess related or not, needed in case subsequesnt code suddenly changes siteaccess and needs to clear siteaccess scope

Definition at line 1107 of file ezsys.php.

eZSys::attribute ( attr)

Returns the attribute value for $attr or null if the attribute does not exist.

Parameters:
string$attr
Returns:
null|string

Definition at line 1066 of file ezsys.php.

Make sure that certain attribute keys are available in $this->Attributes.

Returns:
array

Definition at line 1038 of file ezsys.php.

Referenced by hasAttribute().

static eZSys::backupFilename ( ) [static]

Returns the backup filename for this platform.

Possible values: .bak (win32), ~ (unix, mac)

Returns:
string

Definition at line 554 of file ezsys.php.

Referenced by eZCodeTemplate\apply(), and eZINI\save().

static eZSys::clearAccessPath ( siteaccess = true) [static]

Clears the access path, used by eZSys::indexFile().

Parameters:
bool$siteaccess
Returns:
void

Definition at line 1153 of file ezsys.php.

Referenced by eZSiteAccess\change().

static eZSys::clientIP ( ) [static]

Returns the client IP whether he's behind a proxy or not.

Use [HTTPHeaderSettings].ClientIpByCustomHTTPHeader in site.ini if you want to use a custom http header such as X-Forwarded-For

Note: X-Forwarded-For is transformed by PHP into $_SERVER['HTTP_X_FORWARDED_FOR]

Returns:
string

Definition at line 792 of file ezsys.php.

Referenced by eZPaymentCallbackChecker\checkServerIP(), eZDebug\isAllowedByCurrentIP(), eZUser\isUserIPInList(), eZDebug\write(), eZAudit\writeAudit(), and eZDebug\writeFile().

static eZSys::createShellArgument ( argumentText,
array $  replaceList 
) [static]

Replaces % elements in $argumentText using $replaceList, and also properly escape the argument.

Parameters:
string$argumentText
array$replaceList
Returns:
string

Definition at line 393 of file ezsys.php.

Referenced by eZImageShellHandler\convert(), and eZImageHandler\convertFilterToText().

static eZSys::environmentVariable ( variableName,
quiet = false 
) [static]

Returns an environment variable or null if it is not available.

If the variable is not available, trigger an error message

Parameters:
string$variableName
bool$quiet
Returns:
null|string

Definition at line 997 of file ezsys.php.

Referenced by eZSetupTestFileUpload().

static eZSys::envSeparator ( ) [static]

Returns the string used as environment separator on the current system.

Returns:
string

Definition at line 574 of file ezsys.php.

Referenced by eZSetupCheckExecutable().

static eZSys::escapeShellArgument ( argument) [static]

Returns an escaped string to be used as a shell argument.

Parameters:
string$argument
Returns:
string

Definition at line 369 of file ezsys.php.

Referenced by eZImageShellHandler\convert().

static eZSys::fileSeparator ( ) [static]

Returns the string used as the file separator on the current system.

Returns:
string

Definition at line 279 of file ezsys.php.

Referenced by eZImageShellHandler\convert(), eZSetupPrvtAreDirAndFilesWritable(), eZDir\isWriteable(), and eZDir\separator().

static eZSys::filesystemType ( ) [static]

Returns the filesystem type.

Possible values: win32, unix

Returns:
string

Definition at line 269 of file ezsys.php.

Referenced by eZStepEmailSettings\display(), eZSetupCheckExecutable(), and eZStepEmailSettings\init().

static eZSys::getValidwwwDir ( phpSelf,
scriptFileName,
index 
) [static, protected]

Generate wwwdir from phpSelf if valid accoring to scriptFileName and return null if invalid and false if there is no index in phpSelf.

Parameters:
string$phpSelf
string$scriptFileName
string$index
Returns:
string|null|false String in form 'path/path2' if valid, null if not and false if $index is not part of phpself

Definition at line 1327 of file ezsys.php.

Referenced by init().

static eZSys::globBrace ( pattern,
flags = 0 
) [static]

Wraps around the built-in glob() function to provide same functionality for systems (e.g Solaris) that does not support GLOB_BRACE.

Parameters:
string$pattern
int$flags
Returns:
array

Definition at line 1439 of file ezsys.php.

Referenced by eZFS2FileHandler\fileDeleteByDirList(), eZFSFileHandler\fileDeleteByDirList(), and eZFSFileHandler\fileDeleteByWildcard().

eZSys::hasAttribute ( attr)

Checks if the attribute $attr is set.

Parameters:
string$attr
Returns:
bool

Definition at line 1055 of file ezsys.php.

static eZSys::hasEnvironmentVariable ( variableName) [static]

Checks if an environment variable is available.

Parameters:
string$variableName
Returns:
bool

Definition at line 1016 of file ezsys.php.

Referenced by eZSetupTestFileUpload().

static eZSys::hostname ( ) [static]

Returns the current hostname.

First tries to use X-Forward-Host before it goes on to use host in header, if none of them exists fallback to use host part of site.ini\[SiteSettings]|SiteURL setting.

Returns:
string

Definition at line 757 of file ezsys.php.

Referenced by eZHTTPTool\createRedirectUrl(), eZSiteInstaller\createSiteaccessUrls(), extension_path(), eZRSSExport\fetchImageURL(), eZUserOperationCollection\sendActivationEmail(), serverPort(), and serverURL().

static eZSys::indexFile ( withAccessPath = true) [static]

Returns the filepath for the index file with the access path appended.

Parameters:
bool$withAccessPath
Returns:
string

Definition at line 699 of file ezsys.php.

Referenced by attribute(), eZTemplateCompiler\compilationFilename(), eZNodeviewfunctions\generateViewCacheFile(), indexDir(), eZUser\instance(), and ezpLanguageSwitcher\process().

static eZSys::indexFileName ( ) [static]

Returns the filepath for the index file.

Returns:
string

Definition at line 744 of file ezsys.php.

Referenced by eZSiteInstaller\createSiteaccessUrls(), and eZStepSecurity\init().

static eZSys::init ( index = 'index.php',
forceVirtualHost = null 
) [static]

Initializes some variables according to some global PHP values.

This function should be called once in the index file with the parameters stated in the parameter list.

Parameters:
string$indexThe current index file, needed for virtual host mode detection.
bool$forceVirtualHostVirtual host mode is normally autodetected, but if not this can be forced by setting this to true.

Definition at line 1219 of file ezsys.php.

static eZSys::isDebugEnabled ( ) [static]

Returns true if debugging of internals is enabled, this will display which server variables are read.

Set the option with setIsDebugEnabled().

Deprecated:
Since 4.5, not used
Returns:
bool

Definition at line 1196 of file ezsys.php.

static eZSys::isPHPVersionSufficient ( requiredVersion) [static]

Checks if the given version is greater than or equal to the current PHP version.

Usage: eZSys::isPHPVersionSufficient( array( 4, 1, 0 ) );

Deprecated:
Since 4.5
Parameters:
array$requiredVersionMust be an array with version number
Returns:
bool

Definition at line 321 of file ezsys.php.

static eZSys::isShellExecution ( ) [static]

Determines if the current process has been started from the web or the shell.

Returns:
bool

Definition at line 344 of file ezsys.php.

Referenced by eZDebug\isAllowedByCurrentIP(), eZContentOperationCollection\publishNode(), and eZDBInterface\reportError().

static eZSys::isSSLNow ( ) [static]

Determines if SSL is enabled and protocol HTTPS is used.

Returns:
bool

Definition at line 826 of file ezsys.php.

Referenced by eZSSLZone\switchIfNeeded().

static eZSys::lineSeparator ( ) [static]

Returns the string used as line separator on the current system.

Returns:
string

Definition at line 564 of file ezsys.php.

Referenced by eZINI\save().

static eZSys::magickQuotes ( ) [static]

Should return true when magick quotes are enabled, but instead return null.

Deprecated:
since 4.5
Returns:
null

Definition at line 936 of file ezsys.php.

static eZSys::mergeArgumentElements ( array $  argumentElements) [static]

Merges an argument list created by eZSys::splitArgumentIntoElements() back into a text string.

Parameters:
array$argumentElements
Returns:
string

Definition at line 529 of file ezsys.php.

static eZSys::osName ( ) [static]

Returns the current OS name or false if it can not be determined.

Possible values: windows, linux, freebsd, darwin

Returns:
string|bool

Definition at line 257 of file ezsys.php.

static eZSys::path ( quiet = false) [static]

Returns the server's path string.

Parameters:
bool$quiet
Returns:
mixed|null

Definition at line 983 of file ezsys.php.

Referenced by cacheDirectory(), eZSetupCheckExecutable(), storageDirectory(), and varDirectory().

static eZSys::phpVersion ( ) [static]

Returns the PHP version as an array with the version elements.

Deprecated:
Since 4.5
Returns:
array

Definition at line 303 of file ezsys.php.

Referenced by isPHPVersionSufficient().

static eZSys::phpVersionText ( ) [static]

The PHP version as text.

Deprecated:
Since 4.5, use PHP_VERSION
Returns:
string

Definition at line 291 of file ezsys.php.

static eZSys::protocolSchema ( ) [static]

Returns the schema of the request.

Returns:
string

Definition at line 1420 of file ezsys.php.

static eZSys::queryString ( ) [static]

Returns the query string for the current request.

?param1=value1&param2=value2

Returns:
string

Definition at line 688 of file ezsys.php.

Referenced by eZURI\attribute(), and attribute().

static eZSys::removeMagicQuotes ( ) [static]

Removes magic quotes.

Deprecated:
Since 4.5, magic quotes setting has been deprecated in PHP 5.3
Returns:
void

Definition at line 223 of file ezsys.php.

Referenced by __construct(), and eZPaymentCallbackChecker\createDataFromPOST().

static eZSys::requestURI ( ) [static]

Returns the URI used for parsing modules, views and parameters.

May differ from $_SERVER['REQUEST_URI'].

Returns:
string

Definition at line 1368 of file ezsys.php.

Referenced by eZURI\instance(), eZUser\instance(), and eZSSLZone\switchIfNeeded().

static eZSys::rootDir ( ) [static]

Returns the absolute path to the eZ Publish root directory.

Returns:
string|null

Definition at line 628 of file ezsys.php.

Referenced by checkPaths(), eZSetupTestDirectoryPermissions(), and eZDir\recursiveDelete().

static eZSys::serverPort ( ) [static]

Returns the server port or 80 as default if the server port can not be retrieved from the hostname or the server variable 'SERVER_PORT'.

Returns:
int

Definition at line 905 of file ezsys.php.

Referenced by eZHTTPTool\createRedirectUrl(), and isSSLNow().

static eZSys::serverProtocol ( ) [static]

Returns the current server protocol depending on if SSL is enabled or not.

Returns:
string

Definition at line 861 of file ezsys.php.

Referenced by extension_path(), and ezpLanguageSwitcher\process().

static eZSys::serverURL ( ) [static]

Returns the server URL (protocol and hostname and port)

Returns:
string

Definition at line 874 of file ezsys.php.

static eZSys::serverVariable ( variableName,
quiet = false 
) [static]

Returns the value of $_SERVER[$variableName] if it is set.

If it isn't set, trigger an error message if $quiet is false

Parameters:
string$variableName
bool$quiet
Returns:
mixed|null

Definition at line 950 of file ezsys.php.

Referenced by clientIP(), eZPaymentCallbackChecker\createDataFromGET(), eZHTTPTool\createRedirectUrl(), hostname(), eZSiteAccess\match(), path(), eZDBInterface\reportError(), eZSiteAccess\siteAccessList(), eZSSLZone\switchIfNeeded(), eZDebug\write(), eZAudit\writeAudit(), and eZDebug\writeFile().

static eZSys::setAccessPath ( array $  path = array(),
name = 'undefined',
siteaccess = true 
) [static]

Set access path (parts of url that identifies siteaccess), used by eZSys::indexFile().

Parameters:
array$path
string$nameAn identifer of the name of the path provided $AccessPath
bool$siteaccessHints if path is siteaccess related or not, needed in case subsequesnt code suddenly changes siteaccess and needs to clear siteaccess scope

Definition at line 1139 of file ezsys.php.

Referenced by eZSiteAccess\change().

static eZSys::setEnvironmentVariable ( variableName,
variableValue 
) [static]

Sets an environment variable for the current process/page view.

Parameters:
string$variableName
mixed$variableValue
Returns:
void

Definition at line 1028 of file ezsys.php.

static eZSys::setInstance ( eZSys instance = null) [static]

Sets eZSys instance or clears it if left undefined.

Parameters:
eZSys$instance

Definition at line 1392 of file ezsys.php.

static eZSys::setIsDebugEnabled ( debug) [static]

Sets whether internal debugging is enabled or not.

Deprecated:
Since 4.5, has not effect anymore
Parameters:
bool$debug

Definition at line 1206 of file ezsys.php.

static eZSys::setServerVariable ( variableName,
variableValue 
) [static]

Sets a server variable in the global array $_SERVER.

Note: Variables are only set for the current process/page view

Parameters:
string$variableName
mixed$variableValue
Returns:
void

Definition at line 972 of file ezsys.php.

static eZSys::simulateGlobBrace ( filenames) [static, protected]

Expands a list of filenames like GLOB_BRACE does.

GLOB_BRACE is non POSIX and only available in GNU glibc. This is needed to support operating systems like Solars.

Parameters:
$filenames
Returns:
array

Definition at line 1471 of file ezsys.php.

Referenced by globBrace().

static eZSys::siteDir ( ) [static]

Returns the path to where all the code resides.

Returns:
string

Definition at line 653 of file ezsys.php.

Referenced by attribute().

static eZSys::splitArgumentIntoElements ( argumentText) [static]

Splits $argumentText on boundaries formed by one or more spaces and save them into an array of separate arguments.

The number of spaces between to arguments is inserted as an integer value between two argument values.

Example: $list = splitArgumentIntoElements( "-geometry 100x100" ); var_dump( $list ); // Output: array( "-geometry", 1, "100x100" );

You can then easily modify the elements separately and create the argument text with eZSys::mergeArgumentElements()

Parameters:
string$argumentText
Returns:
array

Definition at line 430 of file ezsys.php.


Member Data Documentation

eZSys::$AccessPath [protected]

Definition at line 79 of file ezsys.php.

eZSys::$EnvSeparator

Definition at line 53 of file ezsys.php.

eZSys::$FileSeparator

Definition at line 46 of file ezsys.php.

eZSys::$FileSystemType

Definition at line 107 of file ezsys.php.

eZSys::$IndexFile

Definition at line 93 of file ezsys.php.

Referenced by init().

eZSys::$instance = null [static, protected]
eZSys::$LineSeparator

Definition at line 39 of file ezsys.php.

eZSys::$OSType

Definition at line 121 of file ezsys.php.

eZSys::$Params [protected]

Definition at line 129 of file ezsys.php.

eZSys::$QueryString [protected]

Definition at line 144 of file ezsys.php.

eZSys::$RequestURI

Definition at line 100 of file ezsys.php.

eZSys::$RootDir

Definition at line 60 of file ezsys.php.

eZSys::$ShellEscapeCharacter

Definition at line 114 of file ezsys.php.

eZSys::$SiteDir

Definition at line 67 of file ezsys.php.

eZSys::$WWWDir

Definition at line 86 of file ezsys.php.


The documentation for this class was generated from the following file: