This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
core_docs:utility_functions [2016/06/05 00:19] Tyblitz [tsl] |
core_docs:utility_functions [2016/06/05 09:35] Tyblitz [shtDate] |
||
---|---|---|---|
Line 15: | Line 15: | ||
===== XMLsave ===== | ===== XMLsave ===== | ||
===== lngDate ===== | ===== lngDate ===== | ||
- | ===== shtDate ===== | + | **Signature** |
+ | <code>lngDate($date)</code> | ||
+ | |||
+ | **Description**\\ | ||
+ | Returns a date according to the format stored in the global ''$i18n'' key''DATE_AND_TIME_FORMAT'', in ''admin/lang/''.\\ | ||
+ | Default format is ''F jS, Y - g:i A'', see [[http://php.net/manual/en/function.date.php|PHP dates and times]]. | ||
+ | ===== shtDate ==== | ||
+ | **Signature** | ||
+ | <code>shtDate($date)</code> | ||
+ | |||
+ | **Description**\\ | ||
+ | Returns a date according to the format stored in the global ''$i18n'' key''DATE_FORMAT'', in ''admin/lang/''.\\ | ||
+ | Default format is ''M j, Y'', see [[http://php.net/manual/en/function.date.php|PHP dates and times]]. | ||
===== cl ===== | ===== cl ===== | ||
+ | **Signature** | ||
+ | <code>cl($data)</code> | ||
+ | |||
+ | **Description**\\ | ||
+ | Cleans ''$data'' consecutively with html_entity_decode, strip_tags and strip_slashes | ||
+ | |||
+ | **Parameters** | ||
+ | * ''$data'', the data string to clean | ||
===== tsl ===== | ===== tsl ===== | ||
**Signature** | **Signature** | ||
Line 25: | Line 45: | ||
**Parameters** | **Parameters** | ||
- | $''$path'', the path to add a trailing slash to. | + | * ''$path'', the path to add a trailing slash to. |
===== in_arrayi ===== | ===== in_arrayi ===== | ||
===== find_url ===== | ===== find_url ===== | ||
===== strippath ===== | ===== strippath ===== | ||
+ | **Signature** | ||
+ | <code>strippath($path_to_file)</code> | ||
+ | |||
+ | **Description**\\ | ||
+ | Returns the filename and extension from ''$path_to_file'', using ''pathinfo''. | ||
===== strip_quotes ===== | ===== strip_quotes ===== | ||
- | ===== encode_quotes ===== | + | **Signature** |
+ | <code>strip_quotes($text)</code> | ||
+ | |||
+ | **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** | ||
+ | <code>encode_quotes($text)</code> | ||
+ | |||
+ | **Description**\\ | ||
+ | Encodes quotes as HTML entities with ''htmlspecialchars'' and trims whitespace in ''$text''. | ||
+ | |||
+ | **Parameters** | ||
+ | * ''$text'', the text to encode quotes in. | ||
===== redirect ===== | ===== redirect ===== | ||
===== i18n ===== | ===== i18n ===== | ||
+ | **Signature** | ||
+ | <code>i18n($key[, $echo=true])</code> | ||
+ | |||
+ | **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 ===== | ===== i18n_r ===== | ||
+ | **Signature** | ||
+ | <code>i18n_r($key)</code> | ||
+ | |||
+ | **Description**\\ | ||
+ | Shorthand for ''i18n($key, true)''. Returns the translation for ''$key''. | ||
===== i18n_merge ===== | ===== i18n_merge ===== | ||
+ | **Signature** | ||
+ | <code>i18n_merge($plugin[, $language=null])</code> | ||
+ | |||
+ | **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 ===== | ===== i18n_merge_impl ===== | ||
+ | **Signature** | ||
+ | <code>i18n_merge_impl($plugin, $lang, &$globali18n)</code> | ||
+ | |||
+ | **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 ===== | ===== safe_slash_html ===== | ||
===== xmlFilterChars ===== | ===== xmlFilterChars ===== |