aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/utf')
-rw-r--r--phpBB/includes/utf/utf_normalizer.php33
-rw-r--r--phpBB/includes/utf/utf_tools.php20
2 files changed, 18 insertions, 35 deletions
diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php
index 9048a71e51..5f88adaa4c 100644
--- a/phpBB/includes/utf/utf_normalizer.php
+++ b/phpBB/includes/utf/utf_normalizer.php
@@ -93,14 +93,12 @@ class utf_normalizer
// Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together
if (!isset($GLOBALS['utf_nfc_qc']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_nfc_qc.' . PHP_EXT);
}
if (!isset($GLOBALS['utf_canonical_decomp']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_decomp.' . PHP_EXT);
}
// Replace any byte in the range 0x00..0x1F, except for \r, \n and \t
@@ -133,14 +131,12 @@ class utf_normalizer
if (!isset($GLOBALS['utf_nfc_qc']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_nfc_qc.' . PHP_EXT);
}
if (!isset($GLOBALS['utf_canonical_decomp']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_decomp.' . PHP_EXT);
}
$str = self::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']);
@@ -165,14 +161,12 @@ class utf_normalizer
if (!isset($GLOBALS['utf_nfkc_qc']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_nfkc_qc.' . PHP_EXT);
}
if (!isset($GLOBALS['utf_compatibility_decomp']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_compatibility_decomp.' . PHP_EXT);
}
$str = self::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']);
@@ -197,8 +191,7 @@ class utf_normalizer
if (!isset($GLOBALS['utf_canonical_decomp']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_decomp.' . PHP_EXT);
}
$str = self::decompose($str, $pos, $len, $GLOBALS['utf_canonical_decomp']);
@@ -223,8 +216,7 @@ class utf_normalizer
if (!isset($GLOBALS['utf_compatibility_decomp']))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_compatibility_decomp.' . PHP_EXT);
}
$str = self::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']);
@@ -250,15 +242,13 @@ class utf_normalizer
// Load some commonly-used tables
if (!isset($utf_jamo_index, $utf_jamo_type, $utf_combining_class))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_normalizer_common.' . PHP_EXT);
}
// Load the canonical composition table
if (!isset($utf_canonical_comp))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_comp.' . PHP_EXT);
}
// Buffer the last ASCII char before the UTF-8 stuff if applicable
@@ -951,8 +941,7 @@ class utf_normalizer
// Load some commonly-used tables
if (!isset($utf_combining_class))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_normalizer_common.' . PHP_EXT);
}
// UTF char length array
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 5345cc746d..8dbb236a1c 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -634,24 +634,23 @@ function utf8_decode_ncr_callback($m)
function utf8_case_fold($text, $option = 'full')
{
static $uniarray = array();
- global $phpbb_root_path, $phpEx;
// common is always set
if (!isset($uniarray['c']))
{
- $uniarray['c'] = include($phpbb_root_path . 'includes/utf/data/case_fold_c.' . $phpEx);
+ $uniarray['c'] = include(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_c.' . PHP_EXT);
}
// only set full if we need to
if ($option === 'full' && !isset($uniarray['f']))
{
- $uniarray['f'] = include($phpbb_root_path . 'includes/utf/data/case_fold_f.' . $phpEx);
+ $uniarray['f'] = include(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_f.' . PHP_EXT);
}
// only set simple if we need to
if ($option !== 'full' && !isset($uniarray['s']))
{
- $uniarray['s'] = include($phpbb_root_path . 'includes/utf/data/case_fold_s.' . $phpEx);
+ $uniarray['s'] = include(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_s.' . PHP_EXT);
}
// common is always replaced
@@ -1248,15 +1247,13 @@ function utf8_case_fold_nfkc($text, $option = 'full')
"\xF0\x9D\x9E\xBB" => "\xCF\x83",
"\xF0\x9D\x9F\x8A" => "\xCF\x9D",
);
- global $phpbb_root_path, $phpEx;
// do the case fold
$text = utf8_case_fold($text, $option);
if (!class_exists('utf_normalizer'))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT);
}
// convert to NFKC
@@ -1345,7 +1342,6 @@ function utf8_case_fold_nfc($text, $option = 'full')
"\xE1\xBF\xB7" => "\xE1\xBF\xB6\xCD\x85",
"\xE1\xBF\xBC" => "\xCE\xA9\xCD\x85",
);
- global $phpbb_root_path, $phpEx;
// perform a small trick, avoid further normalization on composed points that contain U+0345 in their decomposition
$text = strtr($text, $ypogegrammeni);
@@ -1372,8 +1368,7 @@ function utf8_normalize_nfc($strings)
if (!class_exists('utf_normalizer'))
{
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
+ include(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT);
}
if (!is_array($strings))
@@ -1416,12 +1411,11 @@ function utf8_normalize_nfc($strings)
*/
function utf8_clean_string($text)
{
- global $phpbb_root_path, $phpEx;
-
static $homographs = array();
+
if (empty($homographs))
{
- $homographs = include($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx);
+ $homographs = include(PHPBB_ROOT_PATH . 'includes/utf/data/confusables.' . PHP_EXT);
}
$text = utf8_case_fold_nfkc($text);