From 6681b2417a3f87a666c816658a2daab8a464e233 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 6 Mar 2011 21:39:42 +0100 Subject: [PATCH] [ticket/9669] Switch if/else to make the if positive PHPBB3-9669 --- phpBB/includes/utf/utf_tools.php | 96 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 34f9633677..3ee121a179 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1712,54 +1712,7 @@ function utf8_case_fold_nfc($text, $option = 'full') return $text; } -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 +if (extension_loaded('intl')) { /** * wrapper around PHP's native normalizer from intl @@ -1813,6 +1766,53 @@ else 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.