mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/9669] Switch if/else to make the if positive
PHPBB3-9669
This commit is contained in:
parent
6df35c2cb6
commit
6681b2417a
1 changed files with 48 additions and 48 deletions
|
@ -1712,54 +1712,7 @@ function utf8_case_fold_nfc($text, $option = 'full')
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!extension_loaded('intl'))
|
if (extension_loaded('intl'))
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A wrapper function for the normalizer which takes care of including the class if required and modifies the passed strings
|
|
||||||
* to be in NFC (Normalization Form Composition).
|
|
||||||
*
|
|
||||||
* @param mixed $strings a string or an array of strings to normalize
|
|
||||||
* @return mixed the normalized content, preserving array keys if array given.
|
|
||||||
*/
|
|
||||||
function utf8_normalize_nfc($strings)
|
|
||||||
{
|
|
||||||
if (empty($strings))
|
|
||||||
{
|
|
||||||
return $strings;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!class_exists('utf_normalizer'))
|
|
||||||
{
|
|
||||||
global $phpbb_root_path, $phpEx;
|
|
||||||
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_array($strings))
|
|
||||||
{
|
|
||||||
utf_normalizer::nfc($strings);
|
|
||||||
}
|
|
||||||
else if (is_array($strings))
|
|
||||||
{
|
|
||||||
foreach ($strings as $key => $string)
|
|
||||||
{
|
|
||||||
if (is_array($string))
|
|
||||||
{
|
|
||||||
foreach ($string as $_key => $_string)
|
|
||||||
{
|
|
||||||
utf_normalizer::nfc($strings[$key][$_key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
utf_normalizer::nfc($strings[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $strings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* wrapper around PHP's native normalizer from intl
|
* wrapper around PHP's native normalizer from intl
|
||||||
|
@ -1813,6 +1766,53 @@ else
|
||||||
return $strings;
|
return $strings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A wrapper function for the normalizer which takes care of including the class if
|
||||||
|
* required and modifies the passed strings to be in NFC (Normalization Form Composition).
|
||||||
|
*
|
||||||
|
* @param mixed $strings a string or an array of strings to normalize
|
||||||
|
* @return mixed the normalized content, preserving array keys if array given.
|
||||||
|
*/
|
||||||
|
function utf8_normalize_nfc($strings)
|
||||||
|
{
|
||||||
|
if (empty($strings))
|
||||||
|
{
|
||||||
|
return $strings;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!class_exists('utf_normalizer'))
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_array($strings))
|
||||||
|
{
|
||||||
|
utf_normalizer::nfc($strings);
|
||||||
|
}
|
||||||
|
else if (is_array($strings))
|
||||||
|
{
|
||||||
|
foreach ($strings as $key => $string)
|
||||||
|
{
|
||||||
|
if (is_array($string))
|
||||||
|
{
|
||||||
|
foreach ($string as $_key => $_string)
|
||||||
|
{
|
||||||
|
utf_normalizer::nfc($strings[$key][$_key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
utf_normalizer::nfc($strings[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $strings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to generate a "clean" version of a string.
|
* This function is used to generate a "clean" version of a string.
|
||||||
|
|
Loading…
Add table
Reference in a new issue