[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Smarty Internal Plugin Compile Object Funtion 4 * 5 * Compiles code for registered objects as function 6 * 7 * @package Smarty 8 * @subpackage Compiler 9 * @author Uwe Tews 10 */ 11 12 /** 13 * Smarty Internal Plugin Compile Object Function Class 14 * 15 * @package Smarty 16 * @subpackage Compiler 17 */ 18 class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase { 19 20 /** 21 * Attribute definition: Overwrites base class. 22 * 23 * @var array 24 * @see Smarty_Internal_CompileBase 25 */ 26 public $optional_attributes = array('_any'); 27 28 /** 29 * Compiles code for the execution of function plugin 30 * 31 * @param array $args array with attributes from parser 32 * @param object $compiler compiler object 33 * @param array $parameter array with compilation parameter 34 * @param string $tag name of function 35 * @param string $method name of method to call 36 * @return string compiled code 37 */ 38 public function compile($args, $compiler, $parameter, $tag, $method) 39 { 40 // check and get attributes 41 $_attr = $this->getAttributes($compiler, $args); 42 if ($_attr['nocache'] === true) { 43 $compiler->tag_nocache = true; 44 } 45 unset($_attr['nocache']); 46 $_assign = null; 47 if (isset($_attr['assign'])) { 48 $_assign = $_attr['assign']; 49 unset($_attr['assign']); 50 } 51 // convert attributes into parameter array string 52 if ($compiler->smarty->registered_objects[$tag][2]) { 53 $_paramsArray = array(); 54 foreach ($_attr as $_key => $_value) { 55 if (is_int($_key)) { 56 $_paramsArray[] = "$_key=>$_value"; 57 } else { 58 $_paramsArray[] = "'$_key'=>$_value"; 59 } 60 } 61 $_params = 'array(' . implode(",", $_paramsArray) . ')'; 62 $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; 63 } else { 64 $_params = implode(",", $_attr); 65 $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; 66 } 67 if (empty($_assign)) { 68 // This tag does create output 69 $compiler->has_output = true; 70 $output = "<?php echo {$return};?>\n"; 71 } else { 72 $output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n"; 73 } 74 return $output; 75 } 76 77 } 78 79 ?>
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 |