<?php

namespace Tools;

function _global_include_($filename, $vars)
{
	extract($vars, EXTR_OVERWRITE);
	@include($filename);
}

class Output
{
	private $context;
	private $output_filtering;

	public function __construct($context)
	{
		$this->output_filtering = true;
		$this->context = $context;
	}

	public function renderFile($filePath)
	{
		_global_include_($filePath, array(
			"controller" => $this->context->controller,
			"context" => $this->context,
			"cart" => $this->context->cart,
			"user" => $this->context->user));
		$content = ob_get_contents();
		ob_end_clean();
		$this->filter_content($content);
	}

	public function filter_content($content)
	{
		//TODO trigger hook
		echo $content;
	}
}

