From 378881378aab5454c84cb1fecbbcc675f64dc27f Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Fri, 25 Sep 2020 21:18:18 +0200 Subject: Refactor textprocessors They are now managed by TextprocessorRepository and are instances of Textprocessor. This replaces the global $textprocessors variable. --- ratatoeskr/sys/plugin_api.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ratatoeskr/sys/plugin_api.php') diff --git a/ratatoeskr/sys/plugin_api.php b/ratatoeskr/sys/plugin_api.php index c286fdc..b85ce57 100644 --- a/ratatoeskr/sys/plugin_api.php +++ b/ratatoeskr/sys/plugin_api.php @@ -10,6 +10,8 @@ */ use r7r\ste\STECore; +use r7r\cms\sys\Env; +use r7r\cms\sys\textprocessors\LegacyTextprocessor; require_once(dirname(__FILE__) . "/models.php"); require_once(dirname(__FILE__) . "/textprocessors.php"); @@ -50,6 +52,9 @@ abstract class RatatoeskrPlugin { private $id; + /** @var Env */ + private $env; + /** @var PluginKVStorage The Key-Value-Storage for the Plugin */ protected $kvstorage; @@ -70,6 +75,7 @@ abstract class RatatoeskrPlugin global $ste, $rel_path_to_root; $this->id = $id; + $this->env = Env::getGlobal(); $this->kvstorage = new PluginKVStorage($id); $this->ste = $ste; $this->rel_path_to_root = $rel_path_to_root; @@ -151,7 +157,7 @@ abstract class RatatoeskrPlugin */ final protected function register_textprocessor($name, $fx, $visible_in_backend=true) { - textprocessor_register($name, $fx, $visible_in_backend); + $this->env->textprocessors()->register($name, new LegacyTextprocessor($fx, (bool)$visible_in_backend)); } /** -- cgit v1.2.3-54-g00ecf