You are here

function Smarty_Compiler::_parse_section_prop in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/smarty/Smarty_Compiler.class.php \Smarty_Compiler::_parse_section_prop()

parse section property expression into PHP code

Parameters

string $section_prop_expr:

Return value

string

1 call to Smarty_Compiler::_parse_section_prop()
Smarty_Compiler::_parse_var_props in includes/moodle/lib/smarty/Smarty_Compiler.class.php
compile single variable and section properties token into PHP code

File

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

Class

Smarty_Compiler
Template compiling class @package Smarty

Code

function _parse_section_prop($section_prop_expr) {
  $parts = explode('|', $section_prop_expr, 2);
  $var_ref = $parts[0];
  $modifiers = isset($parts[1]) ? $parts[1] : '';
  preg_match('!%(\\w+)\\.(\\w+)%!', $var_ref, $match);
  $section_name = $match[1];
  $prop_name = $match[2];
  $output = "\$this->_sections['{$section_name}']['{$prop_name}']";
  $this
    ->_parse_modifiers($output, $modifiers);
  return $output;
}