change Tpex integration

This commit is contained in:
Manuel Raynaud
2013-04-08 17:06:04 +02:00
parent 29c05e53f2
commit 266e0bd5eb
5 changed files with 74 additions and 15 deletions

View File

@@ -8,6 +8,7 @@
}, },
"require":{ "require":{
"php": ">=5.4.0", "php": ">=5.4.0",
"ezyang/htmlpurifier": "dev-master",
"ircmaxell/password-compat": "dev-master", "ircmaxell/password-compat": "dev-master",
"propel/propel1" : "1.6.*", "propel/propel1" : "1.6.*",
"psr/log" : "1.0", "psr/log" : "1.0",

57
composer.lock generated
View File

@@ -1,6 +1,50 @@
{ {
"hash": "89f5db06d70dd16aa1ba0f4983c89335", "hash": "b0cd7b00eccd6c31a028d4536d822017",
"packages": [ "packages": [
{
"name": "ezyang/htmlpurifier",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "v4.5.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/v4.5.0",
"reference": "v4.5.0",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"type": "library",
"autoload": {
"psr-0": {
"HTMLPurifier": "library/"
},
"files": [
"library/HTMLPurifier.composer.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"time": "2013-02-18 00:04:08"
},
{ {
"name": "ircmaxell/password-compat", "name": "ircmaxell/password-compat",
"version": "dev-master", "version": "dev-master",
@@ -94,16 +138,16 @@
}, },
{ {
"name": "propel/propel1", "name": "propel/propel1",
"version": "1.6.8", "version": "1.6.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/propelorm/Propel.git", "url": "https://github.com/propelorm/Propel.git",
"reference": "1.6.8" "reference": "1.6.9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/propelorm/Propel/zipball/1.6.8", "url": "https://api.github.com/repos/propelorm/Propel/zipball/1.6.9",
"reference": "1.6.8", "reference": "1.6.9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -150,7 +194,7 @@
"orm", "orm",
"persistence" "persistence"
], ],
"time": "2013-02-14 20:50:27" "time": "2013-03-31 17:20:51"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@@ -676,6 +720,7 @@
], ],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
"ezyang/htmlpurifier": 20,
"ircmaxell/password-compat": 20 "ircmaxell/password-compat": 20
}, },
"platform": { "platform": {

View File

@@ -148,15 +148,11 @@ class Parser implements ParserInterface
{ {
$content = $this->openFile($this->getRequest()); $content = $this->openFile($this->getRequest());
$tpex = new Tpex(); $tpex = $this->container->get("template");
$tpex->setBaseDir(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/");
$tpex->setContent($content);
$tpex->init($this->container->get("request"), $this->container->get("event_dispatcher"), $content, THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/");
$tpex->configure(
$this->container->getParameter("Tpex.loop"),
$this->container->getParameter("Tpex.filter"),
$this->container->getParameter("Tpex.baseParam"),
$this->container->getParameter("Tpex.testLoop")
);
$this->setContent($tpex->execute()); $this->setContent($tpex->execute());
} }

View File

@@ -62,6 +62,23 @@
<argument type="service" id="controller_resolver" /> <argument type="service" id="controller_resolver" />
</service> </service>
<service id="template" class="Thelia\Tpex\Tpex" scope="request">
<argument type="service" id="request" />
<argument type="service" id="event_dispatcher"/>
<call method="setLoop">
<argument>%tpex.loop%</argument>
</call>
<call method="setFilter">
<argument>%tpex.filter%</argument>
</call>
<call method="setBaseParams">
<argument>%tpex.baseParam%</argument>
</call>
<call method="setTestLoop">
<argument>%tpex.testLoop%</argument>
</call>
</service>
<service id="request" scope="request" synthetic="true" /> <service id="request" scope="request" synthetic="true" />
<service id="service_container" synthetic="true" /> <service id="service_container" synthetic="true" />