PathService

Type
Class
Namespace
Craft
Inherits
Craft\PathService » Craft\BaseApplicationComponent » CApplicationComponent » CComponent
Implements
IApplicationComponent
Since
1.0

PathService provides APIs for getting server paths that are used by Craft.

An instance of PathService is globally accessible in Craft via {@link WebApp::path craft()->path}.

See also http://craftcms.com

View source

Public Properties

PropertyDescription
$behaviorsarray – The behaviors that should be attached to this component.

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__get()Returns a property value, an event handler list or a behavior based on its name.
__isset()Checks if a property value is null.
__set()Sets value of a component property.
__unset()Sets a component property to be null.
asa()Returns the named behavior object.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
attachEventHandler()Attaches an event handler to an event.
canGetProperty()Determines whether a property can be read.
canSetProperty()Determines whether a property can be set.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
detachEventHandler()Detaches an existing event handler.
disableBehavior()Disables an attached behavior.
disableBehaviors()Disables all behaviors attached to this component.
enableBehavior()Enables an attached behavior.
enableBehaviors()Enables all behaviors attached to this component.
evaluateExpression()Evaluates a PHP expression or callback under the context of this component.
getAppPath()Returns the path to the craft/app/ folder.
getAssetsIconsPath()Returns the path to the craft/storage/runtime/assets/icons/ folder.
getAssetsImageSourcePath()Returns the path to the craft/storage/runtime/assets/sources/ folder.
getAssetsPath()Returns the path to the craft/storage/runtime/assets/ folder.
getAssetsTempSourcePath()Returns the path to the craft/storage/runtime/assets/tempuploads/ folder.
getAssetsThumbsPath()Returns the path to the craft/storage/runtime/assets/thumbs/ folder.
getCachePath()Returns the path to the file cache folder.
getCompiledTemplatesPath()Returns the path to the craft/storage/runtime/compiled_templates/ folder.
getConfigPath()Retursn the path to the craft/config/ folder.
getCpTemplatesPath()Returns the path to the craft/app/templates/ folder.
getCpTranslationsPath()Returns the path to the craft/app/translations/ folder.
getDbBackupPath()Returns the path to the craft/storage/backups/ folder.
getEventHandlers()Returns the list of attached event handlers for an event.
getFrameworkPath()Returns the path to the framework/ folder.
getIsInitialized()Checks if this application component has been initialized.
getLibPath()Returns the path to the craft/app/lib/ folder.
getLicenseKeyPath()Returns the path to craft/config/license.key.
getLogPath()Returns the path to the craft/storage/runtime/logs/ folder.
getMigrationsPath()Returns the path to the craft/app/migrations/ folder, or the path to a plugin’s migrations/ folder.
getPluginIconsPath()Returns the path to the craft/storage/runtime/pluginicons/ folder.
getPluginsPath()Returns the path to the craft/plugins/ folder.
getRebrandPath()Returns the path to the craft/storage/rebrand/ folder.
getResourcesPath()Returns the path to the craft/app/resources/ folder.
getRuntimePath()Returns the path to the craft/storage/runtime/ folder.
getSessionPath()Returns the path to the craft/storage/runtime/sessions/ folder.
getSiteTemplatesPath()Returns the path to the craft/templates/ folder.
getSiteTranslationsPath()Returns the path to the craft/translations/ folder.
getStatePath()Returns the path to the craft/storage/runtime/state/ folder.
getStoragePath()Returns the path to the craft/storage/ folder.
getTempPath()Returns the path to the craft/storage/runtime/temp/ folder.
getTempUploadsPath()Returns the path to the craft/storage/runtime/temp/uploads/ folder.
getTemplatesPath()Returns the current templates path, taking into account whether this is a CP or Site request.
getUserPhotosPath()Returns the path to the craft/storage/userphotos/ folder.
getVendorPath()Returns the path to the vendor/ folder.
hasEvent()Determines whether an event is defined.
hasEventHandler()Checks whether the named event has attached handlers.
hasProperty()Determines whether a property is defined.
init()Initializes the application component.
isInitialized()Checks if this application component has been initialized yet, or not.
raiseEvent()Raises an event.
setTemplatesPath()Sets the current templates path.

getAppPath()

Returns the path to the craft/app/ folder.

View source

Returns

string – The path to the craft/app/ folder.

Signature

public string getAppPath ( )

getAssetsIconsPath()

Returns the path to the craft/storage/runtime/assets/icons/ folder.

View source

Returns

string – The path to the craft/storage/runtime/assets/icons/ folder.

Signature

public string getAssetsIconsPath ( )

getAssetsImageSourcePath()

Returns the path to the craft/storage/runtime/assets/sources/ folder.

View source

Returns

string – The path to the craft/storage/runtime/assets/sources/ folder.

Signature

public string getAssetsImageSourcePath ( )

getAssetsPath()

Returns the path to the craft/storage/runtime/assets/ folder.

View source

Returns

string – The path to the craft/storage/runtime/assets/ folder.

Signature

public string getAssetsPath ( )

getAssetsTempSourcePath()

Returns the path to the craft/storage/runtime/assets/tempuploads/ folder.

View source

Returns

string – The path to the craft/storage/runtime/assets/tempuploads/ folder.

Signature

public string getAssetsTempSourcePath ( )

getAssetsThumbsPath()

Returns the path to the craft/storage/runtime/assets/thumbs/ folder.

View source

Returns

string – The path to the craft/storage/runtime/assets/thumbs/ folder.

Signature

public string getAssetsThumbsPath ( )

getCachePath()

Returns the path to the file cache folder. This will be located at craft/storage/runtime/cache/ by default, but that can be overridden with the 'cachePath' config setting in craft/config/filecache.php.

View source

Returns

string – The path to the file cache folder.

Signature

public string getCachePath ( )

getCompiledTemplatesPath()

Returns the path to the craft/storage/runtime/compiled_templates/ folder.

View source

Returns

string – The path to the craft/storage/runtime/compiled_templates/ folder.

Signature

public string getCompiledTemplatesPath ( )

getConfigPath()

Retursn the path to the craft/config/ folder.

View source

Returns

string – The path to the craft/config/ folder.

Signature

public string getConfigPath ( )

getCpTemplatesPath()

Returns the path to the craft/app/templates/ folder.

View source

Returns

string – The path to the craft/app/templates/ folder.

Signature

public string getCpTemplatesPath ( )

getCpTranslationsPath()

Returns the path to the craft/app/translations/ folder.

View source

Returns

string – The path to the craft/app/translations/ folder.

Signature

public string getCpTranslationsPath ( )

getDbBackupPath()

Returns the path to the craft/storage/backups/ folder.

View source

Returns

string – The path to the craft/storage/backups/ folder.

Signature

public string getDbBackupPath ( )

getFrameworkPath()

Returns the path to the framework/ folder.

View source

Returns

string – The path to the framework/ folder.

Signature

public string getFrameworkPath ( )

getLibPath()

Returns the path to the craft/app/lib/ folder.

View source

Returns

string – The path to the craft/app/lib/ folder.

Signature

public string getLibPath ( )

getLicenseKeyPath()

Returns the path to craft/config/license.key.

View source

Returns

string – The path to craft/config/license.key.

Signature

public string getLicenseKeyPath ( )

getLogPath()

Returns the path to the craft/storage/runtime/logs/ folder.

View source

Returns

string – The path to the craft/storage/runtime/logs/ folder.

Signature

public string getLogPath ( )

getMigrationsPath()

Returns the path to the craft/app/migrations/ folder, or the path to a plugin’s migrations/ folder.

View source

Arguments

  • $pluginHandle (string) – The plugin handle whose migrations/ folder should be returned. Defaults to null.

Returns

string – The path to the migrations/ folder.

Signature

public string getMigrationsPath ( $pluginHandle = null )

getPluginIconsPath()

Returns the path to the craft/storage/runtime/pluginicons/ folder.

View source

Returns

string – The path to the craft/storage/runtime/pluginicons/ folder.

Signature

public string getPluginIconsPath ( )

getPluginsPath()

Returns the path to the craft/plugins/ folder.

View source

Returns

string – The path to the craft/plugins/ folder.

Signature

public string getPluginsPath ( )

getRebrandPath()

Returns the path to the craft/storage/rebrand/ folder.

View source

Returns

string

Signature

public string getRebrandPath ( )

getResourcesPath()

Returns the path to the craft/app/resources/ folder.

View source

Returns

string – The path to the craft/app/resources/ folder.

Signature

public string getResourcesPath ( )

getRuntimePath()

Returns the path to the craft/storage/runtime/ folder.

View source

Returns

string – The path to the craft/storage/runtime/ folder.

Signature

public string getRuntimePath ( )

getSessionPath()

Returns the path to the craft/storage/runtime/sessions/ folder.

View source

Returns

string – The path to the craft/storage/runtime/sessions/ folder.

Signature

public string getSessionPath ( )

getSiteTemplatesPath()

Returns the path to the craft/templates/ folder.

View source

Returns

string – The path to the craft/templates/ folder.

Signature

public string getSiteTemplatesPath ( )

getSiteTranslationsPath()

Returns the path to the craft/translations/ folder.

View source

Returns

string – The path to the craft/translations/ folder.

Signature

public string getSiteTranslationsPath ( )

getStatePath()

Returns the path to the craft/storage/runtime/state/ folder.

View source

Returns

string – The path to the craft/storage/runtime/state/ folder.

Signature

public string getStatePath ( )

getStoragePath()

Returns the path to the craft/storage/ folder.

View source

Returns

string – The path to the craft/storage/ folder.

Signature

public string getStoragePath ( )

getTempPath()

Returns the path to the craft/storage/runtime/temp/ folder.

View source

Returns

string – The path to the craft/storage/runtime/temp/ folder.

Signature

public string getTempPath ( )

getTempUploadsPath()

Returns the path to the craft/storage/runtime/temp/uploads/ folder.

View source

Returns

string – The path to the craft/storage/runtime/temp/uploads/ folder.

Signature

public string getTempUploadsPath ( )

getTemplatesPath()

DEPRECATED

Deprecated Deprecated in 2.6.2778. Use TemplatesService::getTemplatesPath() or TemplatesService::getTemplateMode() instead.

Returns the current templates path, taking into account whether this is a CP or Site request.

View source

Returns

string – The templates path.

Signature

public string getTemplatesPath ( )

getUserPhotosPath()

Returns the path to the craft/storage/userphotos/ folder.

View source

Returns

string – The path to the craft/storage/userphotos/ folder.

Signature

public string getUserPhotosPath ( )

getVendorPath()

Returns the path to the vendor/ folder.

View source

Returns

string – The path to the vendor/ folder.

Signature

public string getVendorPath ( )

setTemplatesPath()

DEPRECATED

Deprecated Deprecated in 2.6.2778. Use TemplatesService::setTemplatesPath() or TemplatesService::setTemplateMode() instead.

Sets the current templates path.

View source

Arguments

  • $path (string) – The new templates path.

Signature

public void setTemplatesPath ( $path )