Implement serendipity_mb_ucfirst() as that's not available.
This commit is contained in:
parent
f4bd9bc07a
commit
25b8dbcb42
@ -188,7 +188,7 @@ function serendipity_formatTime($format, $time, $useOffset = true, $useDate = fa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return serendipity_mb('ucfirst', serendipity_strftime($cache[$format], (int)$time, $useOffset, $useDate));
|
return serendipity_mb_ucfirst(serendipity_strftime($cache[$format], (int)$time, $useOffset, $useDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,43 +68,10 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
|
|||||||
* @param mixed Any input array, dynamically evaluated for best emulation
|
* @param mixed Any input array, dynamically evaluated for best emulation
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function serendipity_mb(string $func, ...$args) {
|
function serendipity_mb_ucfirst(string $str)
|
||||||
static $mbstring = null;
|
{
|
||||||
|
// there's no mb_ucfirst, so emulate it
|
||||||
if (is_null($mbstring)) {
|
return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1);
|
||||||
$mbstring = (extension_loaded('mbstring') && @mb_internal_encoding(LANG_CHARSET) ? 1 : 0);
|
|
||||||
if ($mbstring === 1) {
|
|
||||||
if (function_exists('mb_strtoupper')) {
|
|
||||||
$mbstring = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch($func) {
|
|
||||||
case 'ucfirst':
|
|
||||||
// there's no mb_ucfirst, so emulate it
|
|
||||||
if ($mbstring === 2) {
|
|
||||||
$enc = LANG_CHARSET;
|
|
||||||
return mb_strtoupper(mb_substr($args[0], 0, 1, $enc), $enc) . mb_substr($args[0], 1, mb_strlen($args[0], $enc), $enc);
|
|
||||||
} else {
|
|
||||||
return ucfirst($args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'strtolower':
|
|
||||||
case 'strtoupper':
|
|
||||||
if ($mbstring === 2) {
|
|
||||||
return call_user_func_array('mb_' . $func, $args);
|
|
||||||
} else {
|
|
||||||
return call_user_func_array($func, $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
if ($mbstring) {
|
|
||||||
return call_user_func_array('mb_' . $func, $args);
|
|
||||||
} else {
|
|
||||||
return call_user_func_array($func, $args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
define('serendipity_MB_LOADED', true);
|
define('serendipity_MB_LOADED', true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user