/** * Sends content for the current web response. * * @param DispatcherResponseInterface $response * @return DispatcherResponseTransportRedirect */ public function sendContent(DispatcherResponseInterface $response) { $session = $response->getUser()->getSession(); //Set the messages into the session $messages = $response->getMessages(); if (count($messages)) { //Auto start the session if it's not active. if (!$session->isActive()) { $session->start(); } $session->getContainer('message')->values($messages); } //Set the redirect into the response $response->setContent(sprintf('<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="refresh" content="1;url=%1$s" /> <title>Redirecting to %1$s</title> </head> <body> Redirecting to <a href="%1$s">%1$s</a>. </body> </html>', htmlspecialchars($response->headers->get('Location'), ENT_QUOTES, 'UTF-8'))); return parent::sendContent($response); }
/** * Sends content for the current web response. * * We flush the data to the output buffer based on the chunk size and range information provided in the request. * The default chunk size is 8 MB. * * @param DispatcherResponseInterface $response * @return DispatcherResponseTransportRedirect */ public function sendContent(DispatcherResponseInterface $response) { if ($response->isSuccess()) { //For a certain unmentionable browser if (ini_get('zlib.output_compression')) { @ini_set('zlib.output_compression', 'Off'); } //Fix for IE7/8 if (function_exists('apache_setenv')) { apache_setenv('no-gzip', '1'); } //Remove PHP time limit if (!ini_get('safe_mode')) { @set_time_limit(0); } $stream = $response->getStream(); $offset = $this->getOffset($response); $range = $this->getRange($response); $chunk = $this->getChunkSize(); if ($offset > 0) { $stream->seek($offset); } $stream->flush($chunk, $range); $stream->close(); return $this; } parent::sendContent($response); }
/** * Sends content for the current web response. * * We flush(stream) the data to the output buffer based on the chunk size and range information provided in the * request. The default chunk size is 8 MB. * * @param DispatcherResponseInterface $response * @return DispatcherResponseTransportRedirect */ public function sendContent(DispatcherResponseInterface $response) { if ($response->isSuccess()) { //For a certain unmentionable browser if (ini_get('zlib.output_compression')) { @ini_set('zlib.output_compression', 'Off'); } //Fix for IE7/8 if (function_exists('apache_setenv')) { @apache_setenv('no-gzip', '1'); } //Remove PHP time limit if (!ini_get('safe_mode')) { @set_time_limit(0); } if ($response->isStreamable() && $response->getRequest()->isStreaming()) { //Make sure the output buffers are cleared $level = ob_get_level(); while ($level > 0) { ob_end_clean(); $level--; } $stream = $response->getStream(); $offset = $this->getOffset($response); $range = $this->getRange($response); if ($offset > 0) { $stream->seek($offset); } $output = fopen('php://output', 'w+'); $stream->flush($output, $range); $stream->close(); fclose($output); return $this; } else { return parent::sendContent($response); } } return parent::sendContent($response); }