Dotclear 2.24
|
Text utilities. More...
Static Public Member Functions | |
static | isEmail (string $email) |
static | deaccent (string $str) |
static | str2URL (string $str, bool $with_slashes=true) |
static | tidyURL (string $str, bool $keep_slashes=true, bool $keep_spaces=false) |
static | cutString (string $str, int $length) |
static | splitWords (string $str) |
static | detectEncoding (string $str) |
static | toUTF8 (string $str, ?string $encoding=null) |
static | utf8badFind (string $str) |
static | cleanUTF8 (string $str, string $repl='?') |
static | removeBOM (string $str) |
static | QPEncode (string $str) |
Text utilities.
|
static |
Check email address
Returns true if $email is a valid email address.
string | Email string |
Referenced by urlPages\pages(), testIsEmail(), and testIsEmailAll().
|
static |
Accents replacement
Replaces some occidental accentuated characters by their ASCII representation.
string | $str | String to deaccent |
Referenced by dcMedia\inflateZipFile(), str2URL(), testDeaccent(), and files\tidyFileName().
|
static |
String to URL
Transforms a string to a proper URL.
string | $str | String to transform |
bool | $with_slashes | Keep slashes in URL |
References deaccent(), and tidyURL().
Referenced by teststr2URL().
|
static |
URL cleanup
string | $str | URL to tidy |
bool | $keep_slashes | Keep slashes in URL |
bool | $keep_spaces | Keep spaces in URL |
Referenced by dcBlog\addCategory(), dcBlog\getPostURL(), dcMeta\sanitizeMetaID(), str2URL(), testTidyURL(), and dcBlog\updCategory().
|
static |
Cut string
Returns a cuted string on spaced at given length $l.
string | $str | String to cut |
integer | $length | Length to keep |
Referenced by dcRestMethods\checkNewsUpdate(), adminPost\init(), dcImportFeed\process(), dcTrackback\receivePingback(), dcTrackback\receiveTrackback(), dcTrackback\receiveWebmention(), and testcutString().
|
static |
Split words
Returns an array of words from a given string.
string | $str | Words to split |
References html\clean().
Referenced by dcBlog\getComments(), dcBlog\getPosts(), dcImportDC1\importComments(), dcImportWP\importComments(), dcImportDC1\importPost(), dcImportWP\importPost(), dcCore\indexAllComments(), dcCore\indexAllPosts(), and testSplitWords().
|
static |
Encoding detection
Returns the encoding (in lowercase) of given $str.
string | $str | String |
Referenced by testDetectEncoding(), and toUTF8().
|
static |
UTF8 conversions
Returns an UTF-8 converted string. If $encoding is not specified, the function will try to detect encoding.
string | $str | String to convert |
string | $encoding | Optionnal "from" encoding |
References detectEncoding().
Referenced by dcImportDC1\cleanStr(), dcImportWP\cleanStr(), imageMeta\readEXIF(), imageMeta\readIPTC(), imageMeta\readXMP(), and testToUTF8().
|
static |
Find bad UTF8 tokens
Locates the first bad byte in a UTF-8 string returning it's byte index in the string PCRE Pattern to locate bad bytes in a UTF-8 string Comes from W3 FAQ: Multilingual Forms Note: modified to include full ASCII range including control chars
string | $str | String to search |
Referenced by testUtf8badFind().
|
static |
UTF-8 cleanup
Replaces non UTF-8 bytes in $str by $repl.
string | $str | String to clean |
string | $repl | Replacement string |
Referenced by dcImportDC1\cleanStr(), dcImportWP\cleanStr(), and testCleanUTF8().
|
static |
BOM removal (UTF-8 only)
Removes BOM from the begining of a string if present.
string | $str | String to clean |
Referenced by testRemoveBOM().
|
static |
Quoted printable conversion
Encodes given str to quoted printable
string | $str | String to encode |
Referenced by testQPEncode().