Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,075 of 9,075 pages
About the help in other languages
All help pages

eZSys and eZExtension

Paths and the environment with eZSys (varDirectory, cacheDirectory, serverURL, isShellExecution) and active extensions with eZExtension (activeExtensions, expandedPathList, getHandlerClass).

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-8-reference/ezsys-and-ezextension.md

On this page

eZSys and eZExtension

Part 8, reference 11. Two helper classes every extension sooner or later needs: eZSys (lib/ezutils/classes/ezsys.php) knows where things are and how the request came in; eZExtension (lib/ezutils/classes/ezextension.php) knows which extensions are active and where they live.

eZSys: paths

All static:

MethodReturns (on a typical installation)
varDirectory()the site's var directory, e.g. var/site
cacheDirectory()its cache directory, e.g. var/site/cache
storageDirectory()its storage directory (uploaded files)
rootDir()the installation's root directory
wwwDir(), indexDir(), indexFile()the web paths of the installation
siteDir()the site directory

Never write paths such as var/site/cache into code: the var directory is a setting and differs per installation.

<?php
$dir = eZSys::cacheDirectory() . '/myext';
eZDir::mkdir( $dir, false, true );

eZSys: the request

MethodReturns
isShellExecution()true on the command line
serverURL()scheme and host of the current request
hostname()the host name
isSSLNow()whether the request came over HTTPS (trusting configured proxies)
clientIP()the client's address (trusting configured proxies)
serverVariable( $variableName, $quiet = false )a $_SERVER value
osType(), fileSeparator()the operating system

Behind a reverse proxy, isSSLNow() and clientIP() depend on the trusted proxy settings (Trusted proxies).

eZExtension

Method (static)Returns
activeExtensions( $extensionType = false, $siteINI = null )the names of the active extensions, in load order
baseDirectory( $siteINI = null )the extension directory, usually extension
expandedPathList( $extensionList, $subdirectory = false )each extension's path, optionally with a subdirectory appended
extensionInfo( $extension )the extension's metadata (name, version, copyright, license, info URL)
nameFromPath( $path )the extension a path belongs to
getHandlerClass( ezpExtensionOptions $options )an object of the class an INI setting names
<?php
if ( in_array( 'ezjscore', eZExtension::activeExtensions() ) )
{
    // ezjscore is there: use its packer keys
}
$settingsDirs = eZExtension::expandedPathList( array( 'myext' ), 'settings' );   // array( 'extension/myext/settings' )

Run on a demo installation, activeExtensions() returned 62 names and expandedPathList( array( 'ezjscore' ), 'settings' ) returned extension/ezjscore/settings. For richer metadata (about page data), the kernel's expInfo class reads extension.xml and ezinfo.php together (Extension metadata specification).

getHandlerClass() and the options it takes are explained, with the mail transport as example, in Handlers named by settings.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x