Joostina CMS / CMF v2.* API
  • Docs
  • Package
  • Class
  • Tree
  • Todo
Overview

Packages

  • Components
    • Acls
      • Models
        • Admin
        • Site
    • BlogCategory
      • Models
        • Admin
        • Site
    • Blogs
      • Controllers
        • Admin
        • Site
      • Helpers
      • Models
        • Admin
        • Site
    • Coder
      • Controllers
        • Admin
      • Models
        • Admin
    • Comments
      • Controllers
        • Admin
        • Site
      • Helpers
      • Models
        • Admin
        • Site
    • CommentsCounter
      • Models
        • Admin
        • Site
    • Mainpage
      • Controllers
        • Site
    • News
      • Controllers
        • Admin
        • Site
      • Helpers
      • Models
        • Admin
        • Site
    • Pages
      • Controllers
        • Admin
        • Site
      • Models
        • Site
    • Search
      • Controllers
        • Site
    • Site
      • Controllers
        • Admin
        • Site
    • Sitemap
      • Controllers
        • Admin
        • Site
      • Models
        • Admin
        • Site
    • Test
      • Controllers
        • Site
    • Torrents
      • Controllers
        • Site
    • Users
      • Controllers
        • Admin
        • Site
      • Models
        • Admin
        • Site
  • Compression
  • Core
    • Libraries
      • Arhive
      • Array
      • Attached
      • Autoadmin
      • Autoloader
      • Benchmark
      • Breadcrumbs
      • Cache
      • Config
      • Cookie
      • Csrf
      • Database
        • Drivers
          • Interfaces
      • Datetime
      • Debug
      • Editor
      • Events
      • File
      • Filter
      • Flashmessage
      • Folder
      • Hit
      • Html
      • Image
      • Inflector
      • Inputfilter
      • Libraries
      • Mail
      • Module
      • Nestedset
      • Pager
      • Pages
      • Params
      • Randomizer
      • Request
      • RobotLoader
      • Route
      • Security
      • Session
      • Static
      • String
      • Text
      • Trash
      • Validate
  • Email
  • Extra
    • Libraries
      • Basket
  • Joostina
    • Controller
    • Core
    • Document
  • JSMin
  • Libraries
    • Extra
      • Basket
        • Models
          • Site
  • None
  • Plugins
    • Autoadmin
    • Editor
    • Sitemap
  • SimpleMail
  • Vendors
    • Libraries
      • Email

Classes

  • joosString

Class joosString

Библиотека работы со строками в правильной кодировке UTF-8

Category: Libraries
Copyright: (C) 2007-2012 Joostina Team
Copyright: (c) 2007 Kohana Team
Copyright: (c) 2005 Harry Fuecks
License: License http://www.opensource.org/licenses/mit-license.php Информация об авторах и лицензиях стороннего кода в составе Joostina CMS: docs/copyrights
License: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
Author: Joostina Team <info@joostina.ru>
Author: Kohana Team
Version: 1.0
Located at: core/libraries/string.php

Methods summary

public static boolean
# is_ascii( string $str )

Tests whether a string contains only 7bit ASCII bytes. This is used to determine when to use native functions or UTF-8 functions.

Tests whether a string contains only 7bit ASCII bytes. This is used to determine when to use native functions or UTF-8 functions.

Parameters

$str
string
string to check

Returns

boolean
public static string
# strip_ascii_ctrl( string $str )

Strips out device control codes in the ASCII range.

Strips out device control codes in the ASCII range.

Parameters

$str
string
string to clean

Returns

string
public static string
# strip_non_ascii( string $str )

Strips out all non-7bit ASCII bytes.

Strips out all non-7bit ASCII bytes.

Parameters

$str
string
string to clean

Returns

string
public static integer
# strlen( string $str )

Returns the length of the given string.

Returns the length of the given string.

Parameters

$str
string
string being measured for length

Returns

integer

See

http://php.net/strlen
public static integer
# strpos( string $str, string $search, integer $offset = 0 )

Finds position of first occurrence of a UTF-8 string.

Finds position of first occurrence of a UTF-8 string.

Parameters

$str
string
haystack
$search
string
needle
$offset
integer
offset from which character in haystack to start searching

Returns

integer
position of needle
boolean
FALSE if the needle is not found

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/strlen
public static integer
# strrpos( string $str, string $search, integer $offset = 0 )

Finds position of last occurrence of a char in a UTF-8 string.

Finds position of last occurrence of a char in a UTF-8 string.

Parameters

$str
string
haystack
$search
string
needle
$offset
integer
offset from which character in haystack to start searching

Returns

integer
position of needle
boolean
FALSE if the needle is not found

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/strrpos
public static string
# substr( string $str, integer $offset, integer $length = NULL )

Returns part of a UTF-8 string.

Returns part of a UTF-8 string.

Parameters

$str
string
input string
$offset
integer
offset
$length
integer
length limit

Returns

string

Author

Chris Smith <chris@jalakai.co.uk>

See

http://php.net/substr
public static string
# substr_replace( string $str, string $replacement, integer $offset, $length = NULL )

Replaces text within a portion of a UTF-8 string.

Replaces text within a portion of a UTF-8 string.

Parameters

$str
string
input string
$replacement
string
replacement string
$offset
integer
offset
$length

Returns

string

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/substr_replace
public static string
# strtolower( string $str )

Makes a UTF-8 string lowercase.

Makes a UTF-8 string lowercase.

Parameters

$str
string
mixed case string

Returns

string

Author

Andreas Gohr <andi@splitbrain.org>

See

http://php.net/strtolower
public static string
# strtoupper( string $str )

Makes a UTF-8 string uppercase.

Makes a UTF-8 string uppercase.

Parameters

$str
string
mixed case string

Returns

string

Author

Andreas Gohr <andi@splitbrain.org>

See

http://php.net/strtoupper
public static string
# ucfirst( string $str )

Makes a UTF-8 string's first character uppercase.

Makes a UTF-8 string's first character uppercase.

Parameters

$str
string
mixed case string

Returns

string

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/ucfirst
public static string
# ucwords( string $str )

Makes the first character of every word in a UTF-8 string uppercase.

Makes the first character of every word in a UTF-8 string uppercase.

Parameters

$str
string
mixed case string

Returns

string

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/ucwords
public static integer
# strcasecmp( string $str1, string $str2 )

Case-insensitive UTF-8 string comparison.

Case-insensitive UTF-8 string comparison.

Parameters

$str1
string
string to compare
$str2
string
string to compare

Returns

integer
less than 0 if str1 is less than str2
integer
greater than 0 if str1 is greater than str2
integer
0 if they are equal

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/strcasecmp
public static string
# str_ireplace( string|array $search, string|array $replace, string|array $str, integer & $count = NULL )

Returns a string or an array with all occurrences of search in subject (ignoring case). replaced with the given replace value.

Returns a string or an array with all occurrences of search in subject (ignoring case). replaced with the given replace value.

Parameters

$search
string|array
text to replace
$replace
string|array
replacement text
$str
string|array
subject text
$count
integer
number of matched and replaced needles will be returned via this parameter which is passed by reference

Returns

string
if the input was a string
array
if the input was an array

Author

Harry Fuecks <hfuecks@gmail.com

See

http://php.net/str_ireplace

Note

It's not fast and gets slower if $search and/or $replace are arrays.
public static string
# stristr( string $str, string $search )

Case-insenstive UTF-8 version of strstr. Returns all of input string from the first occurrence of needle to the end.

Case-insenstive UTF-8 version of strstr. Returns all of input string from the first occurrence of needle to the end.

Parameters

$str
string
input string
$search
string
needle

Returns

string
matched substring if found
boolean
FALSE if the substring was not found

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/stristr
public static integer
# strspn( string $str, string $mask, integer $offset = NULL, integer $length = NULL )

Finds the length of the initial segment matching mask.

Finds the length of the initial segment matching mask.

Parameters

$str
string
input string
$mask
string
mask for search
$offset
integer
start position of the string to examine
$length
integer
length of the string to examine

Returns

integer
length of the initial segment that contains characters in the mask

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/strspn
public static integer
# strcspn( string $str, string $mask, integer $offset = NULL, integer $length = NULL )

Finds the length of the initial segment not matching mask.

Finds the length of the initial segment not matching mask.

Parameters

$str
string
input string
$mask
string
mask for search
$offset
integer
start position of the string to examine
$length
integer
length of the string to examine

Returns

integer
length of the initial segment that contains characters not in the mask

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/strcspn
public static string
# str_pad( string $str, integer $final_str_length, string $pad_str = ' ', string $pad_type = STR_PAD_RIGHT )

Pads a UTF-8 string to a certain length with another string.

Pads a UTF-8 string to a certain length with another string.

Parameters

$str
string
input string
$final_str_length
integer
desired string length after padding
$pad_str
string
string to use as padding
$pad_type
string
padding type: STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH

Returns

string

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/str_pad
public static array
# str_split( string $str, integer $split_length = 1 )

Converts a UTF-8 string to an array.

Converts a UTF-8 string to an array.

Parameters

$str
string
input string
$split_length
integer
maximum length of each chunk

Returns

array

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/str_split
public static string
# strrev( string $str )

Reverses a UTF-8 string.

Reverses a UTF-8 string.

Parameters

$str
string
string to be reversed

Returns

string

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/strrev
public static string
# trim( string $str, string $charlist = NULL )

Strips whitespace (or other UTF-8 characters) from the beginning and end of a string.

Strips whitespace (or other UTF-8 characters) from the beginning and end of a string.

Parameters

$str
string
input string
$charlist
string
string of characters to remove

Returns

string

Author

Andreas Gohr <andi@splitbrain.org>

See

http://php.net/trim
public static string
# ltrim( string $str, string $charlist = NULL )

Strips whitespace (or other UTF-8 characters) from the beginning of a string.

Strips whitespace (or other UTF-8 characters) from the beginning of a string.

Parameters

$str
string
input string
$charlist
string
string of characters to remove

Returns

string

Author

Andreas Gohr <andi@splitbrain.org>

See

http://php.net/ltrim
public static string
# rtrim( string $str, string $charlist = NULL )

Strips whitespace (or other UTF-8 characters) from the end of a string.

Strips whitespace (or other UTF-8 characters) from the end of a string.

Parameters

$str
string
input string
$charlist
string
string of characters to remove

Returns

string

Author

Andreas Gohr <andi@splitbrain.org>

See

http://php.net/rtrim
public static integer
# ord( string $chr )

Returns the unicode ordinal for a character.

Returns the unicode ordinal for a character.

Parameters

$chr
string
UTF-8 encoded character

Returns

integer

Author

Harry Fuecks <hfuecks@gmail.com>

See

http://php.net/ord
public static array
# to_unicode( string $str )

Takes an UTF-8 string and returns an array of ints representing the Unicode characters. Astral planes are supported i.e. the ints in the output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates are not allowed.

Takes an UTF-8 string and returns an array of ints representing the Unicode characters. Astral planes are supported i.e. the ints in the output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates are not allowed.

The Original Code is Mozilla Communicator client code. The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by the Initial Developer are Copyright (C) 1998 the Initial Developer. Ported to PHP by Henri Sivonen <hsivonen@iki .fi>, see http://hsivonen.iki.fi/php-utf8/. Slight modifications to fit with phputf8 library by Harry Fuecks <hfuecks@gmail.com>.

Parameters

$str
string
UTF-8 encoded string

Returns

array
unicode code points
boolean
FALSE if the string is invalid
public static string
# from_unicode( array $arr )

Takes an array of ints representing the Unicode characters and returns a UTF-8 string. Astral planes are supported i.e. the ints in the input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates are not allowed.

Takes an array of ints representing the Unicode characters and returns a UTF-8 string. Astral planes are supported i.e. the ints in the input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates are not allowed.

The Original Code is Mozilla Communicator client code. The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by the Initial Developer are Copyright (C) 1998 the Initial Developer. Ported to PHP by Henri Sivonen <hsivonen@iki .fi>, see http://hsivonen.iki.fi/php-utf8/. Slight modifications to fit with phputf8 library by Harry Fuecks <hfuecks@gmail.com>.

Parameters

$arr
array
unicode code points representing a string

Returns

string
utf8 string of characters
boolean
FALSE if a code point cannot be found
public static
# to_utf8( & $text )
public static
# is_utf8( & $data, $is_strict = true )
public static
# utf8_check( $str, $is_strict = true )

Properties summary

public static array $called array()
#
Joostina CMS / CMF v2.* API API documentation generated by ApiGen 2.6.1 – Template adapted by @olvlv and Joostina Team