Хранилища Subversion ant

Редакция

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

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
 
3
/**
4
* Smarty Internal Plugin Debug
5
*
6
* Class to collect data for the Smarty Debugging Consol
7
*
8
* @package Smarty
9
* @subpackage Debug
10
* @author Uwe Tews
11
*/
12
/**
13
* Smarty Internal Plugin Debug Class
14
*/
15
class Smarty_Internal_Debug extends Smarty_Internal_TemplateBase {
16
    /**
17
    * Opens a window for the Smarty Debugging Consol and display the data
18
    */
19
    public static function display_debug($smarty)
20
    {
21
        // get template names
22
        $i = 0;
23
        $_template_data = array();
24
        if (is_array($smarty->template_objects)) {
25
            foreach ($smarty->template_objects as $_template_obj) {
26
                // exclude the debugging template from displayed data
27
                if ($smarty->debug_tpl != $_template_obj->resource_name) {
28
                    $_template_data[$i]['name'] = $_template_obj->getTemplateFilepath();
29
                    $_template_data[$i]['compile_time'] = $_template_obj->compile_time;
30
                    $_template_data[$i]['render_time'] = $_template_obj->render_time;
31
                    $_template_data[$i]['cache_time'] = $_template_obj->cache_time;
32
                    $i++;
33
                    if (false && $i == 1) {
34
                        foreach ($_template_obj->properties['file_dependency'] as $_file) {
35
                            $_template_data[$i]['name'] = $_file[0];
36
                            $_template_data[$i]['compile_time'] = 0;
37
                            $_template_data[$i]['render_time'] = 0;
38
                            $_template_data[$i]['cache_time'] = 0;
39
                            $i++;
40
                        }
41
                    }
42
                }
43
            }
44
        }
45
        // prepare information of assigned variables
46
        $_assigned_vars = $smarty->tpl_vars;
47
        ksort($_assigned_vars);
48
        $_config_vars = $smarty->config_vars;
49
        ksort($_config_vars);
50
        $_template = new Smarty_Template ($smarty->debug_tpl, $smarty);
51
        $_template->caching = false;
52
        $_template->force_compile = false;
53
        $_template->security = false;
54
        $_template->assign('template_data', $_template_data);
55
        $_template->assign('assigned_vars', $_assigned_vars);
56
        $_template->assign('config_vars', $_config_vars);
57
        $_template->assign('execution_time', $smarty->_get_time() - $smarty->start_time);
58
        echo $smarty->fetch($_template);
59
    }
60
}
61
 
62
?>