blob: a131a557d3045a9f1fd798d73f18bfd41dd943e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
namespace Bitweaver\Plugins;
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/** \file
* $Header$
*
* \author zaufi <zaufi@sendmail.ru>
*/
/**
* \brief Smarty plugin to add variable dump to debug console log
* Usage format {var_dump var=var_name_2_dump}
*/
function smarty_function_var_dump($params, &$gBitSmarty)
{
global $debugger;
require_once( DEBUG_PKG_PATH.'debugger.php' );
//
$v = $params['var'];
if (strlen($v) != 0)
{
$tmp = $gBitSmarty->getTemplateVars();
if (is_array($tmp) && isset($tmp[$v]))
$debugger->msg("Smarty var_dump(".$v.') = '.print_r($tmp[$v], true));
else
$debugger->msg("Smarty var_dump(".$v."): Variable not found");
}
else
$debugger->msg("Smarty var_dump: Parameter 'var' not specified");
return '<!-- var_dump('.$v.') -->';
}
|