function Smarty_Compiler::_compile_insert_tag in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/smarty/Smarty_Compiler.class.php \Smarty_Compiler::_compile_insert_tag()
Compile {insert ...} tag
Parameters
string $tag_args:
Return value
string
1 call to Smarty_Compiler::_compile_insert_tag()
- Smarty_Compiler::_compile_tag in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - Compile a template tag
File
- includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php, line 918
Class
- Smarty_Compiler
- Template compiling class @package Smarty
Code
function _compile_insert_tag($tag_args) {
$attrs = $this
->_parse_attrs($tag_args);
$name = $this
->_dequote($attrs['name']);
if (empty($name)) {
$this
->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__);
}
if (!empty($attrs['script'])) {
$delayed_loading = true;
}
else {
$delayed_loading = false;
}
foreach ($attrs as $arg_name => $arg_value) {
if (is_bool($arg_value)) {
$arg_value = $arg_value ? 'true' : 'false';
}
$arg_list[] = "'{$arg_name}' => {$arg_value}";
}
$this
->_add_plugin('insert', $name, $delayed_loading);
$_params = "array('args' => array(" . implode(', ', (array) $arg_list) . "))";
return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler({$_params}, \$this); ?>" . $this->_additional_newline;
}