AppBehavior

Type
Class
Namespace
Craft
Inherits
Craft\AppBehavior » Craft\BaseBehavior » CBehavior » CComponent
Implements
IBehavior
Since
1.2

Class AppBehavior

See also http://craftcms.com

View source

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.
attach()Attaches the behavior object to the component.
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.
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()Detaches the behavior object from the component.
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.
disableMaintenanceMode()Disables Maintenance Mode.
enableBehavior()Enables an attached behavior.
enableBehaviors()Enables all behaviors attached to this component.
enableMaintenanceMode()Enables Maintenance Mode.
evaluateExpression()Evaluates a PHP expression or callback under the context of this component.
events()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()
getEventHandlers()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()
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()Determines whether an event is defined.
hasEventHandler()Checks whether the named event has attached handlers.
hasPackage()Returns whether a package is included in this Craft build.
hasProperty()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()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()
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

Returns

boolean

Signature

public boolean canTestEditions ( )

canUpgradeEdition()

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

View source

Returns

boolean

Signature

public boolean canUpgradeEdition ( )

createDbConnection()

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

View source

Returns

Craft\DbConnection

Throws

Signature

public Craft\DbConnection createDbConnection ( )

disableMaintenanceMode()

Disables Maintenance Mode.

View source

Returns

boolean

Signature

public boolean disableMaintenanceMode ( )

enableMaintenanceMode()

Enables Maintenance Mode.

View source

Returns

boolean

Signature

public boolean enableMaintenanceMode ( )

getBuild()

Returns the installed Craft build.

View source

Returns

string

Signature

public string getBuild ( )

getEdition()

Returns the Craft edition.

View source

Returns

integer

Signature

public integer getEdition ( )

getEditionName()

Returns the name of the Craft edition.

View source

Returns

string

Signature

public string getEditionName ( )

getInfo()

Returns the info model, or just a particular attribute.

View source

Arguments

Returns

mixed

Throws

Signature

public mixed getInfo ( $attribute = null )

getIsDbConnectionValid()

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

View source

Returns

boolean

Signature

public boolean getIsDbConnectionValid ( )

getLanguage()

Returns the target application language.

View source

Returns

string

Signature

public string getLanguage ( )

getLicensedEdition()

Returns the edition Craft is actually licensed to run in.

View source

Returns

integer, null

Signature

public integer, null getLicensedEdition ( )

getLicensedEditionName()

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

View source

Returns

string, null

Signature

public string, null getLicensedEditionName ( )

getReleaseDate()

Returns the installed Craft release date.

View source

Returns

Craft\DateTime

Signature

public Craft\DateTime getReleaseDate ( )

getSchemaVersion()

Returns the installed Craft schema version.

View source

Returns

string

Signature

public string getSchemaVersion ( )

getSiteName()

Returns the site name.

View source

Returns

string

Signature

public string getSiteName ( )

getSiteUid()

Returns the site UID.

View source

Returns

string

Signature

public string getSiteUid ( )

getSiteUrl()

Returns the site URL (with a trailing slash).

View source

Arguments

  • $protocol (string, null) – The protocol to use (http or https). If none is specified, it will default to whatever's in the Site URL setting.

Returns

string

Signature

public string getSiteUrl ( $protocol = null )

getTargetLanguage()

Returns the target app language.

View source

Arguments

  • $useUserLanguage

Returns

string, null

Signature

public string, null getTargetLanguage ( $useUserLanguage = true )

getTimezone()

Returns the system timezone.

View source

Returns

string

Signature

public string getTimezone ( )

getTrack()

Returns the Craft track.

View source

Returns

string

Signature

public string getTrack ( )

getVersion()

Returns the installed Craft version.

View source

Returns

string

Signature

public string getVersion ( )

getYiiVersion()

Returns the Yii framework version.

View source

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

Arguments

  • $packageName

Returns

boolean

Signature

public boolean hasPackage ( $packageName )

hasWrongEdition()

Returns whether Craft is running with the wrong edition.

View source

Returns

boolean

Signature

public boolean hasWrongEdition ( )

isInMaintenanceMode()

Returns whether the system is in maintenance mode.

View source

Returns

boolean

Signature

public boolean isInMaintenanceMode ( )

isInstalled()

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

View source

Returns

boolean

Signature

public boolean isInstalled ( )

isLocalized()

Returns whether this site has multiple locales.

View source

Returns

boolean

Signature

public boolean isLocalized ( )

isSystemOn()

Returns whether the system is on.

View source

Returns

boolean

Signature

public boolean isSystemOn ( )

requireEdition()

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

View source

Arguments

Throws

Signature

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

saveInfo()

Updates the info row.

View source

Arguments

Returns

boolean

Signature

public boolean saveInfo ( Craft\InfoModel $info )

setEdition()

Sets the Craft edition.

View source

Arguments

Returns

boolean

Signature

public boolean setEdition ( $edition )

setIsDbConnectionValid()

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

View source

Arguments

  • $value

Signature

public void setIsDbConnectionValid ( $value )

setIsInstalled()

Tells Craft that it's installed now.

View source

Returns

null

Signature

public null setIsInstalled ( )

setLanguage()

Sets the target application language.

View source

Arguments

Returns

null

Signature

public null setLanguage ( $language )

setSiteUrl()

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

View source

Arguments

Returns

null

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

Returns

null

Throws

Signature

public null validateDbConfigFile ( )