Moodle  2.2.1
http://www.collinsharper.com
textlib Class Reference

Static Public Member Functions

static parse_charset ($charset)
static convert ($text, $fromCS, $toCS='utf-8')
static substr ($text, $start, $len=null, $charset='utf-8')
static strlen ($text, $charset='utf-8')
static strtolower ($text, $charset='utf-8')
static strtoupper ($text, $charset='utf-8')
static strpos ($haystack, $needle, $offset=0)
static strrpos ($haystack, $needle)
static specialtoascii ($text, $charset='utf-8')
static encode_mimeheader ($text, $charset='utf-8')
static entities_to_utf8 ($str, $htmlent=true)
static utf8_to_entities ($str, $dec=false, $nonnum=false)
static trim_utf8_bom ($str)
static get_encodings ()
static code2utf8 ($num)
static strtotitle ($text)
static asort (array &$arr, $sortflag=null)

Static Protected Member Functions

static typo3 ()

Detailed Description

Definition at line 58 of file textlib.class.php.


Member Function Documentation

static asort ( array &$  arr,
sortflag = null 
) [static]

Locale aware sorting, the key associations are kept, values are sorted alphabetically.

Parameters:
array$arrarray to be sorted (reference)
int$sortflagOne of Collator::SORT_REGULAR, Collator::SORT_NUMERIC, Collator::SORT_STRING
Returns:
void modifies parameter

Definition at line 590 of file textlib.class.php.

Here is the call graph for this function:

static code2utf8 ( num) [static]

Returns the utf8 string corresponding to the unicode value (from php.net, courtesy - romans@void.lv)

Parameters:
int$numone unicode value
Returns:
string the UTF-8 char corresponding to the unicode value

Definition at line 531 of file textlib.class.php.

Here is the caller graph for this function:

static convert ( text,
fromCS,
toCS = 'utf-8' 
) [static]

Converts the text between different encodings. It uses iconv extension with //TRANSLIT parameter, falls back to typo3. Returns false if fails.

Parameters:
string$text
string$fromCSsource encoding
string$toCSresult encoding
Returns:
string|bool converted string or false on error

Definition at line 162 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static encode_mimeheader ( text,
charset = 'utf-8' 
) [static]

Generate a correct base64 encoded header to be used in MIME mail messages. This function seems to be 100% compliant with RFC1342. Credits go to: paravoid (http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283).

Parameters:
string$text
string$charsetencoding of the text
Returns:
string

Definition at line 351 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static entities_to_utf8 ( str,
htmlent = true 
) [static]

Converts all the numeric entities &#nnnn; or &#xnnn; to UTF-8 Original from laurynas dot butkus at gmail at: http://php.net/manual/en/function.html-entity-decode.php#75153 with some custom mods to provide more functionality

Parameters:
string$strinput string
boolean$htmlentconvert also html entities (defaults to true)
Returns:
string

NOTE: we could have used typo3 entities_to_utf8() here but the direct alternative used runs 400% quicker and uses 0.5Mb less memory, so, let's use it (tested against 10^6 conversions)

Definition at line 444 of file textlib.class.php.

Here is the caller graph for this function:

static get_encodings ( ) [static]

Returns encoding options for select boxes, utf-8 and platform encoding first

Returns:
array encodings

Definition at line 507 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static parse_charset ( charset) [static]

Standardise charset name

Please note it does not mean the returned charset is actually supported.

Parameters:
string$charsetraw charset name
Returns:
string normalised lowercase charset name

Definition at line 115 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static specialtoascii ( text,
charset = 'utf-8' 
) [static]

Try to convert upper unicode characters to plain ascii, the returned string may contain unconverted unicode characters.

Parameters:
string$text
string$charsetencoding of the text
Returns:
string

Definition at line 334 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static strlen ( text,
charset = 'utf-8' 
) [static]

Multibyte safe strlen() function, uses mbstring or iconv for UTF-8, falls back to typo3.

Parameters:
string$text
string$charsetencoding of the text
Returns:
int number of characters

Definition at line 235 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static strpos ( haystack,
needle,
offset = 0 
) [static]

UTF-8 ONLY safe strpos(), uses mbstring, falls back to iconv.

Parameters:
string$haystack
string$needle
int$offset
Returns:
string

Definition at line 303 of file textlib.class.php.

Here is the caller graph for this function:

static strrpos ( haystack,
needle 
) [static]

UTF-8 ONLY safe strrpos(), uses mbstring, falls back to iconv.

Parameters:
string$haystack
string$needle
Returns:
string

Definition at line 318 of file textlib.class.php.

Here is the caller graph for this function:

static strtolower ( text,
charset = 'utf-8' 
) [static]

Multibyte safe strtolower() function, uses mbstring, falls back to typo3.

Parameters:
string$text
string$charsetencoding of the text (may not work for all encodings)
Returns:
string lower case text

Definition at line 260 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static strtotitle ( text) [static]

Makes first letter of each word capital - words must be separated by spaces. Use with care, this function does not work properly in many locales!!!

Parameters:
string$text
Returns:
string

Definition at line 554 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static strtoupper ( text,
charset = 'utf-8' 
) [static]

Multibyte safe strtoupper() function, uses mbstring, falls back to typo3.

Parameters:
string$text
string$charsetencoding of the text (may not work for all encodings)
Returns:
string upper case text

Definition at line 281 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static substr ( text,
start,
len = null,
charset = 'utf-8' 
) [static]

Multibyte safe substr() function, uses mbstring or iconv for UTF-8, falls back to typo3.

Parameters:
string$text
int$startnegative value means from end
int$len
string$charsetencoding of the text
Returns:
string

Definition at line 193 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static trim_utf8_bom ( str) [static]

Removes the BOM from unicode string - see http://unicode.org/faq/utf_bom.html

Parameters:
string$str
Returns:
string

Definition at line 495 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static typo3 ( ) [static, protected]

Return t3lib helper class

Returns:
t3lib_cs

Definition at line 64 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static utf8_to_entities ( str,
dec = false,
nonnum = false 
) [static]

Converts all Unicode chars > 127 to numeric entities &#nnnn; or &#xnnn;.

Parameters:
string$strinput string
boolean$decoutput decadic only number entities
boolean$nonnumremove all non-numeric entities
Returns:
string converted string

Definition at line 474 of file textlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations