Skip to content

Commit

Permalink
Cleaning up the MediaView class
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 4, 2010
1 parent a611fd0 commit 018def8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cake/libs/view/media.php
Expand Up @@ -25,14 +25,22 @@ class MediaView extends View {
*
* @var boolean
*/
private $compressionEnabled = false;
protected $_compressionEnabled = false;

/**
* Reference to the Response object responsible for sending the headers
*
* @var CakeResponse
*/
public $response = null;


/**
* Constructor
*
* @param object $controller
*/
function __construct(&$controller) {
function __construct($controller = null) {
parent::__construct($controller);
if (is_object($controller) && isset($controller->response)) {
$this->response = $controller->response;
Expand Down Expand Up @@ -142,7 +150,7 @@ function render() {
}
$this->_clearBuffer();
if ($compress) {
$this->compressionEnabled = $this->response->compress();
$this->_compressionEnabled = $this->response->compress();
}

$this->response->send();
Expand All @@ -163,7 +171,7 @@ protected function _sendFile($handle) {
set_time_limit(0);
$buffer = fread($handle, $chunkSize);
echo $buffer;
if (!$this->compressionEnabled) {
if (!$this->_compressionEnabled) {
$this->_flushBuffer();
}
}
Expand Down

0 comments on commit 018def8

Please sign in to comment.