Textpattern | PHP Cross Reference | Content Management Systems |
Description: Collection of miscellaneous tools.
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Functions that are not part of a class:
deNull($in) line: 30 |
Strips NULL bytes. return: mixed param: string|array $in The input value |
deCRLF($in) line: 42 |
Strips carriage returns and linefeeds. return: mixed param: string|array $in The input value |
doArray($in, $function) line: 57 |
Applies a callback to a given string or an array. return: mixed param: string|array $in An array or a string to run through the callback function param: callback $function The callback function |
doStrip($in) line: 80 |
Un-quotes a quoted string or an array of values. return: mixed param: string|array $in The input value |
doStripTags($in) line: 92 |
Strips HTML and PHP tags from a string or an array. return: mixed param: string|array $in The input value |
doDeEnt($in) line: 106 |
Converts entity escaped brackets back to characters. return: mixed param: string|array $in The input value |
deEntBrackets($in) line: 118 |
Converts entity escaped brackets back to characters. return: string param: string $in The input value |
doSlash($in) line: 143 |
Escapes special characters for use in an SQL statement. Always use this function when dealing with user-defined values in SQL statements. If this function is not used to escape user-defined data in a statement, the query is vulnerable to SQL injection attacks. return: mixed An array of escaped values or a string depending on $in param: string|array $in The input value |
doLike($in) line: 162 |
Escape SQL LIKE pattern's wildcards for use in an SQL statement. return: mixed An array of escaped values or a string depending on $in param: string|array $in The input value |
txpspecialchars($string, $flags = ENT_QUOTES, $encoding = 'UTF-8', $double_encode = true) line: 178 |
A shell for htmlspecialchars() with $flags defaulting to ENT_QUOTES. return: string param: string $string The string being converted param: int $flags A bitmask of one or more flags. The default is ENT_QUOTES param: string $encoding Defines encoding used in conversion. The default is UTF-8 param: bool $double_encode When double_encode is turned off PHP will not encode existing HTML entities, the default is to convert everything |
doSpecial($in) line: 211 |
Converts special characters to HTML entities. return: mixed The array or string with HTML syntax characters escaped param: array|string $in The input value |
_null($a) line: 224 |
Converts the given value to NULL. return: null param: mixed $a The input value |
array_null($in) line: 238 |
Converts an array of values to NULL. return: array param: array $in The array |
escape_title($title) line: 251 |
Escapes a page title. Converts <, >, ', " characters to HTML entities. return: string The string escaped param: string $title The input string |
escape_js($js) line: 269 |
Sanitises a string for use in a JavaScript string. Escapes \, \n, \r, " and ' characters. It removes 'PARAGRAPH SEPARATOR' (U+2029) and 'LINE SEPARATOR' (U+2028). When you need to pass a string from PHP to JavaScript, use this function to sanitise the value to avoid XSS attempts. return: string Escaped JavaScript param: string $js JavaScript input |
escape_cdata($str) line: 290 |
Escapes CDATA section for an XML document. return: string XML representation wrapped in CDATA tags param: string $str The string |
gTxt($var, $atts = array() line: 303 |
Returns a localisation string. return: string A localisation string param: string $var String name param: array $atts Replacement pairs param: string $escape Convert special characters to HTML entities. Either "html" or "" |
gTime($timestamp = 0) line: 337 |
Returns given timestamp in a format of 01 Jan 2001 15:19:16. return: string A formatted date param: int $timestamp The UNIX timestamp |
dmp() line: 354 |
Creates a dumpfile from a backtrace and outputs given parameters. |
load_lang($lang, $events = null) line: 396 |
Gets the given language's strings from the database. Fetches the given language from the database and returns the strings as an array. If no $events is specified, only appropriate strings for the current context are returned. If 'txpinterface' constant equals 'admin' all strings are returned. Otherwise, only strings from events 'common' and 'public'. If $events is FALSE, returns all strings. return: array param: string $lang The language code param: array|string|bool $events An array of loaded events |
get_groups() line: 435 |
Gets a list of user groups. return: array |
has_privs($res = null, $user = '') line: 453 |
Checks if a user has privileges to the given resource. return: bool param: string $res The resource param: mixed $user The user. If no user name is supplied, assume the current logged in user |
plug_privs($pluggable = null, $user = null) line: 501 |
Adds dynamic privileges. param: array $pluggable The array, see global $txp_options |
add_privs($res, $perm = '1') line: 543 |
Grants privileges to user-groups. Will not let you override existing privs. param: mixed $res The resource param: string $perm List of user-groups, e.g. '1,2,3' |
require_privs($res = null, $user = '') line: 574 |
Require privileges from a user to the given resource. Terminates the script if user doesn't have required privileges. param: string|null $res The resource, or NULL param: string $user The user. If no user name is supplied, assume the current logged in user |
the_privileged($res, $real = false) line: 596 |
Gets a list of users having access to a resource. return: array A list of usernames param: string $res The resource, e.g. 'article.edit.published' |
sizeImage($name) line: 621 |
Gets the dimensions of an image for a HTML <img> tag. return: string|bool height="100" width="40", or FALSE on failure param: string $name The filename |
imageFetchInfo($id = "", $name = "") line: 641 |
Gets an image as an array. return: array|bool An image data array, or FALSE on failure param: int $id image ID param: string $name image name |
image_format_info($image) line: 698 |
Formats image info. Takes an image data array generated by imageFetchInfo() and formats the contents. return: array param: array $image The image |
link_format_info($link) line: 719 |
Formats link info. return: array Formatted link data param: array $link The link to format |
gps($thing, $default = '') line: 737 |
Gets a HTTP GET or POST parameter. Internally strips CRLF from GET parameters and removes NULL bytes. return: string|array The value of $thing, or an empty string param: string $thing The parameter to get |
gpsa($array) line: 773 |
Gets an array of HTTP GET or POST parameters. return: array param: array $array The parameters to extract |
ps($thing) line: 802 |
Gets a HTTP POST parameter. Internally removes NULL bytes. return: string|array The value of $thing, or an empty string param: string $thing The parameter to get |
psa($array) line: 830 |
Gets an array of HTTP POST parameters. return: array param: array $array The parameters to extract |
psas($array) line: 853 |
Gets an array of HTTP POST parameters and strips HTML and PHP tags from values. return: array param: array $array The parameters to extract |
stripPost() line: 871 |
Gets all received HTTP POST parameters. return: array |
serverSet($thing) line: 887 |
Gets a variable from $_SERVER global array. return: mixed The variable, or an empty string on error param: mixed $thing The variable |
remote_addr() line: 902 |
Gets the client's IP address. Supports proxies and uses 'X_FORWARDED_FOR' HTTP header if deemed necessary. return: string |
pcs($thing) line: 928 |
Gets a variable from HTTP POST or a prefixed cookie. Fetches either a HTTP cookie of the given name prefixed with 'txp_', or a HTTP POST parameter without a prefix. return: array|string The variable or an empty string param: string $thing The variable |
cs($thing) line: 955 |
Gets a HTTP cookie. return: string The cookie or an empty string param: string $thing The cookie |
set_cookie($name, $value = '', $options = array() line: 977 |
Sets a HTTP cookie (polyfill). param: string $name The cookie name param: string $value The cookie value param: array $options The cookie options |
yes_no($status) line: 1006 |
Converts a boolean to a localised "Yes" or "No" string. return: string No if FALSE, Yes otherwise param: bool $status The boolean. Ignores type and as such can also take a string or an integer |
getmicrotime() line: 1021 |
Gets UNIX timestamp with microseconds. return: float |
load_plugin($name, $force = false) line: 1037 |
Loads the given plugin or checks if it was loaded. return: bool TRUE if the plugin is loaded param: string $name The plugin param: bool $force If TRUE loads the plugin even if it's disabled |
require_plugin($name) line: 1121 |
Loads a plugin. Identical to load_plugin() except upon failure it issues an E_USER_ERROR. return: bool param: string $name The plugin |
include_plugin($name) line: 1142 |
Loads a plugin. Identical to load_plugin() except upon failure it issues an E_USER_WARNING. return: bool param: string $name The plugin |
pluginErrorHandler($errno, $errstr, $errfile, $errline) line: 1163 |
Error handler for plugins. param: int $errno param: string $errstr param: string $errfile param: int $errline |
tagErrorHandler($errno, $errstr, $errfile, $errline) line: 1219 |
Error handler for page templates. param: int $errno param: string $errstr param: string $errfile param: int $errline |
feedErrorHandler($errno, $errstr, $errfile, $errline) line: 1292 |
Error handler for XML feeds. param: int $errno param: string $errstr param: string $errfile param: int $errline |
publicErrorHandler($errno, $errstr, $errfile, $errline) line: 1314 |
Error handler for public-side. param: int $errno param: string $errstr param: string $errfile param: int $errline |
load_plugins($type = false, $pre = null) line: 1367 |
Loads plugins. param: bool $type If TRUE loads admin-side plugins, otherwise public |
register_callback($func, $event, $step = '', $pre = 0) line: 1451 |
Attaches a handler to a callback event. param: callback $func The callback function param: string $event The callback event param: string $step The callback step param: bool $pre Before or after. Works only with selected callback events |
callback_event($event, $step = '', $pre = 0) line: 1479 |
Call an event's callback. Executes all callback handlers attached to the matched event and step. When called, any event handlers attached with register_callback() to the matching event, step and pre will be called. The handlers, callback functions, will be executed in the same order they were registered. Any extra arguments will be passed to the callback handlers in the same argument position. This allows passing any type of data to the attached handlers. Callback handlers will also receive the event and the step. Returns a combined value of all values returned by the callback handlers. return: mixed The value returned by the attached callback functions, or an empty string param: string $event The callback event param: string $step Additional callback step param: bool|int|array $pre Allows two callbacks, a prepending and an appending, with same event and step. Array allows return values chaining |
callback_event_ref($event, $step = '', $pre = 0, &$data = null, &$options = null) line: 1571 |
Call an event's callback with two optional byref parameters. return: array Collection of return values from event handlers param: string $event The callback event param: string $step Optional callback step param: bool $pre Allows two callbacks, a prepending and an appending, with same event and step param: mixed $data Optional arguments for event handlers param: mixed $options Optional arguments for event handlers |
has_handler($event, $step = '', $pre = 0) line: 1611 |
Checks if a callback event has active handlers. return: bool TRUE if the event is active, FALSE otherwise param: string $event The callback event param: string $step The callback step param: bool $pre The position |
callback_handlers($event, $step = '', $pre = 0, $as_string = true) line: 1632 |
Lists handlers attached to an event. return: array|bool An array of handlers, or FALSE param: string $event The callback event param: string $step The callback step param: bool $pre The position param: bool $as_string Return callables in string representation |
lAtts($pairs, $atts, $warn = true) line: 1672 |
Merge the second array into the first array. return: array The two arrays merged param: array $pairs The first array param: array $atts The second array param: bool $warn If TRUE triggers errors if second array contains values that are not in the first |
stripSpace($text, $force = false) line: 1730 |
Sanitises a string for use in an article's URL title. return: string|null param: string $text The title or an URL param: bool $force Force sanitisation |
sanitizeForUrl($text, $strip = '/[^\p{L}\p{N}\-_\s\/\\\\]/u') line: 1752 |
Sanitises a string for use in a URL. Be aware that you still have to urlencode the string when appropriate. This function just makes the string look prettier and excludes some unwanted characters, but leaves UTF-8 letters and digits intact. return: string param: string $text The string param: string $strip The regex of the characters to strip |
sanitizeForFile($text) line: 1783 |
Sanitises a string for use in a filename. return: string param: string $text The string |
sanitizeForPage($text) line: 1807 |
Sanitises a string for use in a page template's name. return: string param: string $text The string |
sanitizeForSort($text) line: 1827 |
Sanitizes a string for use in a ORDER BY clause. return: string param: string $text The string |
dumbDown($str, $lang = null) line: 1841 |
Transliterates a string to ASCII. Used to generate RFC 3986 compliant and pretty ASCII-only URLs. param: string $str The string to convert param: string $lang The language which translation table is used |
clean_url($url) line: 1969 |
Cleans a URL. return: string param: string $url The URL |
noWidow($str) line: 1983 |
Replace the last space with a   non-breaking space. return: string param: string $str The string |
is_blacklisted($ip, $checks = '') line: 1999 |
Checks if an IP is on a spam blocklist. return: string|bool The lists the IP is on or FALSE param: string $ip The IP address param: string|array $checks The checked lists. Defaults to 'spam_blacklists' preferences string |
is_logged_in($user = '') line: 2041 |
Checks if the user is authenticated on the public-side. return: array|bool An array containing details about the user; name, RealName, email, privs. FALSE when the user hasn't authenticated. param: string $user The checked username. If not provided, any user is accepted |
updateSitePath($here) line: 2079 |
Updates the path to the site. param: string $here The path |
splat($text) line: 2092 |
Converts Textpattern tag's attribute list to an array. return: array Array of attributes param: string $text The attribute list, e.g. foobar="1" barfoo="0" |
strip_rn($str) line: 2172 |
Replaces CR and LF with spaces, and drops NULL bytes. Used for sanitising email headers. return: string param: string $str The string |
is_valid_email($address) line: 2189 |
Validates a string as an email address. <code> if (is_valid_email('john.doe@example.com')) { echo "'john.doe@example.com' validates."; } </code> return: bool param: string $address The email address |
txpMail($to_address, $subject, $body, $reply_to = null) line: 2211 |
Sends an email message as the currently logged in user. <code> if (txpMail('john.doe@example.com', 'Subject', 'Some message')) { echo "Email sent to 'john.doe@example.com'."; } </code> return: bool Returns FALSE when sending failed param: string $to_address The receiver param: string $subject The subject param: string $body The message param: string $reply_to The reply to address |
encode_mailheader($string, $type) line: 2280 |
Encodes a string for use in an email header. return: string param: string $string The string param: string $type The type of header, either "text" or "phrase" |
eE($txt) line: 2300 |
Converts an email address into unicode entities. return: string Encoded email address param: string $txt The email address |
stripPHP($in) line: 2315 |
Strips PHP tags from a string. return: string param: string $in The input |
create_form($name, $type, $Form) line: 2327 |
Creates a form template. On a successful run, will trigger a 'form.create > done' callback event. return: bool FALSE on error param: string $name The name param: string $type The type param: string $Form The template |
form_exists($name) line: 2364 |
Checks if a form template exists. return: bool TRUE if the form exists param: string $name The form |
is_valid_form($name) line: 2378 |
Validates a string as a form template name. return: bool TRUE if the string validates param: string $name The form name |
since($stamp) line: 2398 |
Gets a "since days ago" date format from a given UNIX timestamp. return: string "n days ago" param: int $stamp UNIX timestamp |
tz_offset($timestamp = null) line: 2424 |
Calculates a timezone offset. Calculates the offset between the server local time and the user's selected timezone at a given point in time. return: int The offset in seconds param: int $timestamp The timestamp. Defaults to time() |
safe_strftime($format, $time = '', $gmt = false, $override_locale = '') line: 2478 |
Formats a time. Respects the locale and local timezone, and makes sure the output string is encoded in UTF-8. return: string Formatted date param: string $format The date format param: int $time UNIX timestamp. Defaults to time() param: bool $gmt Return GMT time param: string $override_locale Override the locale |
safe_strtotime($time_str) line: 2563 |
Converts a time string from the Textpattern timezone to GMT. return: int UNIX timestamp param: string $time_str The time string |
myErrorHandler($errno, $errstr, $errfile, $errline) line: 2581 |
Generic error handler. param: int $errno param: string $errstr param: string $errfile param: int $errline |
make_download_link($id, $label = '', $filename = '') line: 2640 |
Renders a download link. return: string HTML param: int $id The file ID param: string $label The label param: string $filename The filename |
set_error_level($level) line: 2664 |
Sets error reporting level. param: string $level The level. Either "debug", "live" or "testing" |
upload_get_errormsg($err_code) line: 2686 |
Translates upload error code to a localised error message. return: string The $err_code as a message param: int $err_code The error code |
format_filesize($bytes, $decimals = 2, $format = '') line: 2736 |
Formats a file size. return: string Formatted file size param: int $bytes Size in bytes param: int $decimals Number of decimals param: string $format The format the size is represented |
fileDownloadFetchInfo($where) line: 2768 |
Gets a file download as an array. return: array|bool An array of files, or FALSE on failure param: string $where SQL where clause |
file_download_format_info($file) line: 2792 |
Formats file download info. Takes a data array generated by fileDownloadFetchInfo() and formats the contents. return: array Formatted file info param: array $file The file info to format |
fileDownloadFormatTime($params) line: 2817 |
Formats file download's modification and creation timestamps. Used by file_download tags. return: string param: array $params |
txp_get_contents($file) line: 2846 |
file_get_contents wrapper. |
get_files_content($dir, $ext) line: 2856 |
Returns the contents of the found files as an array. |
is_disabled($function) line: 2873 |
Checks if a function is disabled. return: bool TRUE if the function is disabled param: string $function The function name |
build_file_path($base, $path) line: 2897 |
Joins two strings to form a single filesystem path. return: string A path to a file param: string $base The base directory param: string $path The second path, a relative filename |
get_author_name($name) line: 2914 |
Gets a user's real name. return: string A real name, or username if empty param: string $name The username |
get_author_email($name) line: 2936 |
Gets a user's email address. return: string param: string $name The username |
has_single_author($table, $col = 'author') line: 2958 |
Checks if a database table contains items just from one user. return: bool param: string $table The database table param: string $col The column |
txp_tokenize($thing, $hash = null, $transform = null) line: 2984 |
Parse a string and store the result. param: string $thing The raw string param: null|string $hash The string SHA1 hash param: bool|callable $transform The function applied to txp tags |
txp_fill_parsed($sha, $tags, $order, $count, $else) line: 3099 |
No description |
getIfElse($thing, $condition = true) line: 3123 |
Extracts a statement from a if/else condition. return: string Either if or else statement param: string $thing Statement in Textpattern tag markup presentation param: bool $condition TRUE to return if statement, FALSE to else |
EvalElse($thing, $condition) line: 3169 |
Extracts a statement from a if/else condition to parse. return: string Either if or else statement param: string $thing Statement in Textpattern tag markup presentation param: bool $condition TRUE to return if statement, FALSE to else |
fetch_form($name, $theme = null) line: 3198 |
Gets a form template's contents. The form template's reading method can be modified by registering a handler to a 'form.fetch' callback event. Any value returned by the callback function will be used as the form template markup. return: string param: array|string $name The form |
parse_form($name, $theme = null) line: 3251 |
Parses a form template. return: string The parsed contents param: string $name The form |
fetch_page($name, $theme) line: 3302 |
Gets a page template's contents. The page template's reading method can be modified by registering a handler to a 'page.fetch' callback event. Any value returned by the callback function will be used as the template markup. return: string|bool The page template, or FALSE on error param: string $name The template param: string $theme The public theme |
parse_page($name, $theme, $page = '') line: 3345 |
Parses a page template. return: string|bool The parsed page template, or FALSE on error param: string $name The template to parse param: string $theme The public theme param: string $page Default content to parse |
event_category_popup($name, $cat = '', $id = '', $atts = array() line: 3378 |
Gets a HTML select field containing all categories, or sub-categories. return: string|bool HTML select field or FALSE on error param: string $name Return specified parent category's sub-categories param: string $cat The selected category option param: string $id The HTML ID |
fetch_category_title($name, $type = 'article') line: 3399 |
Gets a category's title. return: string|bool The title or FALSE on error param: string $name The category param: string $type Category's type. Either "article", "file", "image" or "link" |
fetch_section_title($name) line: 3428 |
Gets a section's title. return: string|bool The title or FALSE on error param: string $name The section |
update_comments_count($id) line: 3458 |
Updates an article's comment count. return: bool param: int $id The article |
clean_comment_counts($parentids) line: 3476 |
Recalculates and updates comment counts. param: array $parentids List of articles to update |
markup_comment($msg) line: 3511 |
Parses and formats comment message using Textile. return: string HTML markup param: string $msg The comment message |
update_lastmod($trigger = '', $rs = array() line: 3526 |
Updates site's last modification date. When this action is performed, it will trigger a 'site.update > {event}' callback event and pass any record set that triggered the update, along with the exact time the update was triggered. param: $trigger Textpattern event or step that triggered the update param: $rs Record set data at the time of update |
get_lastmod($unix_ts = null) line: 3550 |
Gets the site's last modification date. return: int UNIX timestamp param: int $unix_ts UNIX timestamp |
set_headers($headers = array('Content-Type' => 'text/html; charset=utf-8') line: 3572 |
Sets headers. param: array $headers 'name' => 'value' param: bool $rewrite If TRUE, rewrites existing headers |
handle_lastmod($unix_ts = null, $exit = true) line: 3619 |
Sends and handles a lastmod header. return: array|null Array of sent HTTP status and the lastmod header, or NULL param: int|null $unix_ts The last modification date as a UNIX timestamp param: bool $exit If TRUE, terminates the script |
get_prefs($user = '') line: 3676 |
Gets preferences as an array. Returns preference values from the database as an array. Shouldn't be used to retrieve selected preferences, see get_pref() instead. By default only the global preferences are returned. If the optional user name parameter is supplied, the private preferences for that user are returned. return: array param: string $user User name. |
set_pref($name, $val, $event = 'publish', $type = PREF_CORE, $html = 'text_input', $position = 0, $is_private = PREF_GLOBAL) line: 3709 |
Creates or updates a preference. return: bool FALSE on error param: string $name The name param: string $val The value param: string $event The section the preference appears in param: int $type Either PREF_CORE, PREF_PLUGIN, PREF_HIDDEN param: string $html The HTML control type the field uses. Can take a custom function name param: int $position Used to sort the field on the Preferences panel param: bool $is_private If PREF_PRIVATE, is created as a user pref |
get_pref($thing, $default = '', $from_db = false) line: 3745 |
Gets a preference string. Prefers global system-wide preferences over a user's private preferences. return: string Preference value or $default param: string $thing The named variable param: mixed $default Used as a replacement if named pref isn't found param: bool $from_db If TRUE checks database opposed $prefs variable in memory |
remove_pref($name = null, $event = null, $user_name = null) line: 3788 |
Removes a preference string. Removes preference strings based on the given arguments. Use NULL to omit an argument. return: bool TRUE on success param: string|null $name The preference string name param: string|null $event The preference event param: string|null|bool $user_name The owner. If PREF_PRIVATE, the current user |
pref_exists($name, $user_name = null) line: 3839 |
Checks if a preference string exists. Searches for matching preference strings based on the given arguments. The $user_name argument can be used to limit the search to a specific user, or to global and private strings. If NULL, matches are searched from both private and global strings. return: bool TRUE if the string exists, or FALSE on error param: string $name The preference string name param: string|null|bool $user_name Either the username, NULL, PREF_PRIVATE or PREF_GLOBAL |
create_pref($name, $val, $event = 'publish', $type = PREF_CORE, $html = 'text_input', $position = 0, $user_name = PREF_GLOBAL) line: 3886 |
Creates a preference string. When a string is created, will trigger a 'preference.create > done' callback event. return: bool TRUE if the string exists, FALSE on error param: string $name The name param: string $val The value param: string $event The section the preference appears in param: int $type Either PREF_CORE, PREF_PLUGIN, PREF_HIDDEN param: string $html The HTML control type the field uses. Can take a custom function name param: int $position Used to sort the field on the Preferences panel param: string|bool $user_name The user name, PREF_GLOBAL or PREF_PRIVATE |
update_pref($name, $val = null, $event = null, $type = null, $html = null, $position = null, $user_name = PREF_GLOBAL) line: 3946 |
Updates a preference string. Updates a preference string's properties. The $name and $user_name arguments are used for selecting the updated string, and rest of the arguments take the new values. Use NULL to omit an argument. When a string is updated, will trigger a 'preference.update > done' callback event. return: bool FALSE on error param: string $name The update preference string's name param: string|null $val The value param: string|null $event The section the preference appears in param: int|null $type Either PREF_CORE, PREF_PLUGIN, PREF_HIDDEN param: string|null $html The HTML control type the field uses. Can take a custom function name param: int|null $position Used to sort the field on the Preferences panel param: string|bool|null $user_name The updated string's owner, PREF_GLOBAL or PREF_PRIVATE |
rename_pref($newname, $name, $user_name = null) line: 4010 |
Renames a preference string. When a string is renamed, will trigger a 'preference.rename > done' callback event. return: bool FALSE on error param: string $newname The new name param: string $name The current name param: string $user_name Either the username, PREF_GLOBAL or PREF_PRIVATE |
getCustomFields() line: 4056 |
Gets a list of custom fields. return: array |
buildCustomSql($custom, $pairs, $exclude = array() line: 4085 |
Build a query qualifier to filter non-matching custom fields from the result set. return: bool|string An SQL qualifier for a query's 'WHERE' part param: array $custom An array of 'custom_field_name' => field_number tuples param: array $pairs Filter criteria: An array of 'name' => value tuples |
buildTimeSql($month, $time, $field = 'Posted') line: 4133 |
Build a query qualifier to filter time fields from the result set. return: string An SQL qualifier for a query's 'WHERE' part param: string $month A starting time point param: string $time A time offset param: string $field The field to filter |
txp_status_header($status = '200 OK') line: 4196 |
Sends a HTTP status header. param: string $status The HTTP status code |
txp_die($msg, $status = '503', $url = '') line: 4216 |
Terminates normal page rendition and outputs an error page. param: string|array $msg The error message param: string $status HTTP status code param: string $url Redirects to the specified URL. Can be used with $status of 301, 302 and 307 |
parse_qs($match, $sep='=') line: 4323 |
Get field => alias array. return: array() param: string $match |
join_qs($q, $sep = '&') line: 4345 |
Gets a URL-encoded and HTML entity-escaped query string for a URL. Builds a HTTP query string from an associative array. return: string The query, including starting "?". param: array $q The parameters for the query |
join_atts($atts, $flags = TEXTPATTERN_STRIP_EMPTY_STRING, $glue = ' ') line: 4381 |
Builds a HTML attribute list from an array. Takes an array of raw HTML attributes, and returns a properly sanitised HTML attribute string for use in a HTML tag. Internally handles HTML boolean attributes, array lists and query strings. If an attributes value is set as a boolean, the attribute is considered as one too. If a value is NULL, it's omitted and the attribute is added without a value. An array value is converted to a space-separated list, or for 'href' and 'src' to a URL encoded query string. return: string HTML attribute list param: array|string $atts HTML attributes param: int $flags TEXTPATTERN_STRIP_EMPTY_STRING |
pagelinkurl($parts, $inherit = array() line: 4437 |
Builds a page URL from an array of parameters. The $inherit can be used to add parameters to an existing url, e.g: pagelinkurl(array('pg' => 2), $pretext). Cannot be used to link to an article. See permlinkurl() and permlinkurl_id() instead. return: string param: array $parts The parts used to construct the URL param: array $inherit Can be used to add parameters to an existing url |
permlinkurl_id($id) line: 4554 |
Gets a URL for the given article. If you need to generate a list of article URLs from already fetched table rows, consider using permlinkurl() over this due to performance benefits. return: string The URL param: int $id The article ID |
permlinkurl($article_array, $hu = hu) line: 4591 |
Generates an article URL from the given data array. return: string The URL param: array $article_array An array consisting of keys 'thisid', 'section', 'title', 'url_title', 'posted', 'expires' |
filedownloadurl($id, $filename = '') line: 4750 |
Gets a file download URL. return: string param: int $id The ID param: string $filename The filename |
imagesrcurl($id, $ext, $thumbnail = false) line: 4783 |
Gets an image's absolute URL. return: string param: int $id The image param: string $ext The file extension param: bool $thumbnail If TRUE returns a URL to the thumbnail |
in_list($val, $list, $delim = ',') line: 4801 |
Checks if a value exists in a list. return: bool Returns TRUE if $val is found, FALSE otherwise param: string $val The searched value param: string $list The value list param: string $delim The list boundary |
do_list($list, $delim = ',') line: 4820 |
Split a string by string. Trims the created values of whitespace. return: array param: string $list The string param: string $delim The boundary |
do_list_unique($list, $delim = ',', $flags = TEXTPATTERN_STRIP_EMPTY_STRING) line: 4861 |
Split a string by string, returning only unique results. Trims unique values of whitespace. Flags permit exclusion of empty strings. return: array param: string $list The string param: string $delim The boundary param: int $flags TEXTPATTERN_STRIP_NONE | TEXTPATTERN_STRIP_EMPTY | TEXTPATTERN_STRIP_EMPTY_STRING |
doQuote($val) line: 4893 |
Wraps a string in single quotes. return: string param: string $val The input string |
quote_list($in, $separator = null) line: 4905 |
Escapes special characters for use in an SQL statement and wraps the value in quote. Useful for creating an array/string of values for use in an SQL statement. return: mixed param: string|array $in The input value param: string|null $separator The separator |
trace_add($msg, $level = 0, $dummy = null) line: 4929 |
Adds a line to the tag trace. param: string $msg The message param: int $tracelevel_diff Change trace level |
article_push() line: 4957 |
Push current article on the end of data stack. Populates $stack_article global with the current $thisarticle. |
article_pop() line: 4969 |
Advance to the next article in the current data stack. Populates $thisarticle global with the last article from the stack stored in $stack_article. |
relative_path($path, $pfx = null) line: 4982 |
Gets a path relative to the site's root directory. return: string The absolute $path converted to relative param: string $path The filename to parse param: string $pfx The root directory |
get_caller($num = 1, $start = 2) line: 5000 |
Gets a backtrace. return: array A backtrace param: int $num The limit param: int $start The offset |
getlocale($lang) line: 5055 |
Sets a locale. The function name is misleading but remains for legacy reasons. return: string Current locale param: string $lang |
getMetaDescription($type = null) line: 5076 |
Fetch meta description from the given (or automatic) context. Category context may be refined by specifying the content type as well after a dot. e.g. category.image to check image context category. param: string $type Flavour of meta content to fetch (section, category, article) |
get_context($context = true, $internals = array('id', 's', 'c', 'context', 'q', 'm', 'pg', 'p', 'month', 'author', 'f') line: 5131 |
Get some URL data. return: array The retrieved data param: mixed $context The data to retrieve param: array $internals Data restrictions |
assert_article() line: 5165 |
Assert article context error. |
assert_comment() line: 5182 |
Assert comment context error. |
assert_file() line: 5195 |
Assert file context error. |
assert_image() line: 5208 |
Assert image context error. |
assert_link() line: 5221 |
Assert link context error. |
assert_section() line: 5234 |
Assert section context error. |
assert_category() line: 5247 |
Assert category context error. |
assert_int($myvar) line: 5260 |
Validate a variable as an integer. return: int|bool The variable or FALSE on error param: mixed $myvar The variable |
assert_string($myvar) line: 5278 |
Validate a variable as a string. return: string|bool The variable or FALSE on error param: mixed $myvar The variable |
assert_array($myvar) line: 5296 |
Validate a variable as an array. return: array|bool The variable or FALSE on error param: mixed $myvar The variable |
replace_relative_urls($html, $permalink = '') line: 5314 |
Converts relative links in HTML markup to absolute. return: string HTML param: string $html The HTML to check param: string $permalink Optional URL part appended to the links |
show_clean_test($pretext) line: 5345 |
Used for clean URL test. param: array $pretext |
pager($total, $limit, $page) line: 5364 |
Calculates paging. Takes a total number of items, a per page limit and the current page number, and in return returns the page number, an offset and a number of pages. return: array Array of page, offset and number of pages. param: int $total The number of items in total param: int $limit The number of items per page param: int $page The page number |
soft_wrap($text, $width, $break = '&) line: 5394 |
Word-wrap a string using a zero width space. return: string param: string $text The input string param: int $width Target line length param: string $break Is not used |
strip_prefix($str, $pfx) line: 5428 |
Removes prefix from a string. return: string param: string $str The string param: string $pfx The prefix |
send_xml_response($response = array() line: 5441 |
Sends an XML envelope. Wraps an array of name => value tuples into an XML envelope, supports one level of nested arrays at most. return: string XML envelope param: array $response |
send_script_response($out = '') line: 5493 |
Sends a text/javascript response. param: string $out The JavaScript |
send_json_response($out = '') line: 5515 |
Sends an application/json response. If the provided $out is not a string, its encoded as JSON. Any string is treated as it were valid JSON. param: mixed $out The JSON |
janitor() line: 5544 |
Performs regular housekeeping. |
bombShelter() line: 5565 |
Protection from those who'd bomb the site by GET. Origin of the infamous 'Nice try' message and an even more useful '503' HTTP status. |
http_accept_format($format) line: 5583 |
Test whether the client accepts a certain response format. Discards formats with a quality factor below 0.1 return: boolean $format TRUE if accepted param: string $format One of 'html', 'txt', 'js', 'css', 'json', 'xml', 'rdf', 'atom', 'rss' |
status_list($labels = true, $exclude = array() line: 5636 |
Return a list of status codes and their associated names. The list can be extended with a 'status.types > types' callback event. Callback functions get passed three arguments: '$event', '$step' and '$status_list'. The third parameter contains a reference to an array of 'status_code => label' pairs. return: array A status array param: bool Return the list with L10n labels (for UI purposes) or raw values (for comparisons) param: array List of status keys (numbers) to exclude |
getStatusNum($name, $default = STATUS_LIVE) line: 5677 |
Translates article status names into numerical status codes. return: int Matching numerical status param: string $name Status name param: int $default Status code to return if $name is not a defined status name |
real_max_upload_size($user_max, $php = true) line: 5698 |
Gets the maximum allowed file upload size. Computes the maximum acceptable file size to the application if the user-selected value is larger than the maximum allowed by the current PHP configuration. return: int Actual value; the lower of user-supplied value or system-defined value param: int $user_max Desired upload size supplied by the administrator |
txp_match($atts, $what) line: 5747 |
No description |
title