summaryrefslogtreecommitdiff
path: root/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2015-08-17 21:52:32 +0200
committeruwetews <uwe.tews@googlemail.com>2015-08-17 21:52:32 +0200
commit6cbcdf4d7b79aa038e5773c3a93d215542400c95 (patch)
tree223971ecef4cd51327c7e29bfd2af045fb08e0d4 /libs/sysplugins/smarty_internal_method_setdebugtemplate.php
parenteb7aa8fe9258cf41536e89fe264225e7f1b8f6f3 (diff)
downloadsmarty-6cbcdf4d7b79aa038e5773c3a93d215542400c95.tar.gz
smarty-6cbcdf4d7b79aa038e5773c3a93d215542400c95.tar.bz2
smarty-6cbcdf4d7b79aa038e5773c3a93d215542400c95.zip
- load seldom used Smarty API methods dynamically to reduce memory footprint
Diffstat (limited to 'libs/sysplugins/smarty_internal_method_setdebugtemplate.php')
-rw-r--r--libs/sysplugins/smarty_internal_method_setdebugtemplate.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/libs/sysplugins/smarty_internal_method_setdebugtemplate.php b/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
new file mode 100644
index 00000000..4ff5d7f8
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method SetDebugTemplate
+ *
+ * Smarty::setDebugTemplate() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetDebugTemplate
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * set the debug template
+ *
+ * @api Smarty::setDebugTemplate()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $tpl_name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if file is not readable
+ */
+ public function setDebugTemplate(Smarty_Internal_TemplateBase $obj, $tpl_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (!is_readable($tpl_name)) {
+ throw new SmartyException("Unknown file '{$tpl_name}'");
+ }
+ $smarty->debug_tpl = $tpl_name;
+ return $obj;
+ }
+} \ No newline at end of file