123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- if (MB_ENABLED === TRUE)
- {
- return;
- }
- if ( ! function_exists('mb_strlen'))
- {
-
- function mb_strlen($str, $encoding = NULL)
- {
- if (ICONV_ENABLED === TRUE)
- {
- return iconv_strlen($str, isset($encoding) ? $encoding : config_item('charset'));
- }
- log_message('debug', 'Compatibility (mbstring): iconv_strlen() is not available, falling back to strlen().');
- return strlen($str);
- }
- }
- if ( ! function_exists('mb_strpos'))
- {
-
- function mb_strpos($haystack, $needle, $offset = 0, $encoding = NULL)
- {
- if (ICONV_ENABLED === TRUE)
- {
- return iconv_strpos($haystack, $needle, $offset, isset($encoding) ? $encoding : config_item('charset'));
- }
- log_message('debug', 'Compatibility (mbstring): iconv_strpos() is not available, falling back to strpos().');
- return strpos($haystack, $needle, $offset);
- }
- }
- if ( ! function_exists('mb_substr'))
- {
-
- function mb_substr($str, $start, $length = NULL, $encoding = NULL)
- {
- if (ICONV_ENABLED === TRUE)
- {
- isset($encoding) OR $encoding = config_item('charset');
- return iconv_substr(
- $str,
- $start,
- isset($length) ? $length : iconv_strlen($str, $encoding),
- $encoding
- );
- }
- log_message('debug', 'Compatibility (mbstring): iconv_substr() is not available, falling back to substr().');
- return isset($length)
- ? substr($str, $start, $length)
- : substr($str, $start);
- }
- }
|