User Tools

Site Tools


core_docs:utility_functions

Utility functions

This page is a work in progress.

clean_url

clean_img_name

to7bit

email_template

sendmail

subval_sort

isFile

getFiles

get_execution_time

getXML

Signature

getXML($path_to_file)

Description
Retrieves the XML contents from $path_to_file and returns it as a SimpleXMLExtended object.

XMLsave

Signature

XMLsave($xml, $file)

Description
Saves (ideally SimpleXMLExtended) $xml objects to the $file path.
If GSFORMATXML is true, will pretty-print the XML string.
This function executes the filter xmlsave every time it is called, so that everyone can alter the XML string by using add_filter('xmlsave', 'myFunc')

lngDate

Signature

lngDate($date)

Description
Returns a date according to the format stored in the global $i18n keyDATE_AND_TIME_FORMAT, in admin/lang/.
Default format is F jS, Y - g:i A, see PHP dates and times.

shtDate

Signature

shtDate($date)

Description
Returns a date according to the format stored in the global $i18n keyDATE_FORMAT, in admin/lang/.
Default format is M j, Y, see PHP dates and times.

cl

Signature

cl($data)

Description
Cleans $data consecutively with html_entity_decode, strip_tags and strip_slashes

Parameters

  • $data, the data string to clean

tsl

Signature

tsl($path)

Description
Adds a trailing slash to $path if there isn't one yet.

Parameters

  • $path, the path to add a trailing slash to.

in_arrayi

find_url

strippath

Signature

strippath($path_to_file)

Description
Returns the filename and extension from $path_to_file, using pathinfo.

strip_quotes

Signature

strip_quotes($text)

Description
Strips HTML entity quotes, double and single quotes from $text and returns the result.

Parameters

  • $text, the string to strip quotes from

encode_quotes

Signature

encode_quotes($text)

Description
Encodes quotes as HTML entities with htmlspecialchars and trims whitespace in $text.

Parameters

  • $text, the text to encode quotes in.

redirect

i18n

Signature

i18n($key[, $echo=true])

Description
Outputs the translation of $key in the global $i18n (in the current language, or en_US if it does not exist), or returns it if $echo is false.

Parameters

  • $key, the key of the translation to find
  • $echo (optional), whether to echo or return the value. If $echo is false, acts the same as i18n_r

i18n_r

Signature

i18n_r($key)

Description
Shorthand for i18n($key, true). Returns the translation for $key.

i18n_merge

Signature

i18n_merge($plugin[, $language=null])

Description
Merges a plugin's language file with the global $i18n language.

Parameters

  • $plugin, the namespace of the plugin's language.
  • $language (optional), don't pass unless you want to force a specific language.

i18n_merge_impl

Signature

i18n_merge_impl($plugin, $lang, &$globali18n)

Description Used by i18n_merge to do the actual merging of the plugin's i18n namespace (in the plugin's lang folder) with the global $i18n variable.

safe_slash_html

xmlFilterChars

getRegexUnicode

safe_strip_decode

strip_decode

pathinfo_filename

getFileExtension

suggest_site_path

myself

get_themes

htmldecode

lowercase

Signature

lowercase($text)

Description
Converts $text to lowercase.

find_accesskey

Signature

find_accesskey($i18n_string)

Description
Relies on access keys being enclosed by '<em></em>' elements in an i18n string. Used especially in the admin's main navigation.

_id

defined_array

check_empty_folder

folder_items

validate_url

formatXmlString_legacy

formatXmlString

http_protocol

file_mime_type

is_frontend

get_site_version

get_site_lang

toBytes

removerelativepath

directoryToArray

getDef

isDebug

isBeta

requestIsAjax

arrayIsMultid

returnJsArray

header_xframeoptions

strip_whitespace

strip_content

core_docs/utility_functions.txt · Last modified: 2016/06/05 09:51 by Tyblitz