gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

commit b06f4a74a78d5c1a5835a13c8c0b7619ef9cc72f
parent a58c4de498f360f376afe9a38cb1cd2f9a1cb153
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Sat, 31 Oct 2015 17:27:11 +0100

Create smarty_internal_compile_call.php
Diffstat:
Alibs/smarty/sysplugins/smarty_internal_compile_call.php | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+), 0 deletions(-)

diff --git a/libs/smarty/sysplugins/smarty_internal_compile_call.php b/libs/smarty/sysplugins/smarty_internal_compile_call.php @@ -0,0 +1,85 @@ +<?php +/** + * Smarty Internal Plugin Compile Function_Call + * Compiles the calls of user defined tags defined by {function} + * + * @package Smarty + * @subpackage Compiler + * @author Uwe Tews + */ + +/** + * Smarty Internal Plugin Compile Function_Call Class + * + * @package Smarty + * @subpackage Compiler + */ +class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase +{ + /** + * Attribute definition: Overwrites base class. + * + * @var array + * @see Smarty_Internal_CompileBase + */ + public $required_attributes = array('name'); + /** + * Attribute definition: Overwrites base class. + * + * @var array + * @see Smarty_Internal_CompileBase + */ + public $shorttag_order = array('name'); + /** + * Attribute definition: Overwrites base class. + * + * @var array + * @see Smarty_Internal_CompileBase + */ + public $optional_attributes = array('_any'); + + /** + * Compiles the calls of user defined tags defined by {function} + * + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * + * @return string compiled code + */ + public function compile($args, $compiler) + { + // check and get attributes + $_attr = $this->getAttributes($compiler, $args); + // save possible attributes + if (isset($_attr['assign'])) { + // output will be stored in a smarty variable instead of being displayed + $_assign = $_attr['assign']; + } + //$_name = trim($_attr['name'], "'\""); + $_name = $_attr['name']; + unset($_attr['name'], $_attr['assign'], $_attr['nocache']); + // set flag (compiled code of {function} must be included in cache file + if (!$compiler->template->caching || $compiler->nocache || $compiler->tag_nocache) { + $_nocache = 'true'; + } else { + $_nocache = 'false'; + } + $_paramsArray = array(); + foreach ($_attr as $_key => $_value) { + if (is_int($_key)) { + $_paramsArray[] = "$_key=>$_value"; + } else { + $_paramsArray[] = "'$_key'=>$_value"; + } + } + $_params = 'array(' . implode(",", $_paramsArray) . ')'; + //$compiler->suppressNocacheProcessing = true; + // was there an assign attribute + if (isset($_assign)) { + $_output = "<?php ob_start();\$_smarty_tpl->callTemplateFunction ({$_name}, \$_smarty_tpl, {$_params}, {$_nocache}); \$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n"; + } else { + $_output = "<?php \$_smarty_tpl->callTemplateFunction ({$_name}, \$_smarty_tpl, {$_params}, {$_nocache});?>\n"; + } + return $_output; + } +}