mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix most of the coding standards issues in I18n/
There are a number of whitespace related issues in Multibyte, and variable name related ones in I18n that cannot be easily changed.
This commit is contained in:
parent
15e6e9d981
commit
c5be343b72
3 changed files with 22 additions and 17 deletions
|
@ -97,6 +97,8 @@ class I18n {
|
|||
'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME', 'LC_MESSAGES'
|
||||
);
|
||||
|
||||
protected $_escape = null;
|
||||
|
||||
/**
|
||||
* Constructor, use I18n::getInstance() to get the i18n translation object.
|
||||
*
|
||||
|
@ -560,7 +562,7 @@ class I18n {
|
|||
$replacements = array_map('crc32', $mustEscape);
|
||||
$value = str_replace($mustEscape, $replacements, $value);
|
||||
$value = explode(';', $value);
|
||||
$_this->__escape = $escape;
|
||||
$_this->_escape = $escape;
|
||||
foreach ($value as $i => $val) {
|
||||
$val = trim($val, '"');
|
||||
$val = preg_replace_callback('/(?:<)?(.[^>]*)(?:>)?/', array(&$_this, '_parseLiteralValue'), $val);
|
||||
|
@ -585,16 +587,16 @@ class I18n {
|
|||
*/
|
||||
protected function _parseLiteralValue($string) {
|
||||
$string = $string[1];
|
||||
if (substr($string, 0, 2) === $this->__escape . 'x') {
|
||||
$delimiter = $this->__escape . 'x';
|
||||
if (substr($string, 0, 2) === $this->_escape . 'x') {
|
||||
$delimiter = $this->_escape . 'x';
|
||||
return join('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string)))));
|
||||
}
|
||||
if (substr($string, 0, 2) === $this->__escape . 'd') {
|
||||
$delimiter = $this->__escape . 'd';
|
||||
if (substr($string, 0, 2) === $this->_escape . 'd') {
|
||||
$delimiter = $this->_escape . 'd';
|
||||
return join('', array_map('chr', array_filter(explode($delimiter, $string))));
|
||||
}
|
||||
if ($string[0] === $this->__escape && isset($string[1]) && is_numeric($string[1])) {
|
||||
$delimiter = $this->__escape;
|
||||
if ($string[0] === $this->_escape && isset($string[1]) && is_numeric($string[1])) {
|
||||
$delimiter = $this->_escape;
|
||||
return join('', array_map('chr', array_filter(explode($delimiter, $string))));
|
||||
}
|
||||
if (substr($string, 0, 3) === 'U00') {
|
||||
|
@ -622,4 +624,5 @@ class I18n {
|
|||
}
|
||||
return $format;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -469,4 +469,5 @@ class L10n {
|
|||
}
|
||||
return $this->_l10nCatalog;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ if (!function_exists('mb_substr')) {
|
|||
* @return string A converted version of the string represented in ASCII.
|
||||
*/
|
||||
if (!function_exists('mb_encode_mimeheader')) {
|
||||
function mb_encode_mimeheader($str, $charset = 'UTF-8', $transfer_encoding = 'B', $linefeed = "\r\n", $indent = 1) {
|
||||
function mb_encode_mimeheader($str, $charset = 'UTF-8', $transferEncoding = 'B', $linefeed = "\r\n", $indent = 1) {
|
||||
return Multibyte::mimeEncode($str, $charset, $linefeed);
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ class Multibyte {
|
|||
if (isset($needle[0]) && $needle[0] === $check[$position]) {
|
||||
for ($i = 1; $i < $needleCount; $i++) {
|
||||
if ($needle[$i] !== $check[$position + $i]) {
|
||||
if ($needle[$i] === $check[($position + $i) -1]) {
|
||||
if ($needle[$i] === $check[($position + $i) - 1]) {
|
||||
$found = true;
|
||||
}
|
||||
unset($parts[$position - 1]);
|
||||
|
@ -566,7 +566,7 @@ class Multibyte {
|
|||
if (isset($needle[0]) && $needle[0] === $check[$position]) {
|
||||
for ($i = 1; $i < $needleCount; $i++) {
|
||||
if ($needle[$i] !== $check[$position + $i]) {
|
||||
if ($needle[$i] === $check[($position + $i) -1]) {
|
||||
if ($needle[$i] === $check[($position + $i) - 1]) {
|
||||
$found = true;
|
||||
}
|
||||
unset($parts[$position - 1]);
|
||||
|
@ -624,7 +624,7 @@ class Multibyte {
|
|||
if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
|
||||
for ($i = 1; $i < $needleCount; $i++) {
|
||||
if ($needle[$i] !== $haystack[$position + $i]) {
|
||||
if ($needle[$i] === $haystack[($position + $i) -1]) {
|
||||
if ($needle[$i] === $haystack[($position + $i) - 1]) {
|
||||
$position--;
|
||||
$found = true;
|
||||
continue;
|
||||
|
@ -674,7 +674,7 @@ class Multibyte {
|
|||
if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
|
||||
for ($i = 1; $i < $needleCount; $i++) {
|
||||
if ($needle[$i] !== $haystack[$position + $i]) {
|
||||
if ($needle[$i] === $haystack[($position + $i) -1]) {
|
||||
if ($needle[$i] === $haystack[($position + $i) - 1]) {
|
||||
$position--;
|
||||
$found = true;
|
||||
continue;
|
||||
|
@ -767,13 +767,13 @@ class Multibyte {
|
|||
$length = count($utf8Map);
|
||||
$lowerCase = array();
|
||||
|
||||
for ($i = 0 ; $i < $length; $i++) {
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$char = $utf8Map[$i];
|
||||
|
||||
if ($char < 128) {
|
||||
$str = strtolower(chr($char));
|
||||
$strlen = strlen($str);
|
||||
for ($ii = 0 ; $ii < $strlen; $ii++) {
|
||||
for ($ii = 0; $ii < $strlen; $ii++) {
|
||||
$lower = ord(substr($str, $ii, 1));
|
||||
}
|
||||
$lowerCase[] = $lower;
|
||||
|
@ -812,13 +812,13 @@ class Multibyte {
|
|||
$replaced = array();
|
||||
$upperCase = array();
|
||||
|
||||
for ($i = 0 ; $i < $length; $i++) {
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$char = $utf8Map[$i];
|
||||
|
||||
if ($char < 128) {
|
||||
$str = strtoupper(chr($char));
|
||||
$strlen = strlen($str);
|
||||
for ($ii = 0 ; $ii < $strlen; $ii++) {
|
||||
for ($ii = 0; $ii < $strlen; $ii++) {
|
||||
$upper = ord(substr($str, $ii, 1));
|
||||
}
|
||||
$upperCase[] = $upper;
|
||||
|
@ -1007,7 +1007,7 @@ class Multibyte {
|
|||
* @return string
|
||||
*/
|
||||
protected static function _codepoint($decimal) {
|
||||
if ($decimal > 128 && $decimal < 256) {
|
||||
if ($decimal > 128 && $decimal < 256) {
|
||||
$return = '0080_00ff'; // Latin-1 Supplement
|
||||
} elseif ($decimal < 384) {
|
||||
$return = '0100_017f'; // Latin Extended-A
|
||||
|
@ -1103,4 +1103,5 @@ class Multibyte {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue