This function converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1.
SPECIAL NOTE: This function can be called without the API class instantiated.
This function returns an age, calculated from a timestamp. By default, the function takes the current time as reference, but another timestamp can be specified. The function also returns by default the age in days, but it can also returns it in seconds, minutes or hours.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$tstamp | The base timestamp. | |
$currentTime | false | The time from which to calculate the age (timestamp). Will use current time if none supplied. |
$ageType | false | The type of age to return (seconds, minutes, hours, or days). |
This function write, from an array, every given key, with it's value, as an HTML tag parameter.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$params | An array with the tag parameters as key/value pairs. |
This function checks for the type of multiples variables, passed in an array. It's used to check with one function call multiple variable which should be of the same type.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$vars | An array with the variables to check. | |
$type | 'array' | The type of the variables to check for. |
This function process an array and removes all the keys given as second parameter. It can also keep only the given keys if the $inverse parameter is set.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$input | The array to process. | |
$keys | A comma list of the keys to remove or keep in the input array. | |
$inverse | 0 | If reverse is set, the function will keep only the keys supplied in the array. Otherwise, it will remove them. |
This function is used to get only the host part of an URL.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$url | The URL to process. | |
$http | 1 | If set, add http:// before the base URL. |
$trailingSlash | 1 | If set, add a slash after the base URL. |
This function produces a vCard (.vcf format) from an array.
Here's an example input array:
array( 'firstname' => string// First name 'name' => string// Last name 'username' => string// Nick name 'company' => string// Company 'department' => string// Department 'title' => string// Job title 'www' => string// Home page 'note' => string// Notes 'birthday' => tstamp// Birtday 'email' => array( array( 'mail' => string// Email address 'type' => string// Type (WORK - HOME – Other) ) ) 'phone' => array( array( 'number' => string// Number 'type' => string// Type (WORK - HOME - CELL - MAIN - HOMEFAX - WORKFAX – Other) ) ) 'messenger' => array( array( 'name' => string// Account name 'service' => string// Service (AIM - JABBER - MSN - YAHOO – ICQ) 'type' => string// Type (WORK - HOME – Other) ) ) 'address' => array( array( 'street' => string// Street 'city' => string// City 'state' => string// State 'zip' => string// ZIP code 'country' => string// Country 'type' => string// Type (WORK - HOME – Other) ) ) 'image' => string// Picture reference 'iscompany' => boolean// Define as company ) |
The image must be a valid path to an image. It will be read and encoded in base64 chunks.
To create a pack of vCards, just call this function the number of time necessary, and concatenate the results.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$user | The user array. | |
$version | '3.0' | The vCard version. |
$charset | false | An optionnal charset to use for the properties. |
This function produis used to parse a vCard, or a pack of vCard, and to produce a multi-dimensionnal array with all the vCard informations. The array produced is exactly the same kind of array that must be passed to the div_vCardCreate function of this API. So the two functions are compatible.
If a vCard has an embed base65 encoded image, it's decoded, and a temporary image file is created in typo3temp/. The file reference is then included in the output array.
SPECIAL NOTE: This function can be called without the API class instantiated.
This function produces an HTML list element (UL or OL) from a string, using a separator to get each list item.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$string | The string to convert. | |
$sep | ',' | The separator used to get list items. |
$htmlspecialchars | 1 | Pass the item through htmlspecialchars(). |
$listType | 'ul' | The type of list to produce (UL, OL). |
$listParams | array() | The parameters of the list tag as key/value pairs. |
$itemsParams | array() | The parameters of the list items tag as key/value pairs. |
This function produces an HTML list element (UL or OL) from an array.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$inputArray | The array to convert. | |
$htmlspecialchars | 1 | Pass the item through htmlspecialchars(). |
$listType | 'ul' | The type of list to produce (UL, OL). |
$listParams | array() | The parameters of the list tag as key/value pairs. |
$itemsParams | array() | The parameters of the list items tag as key/value pairs. |
This function is used to output content with a specified type, as attachment for example. You can get a list of all the available type at the following address:
http://www.openmobilealliance.org/tech/omna/omna-wsp-content-type.htm
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$out | The content to output. | |
$cType | The content type. | |
$fName | The name of the file to output. | |
$cDisp | 'attachment' | The content disposition. |
$charset | 'utf-8' | The charset to use for the output. |
This function is used to convert an XML data to a multi-dimensionnal array, representing the structure of the data.
This function is based on the Typo3 array2xml function, in t3lib_div. It basically does the same, but has a few more options, like the inclusion of the xml tags arguments in the output array. This function also has support for same multiple tag names inside the same XML element, which is not the case with the core Typo3 function. In that specific case, the array keys are suffixed with '-N', where N is a numeric value.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$data | The XML data to process. | |
$keepAttribs | 1 | If set, also includes the tag attributes in the array (with key 'xml-attribs'). |
$caseFolding | 0 | XML parser option: case management. |
$skipWhite | 0 | XML parser option: white space management. |
$prefix | false | A tag prefix to remove. |
$numeric | 'n' | Keep only the numeric value for a tag prefixed with this argument (default is 'n'). |
$index | 'index' | Set the tag name to an alternate value found in the tag arguments (default is 'index'). |
$type | 'type' | Force the tag value to a special type, found in the tag arguments (default is 'type'). |
$base64 | 'base64' | Decode the tag value from base64 if the specified tag argument is present (default is 'base64'). |
$php5defCharset | 'iso-8859-1' | The default charset to use with PHP5. |
This function is used to convert a multi-dimensionnal array to XML code.
This is the reverse function of div_xml2array().
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$input | The array to process. | |
$xmlRoot | 'phpArray' | The name of the XML root element. |
$prefix | '' | A prefix for the tag names. |
$numeric | 'item' | The prefix for numeric keys. |
$numericAsAttribute | index | Use an XML attribute to store numeric keys. |
$addArrayAttribute | type | Add an XML attribute if the array value is an array. |
$xmlDeclaration | 1 | Include XML declaration. |
$encoding | 'iso-8859-1' | XML declaration parameter: encoding. |
$version | '1.0' | XML declaration parameter: version. |
$standalone | 'yes' | XML declaration parameter: standalone. |
$doctype | false | The URL of the doctype. |
$newLine | 10 | The new line character to use (through chr()). |
$indent | 9 | The indentation character to use (through chr()). |
$level | 0 | The level processed. Don't touch this, as it's used for the correct code indentation. |
This function is used to crop a string to a specified number of characters. By default, it crops the string after an entire word, and not in the middle of a word. It also strips by default all HTML tags before cropping, to avoid display problems.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$str | The string to crop. | |
$chars | Number of characters. | |
$endString | '...' | The string to add after the cropped string. |
$crop2space | 1 | Don't crop in a middle of a word. |
$stripTags | 1 | Remove all HTML tags from the string. |
This function returns a timestamp for a given year (XXXX), week number, and day number (0 is sunday, 6 is saturday).
Thanx to Nicolas Miroz (nmiroz@free.fr) for the informations about date computing.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$day | The day number. | |
$week | The week number. | |
$year | The year. |
This function forces the specified number into the boundaries of a minimum and maximum number.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$number | The number to check. | |
$min | The minimum value. | |
$max | The maximum value. | |
$int | false | Evaluate value as an integer. |
This function takes RGB (Red-Green-Blue) color values and converts them into HSL (Hue-Saturation-Luminance) color values. RGB values are from 0 to 255, and HSL values are returned in an array with associative keys. Note that the returned hue value is an angle (0-360), and the saturation and luminance are percentage (0-100).
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$R | The red value (0-255). | |
$G | The green value(0-255). | |
$B | The blue value (0-255). | |
$round | 1 | Round final values. |
This function takes HSL (Hue-Saturation-Luminance) color values and converts them into RGB (Red-Green-Blue) color values. This is the reverse function of div_rgb2hsl().
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$H | The hue value (0-360). | |
$S | The saturation value(0-100). | |
$L | The luminance value (0-100). | |
$round | 1 | Round final values. |
This function takes RGB (Red-Green-Blue) color values and converts them into HSv (Hue-Saturation-Value) color values. RGB values are from 0 to 255, and HSV values are returned in an array with associative keys. Note that the returned hue value is an angle (0-360), and the saturation and value are percentage (0-100).
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$R | The red value (0-255). | |
$G | The green value(0-255). | |
$B | The blue value (0-255). | |
$round | 1 | Round final values. |
This function takes HSV (Hue-Saturation-Value) color values and converts them into RGB (Red-Green-Blue) color values. This is the reverse function of div_rgb2hsv().
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$H | The hue value (0-360). | |
$S | The saturation value(0-100). | |
$V | The value value (0-100). | |
$round | 1 | Round final values. |
This function takes HSL (Hue-Saturation-Luminance) color values and converts them into HSV (Hue-Saturation-Value) color values.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$H | The hue value (0-360). | |
$S | The saturation value(0-100). | |
$L | The luminance value (0-100). | |
$round | 1 | Round final values. |
This function takes HSV (Hue-Saturation-Value) color values and converts them into HSL (Hue-Saturation-Luminance) color values.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$H | The hue value (0-360). | |
$S | The saturation value(0-100). | |
$V | The value value (0-100). | |
$round | 1 | Round final values. |
This function is used to create an hexadecimal color representation from RGB (Red-Green-Blue), HSL (Hue-Saturation-Luminance) or HSV (Hue-Saturation-Value) values.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$v1 | The first value (red or hue, depending of the method). | |
$v2 | The second value (green or saturation, depending of the method). | |
$v3 | The third value (blue, luminosity or value, depending of the method). | |
$method | 'RGB' | The method to use for the color creation. Can be 'RGB', 'HSL' or 'HSV'. |
$uppercase | 1 | Return value in uppercase. |
This function is used to modify an hexadecimal color representation by adding RGB (Red-Green-Blue), HSL (Hue-Saturation-Luminance) or HSV (Hue-Saturation-Value) values.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$color | The original color (hexadecimal). | |
$v1 | The first value (red or hue, depending of the method). | |
$v2 | The second value (green or saturation, depending of the method). | |
$v3 | The third value (blue, luminosity or value, depending of the method). | |
$method | 'RGB' | The method to use for the color modification. Can be 'RGB', 'HSL' or 'HSV'. |
$uppercase | 1 | Return value in uppercase. |
This function is used to reformat XHTML code, with linebreaks and indentations. The code passed to this function MUST be XHTML compliant in order to be reformatted, as it will be parsed as XML! If this is not the case, the original code is return. Also note that if you have mixed content inside a tag (eg. cData & tags), the cData won't be preserved, as it will be interpreted as junk data by the XML parser!
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$xhtml | The original XHTML code. | |
$uppercase | 0 | Render XHTML tags in uppercase. |
$newLine | 10 | The new line character to use (through chr()). |
$indent | 9 | The indentation character to use (through chr()), |
$level | 0 | The level processed. Don't touch this, as it's used for the correct code indentation. |
This function converts Macintosh & DOS line breaks to standard Unix line breaks. This means replacing CR (u000D / chr(13)) and CR + LF (u000D + u000A / chr(13) + chr(10)) by LF (u000A / chr(10)). It also replace LF + CR (u000A + u000D / chr(10) + chr(13)) sequences. By default, the function erases all ASCII null characters (u0000 / chr(0)).
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$text | The text to process. | |
$stripNull | 1 | Erase ASCII null characters. |
This function is used to check for specific keys in a multidimensionnal array.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$array | The input array. | |
$keys | The keys to check for, as a commalist representing the array hierarchy. | |
$allowEmpty | false | If this is set, the function returns true even if the final array item has an empty value. |
$checkType | false | The variable type to check for in the final array (array,bool,double,finite,float,int,long,nan,null,numeric,object,real,scalar,string) |
This function is used to delete a complete directory. If the permissions are OK, every file (which can be on subdirectories) is deleted. Then, all the subdirectories are deleted. This function is equivalent to a 'rm -rf' command, but in a more elegant way.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$path | The path of the directory (absolute). | |
$relative | 0 | Path is relative to the Typo3 site, otherwise absolute. |
$cleaned | 0 | Internal only! File cleaning has been processed. |
This function is used to check the type of a variable, without using the PHP gettype() function, which should never be used to check a variable type.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$var | The variable to check. | |
$type | The type to check for (array,bool,double,finite,float,int,long,nan,null,numeric,object,real,scalar,string). |