예제 #1
0
 function printr($what)
 {
     ob_start();
     print_r($what);
     $result = ob_get_clean();
     NetDebug::getTraceStack($result);
 }
예제 #2
0
/**
 * Debug action
 */
function debugAction(&$body)
{
    if (count(NetDebug::getTraceStack()) != 0) {
        $previousResults = $body->getResults();
        $debugInfo = NetDebug::getTraceStack();
        $debugString = "<!-- " . implode("\n", $debugInfo) . "-->";
        $body->setResults($debugString . "\n" . $previousResults);
    }
}
예제 #3
0
function serializationAction(&$body)
{
    //Take the raw response
    $rawResponse =& $body->getResults();
    adapterMap($rawResponse);
    //Now serialize it
    $encodedResponse = json_encode($rawResponse);
    if (count(NetDebug::getTraceStack()) > 0) {
        $trace = "/*" . implode("\n", NetDebug::getTraceStack()) . "*/";
        $encodedResponse = $trace . "\n" . $encodedResponse;
    }
    $body->setResults($encodedResponse);
}
예제 #4
0
파일: NetDebug.php 프로젝트: ksecor/civicrm
 /**
  * A static function that traces stuff in the NetDebug window
  * 
  * Note emulation of static variables
  */
 function trace($what)
 {
     NetDebug::getTraceStack($what);
 }
예제 #5
0
/**
 * Adds debugging information to outgoing packet
 */
function debugFilter(&$amf)
{
    //Add trace headers before outputting
    if (!$GLOBALS['amfphp']['isFlashComm'] && !$GLOBALS['amfphp']['disableTrace']) {
        $headerresults = array();
        // create a result array
        $headerresults[0] = array();
        // create a sub array in results (CF seems to do this, don't know why)
        if (count(NetDebug::getTraceStack()) != 0) {
            $ts = NetDebug::getTraceStack();
            $headerresults[0][] = new TraceHeader($ts);
        }
        if (Headers::getHeader("serviceBrowser") == true) {
            global $amfphp;
            $amfphp['totalTime'] = microtime_float() - $amfphp['startTime'];
            $headerresults[0][] = new ProfilingHeader();
        }
        //Get the last body in the stack
        if (count($headerresults[0]) > 0) {
            $body =& $amf->getBodyAt($amf->numBody() - 1);
            $headers = new MessageBody(NULL, $body->responseIndex, NULL);
            // create a new amf body
            $headers->responseURI = $body->responseIndex . "/onDebugEvents";
            // set the response uri of this body
            $headers->setResults($headerresults);
            // set the results.
            $amf->addBodyAt(0, $headers);
        }
    }
}
예제 #6
0
파일: Filters.php 프로젝트: ksecor/civicrm
/**
 * Adds debugging information to outgoing packet
 */
function debugFilter(&$amf)
{
    //Add trace headers before outputting
    if (!$GLOBALS['amfphp']['isFlashComm'] && !$GLOBALS['amfphp']['disableTrace'] && count(NetDebug::getTraceStack()) != 0) {
        //Get the last body in the stack
        $body =& $amf->getBodyAt($amf->numBody() - 1);
        $headers = new AMFBody(NULL, $body->responseIndex, NULL);
        // create a new amf body
        $headers->responseURI = $body->responseIndex . "/onDebugEvents";
        // set the response uri of this body
        $headerresults = array();
        // create a result array
        $headerresults[0] = array();
        // create a sub array in results (CF seems to do this, don't know why)
        $ts = NetDebug::getTraceStack();
        $headerresults[0][] = new TraceHeader($ts);
        $headers->setResults($headerresults);
        // set the results.
        $amf->addBodyAt(0, $headers);
    }
}