function Smarty_Compiler::_parse_var_props in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/lib/smarty/Smarty_Compiler.class.php \Smarty_Compiler::_parse_var_props()
compile single variable and section properties token into PHP code
Parameters
string $val:
string $tag_attrs:
Return value
string
5 calls to Smarty_Compiler::_parse_var_props()
- Smarty_Compiler::_compile_if_tag in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - Compile {if ...} tag
- Smarty_Compiler::_compile_smarty_ref in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - Compiles references of type $smarty.foo
- Smarty_Compiler::_compile_tag in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - Compile a template tag
- Smarty_Compiler::_parse_is_expr in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - Parse is expression
- Smarty_Compiler::_parse_vars_props in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - compile multiple variables and section properties tokens into PHP code
File
- includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php, line 1596
Class
- Smarty_Compiler
- Template compiling class @package Smarty
Code
function _parse_var_props($val) {
$val = trim($val);
if (preg_match('~^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match)) {
// $ variable or object
$return = $this
->_parse_var($match[1]);
$modifiers = $match[2];
if (!empty($this->default_modifiers) && !preg_match('~(^|\\|)smarty:nodefaults($|\\|)~', $modifiers)) {
$_default_mod_string = implode('|', (array) $this->default_modifiers);
$modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers;
}
$this
->_parse_modifiers($return, $modifiers);
return $return;
}
elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
// double quoted text
preg_match('~^(' . $this->_db_qstr_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match);
$return = $this
->_expand_quoted_text($match[1]);
if ($match[2] != '') {
$this
->_parse_modifiers($return, $match[2]);
}
return $return;
}
elseif (preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
// numerical constant
preg_match('~^(' . $this->_num_const_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match);
if ($match[2] != '') {
$this
->_parse_modifiers($match[1], $match[2]);
return $match[1];
}
}
elseif (preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
// single quoted text
preg_match('~^(' . $this->_si_qstr_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match);
if ($match[2] != '') {
$this
->_parse_modifiers($match[1], $match[2]);
return $match[1];
}
}
elseif (preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
// config var
return $this
->_parse_conf_var($val);
}
elseif (preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
// section var
return $this
->_parse_section_prop($val);
}
elseif (!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
// literal string
return $this
->_expand_quoted_text('"' . $val . '"');
}
return $val;
}