CMS Made Simple API

CMS Made Simple API

Table of Contents

Packages

CMS
Application

Namespaces

CMSMS

Interfaces

CmsRegularTask
An interface to define how tasks should work.

Classes

Bookmark
Bookmark class for the CMSMS admin console.
BookmarkOperations
Class for doing bookmark related functions. Maybe of the Bookmark object functions are just wrappers around these.
cms_admin_tabs
A simple convenience class for creating a tabbed interface in the CMSMS admin console
cms_admin_utils
A Simple static class providing various convenience utilities for admin requests.
cms_cache_driver
An abstract class for various cache drivers
cms_cache_handler
This singleton class provides a convenient caching capbility.
cms_config
A singleton class for interacting with the CMSMS config.php file.
cms_content_tree
A tree class that allows backward compatibility (somewhat) to the old Tree class used in CMSMS versions prior to 1.9, and provides content retrieval abilities, with interface into the content cache.
cms_cookies
A simple static class providing convenience utilities for working with cookies.
cms_filecache_driver
A cache driver to cache files using the filesystem.
cms_http_request
HTTP Class
cms_mailer
A class for sending email.
cms_route_manager
A class to manage all recognized routes in the system.
cms_siteprefs
A class for working with site preferences
cms_tree
A Simple PHP Tree class that allows storing associative data along with each node.
cms_tree_operations
A utility class to provide functions to populate a tree
cms_url
A class for interacting with a URL.
cms_userprefs
A static class for preferences stored with admin user accounts
cms_utils
A Simple Static class providing various convenience utilities.
CmsAdminMenuItem
Base module class.
CmsAdminThemeBase
Base class for CMSMS Admin themes.
CmsAdminThemeNotification
A class representing a simple notification.
CmsAdminUtils
A set of static utilities for assisting with admin requests
CmsApp
Simple singleton class that contains various functions and states representing the application.
CmsContentTypePlaceholder
Simple global convenience object to hold CMS Content Type structure.
CmsCoreCapabilities
A class that identifies numerous standard core capabilities
CmsDbQueryBase
An abstract class for building queries and managing results.
CmsExtraDataException
A basic exception class that holds on to extended information.
CmsException
A base CMSMS Exception
CmsLogicException
A base CMSMS Logic Exception
CmsCommunicationException
A base CMSMS Communications Exception
CmsPrivacyException
A base CMSMS Privacy Exception
CmsSingletonException
A base CMSMS Singleton Exception
CmsInvalidDataException
An exception indicating invalid data was supplied to a function or class.
CmsDataNotFoundException
An exception indicating that the requested data could not be found.
CmsError404Exception
A special exception indicating that a 404 error should be supplied.
CmsError403Exception
A special exception indicating that a 403 error should be supplied.
CmsContentException
A special exception indicating an error with a content object
CmsEditContentException
A special exception indicating an error when editing content.
CmsSQLErrorException
A special exception indicating an SQL Error.
CmsXMLErrorException
A special exception indicating an XML Error.
CmsFileSystemException
A special exception indicating a problem with a file, directory, or filesystem
CmsFormUtils
A static class providing functionality for building forms.
CmsLangOperations
A singleton class to provide simple, generic mechanism for dealing with languages encodings, and locales. This class does not handle translation strings.
CmsLanguageDetector
An abstract class that is used to determine a suitable language for display This may be used by CMSMS on frontend requests to detect a suitable language.
CmsLayoutCollection
A class to manage a collection (or theme) of Templates and Stylesheets
CmsLayoutStylesheet
A class to represent a stylesheet.
CmsLayoutStylesheetQuery
A class to represent a template query, and its results.
CmsLayoutTemplate
A class to represent a smarty template.
CmsLayoutTemplateCategory
A class representing a template category.
CmsLayoutTemplateQuery
A class to represent a template query, and its results.
CmsLayoutTemplateType
A class to manage template types
CmsLockException
An exception indicating an error creating a lock
CmsLockOwnerException
An exception indicating a uid mismatch wrt a lock (person operating on the lock is not the owner)
CmsUnLockException
An exception indicating an error removing a lock
CmsNoLockException
An exception indicating an error loading or finding a lock
CmsLock
A simple class represeinting a lock on a logical object in CMSMS.
CmsLockOperations
A singleton class providing utilities for interacting with locks.
CMSModule
Base module class.
CMSModuleContentType
Class that module defined content types must extend.
CmsNls
A class to provide data and methods for encapsulating a single language
CmsNlsOperations
A singleton class to provide simple, generic mechanism for dealing with languages encodings, and locales. This class does not handle translation strings.
CmsPermission
Simple class for dealing with a permission.
CmsRoute
Simple global convenience object to hold information for a single route.
ContentBase
Base level content object.
ContentOperations
Class for static methods related to content
Events
Class for handling and dispatching system and user defined events.
Group
Generic group class. This can be used for any logged in group or group related function.
GroupOperations
A singleton Class for doing group related functions.
ModuleOperations
A singleton utility class to allow for working with modules.
User
Generic admin user class. This can be used for any logged in user or user related function.
UserOperations
Class for doing user related functions. Maybe of the User object functions are just wrappers around these.
UserTagOperations
UserTags class for admin

Constants

__CMS_PREVIEW_PAGE__  = -100
CLEAN_FILE  = 'CLEAN_FILE'
Indicates that the incoming parameter is an uploaded file.
CLEAN_FLOAT  = 'CLEAN_FLOAT'
Indicates that the incoming parameter is expected to be a float This is used when cleaning input parameters for a module action or module call.
CLEAN_INT  = 'CLEAN_INT'
Indicates that the incoming parameter is expected to be an integer.
CLEAN_NONE  = 'CLEAN_NONE'
Indicates that the incoming parameter is not to be cleaned.
CLEAN_REGEXP  = 'regexp:'
Indicates that the incoming parameter is a regular expression.
CLEAN_STRING  = 'CLEAN_STRING'
Indicates that the incoming parameter is a string.
CMS_DEBUG  = self::$_instance['debug']
A constant indicating if CMSMS is in debug mode.
CMS_ROOT_PATH  = self::$_instance['root_path']
A constant containing the directory where CMSMS is installed.
CMS_ROOT_URL  = self::$_instance['root_url']
A constant containing the CMSMS root url.
PUBLIC_CACHE_LOCATION  = self::$_instance['public_cache_location']
A constant to indicate where public (browsable) cachable files can be written.
PUBLIC_CACHE_URL  = self::$_instance['public_cache_url']
A constant to indicate the public address for cachable files.
TMP_CACHE_LOCATION  = self::$_instance['tmp_cache_location']
A constant to indicate the location where private cacheable files can be written.
TMP_TEMPLATES_C_LOCATION  = self::$_instance['tmp_templates_c_location']
A constant containing the smarty template compile directory.

Functions

get_preference()  : mixed
Retrieve the value of the named preference for the given userid.
set_preference()  : mixed
Sets the given perference for the given userid with the given value.
cmsms()  : CmsApp
Return the global cmsms() object.
cms_db_prefix()  : string
Returns the currently configured database prefix.
is_sitedown()  : bool
A convenience function to test if the site is marked as down according to the config panel.
redirect()  : mixed
Redirects to relative URL on the current site.
redirect_to_alias()  : mixed
Given a page ID or an alias, redirect to it.
microtime_diff()  : int
Calculate the difference in seconds between two microtime() values.
cms_join_path()  : string
Joins a path together using platform specific directory separators.
cms_relative_path()  : string
Return the relative portion of a path
cms_htmlentities()  : string
Perform HTML entity conversion on a string.
debug_bt_to_log()  : mixed
A function to output a backtrace into the generated log file.
debug_bt()  : mixed
A function to generate a backtrace in a readable format.
debug_display()  : string
Debug function to display $var nicely in html.
debug_output()  : mixed
Display $var nicely only if $config["debug"] is set.
debug_to_log()  : mixed
Debug function to output debug information about a variable in a formatted matter to a debug file.
debug_buffer()  : mixed
Display $var nicely to the CmsApp::get_instance()->errors array if $config['debug'] is set.
get_parameter_value()  : mixed
Retrieve the $value from the $parameters array checking for $parameters[$value] and $params[$id.$value].
is_directory_writable()  : bool
Check the permissions of a directory recursively to make sure that we have write permission to all files.
get_recursive_file_list()  : array<string|int, string>
Return an array containing a list of files in a directory performs a recursive search.
recursive_delete()  : bool
A function to recursively delete all files and folders in a directory; synonymous with rm -r.
chmod_r()  : mixed
A function to recursively chmod all files and folders in a directory.
startswith()  : bool
A convenience function to test wether one string starts with another.
endswith()  : bool
Similar to the startswith method, this function tests with string A ends with string B.
munge_string_to_url()  : string
Convert a human readable string into something that is suitable for use in URLS.
ini_get_boolean()  : int
A convenience function to return a bool variable given a php ini key that represents a bool.
stack_trace()  : mixed
Another convenience function to output a human-readable function stack trace.
cms_move_uploaded_file()  : mixed
A wrapper around move_uploaded_file that attempts to ensure permissions on uploaded files are set correctly.
cms_ipmatches()  : bool
A function to test whether an IP address matches a list of expressions.
is_email()  : bool
Test if the string provided is a valid email address.
cms_to_bool()  : mixed
A simple function to convert a string to a bool.
cms_get_jquery()  : mixed
A function to return the appropriate HTML tags to include the CMSMS included jquery in a web page.
is_base64()  : bool
Test if a string is a base64 encoded string
get_userid()  : int
Gets the userid of the currently logged in user.
get_username()  : string
Gets the username of the currently logged in user.
check_login()  : bool
Checks to see if the user is logged in and the request has the proper key. If not, redirects the browser to the admin login.
check_permission()  : bool
Checks to see that the given userid has access to the given permission.
audit()  : void
Put an event into the audit (admin) log. This should be done on most admin events for consistency.
get_site_preference()  : mixed
Gets the given site prefernce
remove_site_preference()  : void
Removes the given site preference
set_site_preference()  : void
Sets the given site perference with the given value.
locale_ftime()  : string
Replacement for deprecated strftime function
cms_set_frontend_language()  : mixed
Temporarily override the current frontend language.
lang_by_realm()  : string
Retrieve a translation for a specific string in a specific realm.
lang()  : string
Return a translated string for the default 'admin' realm.
get_encoding()  : string
Get the encoding of the current language.
get_language_list()  : associative
Retrieve a list of installed languages that is suitable for use in a dropdown.

Constants

CLEAN_FILE

Indicates that the incoming parameter is an uploaded file.

public mixed CLEAN_FILE = 'CLEAN_FILE'

This is used when cleaning input parameters for a module action or module call.

CLEAN_FLOAT

Indicates that the incoming parameter is expected to be a float This is used when cleaning input parameters for a module action or module call.

public mixed CLEAN_FLOAT = 'CLEAN_FLOAT'

CLEAN_INT

Indicates that the incoming parameter is expected to be an integer.

public mixed CLEAN_INT = 'CLEAN_INT'

This is used when cleaning input parameters for a module action or module call.

CLEAN_NONE

Indicates that the incoming parameter is not to be cleaned.

public mixed CLEAN_NONE = 'CLEAN_NONE'

This is used when cleaning input parameters for a module action or module call.

CLEAN_REGEXP

Indicates that the incoming parameter is a regular expression.

public mixed CLEAN_REGEXP = 'regexp:'

This is used when cleaning input parameters for a module action or module call.

CLEAN_STRING

Indicates that the incoming parameter is a string.

public mixed CLEAN_STRING = 'CLEAN_STRING'

This is used when cleaning input parameters for a module action or module call.

CMS_DEBUG

A constant indicating if CMSMS is in debug mode.

public mixed CMS_DEBUG = self::$_instance['debug']

CMS_ROOT_PATH

A constant containing the directory where CMSMS is installed.

public mixed CMS_ROOT_PATH = self::$_instance['root_path']

CMS_ROOT_URL

A constant containing the CMSMS root url.

public mixed CMS_ROOT_URL = self::$_instance['root_url']

If the root_url variable is not specified in the config file, then CMSMS will attempt to calculate one.

PUBLIC_CACHE_LOCATION

A constant to indicate where public (browsable) cachable files can be written.

public mixed PUBLIC_CACHE_LOCATION = self::$_instance['public_cache_location']

PUBLIC_CACHE_URL

A constant to indicate the public address for cachable files.

public mixed PUBLIC_CACHE_URL = self::$_instance['public_cache_url']

TMP_CACHE_LOCATION

A constant to indicate the location where private cacheable files can be written.

public mixed TMP_CACHE_LOCATION = self::$_instance['tmp_cache_location']

TMP_TEMPLATES_C_LOCATION

A constant containing the smarty template compile directory.

public mixed TMP_TEMPLATES_C_LOCATION = self::$_instance['tmp_templates_c_location']

Functions

get_preference()

Retrieve the value of the named preference for the given userid.

get_preference(int $userid, string $prefname[, mixed $default = '' ]) : mixed
Parameters
$userid : int

The user id

$prefname : string

The preference name

$default : mixed = ''

The default value if the preference is not set for the given user id.

Tags
since
0.3
see
cms_siteprefs::get_for_user

set_preference()

Sets the given perference for the given userid with the given value.

set_preference(int $userid, string $prefname, mixed $value) : mixed
Parameters
$userid : int

The user id

$prefname : string

The preference name

$value : mixed

The preference value (will be stored as a string)

Tags
since
0.3
see
cms_siteprefs::set_for_user

cms_db_prefix()

Returns the currently configured database prefix.

cms_db_prefix() : string
Tags
since
0.4
see

CmsApp::GetDbPrefix();

Return values
string

is_sitedown()

A convenience function to test if the site is marked as down according to the config panel.

is_sitedown() : bool

This method includes handling the preference that indicates that site-down behaviour should be disabled for certain IP address ranges.

Return values
bool

redirect()

Redirects to relative URL on the current site.

redirect(string $to) : mixed

If headers have not been sent this method will use header based redirection. Otherwise javascript redirection will be used.

Parameters
$to : string

The url to redirect to

Tags
author

http://www.edoceo.com/

since
0.1

redirect_to_alias()

Given a page ID or an alias, redirect to it.

redirect_to_alias(mixed $alias) : mixed

Retrieves the URL of the specified page, and performs a redirect

Parameters
$alias : mixed

An integer page id or a string page alias.

microtime_diff()

Calculate the difference in seconds between two microtime() values.

microtime_diff(string $a, string $b) : int
Parameters
$a : string

Earlier microtime value

$b : string

Later microtime value

Tags
since
0.3
Return values
int

The difference.

cms_join_path()

Joins a path together using platform specific directory separators.

cms_join_path() : string

Taken from: http://www.php.net/manual/en/ref.dir.php

This method should NOT be used for building URLS.

This method accepts a variable number of string arguments. i.e: $out = cms_join_path($dir1,$dir2,$dir3,$filename); or $out = cms_join_path($dir1,$dir2,$filename);

Tags
since
0.14
Return values
string

cms_relative_path()

Return the relative portion of a path

cms_relative_path(string $in[, string $relative_to = null ]) : string
Parameters
$in : string

The input path or file specification

$relative_to : string = null

The optional path to compute relative to. If not supplied the cmsms root path will be used.

Tags
since
2.2
author

Robert Campbell

Return values
string

The relative portion of the input string.

cms_htmlentities()

Perform HTML entity conversion on a string.

cms_htmlentities(string $val[, string $param = ENT_QUOTES ][, string $charset = "UTF-8" ][, bool $convert_single_quotes = false ]) : string
Parameters
$val : string

The input string

$param : string = ENT_QUOTES

A flag indicating how quotes should be handled (see htmlentities) (ignored)

$charset : string = "UTF-8"

$val The input character set (ignored)

$convert_single_quotes : bool = false

A flag indicating wether single quotes should be converted to entities.

Tags
see
htmlentities
Return values
string

the converted string.

debug_bt_to_log()

A function to output a backtrace into the generated log file.

debug_bt_to_log() : mixed
Tags
see

debug_to_log, debug_bt Rolf: Looks like not used

debug_bt()

A function to generate a backtrace in a readable format.

debug_bt() : mixed

This function does not return but echoes output.

debug_display()

Debug function to display $var nicely in html.

debug_display(mixed $var[, string $title = "" ][, bool $echo_to_screen = true ][, bool $use_html = true ][, bool $showtitle = TRUE ]) : string
Parameters
$var : mixed

The data to display

$title : string = ""

(optional) title for the output. If null memory information is output.

$echo_to_screen : bool = true

(optional) Flag indicating wether the output should be echoed to the screen or returned.

$use_html : bool = true

(optional) flag indicating wether html or text should be used in the output.

$showtitle : bool = TRUE

(optional) flag indicating wether the title field should be displayed in the output.

Return values
string

debug_output()

Display $var nicely only if $config["debug"] is set.

debug_output(mixed $var[, string $title = "" ]) : mixed
Parameters
$var : mixed
$title : string = ""

debug_to_log()

Debug function to output debug information about a variable in a formatted matter to a debug file.

debug_to_log(mixed $var[, string $title = '' ][, string $filename = '' ]) : mixed
Parameters
$var : mixed

data to display

$title : string = ''

optional title.

$filename : string = ''

optional output filename

debug_buffer()

Display $var nicely to the CmsApp::get_instance()->errors array if $config['debug'] is set.

debug_buffer(mixed $var[, string $title = "" ]) : mixed
Parameters
$var : mixed
$title : string = ""

get_parameter_value()

Retrieve the $value from the $parameters array checking for $parameters[$value] and $params[$id.$value].

get_parameter_value(array<string|int, mixed> $parameters, string $value[, mixed $default_value = '' ][, string $session_key = '' ]) : mixed

Returns $default if $value is not in $params array. Note: This function will also trim() string values.

Parameters
$parameters : array<string|int, mixed>
$value : string
$default_value : mixed = ''
$session_key : string = ''

is_directory_writable()

Check the permissions of a directory recursively to make sure that we have write permission to all files.

is_directory_writable(string $path) : bool
Parameters
$path : string

Start directory.

Return values
bool

get_recursive_file_list()

Return an array containing a list of files in a directory performs a recursive search.

get_recursive_file_list(string $path, array<string|int, mixed> $excludes[, int $maxdepth = -1 ][, string $mode = "FULL" ][, d $d = 0 ]) : array<string|int, string>
Parameters
$path : string

Start Path.

$excludes : array<string|int, mixed>

Array of regular expressions indicating files to exclude.

$maxdepth : int = -1

How deep to browse (-1=unlimited)

$mode : string = "FULL"

"FULL"|"DIRS"|"FILES"

$d : d = 0

for internal use only

Return values
array<string|int, string>

recursive_delete()

A function to recursively delete all files and folders in a directory; synonymous with rm -r.

recursive_delete(string $dirname) : bool
Parameters
$dirname : string

The directory name

Return values
bool

chmod_r()

A function to recursively chmod all files and folders in a directory.

chmod_r(string $path, int $mode) : mixed
Parameters
$path : string

The start location

$mode : int

The octal mode Rolf: only used in admin/listmodules.php

Tags
see
chmod

startswith()

A convenience function to test wether one string starts with another.

startswith(string $str, string $sub) : bool

i.e: startswith('The Quick Brown Fox','The');

Parameters
$str : string

The string to test against

$sub : string

The search string

Return values
bool

endswith()

Similar to the startswith method, this function tests with string A ends with string B.

endswith(string $str, string $sub) : bool

i.e: endswith('The Quick Brown Fox','Fox');

Parameters
$str : string

The string to test against

$sub : string

The search string

Return values
bool

munge_string_to_url()

Convert a human readable string into something that is suitable for use in URLS.

munge_string_to_url(string $alias[, bool $tolower = false ][, bool $withslash = false ]) : string
Parameters
$alias : string

String to convert

$tolower : bool = false

Indicates whether output string should be converted to lower case

$withslash : bool = false

Indicates wether slashes should be allowed in the input.

Return values
string

ini_get_boolean()

A convenience function to return a bool variable given a php ini key that represents a bool.

ini_get_boolean(string $str) : int
Parameters
$str : string

The php ini key

Return values
int

stack_trace()

Another convenience function to output a human-readable function stack trace.

stack_trace() : mixed

This method uses echo.

cms_move_uploaded_file()

A wrapper around move_uploaded_file that attempts to ensure permissions on uploaded files are set correctly.

cms_move_uploaded_file(string $tmpfile, string $destination) : mixed
Parameters
$tmpfile : string

The temporary file specification

$destination : string

The destination file specification

Tags
@return

bool.

cms_ipmatches()

A function to test whether an IP address matches a list of expressions.

cms_ipmatches(string $ip, array<string|int, mixed> $checklist) : bool

Credits to J.Adams jna@retins.net

Expressions can be of the form xxx.xxx.xxx.xxx (exact) xxx.xxx.xxx.[yyy-zzz] (range) xxx.xxx.xxx.xxx/nn (nn = # bits, cisco style -- i.e. /24 = class C)

Parameters
$ip : string

IP address to test

$checklist : array<string|int, mixed>

Array of match expressions

Return values
bool

Rolf: only used in lib/content.functions.php

is_email()

Test if the string provided is a valid email address.

is_email(string $email[, bool $checkDNS = false ]) : bool
Parameters
$email : string
$checkDNS : bool = false
Return values
bool

cms_to_bool()

A simple function to convert a string to a bool.

cms_to_bool(string $str) : mixed

accepts, 'y','yes','true',1 as TRUE (case insensitive) all other values represent FALSE.

Parameters
$str : string

Input string to test. Rolf: only used in lib/classes/contenttypes/Content.inc.php

cms_get_jquery()

A function to return the appropriate HTML tags to include the CMSMS included jquery in a web page.

cms_get_jquery([string $exclude = '' ][, bool $ssl = null ][, bool $cdn = false ][, string $append = '' ][, string $custom_root = '' ][, bool $include_css = TRUE ]) : mixed

CMSMS is distributed with a recent version of jQuery, jQueryUI and various other jquery based libraries. This function generates the HTML code that will include these scripts.

See the {cms_jquery} smarty plugin for a convenient way of including the CMSMS provided jquery libraries from within a smarty template.

Known libraries: jquery jquery-ui nestedSortable json migrate

Parameters
$exclude : string = ''

A comma separated list of script names or aliases to exclude.

$ssl : bool = null

Force use of the ssl_url for the root url to necessary scripts.

$cdn : bool = false

Force the use of a CDN url for the libraries if one is known

$append : string = ''

A comma separated list of library URLS to the output

$custom_root : string = ''

A custom root URL for all scripts (when using local mode). If this is spefied the $ssl param will be ignored.

$include_css : bool = TRUE

Optionally output stylesheet tags for the included javascript libraries.

Tags
since
1.10

is_base64()

Test if a string is a base64 encoded string

is_base64(string $s) : bool
Parameters
$s : string

The input string

Tags
since
2.2
Return values
bool

get_userid()

Gets the userid of the currently logged in user.

get_userid([bool $redirect = true ]) : int

If an effective uid has been set in the session, AND the primary user is a member of the admin group then allow emulating that effective uid.

Parameters
$redirect : bool = true

Redirect to the admin login page if the user is not logged in.

Tags
since
0.1
Return values
int

The UID of the logged in administrator, otherwise FALSE

get_username()

Gets the username of the currently logged in user.

get_username([bool $check = true ]) : string

If an effective username has been set in the session, AND the primary user is a member of the admin group then return the effective username.

Parameters
$check : bool = true

Redirect to the admin login page if the user is not logged in.

Tags
since
2.0
Return values
string

the username of the logged in user.

check_login()

Checks to see if the user is logged in and the request has the proper key. If not, redirects the browser to the admin login.

check_login([string $no_redirect = false ]) : bool

Note: Because this method validates that the secret key is in the URL and matches the one that is in the session this method should only be called from admin actions.

Parameters
$no_redirect : string = false

If true, then don't redirect if not logged in

Tags
since
0.1
Return values
bool

check_permission()

Checks to see that the given userid has access to the given permission.

check_permission(int $userid, string $permname) : bool

Members of the admin group have all permissions.

Parameters
$userid : int

The user id

$permname : string

The permission name

Tags
since
0.1
Return values
bool

audit()

Put an event into the audit (admin) log. This should be done on most admin events for consistency.

audit(int $itemid, string $itemname, string $action) : void
Parameters
$itemid : int

The item id (perhaps a content id, or a record id from a module)

$itemname : string

The item name (perhaps Content, or the module name)

$action : string

The action that needs to be audited

Tags
since
0.3

get_site_preference()

Gets the given site prefernce

get_site_preference(string $prefname[, mixed $defaultvalue = '' ]) : mixed
Parameters
$prefname : string

The preference name

$defaultvalue : mixed = ''

The default value if the preference does not exist

Tags
since
0.6
see
cms_siteprefs::get

remove_site_preference()

Removes the given site preference

remove_site_preference(string $prefname[, bool $uselike = false ]) : void
Parameters
$prefname : string

Preference name to remove

$uselike : bool = false

Wether or not to remove all preferences that are LIKE the supplied name

Tags
see
cms_siteprefs::remove

set_site_preference()

Sets the given site perference with the given value.

set_site_preference(string $prefname, mixed $value) : void
Parameters
$prefname : string

The preference name

$value : mixed

The preference value (will be stored as a string)

Tags
see
cms_siteprefs::set
since
0.6

locale_ftime()

Replacement for deprecated strftime function

locale_ftime(string $format[, mixed $datevar = null ]) : string
Parameters
$format : string

strftime()- and/or date()-compatible format specifier

$datevar : mixed = null

timestamp | date-time-string | DateTime object | empty to use time() value

Tags
since
2.2.16
Return values
string

cms_set_frontend_language()

Temporarily override the current frontend language.

cms_set_frontend_language([string $lang = '' ]) : mixed
Parameters
$lang : string = ''

The language to set. If empty, the system will be restored to the default frontend language.

Tags
see
CmsNlsOperations::set_language()

lang_by_realm()

Retrieve a translation for a specific string in a specific realm.

lang_by_realm(string $realm, string $key) : string

Called with the realm first, followed by the key, this method will attempt to load the specific realm data if necessary before doing translation.

This method accepts a variable number of arguments. Any arguments after the realm and the key are passed to the key via vsprintf

i.e: lang_by_realm('tasks','my_string');

Parameters
$realm : string

The realm

$key : string

The lang key and any vspring arguments.

Tags
since
1.8
Return values
string

lang()

Return a translated string for the default 'admin' realm.

lang(string $key) : string

This function is merely a wrapper around the lang_by_realm function that assumes the realm is 'admin'.

This method will throw a notice if it is called from a frontend request

i.e: lang('title');

Parameters
$key : string

The key to translate and then any vsprintf arguments for the key.

Tags
see
lang_by_realm
Return values
string

get_encoding()

Get the encoding of the current language.

get_encoding() : string
Tags
see

CmsNlsOperations::get_encoding();

Return values
string

get_language_list()

Retrieve a list of installed languages that is suitable for use in a dropdown.

get_language_list([bool $allow_none = true ]) : associative
Parameters
$allow_none : bool = true

Optionally adds 'none' (translated to current language) to the top of the list.

Return values
associative

array of lang keys and display strings.

Search results