AppBehavior

Type
Class
Namespace
Craft
Inherits
Craft\AppBehavior » Craft\BaseBehavior » CBehavior (opens new window) » CComponent (opens new window)
Implements
IBehavior
Since
1.2

Class AppBehavior

See also http://craftcms.com

View source (opens new window)

# 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.
attach() (opens new window) Attaches the behavior object to the component.
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.
canTestEditions() Returns whether Craft is running on a domain that is eligible to test out the editions.
canUpgradeEdition() Returns whether Craft is eligible to be upgraded to a different edition.
createDbConnection() Creates a {@link DbConnection} specifically initialized for Craft's craft()->db instance.
detach() (opens new window) Detaches the behavior object from the component.
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.
disableMaintenanceMode() Disables Maintenance Mode.
enableBehavior() (opens new window) Enables an attached behavior.
enableBehaviors() (opens new window) Enables all behaviors attached to this component.
enableMaintenanceMode() Enables Maintenance Mode.
evaluateExpression() (opens new window) Evaluates a PHP expression or callback under the context of this component.
events() (opens new window) Declares events and the corresponding event handler methods.
getBuild() Returns the installed Craft build.
getEdition() Returns the Craft edition.
getEditionName() Returns the name of the Craft edition.
getEnabled() (opens new window)
getEventHandlers() (opens new window) Returns the list of attached event handlers for an event.
getInfo() Returns the info model, or just a particular attribute.
getIsDbConnectionValid() Don't even think of moving this check into DbConnection->init().
getLanguage() Returns the target application language.
getLicensedEdition() Returns the edition Craft is actually licensed to run in.
getLicensedEditionName() Returns the name of the edition Craft is actually licensed to run in.
getOwner() (opens new window)
getReleaseDate() Returns the installed Craft release date.
getSchemaVersion() Returns the installed Craft schema version.
getSiteName() Returns the site name.
getSiteUid() Returns the site UID.
getSiteUrl() Returns the site URL (with a trailing slash).
getTargetLanguage() Returns the target app language.
getTimezone() Returns the system timezone.
getTrack() Returns the Craft track.
getVersion() Returns the installed Craft version.
getYiiVersion() Returns the Yii framework version.
hasEvent() (opens new window) Determines whether an event is defined.
hasEventHandler() (opens new window) Checks whether the named event has attached handlers.
hasPackage() Returns whether a package is included in this Craft build.
hasProperty() (opens new window) Determines whether a property is defined.
hasWrongEdition() Returns whether Craft is running with the wrong edition.
isInMaintenanceMode() Returns whether the system is in maintenance mode.
isInstalled() Determines if Craft is installed by checking if the info table exists.
isLocalized() Returns whether this site has multiple locales.
isSystemOn() Returns whether the system is on.
raiseEvent() (opens new window) Raises an event.
requireEdition() Requires that Craft is running an equal or better edition than what's passed in
saveInfo() Updates the info row.
setEdition() Sets the Craft edition.
setEnabled() (opens new window)
setIsDbConnectionValid() Don't even think of moving this check into DbConnection->init().
setIsInstalled() Tells Craft that it's installed now.
setLanguage() Sets the target application language.
setSiteUrl() Sets the site URL, while ensuring that the given URL ends with a trailing slash.
validateDbConfigFile() Make sure the basics are in place in the db connection file before we actually try to connect later on.

# canTestEditions()

Returns whether Craft is running on a domain that is eligible to test out the editions.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean canTestEditions ( )

# canUpgradeEdition()

Returns whether Craft is eligible to be upgraded to a different edition.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean canUpgradeEdition ( )

# createDbConnection()

Creates a {@link DbConnection} specifically initialized for Craft's craft()->db instance.

View source (opens new window)

Returns

Craft\DbConnection

Throws

Signature

public Craft\DbConnection createDbConnection ( )

# disableMaintenanceMode()

Signature

public boolean disableMaintenanceMode ( )

# enableMaintenanceMode()

Signature

public boolean enableMaintenanceMode ( )

# getBuild()

Returns the installed Craft build.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getBuild ( )

# getEdition()

Signature

public integer getEdition ( )

# getEditionName()

Returns the name of the Craft edition.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getEditionName ( )

# getInfo()

Returns the info model, or just a particular attribute.

View source (opens new window)

Arguments

Returns

mixed

Throws

Signature

public mixed getInfo ( $attribute = null )

# getIsDbConnectionValid()

Don't even think of moving this check into DbConnection->init().

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean getIsDbConnectionValid ( )

# getLanguage()

Returns the target application language.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getLanguage ( )

# getLicensedEdition()

Returns the edition Craft is actually licensed to run in.

View source (opens new window)

Returns

integer (opens new window), null (opens new window)

Signature

public integer, null getLicensedEdition ( )

# getLicensedEditionName()

Returns the name of the edition Craft is actually licensed to run in.

View source (opens new window)

Returns

string (opens new window), null (opens new window)

Signature

public string, null getLicensedEditionName ( )

# getReleaseDate()

Returns the installed Craft release date.

View source (opens new window)

Returns

Craft\DateTime

Signature

public Craft\DateTime getReleaseDate ( )

# getSchemaVersion()

Returns the installed Craft schema version.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getSchemaVersion ( )

# getSiteName()

Signature

public string getSiteName ( )

# getSiteUid()

Signature

public string getSiteUid ( )

# getSiteUrl()

Returns the site URL (with a trailing slash).

View source (opens new window)

Arguments

Returns

string (opens new window)

Signature

public string getSiteUrl ( $protocol = null )

# getTargetLanguage()

Returns the target app language.

View source (opens new window)

Arguments

  • $useUserLanguage

Returns

string (opens new window), null (opens new window)

Signature

public string, null getTargetLanguage ( $useUserLanguage = true )

# getTimezone()

Returns the system timezone.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getTimezone ( )

# getTrack()

Signature

public string getTrack ( )

# getVersion()

Returns the installed Craft version.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getVersion ( )

# getYiiVersion()

Returns the Yii framework version.

View source (opens new window)

Returns

mixed

Signature

public mixed getYiiVersion ( )

# hasPackage()

DEPRECATED

Deprecated Deprecated in 2.0. To get the installed Craft edition, use {@link AppBehavior::getEdition() craft()->getEdition()}.

Returns whether a package is included in this Craft build.

View source (opens new window)

Arguments

  • $packageName

Returns

boolean (opens new window)

Signature

public boolean hasPackage ( $packageName )

# hasWrongEdition()

Returns whether Craft is running with the wrong edition.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean hasWrongEdition ( )

# isInMaintenanceMode()

Returns whether the system is in maintenance mode.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean isInMaintenanceMode ( )

# isInstalled()

Determines if Craft is installed by checking if the info table exists.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean isInstalled ( )

# isLocalized()

Returns whether this site has multiple locales.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean isLocalized ( )

# isSystemOn()

Returns whether the system is on.

View source (opens new window)

Returns

boolean (opens new window)

Signature

public boolean isSystemOn ( )

# requireEdition()

Requires that Craft is running an equal or better edition than what's passed in

View source (opens new window)

Arguments

Throws

Signature

public void requireEdition ( $edition, $orBetter = true )

# saveInfo()

Updates the info row.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

Signature

public boolean saveInfo ( Craft\InfoModel $info )

# setEdition()

Sets the Craft edition.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

Signature

public boolean setEdition ( $edition )

# setIsDbConnectionValid()

Don't even think of moving this check into DbConnection->init().

View source (opens new window)

Arguments

  • $value

Signature

public void setIsDbConnectionValid ( $value )

# setIsInstalled()

Tells Craft that it's installed now.

View source (opens new window)

Returns

null (opens new window)

Signature

public null setIsInstalled ( )

# setLanguage()

Sets the target application language.

View source (opens new window)

Arguments

Returns

null (opens new window)

Signature

public null setLanguage ( $language )

# setSiteUrl()

Sets the site URL, while ensuring that the given URL ends with a trailing slash.

View source (opens new window)

Arguments

Returns

null (opens new window)

Signature

public null setSiteUrl ( $siteUrl )

# validateDbConfigFile()

Make sure the basics are in place in the db connection file before we actually try to connect later on.

View source (opens new window)

Returns

null (opens new window)

Throws

Signature

public null validateDbConfigFile ( )