• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Debug.php

00001 <?php
00031 class Zend_Debug
00032 {
00033 
00037     protected static $_sapi = null;
00038 
00045     public static function getSapi()
00046     {
00047         if (self::$_sapi === null) {
00048             self::$_sapi = PHP_SAPI;
00049         }
00050         return self::$_sapi;
00051     }
00052 
00060     public static function setSapi($sapi)
00061     {
00062         self::$_sapi = $sapi;
00063     }
00064 
00075     public static function dump($var, $label=null, $echo=true)
00076     {
00077         // format the label
00078         $label = ($label===null) ? '' : rtrim($label) . ' ';
00079 
00080         // var_dump the variable into a buffer and keep the output
00081         ob_start();
00082         var_dump($var);
00083         $output = ob_get_clean();
00084 
00085         // neaten the newlines and indents
00086         $output = preg_replace("/\]\=>\n(\s+)/m", "] => ", $output);
00087         if (self::getSapi() == 'cli') {
00088             $output = PHP_EOL . $label
00089                     . PHP_EOL . $output
00090                     . PHP_EOL;
00091         } else {
00092             if(!extension_loaded('xdebug')) {
00093                 $output = htmlspecialchars($output, ENT_QUOTES);
00094             }
00095 
00096             $output = '<pre>'
00097                     . $label
00098                     . $output
00099                     . '</pre>';
00100         }
00101 
00102         if ($echo) {
00103             echo($output);
00104         }
00105         return $output;
00106     }
00107 
00108 }

Generated on Thu Apr 19 2012 17:01:17 for openbiz by  doxygen 1.7.2