[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Smarty Internal Plugin Compile Eval 4 * 5 * Compiles the {eval} tag. 6 * 7 * @package Smarty 8 * @subpackage Compiler 9 * @author Uwe Tews 10 */ 11 12 /** 13 * Smarty Internal Plugin Compile Eval Class 14 * 15 * @package Smarty 16 * @subpackage Compiler 17 */ 18 class Smarty_Internal_Compile_Eval 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('var'); 27 /** 28 * Attribute definition: Overwrites base class. 29 * 30 * @var array 31 * @see Smarty_Internal_CompileBase 32 */ 33 public $optional_attributes = array('assign'); 34 /** 35 * Attribute definition: Overwrites base class. 36 * 37 * @var array 38 * @see Smarty_Internal_CompileBase 39 */ 40 public $shorttag_order = array('var','assign'); 41 42 /** 43 * Compiles code for the {eval} tag 44 * 45 * @param array $args array with attributes from parser 46 * @param object $compiler compiler object 47 * @return string compiled code 48 */ 49 public function compile($args, $compiler) 50 { 51 $this->required_attributes = array('var'); 52 $this->optional_attributes = array('assign'); 53 // check and get attributes 54 $_attr = $this->getAttributes($compiler, $args); 55 if (isset($_attr['assign'])) { 56 // output will be stored in a smarty variable instead of beind displayed 57 $_assign = $_attr['assign']; 58 } 59 60 // create template object 61 $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);"; 62 //was there an assign attribute? 63 if (isset($_assign)) { 64 $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; 65 } else { 66 $_output .= "echo \$_template->fetch();"; 67 } 68 return "<?php $_output ?>"; 69 } 70 71 } 72 73 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |