mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Clean up usage of is_countable()
This commit is contained in:
parent
67a9aba082
commit
494e0ee028
8 changed files with 10 additions and 14 deletions
|
|
@ -500,7 +500,7 @@ class Context
|
||||||
{
|
{
|
||||||
$config = Rhymix\Framework\Config::getAll();
|
$config = Rhymix\Framework\Config::getAll();
|
||||||
}
|
}
|
||||||
if (!is_countable($config) || !count($config))
|
if (!is_array($config) || !count($config))
|
||||||
{
|
{
|
||||||
self::$_instance->db_info = self::$_instance->db_info ?: new stdClass;
|
self::$_instance->db_info = self::$_instance->db_info ?: new stdClass;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -902,7 +902,7 @@ class DB
|
||||||
*/
|
*/
|
||||||
public function _dbInfoExists()
|
public function _dbInfoExists()
|
||||||
{
|
{
|
||||||
return ($this->master_db && (is_countable($this->slave_db) && count($this->slave_db)));
|
return $this->master_db ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ class Query extends BaseObject
|
||||||
|
|
||||||
function setColumnList($columnList)
|
function setColumnList($columnList)
|
||||||
{
|
{
|
||||||
|
if (!is_array($this->columnList)) return;
|
||||||
$this->columnList = $columnList;
|
$this->columnList = $columnList;
|
||||||
if (!is_countable($this->columnList)) return;
|
|
||||||
|
|
||||||
if(count($this->columnList) > 0)
|
if(count($this->columnList) > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,6 @@ class JSONDisplayHandler
|
||||||
*/
|
*/
|
||||||
protected static function _isNumericArray($array)
|
protected static function _isNumericArray($array)
|
||||||
{
|
{
|
||||||
if (!is_countable($array))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!is_array($array) || !count($array))
|
if (!is_array($array) || !count($array))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -694,9 +694,10 @@ function is_empty_html_content($str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://wiki.php.net/rfc/is-countable
|
|
||||||
* Check if there is 'is_countable' function (PHP 7.3)
|
* Check if there is 'is_countable' function (PHP 7.3)
|
||||||
* If there is no 'is_countable' function, define it for check Countable objects
|
* If there is no 'is_countable' function, define it to check for Countable objects.
|
||||||
|
*
|
||||||
|
* cf. https://wiki.php.net/rfc/is-countable
|
||||||
*
|
*
|
||||||
* @param string $str The input string
|
* @param string $str The input string
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
@ -707,4 +708,4 @@ if (!function_exists('is_countable'))
|
||||||
{
|
{
|
||||||
return is_array($var) || $var instanceof Countable;
|
return is_array($var) || $var instanceof Countable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
<footer class="layout_frame layout_footer">
|
<footer class="layout_frame layout_footer">
|
||||||
<div class="layout_footer layout_canvas">
|
<div class="layout_footer layout_canvas">
|
||||||
<!--// Footer Menu -->
|
<!--// Footer Menu -->
|
||||||
<nav class="layout_menu" id="layout_fnb" cond="is_countable($FNB->list)">
|
<nav class="layout_menu" id="layout_fnb" cond="is_countable($FNB->list) && count($FNB->list)">
|
||||||
<ul>
|
<ul>
|
||||||
<li loop="$FNB->list=>$key1,$val1" class="footer_menu">
|
<li loop="$FNB->list=>$key1,$val1" class="footer_menu">
|
||||||
<a href="{$val1['href']}" target="_blank"|cond="$val1['open_window']=='Y'"><span>{$val1['link']}</span></a>
|
<a href="{$val1['href']}" target="_blank"|cond="$val1['open_window']=='Y'"><span>{$val1['link']}</span></a>
|
||||||
|
|
|
||||||
|
|
@ -967,8 +967,7 @@ class moduleController extends module
|
||||||
{
|
{
|
||||||
$this->deleteModuleExtraVars($module_srl);
|
$this->deleteModuleExtraVars($module_srl);
|
||||||
getDestroyXeVars($obj);
|
getDestroyXeVars($obj);
|
||||||
if(!$obj || !is_countable($obj)) return;
|
if(!$obj || !is_countable($obj) || !count($obj)) return;
|
||||||
if(!count($obj)) return;
|
|
||||||
|
|
||||||
foreach($obj as $key => $val)
|
foreach($obj as $key => $val)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<load target="./js/content_widget.js" cond="$widget_info->page_count || is_countable($widget_info->tab)" />
|
<load target="./js/content_widget.js" cond="$widget_info->page_count || (is_countable($widget_info->tab) && count($widget_info->tab))" />
|
||||||
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
||||||
{@$layout_info = Context::get('layout_info')}
|
{@$layout_info = Context::get('layout_info')}
|
||||||
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue