The following list of functions will be presented in alphabetical order. This is a documentation for CMSimple_XH core developers, although several of these functions are useful for extension writers. If not otherwise noted all functions are defined in /cmsimple/cms.php.
string function a(int $number, string $query_string)
Returns an opening <a>-tag to the CMSimple_XH page given by $number. $query_string will be appended to the generated URI.
E.g. call it as follows:
echo a(0, '&param=value').'Link</a>';
string function amp()
Returns '&' or '&' according to the setting of $cf['xhtml']['amp'].
This function is deprecated: use & directly instead.
string function autogallery(string $url)
Returns the code to display a photogallery. $url should point to autogallery's installation folder.
This function is deprecated: use a gallery plugin instead
autogallery() is defined in /cmsimple/functions.php.
bool function chkdl(string $url)
Returns wether the file $filename exists in the download folder and is available for download. Note: $url should be the download URL, e.g. ?download=name.ext
void function chkfile(string $file, bool $writeable)
Checks wether $file exists1), is readable, and if $writeable is true, is writeable. Appends an according message to $e otherwise.
int function cmscript(string $script, string $text)
Returns the number of times the CMSimple script $script is found in $text. Caveat: cmscript() ignores the new notation {{{PLUGIN:...}}}.
void function download(string $filename)
Makes the file $filename available for download. If the file can't be downloaded, an HTTP 404 Not found response will be generated.
void function e(string $errortext, string $filetype, string $filename)
Appends an error message about the file $filename to $e. $errortext should be a key in $tx['error']; $filetype should be a key in $tx['filetype'].
mixed function gc(string $cookiename)
Returns the value of the cookie $cookiename, or NULL if the cookie doesn't exist.
gc() is defined in /cmsimple/login.php.
string function geturl(string $url)
Returns the inner HTML of the <body> of the given $url.
geturl() is defined in /cmsimple/functions.php
string function geturlwp(string $url)
Returns the full content of the given $url.
geturlwp() is defined in /cmsimple/functions.php.
string function h(int $i)
Returns $h[$i]. This is a convenience function meant to be used inside other functions.
h() is defined in /cmsimple/functions.php.
void function initvar(string $varname)
Initializes the global $varname to the appropriate $_GET or $_POST value, or the empty string.
mixed im(string $name, string $param)
Returns parameter $param of an uploaded file $name.
im() is defined in /cmsimple/adm.php.
int function l(int $i)
Returns the menu level of page no. $i.
l() is defined in /cmsimple/functions.php.
bool logincheck()
Returns wether the user is currently logged in.
logincheck() is defined in /cmsimple/login.php.
mixed meta(string $name)
Returns the <meta> tag for name $name if defined in $cf['meta'], NULL otherwise.
string function ml(string $name)
Returns the menu entry for the special CMSimple_XH page $name, e.g. sitemap.
mixed function newsbox(string $title)
Returns the content of page $title, with heading and CMSimple scripting removed, if the page exists, NULL otherwise.
newsbox() is defined in /cmsimple/functions.php.
mixed function rf(string $filename)
Returns the content of file $filename, if it does exist, NULL otherwise.
Remarks on rf() vs. file_get_contents(): These functions have nearly identical results, but rf() also clears the stat cache, returns NULL instead of FALSE in case of failure, has no additional parameters, and uses a fallback in case file_get_contents() is not defined (PHP < 4.3.0).
BUG?: In case the fallback is used, rf() doubles the line endings.
return join("\n", file($fl));
should IMHO be changed to
return join('', file($fl));
AFAIK support for PHP < 4.3.0 isn't required for CMSimple_XH, so rf() might as well be changed to not use the fallback at all.
void function rfc()
This basic function reads content.htm and creates all according global variables of CMSimple_XH.
string function rmnl(string $text)
Returns $text with multiple consecutive line endings in it replaced by single line endings.
string function rp(string $path)
Returns the canonicalized absolute pathname of $path, if $path exists, else $path.
void function selectlist(string $function, string $pattern, string $replacement)
Appends a dropdown menu to $o (used in the back-end for language and template selection).
selectlist() is defined in /cmsimple/adm.php
void function shead(string $errorname)
Sends header 401 resp. 404, if $errorname is '401' resp. '404'. Otherwise appends $tx['error'][$errorname] as <h1> to $o.
array function sortdir(string $dirname)
Returns the alphabetically sorted content of directory $dirname. Caveat: the result includes '.' and '..'.
string function stsl(string $text)
Returns $text with all backslashes stripped according to the setting of gpc_magic_quotes. IOW it undoes the result of gpc_magic_quotes == on.
string function sv(string $name)
Returns the server variable $name, if it's set, the empty string otherwise.
string function tag(string $content)
Returns an HTML/XHTML compliant stand alone tag $content according to the settings of $cf['xhtml']['endtags']. E.g.
tag('img src="img.jpg"')
returns '<img src=“img.jpg”>' resp. '<img src=“img.jpg” />'
string function uenc(string $url)
Returns url encoded $url with all character sequences in $tx['urichar']['org'] replaced by their according character sequences in $tx['urichar']['new']. uenc() should be prefered over urlencode() for CMSimple_XH.
void function writelog(string $message)
Appends the message $message to the logfile, if the logfile does exist, otherwise appends an according message to $e.
string function plugin_admin_common(string $action, string $admin, string $plugin, array $hint=array())
Returns the standard forms for common back-end tasks, eg. “Plugin Stylesheet” according to $action, $admin and $plugin. See the tutorial for plugin developers for details.
string function print_plugin_admin(string $main)
Returns the current plugin's menu in the back-end. If $main != 'on' the “Plugin Main Settings” will be supressed.
void function $pd_router->update(int $id, array $params)
Updates the page data of page no. $id with the data from $params.
array function $pd_router->new_page(array $params = null)
Returns a new page data page array initialitzed with $params.
bool function $pd_router->model->refresh(array $data = NULL)
Rewrites all page data with $data, if $data is not NULL. Returns wether this was the case.