Хранилища Subversion ant

Редакция

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

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
/**
3
* Smarty Internal Plugin Compile Object Funtion
4
*
5
* Compiles code for registered objects as function
6
*
7
* @package Smarty
8
* @subpackage Compiler
9
* @author Uwe Tews
10
*/
11
/**
12
* Smarty Internal Plugin Compile Object Function Class
13
*/
14
class Smarty_Internal_Compile_Object_Function extends Smarty_Internal_CompileBase {
15
    /**
16
    * Compiles code for the execution of function plugin
17
    *
18
    * @param array $args array with attributes from parser
19
    * @param string $tag name of function
20
    * @param string $methode name of methode to call
21
    * @param object $compiler compiler object
22
    * @return string compiled code
23
    */
24
    public function compile($args, $tag, $methode, $compiler)
25
    {
26
        $this->compiler = $compiler;
27
        // This tag does create output
28
        $this->compiler->has_output = true;
29
 
30
        $this->required_attributes = array();
31
        $this->optional_attributes = array('_any');
32
        // check and get attributes
33
        $_attr = $this->_get_attributes($args);
34
        // convert attributes into parameter array string
35
        $_paramsArray = array();
36
        foreach ($_attr as $_key => $_value) {
37
            $_paramsArray[] = "'$_key'=>$_value";
38
        }
39
        $_params = 'array(' . implode(",", $_paramsArray) . ')';
40
        // compile code
41
        $output = '<?php echo $_smarty_tpl->smarty->registered_objects[\''.$tag.'\'][0]->' . $methode . '(' . $_params . ',$_smarty_tpl->smarty,$_smarty_tpl);?>';
42
 
43
        return $output;
44
    }
45
}
46
 
47
?>