class vB_Utility_String

Traits

Properties

protected $iconvenabled
protected $mbstringenabled

Methods

__sleep()

No description

__wakeup()

No description

__construct($charset)

Constructor

getCharset()

Get the default charset for the class

htmlspecialchars(string $value, integer $flags = ENT_COMPAT | ENT_HTML401, string $encoding = null)

Encoding aware htmlspecialchars

htmlentities($value, $flags = ENT_COMPAT | ENT_HTML401, $encoding = null)

No description

bool
isDefaultCharset(string $charset)

Does the charset match the default charset for the class

bool
areCharsetsEqual(string $charset1, string $charset2)

Are the two charsets the same

string|array
toUtf8(string|array $value)

Converts from the internal charset to utf8

string|array
toDefault(string|array $value, string $sourceEncoding)

Converts to the default charset

string|array
toCharset(string|array $value, string $sourceEncoding, string $targetEncoding)

Converts a variable from one character encoding to another.

mixed
parseUrl(string $url, int $component = -1)

UTF-8 Safe Parse_url http://us3.php.net/manual/en/function.parse-url.php

Details

__sleep()

__wakeup()

at line 36
__construct($charset)

Constructor

Parameters

$charset -- the default charset

Will throw an exception if the $charset is not an accepted value

at line 49
getCharset()

Get the default charset for the class

at line 67
htmlspecialchars(string $value, integer $flags = ENT_COMPAT | ENT_HTML401, string $encoding = null)

Encoding aware htmlspecialchars

This takes a string and produces an html escaped version. It uses specified charset.

Parameters

string $value -- string to be escaped
integer $flags -- flags per php function htmlspecialchars
string $encoding -- the browser encoding to use. Note that this is not the encoding value for the php function. Use the same values as you would use for the http/html value and would pass to this class. If null, the class default will be used.

at line 93
htmlentities($value, $flags = ENT_COMPAT | ENT_HTML401, $encoding = null)

Parameters

$value
$flags
$encoding

at line 126
bool isDefaultCharset(string $charset)

Does the charset match the default charset for the class

Parameters

string $charset

Return Value

bool

See also

areCharsetsEqual

at line 143
bool areCharsetsEqual(string $charset1, string $charset2)

Are the two charsets the same

This uses the charset matching rules to look up the charsets and then compares the canoncical value for each charset to see if they match. If either charset is invalid according to the matching rule, the function will return false (even if both are the same invalid value)

Parameters

string $charset1
string $charset2

Return Value

bool

at line 167
string|array toUtf8(string|array $value)

Converts from the internal charset to utf8

Parameters

string|array $value -- The variable to convert

Return Value

string|array The converted variable.

See also

toCharset

at line 180
string|array toDefault(string|array $value, string $sourceEncoding)

Converts to the default charset

Parameters

string|array $value -- The variable to convert
string $sourceEncoding -- The source encoding

Return Value

string|array The converted variable.

See also

toCharset

at line 202
string|array toCharset(string|array $value, string $sourceEncoding, string $targetEncoding)

Converts a variable from one character encoding to another.

If the variable is a string it is converted. If it is array will attempt to recurse over it and convert any string values located. Any other types will be returned unchanged.

Note that this does not attempt to deal with reference loops so is not suitable for complex objects.

Parameters

string|array $value -- The variable to convert
string $sourceEncoding -- The source encoding
string $targetEncoding -- The target encoding

Return Value

string|array The converted variable.

at line 219
mixed parseUrl(string $url, int $component = -1)

UTF-8 Safe Parse_url http://us3.php.net/manual/en/function.parse-url.php

Parameters

string $url
int $component

Return Value

mixed