From 573a21e6439d50acb6c8e0d465ed6269ebf8805a Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Mon, 4 Aug 2014 16:37:29 +0200 Subject: [PATCH] =?UTF-8?q?Clear=20Container=20usage=20in=20position=20act?= =?UTF-8?q?ion=20and=20fix=20slashes=20adding=20in=20CSV=20formatter=20=09?= =?UTF-8?q?modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Action/?= =?UTF-8?q?Export.php=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/li?= =?UTF-8?q?b/Thelia/Action/Import.php=20=09modifi=C3=A9:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20core/lib/Thelia/Config/Resources/action.xml=20=09modif?= =?UTF-8?q?i=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Core/FileFor?= =?UTF-8?q?mat/Formatting/Formatter/CSVFormatter.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Action/Export.php | 11 ++++------- core/lib/Thelia/Action/Import.php | 11 ++++------- core/lib/Thelia/Config/Resources/action.xml | 4 ++-- .../FileFormat/Formatting/Formatter/CSVFormatter.php | 4 +++- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/core/lib/Thelia/Action/Export.php b/core/lib/Thelia/Action/Export.php index 7f3dffe3b..bdea9f360 100644 --- a/core/lib/Thelia/Action/Export.php +++ b/core/lib/Thelia/Action/Export.php @@ -27,14 +27,11 @@ use Thelia\Model\ExportQuery; */ class Export extends BaseAction implements EventSubscriberInterface { - /** - * @var ContainerInterface - */ - protected $container; + protected $environment; - public function __construct(ContainerInterface $container) + public function __construct($environment) { - $this->container = $container; + $this->environment = $environment; } public function changeCategoryPosition(UpdatePositionEvent $event) @@ -54,7 +51,7 @@ class Export extends BaseAction implements EventSubscriberInterface protected function cacheClear(EventDispatcherInterface $dispatcher) { $cacheEvent = new CacheEvent( - $this->container->getParameter('kernel.cache_dir') + $this->environment ); $dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent); diff --git a/core/lib/Thelia/Action/Import.php b/core/lib/Thelia/Action/Import.php index 37eb610dc..e0aef97b5 100644 --- a/core/lib/Thelia/Action/Import.php +++ b/core/lib/Thelia/Action/Import.php @@ -27,14 +27,11 @@ use Thelia\Model\ImportQuery; */ class Import extends BaseAction implements EventSubscriberInterface { - /** - * @var ContainerInterface - */ - protected $container; + protected $environment; - public function __construct(ContainerInterface $container) + public function __construct($environment) { - $this->container = $container; + $this->environment = $environment; } public function changeCategoryPosition(UpdatePositionEvent $event) @@ -54,7 +51,7 @@ class Import extends BaseAction implements EventSubscriberInterface protected function cacheClear(EventDispatcherInterface $dispatcher) { $cacheEvent = new CacheEvent( - $this->container->getParameter('kernel.cache_dir') + $this->environment ); $dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent); diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index 62e017195..18dc627b2 100644 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -165,12 +165,12 @@ - + %kernel.cache_dir% - + %kernel.cache_dir% diff --git a/core/lib/Thelia/Core/FileFormat/Formatting/Formatter/CSVFormatter.php b/core/lib/Thelia/Core/FileFormat/Formatting/Formatter/CSVFormatter.php index 4b6069bdc..654db35f7 100644 --- a/core/lib/Thelia/Core/FileFormat/Formatting/Formatter/CSVFormatter.php +++ b/core/lib/Thelia/Core/FileFormat/Formatting/Formatter/CSVFormatter.php @@ -138,7 +138,9 @@ class CSVFormatter extends AbstractFormatter $value = serialize($value); } - return $this->stringDelimiter . addslashes($value) . $this->stringDelimiter . $this->delimiter; + $value = str_replace($this->stringDelimiter, "\\" . $this->stringDelimiter, $value); + + return $this->stringDelimiter . $value . $this->stringDelimiter . $this->delimiter; } /**