You are here

function Smarty_Compiler::_compile_arg_list in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/lib/smarty/Smarty_Compiler.class.php \Smarty_Compiler::_compile_arg_list()
2 calls to Smarty_Compiler::_compile_arg_list()
Smarty_Compiler::_compile_block_tag in includes/moodle/lib/smarty/Smarty_Compiler.class.php
compile block function tag
Smarty_Compiler::_compile_custom_tag in includes/moodle/lib/smarty/Smarty_Compiler.class.php
compile custom function tag

File

includes/moodle/lib/smarty/Smarty_Compiler.class.php, line 1396

Class

Smarty_Compiler
Template compiling class @package Smarty

Code

function _compile_arg_list($type, $name, $attrs, &$cache_code) {
  $arg_list = array();
  if (isset($type) && isset($name) && isset($this->_plugins[$type]) && isset($this->_plugins[$type][$name]) && empty($this->_plugins[$type][$name][4]) && is_array($this->_plugins[$type][$name][5])) {

    /* we have a list of parameters that should be cached */
    $_cache_attrs = $this->_plugins[$type][$name][5];
    $_count = $this->_cache_attrs_count++;
    $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('{$this->_cache_serial}','{$_count}');";
  }
  else {

    /* no parameters are cached */
    $_cache_attrs = null;
  }
  foreach ($attrs as $arg_name => $arg_value) {
    if (is_bool($arg_value)) {
      $arg_value = $arg_value ? 'true' : 'false';
    }
    if (is_null($arg_value)) {
      $arg_value = 'null';
    }
    if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) {
      $arg_list[] = "'{$arg_name}' => (\$this->_cache_including) ? \$_cache_attrs['{$arg_name}'] : (\$_cache_attrs['{$arg_name}']={$arg_value})";
    }
    else {
      $arg_list[] = "'{$arg_name}' => {$arg_value}";
    }
  }
  return $arg_list;
}