/** * Cleanup */ protected function end() { if ($this->usingBulkTracking) { $result = array('status' => 'success', 'tracked' => $this->countOfLoggedRequests); Common::sendHeader('Content-Type: application/json'); echo Common::json_encode($result); exit; } switch ($this->getState()) { case self::STATE_LOGGING_DISABLE: $this->outputTransparentGif(); Common::printDebug("Logging disabled, display transparent logo"); break; case self::STATE_EMPTY_REQUEST: Common::printDebug("Empty request => Piwik page"); echo "<a href='/'>Piwik</a> is a free/libre web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data."; break; case self::STATE_NOSCRIPT_REQUEST: case self::STATE_NOTHING_TO_NOTICE: default: $this->outputTransparentGif(); Common::printDebug("Nothing to notice => default behaviour"); break; } Common::printDebug("End of the page."); if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) { if (isset(self::$db)) { self::$db->recordProfiling(); Profiler::displayDbTrackerProfile(self::$db); } } self::disconnectDatabase(); }