Редакция 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 {assign_debug_info} function plugin
|
9 | * Smarty {assign_debug_info} function plugin
|
10 | *
|
10 | *
|
11 | * Type: function<br>
|
11 | * Type: function<br>
|
12 | * Name: assign_debug_info<br>
|
12 | * Name: assign_debug_info<br>
|
13 | * Purpose: assign debug info to the template<br>
|
13 | * Purpose: assign debug info to the template<br>
|
14 | * @author Monte Ohrt <monte at ohrt dot com>
|
14 | * @author Monte Ohrt <monte at ohrt dot com>
|
15 | * @param array unused in this plugin, this plugin uses {@link Smarty::$_config},
|
15 | * @param array unused in this plugin, this plugin uses {@link Smarty::$_config},
|
16 | * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info}
|
16 | * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info}
|
17 | * @param Smarty
|
17 | * @param Smarty
|
18 | */
|
18 | */
|
19 | function smarty_function_assign_debug_info($params, &$smarty) |
19 | function smarty_function_assign_debug_info($params, &$smarty) |
20 | {
|
20 | {
|
21 | $assigned_vars = $smarty->_tpl_vars; |
21 | $assigned_vars = $smarty->_tpl_vars; |
22 | ksort($assigned_vars); |
22 | ksort($assigned_vars); |
23 | if (@is_array($smarty->_config[0])) { |
23 | if (@is_array($smarty->_config[0])) { |
24 | $config_vars = $smarty->_config[0]; |
24 | $config_vars = $smarty->_config[0]; |
25 | ksort($config_vars); |
25 | ksort($config_vars); |
26 | $smarty->assign("_debug_config_keys", array_keys($config_vars)); |
26 | $smarty->assign("_debug_config_keys", array_keys($config_vars)); |
27 | $smarty->assign("_debug_config_vals", array_values($config_vars)); |
27 | $smarty->assign("_debug_config_vals", array_values($config_vars)); |
28 | }
|
28 | }
|
29 | 29 | ||
30 | $included_templates = $smarty->_smarty_debug_info; |
30 | $included_templates = $smarty->_smarty_debug_info; |
31 | 31 | ||
32 | $smarty->assign("_debug_keys", array_keys($assigned_vars)); |
32 | $smarty->assign("_debug_keys", array_keys($assigned_vars)); |
33 | $smarty->assign("_debug_vals", array_values($assigned_vars)); |
33 | $smarty->assign("_debug_vals", array_values($assigned_vars)); |
34 | 34 | ||
35 | $smarty->assign("_debug_tpls", $included_templates); |
35 | $smarty->assign("_debug_tpls", $included_templates); |
36 | }
|
36 | }
|
37 | 37 | ||
38 | /* vim: set expandtab: */
|
38 | /* vim: set expandtab: */
|
39 | 39 | ||
40 | ?>
|
40 | ?>
|
41 | 41 |