From 9d5cf4af3321b4e43d21464af26218ed3641a5b4 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 20 Jun 2013 11:22:23 +0200 Subject: [PATCH] remove old Tpex references --- core/lib/Thelia/Core/Template/TPex/Parser.php | 171 ------------------ 1 file changed, 171 deletions(-) delete mode 100644 core/lib/Thelia/Core/Template/TPex/Parser.php diff --git a/core/lib/Thelia/Core/Template/TPex/Parser.php b/core/lib/Thelia/Core/Template/TPex/Parser.php deleted file mode 100644 index b30ca1b70..000000000 --- a/core/lib/Thelia/Core/Template/TPex/Parser.php +++ /dev/null @@ -1,171 +0,0 @@ -. */ -/* */ -/*************************************************************************************/ -namespace Thelia\Core\Template\TPex; - -use Symfony\Component\HttpFoundation\Response; -use Thelia\Core\Template\ParserInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Config\ConfigCache; - -use Thelia\Tpex\Tpex; -use Thelia\Log\Tlog; - -/** - * - * Master class of Thelia's parser. The loop mechanism depends of this parser - * - * From this class all the parser is lunch - * - * - * @author Manuel Raynaud - */ - - -class Parser implements ParserInterface -{ - const PREFIXE = 'prx'; - - const SHOW_TIME = true; - const ALLOW_DEBUG = true; - const USE_CACHE = true; - - - /** - * - * @var Symfony\Component\DependencyInjection\ContainerInterface - */ - protected $container; - - protected $content; - protected $status = 200; - - /** - * - * @var Thelia\Tpex\Tpex - */ - protected $tpex; - - protected $template = "default"; - - /** - * - * @param type $container - * - * public function __construct(ContainerBuilder $container) - */ - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * - * @return Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->container->get('request'); - } - - /** - * - * @return Symfony\Component\EventDispatcher\EventDispatcher - */ - public function getDispatcher() - { - return $this->container->get('dispatcher'); - } - - /** - * - * This method must return a Symfony\Component\HttpFoudation\Response instance or the content of the response - * - */ - public function getContent() - { - $this->loadParser(); - - return $this->content; - } - - /** - * - * set $content with the body of the response or the Response object directly - * - * @param string|Symfony\Component\HttpFoundation\Response $content - */ - public function setContent($content) - { - $this->content = $content; - } - - /** - * - * @return type the status of the response - */ - public function getStatus() - { - return $this->status; - } - - /** - * - * status HTTP of the response - * - * @param int $status - */ - public function setStatus($status) - { - $this->status = $status; - } - - /** - * Main parser function, load the parser - */ - public function loadParser() - { - $content = $this->openFile($this->getRequest()); - - $tpex = $this->container->get("template"); - - $tpex->setBaseDir(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/"); - $tpex->setContent($content); - - $this->setContent($tpex->execute()); - } - - protected function openFile(Request $request) - { - $file = $request->attributes->get('_view'); - $fileName = THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/" . $file . ".html"; - if (file_exists($fileName)) { - $content = file_get_contents($fileName); - } else { - throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template)); - } - - return $content; - } -}