aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf/utf_tools.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-11-15 15:35:50 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-11-15 15:35:50 +0000
commit548cc2c10b56cc9e5c71c2f87356947939abe888 (patch)
tree82a2ceac1eb474aad83281f5d5b4fe94b0ad4d92 /phpBB/includes/utf/utf_tools.php
parent979e36077fa6ae9bbee81bacaaef029aa13c6df0 (diff)
downloadforums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar
forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.gz
forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.bz2
forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.xz
forums-548cc2c10b56cc9e5c71c2f87356947939abe888.zip
- fixes for the following bugs:
#5326 #5318 #5304 #5290 #5288 #5278 #5276 #5272 #5266 - also fixed the "Call-time pass-by-reference" bug #5252 - within this step changed the normalize calls to require references. - added captcha size variables to the class scope (suggestion was posted at area51) git-svn-id: file:///svn/phpbb/trunk@6584 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/utf/utf_tools.php')
-rw-r--r--phpBB/includes/utf/utf_tools.php41
1 files changed, 23 insertions, 18 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index b91fd51c20..b181023f57 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -933,30 +933,35 @@ function utf8_case_fold($text, $option = 'full')
* 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 Either an array of references to strings, a reference to an array of strings or a reference to a single string
+* @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 (!is_array($strings) || (sizeof($strings) > 0))
- {
- if (!class_exists('utf_normalizer'))
- {
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
- }
+ if (empty($strings))
+ {
+ return $strings;
+ }
- if (is_array($strings))
- {
- foreach ($strings as $key => $string)
- {
- $strings[$key] = utf_normalizer::nfc($strings[$key]);
- }
- }
- else
+ 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)
{
- $strings = utf_normalizer::nfc($strings);
+ utf_normalizer::nfc($strings[$key]);
}
}
+
+ return $strings;
}
/**
@@ -982,7 +987,7 @@ function utf8_clean_string($text)
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
}
- $text = utf_normalizer::nfc($text);
+ utf_normalizer::nfc($text);
static $homographs = array(
// cyrllic