packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/smarty/sysplugins/smarty_internal_compile_private_function_plugin.php
changeset 0 3906ca745819
equal deleted inserted replaced
-1:000000000000 0:3906ca745819
       
     1 <?php
       
     2 /**
       
     3  * Smarty Internal Plugin Compile Function Plugin
       
     4  *
       
     5  * Compiles code for the execution of function plugin
       
     6  *
       
     7  * @package Smarty
       
     8  * @subpackage Compiler
       
     9  * @author Uwe Tews
       
    10  */
       
    11 
       
    12 /**
       
    13  * Smarty Internal Plugin Compile Function Plugin Class
       
    14  *
       
    15  * @package Smarty
       
    16  * @subpackage Compiler
       
    17  */
       
    18 class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase {
       
    19 
       
    20     /**
       
    21      * Attribute definition: Overwrites base class.
       
    22      *
       
    23      * @var array
       
    24      * @see Smarty_Internal_CompileBase
       
    25      */
       
    26     public $required_attributes = array();
       
    27     /**
       
    28      * Attribute definition: Overwrites base class.
       
    29      *
       
    30      * @var array
       
    31      * @see Smarty_Internal_CompileBase
       
    32      */
       
    33     public $optional_attributes = array('_any');
       
    34 
       
    35     /**
       
    36      * Compiles code for the execution of function plugin
       
    37      *
       
    38      * @param array $args array with attributes from parser
       
    39      * @param object $compiler compiler object
       
    40      * @param array $parameter array with compilation parameter
       
    41      * @param string $tag name of function plugin
       
    42      * @param string $function PHP function name
       
    43      * @return string compiled code
       
    44      */
       
    45     public function compile($args, $compiler, $parameter, $tag, $function)
       
    46     {
       
    47         // This tag does create output
       
    48         $compiler->has_output = true;
       
    49 
       
    50         // check and get attributes
       
    51         $_attr = $this->getAttributes($compiler, $args);
       
    52         if ($_attr['nocache'] === true) {
       
    53             $compiler->tag_nocache = true;
       
    54         }
       
    55         unset($_attr['nocache']);
       
    56         // convert attributes into parameter array string
       
    57         $_paramsArray = array();
       
    58         foreach ($_attr as $_key => $_value) {
       
    59             if (is_int($_key)) {
       
    60                 $_paramsArray[] = "$_key=>$_value";
       
    61             } else {
       
    62                 $_paramsArray[] = "'$_key'=>$_value";
       
    63             }
       
    64         }
       
    65         $_params = 'array(' . implode(",", $_paramsArray) . ')';
       
    66         // compile code
       
    67         $output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
       
    68         return $output;
       
    69     }
       
    70 
       
    71 }
       
    72 
       
    73 ?>