Public Member Functions | |
| trimExplode ($delim, $string, $onlyNonEmptyValues=0) | |
| dirname ($path) | |
| revExplode ($delim, $string, $count=0) | |
| getIndpEnv ($getEnvName) | |
| _GP ($var) | |
| _GET ($var=NULL) | |
| _POST ($var=NULL) | |
| _GETset ($inputGet, $key='') | |
| GPvar ($var, $strip=0) | |
| GParrayMerged ($var) | |
| gif_compress ($theFile, $type) | |
| png_to_gif_by_imagemagick ($theFile) | |
| read_png_gif ($theFile, $output_png=0) | |
| fixed_lgd ($string, $origChars, $preStr='...') | |
| fixed_lgd_pre ($string, $chars) | |
| fixed_lgd_cs ($string, $chars) | |
| breakTextForEmail ($str, $implChar="\n", $charWidth=76) | |
| breakLinesForEmail ($str, $implChar="\n", $charWidth=76) | |
| cmpIP ($baseIP, $list) | |
| cmpIPv4 ($baseIP, $list) | |
| cmpIPv6 ($baseIP, $list) | |
| IPv6Hex2Bin ($hex) | |
| normalizeIPv6 ($address) | |
| validIPv6 ($ip) | |
| cmpFQDN ($baseIP, $list) | |
| inList ($list, $item) | |
| rmFromList ($element, $list) | |
| expandList ($list) | |
| intInRange ($theInt, $min, $max=2000000000, $zeroValue=0) | |
| intval_positive ($theInt) | |
| int_from_ver ($verNumberStr) | |
| compat_version ($verNumberStr) | |
| md5int ($str) | |
| shortMD5 ($input, $len=10) | |
| uniqueList ($in_list, $secondParameter=NULL) | |
| split_fileref ($fileref) | |
| dirname ($path) | |
| modifyHTMLColor ($color, $R, $G, $B) | |
| modifyHTMLColorAll ($color, $all) | |
| rm_endcomma ($string) | |
| danish_strtoupper ($string) | |
| convUmlauts ($str) | |
| testInt ($var) | |
| isFirstPartOfStr ($str, $partStr) | |
| formatSize ($sizeInBytes, $labels='') | |
| convertMicrotime ($microtime) | |
| splitCalc ($string, $operators) | |
| calcPriority ($string) | |
| calcParenthesis ($string) | |
| htmlspecialchars_decode ($value) | |
| deHSCentities ($str) | |
| slashJS ($string, $extended=0, $char="'") | |
| rawUrlEncodeJS ($str) | |
| rawUrlEncodeFP ($str) | |
| validEmail ($email) | |
| formatForTextarea ($content) | |
| inArray ($in_array, $item) | |
| intExplode ($delim, $string) | |
| revExplode ($delim, $string, $count=0) | |
| trimExplode ($delim, $string, $onlyNonEmptyValues=0) | |
| uniqueArray ($valueArray) | |
| removeArrayEntryByValue ($array, $cmpValue) | |
| implodeArrayForUrl ($name, $theArray, $str='', $skipBlank=0, $rawurlencodeParamName=0) | |
| explodeUrl2Array ($string, $multidim=FALSE) | |
| compileSelectedGetVarsFromArray ($varList, $getArray, $GPvarAlt=1) | |
| addSlashesOnArray (&$theArray) | |
| stripSlashesOnArray (&$theArray) | |
| slashArray ($arr, $cmd) | |
| array_merge_recursive_overrule ($arr0, $arr1, $notAddKeys=0, $includeEmtpyValues=true) | |
| array_merge ($arr1, $arr2) | |
| csvValues ($row, $delim=',', $quote='"') | |
| removeDotsFromTS ($ts) | |
| get_tag_attributes ($tag) | |
| split_tag_attributes ($tag) | |
| implodeAttributes ($arr, $xhtmlSafe=FALSE, $dontOmitBlankAttribs=FALSE) | |
| implodeParams ($arr, $xhtmlSafe=FALSE, $dontOmitBlankAttribs=FALSE) | |
| wrapJS ($string, $linebreak=TRUE) | |
| xml2tree ($string, $depth=999) | |
| array2xml_cs ($array, $docTag='phparray', $options=array(), $charset='') | |
| array2xml ($array, $NSprefix='', $level=0, $docTag='phparray', $spaceInd=0, $options=array(), $stackData=array()) | |
| xml2array ($string, $NSprefix='', $reportDocTag=FALSE) | |
| xmlRecompileFromStructValArray ($vals) | |
| xmlGetHeaderAttribs ($xmlData) | |
| getURL ($url, $includeHeader=0, $requestHeaders=false) | |
| writeFile ($file, $content) | |
| fixPermissions ($file) | |
| writeFileToTypo3tempDir ($filepath, $content) | |
| mkdir ($theNewFolder) | |
| mkdir_deep ($destination, $deepDir) | |
| get_dirs ($path) | |
| getFilesInDir ($path, $extensionList='', $prependPath=0, $order='', $excludePattern='') | |
| getAllFilesAndFoldersInPath ($fileArr, $path, $extList='', $regDirs=0, $recursivityLevels=99, $excludePattern='') | |
| removePrefixPathFromList ($fileArr, $prefixToRemove) | |
| fixWindowsFilePath ($theFile) | |
| resolveBackPath ($pathStr) | |
| locationHeaderUrl ($path) | |
| debug_ordvalue ($string, $characters=100) | |
| view_array ($array_in) | |
| print_array ($array_in) | |
| debug ($var="", $brOrHeader=0) | |
| debug_trail () | |
| debugRows ($rows, $header='') | |
| getThisUrl () | |
| linkThisScript ($getParams=array()) | |
| linkThisUrl ($url, $getParams=array()) | |
| getIndpEnv ($getEnvName) | |
| milliseconds () | |
| clientInfo ($useragent='') | |
| getHostname ($requestHost=TRUE) | |
| getFileAbsFileName ($filename, $onlyRelative=1, $relToTYPO3_mainDir=0) | |
| validPathStr ($theFile) | |
| isAbsPath ($path) | |
| isAllowedAbsPath ($path) | |
| verifyFilenameAgainstDenyPattern ($filename) | |
| upload_copy_move ($source, $destination) | |
| upload_to_tempfile ($uploadedFileName) | |
| unlink_tempfile ($uploadedTempFileName) | |
| tempnam ($filePrefix) | |
| stdAuthCode ($uid_or_record, $fields='', $codeLength=8) | |
| cHashParams ($addQueryParams) | |
| hideIfNotTranslated ($l18n_cfg_fieldValue) | |
| readLLfile ($fileRef, $langKey) | |
| readLLXMLfile ($fileRef, $langKey) | |
| llXmlAutoFileName ($fileRef, $language) | |
| loadTCA ($table) | |
| resolveSheetDefInDS ($dataStructArray, $sheet='sDEF') | |
| resolveAllSheetsInDS ($dataStructArray) | |
| callUserFunction ($funcName, &$params, &$ref, $checkPrefix='user_', $silent=0) | |
| & | getUserObj ($classRef, $checkPrefix='user_', $silent=0) |
| & | makeInstance ($className) |
| makeInstanceClassName ($className) | |
| & | makeInstanceService ($serviceType, $serviceSubType='', $excludeServiceKeys=array()) |
| requireOnce ($requireFile) | |
| plainMailEncoded ($email, $subject, $message, $headers='', $encoding='quoted-printable', $charset='', $dontEncodeHeader=false) | |
| quoted_printable ($string, $maxlen=76) | |
| encodeHeader ($line, $enc='quoted-printable', $charset='ISO-8859-1') | |
| substUrlsInPlainText ($message, $urlmode='76', $index_script_url='') | |
| makeRedirectUrl ($inUrl, $l=0, $index_script_url='') | |
| freetypeDpiComp ($font_size) | |
| initSysLog () | |
| sysLog ($msg, $extKey, $severity=0) | |
| devLog ($msg, $extKey, $severity=0, $dataVar=FALSE) | |
| arrayToLogString ($arr, $valueList=array(), $valueLength=20) | |
| imageMagickCommand ($command, $parameters, $path='') | |
| unQuoteFilenames ($parameters, $unQuote=FALSE) | |
| quoteJSvalue ($value, $inScriptTags=false) | |
Definition at line 10 of file incfile.php.
| t3lib_div::getIndpEnv | ( | $ | getEnvName | ) |
Abstraction method which returns System Environment Variables regardless of server OS, CGI/MODULE version etc. Basically this is SERVER variables for most of them. This should be used instead of getEnv() and HTTP_SERVER_VARS/ENV_VARS to get reliable values for all situations.
Usage: 226
| string | Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY |
Definition at line 46 of file incfile.php.
| t3lib_div::_GP | ( | $ | var | ) |
Returns the 'GLOBAL' value of incoming data from POST or GET, with priority to POST (that is equalent to 'GP' order) Strips slashes from all output, both strings and arrays. This function substitutes t3lib_div::GPvar() To enhancement security in your scripts, please consider using t3lib_div::_GET or t3lib_div::_POST if you already know by which method your data is arriving to the scripts! Usage: 537
| string | GET/POST var to return |
Definition at line 262 of file class.t3lib_div.php.
| t3lib_div::_GET | ( | $ | var = NULL |
) |
Returns the global GET array (or value from) normalized to contain un-escaped values. ALWAYS use this API function to acquire the GET variables! Usage: 27
| string | Optional pointer to value in GET array (basically name of GET var) |
Definition at line 280 of file class.t3lib_div.php.
| t3lib_div::_POST | ( | $ | var = NULL |
) |
Returns the global POST array (or value from) normalized to contain un-escaped values. ALWAYS use this API function to acquire the POST variables! Usage: 41
| string | Optional pointer to value in POST array (basically name of POST var) |
Definition at line 297 of file class.t3lib_div.php.
| t3lib_div::_GETset | ( | $ | inputGet, | |
| $ | key = '' | |||
| ) |
Writes input value to $_GET Usage: 2
| array | Array to write to $_GET. Values should NOT be escaped at input time (but will be escaped before writing according to TYPO3 standards). | |
| string | Alternative key; If set, this will not set the WHOLE GET array, but only the key in it specified by this value! |
Definition at line 313 of file class.t3lib_div.php.
| t3lib_div::GPvar | ( | $ | var, | |
| $ | strip = 0 | |||
| ) |
GET/POST variable Returns the 'GLOBAL' value of incoming data from POST or GET, with priority to POST (that is equalent to 'GP' order) Strips slashes of string-outputs, but not arrays UNLESS $strip is set. If $strip is set all output will have escaped characters unescaped. Usage: 2
| string | GET/POST var to return | |
| boolean | If set, values are stripped of return values that are *arrays!* - string/integer values returned are always strip-slashed() |
Definition at line 336 of file class.t3lib_div.php.
| t3lib_div::GParrayMerged | ( | $ | var | ) |
Returns the GET/POST global arrays merged with POST taking precedence. Usage: 1
| string | Key (variable name) from GET or POST vars |
Definition at line 353 of file class.t3lib_div.php.
| t3lib_div::gif_compress | ( | $ | theFile, | |
| $ | type | |||
| ) |
Compressing a GIF file if not already LZW compressed This function is a workaround for the fact that ImageMagick and/or GD does not compress GIF-files to their minimun size (that is RLE or no compression used)
The function takes a file-reference, $theFile, and saves it again through GD or ImageMagick in order to compress the file GIF: If $type is not set, the compression is done with ImageMagick (provided that $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] is pointing to the path of a lzw-enabled version of 'convert') else with GD (should be RLE-enabled!) If $type is set to either 'IM' or 'GD' the compression is done with ImageMagick and GD respectively PNG: No changes.
$theFile is expected to be a valid GIF-file! The function returns a code for the operation. Usage: 9
| string | Filepath | |
| string | See description of function |
Definition at line 397 of file class.t3lib_div.php.
| t3lib_div::png_to_gif_by_imagemagick | ( | $ | theFile | ) |
Converts a png file to gif This converts a png file to gif IF the FLAG $GLOBALS['TYPO3_CONF_VARS']['FE']['png_to_gif'] is set true. Usage: 5
| string | $theFile the filename with path |
Definition at line 425 of file class.t3lib_div.php.
| t3lib_div::read_png_gif | ( | $ | theFile, | |
| $ | output_png = 0 | |||
| ) |
Returns filename of the png/gif version of the input file (which can be png or gif). If input file type does not match the wanted output type a conversion is made and temp-filename returned. Usage: 2
| string | Filepath of image file | |
| boolean | If set, then input file is converted to PNG, otherwise to GIF |
Definition at line 450 of file class.t3lib_div.php.
| t3lib_div::fixed_lgd | ( | $ | string, | |
| $ | origChars, | |||
| $ | preStr = '...' | |||
| ) |
Truncate string Returns a new string of max. $chars length. If the string is longer, it will be truncated and appended with '...'. Usage: 39
| string | string to truncate | |
| integer | must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end. | |
| string | String to append to the output if it is truncated, default is '...' |
Definition at line 499 of file class.t3lib_div.php.
| t3lib_div::fixed_lgd_pre | ( | $ | string, | |
| $ | chars | |||
| ) |
Truncate string Returns a new string of max. $chars length. If the string is longer, it will be truncated and prepended with '...'. This works like fixed_lgd, but is truncated in the start of the string instead of the end Usage: 6
| string | string to truncate | |
| integer | must be an integer of at least 4 |
Definition at line 524 of file class.t3lib_div.php.
| t3lib_div::fixed_lgd_cs | ( | $ | string, | |
| $ | chars | |||
| ) |
Truncates a string with appended/prepended "..." and takes backend character set into consideration Use only from backend! Usage: 75
| string | string to truncate | |
| integer | must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end. |
Definition at line 538 of file class.t3lib_div.php.
| t3lib_div::breakTextForEmail | ( | $ | str, | |
| $ | implChar = "\n", |
|||
| $ | charWidth = 76 | |||
| ) |
Breaks up the text for emails Usage: 1
| string | The string to break up | |
| string | The string to implode the broken lines with (default/typically ) | |
| integer | The line length |
Definition at line 556 of file class.t3lib_div.php.
| t3lib_div::breakLinesForEmail | ( | $ | str, | |
| $ | implChar = "\n", |
|||
| $ | charWidth = 76 | |||
| ) |
Breaks up a single line of text for emails Usage: 5
| string | The string to break up | |
| string | The string to implode the broken lines with (default/typically ) | |
| integer | The line length |
Definition at line 575 of file class.t3lib_div.php.
| t3lib_div::cmpIP | ( | $ | baseIP, | |
| $ | list | |||
| ) |
Match IP number with list of numbers with wildcard Dispatcher method for switching into specialised IPv4 and IPv6 methods. Usage: 10
| string | $baseIP is the current remote IP address for instance, typ. REMOTE_ADDR | |
| string | $list is a comma-list of IP-addresses to match with. *-wildcard allowed instead of number, plus leaving out parts in the IP number is accepted as wildcard (eg. 192.168.*.* equals 192.168). If list is "*" no check is done and the function returns TRUE immediately. |
Definition at line 611 of file class.t3lib_div.php.
| t3lib_div::cmpIPv4 | ( | $ | baseIP, | |
| $ | list | |||
| ) |
Match IPv4 number with list of numbers with wildcard
| string | $baseIP is the current remote IP address for instance, typ. REMOTE_ADDR | |
| string | $list is a comma-list of IP-addresses to match with. *-wildcard allowed instead of number, plus leaving out parts in the IP number is accepted as wildcard (eg. 192.168.*.* equals 192.168) |
Definition at line 627 of file class.t3lib_div.php.
| t3lib_div::cmpIPv6 | ( | $ | baseIP, | |
| $ | list | |||
| ) |
Match IPv6 address with a list of IPv6 prefixes
| string | $baseIP is the current remote IP address for instance | |
| string | $list is a comma-list of IPv6 prefixes, could also contain IPv4 addresses |
Definition at line 669 of file class.t3lib_div.php.
| t3lib_div::IPv6Hex2Bin | ( | $ | hex | ) |
[Describe function...]
| [type] | $hex: ... |
Definition at line 712 of file class.t3lib_div.php.
| t3lib_div::normalizeIPv6 | ( | $ | address | ) |
Normalize an IPv6 address to full length
| string | Given IPv6 address |
Definition at line 727 of file class.t3lib_div.php.
| t3lib_div::validIPv6 | ( | $ | ip | ) |
Validate a given IP address to the IPv6 address format.
Example for possible format: 43FBBB3F:A0A0:0 | ::1
| string | IP address to be tested |
Definition at line 783 of file class.t3lib_div.php.
| t3lib_div::cmpFQDN | ( | $ | baseIP, | |
| $ | list | |||
| ) |
Match fully qualified domain name with list of strings with wildcard
| string | The current remote IP address for instance, typ. REMOTE_ADDR | |
| string | A comma-list of domain names to match with. *-wildcard allowed but cannot be part of a string, so it must match the full host name (eg. myhost.*.com => correct, myhost.*domain.com => wrong) |
Definition at line 806 of file class.t3lib_div.php.
| t3lib_div::inList | ( | $ | list, | |
| $ | item | |||
| ) |
Check for item in list Check if an item exists in a comma-separated list of items. Usage: 163
| string | comma-separated list of items (string) | |
| string | item to check for |
Definition at line 836 of file class.t3lib_div.php.
| t3lib_div::rmFromList | ( | $ | element, | |
| $ | list | |||
| ) |
Removes an item from a comma-separated list of items. Usage: 1
| string | element to remove | |
| string | comma-separated list of items (string) |
Definition at line 848 of file class.t3lib_div.php.
| t3lib_div::expandList | ( | $ | list | ) |
Expand a comma-separated list of integers with ranges (eg 1,3-5,7 becomes 1,3,4,5,7). Ranges are limited to 1000 values per range.
| string | comma-separated list of integers with ranges (string) |
Definition at line 864 of file class.t3lib_div.php.
| t3lib_div::intInRange | ( | $ | theInt, | |
| $ | min, | |||
| $ | max = 2000000000, |
|||
| $ | zeroValue = 0 | |||
| ) |
Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is 'false' then the $zeroValue is applied. Usage: 224
| integer | Input value | |
| integer | Lower limit | |
| integer | Higher limit | |
| integer | Default value if input is false. |
Definition at line 895 of file class.t3lib_div.php.
| t3lib_div::intval_positive | ( | $ | theInt | ) |
Returns the $integer if greater than zero, otherwise returns zero. Usage: 1
| integer | Integer string to process |
Definition at line 911 of file class.t3lib_div.php.
| t3lib_div::int_from_ver | ( | $ | verNumberStr | ) |
Returns an integer from a three part version number, eg '4.12.3' -> 4012003 Usage: 2
| string | Version number on format x.x.x |
Definition at line 924 of file class.t3lib_div.php.
| t3lib_div::compat_version | ( | $ | verNumberStr | ) |
Returns true if the current TYPO3 version (or compatibility version) is compatible to the input version Notice that this function compares branches, not versions (4.0.1 would be > 4.0.0 although they use the same compat_version)
| string | Minimum branch number required (format x.y / e.g. "4.0" NOT "4.0.0"!) |
Definition at line 937 of file class.t3lib_div.php.
| t3lib_div::md5int | ( | $ | str | ) |
Makes a positive integer hash out of the first 7 chars from the md5 hash of the input Usage: 5
| string | String to md5-hash |
Definition at line 955 of file class.t3lib_div.php.
| t3lib_div::shortMD5 | ( | $ | input, | |
| $ | len = 10 | |||
| ) |
Returns the first 10 positions of the MD5-hash (changed from 6 to 10 recently)
Usage: 37
| string | Input string to be md5-hashed | |
| integer | The string-length of the output |
Definition at line 968 of file class.t3lib_div.php.
| t3lib_div::uniqueList | ( | $ | in_list, | |
| $ | secondParameter = NULL | |||
| ) |
Takes comma-separated lists and arrays and removes all duplicates If a value in the list is trim(empty), the value is ignored. Usage: 16
| string | Accept multiple parameters wich can be comma-separated lists of values and arrays. | |
| mixed | $secondParameter: Dummy field, which if set will show a warning! |
Definition at line 981 of file class.t3lib_div.php.
| t3lib_div::split_fileref | ( | $ | fileref | ) |
Splits a reference to a file in 5 parts Usage: 43
| string | Filename/filepath to be analysed |
Definition at line 995 of file class.t3lib_div.php.
| t3lib_div::dirname | ( | $ | path | ) |
Returns the directory part of a path without trailing slash If there is no dir-part, then an empty string is returned. Behaviour:
'/dir1/dir2/script.php' => '/dir1/dir2' '/dir1/' => '/dir1' 'dir1/script.php' => 'dir1' 'd/script.php' => 'd' '/script.php' => '' '' => '' Usage: 5
| string | Directory name / path |
Definition at line 1033 of file class.t3lib_div.php.
| t3lib_div::modifyHTMLColor | ( | $ | color, | |
| $ | R, | |||
| $ | G, | |||
| $ | B | |||
| ) |
Modifies a HTML Hex color by adding/subtracting $R,$G and $B integers Usage: 11
| string | A hexadecimal color code, xxxxxx | |
| integer | Offset value 0-255 | |
| integer | Offset value 0-255 | |
| integer | Offset value 0-255 |
Definition at line 1049 of file class.t3lib_div.php.
| t3lib_div::modifyHTMLColorAll | ( | $ | color, | |
| $ | all | |||
| ) |
Modifies a HTML Hex color by adding/subtracting $all integer from all R/G/B channels Usage: 6
| string | A hexadecimal color code, xxxxxx | |
| integer | Offset value 0-255 for all three channels. |
Definition at line 1069 of file class.t3lib_div.php.
| t3lib_div::rm_endcomma | ( | $ | string | ) |
Removes comma (if present) in the end of string Usage: 2
| string | String from which the comma in the end (if any) will be removed. |
Definition at line 1080 of file class.t3lib_div.php.
| t3lib_div::danish_strtoupper | ( | $ | string | ) |
strtoupper which converts danish (and other characters) characters as well Usage: 0
| string | String to process |
Definition at line 1093 of file class.t3lib_div.php.
| t3lib_div::convUmlauts | ( | $ | str | ) |
Change umlaut characters to plain ASCII with normally two character target Only known characters will be converted, so don't expect a result for any character.
ä => ae, Ö => Oe
| string | String to convert. |
Definition at line 1108 of file class.t3lib_div.php.
| t3lib_div::testInt | ( | $ | var | ) |
Tests if the input is an integer. Usage: 77
| mixed | Any input variable to test. |
Definition at line 1121 of file class.t3lib_div.php.
| t3lib_div::isFirstPartOfStr | ( | $ | str, | |
| $ | partStr | |||
| ) |
Returns true if the first part of $str matches the string $partStr Usage: 59
| string | Full string to check | |
| string | Reference string which must be found as the "first part" of the full string |
Definition at line 1133 of file class.t3lib_div.php.
| t3lib_div::formatSize | ( | $ | sizeInBytes, | |
| $ | labels = '' | |||
| ) |
Formats the input integer $sizeInBytes as bytes/kilobytes/megabytes (-/K/M) Usage: 53
| integer | Number of bytes to format. | |
| string | Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value) |
Definition at line 1149 of file class.t3lib_div.php.
| t3lib_div::convertMicrotime | ( | $ | microtime | ) |
Returns microtime input to milliseconds Usage: 2
| string | Microtime |
Definition at line 1184 of file class.t3lib_div.php.
| t3lib_div::splitCalc | ( | $ | string, | |
| $ | operators | |||
| ) |
This splits a string by the chars in $operators (typical /+-*) and returns an array with them in Usage: 2
| string | Input string, eg "123 + 456 / 789 - 4" | |
| string | Operators to split by, typically "/+-*" |
Definition at line 1198 of file class.t3lib_div.php.
| t3lib_div::calcPriority | ( | $ | string | ) |
Calculates the input by +,-,*,/,%,^ with priority to + and - Usage: 1
| string | Input string, eg "123 + 456 / 789 - 4" |
Definition at line 1220 of file class.t3lib_div.php.
| t3lib_div::calcParenthesis | ( | $ | string | ) |
Calculates the input with parenthesis levels Usage: 2
| string | Input string, eg "(123 + 456) / 789 - 4" |
Definition at line 1261 of file class.t3lib_div.php.
| t3lib_div::htmlspecialchars_decode | ( | $ | value | ) |
Inverse version of htmlspecialchars() Usage: 4
| string | Value where >, <, " and & should be converted to regular chars. |
Definition at line 1287 of file class.t3lib_div.php.
| t3lib_div::deHSCentities | ( | $ | str | ) |
Re-converts HTML entities if they have been converted by htmlspecialchars() Usage: 10
| string | String which contains eg. "&amp;" which should stay "&". Or "&#1234;" to "Ӓ". Or "&#x1b;" to "" |
Definition at line 1302 of file class.t3lib_div.php.
| t3lib_div::slashJS | ( | $ | string, | |
| $ | extended = 0, |
|||
| $ | char = "'" | |||
| ) |
This function is used to escape any ' -characters when transferring text to JavaScript! Usage: 3
| string | String to escape | |
| boolean | If set, also backslashes are escaped. | |
| string | The character to escape, default is ' (single-quote) |
Definition at line 1315 of file class.t3lib_div.php.
| t3lib_div::rawUrlEncodeJS | ( | $ | str | ) |
Version of rawurlencode() where all spaces (20) are re-converted to space-characters. Usefull when passing text to JavaScript where you simply url-encode it to get around problems with syntax-errors, linebreaks etc. Usage: 4
| string | String to raw-url-encode with spaces preserved |
Definition at line 1328 of file class.t3lib_div.php.
| t3lib_div::rawUrlEncodeFP | ( | $ | str | ) |
rawurlencode which preserves "/" chars Usefull when filepaths should keep the "/" chars, but have all other special chars encoded. Usage: 5
| string | Input string |
Definition at line 1340 of file class.t3lib_div.php.
| t3lib_div::validEmail | ( | $ | ) |
Checking syntax of input email address Usage: 5
| string | Input string to evaluate |
Definition at line 1351 of file class.t3lib_div.php.
| t3lib_div::formatForTextarea | ( | $ | content | ) |
Formats a string for output between <textarea>-tags All content outputted in a textarea form should be passed through this function Not only is the content htmlspecialchar'ed on output but there is also a single newline added in the top. The newline is necessary because browsers will ignore the first newline after <textarea> if that is the first character. Therefore better set it! Usage: 23
| string | Input string to be formatted. |
Definition at line 1366 of file class.t3lib_div.php.
| t3lib_div::inArray | ( | $ | in_array, | |
| $ | item | |||
| ) |
Check if an item exists in an array Please note that the order of parameters is reverse compared to the php4-function in_array()!!! Usage: 3
| array | one-dimensional array of items | |
| string | item to check for |
Definition at line 1397 of file class.t3lib_div.php.
| t3lib_div::intExplode | ( | $ | delim, | |
| $ | string | |||
| ) |
Explodes a $string delimited by $delim and passes each item in the array through intval(). Corresponds to explode(), but with conversion to integers for all values. Usage: 76
| string | Delimiter string to explode with | |
| string | The string to explode |
Definition at line 1414 of file class.t3lib_div.php.
| t3lib_div::revExplode | ( | $ | delim, | |
| $ | string, | |||
| $ | count = 0 | |||
| ) |
Reverse explode which explodes the string counting from behind. Thus t3lib_div::revExplode(':','my:words:here',2) will return array('my:words','here') Usage: 8
| string | Delimiter string to explode with | |
| string | The string to explode | |
| integer | Number of array entries |
Definition at line 1433 of file class.t3lib_div.php.
| t3lib_div::trimExplode | ( | $ | delim, | |
| $ | string, | |||
| $ | onlyNonEmptyValues = 0 | |||
| ) |
Explodes a string and trims all values for whitespace in the ends. If $onlyNonEmptyValues is set, then all blank ('') values are removed. Usage: 256
| string | Delimiter string to explode with | |
| string | The string to explode | |
| boolean | If set, all empty values (='') will NOT be set in output |
Definition at line 1453 of file class.t3lib_div.php.
| t3lib_div::uniqueArray | ( | $ | valueArray | ) |
Remove duplicate values from an array Usage: 0
| array | Array of values to make unique |
Definition at line 1474 of file class.t3lib_div.php.
| t3lib_div::removeArrayEntryByValue | ( | $ | array, | |
| $ | cmpValue | |||
| ) |
Removes the value $cmpValue from the $array if found there. Returns the modified array Usage: 3
| array | Array containing the values | |
| string | Value to search for and if found remove array entry where found. |
Definition at line 1486 of file class.t3lib_div.php.
| t3lib_div::implodeArrayForUrl | ( | $ | name, | |
| $ | theArray, | |||
| $ | str = '', |
|||
| $ | skipBlank = 0, |
|||
| $ | rawurlencodeParamName = 0 | |||
| ) |
Implodes a multidim-array into GET-parameters (eg. ¶m[key][key2]=value2¶m[key][key3]=value3) Usage: 24
| string | Name prefix for entries. Set to blank if you wish none. | |
| array | The (multidim) array to implode | |
| string | (keep blank) | |
| boolean | If set, parameters which were blank strings would be removed. | |
| boolean | If set, the param name itself (for example "param[key][key2]") would be rawurlencoded as well. |
Definition at line 1515 of file class.t3lib_div.php.
| t3lib_div::explodeUrl2Array | ( | $ | string, | |
| $ | multidim = FALSE | |||
| ) |
Explodes a string with GETvars (eg. "&id=1&type=2&ext[mykey]=3") into an array
| string | GETvars string | |
| boolean | If set, the string will be parsed into a multidimensional array if square brackets are used in variable names (using PHP function parse_str()) |
Definition at line 1540 of file class.t3lib_div.php.
| t3lib_div::compileSelectedGetVarsFromArray | ( | $ | varList, | |
| $ | getArray, | |||
| $ | GPvarAlt = 1 | |||
| ) |
Returns an array with selected keys from incoming data. (Better read source code if you want to find out...) Usage: 3
| string | List of variable/key names | |
| array | Array from where to get values based on the keys in $varList | |
| boolean | If set, then t3lib_div::_GP() is used to fetch the value if not found (isset) in the $getArray |
Definition at line 1566 of file class.t3lib_div.php.
| t3lib_div::addSlashesOnArray | ( | &$ | theArray | ) |
AddSlash array This function traverses a multidimentional array and adds slashes to the values. NOTE that the input array is and argument by reference.!! Twin-function to stripSlashesOnArray Usage: 8
| array | Multidimensional input array, (REFERENCE!) |
Definition at line 1589 of file class.t3lib_div.php.
| t3lib_div::stripSlashesOnArray | ( | &$ | theArray | ) |
StripSlash array This function traverses a multidimentional array and strips slashes to the values. NOTE that the input array is and argument by reference.!! Twin-function to addSlashesOnArray Usage: 10
| array | Multidimensional input array, (REFERENCE!) |
Definition at line 1613 of file class.t3lib_div.php.
| t3lib_div::slashArray | ( | $ | arr, | |
| $ | cmd | |||
| ) |
Either slashes ($cmd=add) or strips ($cmd=strip) array $arr depending on $cmd Usage: 0
| array | Multidimensional input array | |
| string | "add" or "strip", depending on usage you wish. |
Definition at line 1635 of file class.t3lib_div.php.
| t3lib_div::array_merge_recursive_overrule | ( | $ | arr0, | |
| $ | arr1, | |||
| $ | notAddKeys = 0, |
|||
| $ | includeEmtpyValues = true | |||
| ) |
Merges two arrays recursively and "binary safe" (integer keys are overridden as well), overruling similar values in the first array ($arr0) with the values of the second array ($arr1) In case of identical keys, ie. keeping the values of the second. Usage: 0
| array | First array | |
| array | Second array, overruling the first array | |
| boolean | If set, keys that are NOT found in $arr0 (first array) will not be set. Thus only existing value can/will be overruled from second array. | |
| boolean | If set, values from $arr1 will overrule if they are empty or zero. Default: true |
Definition at line 1652 of file class.t3lib_div.php.
| t3lib_div::array_merge | ( | $ | arr1, | |
| $ | arr2 | |||
| ) |
An array_merge function where the keys are NOT renumbered as they happen to be with the real php-array_merge function. It is "binary safe" in the sense that integer keys are overridden as well. Usage: 16
| array | First array | |
| array | Second array |
Definition at line 1685 of file class.t3lib_div.php.
| t3lib_div::csvValues | ( | $ | row, | |
| $ | delim = ',', |
|||
| $ | quote = '"' | |||
| ) |
Takes a row and returns a CSV string of the values with $delim (default is ,) and $quote (default is ") as separator chars. Usage: 5
| array | Input array of values | |
| string | Delimited, default is comman | |
| string | Quote-character to wrap around the values. |
Definition at line 1698 of file class.t3lib_div.php.
| t3lib_div::removeDotsFromTS | ( | $ | ts | ) |
Removes dots "." from end of a key identifier of TypoScript styled array. array('key.' => array('property.' => 'value')) --> array('key' => array('property' => 'value'))
| array | $ts: TypoScript configuration array |
Definition at line 1717 of file class.t3lib_div.php.
| t3lib_div::get_tag_attributes | ( | $ | tag | ) |
Returns an array with all attributes of the input HTML tag as key/value pairs. Attributes are only lowercase a-z $tag is either a whole tag (eg '<TAG option="" attrib="VALUE>">') or the parameterlist (ex ' OPTION ATTRIB=VALUE>') If a attribute is empty (I call it 'an option'), then the value for the key is empty. You can check if it existed with isset() Usage: 8
| string | HTML-tag string (or attributes only) |
Definition at line 1762 of file class.t3lib_div.php.
| t3lib_div::split_tag_attributes | ( | $ | tag | ) |
Returns an array with the 'components' from an attribute list from an HTML tag. The result is normally analyzed by get_tag_attributes Removes tag-name if found Usage: 2
| string | HTML-tag string (or attributes only) |
Definition at line 1799 of file class.t3lib_div.php.
| t3lib_div::implodeAttributes | ( | $ | arr, | |
| $ | xhtmlSafe = FALSE, |
|||
| $ | dontOmitBlankAttribs = FALSE | |||
| ) |
Implodes attributes in the array $arr for an attribute list in eg. and HTML tag (with quotes) Usage: 14
| array | Array with attribute key/value pairs, eg. "bgcolor"=>"red", "border"=>0 | |
| boolean | If set the resulting attribute list will have a) all attributes in lowercase (and duplicates weeded out, first entry taking precedence) and b) all values htmlspecialchar()'ed. It is recommended to use this switch! | |
| boolean | If true, don't check if values are blank. Default is to omit attributes with blank values. |
Definition at line 1833 of file class.t3lib_div.php.
| t3lib_div::implodeParams | ( | $ | arr, | |
| $ | xhtmlSafe = FALSE, |
|||
| $ | dontOmitBlankAttribs = FALSE | |||
| ) |
Implodes attributes in the array $arr for an attribute list in eg. and HTML tag (with quotes)
| array | See implodeAttributes() | |
| boolean | See implodeAttributes() | |
| boolean | See implodeAttributes() |
Definition at line 1860 of file class.t3lib_div.php.
| t3lib_div::wrapJS | ( | $ | string, | |
| $ | linebreak = TRUE | |||
| ) |
Wraps JavaScript code XHTML ready with <script>-tags Automatic re-identing of the JS code is done by using the first line as ident reference. This is nice for identing JS code with PHP code on the same level.
| string | JavaScript code | |
| boolean | Wrap script element in linebreaks? Default is TRUE. |
Definition at line 1875 of file class.t3lib_div.php.
| t3lib_div::xml2tree | ( | $ | string, | |
| $ | depth = 999 | |||
| ) |
Parses XML input into a PHP array with associative keys Usage: 0
| string | XML data input | |
| integer | Number of element levels to resolve the XML into an array. Any further structure will be set as XML. |
Definition at line 1906 of file class.t3lib_div.php.
| t3lib_div::array2xml_cs | ( | $ | array, | |
| $ | docTag = 'phparray', |
|||
| $ | options = array(), |
|||
| $ | charset = '' | |||
| ) |
Turns PHP array into XML. See array2xml()
| array | The input PHP array with any kind of data; text, binary, integers. Not objects though. | |
| string | Alternative document tag. Default is "phparray". | |
| array | Options for the compilation. See array2xml() for description. | |
| string | Forced charset to prologue |
Definition at line 1982 of file class.t3lib_div.php.
| t3lib_div::array2xml | ( | $ | array, | |
| $ | NSprefix = '', |
|||
| $ | level = 0, |
|||
| $ | docTag = 'phparray', |
|||
| $ | spaceInd = 0, |
|||
| $ | options = array(), |
|||
| $ | stackData = array() | |||
| ) |
Deprecated to call directly (unless you are aware of using XML prologues)! Use "array2xml_cs" instead (which adds an XML-prologue)
Converts a PHP array into an XML string. The XML output is optimized for readability since associative keys are used as tagnames. This also means that only alphanumeric characters are allowed in the tag names AND only keys NOT starting with numbers (so watch your usage of keys!). However there are options you can set to avoid this problem. Numeric keys are stored with the default tagname "numIndex" but can be overridden to other formats) The function handles input values from the PHP array in a binary-safe way; All characters below 32 (except 9,10,13) will trigger the content to be converted to a base64-string The PHP variable type of the data IS preserved as long as the types are strings, arrays, integers and booleans. Strings are the default type unless the "type" attribute is set. The output XML has been tested with the PHP XML-parser and parses OK under all tested circumstances with 4.x versions. However, with PHP5 there seems to be the need to add an XML prologue a la <?xml version="1.0" encoding="[charset]" standalone="yes" ?> - otherwise UTF-8 is assumed! Unfortunately, many times the output from this function is used without adding that prologue meaning that non-ASCII characters will break the parsing!! This suchs of course! Effectively it means that the prologue should always be prepended setting the right characterset, alternatively the system should always run as utf-8! However using MSIE to read the XML output didn't always go well: One reason could be that the character encoding is not observed in the PHP data. The other reason may be if the tag-names are invalid in the eyes of MSIE. Also using the namespace feature will make MSIE break parsing. There might be more reasons... Usage: 5
| array | The input PHP array with any kind of data; text, binary, integers. Not objects though. | |
| string | tag-prefix, eg. a namespace prefix like "T3:" | |
| integer | Current recursion level. Don't change, stay at zero! | |
| string | Alternative document tag. Default is "phparray". | |
| integer | If greater than zero, then the number of spaces corresponding to this number is used for indenting, if less than zero - no indentation, if zero - a single chr(9) (TAB) is used | |
| array | Options for the compilation. Key "useNindex" => 0/1 (boolean: whether to use "n0, n1, n2" for num. indexes); Key "useIndexTagForNum" => "[tag for numerical indexes]"; Key "useIndexTagForAssoc" => "[tag for associative indexes"; Key "parentTagMap" => array('parentTag' => 'thisLevelTag') | |
| string | Stack data. Don't touch. |
Definition at line 2023 of file class.t3lib_div.php.
| t3lib_div::xml2array | ( | $ | string, | |
| $ | NSprefix = '', |
|||
| $ | reportDocTag = FALSE | |||
| ) |
Converts an XML string to a PHP array. This is the reverse function of array2xml() Usage: 17
| string | XML content to convert into an array | |
| string | The tag-prefix resolve, eg. a namespace like "T3:" | |
| boolean | If set, the document tag will be set in the key "_DOCUMENT_TAG" of the output array |
Definition at line 2150 of file class.t3lib_div.php.
| t3lib_div::xmlRecompileFromStructValArray | ( | $ | vals | ) |
This implodes an array of XML parts (made with xml_parse_into_struct()) into XML again. Usage: 2
| array | A array of XML parts, see xml2tree |
Definition at line 2264 of file class.t3lib_div.php.
| t3lib_div::xmlGetHeaderAttribs | ( | $ | xmlData | ) |
Extract the encoding scheme as found in the first line of an XML document (typically) Usage: 1
| string | XML data |
Definition at line 2308 of file class.t3lib_div.php.
| t3lib_div::getURL | ( | $ | url, | |
| $ | includeHeader = 0, |
|||
| $ | requestHeaders = false | |||
| ) |
Reads the file or url $url and returns the content If you are having trouble with proxys when reading URLs you can configure your way out of that with settings like $TYPO3_CONF_VARS['SYS']['curlUse'] etc. Usage: 83
| string | Filepath/URL to read | |
| integer | Whether the HTTP header should be fetched or not. 0=disable, 1=fetch header+content, 2=fetch header only | |
| array | HTTP headers to be used in the request |
Definition at line 2342 of file class.t3lib_div.php.
| t3lib_div::writeFile | ( | $ | file, | |
| $ | content | |||
| ) |
Writes $content to the file $file Usage: 30
| string | Filepath to write to | |
| string | Content to write |
Definition at line 2435 of file class.t3lib_div.php.
| t3lib_div::fixPermissions | ( | $ | file | ) |
Setting file system mode & group ownership of file
| string | Filepath of newly created file |
Definition at line 2460 of file class.t3lib_div.php.
| t3lib_div::writeFileToTypo3tempDir | ( | $ | filepath, | |
| $ | content | |||
| ) |
Writes $content to a filename in the typo3temp/ folder (and possibly one or two subfolders...) Accepts an additional subdirectory in the file path!
| string | Absolute filepath to write to inside "typo3temp/". First part of this string must match PATH_site."typo3temp/" | |
| string | Content string to write |
Definition at line 2477 of file class.t3lib_div.php.
| t3lib_div::mkdir | ( | $ | theNewFolder | ) |
Wrapper function for mkdir, setting folder permissions according to $GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'] and group ownership according to $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] Usage: 6
| string | Absolute path to folder, see PHP mkdir() function. Removes trailing slash internally. |
Definition at line 2520 of file class.t3lib_div.php.
| t3lib_div::mkdir_deep | ( | $ | destination, | |
| $ | deepDir | |||
| ) |
Creates a directory - including parent directories if necessary - in the file system
| string | Base folder. This must exist! Must have trailing slash! Example "/root/typo3site/" | |
| string | Deep directory to create, eg. "xx/yy/" which creates "/root/typo3site/xx/yy/" if $destination is "/root/typo3site/" |
Definition at line 2539 of file class.t3lib_div.php.
| t3lib_div::get_dirs | ( | $ | path | ) |
Returns an array with the names of folders in a specific path Will return 'error' (string) if there were an error with reading directory content. Usage: 11
| string | Path to list directories from |
Definition at line 2561 of file class.t3lib_div.php.
| t3lib_div::getFilesInDir | ( | $ | path, | |
| $ | extensionList = '', |
|||
| $ | prependPath = 0, |
|||
| $ | order = '', |
|||
| $ | excludePattern = '' | |||
| ) |
Returns an array with the names of files in a specific path Usage: 18
| string | $path: Is the path to the file | |
| string | $extensionList is the comma list of extensions to read only (blank = all) | |
| boolean | If set, then the path is prepended the filenames. Otherwise only the filenames are returned in the array | |
| string | $order is sorting: 1= sort alphabetically, 'mtime' = sort by modification time. | |
| string | A comma seperated list of filenames to exclude, no wildcards |
Definition at line 2587 of file class.t3lib_div.php.
| t3lib_div::getAllFilesAndFoldersInPath | ( | $ | fileArr, | |
| $ | path, | |||
| $ | extList = '', |
|||
| $ | regDirs = 0, |
|||
| $ | recursivityLevels = 99, |
|||
| $ | excludePattern = '' | |||
| ) |
Recursively gather all files and folders of a path. Usage: 5
| array | $fileArr: Empty input array (will have files added to it) | |
| string | $path: The path to read recursively from (absolute) (include trailing slash!) | |
| string | $extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected. | |
| boolean | $regDirs: If set, directories are also included in output. | |
| integer | $recursivityLevels: The number of levels to dig down... | |
| string | $excludePattern: regex pattern of files/directories to exclude |
Definition at line 2642 of file class.t3lib_div.php.
| t3lib_div::removePrefixPathFromList | ( | $ | fileArr, | |
| $ | prefixToRemove | |||
| ) |
Removes the absolute part of all files/folders in fileArr Usage: 2
| array | $fileArr: The file array to remove the prefix from | |
| string | $prefixToRemove: The prefix path to remove (if found as first part of string!) |
Definition at line 2665 of file class.t3lib_div.php.
| t3lib_div::fixWindowsFilePath | ( | $ | theFile | ) |
Fixes a path for windows-backslashes and reduces double-slashes to single slashes Usage: 2
| string | File path to process |
Definition at line 2681 of file class.t3lib_div.php.
| t3lib_div::resolveBackPath | ( | $ | pathStr | ) |
Resolves "../" sections in the input path string. For example "fileadmin/directory/../other_directory/" will be resolved to "fileadmin/other_directory/" Usage: 2
| string | File path in which "/../" is resolved |
Definition at line 2693 of file class.t3lib_div.php.
| t3lib_div::locationHeaderUrl | ( | $ | path | ) |
Prefixes a URL used with 'header-location' with 'http://...' depending on whether it has it already.
| string | URL / path to prepend full URL addressing to. |
Definition at line 2721 of file class.t3lib_div.php.
| t3lib_div::debug_ordvalue | ( | $ | string, | |
| $ | characters = 100 | |||
| ) |
Returns a string with a list of ascii-values for the first $characters characters in $string Usage: 0
| string | String to show ASCII value for | |
| integer | Number of characters to show |
Definition at line 2761 of file class.t3lib_div.php.
| t3lib_div::view_array | ( | $ | array_in | ) |
Returns HTML-code, which is a visual representation of a multidimensional array use t3lib_div::print_array() in order to print an array Returns false if $array_in is not an array Usage: 31
| array | Array to view |
Definition at line 2778 of file class.t3lib_div.php.
| t3lib_div::print_array | ( | $ | array_in | ) |
Prints an array Usage: 6
| array | Array to print visually (in a table). |
Definition at line 2810 of file class.t3lib_div.php.
| t3lib_div::debug | ( | $ | var = "", |
|
| $ | brOrHeader = 0 | |||
| ) |
Makes debug output Prints $var in bold between two vertical lines If not $var the word 'debug' is printed If $var is an array, the array is printed by t3lib_div::print_array() Usage: 8
| mixed | Variable to print | |
| mixed | If the parameter is a string it will be used as header. Otherwise number of break tags to apply after (positive integer) or before (negative integer) the output. |
Definition at line 2825 of file class.t3lib_div.php.
| t3lib_div::debug_trail | ( | ) |
Displays the "path" of the function call stack in a string, using debug_backtrace
Definition at line 2856 of file class.t3lib_div.php.
| t3lib_div::debugRows | ( | $ | rows, | |
| $ | header = '' | |||
| ) |
Displays an array as rows in a table. Useful to debug output like an array of database records.
| array | Array of arrays with similar keys | |
| string | Table header |
Definition at line 2876 of file class.t3lib_div.php.
| t3lib_div::getThisUrl | ( | ) |
Returns the HOST+DIR-PATH of the current script (The URL, but without 'http://' and without script-filename) Usage: 1
Definition at line 2954 of file class.t3lib_div.php.
| t3lib_div::linkThisScript | ( | $ | getParams = array() |
) |
Returns the link-url to the current script. In $getParams you can set associative keys corresponding to the GET-vars you wish to add to the URL. If you set them empty, they will remove existing GET-vars from the current URL. REMEMBER to always use htmlspecialchars() for content in href-properties to get ampersands converted to entities (XHTML requirement and XSS precaution) Usage: 52
| array | Array of GET parameters to include |
Definition at line 2970 of file class.t3lib_div.php.
| t3lib_div::linkThisUrl | ( | $ | url, | |
| $ | getParams = array() | |||
| ) |
Takes a full URL, $url, possibly with a querystring and overlays the $getParams arrays values onto the quirystring, packs it all together and returns the URL again. So basically it adds the parameters in $getParams to an existing URL, $url Usage: 2
| string | URL string | |
| array | Array of key/value pairs for get parameters to add/overrule with. Can be multidimensional. |
Definition at line 2994 of file class.t3lib_div.php.
| t3lib_div::getIndpEnv | ( | $ | getEnvName | ) |
Abstraction method which returns System Environment Variables regardless of server OS, CGI/MODULE version etc. Basically this is SERVER variables for most of them. This should be used instead of getEnv() and $_SERVER/ENV_VARS to get reliable values for all situations. Usage: 221
| string | Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY |
Definition at line 3017 of file class.t3lib_div.php.
| t3lib_div::milliseconds | ( | ) |
milliseconds microtime recalculated to t3lib_div::milliseconds(1/1000 sec) Usage: 20
Definition at line 3215 of file class.t3lib_div.php.
| t3lib_div::clientInfo | ( | $ | useragent = '' |
) |
Client Browser Information Usage: 4
| string | Alternative User Agent string (if empty, t3lib_div::getIndpEnv('HTTP_USER_AGENT') is used) |
Definition at line 3227 of file class.t3lib_div.php.
| t3lib_div::getHostname | ( | $ | requestHost = TRUE |
) |
Get the fully-qualified domain name of the host. Usage: 2
| boolean | Use request host (when not in CLI mode). |
Definition at line 3285 of file class.t3lib_div.php.
| t3lib_div::getFileAbsFileName | ( | $ | filename, | |
| $ | onlyRelative = 1, |
|||
| $ | relToTYPO3_mainDir = 0 | |||
| ) |
Returns the absolute filename of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the PATH_site of the TYPO3 installation and implies a check with t3lib_div::validPathStr(). Returns false if checks failed. Does not check if the file exists. Usage: 24
| string | The input filename/filepath to evaluate | |
| boolean | If $onlyRelative is set (which it is by default), then only return values relative to the current PATH_site is accepted. | |
| boolean | If $relToTYPO3_mainDir is set, then relative paths are relative to PATH_typo3 constant - otherwise (default) they are relative to PATH_site |
Definition at line 3346 of file class.t3lib_div.php.
| t3lib_div::validPathStr | ( | $ | theFile | ) |
Checks for malicious file paths. Returns true if no '//', '..' or '\' is in the $theFile This should make sure that the path is not pointing 'backwards' and further doesn't contain double/back slashes. So it's compatible with the UNIX style path strings valid for TYPO3 internally. Usage: 14
| string | Filepath to evaluate |
Definition at line 3382 of file class.t3lib_div.php.
| t3lib_div::isAbsPath | ( | $ | path | ) |
Checks if the $path is absolute or relative (detecting either '/' or 'x:/' as first part of string) and returns true if so. Usage: 8
| string | Filepath to evaluate |
Definition at line 3393 of file class.t3lib_div.php.
| t3lib_div::isAllowedAbsPath | ( | $ | path | ) |
Returns true if the path is absolute, without backpath '..' and within the PATH_site OR within the lockRootPath Usage: 5
| string | Filepath to evaluate |
Definition at line 3404 of file class.t3lib_div.php.
| t3lib_div::verifyFilenameAgainstDenyPattern | ( | $ | filename | ) |
Verifies the input filename againts the 'fileDenyPattern'. Returns true if OK. Usage: 2
| string | Filepath to evaluate |
Definition at line 3421 of file class.t3lib_div.php.
| t3lib_div::upload_copy_move | ( | $ | source, | |
| $ | destination | |||
| ) |
Moves $source file to $destination if uploaded, otherwise try to make a copy Usage: 4
| string | Source file, absolute path | |
| string | Destination file, absolute path |
Definition at line 3439 of file class.t3lib_div.php.
| t3lib_div::upload_to_tempfile | ( | $ | uploadedFileName | ) |
Will move an uploaded file (normally in "/tmp/xxxxx") to a temporary filename in PATH_site."typo3temp/" from where TYPO3 can use it under safe_mode. Use this function to move uploaded files to where you can work on them. REMEMBER to use t3lib_div::unlink_tempfile() afterwards - otherwise temp-files will build up! They are NOT automatically deleted in PATH_site."typo3temp/"! Usage: 6
| string | The temporary uploaded filename, eg. $_FILES['[upload field name here]']['tmp_name'] |
Definition at line 3465 of file class.t3lib_div.php.
| t3lib_div::unlink_tempfile | ( | $ | uploadedTempFileName | ) |
Deletes (unlink) a temporary filename in 'PATH_site."typo3temp/"' given as input. The function will check that the file exists, is in PATH_site."typo3temp/" and does not contain back-spaces ("../") so it should be pretty safe. Use this after upload_to_tempfile() or tempnam() from this class! Usage: 9
| string | Filepath for a file in PATH_site."typo3temp/". Must be absolute. |
Definition at line 3483 of file class.t3lib_div.php.
| t3lib_div::tempnam | ( | $ | filePrefix | ) |
Create temporary filename (Create file with unique file name) This function should be used for getting temporary filenames - will make your applications safe for open_basedir = on REMEMBER to delete the temporary files after use! This is done by t3lib_div::unlink_tempfile() Usage: 7
| string | Prefix to temp file (which will have no extension btw) |
Definition at line 3499 of file class.t3lib_div.php.
| t3lib_div::stdAuthCode | ( | $ | uid_or_record, | |
| $ | fields = '', |
|||
| $ | codeLength = 8 | |||
| ) |
Standard authentication code (used in Direct Mail, checkJumpUrl and setfixed links computations) Usage: 2
| mixed | Uid (integer) or record (array) | |
| string | List of fields from the record if that is given. | |
| integer | Length of returned authentication code. |
Definition at line 3513 of file class.t3lib_div.php.
| t3lib_div::cHashParams | ( | $ | addQueryParams | ) |
Splits the input query-parameters into an array with certain parameters filtered out. Used to create the cHash value
| string | Query-parameters: "&xxx=yyy&zzz=uuu" |
Definition at line 3544 of file class.t3lib_div.php.
| t3lib_div::hideIfNotTranslated | ( | $ | l18n_cfg_fieldValue | ) |
Responds on input localization setting value whether the page it comes from should be hidden if no translation exists or not.
| integer | Value from "l18n_cfg" field of a page record |
Definition at line 3567 of file class.t3lib_div.php.
| t3lib_div::readLLfile | ( | $ | fileRef, | |
| $ | langKey | |||
| ) |
Includes a locallang file and returns the $LOCAL_LANG array found inside.
| string | Input is a file-reference (see t3lib_div::getFileAbsFileName) which, if exists, is included. That file is expected to be a 'local_lang' file containing a $LOCAL_LANG array. | |
| string | Language key |
Definition at line 3582 of file class.t3lib_div.php.
| t3lib_div::readLLXMLfile | ( | $ | fileRef, | |
| $ | langKey | |||
| ) |
Includes a locallang-xml file and returns the $LOCAL_LANG array Works only when the frontend or backend has been initialized with a charset conversion object. See first code lines.
| string | Absolute reference to locallang-XML file | |
| string | TYPO3 language key, eg. "dk" or "de" or "default" |
Definition at line 3606 of file class.t3lib_div.php.
| t3lib_div::llXmlAutoFileName | ( | $ | fileRef, | |
| $ | language | |||
| ) |
Returns auto-filename for locallang-XML localizations.
| string | Absolute file reference to locallang-XML file. Must be inside system/global/local extension | |
| string | Language key |
Definition at line 3734 of file class.t3lib_div.php.
| t3lib_div::loadTCA | ( | $ | table | ) |
Loads the $TCA (Table Configuration Array) for the $table
Requirements: 1) must be configured table (the ctrl-section configured), 2) columns must not be an array (which it is always if whole table loaded), and 3) there is a value for dynamicConfigFile (filename in typo3conf)
Note: For the frontend this loads only 'ctrl' and 'feInterface' parts. For complete TCA use $GLOBALS['TSFE']->includeTCA() instead.
Usage: 84
| string | Table name for which to load the full TCA array part into the global $TCA |
Definition at line 3781 of file class.t3lib_div.php.
| t3lib_div::resolveSheetDefInDS | ( | $ | dataStructArray, | |
| $ | sheet = 'sDEF' | |||
| ) |
Looks for a sheet-definition in the input data structure array. If found it will return the data structure for the sheet given as $sheet (if found). If the sheet definition is in an external file that file is parsed and the data structure inside of that is returned. Usage: 5
| array | Input data structure, possibly with a sheet-definition and references to external data source files. | |
| string | The sheet to return, preferably. |
Definition at line 3801 of file class.t3lib_div.php.
| t3lib_div::resolveAllSheetsInDS | ( | $ | dataStructArray | ) |
Resolves ALL sheet definitions in dataStructArray If no sheet is found, then the default "sDEF" will be created with the dataStructure inside.
| array | Input data structure, possibly with a sheet-definition and references to external data source files. |
Definition at line 3834 of file class.t3lib_div.php.
| t3lib_div::callUserFunction | ( | $ | funcName, | |
| &$ | params, | |||
| &$ | ref, | |||
| $ | checkPrefix = 'user_', |
|||
| $ | silent = 0 | |||
| ) |
Calls a userdefined function/method in class Such a function/method should look like this: "function proc(&$params, &$ref) {...}" Usage: 17
| string | Function/Method reference, '[file-reference":"]["&"]class/function["->"method-name]'. You can prefix this reference with "[file-reference]:" and t3lib_div::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:&tx_realurl->encodeSpURL". Finally; you can prefix the class name with "&" if you want to reuse a former instance of the same object call ("singleton"). | |
| mixed | Parameters to be pass along (typically an array) (REFERENCE!) | |
| mixed | Reference to be passed along (typically "$this" - being a reference to the calling object) (REFERENCE!) | |
| string | Required prefix of class or function name | |
| boolean | If set, no debug() error message is shown if class/function is not present. |
Definition at line 3863 of file class.t3lib_div.php.
| & t3lib_div::getUserObj | ( | $ | classRef, | |
| $ | checkPrefix = 'user_', |
|||
| $ | silent = 0 | |||
| ) |
Creates and returns reference to a user defined object. This function can return an object reference if you like. Just prefix the function call with "&": "$objRef = &t3lib_div::getUserObj('EXT:myext/class.tx_myext_myclass.php:&tx_myext_myclass');". This will work ONLY if you prefix the class name with "&" as well. See description of function arguments. Usage: 5
| string | Class reference, '[file-reference":"]["&"]class-name'. You can prefix the class name with "[file-reference]:" and t3lib_div::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:&tx_realurl". Finally; for the class name you can prefix it with "&" and you will reuse the previous instance of the object identified by the full reference string (meaning; if you ask for the same $classRef later in another place in the code you will get a reference to the first created one!). | |
| string | Required prefix of class name. By default "tx_" is allowed. | |
| boolean | If set, no debug() error message is shown if class/function is not present. |
Definition at line 3959 of file class.t3lib_div.php.
| & t3lib_div::makeInstance | ( | $ | className | ) |
Make instance of class Takes the class-extensions API of TYPO3 into account Please USE THIS instead of the PHP "new" keyword. Eg. "$obj = new myclass;" should be "$obj = t3lib_div::makeInstance("myclass")" instead! Usage: 447
| string | Class name to instantiate |
Definition at line 4017 of file class.t3lib_div.php.
| t3lib_div::makeInstanceClassName | ( | $ | className | ) |
Return classname for new instance Takes the class-extensions API of TYPO3 into account Usage: 17
| string | Base Class name to evaluate |
Definition at line 4038 of file class.t3lib_div.php.
| & t3lib_div::makeInstanceService | ( | $ | serviceType, | |
| $ | serviceSubType = '', |
|||
| $ | excludeServiceKeys = array() | |||
| ) |
Find the best service and check if it works. Returns object of the service class.
| string | Type of service (service key). | |
| string | Sub type like file extensions or similar. Defined by the service. | |
| mixed | List of service keys which should be exluded in the search for a service. Array or comma list. |
Definition at line 4052 of file class.t3lib_div.php.
| t3lib_div::requireOnce | ( | $ | requireFile | ) |
Require a class for TYPO3 Useful to require classes from inside other classes (not global scope). A limited set of global variables are available (see function)
Definition at line 4105 of file class.t3lib_div.php.
| t3lib_div::plainMailEncoded | ( | $ | email, | |
| $ | subject, | |||
| $ | message, | |||
| $ | headers = '', |
|||
| $ | encoding = 'quoted-printable', |
|||
| $ | charset = '', |
|||
| $ | dontEncodeHeader = false | |||
| ) |
Simple substitute for the PHP function mail() which allows you to specify encoding and character set The fifth parameter ($encoding) will allow you to specify 'base64' encryption for the output (set $encoding=base64) Further the output has the charset set to ISO-8859-1 by default. Usage: 4
| string | Email address to send to. (see PHP function mail()) | |
| string | Subject line, non-encoded. (see PHP function mail()) | |
| string | Message content, non-encoded. (see PHP function mail()) | |
| string | Headers, separated by chr(10) | |
| string | Encoding type: "base64", "quoted-printable", "8bit". Default value is "quoted-printable". | |
| string | Charset used in encoding-headers (only if $encoding is set to a valid value which produces such a header) | |
| boolean | If set, the header content will not be encoded. |
Definition at line 4126 of file class.t3lib_div.php.
| t3lib_div::quoted_printable | ( | $ | string, | |
| $ | maxlen = 76 | |||
| ) |
Implementation of quoted-printable encode. This functions is buggy. It seems that in the part where the lines are breaked every 76th character, that it fails if the break happens right in a quoted_printable encode character! See RFC 1521, section 5.1 Quoted-Printable Content-Transfer-Encoding Usage: 2
| string | Content to encode | |
| integer | Length of the lines, default is 76 |
Definition at line 4196 of file class.t3lib_div.php.
| t3lib_div::encodeHeader | ( | $ | line, | |
| $ | enc = 'quoted-printable', |
|||
| $ | charset = 'ISO-8859-1' | |||
| ) |
Encode header lines Email headers must be ASCII, therefore they will be encoded to quoted_printable (default) or base64.
| string | Content to encode | |
| string | Encoding type: "base64" or "quoted-printable". Default value is "quoted-printable". | |
| string | Charset used for encoding |
Definition at line 4243 of file class.t3lib_div.php.
| t3lib_div::substUrlsInPlainText | ( | $ | message, | |
| $ | urlmode = '76', |
|||
| $ | index_script_url = '' | |||
| ) |
Takes a clear-text message body for a plain text email, finds all 'http://' links and if they are longer than 76 chars they are converted to a shorter URL with a hash parameter. The real parameter is stored in the database and the hash-parameter/URL will be redirected to the real parameter when the link is clicked. This function is about preserving long links in messages. Usage: 3
| string | Message content | |
| string | URL mode; "76" or "all" | |
| string | URL of index script (see makeRedirectUrl()) |
Definition at line 4287 of file class.t3lib_div.php.
| t3lib_div::makeRedirectUrl | ( | $ | inUrl, | |
| $ | l = 0, |
|||
| $ | index_script_url = '' | |||
| ) |
Subfunction for substUrlsInPlainText() above. Usage: 2
| string | Input URL | |
| integer | URL string length limit | |
| string | URL of "index script" - the prefix of the "?RDCT=..." parameter. If not supplyed it will default to t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'index.php' |
Definition at line 4324 of file class.t3lib_div.php.
| t3lib_div::freetypeDpiComp | ( | $ | font_size | ) |
Function to compensate for FreeType2 96 dpi Usage: 21
| integer | Fontsize for freetype function call |
Definition at line 4352 of file class.t3lib_div.php.
| t3lib_div::initSysLog | ( | ) |
Init system error log.
Definition at line 4364 of file class.t3lib_div.php.
| t3lib_div::sysLog | ( | $ | msg, | |
| $ | extKey, | |||
| $ | severity = 0 | |||
| ) |
System error log; This should be implemented around the source code, including the Core and both frontend and backend, logging serious errors. If you want to implement the sysLog in your applications, simply add lines like: t3lib_div::sysLog('[write message in English here]', 'extension key');
| string | Message (in English). | |
| string | Extension key (from which extension you are calling the log) or "Core" | |
| integer | Severity: 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error |
Definition at line 4414 of file class.t3lib_div.php.
| t3lib_div::devLog | ( | $ | msg, | |
| $ | extKey, | |||
| $ | severity = 0, |
|||
| $ | dataVar = FALSE | |||
| ) |
Developer log; This should be implemented around the source code, both frontend and backend, logging everything from the flow through an application, messages, results from comparisons to fatal errors. The result is meant to make sense to developers during development or debugging of a site. The idea is that this function is only a wrapper for external extensions which can set a hook which will be allowed to handle the logging of the information to any format they might wish and with any kind of filter they would like. If you want to implement the devLog in your applications, simply add lines like: if (TYPO3_DLOG) t3lib_div::devLog('[write message in english here]', 'extension key');
| string | Message (in english). | |
| string | Extension key (from which extension you are calling the log) | |
| integer | Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message | |
| array | Additional data you want to pass to the logger. |
Definition at line 4497 of file class.t3lib_div.php.
| t3lib_div::arrayToLogString | ( | $ | arr, | |
| $ | valueList = array(), |
|||
| $ | valueLength = 20 | |||
| ) |
Converts a one dimensional array to a one line string which can be used for logging or debugging output Example: "loginType: FE; refInfo: Array; HTTP_HOST: www.example.org; REMOTE_ADDR: 192.168.1.5; REMOTE_HOST:; security_level:; showHiddenRecords: 0;"
| array | Data array which should be outputted | |
| mixed | List of keys which should be listed in the output string. Pass a comma list or an array. An empty list outputs the whole array. | |
| integer | Long string values are shortened to this length. Default: 20 |
Definition at line 4518 of file class.t3lib_div.php.
| t3lib_div::imageMagickCommand | ( | $ | command, | |
| $ | parameters, | |||
| $ | path = '' | |||
| ) |
Compile the command for running ImageMagick/GraphicsMagick.
| string | Command to be run: identify, convert or combine/composite | |
| string | The parameters string | |
| string | Override the default path |
Definition at line 4542 of file class.t3lib_div.php.
| t3lib_div::unQuoteFilenames | ( | $ | parameters, | |
| $ | unQuote = FALSE | |||
| ) |
Explode a string (normally a list of filenames) with whitespaces by considering quotes in that string. This is mostly needed by the imageMagickCommand function above.
| string | The whole parameters string | |
| boolean | If set, the elements of the resulting array are unquoted. |
Definition at line 4589 of file class.t3lib_div.php.
| t3lib_div::quoteJSvalue | ( | $ | value, | |
| $ | inScriptTags = false | |||
| ) |
Quotes a string for usage as JS parameter. Depends wheter the value is used in script tags (it doesn't need/must not get htmlspecialchar'ed in this case)
| string | The string to encode. | |
| boolean | If the values get's used in <script> tags. |
Definition at line 4623 of file class.t3lib_div.php.