This commit is contained in:
Manuel Raynaud
2013-12-18 10:04:13 +01:00
parent d0e5d189d2
commit 2f4158d1f6
112 changed files with 425 additions and 526 deletions

View File

@@ -30,7 +30,6 @@ use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Exception\UrlRewritingException;
use Thelia\Form\Exception\FormValidationException;
use \Thelia\Model\Tools\UrlRewritingTrait;
class BaseAction
{

View File

@@ -138,7 +138,6 @@ class Coupon extends BaseAction implements EventSubscriberInterface
}
}
$event->setIsValid($isValid);
$event->setDiscount($totalDiscount);
}

View File

@@ -131,7 +131,6 @@ class Product extends BaseAction implements EventSubscriberInterface
return $this->genericUpdateSeo(ProductQuery::create(), $event);
}
/**
* Delete a product entry
*

View File

@@ -209,8 +209,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
if ($product->countSaleElements() <= 0) {
// If we just deleted the last PSE, create a default one
$product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
}
elseif ($pse->getIsDefault()) {
} elseif ($pse->getIsDefault()) {
// If we deleted the default PSE, make the last created one the default
$pse = ProductSaleElementsQuery::create()
@@ -238,8 +237,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
*
* @param ProductCombinationGenerationEvent $event
*/
public function generateCombinations(ProductCombinationGenerationEvent $event) {
public function generateCombinations(ProductCombinationGenerationEvent $event)
{
$con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME);
$con->beginTransaction();
@@ -276,8 +275,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
// Store all the stuff !
$con->commit();
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
$con->rollback();

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\AdminQuery;
use Thelia\Tools\Password;
/**
* command line for updating admin password
*
@@ -72,18 +71,15 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand
{
$login = $input->getArgument('login');
if (null === $admin = AdminQuery::create()->filterByLogin($login)->findOne()) {
throw new \RuntimeException(sprintf('Admin with login %s does not exists', $login));
}
$password = $input->getOption('password') ?: Password::generateRandom();
$event = new AdministratorUpdatePasswordEvent($admin);
$event->setPassword($password);
$this->
getContainer()
->get('event_dispatcher')
@@ -99,4 +95,3 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand
}
}

View File

@@ -443,7 +443,6 @@ abstract class AbstractCrudController extends BaseAdminController
$ex
);
//return $this->renderEditionTemplate();
}

View File

@@ -134,7 +134,8 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
*
* @param unknown $object
*/
protected function hydrateSeoForm($object){
protected function hydrateSeoForm($object)
{
// The "SEO" tab form
$locale = $object->getLocale();
$data = array(
@@ -227,8 +228,6 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
$ex
);
// At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate();
}

View File

@@ -309,7 +309,8 @@ class AddressController extends AbstractCrudController
$this->redirectToEditionTemplate();
}
protected function getCustomerId() {
protected function getCustomerId()
{
if (null !== $address = $this->getExistingObject())
return $address->getCustomerId();
else

View File

@@ -34,7 +34,6 @@ use Thelia\Form\AttributeModificationForm;
use Thelia\Form\AttributeCreationForm;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeAvQuery;
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
use Thelia\Core\Event\Attribute\AttributeEvent;

View File

@@ -309,6 +309,7 @@ class BaseAdminController extends BaseController
{
// Check if the functionality is activated
if(!ConfigQuery::read("one_domain_foreach_lang", false))
return;
// If we don't have a locale value, use the locale value in the session

View File

@@ -201,15 +201,12 @@ class CategoryController extends AbstractSeoCrudController
protected function redirectToListTemplateWithId($category_id)
{
if($category_id > 0)
{
if ($category_id > 0) {
$this->redirectToRoute(
'admin.categories.default',
array('category_id' => $category_id)
);
}
else
{
} else {
$this->redirectToRoute(
'admin.catalog'
);

View File

@@ -23,11 +23,9 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\ConfigStoreForm;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery;
/**
* Class ConfigStoreController

View File

@@ -23,19 +23,14 @@
namespace Thelia\Controller\Admin;
use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\CustomerCreateForm;
use Thelia\Form\CustomerUpdateForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\CustomerQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Tools\Password;
use Thelia\Model\AddressQuery;
use Thelia\Model\Address;
/**

View File

@@ -34,7 +34,6 @@ use Thelia\Form\FeatureModificationForm;
use Thelia\Form\FeatureCreationForm;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\FeatureAv;
use Thelia\Model\FeatureAvQuery;
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
use Thelia\Core\Event\Feature\FeatureEvent;

View File

@@ -88,7 +88,6 @@ class HomeController extends BaseAdminController
array(5)
);
$data->series = array(
$saleSeries,
$newCustomerSeries,

View File

@@ -31,7 +31,6 @@ use Thelia\Model\MessageQuery;
use Thelia\Form\MessageModificationForm;
use Thelia\Form\MessageCreationForm;
use Symfony\Component\Finder\Finder;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper;
/**
@@ -164,8 +163,8 @@ class MessageController extends AbstractCrudController
return $this->render('messages');
}
protected function listDirectoryContent($requiredExtension) {
protected function listDirectoryContent($requiredExtension)
{
$list = array();
$dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();

View File

@@ -123,7 +123,6 @@ class ModuleController extends AbstractCrudController
->findOneById($this->getRequest()->get('module_id'));
}
protected function getObjectLabel($object)
{
return $object->getTitle();
@@ -197,7 +196,6 @@ class ModuleController extends AbstractCrudController
}
if (null !== $response = $this->checkAuth(array(), $module_code, AccessManager::VIEW)) return $response;
return $this->render(
"module-configure",
array(

View File

@@ -27,7 +27,6 @@ use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\PdfEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\OrderUpdateAddress;
@@ -36,7 +35,6 @@ use Thelia\Model\Base\OrderAddressQuery;
use Thelia\Model\OrderQuery;
use Thelia\Model\OrderStatusQuery;
use Thelia\Tools\URL;
use Thelia\Core\Template\TemplateHelper;
/**
* Class OrderController
@@ -203,14 +201,12 @@ class OrderController extends BaseAdminController
public function generateInvoicePdf($order_id)
{
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
}
public function generateDeliveryPdf($order_id)
{
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
}
@@ -225,5 +221,4 @@ class OrderController extends BaseAdminController
return $response;
}
}

View File

@@ -72,7 +72,6 @@ use Thelia\Form\ProductCombinationGenerationForm;
use Thelia\TaxEngine\Calculator;
use Thelia\Tools\NumberFormat;
/**
* Manages products
*
@@ -1037,7 +1036,8 @@ class ProductController extends AbstractSeoCrudController
}
// Create combinations
protected function combine($input, &$output, &$tmp) {
protected function combine($input, &$output, &$tmp)
{
$current = array_shift($input);
if (count($input) > 0) {
@@ -1058,8 +1058,8 @@ class ProductController extends AbstractSeoCrudController
/**
* Build combinations from the combination output builder
*/
public function buildCombinationsAction() {
public function buildCombinationsAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;

View File

@@ -23,7 +23,6 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\SystemLogConfigurationForm;
@@ -58,8 +57,8 @@ class SystemLogController extends BaseAdminController
);
}
protected function loadDefinedDestinations($directory, &$destinations) {
protected function loadDefinedDestinations($directory, &$destinations)
{
try {
foreach (new \DirectoryIterator($directory) as $fileInfo) {

View File

@@ -23,12 +23,8 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\SystemLogConfigurationForm;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Template\TemplateDefinition;
@@ -149,8 +145,7 @@ class TranslationsController extends BaseAdminController
$templateArguments['max_input_vars_warning'] = true;
$templateArguments['required_max_input_vars'] = $stringsCount;
$templateArguments['current_max_input_vars'] = ini_get('max_input_vars');
}
else {
} else {
$templateArguments['all_strings'] = $all_strings;
}
}
@@ -162,14 +157,12 @@ class TranslationsController extends BaseAdminController
public function defaultAction()
{
if (null !== $response = $this->checkAuth(AdminResources::TRANSLATIONS, array(), AccessManager::VIEW)) return $response;
return $this->renderTemplate();
}
public function updateAction()
{
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
return $this->renderTemplate();
}
}

View File

@@ -252,7 +252,6 @@ abstract class BaseController extends ContainerAware
}
}
/**

View File

@@ -25,10 +25,8 @@ namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\Redirect;
use Thelia\Tools\URL;

View File

@@ -26,7 +26,6 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Class TranslatorPass
* @package Thelia\Core\DependencyInjection\Compiler

View File

@@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Administrator;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Admin;
/**
* Class AdministratorUpdatePasswordEvent
* @package Thelia\Core\Event\Administrator
@@ -82,4 +81,3 @@ class AdministratorUpdatePasswordEvent extends ActionEvent
}
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Customer;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Customer;
/**

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Customer;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Customer;
class CustomerLoginEvent extends CustomerEvent

View File

@@ -65,6 +65,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setReference($reference)
{
$this->reference = $reference;
return $this;
}
@@ -76,6 +77,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setPrice($price)
{
$this->price = $price;
return $this;
}
@@ -87,6 +89,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setWeight($weight)
{
$this->weight = $weight;
return $this;
}
@@ -98,6 +101,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setQuantity($quantity)
{
$this->quantity = $quantity;
return $this;
}
@@ -109,6 +113,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setSalePrice($sale_price)
{
$this->sale_price = $sale_price;
return $this;
}
@@ -120,6 +125,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setOnsale($onsale)
{
$this->onsale = $onsale;
return $this;
}
@@ -131,6 +137,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setIsnew($isnew)
{
$this->isnew = $isnew;
return $this;
}
@@ -142,6 +149,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setEanCode($ean_code)
{
$this->ean_code = $ean_code;
return $this;
return $this;
}
@@ -154,6 +162,7 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setCombinations($combinations)
{
$this->combinations = $combinations;
return $this;
}
}

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement;
use Thelia\Model\Product;
class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
{

View File

@@ -184,5 +184,4 @@ class UpdateSeoEvent extends ActionEvent
return $this->object;
}
}

View File

@@ -30,12 +30,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Core\HttpFoundation\Response;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpKernel\Exception\NotFountHttpException;
use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Exception\OrderException;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\Redirect;
use Thelia\Tools\URL;
use Thelia\Core\Security\Exception\AuthenticationException;

View File

@@ -39,8 +39,8 @@ class Response extends BaseResponse
*
* @see \Thelia\Core\HttpFoundation\Response::sendContent()
*/
public function sendContent() {
public function sendContent()
{
Tlog::getInstance()->write($this->content);
parent::sendContent();

View File

@@ -65,6 +65,7 @@ class HttpCache extends BaseHttpCache implements HttpKernelInterface
$request->getContent()
);
}
return parent::handle($request, $type, $catch);
}

View File

@@ -23,7 +23,8 @@
namespace Thelia\Core\Template\Assets;
interface AssetManagerInterface {
interface AssetManagerInterface
{
/**
* Prepare an asset directory.
*

View File

@@ -75,7 +75,8 @@ class AsseticAssetManager implements AssetManagerInterface
*
* @param \DirectoryIterator $fileInfo
*/
protected function isSourceFile(\SplFileInfo $fileInfo) {
protected function isSourceFile(\SplFileInfo $fileInfo)
{
return in_array($fileInfo->getExtension(), $this->source_file_extensions);
}
@@ -164,8 +165,8 @@ class AsseticAssetManager implements AssetManagerInterface
* @param string $web_assets_directory_base the base directory of the web based asset directory
* @throws \RuntimeException if something goes wrong.
*/
public function prepareAssets($source_assets_directory, $web_assets_directory_base) {
public function prepareAssets($source_assets_directory, $web_assets_directory_base)
{
// Compute the absolute path of the output directory
$to_directory = $this->getDestinationDirectory($source_assets_directory, $web_assets_directory_base);
@@ -217,8 +218,7 @@ class AsseticAssetManager implements AssetManagerInterface
throw new \RuntimeException(
"Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that.");
}
/* }
else {
/* } else {
@fclose($fp);
}
*/
@@ -233,8 +233,8 @@ class AsseticAssetManager implements AssetManagerInterface
* @throws \InvalidArgumentException if a wrong filter is passed
* @return an array of filter names
*/
protected function decodeAsseticFilters(FilterManager $filterManager, $filters) {
protected function decodeAsseticFilters(FilterManager $filterManager, $filters)
{
if (!empty($filters)) {
$filter_list = explode(',', $filters);
@@ -273,8 +273,7 @@ class AsseticAssetManager implements AssetManagerInterface
break;
}
}
}
else {
} else {
$filter_list = array();
}

View File

@@ -277,7 +277,6 @@ abstract class BaseLoop
}
}
protected function searchArray(array $search, &$pagination = null)
{
if (false === $this->countable) {

View File

@@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\AdminQuery;
use Thelia\Type;
/**
*

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Util\PropelModelPager;
use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\ConditionInterface;
use Thelia\Core\HttpFoundation\Request;

View File

@@ -158,6 +158,7 @@ class Currency extends BaseI18nLoop implements PropelSearchLoopInterface
}
/* perform search */
return $search;
}

View File

@@ -36,9 +36,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CustomerQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Model\OrderQuery;
use Thelia\Model\Map\OrderAddressTableMap;
use Thelia\Model\Map\OrderTableMap;
/**
*
@@ -208,7 +205,6 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
$search->orderByCreatedAt(Criteria::DESC);
break;
}
}

View File

@@ -126,7 +126,6 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
$orders = $this->getOrder();
foreach ($orders as $order) {

View File

@@ -236,7 +236,6 @@ class Image extends BaseI18nLoop implements PropelSearchLoopInterface
$search->filterById($exclude, Criteria::NOT_IN);
// echo "sql=".$search->toString();
return $search;
}

View File

@@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ProfileQuery;
use Thelia\Type;
/**
*

View File

@@ -23,19 +23,12 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
use Thelia\Type;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Template\TemplateDefinition;
@@ -72,7 +65,8 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
);
}
public function buildArray() {
public function buildArray()
{
$type = $this->getArg(template_type);
if ($type == 'front-office')

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Template\Smarty\Assets;
use Thelia\Core\Template\Assets\AsseticHelper;
use Thelia\Tools\URL;
use Thelia\Core\Template\Assets\AssetManagerInterface;
@@ -51,8 +50,8 @@ class SmartyAssetsManager
$this->assetsManager = $assetsManager;
}
public function prepareAssets($assets_directory, \Smarty_Internal_Template $template) {
public function prepareAssets($assets_directory, \Smarty_Internal_Template $template)
{
$tpl_dir = dirname($template->source->filepath);
$asset_dir_absolute_path = realpath($tpl_dir . DS . $assets_directory);

View File

@@ -27,8 +27,6 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL;
use Thelia\Core\Security\SecurityContext;
use Thelia\Model\Config;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper;
/**
@@ -45,8 +43,8 @@ class AdminUtilities extends AbstractSmartyPlugin
$this->securityContext = $securityContext;
}
protected function fetch_snippet($smarty, $templateName, $variablesArray) {
protected function fetch_snippet($smarty, $templateName, $variablesArray)
{
$data = '';
$snippet_path = sprintf('%s/%s/%s.html',
@@ -99,7 +97,6 @@ class AdminUtilities extends AbstractSmartyPlugin
$module === null ? array() : array($module),
array($access))
) {
return $this->fetch_snippet($smarty, 'includes/admin-utilities-position-block', array(
'admin_utilities_go_up_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)),
'admin_utilities_in_place_edit_class' => $in_place_edit_class,

View File

@@ -60,6 +60,7 @@ class Assets extends AbstractSmartyPlugin
$catchException = $this->getNormalizedParam($params, array('catchException'));
if ($catchException == "true") {
$repeat = false;
return null;
} else {
throw $e;

View File

@@ -28,7 +28,6 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\Smarty\an;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
/**
* Class Esi
* @package Thelia\Core\Template\Smarty\Plugins

View File

@@ -14,8 +14,6 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Translation\Translator;
/**
@@ -66,7 +64,6 @@ class SmartyParser extends Smarty implements ParserInterface
$this->setCompileDir($compile_dir);
$this->setCacheDir($cache_dir);
$this->debugging = $debug;
// Prevent smarty ErrorException: Notice: Undefined index bla bla bla...
@@ -83,7 +80,6 @@ class SmartyParser extends Smarty implements ParserInterface
//$this->enableSecurity();
// The default HTTP status
$this->status = 200;
@@ -186,7 +182,6 @@ class SmartyParser extends Smarty implements ParserInterface
return $this->fetch(sprintf("%s:%s", $resourceType, $resourceContent));
}
/**
* Return a rendered template file
*
@@ -194,8 +189,8 @@ class SmartyParser extends Smarty implements ParserInterface
* @param array $parameters an associative array of names / value pairs
* @return string the rendered template text
*/
public function render($realTemplateName, array $parameters = array()) {
public function render($realTemplateName, array $parameters = array())
{
if (false === $this->templateExists($realTemplateName)) {
throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file', $realTemplateName)));
}
@@ -210,7 +205,8 @@ class SmartyParser extends Smarty implements ParserInterface
* @param array $parameters an associative array of names / value pairs
* @return string the rendered template text
*/
public function renderString($templateText, array $parameters = array()) {
public function renderString($templateText, array $parameters = array())
{
return $this->internalRenderer('string', $templateText, $parameters);
}

View File

@@ -50,7 +50,6 @@ class TemplateDefinition
*/
protected $type;
public function __construct($name, $type)
{
$this->name = $name;
@@ -83,14 +82,17 @@ class TemplateDefinition
public function setName($name)
{
$this->name = $name;
return $this;
}
public function getI18nPath() {
public function getI18nPath()
{
return $this->getPath() . DS . 'I18n';
}
public function getAbsoluteI18nPath() {
public function getAbsoluteI18nPath()
{
return THELIA_TEMPLATE_DIR . $this->getI18nPath();
}
@@ -99,7 +101,8 @@ class TemplateDefinition
return $this->path;
}
public function getAbsolutePath() {
public function getAbsolutePath()
{
return THELIA_TEMPLATE_DIR . $this->getPath();
}
@@ -108,13 +111,15 @@ class TemplateDefinition
return $this->getPath() . DS . 'configs';
}
public function getAbsoluteConfigPath() {
public function getAbsoluteConfigPath()
{
return THELIA_TEMPLATE_DIR . $this->getConfigPath();
}
public function setPath($path)
{
$this->path = $path;
return $this;
}
@@ -126,6 +131,7 @@ class TemplateDefinition
public function setType($type)
{
$this->type = $type;
return $this;
}
}

View File

@@ -40,16 +40,17 @@ class TemplateHelper
private function __construct() {}
public static function getInstance() {
public static function getInstance()
{
if (self::$instance == null) self::$instance = new TemplateHelper();
return self::$instance;
}
/**
* @return TemplateDefinition
*/
public function getActiveMailTemplate() {
public function getActiveMailTemplate()
{
return new TemplateDefinition(
ConfigQuery::read('active-mail-template', 'default'),
TemplateDefinition::EMAIL
@@ -59,7 +60,8 @@ class TemplateHelper
/**
* @return TemplateDefinition
*/
public function getActivePdfTemplate() {
public function getActivePdfTemplate()
{
return new TemplateDefinition(
ConfigQuery::read('active-pdf-template', 'default'),
TemplateDefinition::PDF
@@ -69,7 +71,8 @@ class TemplateHelper
/**
* @return TemplateDefinition
*/
public function getActiveAdminTemplate() {
public function getActiveAdminTemplate()
{
return new TemplateDefinition(
ConfigQuery::read('active-admin-template', 'default'),
TemplateDefinition::BACK_OFFICE
@@ -79,24 +82,23 @@ class TemplateHelper
/**
* @return TemplateDefinition
*/
public function getActiveFrontTemplate() {
public function getActiveFrontTemplate()
{
return new TemplateDefinition(
ConfigQuery::read('active-front-template', 'default'),
TemplateDefinition::FRONT_OFFICE
);
}
public function getList($templateType) {
public function getList($templateType)
{
$list = $exclude = array();
if ($templateType == TemplateDefinition::BACK_OFFICE) {
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::BACK_OFFICE_SUBDIR;
}
else if ($templateType == TemplateDefinition::PDF) {
} elseif ($templateType == TemplateDefinition::PDF) {
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::PDF_SUBDIR;
}
else {
} else {
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::FRONT_OFFICE_SUBDIR;
$exclude = array(TemplateDefinition::BACK_OFFICE_SUBDIR, TemplateDefinition::PDF_SUBDIR);
@@ -118,7 +120,6 @@ class TemplateHelper
return $list;
}
protected function normalize_path($path)
{
$path = str_replace(
@@ -147,8 +148,8 @@ class TemplateHelper
* @throws \InvalidArgumentException if $walkMode contains an invalid value
* @return number the total number of translatable texts
*/
public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) {
public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings)
{
$num_texts = 0;
if ($walkMode == self::WALK_MODE_PHP) {
@@ -159,8 +160,7 @@ class TemplateHelper
$prefix = '\{intl[\s]l=';
$allowed_exts = array('html', 'tpl', 'xml');
}
else {
} else {
throw new \InvalidArgumentException(
Translator::getInstance()->trans('Invalid value for walkMode parameter: %value', array('%value' => $walkMode))
);
@@ -198,14 +198,11 @@ class TemplateHelper
$hash = md5($match);
if (isset($strings[$hash]))
{
if (! in_array($short_path, $strings[$hash]['files']))
{
if (isset($strings[$hash])) {
if (! in_array($short_path, $strings[$hash]['files'])) {
$strings[$hash]['files'][] = $short_path;
}
}
else {
} else {
$num_texts++;
// remove \'
@@ -257,9 +254,7 @@ class TemplateHelper
fwrite($fp, ");\n");
@fclose($fp);
}
else
{
} else {
throw new \RuntimeException(
Translator::getInstance()->trans(
'Failed to open translation file %file. Please be sure that this file is writable by your Web server',

View File

@@ -49,7 +49,6 @@ use Thelia\Config\DefinePropel;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Core\TheliaContainerBuilder;
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Config\FileLocator;
use Propel\Runtime\Propel;
@@ -142,7 +141,6 @@ class Thelia extends Kernel
$defintion
);
$code = ucfirst($module->getCode());
$loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));

View File

@@ -23,7 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery;
/**

View File

@@ -23,7 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery;

View File

@@ -23,7 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Model\Currency;
use Thelia\Core\Translation\Translator;

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator;
class ProductModificationForm extends ProductCreationForm
{
use StandardDescriptionFieldsTrait;

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Log\Tlog;
use Thelia\Core\Translation\Translator;

View File

@@ -25,18 +25,20 @@ namespace Thelia\Log\Destination;
use Thelia\Log\AbstractTlogDestination;
class TlogDestinationJavascriptConsole extends AbstractTlogDestination {
public function getTitle() {
class TlogDestinationJavascriptConsole extends AbstractTlogDestination
{
public function getTitle()
{
return "Browser's Javascript console";
}
public function getDescription() {
public function getDescription()
{
return "The Thelia logs are displayed in your browser's Javascript console.";
}
public function write(&$res) {
public function write(&$res)
{
$content = '<script>try {'."\n";
foreach ($this->_logs as $line) {

View File

@@ -26,8 +26,8 @@ namespace Thelia\Log\Destination;
use Thelia\Log\AbstractTlogDestination;
use Thelia\Log\TlogDestinationConfig;
class TlogDestinationPopup extends AbstractTlogDestination {
class TlogDestinationPopup extends AbstractTlogDestination
{
// Nom des variables de configuration
// ----------------------------------
const VAR_POPUP_WIDTH = "tlog_destinationpopup_width";
@@ -40,15 +40,18 @@ class TlogDestinationPopup extends AbstractTlogDestination {
// Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php
const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl";
public function getTitle() {
public function getTitle()
{
return "Javascript popup window";
}
public function getDescription() {
public function getDescription()
{
return "Display logs in a popup window, separate from the main window .";
}
public function getConfigs() {
public function getConfigs()
{
return array(
new TlogDestinationConfig(
self::VAR_POPUP_TPL,
@@ -74,8 +77,8 @@ class TlogDestinationPopup extends AbstractTlogDestination {
);
}
public function write(&$res) {
public function write(&$res)
{
$content = ""; $count = 1;
foreach ($this->_logs as $line) {
@@ -92,8 +95,7 @@ class TlogDestinationPopup extends AbstractTlogDestination {
_thelia_console = window.open("","thelia_console","width=%s,height=%s,resizable,scrollbars=yes");
if (_thelia_console == null) {
alert("The log popup window could not be opened. Please disable your popup blocker for this site.");
}
else {
} else {
_thelia_console.document.write("%s");
_thelia_console.document.close();
}

View File

@@ -171,7 +171,8 @@ class Tlog Implements LoggerInterface
*
* @return array of directories
*/
public function getDestinationsDirectories() {
public function getDestinationsDirectories()
{
return $this->dir_destinations;
}

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Log;
use Thelia\Model\Config;
use Thelia\Model\ConfigQuery;
class TlogDestinationConfig

View File

@@ -39,7 +39,6 @@ use Thelia\Model\Module;
use Thelia\Model\ModuleImage;
use Thelia\Model\ModuleQuery;
class BaseModule extends ContainerAware implements BaseModuleInterface
{
const CLASSIC_MODULE_TYPE = 1;
@@ -115,16 +114,18 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
return $this->container;
}
public function hasRequest() {
public function hasRequest()
{
return null !== $this->request;
}
public function setRequest(Request $request) {
public function setRequest(Request $request)
{
$this->request = $request;
}
public function getRequest() {
public function getRequest()
{
if ($this->hasRequest() === false) {
throw new \RuntimeException("Sorry, the request is not available in this context");
}
@@ -132,16 +133,18 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
return $this->request;
}
public function hasDispatcher() {
public function hasDispatcher()
{
return null !== $this->dispatcher;
}
public function setDispatcher(EventDispatcherInterface $dispatcher) {
public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
public function getDispatcher() {
public function getDispatcher()
{
if ($this->hasDispatcher() === false) {
throw new \RuntimeException("Sorry, the dispatcher is not available in this context");
}
@@ -149,7 +152,6 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
return $this->dispatcher;
}
public function setTitle(Module $module, $titles)
{
if (is_array($titles)) {

View File

@@ -24,8 +24,6 @@
namespace Thelia\Module;
use Propel\Runtime\Connection\ConnectionInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
interface BaseModuleInterface
{

View File

@@ -83,6 +83,7 @@ class FolderTest extends TestCaseWithURLToolSetup
public function processUpdateSeoAction($event)
{
$contentAction = new Folder($this->getContainer());
return $contentAction->updateSeo($event);
}

View File

@@ -24,7 +24,6 @@
namespace Thelia\Tests\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent;

View File

@@ -52,7 +52,6 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
{
}
/**
* Generate adapter stub
*

View File

@@ -431,12 +431,10 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('getContainer')
->will($this->returnValue($stubContainer));
$conditions = new ConditionCollection();
$conditionFactory = new ConditionFactory($stubContainer);
$conditionNone = new MatchForEveryone($stubFacade);
$expectedCollection = new ConditionCollection();
$expectedCollection->add($conditionNone);

View File

@@ -197,6 +197,5 @@ class MatchForEveryoneTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected1, $actual1);
$this->assertEquals($expected2, $actual2);
}
}

View File

@@ -633,7 +633,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
@@ -644,7 +643,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmount::INPUT2 => 'UNK');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
@@ -700,7 +698,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
@@ -711,7 +708,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
@@ -767,7 +763,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
@@ -778,7 +773,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();

View File

@@ -156,7 +156,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$serializedConditions = $conditionFactory->serializeConditionCollection($conditions);
$coupon1->setSerializedConditions($serializedConditions);
$coupon1->setMaxUsage(40);
$coupon1->setIsCumulative(true);
$coupon1->setIsRemovingPostage(false);
@@ -190,7 +189,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
@@ -223,7 +221,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));
@@ -255,8 +252,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager));
@@ -293,7 +288,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
@@ -326,7 +320,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));
@@ -358,7 +351,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
@@ -389,7 +381,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));

View File

@@ -62,7 +62,6 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
{
}
/**
* Generate a valid Coupon model
*/
@@ -118,7 +117,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$serializedConditions = $conditionFactory->serializeConditionCollection($conditions);
$coupon1->setSerializedConditions($serializedConditions);
$coupon1->setMaxUsage(40);
$coupon1->setIsCumulative(true);
$coupon1->setIsRemovingPostage(true);
@@ -307,8 +305,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$conditionFactory = new ConditionFactory($stubContainer);
$stubFacade->expects($this->any())
->method('getCurrentCoupons')
->will($this->returnValue(array()));
@@ -334,7 +330,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$coupon1 = $couponFactory->buildCouponFromModel($model1);
$coupon2 = clone $coupon1;
$couponManager = new CouponManager($stubContainer);
$couponManager->addAvailableCoupon($coupon1);
$couponManager->addAvailableCoupon($coupon2);
@@ -387,7 +382,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('get')
->will($this->onConsecutiveCalls($stubFacade));
$couponManager = new CouponManager($stubContainer);
$couponManager->addAvailableCondition($condition1);
$couponManager->addAvailableCondition($condition2);
@@ -444,10 +438,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('get')
->will($this->onConsecutiveCalls($stubFacade));
$couponManager = new CouponManager($stubContainer);
$stubModel = $this->getMockBuilder('\Thelia\Model\Coupon')
->disableOriginalConstructor()
->getMock();
@@ -511,10 +503,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('get')
->will($this->onConsecutiveCalls($stubFacade));
$couponManager = new CouponManager($stubContainer);
$stubModel = $this->getMockBuilder('\Thelia\Model\Coupon')
->disableOriginalConstructor()
->getMock();

View File

@@ -23,7 +23,6 @@
namespace Thelia\Tests\Model;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Filesystem\Filesystem;
use Thelia\Model\Message;
@@ -324,8 +323,8 @@ class MessageTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("TEXT Layout 6: TEXT <template> & content v=my-value", $instance->getChildren()[0]->getBody());
}
protected function tearDown() {
protected function tearDown()
{
$dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();
ConfigQuery::write('active-mail-template', $this->backup_mail_template);

View File

@@ -37,7 +37,6 @@ use Thelia\Form\FolderDocumentModification;
use Thelia\Form\FolderImageModification;
use Thelia\Form\ProductDocumentModification;
use Thelia\Form\ProductImageModification;
use Thelia\Model\AdminLog;
use Thelia\Model\CategoryDocument;
use Thelia\Model\CategoryDocumentQuery;
use Thelia\Model\CategoryImage;

View File

@@ -46,12 +46,11 @@ class NumberFormat
* @param float $number the number
* @param string $decimals number of decimal figures
*/
public function formatStandardNumber($number, $decimals = null) {
public function formatStandardNumber($number, $decimals = null)
{
$lang = $this->request->getSession()->getLang();
if ($decimals == null) $decimals = $lang->getDecimals();
return number_format($number, $decimals, '.', '');
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Tools;
/**
* Class Password
* @package Thelia\Tools
@@ -32,8 +31,8 @@ namespace Thelia\Tools;
class Password
{
private static function randgen($letter, $length) {
private static function randgen($letter, $length)
{
return substr(str_shuffle($letter), 0, $length);
}
@@ -43,8 +42,8 @@ class Password
* @param int $length
* @return mixed
*/
public static function generateRandom($length = 8){
public static function generateRandom($length = 8)
{
$letter = "abcdefghijklmnopqrstuvwxyz";
$letter .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$letter .= "0123456789";