include/template.php
/**
	 * Final parsing of output file
	 *
	 * Called as callback for output buffering
	 *
	 * @param string $buffer
	 */
Final parsing of output file
Called as callback for output buffering

@param string $buffer
Final parsing of output file Called as callback for output buffering @param string $buffer
function templatePostParse($output)
	{
		global $pageParameters, $pageNoPostProcess, $extraHeaders, $smarty;
		if ($pageNoPostProcess) return;
		$Keywords = array();
		if (!is_array($pageParameters['keywords']) || !count($pageParameters['keywords']))
			$pageParameters['keywords'] = array();
		foreach ($pageParameters['keywords'] as $line) {
			$NewKeywords = preg_split("/[\s,]+/", $line, 0, PREG_SPLIT_NO_EMPTY);
			$Keywords = array_merge($Keywords, $NewKeywords);
		}
		if (!is_array($pageParameters['title']) || !count($pageParameters['title']))
			$pageParameters['title'] = array('');
		if (!is_array($pageParameters['description']) || !count($pageParameters['description']))
			$pageParameters['description'] = array('');
		$output = strtr(
			$output,
			array(
				'#Title#'       => end($pageParameters['title']),
				'#Description#' => end($pageParameters['description']),
				'#Keywords#'    => implode(" ",array_unique($Keywords)),
				'#ExtraHeaders#'=> $extraHeaders,
			)
		);
		$acceptExcodings = explode(",",$_SERVER['HTTP_ACCEPT_ENCODING']);
		if (!headers_sent() && array_search('gzip', $acceptExcodings)!==false) {
			header("Content-Encoding: gzip");
			return gzencode($output);
		} else {
			return $output;
		}
	}
function templatePostParse ( $ output ) { global $ pageParameters , $ pageNoPostProcess , $ extraHeaders , $ smarty ; if ( $ pageNoPostProcess ) return ; $ Keywords = array ( ) ; if ( ! is_array ( $ pageParameters [ 'keywords' ] ) || ! count ( $ pageParameters [ 'keywords' ] ) ) $ pageParameters [ 'keywords' ] = array ( ) ; foreach ( $ pageParameters [ 'keywords' ] as $ line ) { $ NewKeywords = preg_split ( " /[\s,]+/ " , $ line , 0 , PREG_SPLIT_NO_EMPTY ) ; $ Keywords = array_merge ( $ Keywords , $ NewKeywords ) ; } if ( ! is_array ( $ pageParameters [ 'title' ] ) || ! count ( $ pageParameters [ 'title' ] ) ) $ pageParameters [ 'title' ] = array ( '' ) ; if ( ! is_array ( $ pageParameters [ 'description' ] ) || ! count ( $ pageParameters [ 'description' ] ) ) $ pageParameters [ 'description' ] = array ( '' ) ; $ output = strtr ( $ output , array ( '#Title#' => end ( $ pageParameters [ 'title' ] ) , '#Description#' => end ( $ pageParameters [ 'description' ] ) , '#Keywords#' => implode ( " " , array_unique ( $ Keywords ) ) , '#ExtraHeaders#' => $ extraHeaders , ) ) ; $ acceptExcodings = explode ( " , " , $ _SERVER [ 'HTTP_ACCEPT_ENCODING' ] ) ; if ( ! headers_sent ( ) && array_search ( 'gzip' , $ acceptExcodings ) !== false ) { header ( " Content-Encoding: gzip " ) ; return gzencode ( $ output ) ; } else { return $ output ; } }
Final parsing of output file
 Called as callback for output buffering
Final parsing of output file Called as callback for output buffering
// Prepare keywords list // Step2 parsing // Check if the browser supports gzip encoding // Return GZipped content // Return normal content