Framework
3.9
|
Library of commonly used functions. More...
Functions | |
checkRole ($role, $account=null) | |
Check whether the user has one of a specified set of roles. More... | |
hasRole ($role, $account=null) | |
Determine whether a user has a specific role explicitly set. More... | |
filterByRole ($items, $field) | |
Filter the given list, retaining only the objects that match the current user's role profile in the given parameter. More... | |
formatAddress () | |
Utility function to nicely format addresses, etc. More... | |
formatCurrency ($amount) | |
Utility function to format currency using $ and , and stuff. More... | |
formatDate ($date) | |
Utility function to format date (no time component). More... | |
formatMonthYear ($date) | |
formatDateShort ($date) | |
Utility function to format date in short form (MM/DD/YYYY), with no time component. More... | |
formatDateLong ($date) | |
formatTimestamp ($ts) | |
Utility function to format readable date from a timestamp (no time component). More... | |
formatTimestampShort ($ts) | |
getMonthDays ($m, $y) | |
Returns the number of days in the specified month. More... | |
getMonthWeekDays ($month, $year) | |
Get the number of week days in the specified month. More... | |
formatTime12 ($time) | |
Format a time in 12 hour clock, no seconds. More... | |
formatDateTime12 ($time) | |
Format a date and time in 12 hour clock, no seconds. More... | |
formatDateTime12Hr ($datetime) | |
formatStartDateToEndDate ($start, $end) | |
format_phone ($phone) | |
now () | |
Returns the current time and date in a database compatible format. More... | |
today () | |
Returns today as a string. More... | |
jsSafe ($str, $escapeEntities=false) | |
Utility function to escape a string correctly for use in a Javascript client-side call. More... | |
htmlsafe ($str) | |
cleanHTMLTags ($str) | |
HTMLToText ($html) | |
cleanQuotes ($str) | |
printMIMETypeList ($types) | |
Outputs the MIME type list based on an array of MIME types. More... | |
getDocType ($doc) | |
Returns a human-readable type name for a document, based on the file extension of the supplied file name. More... | |
getDocSize ($doc) | |
Returns the file size in Kb for a document. More... | |
getDocMimeType ($name) | |
getDocIcon ($doc) | |
checkNumeric ($p) | |
Security helper function. More... | |
checkNumericList ($p, $separator=",") | |
Security helper function. More... | |
checkIdentifier ($p) | |
Security helper function. More... | |
checkIdentifierList ($p) | |
Security helper function. More... | |
checkValidEmail ($e) | |
Security helper function. More... | |
checkValidDate ($d) | |
Security helper function. More... | |
checkValidDateTime ($d) | |
Security helper function. More... | |
checkPlainGUID ($guid) | |
Checkes whether the provided string is an undecorated GUID (i.e. More... | |
checkGUID ($guid) | |
Checks whether the provided string is in a valid form for a GUID. More... | |
color ($count) | |
Utility function to nicely format addresses, etc. More... | |
ellipsis ($txt, $max, $wholeWord=false) | |
Truncate the supplied text at the given maximum length. More... | |
rteSafe ($strText) | |
firstSentence ($text) | |
Returns the first sentence of the supplied text. More... | |
stripHTML ($text) | |
parseMultiParam ($collection, $param) | |
Parse out multiple values from the provided collection that have the same root name, and return the results in an array. More... | |
option ($value, $text, $sel="") | |
Write out an option tag, marking as selected if applicable. More... | |
str_option ($value, $text, $sel="") | |
Write out an option tag to a string, marking as selected if applicable. More... | |
registerRedirectLogCallback ($callback) | |
redirect ($page) | |
Simplified redirect. More... | |
getCleanQueryString () | |
Returns the query string for the current page, cleaned of any Fakoli-related navigation parameters. More... | |
trace ($msg, $lvl=3, $callStack=null) | |
Send output to the trace log. More... | |
getScaledSize ($size, $decimal_places=1) | |
Get human-readable file size from raw number of bytes. More... | |
roundFormat ($num, $abbrev=false) | |
getIcon ($file) | |
Retrieves a graphic icon appropriate for the given file. More... | |
includeRemote ($host, $file) | |
Includes the contents of the given remote file, with any relative src or href references converted to absolute references. More... | |
getRemote ($url, $username="", $password="") | |
Retrieve the contents of the remote file at the given URL. More... | |
jsonRequest ($url, $params=array()) | |
Make a simple GET request to a JSON-return RESTful API, passing the supplied parameters. More... | |
saveRemote ($url, $saveAs) | |
Retreive the contents of the remote file at the given URL and save it to the specified location on the local disk. More... | |
canonicalizeURL ($url) | |
Takes a URL and converts relative URLs to absolute URLs for the current site. More... | |
sanitizePath ($path) | |
Sanitize a file path, removing relative path sections and ensuring the correct directory separator is used throughout. More... | |
postRemote ($url, $data=null, $timeout=30) | |
Make a POST request to a remote URL, returning the results. More... | |
postRemoteXML ($url, $xml, $timeout=30) | |
getRemoteHeaders ($url) | |
Retrieve the HTTP headers for the specified remote URL (excluding the body). More... | |
wrapURL ($url, $width=120) | |
Break a URL at a given string position. More... | |
codify ($name) | |
Takes a text string and converts it into a code-compliant format, suitable for use as a variable name or identifier. More... | |
prettify ($name) | |
Takes a variable or field name and converts it into a human-readable version (assuming that the original contains human-readable words, of course). More... | |
pluralize ($text, $count=0) | |
Takes a singular string and makes it plural. More... | |
formatAsHTML ($text) | |
Takes a string and formats it for display as HTML, removing any HTML tags it contains, and converting carriage returns to br tags. More... | |
startsWith ($text, $start) | |
Tests whether a string starts with a given sub-string. More... | |
endsWith ($text, $end) | |
Tests whether a string ends with the given sub-string. More... | |
stripHTMLTags ($text) | |
Removes all HTML tags from the specified string. More... | |
ordinalSuffix ($n, $sup=false) | |
Adds the english ordinal suffix to a number. More... | |
makeURL ($uri) | |
Ensures that the http:// protocol specifier prefix is present in the supplied string. More... | |
formatCheckListItemsforView ($options, $items) | |
For dataitems that are rendered as CheckListFieldRenderer, this function converts the comma-delimited list of items for display. More... | |
baseURI ($uri=null) | |
Returns the base URI for the current script, with the query string removed. More... | |
appendToQueryString ($qs, $params) | |
Appends the specified parameters to the supplied query string. More... | |
registerURLRewriteParameters () | |
Register any URL rewrite parameters that should be excluded from query string reformatting. More... | |
getFullQueryString ($includePOST=true) | |
Generates a query string containing the values passed to this page. More... | |
toJSArray ($items, $field="") | |
prettyPrintJSON ($json) | |
Format the JSON in the supplied string to be more human-readable. More... | |
makeRandomString ($len) | |
Creates a randomized string of characters. More... | |
arrayFilterKey ( $input, $callback) | |
Filter an array based on applying the specified callback to the keys. More... | |
ajaxReturn ($msg=null) | |
Returns a string output and exits the script cleanly. More... | |
getMIMEType ($filename) | |
array_remove_keys ($array) | |
Remove specified keys from the given array. More... | |
xmlEntities ($string) | |
Function to provide html to XML entity renaming. More... | |
encode7bit ($text) | |
Encode text to 7-bit clean format, suitable for mail headers. More... | |
GUID () | |
Generates a version 4 GUID. More... | |
plainGUID () | |
Generates a version 4 GUID with no punctutation. More... | |
getBacktrace ($ignore=2) | |
Returns a formatted backtrace suitable for debugging output. More... | |
luhnTest ($num) | |
Performs a Luhn validity test for credit card or IMEI numbers. More... | |
countMatchingElements ($a, $b) | |
Determines the number of items that two comma-separated lists have in common. More... | |
printIncludes ($html=true, $return=false) | |
Outputs a list of all included files. More... | |
replaceValues ($substitutions, $target) | |
Given an array of pairs of old and new values, replace all instances of old values with new values in the target string. More... | |
fopen_utf8 ($filename) | |
Opens a text file, detects the encoding, inteprets the BOM if present, attaches a stream filter to convert to UTF-8. More... | |
fgetcsv_noBOM ($fp) | |
tempdir ($dir=null, $prefix='tmp_', $mode=0700, $maxAttempts=1000) | |
Creates a random unique temporary directory, with specified parameters, that does not already exist (like tempnam(), but for dirs). More... | |
Variables | |
$image_types = array( "image/jpeg", "image/gif", "image/x-png", "image/pjpeg" ) | |
MIME types allowable for image uploads. More... | |
$_redirectLogCallback = null | |
$traceLevels | |
$_icons | |
$__urlRewriteParams = array() | |
Library of commonly used functions.
ajaxReturn | ( | $msg = null | ) |
Returns a string output and exits the script cleanly.
We used to be able to use die(), but because of PHP 5's messed up session handling this throws an error if there is a custom session handler registered.
string | $msg |
Definition at line 1783 of file functions.inc.
appendToQueryString | ( | $qs, | |
$params | |||
) |
Appends the specified parameters to the supplied query string.
string | $qs | the query string |
string | $params | parameters to append in query string format |
Definition at line 1594 of file functions.inc.
array_remove_keys | ( | $array | ) |
Remove specified keys from the given array.
array | $array | the array to strip |
Definition at line 1885 of file functions.inc.
arrayFilterKey | ( | $input, | |
$callback | |||
) |
Filter an array based on applying the specified callback to the keys.
array | $input | the array to be filtered |
callback | $callback | a callback function or method |
Definition at line 1752 of file functions.inc.
baseURI | ( | $uri = null | ) |
Returns the base URI for the current script, with the query string removed.
string
$uri | (optional) the URI to truncate - if not specified, the URI for the currently executing script is used. |
Definition at line 1582 of file functions.inc.
canonicalizeURL | ( | $url | ) |
Takes a URL and converts relative URLs to absolute URLs for the current site.
string | $url | the URL to convert |
Definition at line 1278 of file functions.inc.
checkGUID | ( | $guid | ) |
Checks whether the provided string is in a valid form for a GUID.
string | $guid | the GUID candidate |
Definition at line 744 of file functions.inc.
checkIdentifier | ( | $p | ) |
Security helper function.
Check that the given parameter is a valid identifier (alphanumeric, _ and digits only with no spaces). Empty string is valid
Definition at line 666 of file functions.inc.
checkIdentifierList | ( | $p | ) |
Security helper function.
Check that the given parameter is a comma-separated list of valid identifiers (alphanumeric, _ and digits only with no spaces). Empty string is valid
Definition at line 675 of file functions.inc.
checkNumeric | ( | $p | ) |
Security helper function.
Check that the given parameter is a numeric value.
string | $p | the parameter to check |
Definition at line 630 of file functions.inc.
checkNumericList | ( | $p, | |
$separator = "," |
|||
) |
Security helper function.
Check that the given parameter contains a list of numeric values with the given separator.
string | $p | the parameter to check |
string | $separator | the list separator (default to comma) |
Definition at line 649 of file functions.inc.
checkPlainGUID | ( | $guid | ) |
Checkes whether the provided string is an undecorated GUID (i.e.
a string of 32 hex characters)
string | $guid | the GUID candidate |
Definition at line 729 of file functions.inc.
checkRole | ( | $role, | |
$account = null |
|||
) |
Check whether the user has one of a specified set of roles.
string | $role | the role(s) to check against, as a comma-delimited list |
object | $account | (optional) the account object to check (must have a 'role' property). If not provided, the default user account is used (assumed to be in the global $user variable). |
Definition at line 52 of file functions.inc.
checkValidDate | ( | $d | ) |
Security helper function.
Check that the given parameter is a valid date.
string | $d | the date |
Definition at line 695 of file functions.inc.
checkValidDateTime | ( | $d | ) |
Security helper function.
Check that the given parameter is a valid date time.
string | $d | the date time |
Definition at line 712 of file functions.inc.
checkValidEmail | ( | $e | ) |
Security helper function.
Check that the given parameter is a valid email. Empty string is valid
string | $e | the parameter to check |
Definition at line 685 of file functions.inc.
cleanHTMLTags | ( | $str | ) |
Definition at line 456 of file functions.inc.
cleanQuotes | ( | $str | ) |
Definition at line 470 of file functions.inc.
codify | ( | $name | ) |
Takes a text string and converts it into a code-compliant format, suitable for use as a variable name or identifier.
Principally this involved replacing all whitespace and sequences of non-word characters (such as punctuation) with underscores.
$name | the name to codify |
Definition at line 1399 of file functions.inc.
color | ( | $count | ) |
Utility function to nicely format addresses, etc.
(skips blank entries, places all other entries on separate lines)
integer | $count | the index of the current line |
Deprecated
Definition at line 762 of file functions.inc.
countMatchingElements | ( | $a, | |
$b | |||
) |
Determines the number of items that two comma-separated lists have in common.
Useful for determining matches between checklist fields or roles.
string | $a | the first string to test |
string | $b | the second string to test |
Definition at line 2011 of file functions.inc.
ellipsis | ( | $txt, | |
$max, | |||
$wholeWord = false |
|||
) |
Truncate the supplied text at the given maximum length.
If the string is truncated then an ellipsis is added.
string | $txt | the text to truncate |
integer | $max | the maximum allowed length |
boolean | $wholeWord | true to truncate to whole words only |
Definition at line 779 of file functions.inc.
encode7bit | ( | $text | ) |
Encode text to 7-bit clean format, suitable for mail headers.
string | $text | the possibly unclean text |
Definition at line 1925 of file functions.inc.
endsWith | ( | $text, | |
$end | |||
) |
Tests whether a string ends with the given sub-string.
$text | the string to test |
$end | the sub-string to look for at the end |
Definition at line 1481 of file functions.inc.
fgetcsv_noBOM | ( | $fp | ) |
Definition at line 2106 of file functions.inc.
filterByRole | ( | $items, | |
$field | |||
) |
Filter the given list, retaining only the objects that match the current user's role profile in the given parameter.
string | $items | the array of items to be filtered |
string | $field | the name of the field defining the role restriction |
Definition at line 101 of file functions.inc.
firstSentence | ( | $text | ) |
Returns the first sentence of the supplied text.
HTML formatting is removed. The first sentence is defined as the text up to the first occurrence of the substring ". ". If this substring does not appear, the whole (HTML-stripped) text is returned.
string | $text | the text of which the first sentence is to be returned |
Definition at line 839 of file functions.inc.
fopen_utf8 | ( | $filename | ) |
Opens a text file, detects the encoding, inteprets the BOM if present, attaches a stream filter to convert to UTF-8.
Thanks to the author of this article: http://www.practicalweb.co.uk/blog/2008/05/18/reading-a-unicode-excel-file-in-php/
string | $filename | the file to be opened for reading |
Definition at line 2082 of file functions.inc.
format_phone | ( | $phone | ) |
Definition at line 398 of file functions.inc.
formatAddress | ( | ) |
Utility function to nicely format addresses, etc.
(skips blank entries, places all other entries on separate lines)
Deprecated
Definition at line 126 of file functions.inc.
formatAsHTML | ( | $text | ) |
Takes a string and formats it for display as HTML, removing any HTML tags it contains, and converting carriage returns to br tags.
$text | the text to format |
Definition at line 1456 of file functions.inc.
formatCheckListItemsforView | ( | $options, | |
$items | |||
) |
For dataitems that are rendered as CheckListFieldRenderer, this function converts the comma-delimited list of items for display.
To do: add handling of grouped checkboxes and provide parameter for delimiter between items
Deprecated
Definition at line 1555 of file functions.inc.
formatCurrency | ( | $amount | ) |
Utility function to format currency using $ and , and stuff.
Deprecated
Definition at line 142 of file functions.inc.
formatDate | ( | $date | ) |
Utility function to format date (no time component).
string | $date | the date to format |
Deprecated
Definition at line 154 of file functions.inc.
formatDateLong | ( | $date | ) |
$date | Deprecated |
Definition at line 203 of file functions.inc.
formatDateShort | ( | $date | ) |
Utility function to format date in short form (MM/DD/YYYY), with no time component.
Deprecated
Definition at line 183 of file functions.inc.
formatDateTime12 | ( | $time | ) |
Format a date and time in 12 hour clock, no seconds.
Deprecated
Definition at line 321 of file functions.inc.
formatDateTime12Hr | ( | $datetime | ) |
Definition at line 334 of file functions.inc.
formatMonthYear | ( | $date | ) |
$date | Deprecated |
Definition at line 169 of file functions.inc.
formatStartDateToEndDate | ( | $start, | |
$end | |||
) |
Definition at line 361 of file functions.inc.
formatTime12 | ( | $time | ) |
Format a time in 12 hour clock, no seconds.
Deprecated
Definition at line 311 of file functions.inc.
formatTimestamp | ( | $ts | ) |
Utility function to format readable date from a timestamp (no time component).
Timestamp is a string in the format 'YYYYMMDDHHIISS'.
string | $ts | the timestamp to format. |
Deprecated
Definition at line 223 of file functions.inc.
formatTimestampShort | ( | $ts | ) |
Definition at line 247 of file functions.inc.
getBacktrace | ( | $ignore = 2 | ) |
Returns a formatted backtrace suitable for debugging output.
Definition at line 1962 of file functions.inc.
getCleanQueryString | ( | ) |
Returns the query string for the current page, cleaned of any Fakoli-related navigation parameters.
Definition at line 986 of file functions.inc.
getDocIcon | ( | $doc | ) |
getDocMimeType | ( | $name | ) |
getDocSize | ( | $doc | ) |
Returns the file size in Kb for a document.
string | $doc | the (local) URL of the document |
Deprecated
Definition at line 554 of file functions.inc.
getDocType | ( | $doc | ) |
Returns a human-readable type name for a document, based on the file extension of the supplied file name.
string | $doc | the filename of the document |
Deprecated
Definition at line 531 of file functions.inc.
getFullQueryString | ( | $includePOST = true | ) |
Generates a query string containing the values passed to this page.
The default behavior is to include parameters passed both as GET and POST parameters. To retrieve only the GET parameters, pass false.
boolean | $includePOST | true (default) to include POST parameters, false for only GET parameters |
Definition at line 1634 of file functions.inc.
getIcon | ( | $file | ) |
Retrieves a graphic icon appropriate for the given file.
$file | the name of the file |
Definition at line 1149 of file functions.inc.
getMIMEType | ( | $filename | ) |
getMonthDays | ( | $m, | |
$y | |||
) |
Returns the number of days in the specified month.
number | $m | the month number |
number | $y | the year |
Deprecated
Definition at line 272 of file functions.inc.
getMonthWeekDays | ( | $month, | |
$year | |||
) |
Get the number of week days in the specified month.
number | $m | the month number |
number | $y | the year |
Deprecated
Definition at line 289 of file functions.inc.
getRemote | ( | $url, | |
$username = "" , |
|||
$password = "" |
|||
) |
Retrieve the contents of the remote file at the given URL.
string | $url | the URL to retrieve |
string | $username | (optional) username for basic authentication |
string | $password | (optional) password for basic authentication |
Definition at line 1192 of file functions.inc.
getRemoteHeaders | ( | $url | ) |
Retrieve the HTTP headers for the specified remote URL (excluding the body).
string | $url | the URL to retrieve |
Definition at line 1359 of file functions.inc.
getScaledSize | ( | $size, | |
$decimal_places = 1 |
|||
) |
Get human-readable file size from raw number of bytes.
$size | the size of the file in bytes |
$decimal_places | the number of decimal places in the output (default is 1) |
Definition at line 1088 of file functions.inc.
GUID | ( | ) |
Generates a version 4 GUID.
Where random_int is available (PHP > 7.0) it is used to ensure cryptographically secure random numbers.
Definition at line 1935 of file functions.inc.
hasRole | ( | $role, | |
$account = null |
|||
) |
Determine whether a user has a specific role explicitly set.
Unlike checkRole() this does not always return true if a user is super or admin.
string | $role | |
object | $account |
Definition at line 82 of file functions.inc.
htmlsafe | ( | $str | ) |
Definition at line 451 of file functions.inc.
HTMLToText | ( | $html | ) |
Definition at line 461 of file functions.inc.
includeRemote | ( | $host, | |
$file | |||
) |
Includes the contents of the given remote file, with any relative src or href references converted to absolute references.
The included file is echoed directly to the output stream.
$host | the host to retrieve the file from |
$file | the URI of the file on the host |
Definition at line 1173 of file functions.inc.
jsonRequest | ( | $url, | |
$params = array() |
|||
) |
Make a simple GET request to a JSON-return RESTful API, passing the supplied parameters.
string | $url | the target URL for the API |
array | $params | an array of parameters to pass, as key-value pairs |
Definition at line 1221 of file functions.inc.
jsSafe | ( | $str, | |
$escapeEntities = false |
|||
) |
Utility function to escape a string correctly for use in a Javascript client-side call.
string | $str | the string to make safe. |
Definition at line 434 of file functions.inc.
luhnTest | ( | $num | ) |
Performs a Luhn validity test for credit card or IMEI numbers.
string | $num | credit card or IMEI number |
Definition at line 1985 of file functions.inc.
makeRandomString | ( | $len | ) |
Creates a randomized string of characters.
This is not cryptographically secure and should not be used for cryptographic operations.
int | $len | the length of the string to generate |
Definition at line 1735 of file functions.inc.
makeURL | ( | $uri | ) |
Ensures that the http:// protocol specifier prefix is present in the supplied string.
string | $uri | the string to process |
Definition at line 1539 of file functions.inc.
now | ( | ) |
Returns the current time and date in a database compatible format.
Definition at line 416 of file functions.inc.
option | ( | $value, | |
$text, | |||
$sel = "" |
|||
) |
Write out an option tag, marking as selected if applicable.
mixed | $value | the value of the option |
string | $text | the text for the option |
mixed | $sel | a value to compare to the $value field, to determine whether the option should be selected. |
Definition at line 888 of file functions.inc.
ordinalSuffix | ( | $n, | |
$sup = false |
|||
) |
Adds the english ordinal suffix to a number.
If the value passed is not purely numeric, it will be returned unchanged.
$n | the value for the ordinal suffix |
$sup | true to add HTML superscript tag, false for plain text |
Definition at line 1503 of file functions.inc.
parseMultiParam | ( | $collection, | |
$param | |||
) |
Parse out multiple values from the provided collection that have the same root name, and return the results in an array.
array | $collection | the parameter collection (usually $_POST or $_GET) |
string | $param | the root name for the params to search for |
Definition at line 865 of file functions.inc.
plainGUID | ( | ) |
Generates a version 4 GUID with no punctutation.
Definition at line 1954 of file functions.inc.
pluralize | ( | $text, | |
$count = 0 |
|||
) |
Takes a singular string and makes it plural.
$text | the string to make plural |
$count | integer (optional) the number of items, to determine whether to pluralize or not |
Definition at line 1428 of file functions.inc.
postRemote | ( | $url, | |
$data = null , |
|||
$timeout = 30 |
|||
) |
Make a POST request to a remote URL, returning the results.
$url | the URL of the page to submit the POST request to |
$data | the POST parameters, passed as an array of key => value pairs |
$timeout | the amount of time to wait for the POST to complete |
Definition at line 1325 of file functions.inc.
postRemoteXML | ( | $url, | |
$xml, | |||
$timeout = 30 |
|||
) |
Definition at line 1339 of file functions.inc.
prettify | ( | $name | ) |
Takes a variable or field name and converts it into a human-readable version (assuming that the original contains human-readable words, of course).
It handles CamelCase and underscores. Individual words in the output are capitalized.
$name | the string to prettify |
Definition at line 1413 of file functions.inc.
prettyPrintJSON | ( | $json | ) |
Format the JSON in the supplied string to be more human-readable.
string | $json | the JSON to pretty-print |
Definition at line 1723 of file functions.inc.
printIncludes | ( | $html = true , |
|
$return = false |
|||
) |
Outputs a list of all included files.
This is provided as a tool for troubleshooting.
boolean | $html | whether to include HTML formatting in the output (default true) |
boolean | $return | set to true to return the list as the return value, false to print to the output buffer |
Definition at line 2023 of file functions.inc.
printMIMETypeList | ( | $types | ) |
Outputs the MIME type list based on an array of MIME types.
Use this function to generate the contents of ACCEPT= attributes for <INPUT TYPE="file" ...> tags.
Deprecated
Definition at line 511 of file functions.inc.
redirect | ( | $page | ) |
Simplified redirect.
string | $page | the page to redirect to |
Definition at line 930 of file functions.inc.
registerRedirectLogCallback | ( | $callback | ) |
Definition at line 920 of file functions.inc.
registerURLRewriteParameters | ( | ) |
Register any URL rewrite parameters that should be excluded from query string reformatting.
Definition at line 1616 of file functions.inc.
replaceValues | ( | $substitutions, | |
$target | |||
) |
Given an array of pairs of old and new values, replace all instances of old values with new values in the target string.
array | $substitutions | array of old and new values |
string | $target | the target string to update |
Definition at line 2060 of file functions.inc.
roundFormat | ( | $num, | |
$abbrev = false |
|||
) |
Definition at line 1113 of file functions.inc.
rteSafe | ( | $strText | ) |
sanitizePath | ( | $path | ) |
Sanitize a file path, removing relative path sections and ensuring the correct directory separator is used throughout.
string | $path | potentially dirty path |
Definition at line 1309 of file functions.inc.
saveRemote | ( | $url, | |
$saveAs | |||
) |
Retreive the contents of the remote file at the given URL and save it to the specified location on the local disk.
$url | the URL to retrieve |
$saveAs | the path and file name where the downloaded file should be stored. |
Definition at line 1246 of file functions.inc.
startsWith | ( | $text, | |
$start | |||
) |
Tests whether a string starts with a given sub-string.
$text | the string to test |
$start | the sub-string to look for at the start |
Definition at line 1470 of file functions.inc.
str_option | ( | $value, | |
$text, | |||
$sel = "" |
|||
) |
Write out an option tag to a string, marking as selected if applicable.
mixed | $value | the value of the option |
string | $text | the text for the option |
mixed | $sel | a value to compare to the $value field, to determine whether the option should be selected. |
Definition at line 906 of file functions.inc.
stripHTML | ( | $text | ) |
Definition at line 847 of file functions.inc.
stripHTMLTags | ( | $text | ) |
Removes all HTML tags from the specified string.
$text | the string from which tags are to be removed |
Definition at line 1491 of file functions.inc.
tempdir | ( | $dir = null , |
|
$prefix = 'tmp_' , |
|||
$mode = 0700 , |
|||
$maxAttempts = 1000 |
|||
) |
Creates a random unique temporary directory, with specified parameters, that does not already exist (like tempnam(), but for dirs).
Created dir will begin with the specified prefix, followed by random numbers.
Definition at line 2139 of file functions.inc.
today | ( | ) |
toJSArray | ( | $items, | |
$field = "" |
|||
) |
Definition at line 1694 of file functions.inc.
trace | ( | $msg, | |
$lvl = 3 , |
|||
$callStack = null |
|||
) |
Send output to the trace log.
string | $msg | the message to output |
int | $lvl | the severity level (0-5) of this message |
Definition at line 1010 of file functions.inc.
wrapURL | ( | $url, | |
$width = 120 |
|||
) |
Break a URL at a given string position.
This can help prevent long URLs from messing up your page layout.
$url | the URL to break |
$width | the maximum line length (in characters) |
Definition at line 1381 of file functions.inc.
xmlEntities | ( | $string | ) |
Function to provide html to XML entity renaming.
Provides fallback for PHP versions earlier than 5.4 that do not have the ENT_XML1 format available for the htmlentities() call.
string | $string | the string to convert |
Definition at line 1903 of file functions.inc.
$__urlRewriteParams = array() |
Definition at line 1610 of file functions.inc.
$_icons |
Definition at line 1138 of file functions.inc.
$_redirectLogCallback = null |
Definition at line 918 of file functions.inc.
$image_types = array( "image/jpeg", "image/gif", "image/x-png", "image/pjpeg" ) |
MIME types allowable for image uploads.
Definition at line 118 of file functions.inc.
$traceLevels |
Definition at line 1000 of file functions.inc.