From fe6c8f805a2dfa6d132ee6e0c2e81b43c6d552c5 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 6 Feb 2022 23:15:39 +0100 Subject: [PATCH] Re-add deprecated Pico::getBaseThemeUrl() and AbstractPicoPlugin::__call() This reverts commits efc4fb5288d39e66a81df3707255278b33506232 and bc816febfca84fed80ca96d499bb5e034b0f8e8f --- lib/AbstractPicoPlugin.php | 24 ++++++++++++++++++++++++ lib/Pico.php | 14 ++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/lib/AbstractPicoPlugin.php b/lib/AbstractPicoPlugin.php index 144170f..bdfaf9c 100644 --- a/lib/AbstractPicoPlugin.php +++ b/lib/AbstractPicoPlugin.php @@ -193,6 +193,30 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface return isset($pluginConfig[$configName]) ? $pluginConfig[$configName] : $default; } + /** + * Passes all not satisfiable method calls to Pico + * + * @see PicoPluginInterface::getPico() + * + * @deprecated 2.1.0 + * + * @param string $methodName name of the method to call + * @param array $params parameters to pass + * + * @return mixed return value of the called method + */ + public function __call($methodName, array $params) + { + if (method_exists($this->getPico(), $methodName)) { + return call_user_func_array(array($this->getPico(), $methodName), $params); + } + + throw new BadMethodCallException( + 'Call to undefined method ' . get_class($this->getPico()) . '::' . $methodName . '() ' + . 'through ' . get_called_class() . '::__call()' + ); + } + /** * Enables all plugins which this plugin depends on * diff --git a/lib/Pico.php b/lib/Pico.php index 663a413..f92d9eb 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -2373,6 +2373,20 @@ class Pico return substr($path, $contentDirLength, -$contentExtLength) ?: null; } + /** + * Returns the URL of the themes folder of this Pico instance + * + * @see Pico::getUrlFromPath() + * + * @deprecated 2.1.0 + * + * @return string + */ + public function getBaseThemeUrl() + { + return $this->getConfig('themes_url'); + } + /** * Substitutes URL placeholders (e.g. %base_url%) *