phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc functions.inc.php,1.121,1.121.2.1


From: Dan Kuykendall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc functions.inc.php,1.121,1.121.2.1
Date: Tue, 12 Feb 2002 04:10:14 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv25204/phpgwapi/inc

Modified Files:
      Tag: Version-0_9_14-branch
        functions.inc.php 
Log Message:
fixed header to use  and added my debug constants along with my replacement for 
print_debug

Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.121
retrieving revision 1.121.2.1
diff -C2 -r1.121 -r1.121.2.1
*** functions.inc.php   13 Jan 2002 04:06:40 -0000      1.121
--- functions.inc.php   12 Feb 2002 09:10:10 -0000      1.121.2.1
***************
*** 1,4 ****
  <?php
- /*    $GLOBALS['debugme'] = "on"; */
         
/**************************************************************************\
         * phpGroupWare API - phpgwapi loader                                   
    *
--- 1,3 ----
***************
*** 46,49 ****
--- 45,87 ----
  
        /*!
+        @function print_debug
+        @abstract print debug data only when debugging mode is turned on.
+        @author seek3r
+        @discussion This function is used to debugging data. 
+        @syntax print_debug('message', $somevar);
+        @example print_debug('this is some debugging data',$somevar);
+       */
+       function print_debug($message,$var = 'messageonly',$part = 'app', 
$level = 3)
+       {
+               if (($part == 'app' && DEBUG_APP == True) || ($part == 'api' && 
DEBUG_API == True))
+               {
+                       if ($level >= DEBUG_LEVEL)
+                       {
+                               if (!is_array($var))
+                               {
+                                       if ($var != 'messageonly')
+                                       {
+                                               echo "$message is a 
".gettype($var)."<br>\n";
+                                       }
+                                       else
+                                       {
+                                               echo "$message<br>\n";
+                                       }
+                               }
+                               else
+                               {
+                                       echo "<pre>\n$message\n";
+                                       print_r($var);
+                                       while(list($key, $value) = each($var))
+                                       {
+                                               echo 'Array['.$key.'] is a 
'.gettype($var[$key])."\n";
+                                       }
+                                       echo "\n<pre>\n";
+                               }
+                       }
+               }
+       }
+       
+       /*!
         @function sanitize
         @abstract Validate data.
***************
*** 467,494 ****
        }
  
        function _debug_array($array)
        {
!               if(floor(phpversion()) == 4)
!               {
!                       ob_start(); 
!                       echo '<pre>'; print_r($array); echo '</pre>';
!                       $contents = ob_get_contents(); 
!                       ob_end_clean();
!                       echo $contents;
! //                    return $contents;
!               }
!               else
!               {
!                       echo '<pre>'; var_dump($array); echo '</pre>';
!               }
!       }
! 
!       function print_debug($text='')
!       {
!               if (isset($GLOBALS['debugme']) &&
!                       $GLOBALS['debugme'] == 'on')
!               {
!                       echo 'debug: '.$text.'<br>';
!               }
        }
  
--- 505,512 ----
        }
  
+       /* Just a wrapper to my new print_r() function I added to the php3 
support file.  Seek3r */
        function _debug_array($array)
        {
!               print_r($array);
        }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]