You are here: start » core_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

core_functions [2012/11/17 13:46]
127.0.0.1 external edit
core_functions [2018/10/26 15:33]
Line 1: Line 1:
-====== Functions ====== 
  
-[[#top|⇑ top]] 
- 
-===== Core functions ===== 
- 
-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. 
- 
-[[#top|⇑ top]] 
- 
-==== a ==== 
- 
-<code php>​string function a(int $number, string $query_string)</​code>​ 
-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: 
- 
-<code php>echo a(0, '&​amp;​param=value'​).'​Link</​a>';</​code>​ 
- 
-[[#top|⇑ top]] 
- 
-==== amp ==== 
- 
-<code php>​string function amp()</​code>​ 
-Returns '&'​ or '&​amp;'​ according to the setting of $cf['​xhtml'​]['​amp'​]. 
- 
-//This function is **deprecated**:​ use **&​amp;​** directly instead.// 
- 
-[[#top|⇑ top]] 
- 
-==== autogallery ==== 
-<code php>​string function autogallery(string $url)</​code>​ 
-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. 
- 
-[[#top|⇑ top]] 
- 
-==== chkdl ==== 
-<code php>bool function chkdl(string $url)</​code>​ 
-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 
- 
-[[#top|⇑ top]] 
- 
-==== chkfile ==== 
-<code php>void function chkfile(string $filename, bool $writeable)</​code>​ 
-Checks wether the file $filename exists, is readable, and if $writeable is true, is writeable. Appends an according message to $e otherwise. 
- 
-[[#top|⇑ top]] 
- 
-==== cmscript() ==== 
-<code php>int function cmscript(string $script, string $text)</​code>​ 
-Returns the number of times the CMSimple script $script is found in $text. Caveat: cmscript() ignores the new notation %%{{{PLUGIN:​...}}}%%. 
- 
-[[#top|⇑ top]] 
- 
-==== download ==== 
-<code php>void function download(string $filename)</​code>​ 
-Makes the file $filename available for download. If the file can't be downloaded, an HTTP 404 Not found response will be generated. 
- 
-[[#top|⇑ top]] 
- 
-==== e ==== 
-<code php>void function e(string $errortext, string $filetype, string $filename)</​code>​ 
-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'​]. 
- 
-[[#top|⇑ top]] 
- 
-==== ftp ==== 
-<code php>​ftp($name)</​code>​ 
-returns a link to a CMS-file 
- 
-**ftp() was removed from CMSimple_XH** 
- 
-[[#top|⇑ top]] 
- 
-==== gc ==== 
-<code php>​mixed function gc(string $cookiename)</​code>​ 
-Returns the value of the cookie $cookiename,​ or NULL if the cookie doesn'​t exist. 
- 
-gc() is defined in /​cmsimple/​login.php. 
- 
-[[#top|⇑ top]] 
- 
-==== geturl ==== 
-<code php>​string function geturl(string $url)</​code>​ 
-Returns the inner HTML of the <​body>​ of the given $url. 
- 
-geturl() is defined in /​cmsimple/​functions.php 
- 
-[[#top|⇑ top]] 
- 
-==== geturlwp ==== 
-<code php>​string function geturlwp(string $url)</​code>​ 
-Returns the full content of the given $url. 
- 
-geturlwp() is defined in /​cmsimple/​functions.php. 
- 
-[[#top|⇑ top]] 
- 
-==== h ==== 
-<code php>​string function h(int $i)</​code>​ 
-Returns $h[$i]. This is a convenience function meant to be used inside other functions. 
- 
-h() is defined in /​cmsimple/​functions.php. 
- 
-[[#top|⇑ top]] 
- 
-==== hide ==== 
-<code php>bool function hide(int $i)</​code>​ 
-Returns wether the page no. $i is hidden. 
- 
-[[#top|⇑ top]] 
- 
-==== initvar ==== 
-<code php>void function initvar(string $varname)</​code>​ 
-Initializes the global $//​varname//​ to the appropriate $_GET or $_POST value, or the empty string. 
- 
-[[#top|⇑ top]] 
- 
-==== im ==== 
-<code php>​mixed im(string $name, string $param)</​code>​ 
-Returns parameter $param of an uploaded file $name. 
- 
-im() is defined in /​cmsimple/​adm.php. 
- 
-[[#top|⇑ top]] 
- 
-==== l ==== 
-<code php>int function l(int $i)</​code>​ 
-Returns the menu level of page no. $i. 
- 
-l() is defined in /​cmsimple/​functions.php. 
- 
-[[#top|⇑ top]] 
- 
-==== logincheck ==== 
-<code php>bool logincheck()</​code>​ 
-Returns wether the user is currently logged in. 
- 
-logincheck() is defined in /​cmsimple/​login.php. 
- 
-[[#top|⇑ top]] 
- 
-==== meta ==== 
-<code php>​mixed meta(string $name)</​code>​ 
-Returns the <​meta>​ tag for name $name if defined in $cf['​meta'​],​ NULL otherwise. 
- 
-[[#top|⇑ top]] 
- 
-==== ml ==== 
-<code php>​string function ml(string $name)</​code>​ 
-Returns the menu entry for the special CMSimple_XH page $name, e.g. sitemap. 
- 
-[[#top|⇑ top]] 
- 
-==== newsbox ==== 
-<code php>​mixed function newsbox(string $title)</​code>​ 
-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. 
- 
-[[#top|⇑ top]] 
- 
-==== rf ==== 
-<code php>​mixed function rf(string $filename)</​code>​ 
-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. 
-<code php>​return join("​\n",​ file($fl));</​code>​ should IMHO be changed to <code php>​return join('',​ file($fl));</​code>​ 
- 
-//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.// 
- 
-[[#top|⇑ top]] 
- 
-==== rfc ==== 
-<code php>void function rfc()</​code>​ 
-This basic function reads content.htm and creates all according global variables of CMSimple_XH. 
- 
-[[#top|⇑ top]] 
- 
-==== rmanl ==== 
-<code php>​string function rmanl(string $text)</​code>​ 
-Returns $text with all newlines removed from it. 
- 
-[[#top|⇑ top]] 
- 
-==== rmnl ==== 
-<code php>​string function rmnl(string $text)</​code>​ 
-Returns $text with multiple consecutive line endings in it replaced by single line endings. 
- 
-[[#top|⇑ top]] 
- 
-==== rp ==== 
-<code php>​string function rp(string $path)</​code>​ 
-Returns the canonicalized absolute pathname of $path, if $path exists, else $path. 
- 
-[[#top|⇑ top]] 
- 
-==== selectlist ==== 
-<code php>void function selectlist(string $function, string $pattern, string $replacement)</​code>​ 
-Appends a dropdown menu to $o (used in the back-end for language and template selection). 
- 
-selectlist() is defined in /​cmsimple/​adm.php 
- 
-[[#top|⇑ top]] 
- 
-==== shead ==== 
-<code php>void function shead(string $errorname)</​code>​ 
-Sends header 401 resp. 404, if $errorname is '​401'​ resp. '​404'​. Otherwise appends $tx['​error'​][$errorname] as <h1> to $o. 
- 
-[[#top|⇑ top]] 
- 
-==== sortdir ==== 
-<code php>​array function sortdir(string $dirname)</​code>​ 
-Returns the alphabetically sorted content of directory $dirname. Caveat: the result includes '​.'​ and '​..'​. 
- 
-[[#top|⇑ top]] 
- 
-==== stsl ==== 
-<code php>​string function stsl(string $text)</​code>​ 
-Returns $text with all backslashes stripped according to the setting of gpc_magic_quotes. IOW it undoes the result of gpc_magic_quotes == on. 
- 
-[[#top|⇑ top]] 
- 
-==== sv ==== 
-<code php>​string function sv(string $name)</​code>​ 
-Returns the server variable $name, if it's set, the empty string otherwise. 
- 
-[[#top|⇑ top]] 
- 
-==== tag ==== 
-<code php>​string function tag(string $content)</​code>​ 
-Returns an HTML/XHTML compliant stand alone tag $content according to the settings of $cf['​xhtml'​]['​endtags'​]. E.g. 
-<code php>​tag('​img src="​img.jpg"'​)</​code>​ returns '<​img src="​img.jpg">'​ resp. '<​img src="​img.jpg"​ />' 
- 
-[[#top|⇑ top]] 
- 
-==== uenc ==== 
-<code php>​string function uenc(string $url)</​code>​ 
-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. 
- 
-[[#top|⇑ top]] 
- 
-==== writelog ==== 
-<code php>void function writelog(string $message)</​code>​ 
-Appends the message $message to the logfile, if the logfile does exist, otherwise appends an according message to $e. 
- 
-[[#top|⇑ top]] 
- 
-===== Plugin loader functions ===== 
- 
-[[#top|⇑ top]] 
- 
-==== plugin_admin_common ==== 
-<code php>​string function plugin_admin_common(string $action, string $admin, string $plugin, array $hint=array())</​code>​ 
-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. 
- 
-[[#top|⇑ top]] 
- 
-==== print_plugin_admin ==== 
-<code php>​string function print_plugin_admin(string $main)</​code>​ 
-Returns the current plugin'​s menu in the back-end. If $main != '​on'​ the "​Plugin Main Settings"​ will be supressed. 
- 
-[[#top|⇑ top]] 
- 
-===== Pagedata methods ===== 
- 
-[[#top|⇑ top]] 
- 
-==== find_all ==== 
-<code php>​array function $pd_router->​find_all()</​code>​ 
-Returns all page data. 
- 
-[[#top|⇑ top]] 
- 
-==== find_page ==== 
-<code php>​array function $pd_router->​find_page(int $id)</​code>​ 
-Returns the page data of page no. $id. 
- 
-[[#top|⇑ top]] 
- 
-==== update ==== 
-<code php>void function $pd_router->​update(int $id, array $params)</​code>​ 
-Updates the page data of page no. $id with the data from $params. 
- 
-[[#top|⇑ top]] 
- 
-==== new_page ==== 
-<code php>​array function $pd_router->​new_page(array $params = null)</​code>​ 
-Returns a new page data page array initialitzed with $params. 
- 
-[[#top|⇑ top]] 
- 
-==== destroy ==== 
-<​code=php>​void function $pd_router->​destroy(int $id)</​code>​ 
-Deletes the page data of page no. $id. 
- 
-[[#top|⇑ top]] 
- 
-==== model->​refresh ==== 
-<​code=php>​bool function $pd_router->​model->​refresh(array $data = NULL)</​code>​ 
-Rewrites all page data with $data, if $data is not NULL. Returns wether this was the case. 
- 
-[[#top|⇑ top]] 
 
You are here: start » core_functions
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Valid XHTML 1.0 Valid CSS Driven by DokuWiki