mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 08:41:39 +09:00
is_countable?!
This commit is contained in:
parent
43fe12af13
commit
a641b3103a
10 changed files with 39 additions and 14 deletions
|
|
@ -500,7 +500,7 @@ class Context
|
|||
{
|
||||
$config = Rhymix\Framework\Config::getAll();
|
||||
}
|
||||
if (!count($config))
|
||||
if (!is_countable($config) || !count($config))
|
||||
{
|
||||
self::$_instance->db_info = self::$_instance->db_info ?: new stdClass;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ class Query extends BaseObject
|
|||
function setColumnList($columnList)
|
||||
{
|
||||
$this->columnList = $columnList;
|
||||
if (!is_countable($this->columnList)) return;
|
||||
|
||||
if(count($this->columnList) > 0)
|
||||
{
|
||||
$selectColumns = array();
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ class JSONDisplayHandler
|
|||
*/
|
||||
protected static function _isNumericArray($array)
|
||||
{
|
||||
if (!is_countable($array))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!is_array($array) || !count($array))
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -691,4 +691,20 @@ function is_empty_html_content($str)
|
|||
$str = strip_tags($str, '<img><audio><video><iframe><object><embed>');
|
||||
$str = utf8_trim(utf8_clean(html_entity_decode($str, ENT_QUOTES, 'UTF-8')));
|
||||
return $str === '';
|
||||
}
|
||||
|
||||
/**
|
||||
* https://wiki.php.net/rfc/is-countable
|
||||
* Check if there is 'is_countable' function (PHP 7.3)
|
||||
* If there is no 'is_countable' function, define it for check Countable objects
|
||||
*
|
||||
* @param string $str The input string
|
||||
* @return bool
|
||||
**/
|
||||
if (!function_exists('is_countable'))
|
||||
{
|
||||
function is_countable($var)
|
||||
{
|
||||
return is_array($var) || $var instanceof Countable;
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
<footer class="layout_frame layout_footer">
|
||||
<div class="layout_footer layout_canvas">
|
||||
<!--// Footer Menu -->
|
||||
<nav class="layout_menu" id="layout_fnb" cond="count($FNB->list) > 0">
|
||||
<nav class="layout_menu" id="layout_fnb" cond="is_countable($FNB->list)">
|
||||
<ul>
|
||||
<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>
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
</nav>
|
||||
<!--// Footer Menu -->
|
||||
<!--// Language -->
|
||||
<div class="layout_language" cond="count($lang_supported) > 1">
|
||||
<div class="layout_language" cond="is_countable($lang_supported) && count($lang_supported) > 1">
|
||||
<button type="button" class="toggle">Language: {$lang_supported[$lang_type]}</button>
|
||||
<ul class="selectLang">
|
||||
<li loop="$lang_supported=>$key,$val" cond="$key!= $lang_type"><button type="button" onclick="doChangeLangType('{$key}');return false;">{$val}</button></li>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<li><a href="{getUrl('act','dispMemberLoginForm')}" >{$lang->cmd_login}...</a></li>
|
||||
<!--@end-->
|
||||
<li><a href="{getUrl('m',0)}">PC</a></li>
|
||||
<li class="lang off" cond="count($lang_supported)>1">
|
||||
<li class="lang off" cond="is_countable($lang_supported) && count($lang_supported)>1">
|
||||
<a href="#" onclick="return false;" title="{$lang_type}">{$lang_supported[$lang_type]} <i class="icon_arr_draw"></i></a>
|
||||
<ul class="lang_lst">
|
||||
<!--@foreach($lang_supported as $key=>$val)-->
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@
|
|||
<li class="fl"><a href="{getUrl('act','dispMemberLoginForm')}">{$lang->cmd_login}...</a></li>
|
||||
<!--@end-->
|
||||
<li class="fr"><a href="{getUrl('m',0)}">PC</a></li>
|
||||
<li class="fr" cond="count($lang_supported)>1"><a href="{getUrl('act','dispModuleChangeLang','oldact',$act)}">LANG</a></li>
|
||||
<li class="fr" cond="is_countable($lang_supported) && count($lang_supported)>1"><a href="{getUrl('act','dispModuleChangeLang','oldact',$act)}">LANG</a></li>
|
||||
</ul>
|
||||
<p class="cr">{$layout_info->index_title}<!--@if(!$layout_info->index_title)-->{Context::getSiteTitle()}<!--@end--></p>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@
|
|||
<li class="fl"><a href="{getUrl('act','dispMemberLoginForm')}">{$lang->cmd_login}...</a></li>
|
||||
<!--@end-->
|
||||
<li class="fr"><a href="{getUrl('m',0)}">PC</a></li>
|
||||
<li class="fr" cond="count($lang_supported)>1"><a href="{getUrl('act','dispModuleChangeLang','oldact',$act)}">LANG</a></li>
|
||||
<li class="fr" cond="is_countable($lang_supported) && count($lang_supported)>1"><a href="{getUrl('act','dispModuleChangeLang','oldact',$act)}">LANG</a></li>
|
||||
</ul>
|
||||
<p class="cr">{$layout_info->index_title}</p>
|
||||
|
|
|
|||
|
|
@ -967,7 +967,8 @@ class moduleController extends module
|
|||
{
|
||||
$this->deleteModuleExtraVars($module_srl);
|
||||
getDestroyXeVars($obj);
|
||||
if(!$obj || !count($obj)) return;
|
||||
if(!$obj || !is_countable($obj)) return;
|
||||
if(!count($obj)) return;
|
||||
|
||||
foreach($obj as $key => $val)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<load target="./js/content_widget.js" cond="$widget_info->page_count || count($widget_info->tab)" />
|
||||
<load target="./js/content_widget.js" cond="$widget_info->page_count || is_countable($widget_info->tab)" />
|
||||
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
||||
{@$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'">
|
||||
|
|
@ -71,14 +71,16 @@
|
|||
<div class="widgetContainer">
|
||||
<div class="simple_content">
|
||||
<section class="simple_content">
|
||||
<!--@if($widget_info->tab_type == "tab_left" && count($widget_info->tab) > 1)-->
|
||||
<!--#include("./_tab_left.html")-->
|
||||
<!--@elseif($widget_info->tab_type == "tab_top" && count($widget_info->tab) > 1)-->
|
||||
<!--#include("./_tab_top.html")-->
|
||||
<!--@else-->
|
||||
<!--@if($widget_info->tab_type == "tab_left" || $widget_info->tab_type == "tab_top")-->
|
||||
<!--@if(is_countable($widget_info->tab))-->
|
||||
<!--@if($widget_info->tab_type == "tab_left" && count($widget_info->tab) > 1)-->
|
||||
<!--#include("./_tab_left.html")-->
|
||||
<!--@elseif($widget_info->tab_type == "tab_top" && count($widget_info->tab) > 1)-->
|
||||
<!--#include("./_tab_top.html")-->
|
||||
<!--@elseif($widget_info->tab_type == "tab_left" || $widget_info->tab_type == "tab_top")-->
|
||||
{@$widget_info->content_items = $widget_info->tab[0]->content_items}
|
||||
<!--#include("./_tab_none.html")-->
|
||||
<!--@end-->
|
||||
<!--@else-->
|
||||
<!--#include("./_tab_none.html")-->
|
||||
<!--@end-->
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue