/** * Output the feed to the browser. * * TODO: Pass $response object to ->outputToBrowser() to loosen dependence on global state for easier testing/prototyping so dev can inject custom HTTPResponse instance. * * @return DBHTMLText */ public function outputToBrowser() { $prevState = SSViewer::config()->get('source_file_comments'); SSViewer::config()->update('source_file_comments', false); $response = Controller::curr()->getResponse(); if (is_int($this->lastModified)) { HTTP::register_modification_timestamp($this->lastModified); $response->addHeader("Last-Modified", gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT'); } if (!empty($this->etag)) { HTTP::register_etag($this->etag); } if (!headers_sent()) { HTTP::add_cache_headers(); $response->addHeader("Content-Type", "application/rss+xml; charset=utf-8"); } SSViewer::config()->update('source_file_comments', $prevState); return $this->renderWith($this->getTemplates()); }