PathService

Type
Class
Namespace
Craft
Inherits
Craft\PathService » Craft\BaseApplicationComponent » CApplicationComponent (opens new window) » CComponent (opens new window)
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 (opens new window)

# Public Properties

Property Description
$behaviors (opens new window) array (opens new window) – The behaviors that should be attached to this component.

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__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.
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.
canGetProperty() (opens new window) Determines whether a property can be read.
canSetProperty() (opens new window) Determines whether a property can be set.
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.
enableBehavior() (opens new window) Enables an attached behavior.
enableBehaviors() (opens new window) Enables all behaviors attached to this component.
evaluateExpression() (opens new window) 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() (opens new window) Returns the list of attached event handlers for an event.
getFrameworkPath() Returns the path to the framework/ folder.
getIsInitialized() (opens new window) 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() (opens new window) Determines whether an event is defined.
hasEventHandler() (opens new window) Checks whether the named event has attached handlers.
hasProperty() (opens new window) Determines whether a property is defined.
init() (opens new window) Initializes the application component.
isInitialized() Checks if this application component has been initialized yet, or not.
raiseEvent() (opens new window) Raises an event.
setTemplatesPath() Sets the current templates path.

# getAppPath()

Returns the path to the craft/app/ folder.

View source (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – The path to the craft/config/ folder.

Signature

public string getConfigPath ( )

# getCpTemplatesPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/app/templates/ folder.

Signature

public string getCpTemplatesPath ( )

# getCpTranslationsPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/app/translations/ folder.

Signature

public string getCpTranslationsPath ( )

# getDbBackupPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/storage/backups/ folder.

Signature

public string getDbBackupPath ( )

# getFrameworkPath()

Returns the path to the framework/ folder.

View source (opens new window)

Returns

string (opens new window) – The path to the framework/ folder.

Signature

public string getFrameworkPath ( )

# getLibPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/app/lib/ folder.

Signature

public string getLibPath ( )

# getLicenseKeyPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to craft/config/license.key.

Signature

public string getLicenseKeyPath ( )

# getLogPath()

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

View source (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Arguments

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

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – The path to the craft/storage/runtime/pluginicons/ folder.

Signature

public string getPluginIconsPath ( )

# getPluginsPath()

Returns the path to the craft/plugins/ folder.

View source (opens new window)

Returns

string (opens new window) – The path to the craft/plugins/ folder.

Signature

public string getPluginsPath ( )

# getRebrandPath()

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

View source (opens new window)

Returns

string (opens new window)

Signature

public string getRebrandPath ( )

# getResourcesPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/app/resources/ folder.

Signature

public string getResourcesPath ( )

# getRuntimePath()

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

View source (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – The path to the craft/storage/runtime/sessions/ folder.

Signature

public string getSessionPath ( )

# getSiteTemplatesPath()

Returns the path to the craft/templates/ folder.

View source (opens new window)

Returns

string (opens new window) – The path to the craft/templates/ folder.

Signature

public string getSiteTemplatesPath ( )

# getSiteTranslationsPath()

Returns the path to the craft/translations/ folder.

View source (opens new window)

Returns

string (opens new window) – The path to the craft/translations/ folder.

Signature

public string getSiteTranslationsPath ( )

# getStatePath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/storage/runtime/state/ folder.

Signature

public string getStatePath ( )

# getStoragePath()

Returns the path to the craft/storage/ folder.

View source (opens new window)

Returns

string (opens new window) – The path to the craft/storage/ folder.

Signature

public string getStoragePath ( )

# getTempPath()

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

View source (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Returns

string (opens new window) – The templates path.

Signature

public string getTemplatesPath ( )

# getUserPhotosPath()

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

View source (opens new window)

Returns

string (opens new window) – The path to the craft/storage/userphotos/ folder.

Signature

public string getUserPhotosPath ( )

# getVendorPath()

Returns the path to the vendor/ folder.

View source (opens new window)

Returns

string (opens new window) – 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 (opens new window)

Arguments

Signature

public void setTemplatesPath ( $path )