src/Header.php
public function getAll($handle) {
		// set content type at first position so it will get overwritten by later definitions
		array_unshift($this->_header, 'Content-Type: text/html; charset=utf-8');
		$this->_header[] = 'Vary:';

		// use etag for content validation (only HTTP1.1)
		rewind($handle);
		$hash = hash_init('md5');
		hash_update_stream($hash, $handle);
		$hash = hash_final($hash);
		
		// add all user defined headers to hash
		// if we change one of those we also want to see the actual view
		$hash = md5($hash . implode('', $this->_header));
		
		if ($this->_cacheetag) $this->_header[] = 'ETag: '.$hash; // HTTP 1.1
		
		if ($this->_cachetime === null) {
			// no caching
			if ($this->_cacheetag) $this->_header[] = 'Cache-Control: no-cache, must-revalidate';
			else $this->_header[] = 'Cache-Control: no-store, no-cache, must-revalidate'; // to overwrite default php setting with "no-store"
		} else {
			// caching
			$fileexpired = strtotime($this->_cachetime);
			$filemaxage = $fileexpired-time();

			// HTTP 1.0
			$this->_header[] = 'Pragma: ';
			$this->_header[] = 'Expires: '.gmdate("D, d M Y H:i:s", $fileexpired) ." GMT";

			// HTTP 1.1
			$this->_header[] = 'Cache-Control: public, max-age='.$filemaxage;
		}

		// check for etag
		if (!isset($_SERVER['HTTP_CACHE_CONTROL']) || !preg_match('/max-age=0|no-cache/i', $_SERVER['HTTP_CACHE_CONTROL'])) // by-pass "not modified" on explicit reload
			if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $hash) {
				$this->_etag_is_different = false;
				$this->_header[] = 'HTTP/1.1 304 Not Modified';
			}

		// set download header
		if (!empty($this->_filename)) {
			$this->_header[] = 'Content-Type: ' . $this->getMimeType($this->_filename);
			$this->_header[] = 'Content-Disposition: attachment; filename='.basename($this->_filename);
		}

		return $this->_header;
	}
public function getAll($handle) {
		// set content type at first position so it will get overwritten by later definitions
		array_unshift($this->_header, 'Content-Type: text/html; charset=utf-8');
		$this->_header[] = 'Vary:';

		// use etag for content validation (only HTTP1.1)
		rewind($handle);
		$hash = hash_init('md5');
		hash_update_stream($hash, $handle);
		$hash = hash_final($hash);
		
		// add all user defined headers to hash
		// if we change one of those we also want to see the actual view
		$hash = md5($hash . implode('', $this->_header));
		
		if ($this->_cacheetag) $this->_header[] = 'ETag: '.$hash; // HTTP 1.1
		
		if ($this->_cachetime === null) {
			// no caching
			if ($this->_cacheetag) $this->_header[] = 'Cache-Control: no-cache, must-revalidate';
			else $this->_header[] = 'Cache-Control: no-store, no-cache, must-revalidate'; // to overwrite default php setting with "no-store"
		} else {
			// caching
			$fileexpired = strtotime($this->_cachetime);
			$filemaxage = $fileexpired-time();

			// HTTP 1.0
			$this->_header[] = 'Pragma: ';
			$this->_header[] = 'Expires: '.gmdate("D, d M Y H:i:s", $fileexpired) ." GMT";

			// HTTP 1.1
			$this->_header[] = 'Cache-Control: public, max-age='.$filemaxage;
		}

		// check for etag
		if (!isset($_SERVER['HTTP_CACHE_CONTROL']) || !preg_match('/max-age=0|no-cache/i', $_SERVER['HTTP_CACHE_CONTROL'])) // by-pass "not modified" on explicit reload
			if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $hash) {
				$this->_etag_is_different = false;
				$this->_header[] = 'HTTP/1.1 304 Not Modified';
			}

		// set download header
		if (!empty($this->_filename)) {
			$this->_header[] = 'Content-Type: ' . $this->getMimeType($this->_filename);
			$this->_header[] = 'Content-Disposition: attachment; filename='.basename($this->_filename);
		}

		return $this->_header;
	}
public function getAll ( $ handle ) { // set content type at first position so it will get overwritten by later definitions array_unshift ( $ this -> _header , 'Content-Type: text/html; charset=utf-8' ) ; $ this -> _header [ ] = 'Vary:' ; // use etag for content validation (only HTTP1.1) rewind ( $ handle ) ; $ hash = hash_init ( 'md5' ) ; hash_update_stream ( $ hash , $ handle ) ; $ hash = hash_final ( $ hash ) ; // add all user defined headers to hash // if we change one of those we also want to see the actual view $ hash = md5 ( $ hash . implode ( '' , $ this -> _header ) ) ; if ( $ this -> _cacheetag ) $ this -> _header [ ] = 'ETag: ' . $ hash ; // HTTP 1.1 if ( $ this -> _cachetime === null ) { // no caching if ( $ this -> _cacheetag ) $ this -> _header [ ] = 'Cache-Control: no-cache, must-revalidate' ; else $ this -> _header [ ] = 'Cache-Control: no-store, no-cache, must-revalidate' ; // to overwrite default php setting with "no-store" } else { // caching $ fileexpired = strtotime ( $ this -> _cachetime ) ; $ filemaxage = $ fileexpired - time ( ) ; // HTTP 1.0 $ this -> _header [ ] = 'Pragma: ' ; $ this -> _header [ ] = 'Expires: ' . gmdate ( "D, d M Y H:i:s" , $ fileexpired ) . " GMT" ; // HTTP 1.1 $ this -> _header [ ] = 'Cache-Control: public, max-age=' . $ filemaxage ; } // check for etag if ( ! isset ( $ _SERVER [ 'HTTP_CACHE_CONTROL' ] ) || ! preg_match ( '/max-age=0|no-cache/i' , $ _SERVER [ 'HTTP_CACHE_CONTROL' ] ) ) // by-pass "not modified" on explicit reload if ( isset ( $ _SERVER [ 'HTTP_IF_NONE_MATCH' ] ) && $ _SERVER [ 'HTTP_IF_NONE_MATCH' ] == $ hash ) { $ this -> _etag_is_different = false ; $ this -> _header [ ] = 'HTTP/1.1 304 Not Modified' ; } // set download header if ( ! empty ( $ this -> _filename ) ) { $ this -> _header [ ] = 'Content-Type: ' . $ this -> getMimeType ( $ this -> _filename ) ; $ this -> _header [ ] = 'Content-Disposition: attachment; filename=' . basename ( $ this -> _filename ) ; } return $ this -> _header ; }
Returns all headers for a given content. This is internally used by the \Morrow\Core\Frontcontroller class.

@param	object	$handle	The stream handle for the generated content.
@return	array All headers as array.
Returns all headers for a given content . This is internally used by the \ Morrow \ Core \ Frontcontroller class .