WebApp
- Type
- Class
- Namespace
- Craft
- Inherits
- Craft\WebApp » CWebApplication (opens new window) » CApplication (opens new window) » CModule (opens new window) » CComponent (opens new window)
- Since
- 1.0
See also http://craftcms.com
View source (opens new window)
# Public Properties
# $componentAliases
Signature
public array $componentAliases = null
# $sourceLanguage
Signature
public string $sourceLanguage = 'en_us'
# Public Methods
Method | Description |
---|---|
__call() (opens new window) | Calls the named method which is not a class method. |
__construct() (opens new window) | Constructor. |
__get() (opens new window) | Returns a property value, an event handler list or a behavior based on its name. |
__isset() (opens new window) | Checks if a property value is null. |
__set() (opens new window) | Sets value of a component property. |
__unset() (opens new window) | Sets a component property to be null. |
afterControllerAction() (opens new window) | The post-filter for controller actions. |
asa() (opens new window) | Returns the named behavior object. |
attachBehavior() (opens new window) | Attaches a behavior to this component. |
attachBehaviors() (opens new window) | Attaches a list of behaviors to the component. |
attachEventHandler() (opens new window) | Attaches an event handler to an event. |
beforeControllerAction() (opens new window) | The pre-filter for controller actions. |
canGetProperty() (opens new window) | Determines whether a property can be read. |
canSetProperty() (opens new window) | Determines whether a property can be set. |
clearGlobalState() (opens new window) | Clears a global value. |
configure() (opens new window) | Configures the module with the specified configuration. |
createAbsoluteUrl() (opens new window) | Creates an absolute URL based on the given controller and action information. |
createController() | Creates a controller instance based on a route. |
createUrl() (opens new window) | Creates a relative URL based on the given controller and action information. |
detachBehavior() (opens new window) | Detaches a behavior from the component. |
detachBehaviors() (opens new window) | Detaches all behaviors from the component. |
detachEventHandler() (opens new window) | Detaches an existing event handler. |
disableBehavior() (opens new window) | Disables an attached behavior. |
disableBehaviors() (opens new window) | Disables all behaviors attached to this component. |
displayError() (opens new window) | Displays the captured PHP error. |
displayException() (opens new window) | Displays the uncaught PHP exception. |
enableBehavior() (opens new window) | Enables an attached behavior. |
enableBehaviors() (opens new window) | Enables all behaviors attached to this component. |
end() (opens new window) | Terminates the application. |
evaluateExpression() (opens new window) | Evaluates a PHP expression or callback under the context of this component. |
findLocalizedFile() (opens new window) | Returns the localized version of a specified file. |
findModule() (opens new window) | Do not call this method. This method is used internally to search for a module by its ID. |
getAssetManager() (opens new window) | |
getAuthManager() (opens new window) | |
getBasePath() (opens new window) | Returns the root path of the application. |
getBaseUrl() (opens new window) | Returns the relative URL for the application. |
getCache() (opens new window) | Returns the cache component. |
getClientScript() (opens new window) | Returns the client script manager. |
getComponent() | Override getComponent() so we can attach any pending events if the component is getting initialized as well as do some special logic around creating the craft()->db application component. |
getComponents() (opens new window) | Returns the application components. |
getController() (opens new window) | |
getControllerPath() (opens new window) | |
getCoreMessages() (opens new window) | Returns the core message translations component. |
getDateFormatter() (opens new window) | Returns the locale-dependent date formatter. |
getDb() (opens new window) | Returns the database connection component. |
getErrorHandler() (opens new window) | Returns the error handler component. |
getEventHandlers() (opens new window) | Returns the list of attached event handlers for an event. |
getExtensionPath() (opens new window) | Returns the root directory that holds all third-party extensions. |
getFormat() (opens new window) | Returns the formatter component. |
getGlobalState() (opens new window) | Returns a global value. |
getHomeUrl() (opens new window) | |
getId() (opens new window) | Returns the unique identifier for the application. |
getLanguage() | Returns the target application language. |
getLayoutPath() (opens new window) | |
getLocale() | Returns the localization data for a given locale. |
getLocaleDataPath() (opens new window) | Returns the directory that contains the locale data. |
getMessages() (opens new window) | Returns the application message translations component. |
getModule() (opens new window) | Retrieves the named application module. |
getModulePath() (opens new window) | Returns the directory that contains the application modules. |
getModules() (opens new window) | Returns the configuration of the currently installed modules. |
getNumberFormatter() (opens new window) | |
getParams() (opens new window) | Returns user-defined parameters. |
getParentModule() (opens new window) | Returns the parent module. |
getRequest() (opens new window) | Returns the request component. |
getRuntimePath() (opens new window) | Returns the directory that stores runtime files. |
getSecurityManager() (opens new window) | Returns the security manager component. |
getSession() | Returns the {@link HttpSessionService} (craft()->httpSession). |
getStatePersister() (opens new window) | Returns the state persister component. |
getSystemViewPath() (opens new window) | |
getTheme() (opens new window) | |
getThemeManager() (opens new window) | |
getTimeZone() | Returns the system time zone. Note that this method cannot be in {@link AppBehavior}, because Yii will check {@link \CApplication::getTimeZone()} instead. |
getTranslatedBrowserLanguage() | Tries to find a match between the browser's preferred locales and the locales Craft has been translated into. |
getUrlManager() (opens new window) | Returns the URL manager component. |
getUser() | Returns the {@link UserSessionService} (craft()->userSession). |
getViewPath() (opens new window) | |
getViewRenderer() (opens new window) | Returns the view renderer. |
getWidgetFactory() (opens new window) | Returns the widget factory. |
handleError() | |
handleException() (opens new window) | Handles uncaught PHP exceptions. |
hasComponent() (opens new window) | Checks whether the named component exists. |
hasEvent() (opens new window) | Determines whether an event is defined. |
hasEventHandler() (opens new window) | Checks whether the named event has attached handlers. |
hasModule() (opens new window) | Returns a value indicating whether the specified module is installed. |
hasProperty() (opens new window) | Determines whether a property is defined. |
init() | Initializes the application. |
isConsole() | Returns whether we are executing in the context on a console app. |
loadGlobalState() (opens new window) | Loads the global state data from persistent storage. |
on() | Attaches an event handler, or remembers it for later if the component has not been initialized yet. |
onBeginRequest() (opens new window) | Raised right BEFORE the application processes the request. |
onEditionChange() | Fires an onEditionChange event. |
onEndRequest() | Raised right AFTER the application processes the request. |
onError() (opens new window) | Raised when a PHP execution error occurs. |
onException() (opens new window) | Raised when an uncaught PHP exception occurs. |
processRequest() | Processes the request. |
raiseEvent() (opens new window) | Raises an event. |
returnAjaxError() | Formats a PHP error into JSON before returning it to the client. |
returnAjaxException() | Formats an exception into JSON before returning it to the client. |
run() (opens new window) | Runs the application. |
runController() (opens new window) | Creates the controller and performs the specified action. |
saveGlobalState() (opens new window) | Saves the global state data into persistent storage. |
setAliases() (opens new window) | Defines the root aliases. |
setBasePath() (opens new window) | Sets the root directory of the application. |
setComponent() | Override setComponent so we can attach any pending events. |
setComponents() | Sets the application components. |
setController() (opens new window) | |
setControllerPath() (opens new window) | |
setExtensionPath() (opens new window) | Sets the root directory that holds all third-party extensions. |
setGlobalState() (opens new window) | Sets a global value. |
setHomeUrl() (opens new window) | |
setId() (opens new window) | Sets the unique identifier for the application. |
setImport() (opens new window) | Sets the aliases that are used in the module. |
setLanguage() | Sets the target application language. |
setLayoutPath() (opens new window) | |
setLocaleDataPath() (opens new window) | Sets the directory that contains the locale data. |
setModulePath() (opens new window) | Sets the directory that contains the application modules. |
setModules() (opens new window) | Configures the sub-modules of this module. |
setParams() (opens new window) | Sets user-defined parameters. |
setRuntimePath() (opens new window) | Sets the directory that stores runtime files. |
setSystemViewPath() (opens new window) | |
setTheme() (opens new window) | |
setTimeZone() (opens new window) | Sets the time zone used by this application. |
setViewPath() (opens new window) |
# createController()
Creates a controller instance based on a route.
View source (opens new window)
Arguments
$route
(string (opens new window))$owner
(mixed
)
Returns
Signature
public array, null createController ( $route, $owner = null )
# getComponent()
Override getComponent() so we can attach any pending events if the component is getting initialized as well as
do some special logic around creating the craft()->db
application component.
View source (opens new window)
Arguments
$id
(string (opens new window))$createIfNull
(boolean (opens new window))
Returns
mixed
Signature
public mixed getComponent ( $id, $createIfNull = true )
# getLanguage()
Signature
public string getLanguage ( )
# getLocale()
Returns the localization data for a given locale.
View source (opens new window)
Arguments
$localeId
(string (opens new window))
Returns
Signature
public Craft\LocaleData getLocale ( $localeId = null )
# getSession()
Returns the {@link HttpSessionService} (craft()->httpSession).
View source (opens new window)
Returns
Signature
public Craft\HttpSessionService getSession ( )
# getTimeZone()
Returns the system time zone. Note that this method cannot be in {@link AppBehavior}, because Yii will check {@link \CApplication::getTimeZone()} instead.
View source (opens new window)
Returns
Signature
public string getTimeZone ( )
# getTranslatedBrowserLanguage()
Tries to find a match between the browser's preferred locales and the locales Craft has been translated into.
View source (opens new window)
Returns
Signature
public string getTranslatedBrowserLanguage ( )
# getUser()
Returns the {@link UserSessionService} (craft()->userSession).
View source (opens new window)
Returns
Signature
public Craft\UserSessionService getUser ( )
# handleError()
View source (opens new window)
Arguments
$code
(integer (opens new window)) – The level of the error raised.$message
(string (opens new window)) – The error message.$file
(string (opens new window)) – The filename that the error was raised in.$line
(integer (opens new window)) – The line number the error was raised at.
Signature
public void handleError ( $code, $message, $file, $line )
# init()
Signature
public null init ( )
# isConsole()
Returns whether we are executing in the context on a console app.
View source (opens new window)
Returns
Signature
public boolean isConsole ( )
# on()
Attaches an event handler, or remembers it for later if the component has not been initialized yet.
The event should be identified in a serviceHandle.eventName
format. For example, if you want to add an event
handler for {@link EntriesService::onSaveEntry()}, you would do this:
craft()->on('entries.saveEntry', function(Event $event) {
// ...
});
Note that the actual event name (saveEntry
) does not need to include the “on
”.
By default, event handlers will not get attached if Craft is current in the middle of updating itself or a
plugin. If you want the event to fire even in that condition, pass true
to the $evenDuringUpdates argument.
View source (opens new window)
Arguments
$event
(string (opens new window)) – The event to listen for.$handler
(mixed
) – The event handler.$evenDuringUpdates
(boolean (opens new window)) – Whether the event handler should be attached when Craft’s updater is running. Default isfalse
.
Returns
Signature
public null on ( $event, $handler, $evenDuringUpdates = false )
# onEditionChange()
Fires an onEditionChange event.
View source (opens new window)
Arguments
$event
(Craft\Event)
Throws
Signature
public void onEditionChange ( Craft\Event $event )
# onEndRequest()
Raised right AFTER the application processes the request.
View source (opens new window)
Arguments
$event
(CEvent (opens new window)) – The event parameter.
Signature
public void onEndRequest ( $event )
# processRequest()
Signature
public null processRequest ( )
# returnAjaxError()
Formats a PHP error into JSON before returning it to the client.
View source (opens new window)
Arguments
$code
(integer (opens new window)) – The error code.$message
(string (opens new window)) – The error message.$file
(string (opens new window)) – The error file.$line
(string (opens new window)) – The error line.
Returns
Signature
public null returnAjaxError ( $code, $message, $file, $line )
# returnAjaxException()
Formats an exception into JSON before returning it to the client.
View source (opens new window)
Arguments
$data
(array (opens new window))
Returns
Signature
public null returnAjaxException ( $data )
# setComponent()
Override setComponent so we can attach any pending events.
View source (opens new window)
Arguments
$id
(string (opens new window))$component
(mixed
)$merge
(boolean (opens new window))
Returns
Signature
public null setComponent ( $id, $component, $merge = true )
# setComponents()
Sets the application components.
View source (opens new window)
Arguments
$components
$merge
(boolean (opens new window))
Returns
Signature
public null setComponents ( $components, $merge = true )
# setLanguage()
Sets the target application language.
View source (opens new window)
Arguments
$language
(string (opens new window))
Returns
Signature
public null setLanguage ( $language )
# Protected Methods
Method | Description |
---|---|
initSystemHandlers() (opens new window) | Initializes the error handlers. |
parseActionParams() (opens new window) | Parses a path info into an action ID and GET variables. |
preinit() (opens new window) | Preinitializes the module. |
preloadComponents() (opens new window) | Loads static application components. |
registerCoreComponents() (opens new window) | Registers the core application components. |