Dotclear 2.24
Loading...
Searching...
No Matches
text Class Reference

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)
 

Detailed Description

Text utilities.

Member Function Documentation

◆ isEmail()

static isEmail ( string  $email)
static

Check email address

Returns true if $email is a valid email address.

Parameters
string$emailEmail string
Returns
bool

Referenced by urlPages\pages(), testIsEmail(), and testIsEmailAll().

◆ deaccent()

static deaccent ( string  $str)
static

Accents replacement

Replaces some occidental accentuated characters by their ASCII representation.

Parameters
string$strString to deaccent
Returns
string

Referenced by dcMedia\inflateZipFile(), str2URL(), testDeaccent(), and files\tidyFileName().

◆ str2URL()

static str2URL ( string  $str,
bool  $with_slashes = true 
)
static

String to URL

Transforms a string to a proper URL.

Parameters
string$strString to transform
bool$with_slashesKeep slashes in URL
Returns
string

References deaccent(), and tidyURL().

Referenced by teststr2URL().

◆ tidyURL()

static tidyURL ( string  $str,
bool  $keep_slashes = true,
bool  $keep_spaces = false 
)
static

URL cleanup

Parameters
string$strURL to tidy
bool$keep_slashesKeep slashes in URL
bool$keep_spacesKeep spaces in URL
Returns
string

Referenced by dcBlog\addCategory(), dcBlog\getPostURL(), dcMeta\sanitizeMetaID(), str2URL(), testTidyURL(), and dcBlog\updCategory().

◆ cutString()

static cutString ( string  $str,
int  $length 
)
static

Cut string

Returns a cuted string on spaced at given length $l.

Parameters
string$strString to cut
integer$lengthLength to keep
Returns
string

Referenced by dcRestMethods\checkNewsUpdate(), adminPost\init(), dcImportFeed\process(), dcTrackback\receivePingback(), dcTrackback\receiveTrackback(), dcTrackback\receiveWebmention(), and testcutString().

◆ splitWords()

static splitWords ( string  $str)
static

Split words

Returns an array of words from a given string.

Parameters
string$strWords to split
Returns
array

References html\clean().

Referenced by dcBlog\getComments(), dcBlog\getPosts(), dcImportDC1\importComments(), dcImportWP\importComments(), dcImportDC1\importPost(), dcImportWP\importPost(), dcCore\indexAllComments(), dcCore\indexAllPosts(), and testSplitWords().

◆ detectEncoding()

static detectEncoding ( string  $str)
static

Encoding detection

Returns the encoding (in lowercase) of given $str.

Parameters
string$strString
Returns
string

Referenced by testDetectEncoding(), and toUTF8().

◆ toUTF8()

static toUTF8 ( string  $str,
?string  $encoding = null 
)
static

UTF8 conversions

Returns an UTF-8 converted string. If $encoding is not specified, the function will try to detect encoding.

Parameters
string$strString to convert
string$encodingOptionnal "from" encoding
Returns
string

References detectEncoding().

Referenced by dcImportDC1\cleanStr(), dcImportWP\cleanStr(), imageMeta\readEXIF(), imageMeta\readIPTC(), imageMeta\readXMP(), and testToUTF8().

◆ utf8badFind()

static utf8badFind ( string  $str)
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

Parameters
string$strString to search
Returns
integer|false

Referenced by testUtf8badFind().

◆ cleanUTF8()

static cleanUTF8 ( string  $str,
string  $repl = '?' 
)
static

UTF-8 cleanup

Replaces non UTF-8 bytes in $str by $repl.

Parameters
string$strString to clean
string$replReplacement string
Returns
string

Referenced by dcImportDC1\cleanStr(), dcImportWP\cleanStr(), and testCleanUTF8().

◆ removeBOM()

static removeBOM ( string  $str)
static

BOM removal (UTF-8 only)

Removes BOM from the begining of a string if present.

Parameters
string$strString to clean
Returns
string

Referenced by testRemoveBOM().

◆ QPEncode()

static QPEncode ( string  $str)
static

Quoted printable conversion

Encodes given str to quoted printable

Parameters
string$strString to encode
Returns
string

Referenced by testQPEncode().


The documentation for this class was generated from the following file: