phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc common_functions.inc.php,1.3,1.4 ph


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc common_functions.inc.php,1.3,1.4 php3_support_functions.inc.php,1.15,1.16
Date: Sat, 06 Apr 2002 10:13:53 -0500

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

Modified Files:
        common_functions.inc.php php3_support_functions.inc.php 
Log Message:
This now allows the _debug_array() to either print or not print the debug info.

Index: common_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/common_functions.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** common_functions.inc.php    16 Mar 2002 02:56:57 -0000      1.3
--- common_functions.inc.php    6 Apr 2002 15:13:51 -0000       1.4
***************
*** 624,628 ****
  
        /* Just a wrapper to my new print_r() function I added to the php3 
support file.  Seek3r */
!       function _debug_array($array)
        {
                $four = False;
--- 624,628 ----
  
        /* Just a wrapper to my new print_r() function I added to the php3 
support file.  Seek3r */
!       function _debug_array($array,$print=True)
        {
                $four = False;
***************
*** 633,642 ****
                if($four)
                {
                        echo '<pre>';
                }
!               print_r($array);
!               if($four)
                {
!                       echo '</pre>';
                }
        }
--- 633,653 ----
                if($four)
                {
+                       if(!$print)
+                       {
+                               ob_start();
+                       }
                        echo '<pre>';
+                       print_r($array);
+                       echo '</pre>';
+                       if(!$print)
+                       {
+                               $v = ob_get_contents();
+                               ob_end_clean();
+                               return $v;
+                       }
                }
!               else
                {
!                       return print_r($array,False,$print);
                }
        }

Index: php3_support_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/php3_support_functions.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** php3_support_functions.inc.php      16 Mar 2002 02:59:13 -0000      1.15
--- php3_support_functions.inc.php      6 Apr 2002 15:13:51 -0000       1.16
***************
*** 276,304 ****
        }
  
!       function print_r($array,$recursed=False)
        {
                if(is_array($array) || is_object($array))
                {
                        if(!$recursed)
                        {
!                               echo '<p>';
                        }
!                       echo ucfirst(gettype($array)) . '(<ul>';
  
                        while(list($index, $subarray) = each($array) )
                        {
!                               echo '<li>'.$index.' <code>=&gt;&nbsp;</code>';
!                               print_r($subarray,True);
!                               echo '</li>';
                        }
!                       echo '</ul>)';
                }
                elseif(is_string($array))
                {
!                       echo ucfirst(gettype($array)) . '("' . $array . '")';
                }
                else
                {
!                       echo gettype($array) . '(' . $array . ')';
                }
        }
--- 276,313 ----
        }
  
!       function print_r($array,$recursed=False,$print=True)
        {
+               $str = '';
                if(is_array($array) || is_object($array))
                {
                        if(!$recursed)
                        {
!                               $str .= '<p>';
                        }
!                       $str .= ucfirst(gettype($array)) . '(<ul>';
  
                        while(list($index, $subarray) = each($array) )
                        {
!                               $str .= '<li>'.$index.' 
<code>=&gt;&nbsp;</code>';
!                               $str .= print_r($subarray,True,$print);
!                               $str .= '</li>';
                        }
!                       $str .= '</ul>)';
                }
                elseif(is_string($array))
                {
!                       $str .= ucfirst(gettype($array)) . '("' . $array . '")';
                }
                else
                {
!                       $str .= gettype($array) . '(' . $array . ')';
!               }
!               if($print)
!               {
!                       echo $str;
!               }
!               else
!               {
!                       return $str;
                }
        }




reply via email to

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