PHP Class Backend\Core\Engine\Model

Inheritance: extends Common\Core\Model
Datei anzeigen Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
checkSettings ( ) : array Checks the settings and optionally returns an array with warnings
createURLForAction ( string $action = null, string $module = null, string $language = null, array $parameters = null, boolean $urlencode = true ) : string Creates an URL for a given action and module If you don't specify an action the current action will be used.
deleteExtra ( string $module = null, string $type = null, array $data = null ) Delete a page extra by module, type or data.
deleteExtraById ( integer $id, boolean $deleteBlock = false ) Delete a page extra by its id
deleteExtrasForData ( string $module, string $field, string $value, string $action = null ) Delete all extras for a certain value in the data array of that module_extra.
deleteThumbnails ( string $path, string $thumbnail ) Delete thumbnails based on the folders in the path
generateRandomString ( integer $length = 15, boolean $numeric = true, boolean $lowercase = true, boolean $uppercase = true, boolean $special = true ) : string Generate a random string
getDateFormatsLong ( ) : array Fetch the list of long date formats including examples of these formats.
getDateFormatsShort ( ) : array Fetch the list of short date formats including examples of these formats.
getExtras ( array $ids ) : array Get extras
getExtrasForData ( string $module, string $key, string $value, string $action = null ) : array Get extras for data
getKeys ( string $language = null ) : array Get the page-keys
getModulesForDropDown ( ) : array Fetch the list of modules, but for a dropdown.
getModulesOnFilesystem ( boolean $includeCore = true ) : array Get the modules that are available on the filesystem
getNavigation ( string $language = null ) : array Get the navigation-items
getNumberFormats ( ) : array Fetch the list of number formats including examples of these formats.
getTimeFormats ( ) : array Fetch the list of time formats including examples of these formats.
getToken ( ) : string Get the token which will protect us
getURL ( integer $pageId, string $language = null ) : string Get URL for a given pageId
getURLForBlock ( string $module, string $action = null, string $language = null, array $data = null ) : string Get the URL for a give module & action combination
imageDelete ( string $module, string $filename, string $subDirectory = '', array $fileSizes = null ) Image Delete
insertExtra ( string $type, string $module, string $action = null, string $label = null, array $data = null, boolean $hidden = false, integer $sequence = null ) : integer Insert extra
invalidateFrontendCache ( string $module = null, string $language = null )
isModuleInstalled ( string $module ) : boolean Is module installed?
ping ( string $pageOrFeedURL = null, string $category = null ) : boolean Ping the known webservices
submitHam ( string $userIp, string $userAgent, string $content, string $author = null, string $email = null, string $url = null, string $permalink = null, string $type = null, string $referrer = null, array $others = null ) : boolean Submit ham, this call is intended for the marking of false positives, things that were incorrectly marked as spam.
submitSpam ( string $userIp, string $userAgent, string $content, string $author = null, string $email = null, string $url = null, string $permalink = null, string $type = null, string $referrer = null, array $others = null ) : boolean Submit spam, his call is for submitting comments that weren't marked as spam but should have been.
updateExtra ( integer $id, string $key, string $value ) Update extra
updateExtraData ( integer $id, string $key, string $value ) Update extra data

Method Details

checkSettings() public static method

Checks the settings and optionally returns an array with warnings
public static checkSettings ( ) : array
return array

createURLForAction() public static method

If you don't specify a module the current module will be used. If you don't specify a language the current language will be used.
public static createURLForAction ( string $action = null, string $module = null, string $language = null, array $parameters = null, boolean $urlencode = true ) : string
$action string The action to build the URL for.
$module string The module to build the URL for.
$language string The language to use, if not provided we will use the working language.
$parameters array GET-parameters to use.
$urlencode boolean Should the parameters be urlencoded?
return string

deleteExtra() public static method

Data is a key/value array. Example: array(id => 23, language => nl);
public static deleteExtra ( string $module = null, string $type = null, array $data = null )
$module string The module wherefore the extra exists.
$type string The type of extra, possible values are block, homepage, widget.
$data array Extra data that exists.

deleteExtraById() public static method

Delete a page extra by its id
public static deleteExtraById ( integer $id, boolean $deleteBlock = false )
$id integer The id of the extra to delete.
$deleteBlock boolean Should the block be deleted? Default is false.

deleteExtrasForData() public static method

Delete all extras for a certain value in the data array of that module_extra.
public static deleteExtrasForData ( string $module, string $field, string $value, string $action = null )
$module string The module for the extra.
$field string The field of the data you want to check the value for.
$value string The value to check the field for.
$action string In case you want to search for a certain action.

deleteThumbnails() public static method

Delete thumbnails based on the folders in the path
public static deleteThumbnails ( string $path, string $thumbnail )
$path string The path wherein the thumbnail-folders exist.
$thumbnail string The filename to be deleted.

generateRandomString() public static method

Generate a random string
public static generateRandomString ( integer $length = 15, boolean $numeric = true, boolean $lowercase = true, boolean $uppercase = true, boolean $special = true ) : string
$length integer Length of random string.
$numeric boolean Use numeric characters.
$lowercase boolean Use alphanumeric lowercase characters.
$uppercase boolean Use alphanumeric uppercase characters.
$special boolean Use special characters.
return string

getDateFormatsLong() public static method

Fetch the list of long date formats including examples of these formats.
public static getDateFormatsLong ( ) : array
return array

getDateFormatsShort() public static method

Fetch the list of short date formats including examples of these formats.
public static getDateFormatsShort ( ) : array
return array

getExtras() public static method

Get extras
public static getExtras ( array $ids ) : array
$ids array The ids of the modules_extras to get.
return array

getExtrasForData() public static method

Get extras for data
public static getExtrasForData ( string $module, string $key, string $value, string $action = null ) : array
$module string The module for the extra.
$key string The key of the data you want to check the value for.
$value string The value to check the key for.
$action string In case you want to search for a certain action.
return array The ids for the extras.

getKeys() public static method

Get the page-keys
public static getKeys ( string $language = null ) : array
$language string The language to use, if not provided we will use the working language.
return array

getModulesForDropDown() public static method

Fetch the list of modules, but for a dropdown.
public static getModulesForDropDown ( ) : array
return array

getModulesOnFilesystem() public static method

Get the modules that are available on the filesystem
public static getModulesOnFilesystem ( boolean $includeCore = true ) : array
$includeCore boolean Should core be included as a module?
return array

getNavigation() public static method

Get the navigation-items
public static getNavigation ( string $language = null ) : array
$language string The language to use, if not provided we will use the working language.
return array

getNumberFormats() public static method

Fetch the list of number formats including examples of these formats.
public static getNumberFormats ( ) : array
return array

getTimeFormats() public static method

Fetch the list of time formats including examples of these formats.
public static getTimeFormats ( ) : array
return array

getToken() public static method

Get the token which will protect us
public static getToken ( ) : string
return string

getURL() public static method

Get URL for a given pageId
public static getURL ( integer $pageId, string $language = null ) : string
$pageId integer The id of the page to get the URL for.
$language string The language to use, if not provided we will use the working language.
return string

getURLForBlock() public static method

Get the URL for a give module & action combination
public static getURLForBlock ( string $module, string $action = null, string $language = null, array $data = null ) : string
$module string The module wherefore the URL should be build.
$action string The specific action wherefore the URL should be build.
$language string The language wherein the URL should be retrieved, if not provided we will load the language that was provided in the URL.
$data array An array with keys and values that partially or fully match the data of the block. If it matches multiple versions of that block it will just return the first match.
return string

imageDelete() public static method

Image Delete
public static imageDelete ( string $module, string $filename, string $subDirectory = '', array $fileSizes = null )
$module string Module name.
$filename string Filename.
$subDirectory string Subdirectory.
$fileSizes array Possible file sizes.

insertExtra() public static method

Insert extra
public static insertExtra ( string $type, string $module, string $action = null, string $label = null, array $data = null, boolean $hidden = false, integer $sequence = null ) : integer
$type string What type do you want to insert, 'homepage', 'block' or 'widget'.
$module string The module you are inserting this extra for.
$action string The action this extra will use.
$label string Label which will be used when you want to connect this block.
$data array Containing extra variables.
$hidden boolean Should this extra be visible in frontend or not?
$sequence integer
return integer The new extra id

invalidateFrontendCache() public static method

Deprecation: : twig doesn't contain this same type of caching out of the box. Use https://github.com/asm89/twig-cache-extension instead
public static invalidateFrontendCache ( string $module = null, string $language = null )
$module string A specific module to clear the cache for.
$language string The language to use.

isModuleInstalled() public static method

Is module installed?
public static isModuleInstalled ( string $module ) : boolean
$module string
return boolean

ping() public static method

Ping the known webservices
Deprecation:
public static ping ( string $pageOrFeedURL = null, string $category = null ) : boolean
$pageOrFeedURL string The page/feed that has changed.
$category string An optional category for the site.
return boolean If everything went fne true will, otherwise false.

submitHam() public static method

Submit ham, this call is intended for the marking of false positives, things that were incorrectly marked as spam.
public static submitHam ( string $userIp, string $userAgent, string $content, string $author = null, string $email = null, string $url = null, string $permalink = null, string $type = null, string $referrer = null, array $others = null ) : boolean
$userIp string IP address of the comment submitter.
$userAgent string User agent information.
$content string The content that was submitted.
$author string Submitted name with the comment.
$email string Submitted email address.
$url string Commenter URL.
$permalink string The permanent location of the entry the comment was submitted to.
$type string May be blank, comment, trackback, pingback, or a made up value like "registration".
$referrer string The content of the HTTP_REFERER header should be sent here.
$others array Other data (the variables from $_SERVER).
return boolean If everything went fine, true will be returned, otherwise an exception will be triggered.

submitSpam() public static method

Submit spam, his call is for submitting comments that weren't marked as spam but should have been.
public static submitSpam ( string $userIp, string $userAgent, string $content, string $author = null, string $email = null, string $url = null, string $permalink = null, string $type = null, string $referrer = null, array $others = null ) : boolean
$userIp string IP address of the comment submitter.
$userAgent string User agent information.
$content string The content that was submitted.
$author string Submitted name with the comment.
$email string Submitted email address.
$url string Commenter URL.
$permalink string The permanent location of the entry the comment was submitted to.
$type string May be blank, comment, trackback, pingback, or a made up value like "registration".
$referrer string The content of the HTTP_REFERER header should be sent here.
$others array Other data (the variables from $_SERVER).
return boolean If everything went fine true will be returned, otherwise an exception will be triggered.

updateExtra() public static method

Update extra
public static updateExtra ( integer $id, string $key, string $value )
$id integer The id for the extra.
$key string The key you want to update.
$value string The new value.

updateExtraData() public static method

Update extra data
public static updateExtraData ( integer $id, string $key, string $value )
$id integer The id for the extra.
$key string The key in the data you want to update.
$value string The new value.