diff options
Diffstat (limited to 'engine/lib/mb_wrapper.php')
-rw-r--r-- | engine/lib/mb_wrapper.php | 113 |
1 files changed, 56 insertions, 57 deletions
diff --git a/engine/lib/mb_wrapper.php b/engine/lib/mb_wrapper.php index 6221f4aa1..2cef15c64 100644 --- a/engine/lib/mb_wrapper.php +++ b/engine/lib/mb_wrapper.php @@ -1,62 +1,61 @@ <?php - /** - * Elgg wrapper functions for multibyte string support. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * Elgg wrapper functions for multibyte string support. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - /** - * Wrapper function: Returns the result of mb_strtolower if mb_support is present, else the - * result of strtolower is returned. - * - * @param string $string The string. - * @param string $charset The charset (if multibyte support is present) : default 'UTF8' - * @return string - */ - function elgg_strtolower($string, $charset = 'UTF8') - { - if (is_callable('mb_strtolower')) - return mb_strtolower($string, $charset); - - return strtolower($string); +/** + * Wrapper function: Returns the result of mb_strtolower if mb_support is present, else the + * result of strtolower is returned. + * + * @param string $string The string. + * @param string $charset The charset (if multibyte support is present) : default 'UTF8' + * @return string + */ +function elgg_strtolower($string, $charset = 'UTF8') { + if (is_callable('mb_strtolower')) { + return mb_strtolower($string, $charset); } - - /** - * Wrapper function: Returns the result of mb_strtoupper if mb_support is present, else the - * result of strtoupper is returned. - * - * @param string $string The string. - * @param string $charset The charset (if multibyte support is present) : default 'UTF8' - * @return string - */ - function elgg_strtoupper($string, $charset = 'UTF8') - { - if (is_callable('mb_strtoupper')) - return mb_strtoupper($string, $charset); - - return strtoupper($string); + + return strtolower($string); +} + +/** + * Wrapper function: Returns the result of mb_strtoupper if mb_support is present, else the + * result of strtoupper is returned. + * + * @param string $string The string. + * @param string $charset The charset (if multibyte support is present) : default 'UTF8' + * @return string + */ +function elgg_strtoupper($string, $charset = 'UTF8') { + if (is_callable('mb_strtoupper')) { + return mb_strtoupper($string, $charset); } - - /** - * Wrapper function: Returns the result of mb_substr if mb_support is present, else the - * result of substr is returned. - * - * @param string $string The string. - * @param int $start Start position. - * @param int $length Length. - * @param string $charset The charset (if multibyte support is present) : default 'UTF8' - * @return string - */ - function elgg_substr($string, $start = 0, $length = null, $charset = 'UTF8') - { - if (is_callable('mb_substr')) - return mb_substr($string, $start, $length, $charset); - - return substr($string, $start, $length); + + return strtoupper($string); +} + +/** + * Wrapper function: Returns the result of mb_substr if mb_support is present, else the + * result of substr is returned. + * + * @param string $string The string. + * @param int $start Start position. + * @param int $length Length. + * @param string $charset The charset (if multibyte support is present) : default 'UTF8' + * @return string + */ +function elgg_substr($string, $start = 0, $length = null, $charset = 'UTF8') { + if (is_callable('mb_substr')) { + return mb_substr($string, $start, $length, $charset); } - - // TODO: Other wrapper functions -?>
\ No newline at end of file + + return substr($string, $start, $length); +} + +// TODO: Other wrapper functions
\ No newline at end of file |