From 0247fcbe7cf9c08ca934879af56d99dcddf3f52d Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Fri, 3 Feb 2023 00:04:08 +0100 Subject: [PATCH] FIX "TypeError: Cannot access offset of type string on string" #22 --- action.php | 2 +- helper.php | 15 ++++++++------- syntax.php | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/action.php b/action.php index 502a119..7a176a0 100644 --- a/action.php +++ b/action.php @@ -4,7 +4,7 @@ * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Giuseppe Di Terlizzi - * @copyright (C) 2015-2020, Giuseppe Di Terlizzi + * @copyright (C) 2015-2023, Giuseppe Di Terlizzi */ diff --git a/helper.php b/helper.php index ec06e45..721422e 100644 --- a/helper.php +++ b/helper.php @@ -4,7 +4,7 @@ * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Giuseppe Di Terlizzi - * @copyright (C) 2015-2020, Giuseppe Di Terlizzi + * @copyright (C) 2015-2022, Giuseppe Di Terlizzi */ class helper_plugin_semantic extends DokuWiki_Plugin @@ -101,7 +101,7 @@ class helper_plugin_semantic extends DokuWiki_Plugin */ public function getFirstImage() { - return ((@$this->meta['relation']['firstimage']) ? $this->meta['relation']['firstimage'] : null); + return (isset($this->meta['relation']['firstimage']) ? $this->meta['relation']['firstimage'] : null); } /** @@ -121,7 +121,7 @@ class helper_plugin_semantic extends DokuWiki_Plugin */ public function getDescription() { - return (@$this->meta['description']['abstract'] ? $this->meta['description']['abstract'] : $this->getTitle()); + return (isset($this->meta['description']['abstract']) ? $this->meta['description']['abstract'] : $this->getTitle()); } /** @@ -151,7 +151,7 @@ class helper_plugin_semantic extends DokuWiki_Plugin */ public function getTitle() { - return (@$this->meta['title'] ? $this->meta['title'] : null); + return (isset($this->meta['title']) ? $this->meta['title'] : null); } /** @@ -161,7 +161,7 @@ class helper_plugin_semantic extends DokuWiki_Plugin */ public function getCreatedDate() { - return ((@$this->meta['date']['created']) ? $this->meta['date']['created'] : -1); + return (isset($this->meta['date']['created']) ? $this->meta['date']['created'] : -1); } /** @@ -171,7 +171,7 @@ class helper_plugin_semantic extends DokuWiki_Plugin */ public function getModifiedDate() { - return ((@$this->meta['date']['modified']) ? $this->meta['date']['modified'] : -1); + return (isset($this->meta['date']['modified']) ? $this->meta['date']['modified'] : -1); } /** @@ -183,7 +183,8 @@ class helper_plugin_semantic extends DokuWiki_Plugin { global $license; global $conf; - return @$license[$conf['license']]; + + return (isset($license[$conf['license']]) ? $license[$conf['license']] : null); } /** diff --git a/syntax.php b/syntax.php index b1db13e..fb52d27 100644 --- a/syntax.php +++ b/syntax.php @@ -1,9 +1,10 @@ + * @copyright (C) 2015-2023, Giuseppe Di Terlizzi */ class syntax_plugin_semantic extends DokuWiki_Syntax_Plugin