Хранилища Subversion ant

Редакция

Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
/**
3
* Smarty Internal Plugin Compile Function Close
4
*
5
* Compiles the {/function} tag
6
*
7
* @package Smarty
8
* @subpackage Compiler
9
* @author Uwe Tews
10
*/
11
/**
12
* Smarty Internal Plugin Compile FunctionClose Class
13
*/
14
class Smarty_Internal_Compile_FunctionClose extends Smarty_Internal_CompileBase {
15
    /**
16
    * Compiles code for the {/function} tag
17
    *
18
    * @param array $args array with attributes from parser
19
    * @param object $compiler compiler object
20
    * @return boolean true
21
    */
22
    public function compile($args, $compiler)
23
    {
24
        $this->compiler = $compiler;
25
        $this->compiler->has_code = false;
26
        // turn off block code extraction
27
        $compiler->template->extract_code = false;
28
        // check and get attributes
29
        $this->optional_attributes = array('name');
30
        $_attr = $this->_get_attributes($args);
31
        $saved_data = $this->_close_tag(array('function'));
32
        // if name does match to opening tag
33
        if (isset($_attr['name']) && $saved_data[0]['name'] != $_attr['name']) {
34
            $this->compiler->trigger_template_error('mismatching name attributes "' . $saved_data[0]['name'] . '" and "' . $_attr['name'] . '"');
35
        }
36
        $_name = trim($saved_data[0]['name'], "'");
37
        $compiler->template->properties['function'][$_name]['compiled'] = str_replace("\n",'_%n',$compiler->template->extracted_compiled_code);
38
        $this->compiler->smarty->template_functions[$_name]['compiled'] = $compiler->template->extracted_compiled_code;
39
        $this->compiler->smarty->template_functions[$_name]['parameter'] = $compiler->template->properties['function'][$_name]['parameter'];
40
        $compiler->template->extracted_compiled_code = $saved_data[1];
41
        $compiler->template->extract_code = $saved_data[2];
42
        return true;
43
    }
44
}
45
 
46
?>