CMSimple_XH
|
Functions | |
geturl ($u) | |
Returns the inner HTML of the body element of the given URL. More... | |
geturlwp ($u) | |
Returns the contents of the given URL adding all current GET parameters. More... | |
h ($n) | |
Returns a page heading. More... | |
l ($n) | |
Returns a page's menu level. More... | |
evaluate_cmsimple_scripting ($__text, $__compat=true) | |
Returns a text with CMSimple scripting evaluated. More... | |
evaluate_plugincall ($text) | |
Returns a text with all plugin calls evaluatated. More... | |
XH_evaluateSinglePluginCall ($___expression) | |
Returns the result of evaluating a single plugin call expression. More... | |
XH_escapeCMSimpleScripting (array $matches) | |
Escapes CMSimple scripting returned from a plugin call. More... | |
XH_spliceString (&$string, $offset, $length=0, $replacement='') | |
Removes a portion of a string and replaces it with something else. More... | |
evaluate_scripting ($text, $compat=true) | |
Returns a text with CMSimple scripting and plugin calls evaluated. More... | |
newsbox ($heading) | |
Returns content of the first page with the heading $heading with the heading removed and all scripting evaluated. More... | |
init_editor (array $elementClasses=array(), $initFile=false) | |
Calls init_*() of the configured editor. More... | |
include_editor () | |
Calls include_*() of the configured editor. More... | |
editor_replace ($elementID=false, $config='') | |
Returns the result of calling *_replace() of the configured editor. More... | |
XH_finalCleanUp ($html) | |
Callback for output buffering. More... | |
initvar ($name) | |
Initializes a global variable according to a GET or POST parameter. More... | |
sv ($s) | |
Returns the value of a $_SERVER key. More... | |
rmnl ($t) | |
Returns $t with all (consecutive) line endings replaced by a single newline. More... | |
XH_rmws ($str) | |
Returns $str with all (consecutive) whitespaces replaced by a single space. More... | |
rmanl ($t) | |
Returns $t with all line endings removed. More... | |
stsl ($t) | |
Returns the un-quoted $t, i.e. More... | |
download ($fl) | |
Makes the file available for download. More... | |
e ($et, $ft, $fn) | |
Appends an error message about the file to $e. More... | |
rfc () | |
Reads and parses the content file and sets global variables accordingly. More... | |
XH_readContents ($language=null) | |
Reads and parses a content file. More... | |
XH_findPreviousPage () | |
Finds the index of the previous page. More... | |
XH_findNextPage () | |
Finds the index of the next page. More... | |
a ($i, $x) | |
Returns an opening a tag as link to a page. More... | |
meta ($n) | |
Returns the meta element for name, if defined in $cf['meta']; null otherwise. More... | |
ml ($i) | |
Returns the link to a special CMSimple_XH page, e.g. More... | |
uenc ($s) | |
Returns a percent encoded URL component. More... | |
XH_uenc ($s, array $search, array $replace) | |
Returns a percent encoded URL component. More... | |
sortdir ($dir) | |
Returns the alphabetically sorted content of a directory. More... | |
cmscript ($script, $text) | |
Returns the number of times a CMSimple script is found. More... | |
hide ($i) | |
Returns whether a page is hidden. More... | |
tag ($s) | |
Returns an HTML stand alone tag. More... | |
shead ($s) | |
Sends error header and sets $title and $o accordingly. More... | |
XH_debugmode () | |
Debug-Mode. More... | |
XH_debug ($errno, $errstr, $errfile, $errline) | |
Writes all recoverable PHP errors to $e. More... | |
XH_checkValidUtf8 (array $arr) | |
Checks $arr recursively for valid UTF-8. More... | |
XH_createLanguageFile ($dst) | |
Copies default file, if actual language file is missing. More... | |
pluginFiles ($plugin) | |
Set plugin paths. More... | |
XH_plugins ($admin=false) | |
Returns a list of all active plugins. More... | |
gc ($s) | |
Returns the value of a cookie, or null if the cookie doesn't exist. More... | |
logincheck () | |
Returns wether the user is logged in. More... | |
XH_logMessage ($type, $module, $category, $description) | |
Appends a message to the log file, and returns whether that succeeded. More... | |
loginforms () | |
Returns the login form. More... | |
XH_readFile ($filename) | |
Reads a file and returns its contents; false on failure. More... | |
XH_writeFile ($filename, $contents) | |
Writes $contents to the file $filename. More... | |
XH_afterPluginLoading ($callback=null) | |
Registers a callback for execution after all plugins were loaded, if $callback is given; otherwise executes these callbacks. More... | |
XH_afterFinalCleanUp ($param) | |
Registers or executes registered callbacks at the end of XH_finalCleanUp(). More... | |
XH_pluginStylesheet () | |
Returns the path of the combined plugin stylesheet. More... | |
XH_adjustStylesheetURLs ($plugin, $css) | |
Adjusts all relative url(...) in a stylesheet to be used in the combined plugin stylesheet. More... | |
XH_message ($type, $message) | |
Returns an HTML element formatted as message. More... | |
XH_backup () | |
Creates backups of all content files. More... | |
XH_isLanguageFolder ($name) | |
Returns whether $name is a language folder. More... | |
XH_title ($site, $subtitle) | |
Returns the text content for a TITLE element. More... | |
XH_builtinTemplate ($bodyClass) | |
A minimal built-in template for some special functions. More... | |
XH_helpIcon ($tooltip) | |
Returns a help icon which displays a tooltip on hover. More... | |
XH_isContentBackup ($filename, $regularOnly=true) | |
Returns whether a file is a content backup by checking the filename. More... | |
XH_templates () | |
Returns an array of installed templates. More... | |
XH_availableLocalizations () | |
Returns an array of available languages (in cmsimple/languages/). More... | |
XH_secondLanguages () | |
Returns the installed second languages in alphabetic order. More... | |
XH_isInternalPath ($path) | |
Returns whether a path refers to a CMSimple index.php. More... | |
XH_isInternalUrl ($urlParts) | |
Returns whether a URL points to this CMSimple installation. More... | |
XH_convertToPrintUrl (array $matches) | |
Returns a single URL converted to a print URL, if appropriate. More... | |
XH_convertPrintUrls ($pageContent) | |
Convert all internal URLs in a text to print URLs. More... | |
XH_decodeJson ($string) | |
Returns the JSON string decoded as PHP value. More... | |
XH_encodeJson ($value) | |
Returns the JSON representation of a value. More... | |
XH_lastJsonError () | |
Returns whether an error has occurred during the last XH_decodeJson(). More... | |
XH_hsc ($string) | |
Converts special characters to HTML entities. More... | |
XH_mailform ($subject=null) | |
Handles a mailform embedded in a CMSimple_XH page. More... | |
XH_includeVar ($_filename, $_varname) | |
Includes a PHP data file and returns the value of the variable. More... | |
XH_numberSuffix ($count) | |
Returns a suffix for a language string key according to the number (singular, paucal or plural). More... | |
XH_readConfiguration ($plugin=false, $language=false) | |
Returns the configuration resp. More... | |
XH_unionOf2DArrays (array $array1, array $array2) | |
Returns the union of two "2-dimensional" arrays in the same manner as the union operator (i.e. More... | |
XH_renameFile ($oldname, $newname) | |
Attempts to rename oldname to newname, and returns whether that succeeded. More... | |
XH_exit ($status=0) | |
Exits the running script. More... | |
XH_getRootFolder () | |
Returns the root (= installation) folder of the system. More... | |
XH_registerPluginType ($type, $plugin=null) | |
Registers the type of a plugin resp. More... | |
XH_registeredEditorPlugins () | |
Returns the names of the registered editor plugins. More... | |
XH_registeredFilebrowserPlugins () | |
Returns the names of the registered filebrowser plugins. More... | |
XH_registeredPagemanagerPlugins () | |
Returns the names of the registered pagemanager plugins. More... | |
XH_registeredEditmenuPlugins () | |
Returns the names of the registered editmenu plugins. More... | |
XH_onShutdown () | |
Handles the shutdown of the script. More... | |
XH_formatDate ($timestamp) | |
Returns a timestamp formatted according to config and lang. More... | |
XH_lockFile ($handle, $operation) | |
Implements portable advisory file locking. More... | |
XH_highlightSearchWords (array $words, $text) | |
Highlights the search words in a text. More... | |
XH_autoload ($className) | |
Autoloads classes named after CMSimple_XH/PEAR coding standards. More... | |
XH_startSession () | |
Starts a named session. More... | |
XH_getLocatorModel () | |
Returns the locator (breadcrumb navigation) model. More... | |
XH_getPageURL ($index) | |
Returns the full URL of a page. More... | |
XH_redirectSelectedUrl () | |
Returns the URL where to redirect selected GEt requests. More... | |
General functions.
a | ( | $i, | |
$x | |||
) |
Returns an opening a tag as link to a page.
int | $i | The page index. |
string | $x | Arbitrary appendix of the URL. |
cmscript | ( | $script, | |
$text | |||
) |
Returns the number of times a CMSimple script is found.
string | $script | The needle. |
string | $text | The haystack. |
download | ( | $fl | ) |
Makes the file available for download.
If the file can't be downloaded, an HTTP 404 Not found response will be generated.
string | $fl | The file name. |
e | ( | $et, | |
$ft, | |||
$fn | |||
) |
Appends an error message about the file to $e.
string | $et | A key in $tx['error']. |
string | $ft | A key in $tx['filetype']. |
string | $fn | The file name. |
editor_replace | ( | $elementID = false , |
|
$config = '' |
|||
) |
Returns the result of calling *_replace() of the configured editor.
Returns false on failure.
string | false | $elementID | The element with this ID will become an editor. |
string | $config | The configuration. |
evaluate_cmsimple_scripting | ( | $__text, | |
$__compat = true |
|||
) |
Returns a text with CMSimple scripting evaluated.
Scripts are evaluated as if they were in the global scope, except that no new global variables can be defined (unless via $GLOBALS).
string | $__text | The text. |
bool | $__compat | Whether only last CMSimple script should be evaluated. |
evaluate_plugincall | ( | $text | ) |
Returns a text with all plugin calls evaluatated.
All Plugins which are called through a function-call can use this. At the moment it is not possible to do this with class-based plugins. They need to be called through standard-CMSimple-Scripting. Alternatively one can offer a functional wrapper.
To call a plugin, place the following on a CMSimple_XH page (example): {{{pluginfunction('parameters');}}}
About the scope rules see XH_evaluateSinglePluginCall.
string | $text | The text. |
evaluate_scripting | ( | $text, | |
$compat = true |
|||
) |
Returns a text with CMSimple scripting and plugin calls evaluated.
string | $text | The text. |
bool | $compat | Whether only last CMSimple script will be evaluated. |
gc | ( | $s | ) |
Returns the value of a cookie, or null if the cookie doesn't exist.
string | $s | The name of the cookie. |
geturl | ( | $u | ) |
Returns the inner HTML of the body element of the given URL.
string | $u | A URL. |
geturlwp | ( | $u | ) |
Returns the contents of the given URL adding all current GET parameters.
string | $u | A URL. |
h | ( | $n | ) |
Returns a page heading.
int | $n | The index of the page. |
hide | ( | $i | ) |
Returns whether a page is hidden.
int | $i | The page index. |
include_editor | ( | ) |
Calls include_*() of the configured editor.
Returns whether that succeeded.
init_editor | ( | array | $elementClasses = array() , |
$initFile = false |
|||
) |
Calls init_*() of the configured editor.
Returns whether that succeeded.
array | $elementClasses | Elements with these classes will become an editor. |
mixed | $initFile | The init file or configuration. |
initvar | ( | $name | ) |
Initializes a global variable according to a GET or POST parameter.
string | $name | The name of the global variable. |
l | ( | $n | ) |
Returns a page's menu level.
int | $n | The index of the page. |
logincheck | ( | ) |
Returns wether the user is logged in.
loginforms | ( | ) |
Returns the login form.
meta | ( | $n | ) |
Returns the meta element for name, if defined in $cf['meta']; null otherwise.
string | $n | The name attribute. |
ml | ( | $i | ) |
Returns the link to a special CMSimple_XH page, e.g.
sitemap.
string | $i | A key of $tx['menu']. |
newsbox | ( | $heading | ) |
Returns content of the first page with the heading $heading with the heading removed and all scripting evaluated.
Returns false, if the page doesn't exist.
string | $heading | The page heading. |
pluginFiles | ( | $plugin | ) |
Set plugin paths.
string | $plugin | The name of the plugin. |
rfc | ( | ) |
Reads and parses the content file and sets global variables accordingly.
rmanl | ( | $t | ) |
Returns $t with all line endings removed.
string | $t | A string. |
rmnl | ( | $t | ) |
Returns $t with all (consecutive) line endings replaced by a single newline.
string | $t | A string. |
shead | ( | $s | ) |
Sends error header and sets $title and $o accordingly.
int | $s | The HTTP status response code (401, 403, 404). |
sortdir | ( | $dir | ) |
Returns the alphabetically sorted content of a directory.
Caveat: the result includes '.' and '..'.
string | $dir | An existing directory path. |
stsl | ( | $t | ) |
Returns the un-quoted $t, i.e.
reverses the effect of magic_quotes_gpc/magic_quotes_sybase.
Since magic_quotes are gone, it is a NOP now.
string | $t | A string. |
sv | ( | $s | ) |
Returns the value of a $_SERVER key.
string | $s | The key. |
tag | ( | $s | ) |
Returns an HTML stand alone tag.
Used to returns an (X)HTML compliant stand alone tag according to the settings of $cf['xhtml']['endtags'].
string | $s | The contents of the tag. |
uenc | ( | $s | ) |
Returns a percent encoded URL component.
Additionally all character sequences in $tx['urichar']['org'] will be replaced by their according character sequences in $tx['urichar']['new'].
string | $s | The URL component. |
XH_adjustStylesheetURLs | ( | $plugin, | |
$css | |||
) |
Adjusts all relative url(...) in a stylesheet to be used in the combined plugin stylesheet.
string | $plugin | The name of the plugin. |
string | $css | The content of the stylesheet. |
XH_afterFinalCleanUp | ( | $param | ) |
Registers or executes registered callbacks at the end of XH_finalCleanUp().
Registers a callback for execution at the end of XH_finalCleanUp(), if $param is a callable; otherwise executes these callbacks, passing $param as parameter to the callback function. The latter variant is supposed to be called only by the core, and in this case will invoke the callback with the page HTML, and expects the callback to return the possibly modified HTML.
mixed | $param | A parameter. |
XH_afterPluginLoading | ( | $callback = null | ) |
Registers a callback for execution after all plugins were loaded, if $callback is given; otherwise executes these callbacks.
callable | $callback | The callback. |
XH_autoload | ( | $className | ) |
Autoloads classes named after CMSimple_XH/PEAR coding standards.
string | $className | A class name. |
XH_availableLocalizations | ( | ) |
Returns an array of available languages (in cmsimple/languages/).
XH_backup | ( | ) |
Creates backups of all content files.
Surplus old backups will be deleted. Returns an appropriate message.
XH_builtinTemplate | ( | $bodyClass | ) |
A minimal built-in template for some special functions.
Currently used for the print view and the login screen.
string | $bodyClass | The CSS class of the BODY element. |
XH_checkValidUtf8 | ( | array | $arr | ) |
Checks $arr recursively for valid UTF-8.
Otherwise it exits the script.
Useful for checking user input.
array | $arr | Array to check. |
XH_convertPrintUrls | ( | $pageContent | ) |
Convert all internal URLs in a text to print URLs.
string | $pageContent | Some HTML. |
XH_convertToPrintUrl | ( | array | $matches | ) |
Returns a single URL converted to a print URL, if appropriate.
Serves as helper for
array | $matches | The matches of a PREG. |
XH_createLanguageFile | ( | $dst | ) |
Copies default file, if actual language file is missing.
Returns whether the language file exists afterwards.
string | $dst | The destination filename. |
XH_debug | ( | $errno, | |
$errstr, | |||
$errfile, | |||
$errline | |||
) |
Writes all recoverable PHP errors to $e.
int | $errno | Level of the error. |
string | $errstr | An error message. |
string | $errfile | Filename where error was raised. |
int | $errline | Line number where error was raised. |
XH_debugmode | ( | ) |
Debug-Mode.
Check if file "_XHdebug.txt" exists to turn on debug-mode with default debug level 1. The level of the debug mode can be adjusted by placing an integer-value within the file using following values:
XH_decodeJson | ( | $string | ) |
Returns the JSON string decoded as PHP value.
string | $string | A JSON string. |
XH_encodeJson | ( | $value | ) |
Returns the JSON representation of a value.
mixed | $value | A PHP value. |
XH_escapeCMSimpleScripting | ( | array | $matches | ) |
Escapes CMSimple scripting returned from a plugin call.
array | $matches | An array of matches. |
XH_evaluateSinglePluginCall | ( | $___expression | ) |
Returns the result of evaluating a single plugin call expression.
The expression is evaluated as if it where in the global namespace. To avoid clashes with local variables of this function, these are prefixed with a triple underscore. Reference parameters of the function do not modify the global scope.
string | $___expression | The expression to evaluate. |
XH_exit | ( | $status = 0 | ) |
Exits the running script.
Simple wrapper for exit for testing purposes.
mixed | $status | A status message or code. |
XH_finalCleanUp | ( | $html | ) |
Callback for output buffering.
Returns the postprocessed HTML.
Currently debug information and admin menu are prepended, and $bjs is appended to the body element.
string | $html | The HTML generated so far. |
XH_findNextPage | ( | ) |
Finds the index of the next page.
XH_findPreviousPage | ( | ) |
Finds the index of the previous page.
XH_formatDate | ( | $timestamp | ) |
Returns a timestamp formatted according to config and lang.
int | $timestamp | A UNIX timestamp. |
XH_getLocatorModel | ( | ) |
Returns the locator (breadcrumb navigation) model.
The locator model is an ordered list of breadcrumb items, where each item is an array of the title and the URL. If there is no appropriate URL, the element is null.
XH_getPageURL | ( | $index | ) |
Returns the full URL of a page.
int | $index | A valid page index. |
XH_getRootFolder | ( | ) |
Returns the root (= installation) folder of the system.
XH_helpIcon | ( | $tooltip | ) |
Returns a help icon which displays a tooltip on hover.
string | $tooltip | A tooltip in HTML. |
XH_highlightSearchWords | ( | array | $words, |
$text | |||
) |
Highlights the search words in a text.
array | $words | An array of search words. |
string | $text | A text. |
XH_hsc | ( | $string | ) |
Converts special characters to HTML entities.
Same as htmlspecialchars($string, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8').
string | $string | A string. |
XH_includeVar | ( | $_filename, | |
$_varname | |||
) |
Includes a PHP data file and returns the value of the variable.
Returns false, if including failed. During the inclusion, the file is locked for shared access.
string | $_filename | A filename. |
string | $_varname | A variable name. |
XH_isContentBackup | ( | $filename, | |
$regularOnly = true |
|||
) |
Returns whether a file is a content backup by checking the filename.
string | $filename | A filename. |
bool | $regularOnly | Whether to check for regalur backup names only. |
XH_isInternalPath | ( | $path | ) |
Returns whether a path refers to a CMSimple index.php.
string | $path | A relative path. |
XH_isInternalUrl | ( | $urlParts | ) |
Returns whether a URL points to this CMSimple installation.
array | $urlParts | Parts of an URL. |
XH_isLanguageFolder | ( | $name | ) |
Returns whether $name is a language folder.
string | $name | The name to check. |
XH_lastJsonError | ( | ) |
Returns whether an error has occurred during the last XH_decodeJson().
XH_lockFile | ( | $handle, | |
$operation | |||
) |
Implements portable advisory file locking.
For now it is just a simple wrapper around flock().
resource | $handle | A file handle. |
int | $operation | A lock operation (use LOCK_SH, LOCK_EX or LOCK_UN). |
XH_logMessage | ( | $type, | |
$module, | |||
$category, | |||
$description | |||
) |
Appends a message to the log file, and returns whether that succeeded.
string | $type | A message type ("info", "warning", "error"). |
string | $module | A module name ("XH" or plugin name). |
string | $category | A category. |
string | $description | A description. |
XH_mailform | ( | $subject = null | ) |
Handles a mailform embedded in a CMSimple_XH page.
string | $subject | An alternative subject field preset text instead of the subject default in localization. |
XH_message | ( | $type, | |
$message | |||
) |
Returns an HTML element formatted as message.
string | $type | The type of message ('success', 'info', 'warning', 'fail'). |
string | $message | A message format to print in an printf() style. |
XH_numberSuffix | ( | $count | ) |
Returns a suffix for a language string key according to the number (singular, paucal or plural).
int | $count | Count of the items. |
XH_onShutdown | ( | ) |
Handles the shutdown of the script.
XH_plugins | ( | $admin = false | ) |
Returns a list of all active plugins.
bool | $admin | Whether to return only plugins with a admin.php |
XH_pluginStylesheet | ( | ) |
Returns the path of the combined plugin stylesheet.
If necessary, this stylesheet will be created/updated.
XH_readConfiguration | ( | $plugin = false , |
|
$language = false |
|||
) |
Returns the configuration resp.
language array of the core resp. a plugin.
For plugins pluginFiles() has to be called before.
bool | $plugin | Whether to return plugin information (opposed to core). |
bool | $language | Whether to return the language array (opposed to config). |
XH_readContents | ( | $language = null | ) |
Reads and parses a content file.
Returns an associative array containing the following information:
string | $language | The language to read. null means the default language. |
XH_readFile | ( | $filename | ) |
Reads a file and returns its contents; false on failure.
During reading, the file is locked for shared access.
string | $filename | A file path. |
XH_redirectSelectedUrl | ( | ) |
Returns the URL where to redirect selected
GEt requests.
XH_registeredEditmenuPlugins | ( | ) |
Returns the names of the registered editmenu plugins.
XH_registeredEditorPlugins | ( | ) |
Returns the names of the registered editor plugins.
XH_registeredFilebrowserPlugins | ( | ) |
Returns the names of the registered filebrowser plugins.
XH_registeredPagemanagerPlugins | ( | ) |
Returns the names of the registered pagemanager plugins.
XH_registerPluginType | ( | $type, | |
$plugin = null |
|||
) |
Registers the type of a plugin resp.
returns the registered plugins of a certain type.
string | $type | A plugin type ('editor', 'filebrowser', 'pagemanager', 'editmenu'). |
string | $plugin | A plugin name or null. |
XH_renameFile | ( | $oldname, | |
$newname | |||
) |
Attempts to rename oldname to newname, and returns whether that succeeded.
The file is moved between directories if necessary. If newname exists, it will be overwritten.
This is a wrapper around rename(), which offers a fallback for the limitation of PHP < 5.3 on Windows that the rename operation fails, if $newfile already exists. Note, that the fallback solution is not atomic.
string | $oldname | A filename. |
string | $newname | A filename. |
XH_rmws | ( | $str | ) |
Returns $str with all (consecutive) whitespaces replaced by a single space.
string | $str | A string. |
XH_secondLanguages | ( | ) |
Returns the installed second languages in alphabetic order.
XH_spliceString | ( | & | $string, |
$offset, | |||
$length = 0 , |
|||
$replacement = '' |
|||
) |
Removes a portion of a string and replaces it with something else.
This does basically the same to strings as array_splice() for arrays. Note that the behavior of negative values for $offset and $length is not defined.
string | $string | The string to manipulate. |
int | $offset | Offset of the string where to start the replacement. |
int | $length | The number of characters to be replaced. |
string | $replacement | The string to replace the removed characters. |
XH_startSession | ( | ) |
Starts a named session.
If session is already started, nothing happens.
XH_templates | ( | ) |
Returns an array of installed templates.
XH_title | ( | $site, | |
$subtitle | |||
) |
Returns the text content for a TITLE element.
string | $site | A site name. |
string | $subtitle | A subtitle (e.g. the page heading). |
XH_uenc | ( | $s, | |
array | $search, | ||
array | $replace | ||
) |
Returns a percent encoded URL component.
Additionally all character sequences in $search will be replaced by their according character sequences in $replace, spaces will be replaced by the configured word_separator and leading, trailing and multiple consecutive word_separators will be trimmed.
string | $s | The URL component. |
array | $search | Strings to search for. |
array | $replace | Replacement strings. |
XH_unionOf2DArrays | ( | array | $array1, |
array | $array2 | ||
) |
Returns the union of two "2-dimensional" arrays in the same manner as the union operator (i.e.
keys and subkeys in the first array have higher priority).
array | $array1 | A "2-dimensional" array. |
array | $array2 | A "2-dimensional" array. |
XH_writeFile | ( | $filename, | |
$contents | |||
) |
Writes $contents to the file $filename.
During writing the file is locked exclusively.
string | $filename | The filename. |
string | $contents | The content to write. |