smarty_internal_compile_private_modifier.php
Current file: C:\DATA\Viktor\Diplomka\XSLT-Benchmarking/Libs/Smarty/sysplugins/smarty_internal_compile_private_modifier.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
0.00% 0 / 1 CRAP
0.00% 0 / 34
Smarty_Internal_Compile_Private_Modifier
0.00% 0 / 1
0.00% 0 / 1 240
0.00% 0 / 34
 compile($args, $compiler, $parameter)
0.00% 0 / 1 240
0.00% 0 / 34



       1                 : <?php                                                                                                                                                                     
       2                 :                                                                                                                                                                           
       3                 : /**                                                                                                                                                                       
       4                 :  * Smarty Internal Plugin Compile Modifier                                                                                                                                
       5                 :  *                                                                                                                                                                        
       6                 :  * Compiles code for modifier execution                                                                                                                                   
       7                 :  *                                                                                                                                                                        
       8                 :  * @package Smarty                                                                                                                                                        
       9                 :  * @subpackage Compiler                                                                                                                                                   
      10                 :  * @author Uwe Tews                                                                                                                                                       
      11                 :  */                                                                                                                                                                       
      12                 :                                                                                                                                                                           
      13                 : /**                                                                                                                                                                       
      14                 :  * Smarty Internal Plugin Compile Modifier Class                                                                                                                          
      15                 :  *                                                                                                                                                                        
      16                 :  * @package Smarty                                                                                                                                                        
      17                 :  * @subpackage Compiler                                                                                                                                                   
      18                 :  */                                                                                                                                                                       
      19                 : class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {                                                                                      
      20                 :                                                                                                                                                                           
      21                 :     /**                                                                                                                                                                   
      22                 :      * Compiles code for modifier execution                                                                                                                               
      23                 :      *                                                                                                                                                                    
      24                 :      * @param array  $args      array with attributes from parser                                                                                                         
      25                 :      * @param object $compiler  compiler object                                                                                                                           
      26                 :      * @param array  $parameter array with compilation parameter                                                                                                          
      27                 :      * @return string compiled code                                                                                                                                       
      28                 :      */                                                                                                                                                                   
      29                 :     public function compile($args, $compiler, $parameter)                                                                                                                 
      30                 :     {                                                                                                                                                                     
      31                 :         // check and get attributes                                                                                                                                       
      32               0 :         $_attr = $this->getAttributes($compiler, $args);                                                                                                                  
      33               0 :         $output = $parameter['value'];                                                                                                                                    
      34                 :         // loop over list of modifiers                                                                                                                                    
      35               0 :         foreach ($parameter['modifierlist'] as $single_modifier) {                                                                                                        
      36               0 :             $modifier = $single_modifier[0];                                                                                                                              
      37               0 :             $single_modifier[0] = $output;                                                                                                                                
      38               0 :             $params = implode(',', $single_modifier);                                                                                                                     
      39                 :             // check for registered modifier                                                                                                                              
      40               0 :             if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {                                                                       
      41               0 :                 $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];                                                                 
      42               0 :                 if (!is_array($function)) {                                                                                                                               
      43               0 :                     $output = "{$function}({$params})";                                                                                                                   
      44               0 :                 } else {                                                                                                                                                  
      45               0 :                     if (is_object($function[0])) {                                                                                                                        
      46               0 :                         $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
      47               0 :                     } else {                                                                                                                                              
      48               0 :                         $output = $function[0] . '::' . $function[1] . '(' . $params . ')';                                                                               
      49                 :                     }                                                                                                                                                     
      50                 :                 }                                                                                                                                                         
      51               0 :             } else if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {                                                     
      52               0 :                 $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);      
      53                 :                 // check for plugin modifiercompiler                                                                                                                      
      54               0 :             } else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {                                                                           
      55                 :                 // check if modifier allowed                                                                                                                              
      56               0 :                 if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {                      
      57               0 :                     $plugin = 'smarty_modifiercompiler_' . $modifier;                                                                                                     
      58               0 :                     $output = $plugin($single_modifier, $compiler);                                                                                                       
      59               0 :                 }                                                                                                                                                         
      60                 :                 // check for plugin modifier                                                                                                                              
      61               0 :             } else if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {                                                                            
      62                 :                 // check if modifier allowed                                                                                                                              
      63               0 :                 if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {                      
      64               0 :                     $output = "{$function}({$params})";                                                                                                                   
      65               0 :                 }                                                                                                                                                         
      66                 :                 // check if trusted PHP function                                                                                                                          
      67               0 :             } else if (is_callable($modifier)) {                                                                                                                          
      68                 :                 // check if modifier allowed                                                                                                                              
      69               0 :                 if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {                   
      70               0 :                     $output = "{$modifier}({$params})";                                                                                                                   
      71               0 :                 }                                                                                                                                                         
      72               0 :             } else {                                                                                                                                                      
      73               0 :                 $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);                                                   
      74                 :             }                                                                                                                                                             
      75               0 :         }                                                                                                                                                                 
      76               0 :         return $output;                                                                                                                                                   
      77                 :     }                                                                                                                                                                     
      78                 :                                                                                                                                                                           
      79                 : }                                                                                                                                                                         
      80                 :                                                                                                                                                                           


Generated by PHP_CodeCoverage @package_version@ using PHP 5.3.6 and PHPUnit @package_version@ at Tue Jun 26 15:06:55 CEST 2012.