当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty_Internal_Template::_isDataObj方法代码示例

本文整理汇总了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);
 }
开发者ID:jimjag,项目名称:smarty,代码行数:83,代码来源:smarty_internal_debug.php


注:本文中的Smarty_Internal_Template::_isDataObj方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。