Static Public Member Functions | |
| static | wrapHtml ($string, $length=45, $wrapString="\n") |
| static | tokenize ($string, $remove_accents=True) |
| static | cleanString ($string) |
| static | removeAccents ($string) |
| static | stringToChars ($string) |
| static | preventUpperCase ($string, $mode=MB_CASE_TITLE) |
| static | simplePreventUpperCase ($string, $mode=MB_CASE_TITLE) |
| static Pluf_Text::wrapHtml | ( | $ | string, | |
| $ | length = 45, |
|||
| $ | wrapString = "\n" | |||
| ) | [static] |
Wrap a string containing HTML code.
The HTML is not broken, words are broken only if very long.
Improved from a version available on php.net
| string | The string to wrap | |
| int | The maximal length of a string (45) | |
| string | Wrap string ("\n") |
HTML Begins
HTML ends
If this is inside HTML -> append to the wrapped string
Whitespace characted / new line
Check chars
| static Pluf_Text::tokenize | ( | $ | string, | |
| $ | remove_accents = True | |||
| ) | [static] |
Given a string, cleaned from the not interesting characters, returns an array with the words as index and the number of times it was in the text as the value.
Tokenizer of DokuWiki to handle Thai and CJK words. http://www.splitbrain.org/projects/dokuwiki
| string | Cleaned, lowercased and utf-8 encoded string. | |
| bool | Remove the accents (True) |
| static Pluf_Text::cleanString | ( | $ | string | ) | [static] |
Clean a string from the HTML and the unnecessary punctuation. Convert the string to lowercase.
Require mbstring extension.
| string | String. |
| static Pluf_Text::removeAccents | ( | $ | string | ) | [static] |
Remove the accentuated characters.
Requires a string in lowercase, the removal is not perfect but is better than nothing.
| string | Lowercased string in utf-8. |
| static Pluf_Text::stringToChars | ( | $ | string | ) | [static] |
Convert a string to a list of characters.
| string | utf-8 encoded string. |
| static Pluf_Text::preventUpperCase | ( | $ | string, | |
| $ | mode = MB_CASE_TITLE | |||
| ) | [static] |
Prevent a string to be all uppercase.
If more than 50% of the words in the string are uppercases and if the string contains more than one word, the string is converted using the mb_convert_case.
| string | String to test. | |
| int | Mode to convert the string (MB_CASE_TITLE) |
| static Pluf_Text::simplePreventUpperCase | ( | $ | string, | |
| $ | mode = MB_CASE_TITLE | |||
| ) | [static] |
Simple uppercase prevention.
Contrary to self::preventUpperCase, this method will also prevent a single word to be uppercase.
| string | String possibly in uppercase. | |
| int | Mode to convert the string (MB_CASE_TITLE) |