PHP 클래스 Habari\MultiByte

Provides multibyte character set services, a necessity since all of Habari's internal string manipulations are done in UTF-8. Currently this class is a wrapper around mbstring functions.
파일 보기 프로젝트 열기: habari/system

공개 프로퍼티들

프로퍼티 타입 설명
$hab_enc String holding the current encoding the class is using

공개 메소드들

메소드 설명
convert_encoding ( $str, $use_enc = null, $from_enc = null ) : mixed Converts a string's encoding to a new encoding
detect_bom_encoding ( $source_contents ) : mixed Detects the encoding being used for a string using the existence of a byte order mark
detect_encoding ( $str ) : mixed Detects the encoding being used for a string
hab_encoding ( $use_enc = null ) : string. Sets and returns the internal encoding.
lcfirst ( string $str, string $use_enc = null ) : string Makes a string's first character lowercase
library ( integer $new_library = null ) : mixed Sets and returns the multibyte library being used internally
str_ireplace ( mixed $search, mixed $replace, string $subject, integer &$count, string $use_enc = null ) : string Replace all occurrences of the search string with the replacement string.
str_replace ( mixed $search, mixed $replace, string $subject, integer &$count, string $use_enc = null ) : string Replace all occurrences of the search string with the replacement string.
stripos ( $haysack, $needle, $offset, $use_enc = null ) : mixed Find position of first occurrence of string in a string. Case insensitive.
strlen ( $str, $use_enc = null ) : integer. Gets the length of a string in characters
strpos ( $haysack, $needle, $offset, $use_enc = null ) : mixed Find position of first occurrence of string in a string
strripos ( $haysack, $needle, $offset, $use_enc = null ) : mixed Find position of last occurrence of string in a string. Case insensitive.
strrpos ( $haysack, $needle, $offset, $use_enc = null ) : mixed function strrpos
strtolower ( $str, $use_enc = null ) : string. function strtolower
strtoupper ( $str, $use_enc = null ) : string. Converts a multibyte string to uppercase. If a valid multibyte library isn't loaded, strtoupper() will be used, which can lead to unexpected results.
substr ( $str, $begin, $len = null, $use_enc = null ) : mixed Get a section of a string
ucfirst ( string $str, string $use_enc = null ) : string Makes a string's first character uppercase
ucwords ( string $str, string $use_enc = null ) : string Uppercase the first character of each word in a string.
valid_data ( string $str, null $use_enc = null ) : boolean Determines if the passed string is valid character data (according to mbstring)

비공개 메소드들

메소드 설명
__construct ( ) An empty constructor since all functions are static

메소드 상세

convert_encoding() 공개 정적인 메소드

Converts a string's encoding to a new encoding
public static convert_encoding ( $str, $use_enc = null, $from_enc = null ) : mixed
$str string. The string who's encoding is being changed.
$use_enc string. The encoding to convert to. If not set, the internal encoding will be used.
$from_enc string. encoding before conversion. If not set, encoding is detected automatically.
리턴 mixed The source string in the new encoding or boolean false.

detect_bom_encoding() 공개 정적인 메소드

Detects the encoding being used for a string using the existence of a byte order mark
public static detect_bom_encoding ( $source_contents ) : mixed
$source_contents string. The string whose encoding is being detected
리턴 mixed The source string's detected encoding, or boolean false.

detect_encoding() 공개 정적인 메소드

Detects the encoding being used for a string
public static detect_encoding ( $str ) : mixed
$str string. The string whose encoding is being detected
리턴 mixed The source string's detected encoding, or boolean false.

hab_encoding() 공개 정적인 메소드

Sets and returns the internal encoding.
public static hab_encoding ( $use_enc = null ) : string.
$use_enc string. The encoding to be used
리턴 string.

lcfirst() 공개 정적인 메소드

Makes a string's first character lowercase
또한 보기: http://php.net/ucfirst
public static lcfirst ( string $str, string $use_enc = null ) : string
$str string The string to lowercase.
$use_enc string The encoding to be used. If null, the internal encoding will be used.
리턴 string The lowercased string.

library() 공개 정적인 메소드

Sets and returns the multibyte library being used internally
public static library ( integer $new_library = null ) : mixed
$new_library integer The new library to use. One of the self::USE_* constants, null to simply return, or false to disable and use native non-multibyte-safe PHP methods.
리턴 mixed If $new_library is null, returns the current library being used. If $new_library has a valid value, returns the old library, else returns false.

str_ireplace() 공개 정적인 메소드

Replace all occurrences of the search string with the replacement string.
또한 보기: http://php.net/str_ireplace
public static str_ireplace ( mixed $search, mixed $replace, string $subject, integer &$count, string $use_enc = null ) : string
$search mixed A string or an array of strings to search for.
$replace mixed A string or an array of strings to replace search values with.
$subject string The string to perform the search and replace on.
$count integer If passed, this value will hold the number of matched and replaced needles.
$use_enc string The encoding to be used. If null, the internal encoding will be used.
리턴 string The subject with replaced values.

str_replace() 공개 정적인 메소드

Replace all occurrences of the search string with the replacement string.
또한 보기: http://php.net/str_replace
public static str_replace ( mixed $search, mixed $replace, string $subject, integer &$count, string $use_enc = null ) : string
$search mixed A string or an array of strings to search for.
$replace mixed A string or an array of strings to replace search values with.
$subject string The string to perform the search and replace on.
$count integer If passed, this value will hold the number of matched and replaced needles.
$use_enc string The encoding to be used. If null, the internal encoding will be used.
리턴 string The subject with replaced values.

stripos() 공개 정적인 메소드

Find position of first occurrence of string in a string. Case insensitive.
public static stripos ( $haysack, $needle, $offset, $use_enc = null ) : mixed
$haysack string. The string being checked.
$offset integer. The search offset. If it is not specified, 0 is used.
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 mixed The section of the source string requested in the encoding requested or false. If $len is not set, returns substring from $begin to end of string.

strlen() 공개 정적인 메소드

Gets the length of a string in characters
public static strlen ( $str, $use_enc = null ) : integer.
$str string. The string who's length is being returned.
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 integer.

strpos() 공개 정적인 메소드

Find position of first occurrence of string in a string
public static strpos ( $haysack, $needle, $offset, $use_enc = null ) : mixed
$haysack string. The string being checked.
$offset integer. The search offset. If it is not specified, 0 is used.
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 mixed The section of the source string requested in the encoding requested or false. If $len is not set, returns substring from $begin to end of string.

strripos() 공개 정적인 메소드

Find position of last occurrence of string in a string. Case insensitive.
public static strripos ( $haysack, $needle, $offset, $use_enc = null ) : mixed
$haysack string. The string being checked.
$offset integer. The search offset. If it is not specified, 0 is used.
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 mixed The section of the source string requested in the encoding requested or false. If $len is not set, returns substring from $begin to end of string.

strrpos() 공개 정적인 메소드

Find position of last occurrence of string in a string.
public static strrpos ( $haysack, $needle, $offset, $use_enc = null ) : mixed
$haysack string. The string being checked.
$offset integer. The search offset. If it is not specified, 0 is used.
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 mixed The section of the source string requested in the encoding requested or false. If $len is not set, returns substring from $begin to end of string.

strtolower() 공개 정적인 메소드

Converts a multibyte string to lowercase. If a valid multibyte library isn't loaded, strtolower() will be used, which can lead to unexpected results.
public static strtolower ( $str, $use_enc = null ) : string.
$str string. The string to lowercase
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 string.

strtoupper() 공개 정적인 메소드

Converts a multibyte string to uppercase. If a valid multibyte library isn't loaded, strtoupper() will be used, which can lead to unexpected results.
public static strtoupper ( $str, $use_enc = null ) : string.
$str string. The string to uppercase
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 string.

substr() 공개 정적인 메소드

Get a section of a string
public static substr ( $str, $begin, $len = null, $use_enc = null ) : mixed
$str string. The original string
$len integer. How long the returned string should be. If $len is not set, the section of the string from $begin to the end of the string is returned.
$use_enc string. The encoding to be used. If not set, the internal encoding will be used.
리턴 mixed The section of the source string requested in the encoding requested or false. If $len is not set, returns substring from $begin to end of string.

ucfirst() 공개 정적인 메소드

Makes a string's first character uppercase
또한 보기: http://php.net/ucfirst
public static ucfirst ( string $str, string $use_enc = null ) : string
$str string The string to capitalize.
$use_enc string The encoding to be used. If null, the internal encoding will be used.
리턴 string The capitalized string.

ucwords() 공개 정적인 메소드

From php.net/ucwords: The definition of a word is any string of characters that is immediately after a whitespace (These are: space, form-feed, newline, carriage return, horizontal tab, and vertical tab).
또한 보기: http://php.net/ucwords
public static ucwords ( string $str, string $use_enc = null ) : string
$str string The input string.
$use_enc string The encoding to be used. If null, the internal encoding will be used.
리턴 string The modified string.

valid_data() 공개 정적인 메소드

Determines if the passed string is valid character data (according to mbstring)
public static valid_data ( string $str, null $use_enc = null ) : boolean
$str string the string to check
$use_enc null
리턴 boolean

프로퍼티 상세

$hab_enc 정적으로 공개적으로 프로퍼티

String holding the current encoding the class is using
static public $hab_enc