Functions

cms_set_frontend_language

Temporarily override the current frontend language.

lang_by_realm

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

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');

lang

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

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');

get_encoding

Get the encoding of the current language.

get_language_list

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

is_sitedown

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

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

redirect

Redirects to relative URL on the current site.

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

redirect_to_alias

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

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

microtime_diff

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

cms_join_path

Joins a path together using platform specific directory separators.

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);

cms_relative_path

Return the relative portion of a path

cms_htmlentities

Perform HTML entity conversion on a string.

debug_bt_to_log

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

debug_bt

A function to generate a backtrace in a readable format.

This function does not return but echoes output.

debug_display

Debug function to display $var nicely in html.

debug_output

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

debug_to_log

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

debug_buffer

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

get_parameter_value

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

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

is_directory_writable

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

get_recursive_file_list

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

recursive_delete

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

chmod_r

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

startswith

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

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

endswith

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

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

munge_string_to_url

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

ini_get_boolean

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

stack_trace

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

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_ipmatches

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

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)

is_email

Test if the string provided is a valid email address.

cms_to_bool

A simple function to convert a string to a bool.

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

cms_get_jquery

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

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

get_userid

Gets the userid of the currently logged in user.

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.

get_username

Gets the username of the currently logged in user.

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.

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_permission

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

Members of the admin group have all permissions.

audit

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

get_site_preference

Gets the given site prefernce

remove_site_preference

Removes the given site preference

set_site_preference

Sets the given site perference with the given value.

NewDataDictionary

A method to create a new data dictionary object

ADONewConnection

A function co create a new adodb database connection.

load_adodb

A function to load the adodb library.

This method currently has no functionality.

adodb_connect

An old method to ensure that we are re-connected to the proper database

adodb_error

An old function for handling a database error.

get_preference

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

set_preference

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

cmsms

Return the global cmsms() object.

cms_db_prefix

Returns the currently configured database prefix.

Constants

__CMS_PREVIEW_PAGE__

CMS_ADODB_DT

A constant to assist with date and time flags in the data dictionary.

TMP_CACHE_LOCATION

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

PUBLIC_CACHE_LOCATION

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

PUBLIC_CACHE_URL

A constant to indicate the public address for cachable files.

TMP_TEMPLATES_C_LOCATION

A constant containing the smarty template compile directory.

CMS_DEBUG

A constant indicating if CMSMS is in debug mode.

CMS_ROOT_PATH

A constant containing the directory where CMSMS is installed.

CMS_ROOT_URL

A constant containing the CMSMS root url.

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

CMS_DB_PREFIX

CLEAN_INT

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

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.

CLEAN_NONE

Indicates that the incoming parameter is not to be cleaned.

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

CLEAN_STRING

Indicates that the incoming parameter is a string.

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.

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

CLEAN_FILE

Indicates that the incoming parameter is an uploaded file.

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

Classes, interfaces and traits

CronJobTrait

A Trait to define functionality for recurring cron jobs.

FilePickerInterface

Define an interface for modules that provide filepicker functionality.

« More »

CmsRegularTask

An interface to define how tasks should work.

« More »

CronJobInterface

A simple interface to define the functions and constants needed for a cron job.

« More »

ContentBase

Base level content object.

This is the base level content class. It is an abstract object and cannot be instantiated directly. All content pages in the database are required to be drived from this class.
« More »

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.

« More »

CmsFormUtils

A static class providing functionality for building forms.

« More »

User

Generic admin user class. This can be used for any logged in user or user related function.

« More »

FilePickerProfile

A simple class that defines a profile of information used by the filepicker to indicate how it should behave and what functionality should be provided.

This is an immutable class. The constructor and overrideWith methods of this class accept an associative array of parameters (see the properties below) to allow building or altering a profile object. Ths is the only time when properties of a profile can be adjusted. ```php $obj = new \CMSMS\FilePickerProfile( [ 'type'=>FileType::TYPE_IMAGE, 'exclude_prefix'=>'foo' ] );
« More »

HookHandler

An internal class to represent a hook handler.

« More »

HookDefn

An internal class to represent a hook.

« More »

HookManager

A class to manage hooks, and to call hook handlers.

This class is capable of managing a flexible list of hooks, registering handlers for those hooks, and calling the handlers and/or related events.
« More »

Statement

A class defining a prepared database statement.

« More »

CmsNlsOperations

A singleton class to provide simple, generic mechanism for dealing with languages encodings, and locales. This class does not handle translation strings.

« More »

DataDictionary

A class defining methods to work directly with database tables.

This file is based on the DataDictionary base class from the adodb_lite library which was in turn a fork of the adodb library at approximately 2004. Credits and kudos to the authors of those packages.
« More »

CmsLayoutTemplateType

A class to manage template types

« More »

CmsNls

A class to provide data and methods for encapsulating a single language

« More »

CmsLayoutStylesheetQuery

A class to represent a template query, and its results.

This class accepts in it's constructor an array of filter arguments.
« More »

Group

Generic group class. This can be used for any logged in group or group related function.

« More »

FileType

A simple abstract class that defines constants for numerous file types.

« More »

CmsAdminUtils

A set of static utilities for assisting with admin requests

« More »

cms_url

A class for interacting with a URL.

« More »

ContentOperations

Class for static methods related to content

« More »

ContentManager

A simple alias for the ContentOperations class

« More »

ExternalHandlerJob

A type of job that calls an external function for processing. i.e: a UDT or a static function.

If a module is specified for this object, then the module will be loaded before calling the handler.
« More »

Events

Class for handling and dispatching system and user defined events.

« More »

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.

modules may supply a language detector to read from preferences etc.
« More »

cms_tree

A Simple PHP Tree class that allows storing associative data along with each node.

« More »

JobManager

A singleton class defining a manager for asyncrhonous jobs.

In reality, this is a simple proxy for methods in the CmsJobManager module.
« More »

CmsRoute

Simple global convenience object to hold information for a single route.

« More »

cms_mailer

A class for sending email.

Prior to CMSMS 2.0 this class was implemented as a core module.
« More »

GroupOperations

A singleton Class for doing group related functions.

Many of the Group object functions are just wrappers around these.
« More »

UserOperations

Class for doing user related functions. Maybe of the User object functions are just wrappers around these.

« More »

compatibility

A class for providing some compatibility functionality with older module code

« More »

CmsAdminThemeBase

Base class for CMSMS Admin themes.

This is an abstract class that is used for building CMSMS Admin Themes. This is also a singleton object.
« More »

CmsAdminThemeNotification

A class representing a simple notification.

« More »

CmsLayoutTemplate

A class to represent a smarty template.

« More »

CmsLayoutStylesheet

A class to represent a stylesheet.

This class is capable of managing a single stylesheet, and has static methods for loading stylesheets from the database. Loaded stylesheets are cached in internal memory to ensure that the same stylesheet is not loaded twice for a request. Stylesheets are (optionally) attached to designs (CmsLayoutCollection) see the {cms_stylesheet} plugin for more information.
« More »

RegularTask

This class allows converting an old CmsRegularTask pseudocron task into an asynchronous background job.

« More »

cms_siteprefs

A class for working with site preferences

« More »

CmsLangOperations

A singleton class to provide simple, generic mechanism for dealing with languages encodings, and locales. This class does not handle translation strings.

« More »

CmsLayoutTemplateQuery

A class to represent a template query, and its results.

This class accepts in it's constructor an array (or a comma separated string, of filter arguments). Accepted filter arguments are:<br/> o:string - The originator name<br/> i:##,##,## - A list of template id's<br/> t:## - A template type id<br/> c:## - A template category id.<br/> d:## - A design id<br/> u:## - A template owner id<br/> e:## - An additional editor id.<br/> l:# - A boolean (0 or 1) indicating listable, or not listable. Example:<br/> <code> $qry = new CmsTemplateQuery(array('o:'.get_userid(false)));<br/> $qry->limit = 50;<br/> $list = $qry->GetMatches();<br/> </code>
« More »

CMSModuleContentType

Class that module defined content types must extend.

This is the base level content class. It is an abstract object and cannot be instantiated directly. All content pages in the database are required to be drived from this class.
« More »

CmsAdminMenuItem

Base module class.

All modules should inherit and extend this class with their functionality.
« More »

TemplateTypeAssistant

An abstract class to define an assistant to the template type objects in the database.

« More »

Alert

An abstract class that defines Admin Alerts for CMSMS.

Admin alerts have a name, priority, title, message, a timestamp and can optionally refer to a module. Methods are used to test if a module is for a specific user, and to format the message. Alerts are stored as preferences in the database. If the name is the name of the class or something else that is not data or time dependant the only one instance of that alert can be stored in the database. This class usses the ArrayAccess interface to behave like a PHP array.
« More »

CronJob

An abstract base class for a cronjob.

A Cron job is different than a regular job in that it recurs at a specified frequency and can have an end/until date.
« More »

Resultset

A class defining a resultset and how to interact with results from a database query.

« More »

cms_utils

A Simple Static class providing various convenience utilities.

« More »

cms_module_smarty_plugin_manager

A singleton class to manage static smarty plugins registered by modules.

« More »

cms_userprefs

A static class for preferences stored with admin user accounts

« More »

CmsLayoutTemplateCategory

A class representing a template category.

Templates can be optionally organized into categories, this class manages the category itself.
« More »

FileTypeHelper

A class to provide utilities for manipulating files by their type.

« More »

cms_cookies

A simple static class providing convenience utilities for working with cookies.

« More »

cms_http_request

HTTP Class

This is a wrapper HTTP class that uses either cURL or fsockopen to harvest resources from web. This can be used with scripts that need a way to communicate with various APIs who support REST. Modified by Robert Campbell (calguy1000@cmsmadesimple.org) Renamed the class to cms_http_request Fixed some bugs.
« More »

CmsLockOperations

A singleton class providing utilities for interacting with locks.

« More »

CmsApp

Simple singleton class that contains various functions and states representing the application.

Note: This class was named CmsObject before version 1.10
« More »

CmsContentTypePlaceholder

Simple global convenience object to hold CMS Content Type structure.

« More »

UserTagOperations

UserTags class for admin

« More »

cms_admin_utils

A Simple static class providing various convenience utilities for admin requests.

« More »

cms_cache_driver

An abstract class for various cache drivers

« More »

cms_tree_operations

A utility class to provide functions to populate a tree

« More »

cms_config

A singleton class for interacting with the CMSMS config.php file.

This class usses the ArrayAccess interface to behave like a PHP array.
« More »

cms_cache_handler

This singleton class provides a convenient caching capbility.

By default this uses the cms_filecache_driver to cache data in the TMP_CACHE_LOCATION for one hour.
« More »

CmsPermission

Simple class for dealing with a permission.

« More »

SimpleAlert

The SimpleAlert class is a type of alert that allows the developer to create alerts with pre-defined titles, messages, icons, and permissions.

Admin alerts have a name, priority, title, message, a timestamp and can optionally refer to a module. Methods are used to test if a module is for a specific user, and to format the message. Alerts are stored as preferences in the database. If the name is the name of the class or something else that is not data or time dependant the only one instance of that alert can be stored in the database. This class usses the ArrayAccess interface to behave like a PHP array.
« More »

CmsDbQueryBase

An abstract class for building queries and managing results.

This class is capable of managing a resultset, and encapsulates conversionof database rows into application objects.
« More »

CMSModule

Base module class.

All modules should inherit and extend this class with their functionality.
« More »

ConnectionSpec

A class defining all of the details needed to connect to a database.

Some database drivers may not require all of the parameters.
« More »

ConnectionSpecException

A special exception to indicate a problem with a ConnectionSpec

« More »

CmsCoreCapabilities

A class that identifies numerous standard core capabilities

« More »

BookmarkOperations

Class for doing bookmark related functions. Maybe of the Bookmark object functions are just wrappers around these.

« More »

Job

A class defining an asynchronous job, and mechanisms for saving and retrieving that job.

« More »

CmsLayoutCollection

A class to manage a collection (or theme) of Templates and Stylesheets

« More »

CmsLockException

An exception indicating an error creating a lock

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsLockOwnerException

An exception indicating a uid mismatch wrt a lock (person operating on the lock is not the owner)

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsUnLockException

An exception indicating an error removing a lock

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsNoLockException

An exception indicating an error loading or finding a lock

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsLock

A simple class represeinting a lock on a logical object in CMSMS.

« More »

Connection

A class defining a database connection, and mechanisms for working with a database.

This library is largely compatible with adodb_lite with the pear,extended,transaction plugins with a few notable differences: Differences: <ul> <li>GenID will not automatically create a sequence table. <p>We encourage you to not use sequence tables and use auto-increment fields instead.</p> </li> </ul>
« More »

DatabaseException

A special type of exception related to database queries.

« More »

DatabaseConnectionException

A special exception indicating a problem connecting to the database.

« More »

cms_route_manager

A class to manage all recognized routes in the system.

« More »

cms_filecache_driver

A cache driver to cache files using the filesystem.

This driver stores files in the CMSMS TMP_CACHE location. Supports read, and write locking a settable cache lifetime, md5 encoded keys and groups so that filenames cannot be easily determined, and automatic cleaning.
« More »

cms_admin_tabs

A simple convenience class for creating a tabbed interface in the CMSMS admin console

« More »

ModuleOperations

A singleton utility class to allow for working with modules.

« More »

Bookmark

Bookmark class for the CMSMS admin console.

« More »

CmsExtraDataException

A basic exception class that holds on to extended information.

« More »

CmsException

A base CMSMS Exception

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsLogicException

A base CMSMS Logic Exception

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsCommunicationException

A base CMSMS Communications Exception

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsPrivacyException

A base CMSMS Privacy Exception

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsSingletonException

A base CMSMS Singleton Exception

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsInvalidDataException

An exception indicating invalid data was supplied to a function or class.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsDataNotFoundException

An exception indicating that the requested data could not be found.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsError404Exception

A special exception indicating that a 404 error should be supplied.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsError403Exception

A special exception indicating that a 403 error should be supplied.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsContentException

A special exception indicating an error with a content object

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsEditContentException

A special exception indicating an error when editing content.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsSQLErrorException

A special exception indicating an SQL Error.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsXMLErrorException

A special exception indicating an XML Error.

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

CmsFileSystemException

A special exception indicating a problem with a file, directory, or filesystem

This exception can accept an integer 'code' for an exception or a language key. if the string passed in contains a space it is not translated.
« More »

TranslatableAlert

The TranslatableAlert object is an alert that supports translatable language keys.

This class will use the module that is associated with the alert to translate the key. If the module name is empty, or the special value 'core' then the global 'lang' function will be used to read translations from the admin lang file.
« More »

Classes, interfaces and traits

EmptyResultset

A final class to describe a special (empty) recordset.

« More »