コアな関数

Source Location: /cmsimple/functions.php

Functions
a  [line 1070]

string a( int $i, string $x  )

Returns an opening a tag as link to a page.

Parameters:
int   $i:  The page index.
string   $x:  Arbitrary appendix of the URL.

API Tags:
Return:   The (X)HTML.
Global:   string $sn: The script name.
Global:   array $u: The URLs of the pages.
Global:   array $cf: The configuration of the core.


[ Top ]
amp  [line 1295]

string amp( )

Returns '&' or '&' according to the setting of $cf['xhtml']['amp'].


API Tags:
Return:   The (X)HTML.
Global:   array $cf: The configuration of the core.
Deprecated:   since 1.5.4. Use '&' instead.


[ Top ]
autogallery  [line 94]

string autogallery( string $u  )

Returns the code to display a photogallery.

Parameters:
string   $u:  Autogallery's installation folder.

API Tags:
Return:   The (X)HTML.
Global:   string $su: The URL of the active page.
Deprecated:   since 1.5.4. Use a gallery plugin instead.


[ Top ]
chkdl  [line 700]

bool chkdl( string $fl  )

Returns whether the file exists in the download folder and is available for download.

Parameters:
string   $fl:  The download URL, e.g. ?download=file.ext

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   string $sn: The script name.
Deprecated:   since 1.6.


[ Top ]
chkfile  [line 760]

bool chkfile( string $fl, bool $writable  )

Checks wether the file exists, is readable, and if $writeable is true, is writeable.

Appends an according message to $e otherwise.

Parameters:
string   $fl:  A key of $pth['file'].
bool   $writable:  Whether the file has to writable.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   array $tx: The localization of the core.
Deprecated:   since 1.6.


[ Top ]
cmscript  [line 1240]

int cmscript( string $script, string $text  )

Returns the number of times a CMSimple script is found.

Parameters:
string   $script:  The needle.
string   $text:  The haystack.

API Tags:
Global:   array $cf: The configuration of the core.


[ Top ]
download  [line 667]

void download( string $fl  )

Makes the file available for download.

If the file can't be downloaded, an HTTP 404 Not found response will be generated.

Parameters:
string   $fl:  The file name.

API Tags:
Global:   string $download: The script name.
Global:   string $o: The file to download.


[ Top ]
e  [line 792]

void e( string $et, string $ft, string $fn  )

Appends an error message about the file to $e.

Parameters:
string   $et:  A key in $tx['error'].
string   $ft:  A key in $tx['filetype'].
string   $fn:  The file name.

API Tags:
Global:   string $e: Error messages as (X)HTML fragment consisting of LI Elements.
Global:   array $tx: The localization of the core.


[ Top ]
editor_replace  [line 466]

void editor_replace( [string $elementID = false], [string $config = '']  )

Returns the result of calling *_replace() of the configured editor.

Returns false on failure.

Parameters:
string   $elementID:  The element with this ID will become an editor.
string   $config:  The configuration.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   array $cf: The configuration of the core.

Information Tags:
Link:   http://www.cmsimple-xh.org/wiki/doku.php/plugin_interfaces
Since:   1.5

[ Top ]
evaluate_cmsimple_scripting  [line 159]

string evaluate_cmsimple_scripting( string $__text, [bool $__compat = true]  )

Returns a text with CMSimple scripting evaluated.

Scripts are evaluated in the global scope.

Parameters:
string   $__text:  The text.
bool   $__compat:  Whether only last CMSimple script should be evaluated.

API Tags:
Global:   string 0: The output.

Information Tags:
Since:   1.5

[ Top ]
evaluate_plugincall  [line 225]

string evaluate_plugincall( string $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.

Parameters:
string   $text:  The text.

API Tags:
Global:   array $tx: The localization of the core.

Information Tags:
Since:   1.5

[ Top ]
evaluate_scripting  [line 340]

void evaluate_scripting( string $text, [bool $compat = true]  )

Returns a text with CMSimple scripting and plugin calls evaluated.

Parameters:
string   $text:  The text.
bool   $compat:  Whether only last CMSimple script will be evaluated.

Information Tags:
Since:   1.5

[ Top ]
gc  [line 1710]

string gc( string $s  )

Returns the value of a cookie, or null if the cookie doesn't exist.

Parameters:
string   $s:  The name of the cookie.


[ Top ]
geturl  [line 46]

string geturl( string $u  )

Returns the inner HTML of the body element of the given URL.

Parameters:
string   $u:  A URL.

API Tags:
Return:   The (X)HTML.


[ Top ]
geturlwp  [line 65]

string geturlwp( string $u  )

Returns the contents of the given URL adding all current GET parameters.

Parameters:
string   $u:  A URL.

API Tags:
Return:   The (X)HTML.


[ Top ]
h  [line 121]

string h( int $n  )

Returns a page heading.

Parameters:
int   $n:  The index of the page.

API Tags:
See:   $h


[ Top ]
hide  [line 1258]

bool hide( int $i  )

Returns whether a page is hidden.

Parameters:
int   $i:  The page index.

API Tags:
Global:   array $c: The content of the pages.
Global:   bool $edit: Whether edit mode is active.


[ Top ]
include_editor  [line 428]

bool include_editor( )

Calls include_*() of the configured editor. Returns whether that succeeded.


API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   array $cf: The configuration of the core.

Information Tags:
Link:   http://www.cmsimple-xh.org/wiki/doku.php/plugin_interfaces
Since:   1.5

[ Top ]
initvar  [line 567]

void initvar( string $name  )

Initializes a global variable according to a GET or POST parameter.

Parameters:
string   $name:  The name of the global variable.

API Tags:
See:   http://www.cmsimpleforum.com/viewtopic.php?f=29&t=5315


[ Top ]
init_editor  [line 394]

bool init_editor( [array $elementClasses = array()], [mixed $initFile = false]  )

Calls init_*() of the configured editor. Returns whether that succeeded.

Parameters:
array   $elementClasses:  Elements with these classes will become an editor.
mixed   $initFile:  The init file or configuration.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   array $cf: The configuration of the core.

Information Tags:
Link:   http://www.cmsimple-xh.org/wiki/doku.php/plugin_interfaces
Since:   1.5

[ Top ]
l  [line 137]

int l( int $n  )

Returns a page's menu level.

Parameters:
int   $n:  The index of the page.

API Tags:
See:   $l


[ Top ]
lilink  [line 1808]

string lilink( )

Returns the login link.


API Tags:
Return:   The (X)HTML.
Global:   int $s: The index of the requested page.
Global:   array $tx: The localization of the core.


[ Top ]
logincheck  [line 1724]

bool. logincheck( )

Returns wether the user is logged in.


API Tags:
Global:   array $cf: The configuration of the core.


[ Top ]
loginforms  [line 1831]

string loginforms( )

Returns the login form.


API Tags:
Return:   The (X)HTML.
Global:   array $cf: The configuration of the core.
Global:   array $tx: The localization of the core.
Global:   string $onload: JavaScript for the onload event of the BODY element.
Global:   string $f: The requested special function.
Global:   string $o: The (X)HTML of the contents area.
Global:   int $s: The index of the requested page.
Global:   string $sn: The script name.
Global:   array $u: The URLs of the pages.


[ Top ]
meta  [line 1096]

string meta( string $n  )

Returns the meta element for name, if defined in $cf['meta']; null otherwise.

Parameters:
string   $n:  The name attribute.

API Tags:
Return:   The (X)HTML.
Global:   array $cf: The configuration of the core.
Global:   array $tx: The localization of the core.
Global:   bool $print: Whether print mode is active.


[ Top ]
ml  [line 1119]

string ml( string $i  )

Returns the link to a special CMSimple_XH page, e.g. sitemap.

Parameters:
string   $i:  A key of $tx['menu'].

API Tags:
Return:   The (X)HTML.
Global:   string $f: The requested special function.
Global:   string $sn: The script name.
Global:   array $tx: The localization of the core.


[ Top ]
newsbox  [line 361]

string newsbox( string $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.

Parameters:
string   $heading:  The page heading.

API Tags:
Return:   The (X)HTML.
Global:   array $c: The content of the pages.
Global:   int $cl: The number of pages.
Global:   array $h: The headings of the pages.
Global:   array $cf: The configuation of the core.
Global:   bool $edit: Whether edit mode is active.


[ Top ]
pluginFiles  [line 1555]

void pluginFiles( string $plugin  )

Set plugin paths.

Parameters:
string   $plugin:  The name of the plugin.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   string $sl: The active language.
Staticvar:   array $helpFiles: The help filename cache.


[ Top ]
preCallPlugins  [line 1634]

void preCallPlugins( [int $pageIndex = -1]  )

Function preCallPlugins() => Pre-Call of Plugins.

All Plugins which are called through a function-call can use this. At the moment it is'nt possible to do this with class-based plugins. They need to be called through standard-CMSimple-Scripting.

Call a plugin: place this in your code (example): {{{PLUGIN:pluginfunction('parameters');}}}

Call a built-in function (at the moment only one for demonstration): {{{HOME}}} or: {{{HOME:name_of_Link}}} This creates a link to the first page of your CMSimple- Installation.

Parameters:
int   $pageIndex:  The page index.

API Tags:
Global:   bool $edit: Whether edit-mode is active.
Global:   array $c: The contents of all pages.
Global:   int $s: The Index of the active page.
Global:   array $u: The URLs of all pages.
Deprecated:   since 1.6

Information Tags:
Author:   mvwd
Since:   1.0

[ Top ]
rf  [line 732]

string rf( string $fl  )

Returns the content of file $filename, if it does exist, null otherwise.

Parameters:
string   $fl:  The file name.

API Tags:
Deprecated:   since 1.6


[ Top ]
rfc  [line 817]

void rfc( )

Reads and parses the content file and sets global variables accordingly.


API Tags:
Global:   bool $edit: Whether we're in edit mode.
Global:   array $c: The contents of the pages.
Global:   int $cl: The number of pages.
Global:   array $h: The headings of the pages.
Global:   array $u: The URLs of the pages.
Global:   array $l: The menu levels of the pages.
Global:   string $su: The URL of the current page.
Global:   string $s: The index of the current page.
Global:   array $tx: The localization of the core.
Global:   string $e: Error messages as (X)HTML fragment consisting of LI Elements.
Global:   object The $pth: pagedata router.


[ Top ]
rmanl  [line 635]

string rmanl( string $t  )

Returns $t with all line endings removed.

Parameters:
string   $t:  A string.


[ Top ]
rmnl  [line 603]

string rmnl( string $t  )

Returns $t with all (consecutive) line endings replaced by a single newline.

Parameters:
string   $t:  A string.


[ Top ]
rp  [line 1197]

string rp( string $p  )

Returns the canonicalized absolute pathname on success.

Otherwise returns its input.

Parameters:
string   $p:  The file name.

API Tags:
Deprecated:   since 1.5.4. Use realpath() instead.


[ Top ]
shead  [line 1321]

void. shead( int $s  )

Sends error header and sets $title and $o accordingly.

Parameters:
int   $s:  The HTTP status response code (401, 403, 404).

API Tags:
Global:   bool $iis: Whether the server is IIS.
Global:   bool $cgi: Whether the API is CGI.
Global:   array $tx: The localization of the core.
Global:   string $title: The page title.
Global:   string $o: The (X)HTML of the contents area.


[ Top ]
sortdir  [line 1217]

array sortdir( string $dir  )

Returns the alphabetically sorted content of a directory.

Caveat: the result includes '.' and '..'.

Parameters:
string   $dir:  The directory path.


[ Top ]
stsl  [line 650]

string stsl( string $t  )

Returns the un-quoted $t, i.e. reverses the effect of magic_quotes_gpc/magic_quotes_sybase.

If in doubt, use on all user input (but at most once!).

Parameters:
string   $t:  A string.


[ Top ]
sv  [line 587]

string sv( string $s  )

Returns the value of a $_SERVER key.

Parameters:
string   $s:  The key.


[ Top ]
tag  [line 1278]

string tag( string $s  )

Returns an (X)HTML compliant stand alone tag according to the settings of $cf['xhtml']['endtags'].

Parameters:
string   $s:  The contents of the tag.

API Tags:
Return:   The (X)HTML.
Global:   array $cf: The configuration of the core.


[ Top ]
uenc  [line 1148]

string uenc( string $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'].

Parameters:
string   $s:  The URL component.

API Tags:
Global:   array $tx: The localization of the core.
See:   XH_uenc()


[ Top ]
writelog  [line 1752]

void writelog( string $m  )

Appends a message to the logfile.

On failure an according message is appended to $e.

Parameters:
string   $m:  The log message.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   string $e: Error messages as (X)HTML fragment consisting of LI Elements.
Deprecated:   since 1.6


[ Top ]
XH_adjustStylesheetURLs  [line 2054]

string XH_adjustStylesheetURLs( string $plugin, string $css  )

Adjusts all relative url(...) in a stylesheet to be used in the combined plugin stylesheet.

Parameters:
string   $plugin:  The name of the plugin.
string   $css:  The content of the stylesheet.

Information Tags:
Since:   1.6

[ Top ]
XH_afterPluginLoading  [line 1953]

void XH_afterPluginLoading( [callable $callback = null]  )

Registers a callback for execution after all plugins were loaded, if $callback is given; otherwise executes these callbacks.

Parameters:
callable   $callback:  The callback.

API Tags:
Staticvar:   array $helpFiles: The callbacks for later execution.

Information Tags:
Since:   1.6

[ Top ]
XH_availableLocalizations  [line 2266]

array XH_availableLocalizations( )

Returns an array of available languages (in cmsimple/languages/).


API Tags:
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_backup  [line 2092]

string XH_backup( )

Creates backups of all content files.

Surplus old backups will be deleted. Returns an appropriate message.


API Tags:
Return:   (X)HTML.
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_builtinTemplate  [line 2160]

string XH_builtinTemplate( string $bodyClass  )

A minimal built-in template for some special functions.

Currently used for the print view and the login screen.

Parameters:
string   $bodyClass:  The CSS class of the BODY element.

API Tags:
Return:   (X)HTML.

Information Tags:
Since:   1.6

[ Top ]
XH_checkValidUtf8  [line 1496]

void XH_checkValidUtf8( array $arr  )

Checks $arr recursively for valid UTF-8.

Otherwise it exits the script.

Useful for checking user input.

Parameters:
array   $arr:  Array to check.

API Tags:
Global:   array $tx: The localization of the core.

Information Tags:
Since:   1.5.5

[ Top ]
XH_convertPrintUrls  [line 2405]

string XH_convertPrintUrls( string $pageContent  )

Convert all internal URLs in a text to print URLs.

Parameters:
string   $pageContent:  Some (X)HTML.

Information Tags:
Since:   1.6

[ Top ]
XH_convertToPrintUrl  [line 2380]

string XH_convertToPrintUrl( array $matches  )

Returns a single URL converted to a print URL, if appropriate.

Serves as helper for @see XH_convertPrintUrls().

Parameters:
array   $matches:  The matches of a PREG.

Information Tags:
Since:   1.6

[ Top ]
XH_createLanguageFile  [line 1530]

bool XH_createLanguageFile( string $dst  )

Copies default file, if actual language file is missing. Returns whether the language file exists afterwards.

Parameters:
string   $dst:  The destination filename.

Information Tags:
Todo:   Remove handling of LANGconfigs, unless they won't get reintroduced.
Since:   1.6

[ Top ]
XH_debug  [line 1430]

void XH_debug( int $errno, string $errstr, string $errfile, int $errline, array $context  )

Writes all recoverable PHP errors to $e.

Parameters:
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.
array   $context:  The error context.

API Tags:
Global:   array $errors: The list of PHP errors formatted as (X)HTML fragment.


[ Top ]
XH_debugmode  [line 1369]

boolean 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:

  • 0: Turn off all error reporting
  • 1: Runtime errors except warnings
  • 2: Runtime errors
  • 3: Runtime errors + notices
  • 4: All errors except notices and warnings
  • 5: All errors except notices
  • 6: All errors

API Tags:
Return:   Whether error_reporting is enabled.
Global:   array $pth: The paths of system files and folders.

Information Tags:
Author:   Holger
Since:   1.0rc3

[ Top ]
XH_decodeJson  [line 2424]

mixed XH_decodeJson( string $string  )

Returns the JSON string decoded as PHP value.

Parameters:
string   $string:  A JSON string.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   object The $_XH_json: JSON codec.

Information Tags:
Since:   1.6

[ Top ]
XH_encodeJson  [line 2451]

string XH_encodeJson( mixed $value  )

Returns the JSON representation of a value.

Parameters:
mixed   $value:  A PHP value.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   object The $_XH_json: JSON codec.

Information Tags:
Since:   1.6

[ Top ]
XH_escapeCMSimpleScripting  [line 297]

string XH_escapeCMSimpleScripting( array $matches  )

Escapes CMSimple scripting returned from a plugin call.

Parameters:
array   $matches:  An array of matches.

Information Tags:
Since:   1.6.6

[ Top ]
XH_evaluateSinglePluginCall  [line 277]

srting XH_evaluateSinglePluginCall( string $___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.

Parameters:
string   $___expression:  The expression to evaluate.

Information Tags:
Since:   1.6

[ Top ]
XH_exit  [line 2706]

void XH_exit( [mixed $status = 0]  )

Exits the running script.

Simple wrapper for exit for testing purposes.

Parameters:
mixed   $status:  A status message or code.

Information Tags:
Since:   1.6.2

[ Top ]
XH_finalCleanUp  [line 509]

string XH_finalCleanUp( string $html  )

Callback for output buffering. Returns the postprocessed (X)HTML.

Currently debug information and admin menu are prepended, and $bjs is appended to the body element.

Parameters:
string   $html:  The (X)HTML generated so far.

API Tags:
Global:   int $s: The index of the active page.
Global:   string $o: The (X)HTML of the contents area.
Global:   array $errors:
Global:   array $cf: The configuration of the core.
Global:   array $tx: The localization of the core.
Global:   string $bjs: (X)HTML to be preprended to the closing BODY tag.

Information Tags:
Since:   1.6

[ Top ]
XH_findNextPage  [line 1046]

int XH_findNextPage( )

Finds the index of the next page.


API Tags:
Global:   int $s: The index of the current page.
Global:   int $cl: The number of pages.

Information Tags:
Since:   1.6.3

[ Top ]
XH_findPreviousPage  [line 1024]

int XH_findPreviousPage( )

Finds the index of the previous page.


API Tags:
Global:   int $s: The index of the current page.
Global:   int $cl: The number of pages.

Information Tags:
Since:   1.6.3

[ Top ]
XH_formatDate  [line 2851]

string XH_formatDate( int $timestamp  )

Returns a timestamp formatted according to $tx[lastupdate][dateformat].

Parameters:
int   $timestamp:  A UNIX timestamp.

API Tags:
Global:   array $tx: The localization of the core.

Information Tags:
Since:   1.6.3

[ Top ]
XH_getRootFolder  [line 2721]

string XH_getRootFolder( )

Returns the root (= installation) folder of the system.


API Tags:
Global:   string $sn: The script name.
Global:   string $sl: The current language.

Information Tags:
Since:   1.6.2

[ Top ]
XH_getStreamContents  [line 1875]

string XH_getStreamContents( resource $stream  )

Returns the remaining contents of a stream.

Parameters:
resource   $stream:  An open stream.

Information Tags:
Since:   1.6

[ Top ]
XH_helpIcon  [line 2200]

string XH_helpIcon( string $tooltip  )

Returns a help icon which displays a tooltip on hover.

Parameters:
string   $tooltip:  A tooltip in (X)HTML.

API Tags:
Return:   (X)HTML.
Global:   array $pth: The paths of system files and folders.
Global:   array $tx: The localization of the core.

Information Tags:
Todo:   Change the DIVs to SPANs and require the $tooltip to be an inline fragment (requires block level elements to be removed from all help texts--even $plugin_tx).
Since:   1.6

[ Top ]
XH_highlightSearchWords  [line 2885]

string XH_highlightSearchWords( array $words, string $text  )

Highlights the search words in a text.

Parameters:
array   $words:  An array of search words.
string   $text:  A text.

API Tags:
Return:   (X)HTML.

Information Tags:
Since:   1.6.5

[ Top ]
XH_hsc  [line 2504]

string XH_hsc( string $string  )

Converts special characters to HTML entities.

Same as htmlspecialchars($string, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8'), but works for PHP < 5.4 as well.

Parameters:
string   $string:  A string.

Information Tags:
Since:   1.5.8

[ Top ]
XH_includeVar  [line 2553]

mixed XH_includeVar( string $_filename, string $_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.

Parameters:
string   $_filename:  A filename.
string   $_varname:  A variable name.

Information Tags:
Since:   1.6

[ Top ]
XH_isContentBackup  [line 2222]

bool XH_isContentBackup( string $filename, [string $regularOnly = true]  )

Returns whether a file is a content backup by checking the filename.

Parameters:
string   $filename:  A filename.
string   $regularOnly:  Whether to check for regalur backup names only.

Information Tags:
Since:   1.6

[ Top ]
XH_isInternalPath  [line 2322]

string XH_isInternalPath( string $path  )

Returns whether a path refers to a CMSimple index.php.

Parameters:
string   $path:  A relative path.

Information Tags:
Since:   1.6

[ Top ]
XH_isInternalUrl  [line 2359]

bool XH_isInternalUrl( string $urlParts  )

Returns whether a URL points to this CMSimple installation.

Parameters:
string   $urlParts:  Parts of an URL.

Information Tags:
Since:   1.6

[ Top ]
XH_isLanguageFolder  [line 2117]

bool XH_isLanguageFolder( string $name  )

Returns whether $name is a language folder.

Parameters:
string   $name:  The name to check.

API Tags:
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_lastJsonError  [line 2477]

bool XH_lastJsonError( )

Returns whether an error has occurred during the last XH_decodeJSON().


API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   object The $_XH_json: JSON codec.

Information Tags:
Since:   1.6

[ Top ]
XH_lockFile  [line 2870]

bool XH_lockFile( resource $handle, int $operation  )

Implements portable advisory file locking.

For now it is just a simple wrapper around flock().

Parameters:
resource   $handle:  A file handle.
int   $operation:  A lock operation (use LOCK_SH, LOCK_EX or LOCK_UN).

Information Tags:
Since:   1.6.3

[ Top ]
XH_logMessage  [line 1781]

bool XH_logMessage( string $type, string $module, string $category, string $description  )

Appends a message to the log file, and returns whether that succeeded.

Parameters:
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.

API Tags:
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_mailform  [line 2528]

string XH_mailform( [string $subject = null]  )

Handles a mailform embedded in a CMSimple_XH page.

Parameters:
string   $subject:  An alternative subject field preset text

API Tags:
Return:   (X)HTML. instead of the subject default in localization.
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_message  [line 2072]

string XH_message( string $type, string $message  )

Returns an (X)HTML element formatted as message.

Parameters:
string   $type:  The type of message ('success', 'info', 'warning', 'fail').
string   $message:  A message format to print in an printf() style.

Information Tags:
Since:   1.6

[ Top ]
XH_numberSuffix  [line 2580]

string XH_numberSuffix( int $count  )

Returns a suffix for a language string key according to the number (singular, paucal or plural).

Parameters:
int   $count:  Count of the items.

Information Tags:
Since:   1.6

[ Top ]
XH_onShutdown  [line 2825]

void XH_onShutdown( )

Handles the shutdown of the script.

  • Unsets erroneously set password in session (backdoor mitigation).
  • Displays a message if a fatal error occurred.

API Tags:
Global:   array $tx: The localization of the core.

Information Tags:
Since:   1.6.3

[ Top ]
XH_plugins  [line 1669]

array XH_plugins( [bool $admin = false]  )

Returns a list of all active plugins.

Parameters:
bool   $admin:  Whether to return only plugins with a admin.php

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   array $cf: The configuration of the core.
Staticvar:   array $helpFiles: The plugin name cache.
Staticvar:   array $plugins: The admin plugin name cache.

Information Tags:
Todo:   Might be optimized to set $admPlugins only when necessary.
Todo:   with PHP 5.4.0 replace array_values() by sort($plugins, SORT_NATURAL | SORT_FLAG_CASE)
Since:   1.6

[ Top ]
XH_pluginStylesheet  [line 1976]

string XH_pluginStylesheet( )

Returns the path of the combined plugin stylesheet.

If necessary, this stylesheet will be created/updated.


API Tags:
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_readConfiguration  [line 2606]

array XH_readConfiguration( [bool $plugin = false], [bool $language = false]  )

Returns the configuration resp. language array of the core resp. a plugin.

For plugins pluginFiles() has to be called before.

Parameters:
bool   $plugin:  Whether to return plugin information (opposed to core).
bool   $language:  Whether to return the language array (opposed to config).

API Tags:
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_readContents  [line 897]

array XH_readContents( [string $language = null]  )

Reads and parses a content file.

Returns an associative array containing the following information:

  • urls: The URLs of the pages.
  • too_long: Flags, whether URLs were too long.
  • headings: The headings of the pages.
  • levels: The menu levels of the pages.
  • pages: The contents of the pages.
  • pd_router: A page data router object.
  • removed: Flags whether pages are removed.

Returns FALSE, if the file couldn't be read.

Parameters:
string   $language:  The language to read. null means the default language.

API Tags:
Global:   array $pth: The paths of system files and folders.
Global:   array $cf: The configuration of the core.
Global:   bool $edit: Whether edit mode is active.
Global:   int $_XH_firstPublishedPage: The index of the first published page.

Information Tags:
Since:   1.6

[ Top ]
XH_readFile  [line 1897]

string XH_readFile( string $filename  )

Reads a file and returns its contents; false on failure.

During reading, the file is locked for shared access.

Parameters:
string   $filename:  A file path.

Information Tags:
Since:   1.6

[ Top ]
XH_registeredEditmenuPlugins  [line 2806]

array XH_registeredEditmenuPlugins( )

Returns the names of the registered editmenu plugins.


Information Tags:
Since:   1.6.2

[ Top ]
XH_registeredEditorPlugins  [line 2770]

array XH_registeredEditorPlugins( )

Returns the names of the registered editor plugins.


Information Tags:
Since:   1.6.2

[ Top ]
XH_registeredFilebrowserPlugins  [line 2782]

array XH_registeredFilebrowserPlugins( )

Returns the names of the registered filebrowser plugins.


Information Tags:
Since:   1.6.2

[ Top ]
XH_registeredPagemanagerPlugins  [line 2794]

array XH_registeredPagemanagerPlugins( )

Returns the names of the registered pagemanager plugins.


Information Tags:
Since:   1.6.2

[ Top ]
XH_registerPluginType  [line 2746]

mixed XH_registerPluginType( string $type, [string $plugin = null]  )

Registers the type of a plugin resp. returns the registered plugins of a certain type.

Parameters:
string   $type:  A plugin type ('editor', 'filebrowser', 'pagemanager', 'editmenu').
string   $plugin:  A plugin name or null.

API Tags:
Staticvar:   array $helpFiles: The registered plugins.

Information Tags:
Since:   1.6.2

[ Top ]
XH_renameFile  [line 2685]

bool XH_renameFile( string $oldname, string $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.

Parameters:
string   $oldname:  A filename.
string   $newname:  A filename.

Information Tags:
Since:   1.6

[ Top ]
XH_rmws  [line 617]

string XH_rmws( string $str  )

Returns $str with all (consecutive) whitespaces replaced by a single space.

Parameters:
string   $str:  A string.

Information Tags:
Since:   1.5.4

[ Top ]
XH_secondLanguages  [line 2294]

array XH_secondLanguages( )

Returns the installed second languages in alphabetic order.


API Tags:
Global:   array $pth: The paths of system files and folders.
Staticvar:   array $helpFiles: The language names cache.

Information Tags:
Since:   1.6

[ Top ]
XH_spliceString  [line 321]

string XH_spliceString( &$string, int $offset, [int $length = 0], [string $replacement = ''], string $string  )

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.

Parameters:
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.
   &$string:   

API Tags:
Return:   The replaced characters.

Information Tags:
Since:   1.6

[ Top ]
XH_templates  [line 2237]

array XH_templates( )

Returns an array of installed templates.


API Tags:
Global:   array $pth: The paths of system files and folders.

Information Tags:
Since:   1.6

[ Top ]
XH_title  [line 2136]

string XH_title( string $site, string $subtitle  )

Returns the text content for a TITLE element.

Parameters:
string   $site:  A site name.
string   $subtitle:  A subtitle (e.g. the page heading).

Information Tags:
Since:   1.6

[ Top ]
XH_uenc  [line 1179]

string XH_uenc( string $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.

Parameters:
string   $s:  The URL component.
array   $search:  Strings to search for.
array   $replace:  Replacement strings.

API Tags:
Global:   array $cf: The configuration of the core.
See:   uenc()

Information Tags:
Since:   1.6

[ Top ]
XH_unionOf2DArrays  [line 2658]

array 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).

Parameters:
array   $array1:  A "2-dimensional" array.
array   $array2:  A "2-dimensional" array.

Information Tags:
Since:   1.6

[ Top ]
XH_writeFile  [line 1922]

int XH_writeFile( string $filename, string $contents  )

Writes $contents to the file $filename.

During writing the file is locked exclusively.

Parameters:
string   $filename:  The filename.
string   $contents:  The content to write.

API Tags:
Return:   The number of bytes written, or false on failure.

Information Tags:
Since:   1.6

[ Top ]