Piwik\Tracker\Response::outputResponse PHP Method

outputResponse() public method

public outputResponse ( Piwik\Tracker $tracker )
$tracker Piwik\Tracker
    public function outputResponse(Tracker $tracker)
    {
        if (!$tracker->shouldRecordStatistics()) {
            $this->outputApiResponse($tracker);
            Common::printDebug("Logging disabled, display transparent logo");
        } elseif (!$tracker->hasLoggedRequests()) {
            if (!$this->isHttpGetRequest() || !empty($_GET) || !empty($_POST)) {
                Common::sendResponseCode(400);
            }
            Common::printDebug("Empty request => Piwik page");
            echo "This resource is part of Piwik. Keep full control of your data with the leading free and open source <a href='https://piwik.org' target='_blank'>digital analytics platform</a> for web and mobile.";
        } else {
            $this->outputApiResponse($tracker);
            Common::printDebug("Nothing to notice => default behaviour");
        }
        Common::printDebug("End of the page.");
        if ($tracker->isDebugModeEnabled() && $tracker->isDatabaseConnected() && TrackerDb::isProfilingEnabled()) {
            $db = Tracker::getDatabase();
            $db->recordProfiling();
            Profiler::displayDbTrackerProfile($db);
        }
        if ($tracker->isDebugModeEnabled()) {
            Common::printDebug($_COOKIE);
            Common::printDebug((string) $this->timer);
        }
    }

Usage Example

Example #1
0
 public function finish(Tracker $tracker, RequestSet $requestSet)
 {
     $this->response->outputResponse($tracker);
     $this->redirectIfNeeded($requestSet);
     return $this->response->getOutput();
 }