*/ require_once('lib/debug/debugger-ext.php'); /** * \brief Debugger command to print smarty vars */ class DbgSPrint extends DebuggerCommand { /// \b Must have function to announce command name in debugger console public function name() { return 'sprint'; } /// \b Must have function to provide help to debugger console public function description() { return 'Print Smarty variable'; } /// \b Must have function to provide help to debugger console public function syntax() { return 'sprint var1 var2 var3 ...'; } /// \b Must have functio to show example of usage of given command public function example() { return 'sprint user feature_left_column'; } /// Execute command with given set of arguments. public function execute($params) { $smarty = TikiLib::lib('smarty'); $this->set_result_type(TEXT_RESULT); $result = ''; $vars = explode(' ', $params); foreach ($vars as $v) { $v = trim(str_replace('$', '', $v)); if (strlen($v) != 0) { $tmp = $smarty->getTemplateVars(); if (is_array($tmp) && isset($tmp[$v])) { $result .= $v . ' = ' . print_r($tmp[$v], true) . "\n"; } else { $result .= 'Smarty variable "' . $v . '" not found'; } } } return $result; } } /// Class factory to create instances of defined commands function dbg_command_factory_sprint() { return new DbgSPrint(); }