本文整理汇总了PHP中Smarty_Internal_Template::_isDataObj方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Template::_isDataObj方法的具体用法?PHP Smarty_Internal_Template::_isDataObj怎么用?PHP Smarty_Internal_Template::_isDataObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Template
的用法示例。
在下文中一共展示了Smarty_Internal_Template::_isDataObj方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_debug_vars
/**
* Recursively gets variables from all template/data scopes
*
* @param Smarty_Internal_Template|Smarty_Data $obj object to debug
*
* @return StdClass
*/
public function get_debug_vars($obj)
{
$config_vars = array();
foreach ($obj->config_vars as $key => $var) {
$config_vars[$key]['value'] = $var;
if ($obj->_isTplObj()) {
$config_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
} elseif ($obj->_isDataObj()) {
$tpl_vars[$key]['scope'] = $obj->dataObjectName;
} else {
$config_vars[$key]['scope'] = 'Smarty object';
}
}
$tpl_vars = array();
foreach ($obj->tpl_vars as $key => $var) {
foreach ($var as $varkey => $varvalue) {
if ($varkey == 'value') {
$tpl_vars[$key][$varkey] = $varvalue;
} else {
if ($varkey == 'nocache') {
if ($varvalue == true) {
$tpl_vars[$key][$varkey] = $varvalue;
}
} else {
if ($varkey != 'scope' || $varvalue !== 0) {
$tpl_vars[$key]['attributes'][$varkey] = $varvalue;
}
}
}
}
if ($obj->_isTplObj()) {
$tpl_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
} elseif ($obj->_isDataObj()) {
$tpl_vars[$key]['scope'] = $obj->dataObjectName;
} else {
$tpl_vars[$key]['scope'] = 'Smarty object';
}
}
if (isset($obj->parent)) {
$parent = $this->get_debug_vars($obj->parent);
foreach ($parent->tpl_vars as $name => $pvar) {
if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
$tpl_vars[$name]['scope'] = $pvar['scope'];
}
}
$tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
foreach ($parent->config_vars as $name => $pvar) {
if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) {
$config_vars[$name]['scope'] = $pvar['scope'];
}
}
$config_vars = array_merge($parent->config_vars, $config_vars);
} else {
foreach (Smarty::$global_tpl_vars as $key => $var) {
if (!array_key_exists($key, $tpl_vars)) {
foreach ($var as $varkey => $varvalue) {
if ($varkey == 'value') {
$tpl_vars[$key][$varkey] = $varvalue;
} else {
if ($varkey == 'nocache') {
if ($varvalue == true) {
$tpl_vars[$key][$varkey] = $varvalue;
}
} else {
if ($varkey != 'scope' || $varvalue !== 0) {
$tpl_vars[$key]['attributes'][$varkey] = $varvalue;
}
}
}
}
$tpl_vars[$key]['scope'] = 'Global';
}
}
}
return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
}