This commit is contained in:
Manuel Raynaud
2013-09-11 08:27:40 +02:00
parent 990ab0e094
commit 70d93d1daa
155 changed files with 541 additions and 809 deletions

View File

@@ -27,7 +27,6 @@ use Thelia\Core\Event\AddressCreateOrUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Address as AddressModel;
/**
* Class Address
* @package Thelia\Action
@@ -50,7 +49,6 @@ class Address extends BaseAction implements EventSubscriberInterface
$this->createOrUpdate($addressModel, $event);
}
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
{
$addressModel->setDispatcher($this->getDispatcher());

View File

@@ -22,10 +22,6 @@
/*************************************************************************************/
namespace Thelia\Action;
use Thelia\Form\BaseForm;
use Thelia\Action\Exception\FormValidationException;
use Thelia\Core\Event\ActionEvent;
use Symfony\Component\Form\Form;
use Symfony\Component\DependencyInjection\ContainerInterface;
class BaseAction

View File

@@ -23,12 +23,9 @@
namespace Thelia\Action;
use Propel\Runtime\Exception\PropelException;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\CartEvent;
use Thelia\Form\CartAdd;
use Thelia\Model\ProductPrice;
use Thelia\Model\ProductPriceQuery;
use Thelia\Model\CartItem;

View File

@@ -31,7 +31,6 @@ use Thelia\Model\CategoryQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Model\Map\CategoryTableMap;
use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Event\CategoryCreateEvent;
use Thelia\Core\Event\CategoryDeleteEvent;

View File

@@ -23,7 +23,6 @@
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\ConfigQuery;

View File

@@ -27,9 +27,6 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Coupon as CouponModel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Model\Map\CategoryTableMap;
/**
* Created by JetBrains PhpStorm.

View File

@@ -23,7 +23,6 @@
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\CurrencyQuery;
@@ -60,7 +59,6 @@ class Currency extends BaseAction implements EventSubscriberInterface
->save()
;
$event->setCurrency($currency);
}
@@ -136,16 +134,15 @@ class Currency extends BaseAction implements EventSubscriberInterface
}
}
public function updateRates() {
public function updateRates()
{
$rates_url = ConfigQuery::read('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml');
$rate_data = @file_get_contents($rates_url);
if ($rate_data && $sxe = new \SimpleXMLElement($rate_data)) {
foreach ($sxe->Cube[0]->Cube[0]->Cube as $last)
{
foreach ($sxe->Cube[0]->Cube[0]->Cube as $last) {
$code = strtoupper($last["currency"]);
$rate = floatval($last['rate']);
@@ -157,8 +154,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
;
}
}
}
else {
} else {
throw new \RuntimeException(sprintf("Failed to get currency rates data from URL %s", $rates_url));
}
}

View File

@@ -27,17 +27,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\ActionEvent;
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\CustomerCreation;
use Thelia\Form\CustomerModification;
use Thelia\Model\Customer as CustomerModel;
use Thelia\Log\Tlog;
use Thelia\Model\CustomerQuery;
use Thelia\Form\CustomerLogin;
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
use Symfony\Component\Validator\Exception\ValidatorException;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\UsernameNotFoundException;
use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Event\CustomerLoginEvent;
/**
@@ -96,7 +86,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
$event->setCustomer($customer);
}
public function login(CustomerLoginEvent $event)
{
$this->getSecurityContext()->setCustomerUser($event->getCustomer());

View File

@@ -25,7 +25,6 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\ActionEvent;
use Thelia\Core\Event\ImageEvent;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\URL;
@@ -86,8 +85,8 @@ class Image extends BaseAction implements EventSubscriberInterface
*
* @param ImageEvent $event
*/
public function clearCache(ImageEvent $event) {
public function clearCache(ImageEvent $event)
{
$path = $this->getCachePath($event->getCacheSubdirectory(), false);
$this->clearDirectory($path);
@@ -98,8 +97,8 @@ class Image extends BaseAction implements EventSubscriberInterface
*
* @param string $path the directory path
*/
protected function clearDirectory($path) {
protected function clearDirectory($path)
{
$iterator = new \DirectoryIterator($path);
foreach ($iterator as $fileinfo) {
@@ -108,8 +107,7 @@ class Image extends BaseAction implements EventSubscriberInterface
if ($fileinfo->isFile() || $fileinfo->isLink()) {
@unlink($fileinfo->getPathname());
}
else if ($fileinfo->isDir()) {
} elseif ($fileinfo->isDir()) {
$this->clearDirectory($fileinfo->getPathname());
}
}
@@ -160,8 +158,7 @@ class Image extends BaseAction implements EventSubscriberInterface
if (false == symlink($source_file, $originalImagePathInCache)) {
throw new ImageException(sprintf("Failed to create symbolic link for %s in %s image cache directory", basename($source_file), $subdir));
}
}
else {// mode = 'copy'
} else {// mode = 'copy'
if (false == @copy($source_file, $originalImagePathInCache)) {
throw new ImageException(sprintf("Failed to copy %s in %s image cache directory", basename($source_file), $subdir));
}
@@ -182,8 +179,7 @@ class Image extends BaseAction implements EventSubscriberInterface
if ($background_color != null) {
$bg_color = new Color($background_color);
}
else
} else
$bg_color = null;
// Apply resize
@@ -252,8 +248,7 @@ class Image extends BaseAction implements EventSubscriberInterface
$cacheFilePath,
array('quality' => $quality)
);
}
else {
} else {
throw new ImageException(sprintf("Source file %s cannot be opened.", basename($source_file)));
}
}
@@ -313,8 +308,7 @@ class Image extends BaseAction implements EventSubscriberInterface
$dest_width = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_width : $next_width);
$dest_height = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_height : $next_height);
}
else if ($width_diff > $height_diff) {
} elseif ($width_diff > $height_diff) {
// Image height > image width
$next_height = $dest_height;
@@ -324,12 +318,10 @@ class Image extends BaseAction implements EventSubscriberInterface
$next_width = $dest_width;
$next_height = intval($height_orig * $dest_width / $width_orig);
$delta_y = ($next_height - $dest_height) / 2;
}
else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
} elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
$dest_width = $next_width;
}
}
else {
} else {
// Image width > image height
$next_width = $dest_width;
$next_height = intval($height_orig * $dest_width / $width_orig);
@@ -338,8 +330,7 @@ class Image extends BaseAction implements EventSubscriberInterface
$next_height = $dest_height;
$next_width = intval(($width_orig * $next_height) / $height_orig);
$delta_x = ($next_width - $dest_width) / 2;
}
else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
} elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
$dest_height = $next_height;
}
}
@@ -357,9 +348,7 @@ class Image extends BaseAction implements EventSubscriberInterface
return $imagine->create($canvas, $bg_color)
->paste($image, new Point($border_width, $border_height));
}
else if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
} elseif ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
$image->crop(
new Point($delta_x, $delta_y),
new Box($dest_width, $dest_height)
@@ -370,7 +359,6 @@ class Image extends BaseAction implements EventSubscriberInterface
return $image;
}
/**
* Return the absolute URL to the cached image
*
@@ -420,12 +408,10 @@ class Image extends BaseAction implements EventSubscriberInterface
$safe_subdir = basename($subdir);
$path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir);
}
else
} else
$path = $cache_dir_from_web_root;
// Check if path is valid, e.g. in the cache dir
return $path;
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\MessageQuery;

View File

@@ -23,7 +23,6 @@
namespace Thelia\Action;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;

View File

@@ -25,8 +25,8 @@ namespace Thelia\Action;
use Thelia\Core\Event\BaseChangePositionEvent;
trait PositionManagementTrait {
trait PositionManagementTrait
{
const POSITION_UP
/**
* Changes object position, selecting absolute ou relative change.

View File

@@ -32,7 +32,6 @@ use Thelia\Core\HttpFoundation\Request;
use Symfony\Component\Console\Input\InputArgument;
use Thelia\Core\Event\TheliaEvents;
class ClearImageCache extends ContainerAwareCommand
{
protected function configure()
@@ -60,8 +59,7 @@ class ClearImageCache extends ContainerAwareCommand
$dispatcher->dispatch(TheliaEvents::IMAGE_CLEAR_CACHE, $event);
$output->writeln(sprintf('%s image cache successfully cleared.', is_null($subdir) ? 'Entire' : ucfirst($subdir)));
}
catch(\Exception $ex) {
} catch (\Exception $ex) {
$output->writeln(sprintf("Failed to clear image cache: %s", $ex->getMessage()));
}
}

View File

@@ -133,8 +133,7 @@ class CreateAdminUser extends ContainerAwareCommand
}
$output->writeln("Passwords are different, please try again.");
}
while (true);
} while (true);
return $admin;
}

View File

@@ -28,7 +28,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Thelia\Install\Database;
/**
* Class ReloadDatabasesCommand
* @package Thelia\Command

View File

@@ -25,7 +25,7 @@ namespace %%NAMESPACE%%;
use Thelia\Module\BaseModule;
class %%CLASSNAME%% extends BaseModule
class Class extends BaseModule
{
/**
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class

View File

@@ -23,18 +23,6 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\MessageDeleteEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Tools\URL;
use Thelia\Core\Event\MessageUpdateEvent;
use Thelia\Core\Event\MessageCreateEvent;
use Thelia\Log\Tlog;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Security\Exception\AuthorizationException;
use Thelia\Model\MessageQuery;
use Thelia\Form\MessageModificationForm;
use Thelia\Form\MessageCreationForm;
/**
* Manages messages sent by mail
*
@@ -47,17 +35,15 @@ class AttributeController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function defaultAction() {
public function defaultAction()
{
if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response;
return $this->render('product-attributes');
}
public function updateAction() {
public function updateAction()
{
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
return $this->render('product-attributes-edit');
}
}

View File

@@ -33,7 +33,6 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Tools\URL;
use Thelia\Tools\Redirect;
use Thelia\Core\Security\SecurityContext;
use Thelia\Model\AdminLog;
use Thelia\Model\Lang;
use Thelia\Model\LangQuery;
@@ -50,7 +49,8 @@ class BaseAdminController extends BaseController
*
* @param unknown $message
*/
public function adminLogAppend($message) {
public function adminLogAppend($message)
{
AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser());
}
@@ -66,12 +66,10 @@ class BaseAdminController extends BaseController
if (! empty($template)) {
// If we have a view in the URL, render this view
return $this->render($template);
}
elseif (null != $view = $this->getRequest()->get('view')) {
} elseif (null != $view = $this->getRequest()->get('view')) {
return $this->render($view);
}
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
return $this->errorPage($ex->getMessage());
}
@@ -135,7 +133,8 @@ class BaseAdminController extends BaseController
/*
* Create the standard message displayed to the user when the form cannot be validated.
*/
protected function createStandardFormValidationErrorMessage(FormValidationException $exception) {
protected function createStandardFormValidationErrorMessage(FormValidationException $exception)
{
return $this->getTranslator()->trans(
"Please check your input: %error",
array(
@@ -152,8 +151,8 @@ class BaseAdminController extends BaseController
* @param string $error_message the error message
* @param Exception $exception the exception or null if no exception
*/
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null) {
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null)
{
if ($error_message !== false) {
// Log the error message
@@ -227,7 +226,8 @@ class BaseAdminController extends BaseController
*
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
*/
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH)
{
return $this->getRouteFromRouter(
'router.admin',
$routeId,
@@ -242,15 +242,16 @@ class BaseAdminController extends BaseController
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
*/
public function redirectToRoute($routeId, $urlParameters = array()) {
public function redirectToRoute($routeId, $urlParameters = array())
{
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters));
}
/**
* Get the current edition lang ID, checking if a change was requested in the current request.
*/
protected function getCurrentEditionLang() {
protected function getCurrentEditionLang()
{
// Return the new language if a change is required.
if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) {
@@ -266,7 +267,8 @@ class BaseAdminController extends BaseController
/**
* A simple helper to get the current edition locale.
*/
protected function getCurrentEditionLocale() {
protected function getCurrentEditionLocale()
{
return $this->getCurrentEditionLang()->getLocale();
}
@@ -322,13 +324,11 @@ class BaseAdminController extends BaseController
$data = $this->getParser()->render($templateName, $args);
return $data;
}
catch (AuthenticationException $ex) {
} catch (AuthenticationException $ex) {
// User is not authenticated, and templates requires authentication -> redirect to login page
// We user login_tpl as a path, not a template.
Redirect::exec(URL::getInstance()->absoluteUrl($ex->getLoginTemplate()));
}
catch (AuthorizationException $ex) {
} catch (AuthorizationException $ex) {
// User is not allowed to perform the required action. Return the error page instead of the requested page.
return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."));
}

View File

@@ -23,18 +23,10 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\AuthorizationException;
use Thelia\Log\Tlog;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\CategoryCreateEvent;
use Thelia\Form\CategoryCreationForm;
use Thelia\Core\Event\CategoryDeleteEvent;
use Thelia\Core\Event\CategoryToggleVisibilityEvent;
use Thelia\Core\Event\CategoryChangePositionEvent;
use Thelia\Form\CategoryDeletionForm;
use Thelia\Model\Lang;
use Thelia\Core\Translation\Translator;
use Thelia\Core\Event\CategoryUpdatePositionEvent;
use Thelia\Model\CategoryQuery;
use Thelia\Form\CategoryModificationForm;
@@ -46,12 +38,13 @@ class CategoryController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
protected function renderList() {
protected function renderList()
{
return $this->render('categories', $this->getTemplateArgs());
}
protected function getTemplateArgs() {
protected function getTemplateArgs()
{
// Get the category ID
$category_id = $this->getRequest()->get('category_id', 0);
@@ -77,10 +70,9 @@ class CategoryController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function defaultAction() {
public function defaultAction()
{
if (null !== $response = $this->checkAuth("admin.categories.view")) return $response;
return $this->renderList();
}
@@ -89,8 +81,8 @@ class CategoryController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function createAction() {
public function createAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.create")) return $response;
@@ -126,12 +118,10 @@ class CategoryController extends BaseAdminController
// Redirect to the success URL
$this->redirect($successUrl);
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
@@ -147,8 +137,8 @@ class CategoryController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function changeAction() {
public function changeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
@@ -189,8 +179,8 @@ class CategoryController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function saveChangeAction() {
public function saveChangeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
@@ -241,12 +231,10 @@ class CategoryController extends BaseAdminController
// Redirect to the success URL
$this->redirect($changeForm->getSuccessUrl());
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
@@ -260,7 +248,8 @@ class CategoryController extends BaseAdminController
/**
* Online status toggle category
*/
public function setToggleVisibilityAction() {
public function setToggleVisibilityAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
@@ -271,8 +260,7 @@ class CategoryController extends BaseAdminController
try {
$this->dispatch(TheliaEvents::CATEGORY_SET_DEFAULT, $changeEvent);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
@@ -283,7 +271,8 @@ class CategoryController extends BaseAdminController
/**
* Update categoryposition
*/
public function updatePositionAction() {
public function updatePositionAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
@@ -306,8 +295,7 @@ class CategoryController extends BaseAdminController
);
$this->dispatch(TheliaEvents::CATEGORY_UPDATE_POSITION, $event);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
@@ -320,8 +308,8 @@ class CategoryController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function deleteAction() {
public function deleteAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.delete")) return $response;

View File

@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Tools\URL;
use Thelia\Core\Event\ConfigUpdateEvent;
use Thelia\Core\Event\ConfigCreateEvent;
use Thelia\Log\Tlog;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Security\Exception\AuthorizationException;
use Thelia\Model\ConfigQuery;
use Thelia\Form\ConfigModificationForm;
use Thelia\Form\ConfigCreationForm;
@@ -47,8 +45,8 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
protected function renderList() {
protected function renderList()
{
// Find the current order
$order = $this->getRequest()->get(
'order',
@@ -66,10 +64,9 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function defaultAction() {
public function defaultAction()
{
if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response;
return $this->renderList();
}
@@ -78,8 +75,8 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function createAction() {
public function createAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response;
@@ -120,12 +117,10 @@ class ConfigController extends BaseAdminController
// Redirect to the success URL
$this->redirect($successUrl);
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$message = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$message = $ex->getMessage();
}
@@ -141,8 +136,8 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function changeAction() {
public function changeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
@@ -183,8 +178,8 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function saveChangeAction() {
public function saveChangeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
@@ -240,12 +235,10 @@ class ConfigController extends BaseAdminController
// Redirect to the success URL
$this->redirect($changeForm->getSuccessUrl());
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$message = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$message = $ex->getMessage();
}
@@ -261,8 +254,8 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function changeValuesAction() {
public function changeValuesAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
@@ -284,8 +277,8 @@ class ConfigController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function deleteAction() {
public function deleteAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response;

View File

@@ -26,17 +26,12 @@ namespace Thelia\Controller\Admin;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;
use Thelia\Constraint\ConstraintFactory;
use Thelia\Constraint\ConstraintFactoryTest;
use Thelia\Constraint\Rule\AvailableForTotalAmount;
use Thelia\Constraint\Rule\CouponRuleInterface;
use Thelia\Constraint\Validator\PriceParam;
use Thelia\Core\Event\Coupon\CouponCreateEvent;
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
use Thelia\Core\Event\Coupon\CouponEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Session\Session;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\AuthorizationException;
use Thelia\Core\Translation\Translator;
use Thelia\Coupon\CouponAdapterInterface;
use Thelia\Coupon\CouponManager;
@@ -222,7 +217,6 @@ class CouponController extends BaseAdminController
);
}
/**
* Manage Coupons Rule creation display
*
@@ -311,8 +305,6 @@ class CouponController extends BaseAdminController
);
}
/**
* Manage Coupons read display
*
@@ -375,7 +367,6 @@ class CouponController extends BaseAdminController
);
}
/**
* Manage Coupons read display
*
@@ -697,6 +688,4 @@ class CouponController extends BaseAdminController
// }
// }
}

View File

@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Tools\URL;
use Thelia\Core\Event\CurrencyUpdateEvent;
use Thelia\Core\Event\CurrencyCreateEvent;
use Thelia\Log\Tlog;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Security\Exception\AuthorizationException;
use Thelia\Model\CurrencyQuery;
use Thelia\Form\CurrencyModificationForm;
use Thelia\Form\CurrencyCreationForm;
@@ -48,8 +46,8 @@ class CurrencyController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
protected function renderList() {
protected function renderList()
{
// Find the current order
$order = $this->getRequest()->get(
'order',
@@ -67,10 +65,9 @@ class CurrencyController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function defaultAction() {
public function defaultAction()
{
if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response;
return $this->renderList();
}
@@ -79,8 +76,8 @@ class CurrencyController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function createAction() {
public function createAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response;
@@ -120,12 +117,10 @@ class CurrencyController extends BaseAdminController
// Redirect to the success URL
$this->redirect($successUrl);
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
@@ -141,8 +136,8 @@ class CurrencyController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function changeAction() {
public function changeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
@@ -179,8 +174,8 @@ class CurrencyController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function saveChangeAction() {
public function saveChangeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
@@ -231,12 +226,10 @@ class CurrencyController extends BaseAdminController
// Redirect to the success URL
$this->redirect($changeForm->getSuccessUrl());
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
@@ -250,7 +243,8 @@ class CurrencyController extends BaseAdminController
/**
* Sets the default currency
*/
public function setDefaultAction() {
public function setDefaultAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
@@ -261,8 +255,7 @@ class CurrencyController extends BaseAdminController
try {
$this->dispatch(TheliaEvents::CURRENCY_SET_DEFAULT, $changeEvent);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
@@ -273,14 +266,14 @@ class CurrencyController extends BaseAdminController
/**
* Update currencies rates
*/
public function updateRatesAction() {
public function updateRatesAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
try {
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
@@ -291,7 +284,8 @@ class CurrencyController extends BaseAdminController
/**
* Update currencyposition
*/
public function updatePositionAction() {
public function updatePositionAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
@@ -314,8 +308,7 @@ class CurrencyController extends BaseAdminController
);
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
@@ -323,14 +316,13 @@ class CurrencyController extends BaseAdminController
$this->redirectToRoute('admin.configuration.currencies.default');
}
/**
* Delete a currency object
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function deleteAction() {
public function deleteAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response;

View File

@@ -23,7 +23,6 @@
namespace Thelia\Controller\Admin;
/**
* Class CustomerController
* @package Thelia\Controller\Admin
@@ -34,7 +33,6 @@ class CustomerController extends BaseAdminController
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.customers.view")) return $response;
return $this->render("customers", array("display_customer" => 20));
}
}

View File

@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Tools\URL;
use Thelia\Core\Event\MessageUpdateEvent;
use Thelia\Core\Event\MessageCreateEvent;
use Thelia\Log\Tlog;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Security\Exception\AuthorizationException;
use Thelia\Model\MessageQuery;
use Thelia\Form\MessageModificationForm;
use Thelia\Form\MessageCreationForm;
@@ -47,7 +45,8 @@ class MessageController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
protected function renderList() {
protected function renderList()
{
return $this->render('messages');
}
@@ -56,10 +55,9 @@ class MessageController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function defaultAction() {
public function defaultAction()
{
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
return $this->renderList();
}
@@ -68,8 +66,8 @@ class MessageController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function createAction() {
public function createAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response;
@@ -107,12 +105,10 @@ class MessageController extends BaseAdminController
// Redirect to the success URL
$this->redirect($successUrl);
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$message = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$message = $ex->getMessage();
}
@@ -128,8 +124,8 @@ class MessageController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function changeAction() {
public function changeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
@@ -168,8 +164,8 @@ class MessageController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function saveChangeAction() {
public function saveChangeAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
@@ -221,12 +217,10 @@ class MessageController extends BaseAdminController
// Redirect to the success URL
$this->redirect($changeForm->getSuccessUrl());
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Form cannot be validated
$message = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Any other error
$message = $ex->getMessage();
}
@@ -242,8 +236,8 @@ class MessageController extends BaseAdminController
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
public function deleteAction() {
public function deleteAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response;

View File

@@ -27,7 +27,6 @@ use Thelia\Form\AdminLogin;
use Thelia\Core\Security\Authentication\AdminUsernamePasswordFormAuthenticator;
use Thelia\Model\AdminLog;
use Thelia\Core\Security\Exception\AuthenticationException;
use Symfony\Component\Validator\Exception\ValidatorException;
use Thelia\Tools\URL;
use Thelia\Tools\Redirect;
use Thelia\Core\Event\TheliaEvents;
@@ -74,20 +73,17 @@ class SessionController extends BaseAdminController
// Redirect to the success URL
return Redirect::exec($adminLoginForm->getSuccessUrl());
}
catch (FormValidationException $ex) {
} catch (FormValidationException $ex) {
// Validation problem
$message = $this->createStandardFormValidationErrorMessage($ex);
}
catch (AuthenticationException $ex) {
} catch (AuthenticationException $ex) {
// Log authentication failure
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
$message = $this->getTranslator()->trans("Login failed. Please check your username and password.");
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Log authentication failure
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);

View File

@@ -39,7 +39,6 @@ use Thelia\Form\BaseForm;
use Thelia\Form\Exception\FormValidationException;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Core\Event\DefaultActionEvent;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -142,8 +141,8 @@ class BaseController extends ContainerAware
* @param \Symfony\Component\Form\Form $form
* @return string the error string
*/
private function getErrorMessages(\Symfony\Component\Form\Form $form) {
private function getErrorMessages(\Symfony\Component\Form\Form $form)
{
$errors = '';
foreach ($form->getErrors() as $key => $error) {
@@ -177,8 +176,7 @@ class BaseController extends ContainerAware
if ($form->isValid()) {
return $form;
}
else {
} else {
$errorMessage = null;
if ($form->get("error_message")->getData() != null) {
$errorMessage = $form->get("error_message")->getData();
@@ -188,8 +186,7 @@ class BaseController extends ContainerAware
throw new FormValidationException($errorMessage);
}
}
else {
} else {
throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod));
}
}
@@ -214,8 +211,7 @@ class BaseController extends ContainerAware
{
if ($form != null) {
$url = $form->getSuccessUrl();
}
else {
} else {
$url = $this->getRequest()->get("success_url");
}
@@ -239,7 +235,8 @@ class BaseController extends ContainerAware
* @throws \InvalidArgumentException When the router doesn't exist
* @return string The generated URL
*/
protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH)
{
/** @var Router $router */
$router = $this->container->get($routerName);

View File

@@ -31,7 +31,6 @@ use Thelia\Model\Base\AddressQuery;
use Thelia\Model\Customer;
use Thelia\Tools\URL;
/**
* Class AddressController
* @package Thelia\Controller\Front
@@ -66,8 +65,7 @@ class AddressController extends BaseFrontController
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
}
catch (\Exception $e) {
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
@@ -120,8 +118,7 @@ class AddressController extends BaseFrontController
$this->redirectSuccess($addressUpdate);
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
}
catch (\Exception $e) {
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}

View File

@@ -35,7 +35,8 @@ class BaseFrontController extends BaseController
*
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
*/
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH)
{
return $this->getRouteFromRouter('router.front', $routeId, $parameters, $referenceType);
}
@@ -45,7 +46,8 @@ class BaseFrontController extends BaseController
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
*/
public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH)
{
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
}
}

View File

@@ -97,7 +97,6 @@ class CartController extends BaseFrontController
$this->getParserContext()->setGeneralError($e->getMessage());
}
}
/**

View File

@@ -27,19 +27,15 @@ use Thelia\Core\Event\CustomerLoginEvent;
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\UsernameNotFoundException;
use Thelia\Core\Security\SecurityContext;
use Thelia\Form\CustomerCreation;
use Thelia\Form\CustomerLogin;
use Thelia\Form\CustomerModification;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\Customer;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\CustomerEvent;
use Thelia\Core\Factory\ActionEventFactory;
use Thelia\Tools\URL;
use Thelia\Log\Tlog;
use Thelia\Core\Security\Exception\WrongPasswordException;
use Symfony\Component\Routing\Router;
/**
* Class CustomerController
@@ -70,11 +66,9 @@ class CustomerController extends BaseFrontController
$this->processLogin($customerCreateEvent->getCustomer());
$this->redirectSuccess($customerCreation);
}
catch (FormValidationException $e) {
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
}
catch (\Exception $e) {
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
@@ -118,11 +112,9 @@ class CustomerController extends BaseFrontController
$this->redirectSuccess($customerModification);
}
catch (FormValidationException $e) {
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
}
catch (\Exception $e) {
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
@@ -166,8 +158,7 @@ class CustomerController extends BaseFrontController
$this->redirectSuccess($customerLoginForm);
}
catch (FormValidationException $e) {
} catch (FormValidationException $e) {
if ($request->request->has("account")) {
$account = $request->request->get("account");
@@ -178,17 +169,13 @@ class CustomerController extends BaseFrontController
}
$message = sprintf("Please check your input: %s", $e->getMessage());
}
catch(UsernameNotFoundException $e) {
} catch (UsernameNotFoundException $e) {
$message = "Wrong email or password. Please try again";
}
catch (WrongPasswordException $e) {
} catch (WrongPasswordException $e) {
$message = "Wrong email or password. Please try again";
}
catch(AuthenticationException $e) {
} catch (AuthenticationException $e) {
$message = "Wrong email or password. Please try again";
}
catch (\Exception $e) {
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Controller\Front;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\URL;
/**
* Class DeliveryController
* @package Thelia\Controller\Front

View File

@@ -25,7 +25,6 @@ namespace Thelia\Controller\Install;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Controller\BaseController;
/**
* Class BaseInstallController
* @package Thelia\Controller\Install

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Controller\Install;
use Thelia\Install\BaseInstall;
use Thelia\Install\CheckPermission;
/**
@@ -30,8 +29,8 @@ use Thelia\Install\CheckPermission;
* @package Thelia\Controller\Install
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class InstallController extends BaseInstallController {
class InstallController extends BaseInstallController
{
public function index()
{
$this->verifyStep(1);

View File

@@ -24,8 +24,6 @@
namespace Thelia\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Form\BaseForm;
/**
*
* Class thrown on Thelia.action event

View File

@@ -26,7 +26,6 @@ use Symfony\Component\EventDispatcher\Event;
use Thelia\Model\Address;
use Thelia\Model\Customer;
/**
* Class AddressCreateOrUpdateEvent
* @package Thelia\Core\Event
@@ -109,7 +108,7 @@ class AddressCreateOrUpdateEvent extends ActionEvent
*/
protected $address;
function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
public function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
{
$this->address1 = $address1;
$this->address2 = $address2;
@@ -263,5 +262,4 @@ class AddressCreateOrUpdateEvent extends ActionEvent
return $this->address;
}
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Model\Address;
/**
* Class AddressEvent
* @package Thelia\Core\Event
@@ -38,12 +37,11 @@ class AddressEvent extends ActionEvent
*/
protected $address;
function __construct(Address $address)
public function __construct(Address $address)
{
$this->address = $address;
}
/**
* @return \Thelia\Model\Address
*/

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event;
class BaseToggleVisibilityEvent extends ActionEvent
{
protected $object_id;
@@ -43,6 +42,7 @@ class BaseToggleVisibilityEvent extends ActionEvent
public function setObjectId($object_id)
{
$this->object_id = $object_id;
return $this;
}
}

View File

@@ -50,6 +50,7 @@ class BaseUpdatePositionEvent extends ActionEvent
public function setMode($mode)
{
$this->mode = $mode;
return $this;
}
@@ -61,6 +62,7 @@ class BaseUpdatePositionEvent extends ActionEvent
public function setPosition($position)
{
$this->position = $position;
return $this;
}
@@ -72,6 +74,7 @@ class BaseUpdatePositionEvent extends ActionEvent
public function setObjectId($object_id)
{
$this->object_id = $object_id;
return $this;
}
}

View File

@@ -145,5 +145,4 @@ class CartEvent extends ActionEvent
return $this->cart;
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Category;
class CategoryCreateEvent extends CategoryEvent
{
protected $title;
@@ -46,6 +44,7 @@ class CategoryCreateEvent extends CategoryEvent
public function setTitle($title)
{
$this->title = $title;
return $this;
}
@@ -57,6 +56,7 @@ class CategoryCreateEvent extends CategoryEvent
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
@@ -68,6 +68,7 @@ class CategoryCreateEvent extends CategoryEvent
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Category;
class CategoryDeleteEvent extends CategoryEvent
{
public function __construct($category_id)
@@ -40,6 +38,7 @@ class CategoryDeleteEvent extends CategoryEvent
public function setCategoryId($category_id)
{
$this->category_id = $category_id;
return $this;
}
}

View File

@@ -35,7 +35,8 @@ class CategoryEvent extends ActionEvent
$this->category = $category;
}
public function hasCategory() {
public function hasCategory()
{
return ! is_null($this->category);
}

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Category;
class CategoryUpdateEvent extends CategoryCreateEvent
{
@@ -49,6 +48,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setCategoryId($category_id)
{
$this->category_id = $category_id;
return $this;
}
@@ -60,6 +60,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setChapo($chapo)
{
$this->chapo = $chapo;
return $this;
}
@@ -71,6 +72,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setDescription($description)
{
$this->description = $description;
return $this;
}
@@ -82,6 +84,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
return $this;
}
@@ -93,6 +96,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setUrl($url)
{
$this->url = $url;
return $this;
}
@@ -104,6 +108,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setVisibility($visibility)
{
$this->visibility = $visibility;
return $this;
}
@@ -115,6 +120,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
}

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Config;
class ConfigCreateEvent extends ConfigEvent
{

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Config;
class ConfigDeleteEvent extends ConfigEvent
{
protected $config_id;

View File

@@ -33,7 +33,8 @@ class ConfigEvent extends ActionEvent
$this->config = $config;
}
public function hasConfig() {
public function hasConfig()
{
return ! is_null($this->config);
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Config;
class ConfigUpdateEvent extends ConfigCreateEvent
{
protected $config_id;

View File

@@ -102,7 +102,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
* @param CouponRuleCollection $rules CouponRuleInterface to add
* @param string $locale Coupon Language code ISO (ex: fr_FR)
*/
function __construct(
public function __construct(
$code,
$title,
$amount,
@@ -307,6 +307,4 @@ class CouponCreateOrUpdateEvent extends ActionEvent
return $this->coupon;
}
}

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Currency;
class CurrencyCreateEvent extends CurrencyEvent
{

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Currency;
class CurrencyDeleteEvent extends CurrencyEvent
{
protected $currency_id;

View File

@@ -33,7 +33,8 @@ class CurrencyEvent extends ActionEvent
$this->currency = $currency;
}
public function hasCurrency() {
public function hasCurrency()
{
return ! is_null($this->currency);
}

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Currency;
class CurrencyUpdateEvent extends CurrencyCreateEvent
{

View File

@@ -9,12 +9,11 @@
namespace Thelia\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Model\Customer;
class CustomerCreateOrUpdateEvent extends ActionEvent {
class CustomerCreateOrUpdateEvent extends ActionEvent
{
//base parameters for creating new customer
protected $title;
protected $firstname;
@@ -39,7 +38,6 @@ class CustomerCreateOrUpdateEvent extends ActionEvent {
*/
protected $customer;
/**
* @param int $title the title customer id
* @param string $firstname
@@ -59,7 +57,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent {
* @param int $sponsor customer's id sponsor
* @param float $discount
*/
function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount)
public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount)
{
$this->address1 = $address1;
$this->address2 = $address2;
@@ -231,7 +229,4 @@ class CustomerCreateOrUpdateEvent extends ActionEvent {
return $this->customer;
}
}

View File

@@ -43,5 +43,4 @@ class CustomerEvent extends ActionEvent
return $this->customer;
}
}

View File

@@ -23,11 +23,10 @@
namespace Thelia\Core\Event;
use Thelia\Model\Customer;
class CustomerLoginEvent extends ActionEvent {
class CustomerLoginEvent extends ActionEvent
{
protected $customer;
public function __construct(Customer $customer)

View File

@@ -22,8 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Model\Cart;
class ImageEvent extends ActionEvent
{

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Message;
class MessageCreateEvent extends MessageEvent
{

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Message;
class MessageDeleteEvent extends MessageEvent
{
protected $message_id;

View File

@@ -33,7 +33,8 @@ class MessageEvent extends ActionEvent
$this->message = $message;
}
public function hasMessage() {
public function hasMessage()
{
return ! is_null($this->message);
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Core\Event;
use Thelia\Model\Message;
class MessageUpdateEvent extends MessageCreateEvent
{
protected $message_id;

View File

@@ -204,8 +204,6 @@ final class TheliaEvents
*/
const IMAGE_CLEAR_CACHE = "action.clearImageCache";
/**
* Sent when creating a Coupon
*/
@@ -311,7 +309,6 @@ final class TheliaEvents
*/
const AFTER_COUPON_RULE_DELETE = "action.after_delete_coupon_rule";
// -- Configuration management ---------------------------------------------
const CONFIG_CREATE = "action.createConfig";
@@ -361,5 +358,4 @@ final class TheliaEvents
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
}

View File

@@ -84,6 +84,7 @@ class Session extends BaseSession
public function setCustomerUser(UserInterface $user)
{
$this->set('thelia.customer_user', $user);
return $this;
}
@@ -102,6 +103,7 @@ class Session extends BaseSession
public function setAdminUser(UserInterface $user)
{
$this->set('thelia.admin_user', $user);
return $this;
}
@@ -120,6 +122,7 @@ class Session extends BaseSession
public function setReturnToUrl($url)
{
$this->set('thelia.return_to_url', $url);
return $this;
}
@@ -180,6 +183,7 @@ class Session extends BaseSession
public function setCart($cart_id)
{
$this->set("thelia.cart_id", $cart_id);
return $this;
}
@@ -192,6 +196,7 @@ class Session extends BaseSession
public function setDelivery($delivery_id)
{
$this->set("thelia.delivery_id", $delivery_id);
return $this;
}

View File

@@ -38,7 +38,6 @@ use Thelia\Model\ConfigQuery;
use Thelia\Tools\Redirect;
use Thelia\Tools\URL;
/**
* Class RewritingRouter
* @package Thelia\Core\Routing

View File

@@ -97,8 +97,8 @@ class SecurityContext
* @param array $roles the roles
* @return boolean true if the user has the required role, false otherwise
*/
final public function hasRequiredRole($user, array $roles) {
final public function hasRequiredRole($user, array $roles)
{
if ($user != null) {
// Check if user's roles matches required roles
$userRoles = $user->getRoles();

View File

@@ -29,8 +29,6 @@ use Assetic\Filter;
use Assetic\Factory\AssetFactory;
use Assetic\Factory\Worker\CacheBustingWorker;
use Assetic\AssetWriter;
use Assetic\Asset\AssetCache;
use Assetic\Cache\FilesystemCache;
/**
* This class is a simple helper for generating assets using Assetic.
@@ -139,8 +137,7 @@ class AsseticHelper
foreach ($filter_list as $filter) {
if ('?' != $filter[0]) {
$asset->ensureFilter($fm->get($filter));
}
elseif (!$debug) {
} elseif (!$debug) {
$asset->ensureFilter($fm->get(substr($filter, 1)));
}
}

View File

@@ -24,10 +24,8 @@
namespace Thelia\Core\Template\Element;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Thelia\Core\Security\SecurityContext;
use Thelia\Model\Tools\ModelCriteriaTools;
/**
@@ -66,6 +64,7 @@ abstract class BaseI18nLoop extends BaseLoop
protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false)
{
/* manage translations */
return ModelCriteriaTools::getI18n(
$this->getBackend_context(),
$this->getLang(),

View File

@@ -29,7 +29,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Thelia\Core\Security\SecurityContext;
use Thelia\Model\Tools\ModelCriteriaTools;
/**
*

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Collection\ObjectCollection;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
@@ -99,7 +98,6 @@ class Address extends BaseLoop
$default = $this->getDefault();
if ($default === true) {
$search->filterByIsDefault(1, Criteria::EQUAL);
}

View File

@@ -24,21 +24,16 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\Base\LangQuery;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery;
use Thelia\Model\Base\AttributeQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -24,17 +24,14 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\Base\AttributeAvQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -24,19 +24,16 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\Base\AttributeCombinationQuery;
use Thelia\Model\Map\AttributeAvTableMap;
use Thelia\Model\Map\AttributeTableMap;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -28,13 +28,13 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ModuleQuery;
/**
* Class Delivery
* @package Thelia\Core\Template\Loop
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class BaseSpecificModule extends BaseI18nLoop {
class BaseSpecificModule extends BaseI18nLoop
{
public $timestampable = true;
/**
@@ -93,12 +93,10 @@ class BaseSpecificModule extends BaseI18nLoop {
{
$search = ModuleQuery::create();
if(null !== $id = $this->getId())
{
if (null !== $id = $this->getId()) {
$search->filterById($id);
}
if (null !== $exclude = $this->getExclude()) {
$search->filterById($exclude, Criteria::NOT_IN);
}

View File

@@ -72,8 +72,6 @@ class Cart extends BaseLoop
public function exec(&$pagination)
{
$cart = $this->getCart($this->request);
$cartItems = $cart->getCartItems();
$result = new LoopResult($cartItems);

View File

@@ -30,10 +30,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\CategoryQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
@@ -113,7 +111,6 @@ class Category extends BaseI18nLoop
$search->filterByParent($parent);
}
$current = $this->getCurrent();
if ($current === true) {
@@ -122,7 +119,6 @@ class Category extends BaseI18nLoop
$search->filterById($this->request->get("category_id"), Criteria::NOT_IN);
}
$exclude = $this->getExclude();
if (!is_null($exclude)) {

View File

@@ -30,7 +30,6 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\LangQuery;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ConfigQuery;
use Thelia\Type\BooleanOrBothType;

View File

@@ -35,7 +35,6 @@ use Thelia\Model\FolderQuery;
use Thelia\Model\Map\ContentTableMap;
use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ContentQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CountryQuery;
use Thelia\Model\ConfigQuery;
/**
*

View File

@@ -34,13 +34,9 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CouponQuery;
use Thelia\Model\Coupon as MCoupon;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/**
* Created by JetBrains PhpStorm.
@@ -95,7 +91,6 @@ class Coupon extends BaseI18nLoop
/** @var Lang $lang */
$lang = $request->getSession()->getLang();
/** @var MCoupon $coupon */
foreach ($coupons as $coupon) {
$loopResultRow = new LoopResultRow();

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type\EnumListType;

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Collection\ObjectCollection;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;

View File

@@ -26,7 +26,6 @@ use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
/**
* Class Delivery
* @package Thelia\Core\Template\Loop

View File

@@ -34,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery;
use Thelia\Model\Base\FeatureQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\FeatureAvQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -24,19 +24,15 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\Base\FeatureProductQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Map\FeatureAvTableMap;
use Thelia\Model\Map\FeatureProductTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -30,10 +30,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\FolderQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
@@ -95,7 +93,6 @@ class Folder extends BaseI18nLoop
$search->filterByParent($parent);
}
$current = $this->getCurrent();
if ($current === true) {
@@ -104,7 +101,6 @@ class Folder extends BaseI18nLoop
$search->filterById($this->request->get("folder_id"), Criteria::NOT_IN);
}
$exclude = $this->getExclude();
if (!is_null($exclude)) {

View File

@@ -25,8 +25,6 @@ namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Event\ImageEvent;
use Thelia\Model\CategoryImageQuery;
use Thelia\Model\ProductImageQuery;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Type\TypeCollection;
@@ -113,8 +111,8 @@ class Image extends BaseI18nLoop
* @param int $object_id the source object ID
* @return ModelCriteria the propel Query object
*/
protected function createSearchQuery($source, $object_id) {
protected function createSearchQuery($source, $object_id)
{
$object = ucfirst($source);
$queryClass = sprintf("\Thelia\Model\%sImageQuery", $object);
@@ -163,8 +161,8 @@ class Image extends BaseI18nLoop
* @param string $object_id (returned) the ID of the source object
* @return ModelCriteria the propel Query object
*/
protected function getSearchQuery(&$object_type, &$object_id) {
protected function getSearchQuery(&$object_type, &$object_id)
{
$search = null;
// Check form source="product" source_id="123" style arguments
@@ -184,8 +182,7 @@ class Image extends BaseI18nLoop
$object_type = $source;
$object_id = $source_id;
}
else {
} else {
// Check for product="id" folder="id", etc. style arguments
foreach ($this->possible_sources as $source) {
@@ -316,8 +313,7 @@ class Image extends BaseI18nLoop
;
$loopResult->addRow($loopResultRow);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Ignore the result and log an error
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
}

View File

@@ -30,7 +30,6 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\LangQuery;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\MessageQuery;
use Thelia\Type\BooleanOrBothType;

View File

@@ -31,12 +31,10 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\CategoryQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\Map\FeatureProductTableMap;
use Thelia\Model\Map\ProductPriceTableMap;
use Thelia\Model\Map\ProductSaleElementsTableMap;
use Thelia\Model\Map\ProductTableMap;

View File

@@ -24,17 +24,14 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\Base\ProductSaleElementsQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery;
use Thelia\Type\TypeCollection;

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CustomerTitleQuery;
use Thelia\Model\ConfigQuery;
/**
*

View File

@@ -25,7 +25,6 @@ namespace Thelia\Core\Template;
use Thelia\Model\ConfigQuery;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Tools\URL;
use Thelia\Form\BaseForm;
/**
* The parser context is an application-wide context, which stores var-value pairs.

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Template\Smarty\Exception;
/**
* Class SmartyPluginException
* @package Thelia\Core\Template\Smarty\Exception

View File

@@ -26,7 +26,6 @@ namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\SecurityContext;
/**
@@ -43,7 +42,8 @@ class AdminUtilities extends AbstractSmartyPlugin
$this->securityContext = $securityContext;
}
public function generatePositionChangeBlock($params, &$smarty) {
public function generatePositionChangeBlock($params, &$smarty)
{
// The required permissions
$permission = $this->getParam($params, 'permission');
@@ -77,13 +77,11 @@ class AdminUtilities extends AbstractSmartyPlugin
$position,
URL::getInstance()->absoluteUrl($path, array('mode' => 'down', $url_parameter => $id))
);
}
else {
} else {
return $position;
}
}
/**
* Generates the link of a sortable column header
*
@@ -111,12 +109,10 @@ class AdminUtilities extends AbstractSmartyPlugin
if ($current_order == $order) {
$icon = 'up';
$order_change = $reverse_order;
}
else if ($current_order == $reverse_order) {
} elseif ($current_order == $reverse_order) {
$icon = 'down';
$order_change = $order;
}
else {
} else {
$order_change = $order;
}
@@ -128,7 +124,6 @@ class AdminUtilities extends AbstractSmartyPlugin
return sprintf('%s<a href="%s">%s</a>', $output, URL::getInstance()->absoluteUrl($path, array('order' => $order_change)), $label);
}
/**
* Define the various smarty plugins handled by this class
*

View File

@@ -107,8 +107,7 @@ class Form extends AbstractSmartyPlugin
$template->assign("form_error", $instance->hasError() ? true : false);
$template->assign("form_error_message", $instance->getErrorMessage());
}
else {
} else {
return $content;
}
}
@@ -201,7 +200,6 @@ class Form extends AbstractSmartyPlugin
}
}
protected function assignFieldErrorVars(\Smarty_Internal_Template $template, array $errors)
{
$template->assign("message", $errors[0]->getMessage());
@@ -223,7 +221,6 @@ class Form extends AbstractSmartyPlugin
if (null == $fieldName)
throw new \InvalidArgumentException("'field' parameter is missing");
if (empty($instance->getView()[$fieldName]))
throw new \InvalidArgumentException(sprintf("Field name '%s' not found in form %s", $fieldName, $instance->getName()));

View File

@@ -121,7 +121,6 @@ class Format extends AbstractSmartyPlugin
$lang = $this->request->getSession()->getLang();
$decimals = array_key_exists("decimals", $params) ? $params["decimals"] : $lang->getDecimals();
$decPoint = array_key_exists("dec_point", $params) ? $params["dec_point"] : $lang->getDecimalSeparator();
$thousandsSep = array_key_exists("thousands_sep", $params) ? $params["thousands_sep"] : $lang->getThousandsSeparator();

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Template\Element\Exception\ElementNotFoundException;
use Thelia\Core\Template\Element\Exception\InvalidElementException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Thelia\Core\Security\SecurityContext;
class TheliaLoop extends AbstractSmartyPlugin

View File

@@ -54,7 +54,6 @@ class UrlGenerator extends AbstractSmartyPlugin
$url = URL::getInstance()->absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target')));
if ($target != null) $url .= '#'.$target;
return $url;
}

View File

@@ -37,13 +37,11 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Validator\Tests\Fixtures\Reference;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Thelia\Core\Bundle;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Log\Tlog;
use Thelia\Config\DatabaseConfiguration;
use Thelia\Config\DefinePropel;
use Thelia\Core\TheliaContainerBuilder;

View File

@@ -22,9 +22,9 @@ class Translator extends BaseTranslator
* @throws \RuntimeException if the class has not been instanciated.
* @return \Thelia\Core\Translation\Translator the instance.
*/
public static function getInstance() {
public static function getInstance()
{
if (self::$instance == null) throw new \RuntimeException("Translator instance is not initialized.");
return self::$instance;
}

View File

@@ -27,8 +27,8 @@ use Thelia\Log\Tlog;
class ImageException extends \RuntimeException
{
public function __construct($message, $code = null, $previous = null) {
public function __construct($message, $code = null, $previous = null)
{
Tlog::getInstance()->addError($message);
parent::__construct($message, $code, $previous);

Some files were not shown because too many files have changed in this diff Show More