mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- small opti/bugfix in normalizer git-svn-id: file:///svn/phpbb/trunk@6593 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
311c0d8e4f
commit
8b0e11a4c9
2 changed files with 14 additions and 12 deletions
|
@ -322,16 +322,11 @@ class utf_normalizer
|
||||||
*/
|
*/
|
||||||
if ($utf_char[0] >= "\xF8")
|
if ($utf_char[0] >= "\xF8")
|
||||||
{
|
{
|
||||||
if ($utf_char[0] < "\xF8")
|
if ($utf_char[0] < "\xFC")
|
||||||
{
|
|
||||||
$trailing_bytes = 3;
|
|
||||||
}
|
|
||||||
else if ($utf_char[0] < "\xFC")
|
|
||||||
{
|
{
|
||||||
$trailing_bytes = 4;
|
$trailing_bytes = 4;
|
||||||
}
|
}
|
||||||
|
else if ($utf_char[0] > "\xFD")
|
||||||
if ($utf_char[0] > "\xFD")
|
|
||||||
{
|
{
|
||||||
$trailing_bytes = 0;
|
$trailing_bytes = 0;
|
||||||
}
|
}
|
||||||
|
@ -931,7 +926,7 @@ class utf_normalizer
|
||||||
*/
|
*/
|
||||||
function decompose($str, $pos, $len, &$decomp_map)
|
function decompose($str, $pos, $len, &$decomp_map)
|
||||||
{
|
{
|
||||||
global $utf_combining_class, $utf_canonical_decomp, $phpbb_root_path;
|
global $utf_combining_class, $phpbb_root_path;
|
||||||
|
|
||||||
// Load some commonly-used tables
|
// Load some commonly-used tables
|
||||||
if (!isset($utf_combining_class))
|
if (!isset($utf_combining_class))
|
||||||
|
|
|
@ -126,8 +126,15 @@ if (extension_loaded('mbstring'))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_null($offset))
|
||||||
|
{
|
||||||
return mb_strrpos($str, $search);
|
return mb_strrpos($str, $search);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mb_strrpos($str, $search, $offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -138,7 +145,7 @@ if (extension_loaded('mbstring'))
|
||||||
function utf8_strrpos($str, $needle, $offset = null)
|
function utf8_strrpos($str, $needle, $offset = null)
|
||||||
{
|
{
|
||||||
// offset for mb_strrpos was added in 5.2.0
|
// offset for mb_strrpos was added in 5.2.0
|
||||||
if ($offset === false)
|
if (is_null($offset))
|
||||||
{
|
{
|
||||||
// Emulate behaviour of strrpos rather than raising warning
|
// Emulate behaviour of strrpos rather than raising warning
|
||||||
if (empty($str))
|
if (empty($str))
|
||||||
|
@ -174,7 +181,7 @@ if (extension_loaded('mbstring'))
|
||||||
*/
|
*/
|
||||||
function utf8_strpos($str, $needle, $offset = null)
|
function utf8_strpos($str, $needle, $offset = null)
|
||||||
{
|
{
|
||||||
if ($offset === false)
|
if (is_null($offset))
|
||||||
{
|
{
|
||||||
return mb_strpos($str, $needle);
|
return mb_strpos($str, $needle);
|
||||||
}
|
}
|
||||||
|
@ -208,7 +215,7 @@ if (extension_loaded('mbstring'))
|
||||||
*/
|
*/
|
||||||
function utf8_substr($str, $offset, $length = null)
|
function utf8_substr($str, $offset, $length = null)
|
||||||
{
|
{
|
||||||
if ($length === false)
|
if (is_null($length))
|
||||||
{
|
{
|
||||||
return mb_substr($str, $offset);
|
return mb_substr($str, $offset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue