summaryrefslogtreecommitdiff
path: root/libs/sysplugins/smarty_internal_method_unregisterplugin.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_unregisterplugin.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_unregisterplugin.php')
-rw-r--r--libs/sysplugins/smarty_internal_method_unregisterplugin.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/libs/sysplugins/smarty_internal_method_unregisterplugin.php b/libs/sysplugins/smarty_internal_method_unregisterplugin.php
new file mode 100644
index 00000000..06cb2d35
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unregisterplugin.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method UnregisterPlugin
+ *
+ * Smarty::unregisterPlugin() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterPlugin
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::unregisterPlugin()
+ * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type plugin type
+ * @param string $name name of template tag
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_plugins[$type][$name])) {
+ unset($smarty->registered_plugins[$type][$name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file