Related Items

FirePHP + XAjAX PDF Drucken E-Mail
Integration for FirePHP into XAjAX 0.5

xajax_core/xajaxResponseManager.inc.php

@@ -1,4 +1,8 @@
<?php
+/**
+ * @package xajax
+ */
+
 /*
 	File: xajaxResponseManager.inc.php
 
@@ -50,6 +54,13 @@
 		Array: aDebugMessages
 	*/
 	var $aDebugMessages;
+	
+	##NEW
+	/*
+		bool: $myFirePHPdebug
+	*/
+	var $myFirePHPdebug = FALSE;
+	##END NEW
 	
 	/*
 		Function: xajaxResponseManager
@@ -107,6 +118,12 @@
 					$this->objResponse->setOutputEntities($this->bOutputEntities);
 			}
 		}
+		##NEW
+		else if ('firePHPdebug' == $sName)
+		{
+			$this->myFirePHPdebug = $mValue;
+		}
+		##END NEW
 	}
 	
 	/*
@@ -199,7 +216,7 @@
 			foreach ($this->aDebugMessages as $sMessage)
 				$this->objResponse->debug($sMessage);
 			$this->aDebugMessages = array();
-			$this->objResponse->printOutput();
+			$this->objResponse->printOutput($this->myFirePHPdebug); ##NEW: ADDED $this->myFirePHPdebug
 		}
 	}

xajax_core/xajaxResponse.inc.php

@@ -1,4 +1,8 @@
<?php
+/**
+ * @package xajax
+ */
+
 /*
 	File: xajaxResponse.inc.php
 
@@ -1354,11 +1358,11 @@
 		
 		string : The textual representation of the response commands.
 	*/
-	function printOutput()
+	function printOutput($myFirePHPdebug) #NEW: ADDED $myFirePHPdebug
 	{
 		$this->_sendHeaders();
 		$this->_printHeader_XML();
-		$this->_printResponse_XML();
+		$this->_printResponse_XML($myFirePHPdebug); #NEW: ADDED $myFirePHPdebug
 	}
 	
 	/*
@@ -1522,13 +1526,23 @@
 		
 		Used internally to generate the command output.
 	*/
-	function _printResponse_XML()
+	function _printResponse_XML($myFirePHPdebug) #NEW: ADDED $myFirePHPdebug
 	{
 		echo '<';
 		echo 'xjx>';
+                
+                ##NEW
+                if ($myFirePHPdebug)
+                    $firephp = FirePHP::getInstance(true);
+                ##END NEW
 		
 		if (null !== $this->returnValue)
 		{
+                        ##NEW
+                        if ($myFirePHPdebug)
+                            $firephp->log($this->returnValue, 'returnValue');
+                        ##END NEW
+                        
 			echo '<';
 			echo 'xjxrv>';
 			
@@ -1538,11 +1552,18 @@
 			echo '/xjxrv>';
 		}
 		
-		foreach(array_keys($this->aCommands) as $sKey)
+		foreach(array_keys($this->aCommands) as $sKey) {
+                        ##NEW
+                        if ($myFirePHPdebug)
+                            $firephp->log($this->aCommands[$sKey], 'aCommands');
+                        ##END NEW
+                        
 			$this->_printCommand_XML($this->aCommands[$sKey]);
+		}
 		
 		echo '<';
 		echo '/xjx>';
+                
 	}
 	
 	/*

How to activate:

require_once('FirePHPCore/FirePHP.class.php');
$xajax->configure('firePHPdebug', true);
 
< Zurück