From 588520ff4b25f66514b9f3443aa49bb08b39db2e Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 8 Feb 2021 21:27:06 +0900 Subject: [PATCH] Fix warnings in PHP 8.0 --- modules/board/board.admin.view.php | 2 +- modules/file/file.view.php | 2 +- modules/module/module.model.php | 50 ++++++++++---------- modules/module/tpl/include.module_setup.html | 12 ++--- modules/point/tpl/point_module_config.html | 30 ++++++------ 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/modules/board/board.admin.view.php b/modules/board/board.admin.view.php index e0671caf8..24e530e4f 100644 --- a/modules/board/board.admin.view.php +++ b/modules/board/board.admin.view.php @@ -39,7 +39,7 @@ class boardAdminView extends board { } } - if($module_info && $module_info->module != 'board') + if(isset($module_info) && $module_info && $module_info->module != 'board') { throw new Rhymix\Framework\Exceptions\InvalidRequest; } diff --git a/modules/file/file.view.php b/modules/file/file.view.php index 06ca18278..fc6484e65 100644 --- a/modules/file/file.view.php +++ b/modules/file/file.view.php @@ -27,7 +27,7 @@ class fileView extends file if(!$current_module_srl) { // Get information of the current module - $current_module_srl = Context::get('current_module_info')->module_srl; + $current_module_srl = Context::get('current_module_info')->module_srl ?? 0; if(!$current_module_srl) { return; diff --git a/modules/module/module.model.php b/modules/module/module.model.php index 1df2d55c2..10516e072 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -928,7 +928,7 @@ class moduleModel extends module $defaultSkinInfo = self::loadSkinInfo($path, $defaultSkinName, $dir); $useDefault = new stdClass(); - $useDefault->title = lang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; + $useDefault->title = lang('use_site_default_skin') . ' (' . ($defaultSkinInfo->title ?? null) . ')'; $useDefaultList['/USE_DEFAULT/'] = $useDefault; } @@ -969,23 +969,23 @@ class moduleModel extends module { // skin format v0.2 $date_obj = (object)array('y' => 0, 'm' => 0, 'd' => 0); - sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); - $skin_info->version = $xml_obj->version->body; + sscanf($xml_obj->date->body ?? null, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); + $skin_info->version = $xml_obj->version->body ?? null; $skin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); - $skin_info->homepage = $xml_obj->link->body; - $skin_info->license = $xml_obj->license->body; - $skin_info->license_link = $xml_obj->license->attrs->link; - $skin_info->description = $xml_obj->description->body; + $skin_info->homepage = $xml_obj->link->body ?? null; + $skin_info->license = $xml_obj->license->body ?? null; + $skin_info->license_link = $xml_obj->license->attrs->link ?? null; + $skin_info->description = $xml_obj->description->body ?? null; - if(!is_array($xml_obj->author)) $author_list = array($xml_obj->author); + if(!is_array($xml_obj->author ?? null)) $author_list = array($xml_obj->author); else $author_list = $xml_obj->author; foreach($author_list as $author) { $author_obj = new stdClass(); - $author_obj->name = $author->name->body; - $author_obj->email_address = $author->attrs->email_address; - $author_obj->homepage = $author->attrs->link; + $author_obj->name = $author->name->body ?? null; + $author_obj->email_address = $author->attrs->email_address ?? null; + $author_obj->homepage = $author->attrs->link ?? null; $skin_info->author[] = $author_obj; } // List extra vars @@ -1011,13 +1011,13 @@ class moduleModel extends module foreach($extra_vars as $key => $val) { $obj = new stdClass; - $obj->group = $group->title->body; - $obj->name = $val->attrs->name; - $obj->title = $val->title->body; - $obj->type = $val->attrs->type ?: 'text'; - $obj->description = $val->description->body; - $obj->value = $val->attrs->value; - $obj->default = $val->attrs->default; + $obj->group = $group->title->body ?? null; + $obj->name = $val->attrs->name ?? null; + $obj->title = $val->title->body ?? null; + $obj->type = ($val->attrs->type ?? null) ?: 'text'; + $obj->description = $val->description->body ?? null; + $obj->value = $val->attrs->value ?? null; + $obj->default = $val->attrs->default ?? null; if(preg_match('/,|\|@\|/', $obj->value, $delimiter) && $delimiter[0]) { @@ -1036,15 +1036,15 @@ class moduleModel extends module for($i = 0; $i < $option_count; $i++) { $obj->options[$i] = new stdClass(); - $obj->options[$i]->title = $val->options[$i]->title->body; - $obj->options[$i]->value = $val->options[$i]->attrs->value; + $obj->options[$i]->title = $val->options[$i]->title->body ?? null; + $obj->options[$i]->value = $val->options[$i]->attrs->value ?? null; } } else { $obj->options[0] = new stdClass(); - $obj->options[0]->title = $val->options->title->body; - $obj->options[0]->value = $val->options->attrs->value; + $obj->options[0]->title = $val->options->title->body ?? null; + $obj->options[0]->value = $val->options->attrs->value ?? null; } $skin_info->extra_vars[] = $obj; @@ -1131,7 +1131,7 @@ class moduleModel extends module } // colorset - $colorset = $xml_obj->colorset->color; + $colorset = $xml_obj->colorset->color ?? null; if($colorset) { if(!is_array($colorset)) $colorset = array($colorset); @@ -1156,7 +1156,7 @@ class moduleModel extends module } } // Menu type (settings for layout) - if($xml_obj->menus->menu) + if($xml_obj->menus->menu ?? null) { $menus = $xml_obj->menus->menu; if(!is_array($menus)) $menus = array($menus); @@ -1250,7 +1250,7 @@ class moduleModel extends module { $args = new stdClass; $args->module = $module; - $args->module_srl = $module_srl; + $args->module_srl = $module_srl ?: 0; $output = executeQuery('module.getModulePartConfig', $args); // Object or Array(compatibility) type diff --git a/modules/module/tpl/include.module_setup.html b/modules/module/tpl/include.module_setup.html index 8fef9df54..106f9b50e 100644 --- a/modules/module/tpl/include.module_setup.html +++ b/modules/module/tpl/include.module_setup.html @@ -10,7 +10,7 @@

{$lang->about_module_category}

@@ -21,7 +21,7 @@

{$lang->about_layout}

@@ -31,7 +31,7 @@

{$lang->about_skin}

@@ -53,7 +53,7 @@ @@ -62,14 +62,14 @@
- +

{$lang->about_description}

diff --git a/modules/point/tpl/point_module_config.html b/modules/point/tpl/point_module_config.html index 065ab98ce..2461a319c 100644 --- a/modules/point/tpl/point_module_config.html +++ b/modules/point/tpl/point_module_config.html @@ -11,91 +11,91 @@
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}
- {$module_config['point_name']} + {$module_config['point_name']}