Skip to content

Commit

Permalink
Updated I18n folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 25, 2012
1 parent acb44bf commit 206aca5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
18 changes: 9 additions & 9 deletions lib/Cake/I18n/I18n.php
Expand Up @@ -16,13 +16,13 @@
* @since CakePHP(tm) v 1.2.0.4116
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

/**
* Included libraries.
*/
App::uses('CakePlugin', 'Core');
App::uses('L10n', 'I18n');
App::uses('Multibyte', 'I18n');
namespace Cake\I18n;
use Cake\Core\Configure,
Cake\Core\Plugin,
Cake\Core\App,
Cake\Cache\Cache,
Cake\Utility\Hash,
Cake\Utility\Inflector;

if (function_exists('mb_internal_encoding')) {
$encoding = Configure::read('App.encoding');
Expand Down Expand Up @@ -304,13 +304,13 @@ protected function _bindTextDomain($domain) {
$core = true;
$merge = array();
$searchPaths = App::path('locales');
$plugins = CakePlugin::loaded();
$plugins = Plugin::loaded();

if (!empty($plugins)) {
foreach ($plugins as $plugin) {
$pluginDomain = Inflector::underscore($plugin);
if ($pluginDomain === $domain) {
$searchPaths[] = CakePlugin::path($plugin) . 'Locale' . DS;
$searchPaths[] = Plugin::path($plugin) . 'Locale' . DS;
$searchPaths = array_reverse($searchPaths);
break;
}
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/I18n/L10n.php
Expand Up @@ -16,7 +16,9 @@
* @since CakePHP(tm) v 1.2.0.4116
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeRequest', 'Network');
namespace Cake\I18n;
use Cake\Core\Configure,
Cake\Network\Request;

/**
* Localization
Expand Down Expand Up @@ -407,7 +409,7 @@ protected function _setLanguage($language = null) {
* @return boolean Success
*/
protected function _autoLanguage() {
$_detectableLanguages = CakeRequest::acceptLanguage();
$_detectableLanguages = Request::acceptLanguage();
foreach ($_detectableLanguages as $key => $langKey) {
if (isset($this->_l10nCatalog[$langKey])) {
$this->_setLanguage($langKey);
Expand Down
29 changes: 14 additions & 15 deletions lib/Cake/I18n/Multibyte.php
Expand Up @@ -17,6 +17,8 @@
* @since CakePHP(tm) v 1.2.0.6833
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace {
use Cake\I18n\Multibyte;

if (!function_exists('mb_stripos')) {

Expand Down Expand Up @@ -273,6 +275,12 @@ function mb_encode_mimeheader($str, $charset = 'UTF-8', $transferEncoding = 'B',

}

}

namespace Cake\I18n {
use Cake\Configure\PhpReader,
Cake\Core\Configure;

/**
* Multibyte handling methods.
*
Expand Down Expand Up @@ -395,9 +403,7 @@ public static function stripos($haystack, $needle, $offset = 0) {
* @return integer|boolean The portion of $haystack, or false if $needle is not found.
*/
public static function stristr($haystack, $needle, $part = false) {
$php = (PHP_VERSION < 5.3);

if (($php && $part) || Multibyte::checkMultibyte($haystack)) {
if (Multibyte::checkMultibyte($haystack)) {
$check = Multibyte::strtoupper($haystack);
$check = Multibyte::utf8($check);
$found = false;
Expand Down Expand Up @@ -438,10 +444,7 @@ public static function stristr($haystack, $needle, $part = false) {
return false;
}

if (!$php) {
return stristr($haystack, $needle, $part);
}
return stristr($haystack, $needle);
return stristr($haystack, $needle, $part);
}

/**
Expand Down Expand Up @@ -735,9 +738,7 @@ public static function strrpos($haystack, $needle, $offset = 0) {
* @return string|boolean The portion of $haystack, or true if $needle is not found.
*/
public static function strstr($haystack, $needle, $part = false) {
$php = (PHP_VERSION < 5.3);

if (($php && $part) || Multibyte::checkMultibyte($haystack)) {
if (Multibyte::checkMultibyte($haystack)) {
$check = Multibyte::utf8($haystack);
$found = false;

Expand Down Expand Up @@ -776,10 +777,7 @@ public static function strstr($haystack, $needle, $part = false) {
return false;
}

if (!$php) {
return strstr($haystack, $needle, $part);
}
return strstr($haystack, $needle);
return strstr($haystack, $needle, $part);
}

/**
Expand Down Expand Up @@ -1090,7 +1088,6 @@ protected static function _find($char, $type = 'lower') {
return null;
}
if (!Configure::configured('_cake_core_')) {
App::uses('PhpReader', 'Configure');
Configure::config('_cake_core_', new PhpReader(CAKE . 'Config' . DS));
}
Configure::load('unicode' . DS . 'casefolding' . DS . $range, '_cake_core_');
Expand Down Expand Up @@ -1132,3 +1129,5 @@ public static function checkMultibyte($string) {
}

}

}

0 comments on commit 206aca5

Please sign in to comment.