Редакция 2 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 2 | Редакция 3 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | /**
|
2 | /**
|
3 | * Smarty plugin
|
3 | * Smarty plugin
|
4 | * @package Smarty
|
4 | * @package Smarty
|
5 | * @subpackage plugins
|
5 | * @subpackage plugins
|
6 | */
|
6 | */
|
7 | 7 | ||
8 | /**
|
8 | /**
|
9 | * Smarty debug_console function plugin
|
9 | * Smarty debug_console function plugin
|
10 | *
|
10 | *
|
11 | * Type: core<br>
|
11 | * Type: core<br>
|
12 | * Name: display_debug_console<br>
|
12 | * Name: display_debug_console<br>
|
13 | * Purpose: display the javascript debug console window
|
13 | * Purpose: display the javascript debug console window
|
14 | * @param array Format: null
|
14 | * @param array Format: null
|
15 | * @param Smarty
|
15 | * @param Smarty
|
16 | */
|
16 | */
|
17 | function smarty_core_display_debug_console($params, &$smarty) |
17 | function smarty_core_display_debug_console($params, &$smarty) |
18 | {
|
18 | {
|
19 | // we must force compile the debug template in case the environment
|
19 | // we must force compile the debug template in case the environment
|
20 | // changed between separate applications.
|
20 | // changed between separate applications.
|
21 | 21 | ||
22 | if(empty($smarty->debug_tpl)) { |
22 | if(empty($smarty->debug_tpl)) { |
23 | // set path to debug template from SMARTY_DIR
|
23 | // set path to debug template from SMARTY_DIR
|
24 | $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl'; |
24 | $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl'; |
25 | if($smarty->security && is_file($smarty->debug_tpl)) { |
25 | if($smarty->security && is_file($smarty->debug_tpl)) { |
26 | $smarty->secure_dir[] = realpath($smarty->debug_tpl); |
26 | $smarty->secure_dir[] = realpath($smarty->debug_tpl); |
27 | }
|
27 | }
|
28 | $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl'; |
28 | $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl'; |
29 | }
|
29 | }
|
30 | 30 | ||
31 | $_ldelim_orig = $smarty->left_delimiter; |
31 | $_ldelim_orig = $smarty->left_delimiter; |
32 | $_rdelim_orig = $smarty->right_delimiter; |
32 | $_rdelim_orig = $smarty->right_delimiter; |
33 | 33 | ||
34 | $smarty->left_delimiter = '{'; |
34 | $smarty->left_delimiter = '{'; |
35 | $smarty->right_delimiter = '}'; |
35 | $smarty->right_delimiter = '}'; |
36 | 36 | ||
37 | $_compile_id_orig = $smarty->_compile_id; |
37 | $_compile_id_orig = $smarty->_compile_id; |
38 | $smarty->_compile_id = null; |
38 | $smarty->_compile_id = null; |
39 | 39 | ||
40 | $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl); |
40 | $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl); |
41 | if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) |
41 | if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) |
42 | {
|
42 | {
|
43 | ob_start(); |
43 | ob_start(); |
44 | $smarty->_include($_compile_path); |
44 | $smarty->_include($_compile_path); |
45 | $_results = ob_get_contents(); |
45 | $_results = ob_get_contents(); |
46 | ob_end_clean(); |
46 | ob_end_clean(); |
47 | } else { |
47 | } else { |
48 | $_results = ''; |
48 | $_results = ''; |
49 | }
|
49 | }
|
50 | 50 | ||
51 | $smarty->_compile_id = $_compile_id_orig; |
51 | $smarty->_compile_id = $_compile_id_orig; |
52 | 52 | ||
53 | $smarty->left_delimiter = $_ldelim_orig; |
53 | $smarty->left_delimiter = $_ldelim_orig; |
54 | $smarty->right_delimiter = $_rdelim_orig; |
54 | $smarty->right_delimiter = $_rdelim_orig; |
55 | 55 | ||
56 | return $_results; |
56 | return $_results; |
57 | }
|
57 | }
|
58 | 58 | ||
59 | /* vim: set expandtab: */
|
59 | /* vim: set expandtab: */
|
60 | 60 | ||
61 | ?>
|
61 | ?>
|
62 | 62 |