Procedural File: _misc.funcs.php
Source Location: /blogs/inc/_misc/_misc.funcs.php
Page Details
This file implements general purpose functions.
This file is part of the evoCore framework - http://evocore.net/ See also http://sourceforge.net/projects/evocms/.
| Author: | fplanque: Francois PLANQUE. |
| Author: | blueyed: Daniel HAHLER. |
| Author: | cafelog (team) |
| Author: | sakichan: Nobuo SAKIYAMA. |
| Author: | jeffbearer: Jeff BEARER. |
| Author: | vegarg: Vegar BERG GULDAL. |
| Author: | mbruneau: Marc BRUNEAU / PROGIDISTRI |
| Version: | $Id: _misc.funcs.php,v 1.95.2.35.2.17 2008/03/06 22:39:38 blueyed Exp $ |
| Copyright: | (c)2003-2007 by Francois PLANQUE - http://fplanque.net/ Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - http://thequod.de/contact. Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - http://progidistri.com/. |
| Todo: | Refactor into smaller chunks/files. We should avoid using a "huge" misc early! |
| Filesource: | Source Code for this file |
Includes
require_once
($model_path.'antispam/_antispam.funcs.php')
[line 53]
Dependencies
require_once
($model_path.'files/_file.funcs.php')
[line 54]
Functions
string action_icon(
string $title, string $icon, string $url, [string $word = NULL], [integer $icon_weight = 4], [integer $word_weight = 1], [array $link_attribs = array()]
)
|
|
Create IMG tag for an action icon.
Parameters:
|
string |
$title: |
TITLE text (IMG and A link) |
|
string |
$icon: |
icon code for get_icon() |
|
string |
$url: |
URL where the icon gets linked to (empty to not wrap the icon in a link) |
|
string |
$word: |
word to be displayed after icon (if no icon gets displayed, $title will be used instead!) |
|
integer |
$icon_weight: |
1-5: weight of the icon. the icon will be displayed only if its weight is >= than the user setting threshold Use 5, if it's a required icon - all others could get disabled by the user. |
|
integer |
$word_weight: |
1-5: weight of the word. the word will be displayed only if its weight is >= than the user setting threshold |
|
array |
$link_attribs: |
Additional attributes to the A tag. The values must be properly encoded for html output (e.g. quotes). It may also contain these params: - 'use_js_popup': if true, the link gets opened as JS popup. You must also pass an "id" attribute for this!
- 'use_js_size': use this to override the default popup size ("500, 400")
- 'class': defaults to 'action_icon', if not set; use "" to not use it
|
API Tags:
| Return: | The generated action icon link. |
void autobrize(
$content
)
|
|
Parameters:
void autoquote(
&$string
)
|
|
Parameters:
bad_request_die [line 1999]
void bad_request_die(
[string $additional_info = '']
)
|
|
Outputs Bad request Error message. When in debug mode it also prints a backtrace.
This should be used when a bad user input is detected?
Parameters:
|
string |
$additional_info: |
Message to output |
void balanceTags(
$text
)
|
|
Parameters:
string base_tag(
string $url, [ $target = NULL]
)
|
|
Returns a "<base />" tag and remembers that we've used it (regenerate_url() needs this).
Parameters:
|
string |
$url: |
URL to use (this gets used as base URL for all relative links on the HTML page) |
|
|
$target: |
|
void bullet(
boolean $bool
)
|
|
Displays an empty or a full bullet based on boolean
Parameters:
|
boolean |
$bool: |
true for full bullet, false for empty bullet |
callback_on_non_matching_blocks [line 335]
string callback_on_non_matching_blocks(
string $text, string $pattern, callback $callback, [array $params = array()]
)
|
|
Split $text into blocks by using $pattern and call $callback on the non-matching blocks.
The non-matching block's text is the first param to $callback and additionally $params gets passed.
This gets used to make links clickable or replace smilies.
E.g., to replace only in non-HTML tags, call it like:
Parameters:
|
string |
$text: |
Text to handle |
|
string |
$pattern: |
Regular expression pattern that defines blocks to exclude. |
|
callback |
$callback: |
Function name or object/method array to use as callback. Each non-matching block gets passed as first param, additional params may be passed with $params. |
|
array |
$params: |
Of additional ("static") params to $callback. |
API Tags:
void compact_date(
string $date
)
|
|
Compact a date in a number keeping only integer value of the string
Parameters:
void convert_chars(
$content, [ $flag = 'html']
)
|
|
Convert all non ASCII chars (except if UTF-8, GB2312 or CP1251) to &#nnnn; unicode references.
Also convert entities to &#nnnn; unicode references if output is not HTML (eg XML)
Preserves < > and quotes.
fplanque: simplified sakichan: pregs instead of loop
Parameters:
*** // Formatting functions ****
Parameters:
void date_i18n(
string $dateformatstring, integer $unixtimestamp, [boolean $useGM = false]
)
|
|
Date internationalization: same as date() formatting but with i18n support
Parameters:
|
string |
$dateformatstring: |
enhanced format string |
|
integer |
$unixtimestamp: |
UNIX timestamp |
|
boolean |
$useGM: |
true to use GM time |
void date_sprintf(
$string, $timestamp
)
|
|
Format dates into a string in a way similar to sprintf()
Parameters:
date_sprintf_callback [line 578]
void date_sprintf_callback(
$matches
)
|
|
Parameters:
void debug_die(
[string $additional_info = '']
)
|
|
Outputs Unexpected Error message. When in debug mode it also prints a backtrace.
This should be used instead of die() everywhere. This should NOT be used instead of exit() anywhere. Dying means the application has encontered and unexpected situation, i-e: something that should never occur during normal operation. Examples: database broken, user changed URL by hand...
Parameters:
|
string |
$additional_info: |
Message to output |
void debug_fopen(
$filename, $mode
)
|
|
Parameters:
void debug_fwrite(
$fp, $string
)
|
|
Parameters:
debug_get_backtrace [line 1686]
string debug_get_backtrace(
[integer|NULL $limit_to_last = NULL], [array $ignore_from = array( 'function' => 'debug_get_backtrace' )], [integer $offset_ignore_from = 0]
)
|
|
Get a function trace from http://www.php.net/debug_backtrace as html table.
Adopted from http://us2.php.net/manual/de/function.debug-backtrace.php#47644.
Parameters:
|
integer|NULL |
$limit_to_last: |
Get the last x entries from the stack (after $ignore_from is applied). Anything non-numeric means "all". |
|
array |
$ignore_from: |
After a key/value pair matches a stack entry, this and the rest is ignored. For example, array('class' => 'DB') would exclude everything after the stack "enters" class DB and everything that got called afterwards. You can also give an array of arrays which means that every condition in one of the given array must match. |
|
integer |
$offset_ignore_from: |
Number of stack entries to include, after $ignore_from matches. |
API Tags:
void debug_info(
[boolean $force = false]
)
|
|
Outputs debug info, according to $debug or $force param. This gets called typically at the end of the page.
Parameters:
|
boolean |
$force: |
true to force output regardless of $debug |
decompact_date [line 3070]
void decompact_date(
string $date
)
|
|
Decompact a date in a date format ( Y-m-d h:m:s )
Parameters:
void display_list(
array $items, [string $list_start = '<ul>'], [string $list_end = '</ul>'], [string $item_separator = ''], [string $item_start = '<li>'], [string $item_end = '</li>'], [ $force_hash = NULL]
)
|
|
Display an array as a list:
Parameters:
|
array |
$items: |
|
|
string |
$list_start: |
|
|
string |
$list_end: |
|
|
string |
$item_separator: |
|
|
string |
$item_start: |
|
|
string |
$item_end: |
|
|
|
$force_hash: |
|
display_param_link [line 3328]
void display_param_link(
$params
)
|
|
Parameters:
void disp_cond(
mixed $var, string $disp_one, [string $disp_more = NULL], [string $disp_none = NULL]
)
|
|
If first parameter evaluates to true printf() gets called using the first parameter as args and the second parameter as print-pattern
Parameters:
|
mixed |
$var: |
variable to test and output if it's true or $disp_none is given |
|
string |
$disp_one: |
printf-pattern to use (%s gets replaced by $var) |
|
string |
$disp_more: |
printf-pattern to use, if $var is numeric and > 1 (%s gets replaced by $var) |
|
string |
$disp_none: |
printf-pattern to use if $var evaluates to false (%s gets replaced by $var) |
void forget_param(
$var
)
|
|
Forget a param so that is will not get included in subsequent regenerate_url() calls.
Parameters:
format_french_phone [line 3140]
void format_french_phone(
string $phone
)
|
|
Format a string in a french phone number
Parameters:
|
string |
$phone: |
phone number |
void format_phone(
string $phone, [ $hide_country_dialing_code_if_same_as_locale = true]
)
|
|
Check the format of the phone number param and format it in a french number if it is.
Parameters:
|
string |
$phone: |
phone number |
|
|
$hide_country_dialing_code_if_same_as_locale: |
|
format_to_output [line 76]
string format_to_output(
string $content, [string $format = 'htmlbody']
)
|
|
Format a string/content for being output
Parameters:
|
string |
$content: |
raw text |
|
string |
$format: |
format, can be one of the following - raw: do nothing
- htmlbody: display in HTML page body: allow full HTML
- entityencoded: Special mode for RSS 0.92: allow full HTML but escape it
- htmlhead: strips out HTML (mainly for use in Title)
- htmlattr: use as an attribute: escapes quotes, strip tags
- formvalue: use as a form value: escapes quotes and < > but leaves code alone
- text: use as plain-text, e.g. for ascii-mails
- xml: use in an XML file: strip HTML tags
- xmlattr: use as an attribute: strips tags and escapes quotes
|
API Tags:
Information Tags:
format_to_post [line 163]
string format_to_post(
string $content, [integer $autobr = 0], [integer $is_comment = 0], [string $encoding = NULL]
)
|
|
Format raw HTML input to cleaned up and validated HTML.
Parameters:
|
string |
$content: |
The content to format |
|
integer |
$autobr: |
Create automated tags? (Deprecated??!) |
|
integer |
$is_comment: |
Is this a comment? (Used for balanceTags(), SafeHtmlChecker()'s URI scheme, styling restrictions) |
|
string |
$encoding: |
Encoding (used for SafeHtmlChecker() only!); defaults to $io_charset |
void form_date(
string $date, [string $time = '']
)
|
|
Parameters:
|
string |
$date: |
date (YYYY-MM-DD) |
|
string |
$time: |
time |
generate_link_from_params [line 3431]
void generate_link_from_params(
$link_params
)
|
|
Generate a link from params
Parameters:
generate_random_key [line 2852]
string generate_random_key(
[integer $length = 32], [string $keychars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789']
)
|
|
Generate a valid key of size $length.
Parameters:
|
integer |
$length: |
length of key |
|
string |
$keychars: |
chars to use in generated key |
API Tags:
generate_random_passwd [line 2872]
string generate_random_passwd(
[integer $length = 8]
)
|
|
Generate a random password with no ambiguous chars
Parameters:
|
integer |
$length: |
length of password |
API Tags:
get_base_domain [line 2814]
string get_base_domain(
string $url
)
|
|
Get the base domain (without protocol and any subdomain) of an URL.
Gets a max of 3 domain parts (x.y.tld)
Parameters:
API Tags:
| Return: | the base domain (may become empty, if found invalid) |
get_field_attribs_as_string [line 3189]
string get_field_attribs_as_string(
array $field_attribs, [boolean $format_to_output = true]
)
|
|
Build a string out of $field_attribs, with each attribute prefixed by a space character.
Parameters:
|
array |
$field_attribs: |
Array of field attributes. |
|
boolean |
$format_to_output: |
Use format_to_output() for the attributes? |
void get_icon(
string $iconKey, [string $what = 'imgtag'], [array $params = NULL], [boolean $include_in_legend = false]
)
|
|
Get properties of an icon.
Note: to get a file type icon, use File::get_icon() instead.
Parameters:
|
string |
$iconKey: |
icon for what? (key) |
|
string |
$what: |
what to return for that icon ('imgtag', 'alt', 'legend', 'file', 'url', 'size' imgsize()) |
|
array |
$params: |
additional params ( 'class' => class name when getting 'imgtag', 'size' => param for 'size', 'title' => title attribute for 'imgtag') |
|
boolean |
$include_in_legend: |
true to include this icon into the legend at the bottom of the page (works for 'imgtag' only) |
API Tags:
array|string get_ip_list(
[boolean $firstOnly = false]
)
|
|
Get list of client IP addresses from REMOTE_ADDR and HTTP_X_FORWARDED_FOR, in this order. '' is used when no IP could be found.
Parameters:
|
boolean |
$firstOnly: |
True, to get only the first IP (probably REMOTE_ADDR) |
API Tags:
| Return: | Depends on first param. |
get_link_showhide [line 3027]
string get_link_showhide(
string $link_id, string $target_id, $text_when_displayed, $text_when_hidden, [ $display_hidden = true]
)
|
|
Generate a link that toggles display of an element on clicking.
Parameters:
|
string |
$link_id: |
ID (html) of the link |
|
string |
$target_id: |
ID (html) of the target to toggle displaying |
|
|
$text_when_displayed: |
|
|
|
$text_when_hidden: |
|
|
|
$display_hidden: |
|
API Tags:
| Uses: | toggle_display_by_id() - (JS) |
Information Tags:
| Todo: | Provide functionality to make those links accessible without JS (using GET parameter) |
get_memorized [line 1481]
void get_memorized(
[mixed $ignore = '']
)
|
|
Construct an array of memorized params which are not in the ignore list
Parameters:
|
mixed |
$ignore: |
string or array of ignore params |
get_start_date_for_week [line 593]
void get_start_date_for_week(
integer $year, integer $week, integer $startofweek
)
|
|
Parameters:
|
integer |
$year: |
year |
|
integer |
$week: |
month (0-53) |
|
integer |
$startofweek: |
0 for sunday, 1 for monday |
get_web_help_link [line 3160]
string get_web_help_link(
string $topic
)
|
|
Generate a link to a online help resource.
testing the concept of online help (aka webhelp). this function should be relocated somewhere better if it is taken onboard by the project
Parameters:
|
string |
$topic: |
Topic The topic should be in a format like [\w]+(/[\w]+)*, e.g features/online_help. |
Information Tags:
| Todo: | replace [?] with icon, |
| Todo: | write url suffix dynamically based on topic and language QUESTION: launch new window with javascript maybe? |
get_weekstartend [line 627]
void get_weekstartend(
date $date, integer $startOfWeek
)
|
|
Get start and end day of a week, based on week number and start-of-week
Used by Calendar
fp>> I'd really like someone to comment the magic of that thing...
Parameters:
|
date |
$date: |
|
|
integer |
$startOfWeek: |
0 for Sunday, 1 for Monday |
hash_link_params [line 3382]
void hash_link_params(
array $link_array, [ $force_hash = NULL]
)
|
|
Get a link line, based url hash combined with probability percentage in first column
Parameters:
|
array |
$link_array: |
of arrays |
|
|
$force_hash: |
|
header_nocache [line 2885]
Sends HTTP headers to avoid caching of the page.
header_redirect [line 2907]
void header_redirect(
[string $redirect_to = NULL], [boolean $permanent = false]
)
|
|
Sends HTTP header to redirect to the previous location (which can be given as function parameter, GET parameter (redirect_to), is taken from Hit::referer or $baseurl).
$Debuglog and $Messages get stored in $Session, so they are available after the redirect.
NOTE: This function exit() the php script execution.
Parameters:
|
string |
$redirect_to: |
URL to redirect to (overrides detection) |
|
boolean |
$permanent: |
is this a permanent redirect? if true, send a 301; otherwise a 303 |
implode_with_and [line 3249]
string implode_with_and(
$arr, [ $implode_by = ', '], [ $implode_last = ' &amp; ']
)
|
|
Implode array( 'x', 'y', 'z' ) to something like 'x, y and z'. Useful for displaying list to the end user.
If there's one element in the table, it is returned. If there are at least two elements, the last one is concatenated using $implode_last, while the ones before are imploded using $implode_by.
Parameters:
|
|
$arr: |
|
|
|
$implode_by: |
|
|
|
$implode_last: |
|
Information Tags:
| Todo: | Support for locales that have a different kind of enumeration?! |
is_admin_page [line 3232]
Is the current page an admin/backoffice page?
is_create_action [line 2993]
void is_create_action(
$action
)
|
|
Parameters:
bool|array is_email(
string $email, [string $format = 'simple'], [boolean $return_match = false]
)
|
|
Check that email address looks valid.
Parameters:
|
string |
$email: |
email address to check |
|
string |
$format: |
Format to use ('simple', 'rfc') 'simple': Single email address. 'rfc': Full email address, may include name (RFC2822) - example@example.org
- Me <example@example.org>
- "Me" <example@example.org>
|
|
boolean |
$return_match: |
Return the match or boolean |
API Tags:
| Return: | Either true/false or the match (see $return_match) |
boolean is_regexp(
string $reg_exp, [boolean $includes_delim = false]
)
|
|
Checks if a given regular expression is valid.
It changes the error_handler and restores it.
Parameters:
|
string |
$reg_exp: |
the regular expression to test |
|
boolean |
$includes_delim: |
does the regular expression includes delimiters (and optionally modifiers)? |
Information Tags:
Are we running on a Windows server?
jsspecialchars [line 3044]
string jsspecialchars(
string $s
)
|
|
Escape a string to be used in Javascript.
Parameters:
make_clickable [line 382]
string make_clickable(
$text, [ $moredelim = '&amp;']
)
|
|
Make links clickable in a given text.
It replaces only text which is not between <a> tags already.
Parameters:
API Tags:
make_clickable_callback [line 401]
string make_clickable_callback(
&$text, [ $moredelim = '&amp;']
)
|
|
Callback function for make_clickable().
Parameters:
API Tags:
| Return: | The clickable text. |
Information Tags:
| Todo: | IMHO it would be better to use "\b" (word boundary) to match the beginning of links.. original function: phpBB, extended here for AIM & ICQ fplanque restricted :// to http:// and mailto:// Fixed to not include trailing dot and comma. |
make_rel_links_abs [line 3538]
string make_rel_links_abs(
string $s, [string $host = NULL]
)
|
|
Make links in $s absolute.
It searches for "src" and "href" HTML tag attributes and makes the absolute.
Parameters:
|
string |
$s: |
content |
|
string |
$host: |
Hostname including scheme, e.g. http://example.com; defaults to $ReqHost |
API Tags:
memorize_param [line 1307]
void memorize_param(
string $var, string $type, mixed $default, [mixed $value = NULL]
)
|
|
Memorize a parameter for automatic future use in regenerate_url()
Parameters:
|
string |
$var: |
Variable to memorize |
|
string |
$type: |
Type of the variable |
|
mixed |
$default: |
Default value to compare to when regenerating url |
|
mixed |
$value: |
Value to set |
void mysql2date(
string $dateformatstring, string $mysqlstring, [boolean $useGM = false]
)
|
|
Format a MYSQL date.
Parameters:
|
string |
$dateformatstring: |
enhanced format string |
|
string |
$mysqlstring: |
MYSQL date YYYY-MM-DD HH:MM:SS |
|
boolean |
$useGM: |
true to use GM time |
mysql2datestamp [line 440]
void mysql2datestamp(
$m
)
|
|
Convert a MYSQL date -- WITHOUT the time -- to a UNIX timestamp
Parameters:
mysql2localedate [line 450]
void mysql2localedate(
string $mysqlstring
)
|
|
Format a MYSQL date to current locale date format.
Parameters:
|
string |
$mysqlstring: |
MYSQL date YYYY-MM-DD HH:MM:SS |
mysql2localedatetime [line 460]
void mysql2localedatetime(
$mysqlstring
)
|
|
Parameters:
mysql2localedatetime_spans [line 465]
void mysql2localedatetime_spans(
$mysqlstring
)
|
|
Parameters:
mysql2localetime [line 455]
void mysql2localetime(
$mysqlstring
)
|
|
Parameters:
mysql2timestamp [line 432]
void mysql2timestamp(
$m
)
|
|
Convert a MYSQL date to a UNIX timestamp
Parameters:
mixed param(
string $var, [string $type = ''], [mixed $default = ''], [boolean $memorize = false], [boolean $override = false], [boolean $use_default = true], [mixed $strict_typing = 'allow_empty']
)
|
|
Sets a parameter with values from the request or to provided default, except if param is already set!
Also removes magic quotes if they are set automatically by PHP. Also forces type. Priority order: POST, GET, COOKIE, DEFAULT.
Parameters:
|
string |
$var: |
Variable to set |
|
string |
$type: |
Force value type to one of: - integer
- float, double
- string (strips (HTML-)Tags, trims whitespace)
- array (TODO: array/integer , array/array/string )
- html (does nothing)
- '' (does nothing)
- '/^...$/' check regexp pattern match (string)
- boolean (will force type to boolean, but you can't use 'true' as a default since it has special meaning. There is no real reason to pass booleans on a URL though. Passing 0 and 1 as integers seems to be best practice).
Value type will be forced only if resulting value (probably from default then) is !== NULL |
|
mixed |
$default: |
Default value or TRUE if user input required |
|
boolean |
$memorize: |
Do we need to memorize this to regenerate the URL for this page? |
|
boolean |
$override: |
Override if variable already set |
|
boolean |
$use_default: |
Force setting of variable to default if no param is sent and var wasn't set before |
|
mixed |
$strict_typing: |
true will refuse illegal values, false will try to convert illegal to legal values, 'allow_empty' will refuse illegal values but will always accept empty values (This helps blocking dirty spambots or borked index bots. Saves a lot of processor time by killing invalid requests) |
API Tags:
| Return: | Final value of Variable, or false if we don't force setting and did not set |
| Usedby: | param_cookie() |
void param_cookie(
$var, [ $type = ''], [ $default = ''], [ $memorize = false], [ $override = false], [ $use_default = true], [ $strict_typing = 'allow_empty']
)
|
|
Get a param from cookie.
Parameters:
|
|
$var: |
|
|
|
$type: |
|
|
|
$default: |
|
|
|
$memorize: |
|
|
|
$override: |
|
|
|
$use_default: |
|
|
|
$strict_typing: |
|
API Tags:
regenerate_url [line 1362]
void regenerate_url(
[mixed|string $ignore = ''], [array|string $set = ''], [mixed|string $pagefileurl = ''], [string $moredelim = '&amp;']
)
|
|
Regenerate current URL from parameters This may clean it up But it is also useful when generating static pages: you cannot rely on $_REQUEST[]
Parameters:
|
mixed|string |
$ignore: |
(delimited by commas) or array of params to ignore (can be regexps in /.../) |
|
array|string |
$set: |
Param(s) to set |
|
mixed|string |
$pagefileurl: |
Alternative URL we want to point to if not the current URL (may be absolute if BASE tag gets used) |
|
string |
$moredelim: |
Delimiter to use for multiple params (typically '&' or '&') |
remove_magic_quotes [line 1041]
void remove_magic_quotes(
$mixed
)
|
|
Parameters:
resolve_link_params [line 3339]
string resolve_link_params(
array $item, [ $force_hash = NULL]
)
|
|
Resolve a link based on params
Parameters:
|
array |
$item: |
|
|
|
$force_hash: |
|
boolean send_mail(
string $to, string $subject, string $message, [string $from = NULL], [array $headers = array()]
)
|
|
Sends a mail, wrapping PHP's mail() function.
$current_locale will be used to set the charset.
Note: we use a single \n as line ending, though it does not comply to RFC2822, but seems to be safer, because some mail transfer agents replace \n by \r\n automatically.
Parameters:
|
string |
$to: |
Recipient, either email only or in "Name <example@example.com>" format (RFC2822). Can be multiple comma-separated addresses. |
|
string |
$subject: |
Subject of the mail |
|
string |
$message: |
The message text |
|
string |
$from: |
From address, being added to headers (we'll prevent injections); see http://securephp.damonkohler.com/index.php/Email_Injection. Might be just an email address or of the same form as $to. $notify_from gets used as default (if NULL). |
|
array |
$headers: |
Additional headers ( headername => value ). Take care of injection! |
API Tags:
| Return: | True if mail could be sent (not necessarily delivered!), false if not - (return value of http://www.php.net/mail) |
Information Tags:
| Todo: | Unit testing with "nice addresses" This gets broken over and over again. |
void set_param(
$var, $value
)
|
|
Set the value of a param (by force! :P)
Parameters:
void unautobrize(
$content
)
|
|
Parameters:
string url_absolute(
string $url, [string $host = NULL]
)
|
|
Make an $url absolute according to $host, if it is not absolute yet.
Parameters:
|
string |
$url: |
URL |
|
string |
$host: |
Host (including protocol, e.g. 'http://example.com'); defaults to $ReqHost |
API Tags:
url_add_param [line 2215]
void url_add_param(
string $url, string $param, [string $moredelim = '&amp;']
)
|
|
Add param(s) at the end of an URL, using either "?" or "&" depending on existing url
Parameters:
|
string |
$url: |
existing url |
|
string |
$param: |
params to add |
|
string |
$moredelim: |
delimiter to use for more params |
void url_add_tail(
string $url, string $tail
)
|
|
Add a tail (starting with "/") at the end of an URL before any params (starting with "?")
Parameters:
|
string |
$url: |
existing url |
|
string |
$tail: |
tail to add |
url_rel_to_same_host [line 3456]
string url_rel_to_same_host(
string $url, string $target_url
)
|
|
Try to make $url relative to $target_url, if scheme, host, user and pass matches.
This is useful for redirect_to params, to keep them short and avoid mod_security rejecting the request as "Not Acceptable" (whole URL as param).
Parameters:
|
string |
$url: |
URL to handle |
|
string |
$target_url: |
URL where we want to make $url relative to |
mixed validate_url(
string $url, array &$allowed_uri_scheme
)
|
|
Check the validity of a given URL
Checks allowed URI schemes and URL ban list. URL can be empty.
Note: We have a problem when trying to "antispam" a keyword which is already blacklisted If that keyword appears in the URL... then the next page has a bad referer! :/
Parameters:
|
string |
$url: |
Url to validate |
|
array |
&$allowed_uri_scheme: |
Allowed URI schemes (see /conf/_formatting.php) |
API Tags:
| Return: | false (which means OK) or error message |
xmlrpc_displayresult [line 780]
void xmlrpc_displayresult(
object XMLRPC $result, [boolean $display = true], [mixed $log = '']
)
|
|
Echo the XML-RPC call Result and optionally log into file
Parameters:
|
object XMLRPC |
$result: |
response object |
|
boolean |
$display: |
true to echo |
|
mixed |
$log: |
File resource or == '' for no file logging. |
xmlrpc_getpostcategory [line 750]
void xmlrpc_getpostcategory(
$content
)
|
|
Also used by post by mail
Parameters:
xmlrpc_getposttitle [line 732]
void xmlrpc_getposttitle(
$content
)
|
|
Parameters:
xmlrpc_logresult [line 827]
boolean xmlrpc_logresult(
object XMLRPC $result, Log &$message_Log
)
|
|
Log the XML-RPC call Result into LOG object
Parameters:
|
object XMLRPC |
$result: |
response object |
|
Log |
&$message_Log: |
object to add messages to |
API Tags:
| Return: | true = success, false = error |
xmlrpc_removepostdata [line 764]
void xmlrpc_removepostdata(
$content
)
|
|
Parameters:
void zeroise(
$number, $threshold
)
|
|
Parameters:
integer _trapError(
[ $reset = 1]
)
|
|
Meant to replace error handler temporarily.
Parameters:
API Tags: