From db6f44a913b972a6751e0e9412a4af7a1244f76c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 8 Jan 2021 00:11:12 +0900 Subject: [PATCH] Fix warnings in PHP 8.0 --- modules/widget/widget.controller.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/modules/widget/widget.controller.php b/modules/widget/widget.controller.php index dfdbea057..d832393b6 100644 --- a/modules/widget/widget.controller.php +++ b/modules/widget/widget.controller.php @@ -363,7 +363,7 @@ class widgetController extends widget } // Fix the widget sequence if it is missing - $widget_sequence = $override_sequence ?: $args->widget_sequence; + $widget_sequence = $override_sequence ?: ($args->widget_sequence ?? 0); if (!$widget_sequence) { $widget_sequence = sha1(json_encode($args)); @@ -482,12 +482,12 @@ class widgetController extends widget * Wanted specified by the administrator of the widget style */ // Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed - $style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style); + $style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style ?? ''); // Find a style statement that based on the internal margin dropping pre-change - $widget_padding_left = $args->widget_padding_left; - $widget_padding_right = $args->widget_padding_right; - $widget_padding_top = $args->widget_padding_top; - $widget_padding_bottom = $args->widget_padding_bottom; + $widget_padding_left = $args->widget_padding_left ?? 0; + $widget_padding_right = $args->widget_padding_right ?? 0; + $widget_padding_top = $args->widget_padding_top ?? 0; + $widget_padding_bottom = $args->widget_padding_bottom ?? 0; $inner_style = sprintf("padding:%dpx %dpx %dpx %dpx !important;", $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left); /** @@ -500,7 +500,10 @@ class widgetController extends widget // If general call is given on page styles should return immediately dreamin ' if(!$javascript_mode) { - if($args->id) $args->id = ' id="'.$args->id.'" '; + if(isset($args->id) && $args->id) + { + $args->id = ' id="'.$args->id.'" '; + } switch($widget) { // If a direct orthogonal addition information @@ -519,20 +522,20 @@ class widgetController extends widget $oEditorController = getController('editor'); $body = $oEditorController->transComponent($body); - $widget_content_header = sprintf('
', $args->id, $style, $inner_style); + $widget_content_header = sprintf('
', $args->id ?? '', $style, $inner_style); $widget_content_body = $body; $widget_content_footer = '
'; break; // If the widget box; it could case 'widgetBox' : - $widget_content_header = sprintf('
', $args->id, $style, $inner_style); + $widget_content_header = sprintf('
', $args->id ?? '', $style, $inner_style); $widget_content_body = $widgetbox_content; break; // If the General wijetil default : - $widget_content_header = sprintf('
',$args->id,$style); + $widget_content_header = sprintf('
', $args->id ?? '', $style); $widget_content_body = sprintf('
%s
', $inner_style,$widget_content); $widget_content_footer = '
'; break; @@ -643,7 +646,10 @@ class widgetController extends widget } } // Compile the widget style. - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); + if(isset($args->widgetstyle) && $args->widgetstyle) + { + $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode); + } $output = $widget_content_header . $widget_content_body . $widget_content_footer;