Functions
colour_diff ($c1, $c2, $percent)
- Package: Misc
- Return: string
Returns the difference between two colours, measured in percentage
of the first (the higher the percentage value, the closer to the
first colour it will be). Percentage is specified as a decimal
value. The colours are 3 or 6 character hex values.
colour_gradient ($c1, $c2, $divisions = 10)
Returns an array of colours between the two specified colours.
The first and last values are always the two colours themselves.
curl_init ()
curl_setopt ($ch, $key, $value)
curl_exec ($ch)
curl_error ($ch)
curl_errno ($ch)
curl_close ($ch)
page_add_header ($header)
Adds an HTTP header to send with the page.
page_add_meta ($key, $value, $name = 'name')
Adds an HTML meta tag to the page.
page_add_script ($script)
Adds a JavaScript script to the page.
page_add_style ($style)
Adds a CSS stylesheet to the page.
page_add_link ($rel, $type, $href, $charset = false, $hreflang = false, $name = false)
Adds a link tag to the page.
page_id ($id)
Sets the page ID to something other than its default.
Handy for actions with page aliases.
page_title ($title)
Sets the title of the page.
page_head_title ($title)
Sets the head_title of the page.
page_nav_title ($title)
Sets the nav_title of the page.
page_description ($description)
Sets the description of the page.
page_keywords ($keywords)
Sets the keywords of the page.
page_below ($ref)
Sets the below_page property of the page. This sets the position of
the page within the web site breadcrumbs.
page_template ($value)
Sets the template to use to render the page.
page_template_set ($value)
Sets the template set (ie. theme) to use to render the page.
page_get_section ()
- Access: public
- Return: string
Alias of the getSection() method. Returns the first section page that
the current page is a child of.
page_get_title ($page = false)
- Access: public
- Return: string
Alias of the getTitle() method.
page_is_parent ($parent)
- Access: public
- Return: boolean
Alias of the isParent() method.
page_onload ($value)
Adds an onload="" handler to the page. This can be rendered in your XT
templates in the onload attribute of your HTML body tag, by inserting the
value "${onload}".
page_onunload ($value)
Adds an onunload="" handler to the page. This can be rendered in your XT
templates in the onunload attribute of your HTML body tag, by inserting the
value "${onunload}".
page_onfocus ($value)
Adds an onfocus="" handler to the page. This can be rendered in your XT
templates in the onfocus attribute of your HTML body tag, by inserting the
value "${onfocus}".
page_onblur ($value)
Adds an onblur="" handler to the page. This can be rendered in your XT
templates in the onblur attribute of your HTML body tag, by inserting the
value "${onblur}".
page_onclick ($value)
Adds an onclick="" handler to the page. This can be rendered in your XT
templates in the onclick attribute of your HTML body tag, by inserting the
value "${onclick}".
ini_parse ($file, $sections = true)
Parses an INI file -- calls parse() on a global $ini object.
ini_add_filter ($func, $keys = array ())
Adds a filter to the global $ini object. Alias of addFilter() method.
ini_filter ($data, $sections = true)
Filters the specified data using the global $ini object.
Alias of filter() method.
ini_clear ()
Clears the list of filters in the global $ini object.
Alias of clear() method.
ini_write ($struct, $instructions = false)
Writes an INI data string from the specified structure.
Alias of write() in global $ini object.
ini_filter_replace_backticks ($value, $reverse = false)
Backtick INI filter. Replaces backticks (`) with double-quotes (").
Please note that this filter is on by default in the Ini class.
The $reverse parameters tells the filter to do the reverse of its
ordinary function and return that instead. This is used by the
write() method to write back an INI file correctly that has
been filtered.
ini_filter_split_commas ($value, $reverse = false)
Comma-splitting INI filter. Breaks a string into a list by the
commas in it. Note: An optional single space is allowed following
commas, and will be trimmed.
The $reverse parameters tells the filter to do the reverse of its
ordinary function and return that instead. This is used by the
write() method to write back an INI file correctly that has
been filtered.
ini_filter_split_comma_single ($value, $reverse = false)
Single-comma-splitting INI filter. Breaks a string into two by
the first comma in it. Note: An optional single space is allowed
following the comma, and will be trimmed.
The $reverse parameters tells the filter to do the reverse of its
ordinary function and return that instead. This is used by the
write() method to write back an INI file correctly that has
been filtered.
microbench ($tag = '', $calculate = false)
Microbench Lightweight Benchmarking Utility
Usage:
microbench ('optional comment');
sleep (5);
microbench ('optional comment');
sleep (4);
microbench ('optional comment');
// display results
microbench_display ();
microbench_display ()
rpc_init ($handler = 'return false', $render = false)
- Return: string
- Package: Misc
Sets up the necessary javascript includes and such for using
the /js/rpc.js package. See that package for more info.
Usage:
echo rpc_init ('javascript to handle server response here...');
rpc_response ()
- Return: string
- Package: Misc
Creates a proper rpc server response out of the parameters passed to
this function (uses func_get_args(), so pass it whatever you want).
Usage:
echo rpc_response (true);
exit;
rpc_serialize ($val)
- Return: string
- Package: Misc
Serialize the specified PHP data into a JavaScript-compatible string.
Properly handles strings, numbers, boolean values, objects, and arrays,
but does not maintain key associations in arrays.
rpc_handle (&$obj, $parameters)
- Return: string
- Package: Misc
Takes an object and the parameter list from a box call, executes
the specified method (a 'method' entry in the parameter list)
with the rest of the values from the parameter list, and
returns a serialized JavaScript variable, suitable for passing
to the JavaScript eval() function.
This function operates independently of the others (ie. you
do not need the calls to rpc_init() or rpc_response(). This
function is used in conjunction with the new XMLHttpRequest-based
RPC facilities in js/rpc.js.
Note: The following are reserved parameter names:
- error
- files
- method
- mode
- page
- param
Usage:
class Test {
function hello ($name) {
return 'hello ' . $name;
}
}
echo rpc_handle (new Test (), $parameters);
exit;
search_split_query ($query)
- Return: array
- Package: Misc
Splits a search into an array of individual terms. Properly handles
quoted strings as well, keeping them as a single literal term.
search_highlight ($string, $queries)
- Return: string
- Package: Misc
Highlights all of the query terms in the specified string, wrapping
them in <span class="highlighted"></span> tags.
Source: http://www.ilovejackdaniels.com/php/google-style-keyword-highlighting/
search_bar ($query, $url = '/index/sitellite-search-action')
- Return: string
- Package: Misc
Returns a bar that displays "Highlighting Search Terms: a, b, c <Search Again>".
get_searchengine_keywords ($referer)
- Return: array Search terms
- Package: Misc
Check if the previous request was a search engine results page. If
so, then parse the search keywords.
saf_misc_search_content_filter ($body)
- Return: string
- Package: Misc
If you would like search terms to be automatically highlighted in your
web pages, add 'filter 1 = "body: saf.Misc.Search"' to the modes.php file
in your template set, under the appropriate output mode.
Return to Top