Skip to content

Commit

Permalink
Removing Multibyte dependency from the core
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Sep 28, 2012
1 parent 29192ab commit 8735268
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 30 deletions.
8 changes: 2 additions & 6 deletions lib/Cake/I18n/I18n.php
Expand Up @@ -21,15 +21,11 @@
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\I18n\Multibyte;
use Cake\Utility\Hash;
use Cake\Utility\Inflector;

if (function_exists('mb_internal_encoding')) {
$encoding = Configure::read('App.encoding');
if (!empty($encoding)) {
mb_internal_encoding($encoding);
}
}
mb_internal_encoding(Configure::read('App.encoding'));

/**
* I18n handles translation of Text and time format strings.
Expand Down
8 changes: 0 additions & 8 deletions lib/Cake/Utility/String.php
Expand Up @@ -439,10 +439,6 @@ public static function tail($text, $length = 100, $options = array()) {
$options = array_merge($default, $options);
extract($options);

if (!function_exists('mb_strlen')) {
class_exists('Cake\I18n\Multibyte');
}

if (mb_strlen($text) <= $length) {
return $text;
}
Expand Down Expand Up @@ -486,10 +482,6 @@ public static function truncate($text, $length = 100, $options = array()) {
$options = array_merge($default, $options);
extract($options);

if (!function_exists('mb_strlen')) {
class_exists('Multibyte');
}

if ($html) {
if (mb_strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
return $text;
Expand Down
12 changes: 2 additions & 10 deletions lib/Cake/Utility/Time.php
Expand Up @@ -20,7 +20,6 @@
namespace Cake\Utility;

use Cake\Core\Configure;
use Cake\I18n\Multibyte;

/**
* Time Helper class for easy use of time data.
Expand Down Expand Up @@ -1040,15 +1039,8 @@ protected static function _strftime($format, $date) {
$format = strftime($format, $date);
$encoding = Configure::read('App.encoding');

if (!empty($encoding) && $encoding === 'UTF-8') {
if (function_exists('mb_check_encoding')) {
$valid = mb_check_encoding($format, $encoding);
} else {
$valid = !Multibyte::checkMultibyte($format);
}
if (!$valid) {
$format = utf8_encode($format);
}
if ($encoding === 'UTF-8' && !mb_check_encoding($format, $encoding)) {
$format = utf8_encode($format);
}
return $format;
}
Expand Down
5 changes: 0 additions & 5 deletions lib/Cake/Utility/Validation.php
Expand Up @@ -21,11 +21,6 @@
use Cake\Error\Exception;
use Cake\Utility\File;

// Load multibyte if the extension is missing.
if (!function_exists('mb_strlen')) {
class_exists('Cake\I18n\Multibyte');
}

/**
* Offers different validation methods.
*
Expand Down
1 change: 0 additions & 1 deletion lib/Cake/View/Helper/TimeHelper.php
Expand Up @@ -21,7 +21,6 @@
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Error;
use Cake\I18n\Multibyte;
use Cake\Utility\Hash;
use Cake\View\Helper;
use Cake\View\View;
Expand Down

0 comments on commit 8735268

Please sign in to comment.