Esempio n. 1
0
 function onAfterRender()
 {
     global $mainframe;
     // settings from config.xml
     $dumpConfig =& JComponentHelper::getParams('com_dump');
     $autopopup = $dumpConfig->get('autopopup', 1);
     $userstate = $mainframe->getUserState('dump.nodes');
     $cnt_dumps = count($userstate);
     if ($autopopup and $cnt_dumps) {
         DumpHelper::showPopup();
     }
 }
Esempio n. 2
0
 function onAfterRender()
 {
     $mainframe = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     if ($option == 'com_dump') {
         return;
     }
     // settings from config.xml
     $dumpConfig = JComponentHelper::getParams('com_dump');
     $autopopup = $dumpConfig->get('autopopup', 1);
     $userstate = $mainframe->getUserState('dump.nodes');
     $cnt_dumps = count($userstate);
     if ($autopopup && $cnt_dumps) {
         DumpHelper::showPopup();
     }
 }
Esempio n. 3
0
 function &getNode($var, $name, $type = null, $level = 0, $source = null)
 {
     $node['name'] = $name;
     $node['type'] = strtolower($type ? $type : gettype($var));
     $node['children'] = array();
     $node['level'] = $level;
     $node['source'] = $source;
     // expand the var according to type
     switch ($node['type']) {
         case 'backtrace':
             // Skip source when backtrace, and change to array
             $node['source'] = null;
             $node['type'] = 'array';
         case 'array':
             if ($level >= DumpHelper::getMaxDepth()) {
                 $node['children'][] =& DumpNode::getNode('Maximum depth reached', null, 'message');
             } else {
                 foreach ($var as $key => $value) {
                     $node['children'][] =& DumpNode::getNode($value, $key, null, $level + 1);
                 }
             }
             break;
         case 'object':
             if ($level >= DumpHelper::getMaxDepth()) {
                 $node['children'][] =& DumpNode::getNode('Maximum depth reached', null, 'message');
             } else {
                 $object_vars = get_object_vars($var);
                 $methods = get_class_methods($var);
                 if (count($object_vars)) {
                     $node['children'][] =& DumpNode::getNode($var, 'Properties', 'properties', $level);
                 }
                 if (count($methods)) {
                     $node['children'][] =& DumpNode::getNode($var, 'Methods', 'methods', $level);
                 }
             }
             $node['classname'] = get_class($var);
             break;
         case 'properties':
             $object_vars = get_object_vars($var);
             foreach ($object_vars as $key => $value) {
                 $node['children'][] =& DumpNode::getNode($value, $key, null, $level + 1);
             }
             break;
         case 'methods':
             $methods = get_class_methods($var);
             foreach ($methods as $value) {
                 $node['children'][] =& DumpNode::getNode(null, $value, 'method');
             }
             break;
         case 'string':
             jimport('joomla.application.component.helper');
             // settings from config.xml
             $dumpConfig =& JComponentHelper::getParams('com_dump');
             $trimstrings = $dumpConfig->get('trimstrings', 1);
             $maxstrlength = $dumpConfig->get('maxstrlength', 150);
             //original string length
             $length = JString::strlen($var);
             // trim string if needed
             if ($trimstrings and $length > $maxstrlength) {
                 $var = JString::substr($var, 0, $maxstrlength) . '...';
                 $node['length'] = $length;
             }
             $node['value'] = $var;
             break;
         default:
             $node['value'] =& $var;
             break;
     }
     return $node;
 }
 public function getCacheKeyData($key)
 {
     $info = $this->cache_obj->get_metadata($key);
     $expire_time = isset($info['expire']) ? $info['expire'] : 0;
     $mtime = isset($info['mtime']) ? $info['mtime'] : 0;
     $cdata = isset($info['data']) ? $info['data'] : null;
     $data = DumpHelper::getDump($cdata, 10, true);
     $html = '
         <div class="modal-header">
             <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
             <h4 class="modal-title">' . $key . '</h4>
         </div>
         <div class="modal-body">
             ' . $data . '
         </div>
     ';
     echo $html;
     exit;
 }