Typos and a few type hints.
This commit is contained in:
parent
50c89e2bad
commit
12e9df52de
@ -82,7 +82,7 @@ function serendipity_db_begin_transaction()
|
|||||||
return $db->beginTransaction();
|
return $db->beginTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
function serendipity_db_end_transaction($commit)
|
function serendipity_db_end_transaction(bool $commit)
|
||||||
{
|
{
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
$db = DbFactory::createFromConfig($serendipity);
|
$db = DbFactory::createFromConfig($serendipity);
|
||||||
@ -96,7 +96,7 @@ function serendipity_db_in_sql($col, &$search_ids, $type = ' OR ')
|
|||||||
return $db->inSql($col, $search_ids, $type);
|
return $db->inSql($col, $search_ids, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
function serendipity_db_escape_string($string)
|
function serendipity_db_escape_string(string $string): string
|
||||||
{
|
{
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
$db = DbFactory::createFromConfig($serendipity);
|
$db = DbFactory::createFromConfig($serendipity);
|
||||||
@ -166,7 +166,7 @@ function serendipity_db_probe($hash, &$errs)
|
|||||||
return $db->probe($hash, $errs);
|
return $db->probe($hash, $errs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function serendipity_utf8mb4_ready()
|
function serendipity_utf8mb4_ready(): bool
|
||||||
{
|
{
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
$db = DbFactory::createFromConfig($serendipity);
|
$db = DbFactory::createFromConfig($serendipity);
|
||||||
|
@ -60,17 +60,17 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
|
|||||||
@mb_internal_encoding(LANG_CHARSET);
|
@mb_internal_encoding(LANG_CHARSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for multibyte string operations
|
* Wrapper for multibyte string operations
|
||||||
*
|
*
|
||||||
* Multibyte string functions wrapper:
|
* Multibyte string functions wrapper:
|
||||||
* strlen(), strpos(), strrpos(), strtolower(), strtoupper(), substr(), ucfirst()
|
* strlen(), strpos(), strrpos(), strtolower(), strtoupper(), substr(), ucfirst()
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @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() {
|
function serendipity_mb(string $func, ...$args) {
|
||||||
static $mbstring = null;
|
static $mbstring = null;
|
||||||
|
|
||||||
if (is_null($mbstring)) {
|
if (is_null($mbstring)) {
|
||||||
@ -82,18 +82,14 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = func_get_args();
|
|
||||||
$func = $args[0];
|
|
||||||
unset($args[0]);
|
|
||||||
|
|
||||||
switch($func) {
|
switch($func) {
|
||||||
case 'ucfirst':
|
case 'ucfirst':
|
||||||
// there's no mb_ucfirst, so emulate it
|
// there's no mb_ucfirst, so emulate it
|
||||||
if ($mbstring === 2) {
|
if ($mbstring === 2) {
|
||||||
$enc = LANG_CHARSET;
|
$enc = LANG_CHARSET;
|
||||||
return mb_strtoupper(mb_substr($args[1], 0, 1, $enc), $enc) . mb_substr($args[1], 1, mb_strlen($args[1], $enc), $enc);
|
return mb_strtoupper(mb_substr($args[0], 0, 1, $enc), $enc) . mb_substr($args[0], 1, mb_strlen($args[0], $enc), $enc);
|
||||||
} else {
|
} else {
|
||||||
return ucfirst($args[1]);
|
return ucfirst($args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'strtolower':
|
case 'strtolower':
|
||||||
|
@ -363,7 +363,7 @@ abstract class DbAbstract
|
|||||||
*
|
*
|
||||||
* @return boolean Whether the database could support utf8mb4
|
* @return boolean Whether the database could support utf8mb4
|
||||||
*/
|
*/
|
||||||
public function isUtf8mb4Ready()
|
public function isUtf8mb4Ready(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ class MysqliDatabase extends DbAbstract
|
|||||||
*
|
*
|
||||||
* @return boolean Whether the database could support utf8mb4
|
* @return boolean Whether the database could support utf8mb4
|
||||||
*/
|
*/
|
||||||
public function isUtf8mb4Ready()
|
public function isUtf8mb4Ready(): bool
|
||||||
{
|
{
|
||||||
$mysql_version = mysqli_get_server_info($this->db_conn);
|
$mysql_version = mysqli_get_server_info($this->db_conn);
|
||||||
$maria = false;
|
$maria = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user