PHP Class FOF30\Platform\Joomla\Platform

This implements the platform class for Joomla! 3
Since: 2.1
Inheritance: extends FOF30\Platform\Base\Platform
Afficher le fichier Open project: akeeba/fof Class Usage Examples

Protected Properties

Свойство Type Description
$isAdmin Is this an administrator application?
$isCLI Is this a CLI application?

Méthodes publiques

Méthode Description
URIbase ( boolean $pathonly = false ) : string Returns the base URI for the request.
URIroot ( boolean $pathonly = false, string $path = null ) : string Returns the root URI for the request.
authorise ( string $action, string $assetname ) : boolean Perform an ACL check.
authorizeAdmin ( string $component ) : boolean Authorise access to the component in the back-end.
checkExecution ( ) : boolean Checks if the current script is run inside a valid CMS execution
clearCache ( ) : boolean Clears the cache of system-wide F0F data. You are supposed to call this in your components' installation script post-installation and post-upgrade methods or whenever you are modifying the structure of database tables accessed by F0F. Please note that F0F's cache never expires and is not purged by Joomla!. You MUST use this method to manually purge the cache.
closeApplication ( integer $code ) : void Immediately terminate the containing application's execution
getCache ( string $key, string $default = null ) : string Retrieves data from the cache. This is supposed to be used for system-side F0F data, not application data.
getComponentBaseDirs ( string $component ) : array Returns the base (root) directories for a given component.
getConfig ( ) : JRegistry Returns an object that holds the configuration of the current site.
getDate ( mixed $time = 'now', null $tzOffest = null, boolean $locale = true ) : JDate Returns an object to handle dates
getDbo ( ) : JDatabaseDriver Returns the database driver object of the CMS/application
getDocument ( ) : JDocument Returns the JDocument object which handles this component's response.
getLanguage ( ) : JLanguage Return the \JLanguage instance of the CMS/application
getPlatformBaseDirs ( ) : array Returns absolute path to directories used by the CMS.
getTemplate ( boolean | array $params = false ) : string Returns the application's template name
getTemplateOverridePath ( string $component, boolean $absolute = true ) : string Return the absolute path to the application's template overrides directory for a specific component. We will use it to look for template files instead of the regular component directories. If the application does not have such a thing as template overrides return an empty string.
getTemplateSuffixes ( ) : array Get application-specific suffixes to use with template paths. This allows you to look for view template overrides based on the application version.
getUser ( integer $id = null ) : JUser Return a user object.
getUserStateFromRequest ( string $key, string $request, Input $input, mixed $default = null, string $type = 'none', boolean $setUserState = true ) : mixed This method will try retrieving a variable from the request (input) data.
importPlugin ( string $type ) : void Load plugins of a specific type. Obviously this seems to only be required in the Joomla! CMS.
isBackend ( ) : boolean Is this the administrative section of the component?
isCli ( ) : boolean Is this a component running in a CLI application?
isFrontend ( ) : boolean Is this the public section of the component?
isGlobalF0FCacheEnabled ( ) : boolean Is the global F0F cache enabled?
loadTranslations ( string $component ) : void Load the translation files for a given component.
logAddLogger ( string $file ) : void Add a log file for FOF
logDebug ( string $message ) : void Adds a message to the application's debug log
logDeprecated ( string $message ) : void Logs a deprecated practice. In Joomla! this results in the $message being output in the deprecated log file, found in your site's log directory.
loginUser ( array $authInfo ) : boolean logs in a user
logoutUser ( ) : boolean logs out a user
raiseError ( integer $code, string $message ) : void Raises an error, using the logic requested by the CMS (PHP Exception or dedicated class)
runPlugins ( string $event, array $data ) : array Execute plugins (system-level triggers) and fetch back an array with their return values.
sendHeaders ( ) : void In platforms that perform header caching, send all headers.
setCache ( string $key, string $content ) : boolean Saves something to the cache. This is supposed to be used for system-wide F0F data, not application data.
setHeader ( string $name, string $value, boolean $replace = false ) : void Method to set a response header. If the replace flag is set then all headers with the given name will be replaced by the new one (only if the current platform supports header caching)
supportsAjaxOrdering ( ) : boolean Is AJAX re-ordering supported? This is 100% Joomla!-CMS specific. All other platforms should return false and never ask why.

Méthodes protégées

Méthode Description
isCliAdmin ( ) : array Main function to detect if we're running in a CLI environment and we're admin

Private Methods

Méthode Description
getCacheObject ( boolean $force = false ) : JRegistry Gets a reference to the cache object, loading it from the disk if needed.
saveCache ( ) : boolean Save the cache object back to disk

Method Details

URIbase() public méthode

Returns the base URI for the request.
public URIbase ( boolean $pathonly = false ) : string
$pathonly boolean If false, prepend the scheme, host and port information. Default is false.
Résultat string The base URI string

URIroot() public méthode

Returns the root URI for the request.
public URIroot ( boolean $pathonly = false, string $path = null ) : string
$pathonly boolean If false, prepend the scheme, host and port information. Default is false.
$path string The path
Résultat string The root URI string.

authorise() public méthode

Perform an ACL check.
See also: PlatformInterface::authorise()
public authorise ( string $action, string $assetname ) : boolean
$action string The ACL privilege to check, e.g. core.edit
$assetname string The asset name to check, typically the component's name
Résultat boolean True if the user is allowed this action

authorizeAdmin() public méthode

Authorise access to the component in the back-end.
See also: PlatformInterface::authorizeAdmin()
public authorizeAdmin ( string $component ) : boolean
$component string The name of the component.
Résultat boolean True to allow loading the component, false to halt loading

checkExecution() public méthode

Checks if the current script is run inside a valid CMS execution
See also: PlatformInterface::checkExecution()
public checkExecution ( ) : boolean
Résultat boolean

clearCache() public méthode

Clears the cache of system-wide F0F data. You are supposed to call this in your components' installation script post-installation and post-upgrade methods or whenever you are modifying the structure of database tables accessed by F0F. Please note that F0F's cache never expires and is not purged by Joomla!. You MUST use this method to manually purge the cache.
public clearCache ( ) : boolean
Résultat boolean True on success

closeApplication() public méthode

Immediately terminate the containing application's execution
public closeApplication ( integer $code ) : void
$code integer The result code which should be returned by the application
Résultat void

getCache() public méthode

Retrieves data from the cache. This is supposed to be used for system-side F0F data, not application data.
public getCache ( string $key, string $default = null ) : string
$key string The key of the data to retrieve
$default string The default value to return if the key is not found or the cache is not populated
Résultat string The cached value

getComponentBaseDirs() public méthode

Returns the base (root) directories for a given component.
See also: PlatformInterface::getComponentBaseDirs()
public getComponentBaseDirs ( string $component ) : array
$component string The name of the component. For Joomla! this is something like "com_example"
Résultat array A hash array with keys main, alt, site and admin.

getConfig() public méthode

Returns an object that holds the configuration of the current site.
public getConfig ( ) : JRegistry
Résultat JRegistry

getDate() public méthode

Returns an object to handle dates
public getDate ( mixed $time = 'now', null $tzOffest = null, boolean $locale = true ) : JDate
$time mixed The initial time
$tzOffest null The timezone offset
$locale boolean Should I try to load a specific class for current language?
Résultat JDate object

getDbo() public méthode

Returns the database driver object of the CMS/application
public getDbo ( ) : JDatabaseDriver
Résultat JDatabaseDriver

getDocument() public méthode

Returns the JDocument object which handles this component's response.
See also: PlatformInterface::getDocument()
public getDocument ( ) : JDocument
Résultat JDocument

getLanguage() public méthode

Return the \JLanguage instance of the CMS/application
public getLanguage ( ) : JLanguage
Résultat JLanguage

getPlatformBaseDirs() public méthode

Returns absolute path to directories used by the CMS.
See also: PlatformInterface::getPlatformBaseDirs()
public getPlatformBaseDirs ( ) : array
Résultat array A hash array with keys root, public, admin, tmp and log.

getTemplate() public méthode

Returns the application's template name
public getTemplate ( boolean | array $params = false ) : string
$params boolean | array An optional associative array of configuration settings
Résultat string The template name. System is the fallback.

getTemplateOverridePath() public méthode

Return the absolute path to the application's template overrides directory for a specific component. We will use it to look for template files instead of the regular component directories. If the application does not have such a thing as template overrides return an empty string.
public getTemplateOverridePath ( string $component, boolean $absolute = true ) : string
$component string The name of the component for which to fetch the overrides
$absolute boolean Should I return an absolute or relative path?
Résultat string The path to the template overrides directory

getTemplateSuffixes() public méthode

Get application-specific suffixes to use with template paths. This allows you to look for view template overrides based on the application version.
public getTemplateSuffixes ( ) : array
Résultat array A plain array of suffixes to try in template names

getUser() public méthode

Return a user object.
See also: PlatformInterface::getUser()
public getUser ( integer $id = null ) : JUser
$id integer The user ID to load. Skip or use null to retrieve the object for the currently logged in user.
Résultat JUser The JUser object for the specified user

getUserStateFromRequest() public méthode

This method will try retrieving a variable from the request (input) data.
See also: PlatformInterface::getUserStateFromRequest()
public getUserStateFromRequest ( string $key, string $request, Input $input, mixed $default = null, string $type = 'none', boolean $setUserState = true ) : mixed
$key string The user state key for the variable
$request string The request variable name for the variable
$input FOF30\Input\Input The Input object with the request (input) data
$default mixed The default value. Default: null
$type string The filter type for the variable data. Default: none (no filtering)
$setUserState boolean Should I set the user state with the fetched value?
Résultat mixed The value of the variable

importPlugin() public méthode

Load plugins of a specific type. Obviously this seems to only be required in the Joomla! CMS.
See also: PlatformInterface::importPlugin()
public importPlugin ( string $type ) : void
$type string The type of the plugins to be loaded
Résultat void

isBackend() public méthode

Is this the administrative section of the component?
See also: PlatformInterface::isBackend()
public isBackend ( ) : boolean
Résultat boolean

isCli() public méthode

Is this a component running in a CLI application?
See also: PlatformInterface::isCli()
public isCli ( ) : boolean
Résultat boolean

isCliAdmin() protected méthode

Main function to detect if we're running in a CLI environment and we're admin
protected isCliAdmin ( ) : array
Résultat array isCLI and isAdmin. It's not an associative array, so we can use list.

isFrontend() public méthode

Is this the public section of the component?
See also: PlatformInterface::isFrontend()
public isFrontend ( ) : boolean
Résultat boolean

isGlobalF0FCacheEnabled() public méthode

Is the global F0F cache enabled?
public isGlobalF0FCacheEnabled ( ) : boolean
Résultat boolean

loadTranslations() public méthode

Load the translation files for a given component.
See also: PlatformInterface::loadTranslations()
public loadTranslations ( string $component ) : void
$component string The name of the component. For Joomla! this is something like "com_example"
Résultat void

logAddLogger() public méthode

Add a log file for FOF
public logAddLogger ( string $file ) : void
$file string
Résultat void

logDebug() public méthode

Adds a message to the application's debug log
public logDebug ( string $message ) : void
$message string
Résultat void

logDeprecated() public méthode

Logs a deprecated practice. In Joomla! this results in the $message being output in the deprecated log file, found in your site's log directory.
public logDeprecated ( string $message ) : void
$message string The deprecated practice log message
Résultat void

loginUser() public méthode

logs in a user
public loginUser ( array $authInfo ) : boolean
$authInfo array authentification information
Résultat boolean True on success

logoutUser() public méthode

logs out a user
public logoutUser ( ) : boolean
Résultat boolean True on success

raiseError() public méthode

Raises an error, using the logic requested by the CMS (PHP Exception or dedicated class)
public raiseError ( integer $code, string $message ) : void
$code integer
$message string
Résultat void

runPlugins() public méthode

Execute plugins (system-level triggers) and fetch back an array with their return values.
See also: PlatformInterface::runPlugins()
public runPlugins ( string $event, array $data ) : array
$event string The event (trigger) name, e.g. onBeforeScratchMyEar
$data array A hash array of data sent to the plugins as part of the trigger
Résultat array A simple array containing the results of the plugins triggered

sendHeaders() public méthode

In platforms that perform header caching, send all headers.
public sendHeaders ( ) : void
Résultat void

setCache() public méthode

Saves something to the cache. This is supposed to be used for system-wide F0F data, not application data.
public setCache ( string $key, string $content ) : boolean
$key string The key of the data to save
$content string The actual data to save
Résultat boolean True on success

setHeader() public méthode

Method to set a response header. If the replace flag is set then all headers with the given name will be replaced by the new one (only if the current platform supports header caching)
public setHeader ( string $name, string $value, boolean $replace = false ) : void
$name string The name of the header to set.
$value string The value of the header to set.
$replace boolean True to replace any headers with the same name.
Résultat void

supportsAjaxOrdering() public méthode

Is AJAX re-ordering supported? This is 100% Joomla!-CMS specific. All other platforms should return false and never ask why.
See also: PlatformInterface::supportsAjaxOrdering()
public supportsAjaxOrdering ( ) : boolean
Résultat boolean

Property Details

$isAdmin protected_oe static_oe property

Is this an administrator application?
protected static $isAdmin

$isCLI protected_oe static_oe property

Is this a CLI application?
protected static $isCLI