mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Merge pull request #2066 from Waterticket/develop
fix deprecated warnings
This commit is contained in:
commit
4c15e8fef5
3 changed files with 51 additions and 51 deletions
|
|
@ -50,13 +50,13 @@ class DBQueryParser extends BaseParser
|
|||
|
||||
// Load attributes that only apply to subqueries in the <conditions> block.
|
||||
$query->operation = $attribs['operation'] ?? null;
|
||||
$query->column = preg_replace('/[^a-z0-9_\.]/i', '', $attribs['column'] ?? null) ?: null;
|
||||
$query->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND';
|
||||
$query->column = preg_replace('/[^a-z0-9_\.]/i', '', $attribs['column'] ?? '') ?: null;
|
||||
$query->pipe = strtoupper($attribs['pipe'] ?? '') ?: 'AND';
|
||||
|
||||
// Load tables.
|
||||
foreach ($xml->tables ? $xml->tables->children() : [] as $tag)
|
||||
{
|
||||
if (trim($tag['query']) === 'true')
|
||||
if (trim($tag['query'] ?: '') === 'true')
|
||||
{
|
||||
$table = self::_parseQuery($tag);
|
||||
$query->tables[$table->alias] = $table;
|
||||
|
|
@ -65,11 +65,11 @@ class DBQueryParser extends BaseParser
|
|||
{
|
||||
$table = new DBQuery\Table;
|
||||
$table->name = trim($tag['name']);
|
||||
$table->alias = trim($tag['alias']) ?: null;
|
||||
$table->ifvar = trim($tag['if']) ?: null;
|
||||
$table->alias = trim($tag['alias'] ?: '') ?: null;
|
||||
$table->ifvar = trim($tag['if'] ?: '') ?: null;
|
||||
}
|
||||
|
||||
$table_type = trim($tag['type']);
|
||||
$table_type = trim($tag['type'] ?: '');
|
||||
if (stripos($table_type, 'join') !== false)
|
||||
{
|
||||
$table->join_type = strtoupper($table_type);
|
||||
|
|
@ -84,7 +84,7 @@ class DBQueryParser extends BaseParser
|
|||
// Load index hints.
|
||||
foreach ($xml->index_hint ?: [] as $index_hint_group)
|
||||
{
|
||||
$index_hint_target_db = strtolower(trim($index_hint_group['for']));
|
||||
$index_hint_target_db = strtolower(trim($index_hint_group['for'] ?: ''));
|
||||
if ($index_hint_target_db !== '' && $index_hint_target_db !== 'all')
|
||||
{
|
||||
$index_hint_target_db = explode(',', $index_hint_target_db);
|
||||
|
|
@ -99,17 +99,17 @@ class DBQueryParser extends BaseParser
|
|||
{
|
||||
$index_hint = new DBQuery\IndexHint;
|
||||
$index_hint->target_db = $index_hint_target_db;
|
||||
$index_hint->hint_type = strtoupper(trim($tag['type'])) ?: 'USE';
|
||||
$index_hint->index_name = trim($tag['name']) ?: '';
|
||||
$index_hint->table_name = trim($tag['table']) ?: '';
|
||||
$index_hint->ifvar = trim($tag['if']) ?: null;
|
||||
if (isset($tag['var']) && trim($tag['var']))
|
||||
$index_hint->hint_type = strtoupper(trim($tag['type'] ?: '')) ?: 'USE';
|
||||
$index_hint->index_name = trim($tag['name'] ?: '') ?: '';
|
||||
$index_hint->table_name = trim($tag['table'] ?: '') ?: '';
|
||||
$index_hint->ifvar = trim($tag['if'] ?: '') ?: null;
|
||||
if (isset($tag['var']) && trim($tag['var'] ?: ''))
|
||||
{
|
||||
$index_hint->var = trim($tag['var']);
|
||||
$index_hint->var = trim($tag['var'] ?: '');
|
||||
}
|
||||
if (isset($tag['default']) && trim($tag['default']))
|
||||
if (isset($tag['default']) && trim($tag['default'] ?: ''))
|
||||
{
|
||||
$index_hint->index_name = trim($tag['default']);
|
||||
$index_hint->index_name = trim($tag['default'] ?: '');
|
||||
}
|
||||
if ($index_hint->index_name || $index_hint->var)
|
||||
{
|
||||
|
|
@ -123,15 +123,15 @@ class DBQueryParser extends BaseParser
|
|||
{
|
||||
if ($tag->getName() === 'query')
|
||||
{
|
||||
$subquery = self::_parseQuery($tag, trim($tag['id']));
|
||||
$subquery = self::_parseQuery($tag, trim($tag['id'] ?: ''));
|
||||
$query->columns[] = $subquery;
|
||||
}
|
||||
elseif ($query->type === 'SELECT')
|
||||
{
|
||||
$column = new DBQuery\ColumnRead;
|
||||
$column->name = trim($tag['name']);
|
||||
$column->alias = trim($tag['alias']) ?: null;
|
||||
$column->ifvar = trim($tag['if']) ?: null;
|
||||
$column->alias = trim($tag['alias'] ?: '') ?: null;
|
||||
$column->ifvar = trim($tag['if'] ?: '') ?: null;
|
||||
if ($column->name === '*' || preg_match('/\.\*$/', $column->name))
|
||||
{
|
||||
$column->is_wildcard = true;
|
||||
|
|
@ -169,13 +169,13 @@ class DBQueryParser extends BaseParser
|
|||
if ($xml->groups)
|
||||
{
|
||||
$query->groupby = new DBQuery\GroupBy;
|
||||
$query->groupby->ifvar = trim($xml->groups['if']) ?: null;
|
||||
$query->groupby->ifvar = trim($xml->groups['if'] ?: '') ?: null;
|
||||
foreach ($xml->groups->children() as $tag)
|
||||
{
|
||||
$name = $tag->getName();
|
||||
if ($name === 'group')
|
||||
{
|
||||
$query->groupby->columns[] = trim($tag['column']);
|
||||
$query->groupby->columns[] = trim($tag['column'] ?: '');
|
||||
}
|
||||
elseif ($name === 'having')
|
||||
{
|
||||
|
|
@ -203,8 +203,8 @@ class DBQueryParser extends BaseParser
|
|||
if ($tag = $xml->navigation->{$key})
|
||||
{
|
||||
$query->navigation->{$key} = new DBQuery\VariableBase;
|
||||
$query->navigation->{$key}->var = trim($tag['var']) ?: null;
|
||||
$query->navigation->{$key}->default = trim($tag['default']) ?: null;
|
||||
$query->navigation->{$key}->var = trim($tag['var'] ?: '') ?: null;
|
||||
$query->navigation->{$key}->default = trim($tag['default'] ?: '') ?: null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ class DBQueryParser extends BaseParser
|
|||
}
|
||||
|
||||
// Check the SELECT DISTINCT flag.
|
||||
if ($xml->columns && $select_distinct = trim($xml->columns['distinct']))
|
||||
if ($xml->columns && $select_distinct = trim($xml->columns['distinct'] ?: ''))
|
||||
{
|
||||
if ($select_distinct === 'distinct' || toBool($select_distinct))
|
||||
{
|
||||
|
|
@ -273,7 +273,7 @@ class DBQueryParser extends BaseParser
|
|||
$cond->filter = $attribs['filter'] ?? null;
|
||||
$cond->minlength = intval($attribs['minlength'] ?? 0, 10);
|
||||
$cond->maxlength = intval($attribs['maxlength'] ?? 0, 10);
|
||||
$cond->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND';
|
||||
$cond->pipe = strtoupper($attribs['pipe'] ?? '') ?: 'AND';
|
||||
$result[] = $cond;
|
||||
}
|
||||
elseif ($name === 'group')
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class ModuleActionParser extends BaseParser
|
|||
{
|
||||
$grant_info = new \stdClass;
|
||||
$grant_info->title = self::_getChildrenByLang($grant, 'title', $lang);
|
||||
$grant_info->default = trim($grant['default']);
|
||||
$grant_info->default = trim($grant['default'] ?: '');
|
||||
$grant_name = trim($grant['name']);
|
||||
$info->grant->{$grant_name} = $grant_info;
|
||||
}
|
||||
|
|
@ -70,8 +70,8 @@ class ModuleActionParser extends BaseParser
|
|||
$menu_info->title = self::_getChildrenByLang($menu, 'title', $lang);
|
||||
$menu_info->index = null;
|
||||
$menu_info->acts = array();
|
||||
$menu_info->type = trim($menu['type']);
|
||||
$menu_name = trim($menu['name']);
|
||||
$menu_info->type = trim($menu['type'] ?: '');
|
||||
$menu_name = trim($menu['name'] ?: '');
|
||||
$info->menu->{$menu_name} = $menu_info;
|
||||
}
|
||||
|
||||
|
|
@ -87,12 +87,12 @@ class ModuleActionParser extends BaseParser
|
|||
if ($permission)
|
||||
{
|
||||
$permission_info->target = $permission;
|
||||
$permission_info->check_var = trim($action['check_var']) ?: trim($action['check-var']);
|
||||
$permission_info->check_type = trim($action['check_type']) ?: trim($action['check-type']);
|
||||
$permission_info->check_var = trim($action['check_var'] ?: '') ?: trim($action['check-var'] ?: '');
|
||||
$permission_info->check_type = trim($action['check_type'] ?: '') ?: trim($action['check-type'] ?: '');
|
||||
}
|
||||
|
||||
// Parse the list of allowed HTTP methods.
|
||||
$method_attr = trim($action['method']);
|
||||
$method_attr = trim($action['method'] ?: '');
|
||||
if ($method_attr)
|
||||
{
|
||||
$methods = explode('|', strtoupper($method_attr));
|
||||
|
|
@ -111,14 +111,14 @@ class ModuleActionParser extends BaseParser
|
|||
}
|
||||
|
||||
// Parse routes.
|
||||
$global_route = (trim($action['global_route']) ?: trim($action['global-route'])) === 'true' ? 'true' : 'false';
|
||||
$route_attr = trim($action['route']);
|
||||
$global_route = (trim($action['global_route'] ?: '') ?: trim($action['global-route'] ?: '')) === 'true' ? 'true' : 'false';
|
||||
$route_attr = trim($action['route'] ?: '');
|
||||
$route_tags = $action->route ?: [];
|
||||
$route_arg = [];
|
||||
if ($route_attr || count($route_tags))
|
||||
{
|
||||
$routes = $route_attr ? array_map(function($route) {
|
||||
return ['route' => trim($route), 'priority' => 0];
|
||||
return ['route' => trim($route ?: ''), 'priority' => 0];
|
||||
}, explode_with_escape('|', $route_attr)) : array();
|
||||
foreach ($route_tags as $route_tag)
|
||||
{
|
||||
|
|
@ -142,7 +142,7 @@ class ModuleActionParser extends BaseParser
|
|||
}
|
||||
elseif ($action_class)
|
||||
{
|
||||
$standalone = trim($action['standalone']);
|
||||
$standalone = trim($action['standalone'] ?: '');
|
||||
if (!$standalone || !in_array($standalone, ['true', 'false', 'auto']))
|
||||
{
|
||||
$standalone = 'auto';
|
||||
|
|
@ -150,7 +150,7 @@ class ModuleActionParser extends BaseParser
|
|||
}
|
||||
else
|
||||
{
|
||||
$standalone = trim($action['standalone']);
|
||||
$standalone = trim($action['standalone'] ?: '');
|
||||
if (!$standalone || !in_array($standalone, ['true', 'false', 'auto']))
|
||||
{
|
||||
$standalone = 'true';
|
||||
|
|
@ -178,19 +178,19 @@ class ModuleActionParser extends BaseParser
|
|||
$action_info = new \stdClass;
|
||||
$action_info->type = $action_type;
|
||||
$action_info->class_name = preg_replace('/\\\\+/', '\\\\', $action_class);
|
||||
$action_info->grant = trim($action['grant']) ?: 'guest';
|
||||
$action_info->grant = trim($action['grant'] ?: '') ?: 'guest';
|
||||
$action_info->permission = $permission_info;
|
||||
$action_info->ruleset = trim($action['ruleset']);
|
||||
$action_info->ruleset = trim($action['ruleset'] ?: '');
|
||||
$action_info->method = implode('|', $methods);
|
||||
$action_info->route = $route_arg;
|
||||
$action_info->standalone = $standalone;
|
||||
$action_info->check_csrf = (trim($action['check_csrf']) ?: trim($action['check-csrf'])) === 'false' ? 'false' : 'true';
|
||||
$action_info->meta_noindex = (trim($action['meta_noindex']) ?: trim($action['meta-noindex'])) === 'true' ? 'true' : 'false';
|
||||
$action_info->check_csrf = (trim($action['check_csrf'] ?: '') ?: trim($action['check-csrf'] ?: '')) === 'false' ? 'false' : 'true';
|
||||
$action_info->meta_noindex = (trim($action['meta_noindex'] ?: '') ?: trim($action['meta-noindex'] ?: '')) === 'true' ? 'true' : 'false';
|
||||
$action_info->global_route = $global_route;
|
||||
$info->action->{$action_name} = $action_info;
|
||||
|
||||
// Set the menu name and index settings.
|
||||
$menu_name = trim($action['menu_name']);
|
||||
$menu_name = trim($action['menu_name'] ?: '');
|
||||
if ($menu_name && isset($info->menu->{$menu_name}))
|
||||
{
|
||||
$info->menu->{$menu_name}->acts[] = $action_name;
|
||||
|
|
@ -217,7 +217,7 @@ class ModuleActionParser extends BaseParser
|
|||
}
|
||||
|
||||
// Set error handler settings.
|
||||
$error_handlers = explode(',', trim($action['error_handlers']) ?: trim($action['error-handlers']));
|
||||
$error_handlers = explode(',', trim($action['error_handlers'] ?: '') ?: trim($action['error-handlers'] ?: ''));
|
||||
foreach ($error_handlers as $error_handler)
|
||||
{
|
||||
if (intval($error_handler) > 200)
|
||||
|
|
@ -233,9 +233,9 @@ class ModuleActionParser extends BaseParser
|
|||
$action_name = trim($permission['action']);
|
||||
if (isset($info->action->{$action_name}))
|
||||
{
|
||||
$info->action->{$action_name}->permission->target = trim($permission['target']);
|
||||
$info->action->{$action_name}->permission->check_var = trim($permission['check_var']) ?: trim($permission['check-var']);
|
||||
$info->action->{$action_name}->permission->check_type = trim($permission['check_type']) ?: trim($permission['check-type']);
|
||||
$info->action->{$action_name}->permission->target = trim($permission['target'] ?: '');
|
||||
$info->action->{$action_name}->permission->check_var = trim($permission['check_var'] ?: '') ?: trim($permission['check-var'] ?: '');
|
||||
$info->action->{$action_name}->permission->check_type = trim($permission['check_type'] ?: '') ?: trim($permission['check-type'] ?: '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,15 +41,15 @@ class ModuleInfoParser extends BaseParser
|
|||
$info->category = trim($xml->category) ?: 'service';
|
||||
$info->date = ($xml->date === 'RX_CORE') ? '' : date('Ymd', strtotime($xml->date . 'T12:00:00Z'));
|
||||
$info->license = trim($xml->license);
|
||||
$info->license_link = trim($xml->license['link']);
|
||||
$info->license_link = trim($xml->license['link'] ?: '');
|
||||
$info->author = array();
|
||||
|
||||
foreach ($xml->author as $author)
|
||||
{
|
||||
$author_info = new \stdClass;
|
||||
$author_info->name = self::_getChildrenByLang($author, 'name', $lang);
|
||||
$author_info->email_address = trim($author['email_address']);
|
||||
$author_info->homepage = trim($author['link']);
|
||||
$author_info->email_address = trim($author['email_address'] ?: '');
|
||||
$author_info->homepage = trim($author['link'] ?: '');
|
||||
$info->author[] = $author_info;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,12 +59,12 @@ class ModuleInfoParser extends BaseParser
|
|||
{
|
||||
$info->title = self::_getChildrenByLang($xml, 'title', $lang);
|
||||
$info->description = self::_getChildrenByLang($xml->author, 'description', $lang);
|
||||
$info->version = trim($xml['version']);
|
||||
$info->version = trim($xml['version'] ?: '');
|
||||
$info->homepage = trim($xml->homepage);
|
||||
$info->category = trim($xml['category']) ?: 'service';
|
||||
$info->category = trim($xml['category'] ?: '') ?: 'service';
|
||||
$info->date = date('Ymd', strtotime($xml->author['date'] . 'T12:00:00Z'));
|
||||
$info->license = trim($xml->license);
|
||||
$info->license_link = trim($xml->license['link']);
|
||||
$info->license_link = trim($xml->license['link'] ?: '');
|
||||
$info->author = array();
|
||||
|
||||
foreach ($xml->author as $author)
|
||||
|
|
@ -72,7 +72,7 @@ class ModuleInfoParser extends BaseParser
|
|||
$author_info = new \stdClass;
|
||||
$author_info->name = self::_getChildrenByLang($author, 'name', $lang);
|
||||
$author_info->email_address = trim($author['email_address']);
|
||||
$author_info->homepage = trim($author['link']);
|
||||
$author_info->homepage = trim($author['link'] ?: '');
|
||||
$info->author[] = $author_info;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue