From d749e53352ae3832c402caf3e3d7963334967da0 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Tue, 26 Jun 2012 01:56:16 +0200 Subject: [PATCH] Deprecate a few legacy functions. --- class.base.php | 9 +++++++++ class.templater.php | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/class.base.php b/class.base.php index fe58777..513c945 100644 --- a/class.base.php +++ b/class.base.php @@ -19,6 +19,8 @@ class CPHPBaseClass public function RenderTimeAgo($template, $property) { + /* DEPRECATED: Please do not use this function if you can avoid it. + * A function offering similar functionality will be added soon. */ global $locale; $variable_name = "s{$property}"; @@ -130,11 +132,18 @@ class CPHPBaseClass public function RenderTemplateExternal($template, $strings) { + /* DEPRECATED: Please do not use this function. + * Instead, you can use Templater::AdvancedParse for rendering arbitrary templates + * without instantiating a Templater yourself. */ return $this->DoRenderTemplate($template, $strings); } public function DoRenderTemplate($template, $strings) { + /* DEPRECATED: Please do not use this function. + * Class-specific templater functions have been discontinued. Instead, you can use + * Templater::AdvancedParse for rendering templates without instantiating a Templater + * yourself. */ global $locale; try diff --git a/class.templater.php b/class.templater.php index 56cfc07..4d606c0 100644 --- a/class.templater.php +++ b/class.templater.php @@ -93,6 +93,9 @@ class Templater public function Compile($strings) { + /* DEPRECATED: Please do not use this function. + * Instead, use the AdvancedParse function, which implements the new + * template parser with advanced syntax. */ global $template_global_vars; if(!is_null($this->tpl)) @@ -119,6 +122,9 @@ class Templater public function ParseForEach($source, $data) { + /* DEPRECATED: Please do not use this function. + * Instead, use the AdvancedParse function, which implements the new + * template parser with advanced syntax. */ $templater = $this; return preg_replace_callback("/<%foreach ([a-z0-9_-]+) in ([a-z0-9_-]+)>(.*?)<%\/foreach>/si", function($matches) use($data, $templater) { @@ -152,6 +158,9 @@ class Templater public function ParseIf($source, $data, $context = null, $identifier = "") { + /* DEPRECATED: Please do not use this function. + * Instead, use the AdvancedParse function, which implements the new + * template parser with advanced syntax. */ return preg_replace_callback("/<%if ([][a-z0-9_-]+) (=|==|>|<|>=|<=|!=) ([^>]+)>(.*?)<%\/if>/si", function($matches) use($data, $context, $identifier) { $variable_name = $matches[1]; $operator = $matches[2]; @@ -253,6 +262,9 @@ class Templater public function Render() { + /* DEPRECATED: Please do not use this function. + * Instead, use the AdvancedParse function, which implements the new + * template parser with advanced syntax. */ if(!is_null($this->tpl)) { return $this->tpl_rendered; @@ -265,6 +277,9 @@ class Templater public function Output() { + /* DEPRECATED: Please do not use this function. + * Instead, use the AdvancedParse function, which implements the new + * template parser with advanced syntax. */ if(!is_null($this->tpl)) { echo($this->tpl_rendered); @@ -277,6 +292,9 @@ class Templater public static function InlineRender($templatename, $localize = array(), $compile = array()) { + /* DEPRECATED: Please do not use this function. + * Instead, use the AdvancedParse function, which implements the new + * template parser with advanced syntax. */ $template = new Templater(); $template->Load($templatename); $template->Localize($localize);