fix cs
This commit is contained in:
@@ -27,11 +27,12 @@ use Thelia\Tools\URL;
|
||||
class TranslationsController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* @param string $item_name the modume code
|
||||
* @return Module the module object
|
||||
* @param string $item_name the modume code
|
||||
* @return Module the module object
|
||||
* @throws \InvalidArgumentException if module was not found
|
||||
*/
|
||||
protected function getModule($item_name) {
|
||||
protected function getModule($item_name)
|
||||
{
|
||||
if (null !== $module = ModuleQuery::create()->findPk($item_name))
|
||||
return $module;
|
||||
|
||||
@@ -40,8 +41,8 @@ class TranslationsController extends BaseAdminController
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected function getModuleTemplateNames(Module $module, $template_type) {
|
||||
protected function getModuleTemplateNames(Module $module, $template_type)
|
||||
{
|
||||
$templates =
|
||||
TemplateHelper::getInstance()->getList(
|
||||
$template_type,
|
||||
@@ -96,14 +97,12 @@ class TranslationsController extends BaseAdminController
|
||||
$domain = $module->getTranslationDomain();
|
||||
$i18n_directory = $module->getAbsoluteI18nPath();
|
||||
$walkMode = TemplateHelper::WALK_MODE_PHP;
|
||||
}
|
||||
else if ($module_part == 'admin-includes') {
|
||||
} elseif ($module_part == 'admin-includes') {
|
||||
$directory = $module->getAbsoluteAdminIncludesPath();
|
||||
$domain = $module->getAdminIncludesTranslationDomain();
|
||||
$i18n_directory = $module->getAbsoluteAdminIncludesI18nPath();
|
||||
$walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
|
||||
}
|
||||
else if (! empty($module_part)) {
|
||||
} elseif (! empty($module_part)) {
|
||||
// Front or back office template, form of $module_part is [bo|fo].subdir-name
|
||||
list($type, $subdir) = explode('.', $module_part);
|
||||
|
||||
@@ -111,13 +110,11 @@ class TranslationsController extends BaseAdminController
|
||||
$directory = $module->getAbsoluteBackOfficeTemplatePath($subdir);
|
||||
$domain = $module->getBackOfficeTemplateTranslationDomain($subdir);
|
||||
$i18n_directory = $module->getAbsoluteBackOfficeI18nTemplatePath($subdir);
|
||||
}
|
||||
else if ($type == 'fo') {
|
||||
} elseif ($type == 'fo') {
|
||||
$directory = $module->getAbsoluteFrontOfficeTemplatePath($subdir);
|
||||
$domain = $module->getFrontOfficeTemplateTranslationDomain($subdir);
|
||||
$i18n_directory = $module->getAbsoluteFrontOfficeI18nTemplatePath($subdir);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Undefined module template type: '$type'.");
|
||||
}
|
||||
|
||||
|
||||
@@ -132,10 +132,10 @@ abstract class BaseLoop
|
||||
/**
|
||||
* Provides a getter to loop parameter values
|
||||
*
|
||||
* @param string $name the method name (only getArgname is supported)
|
||||
* @param mixed $arguments this parameter is ignored
|
||||
* @param string $name the method name (only getArgname is supported)
|
||||
* @param mixed $arguments this parameter is ignored
|
||||
*
|
||||
* @return mixed the argument value
|
||||
* @return mixed the argument value
|
||||
* @throws \InvalidArgumentException if the parameter is unknown or the method name is not supported.
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
@@ -230,7 +230,7 @@ abstract class BaseLoop
|
||||
*
|
||||
* @param string $argumentName the argument name
|
||||
*
|
||||
* @return Argument the loop argument.
|
||||
* @return Argument the loop argument.
|
||||
* @throws \InvalidArgumentException if argument is not found in loop argument list
|
||||
*/
|
||||
protected function getArg($argumentName)
|
||||
@@ -251,7 +251,7 @@ abstract class BaseLoop
|
||||
* @param string $argumentName the argument name
|
||||
*
|
||||
* @throws \InvalidArgumentException if argument is not found in loop argument list
|
||||
* @return mixed the loop argument value
|
||||
* @return mixed the loop argument value
|
||||
*/
|
||||
protected function getArgValue($argumentName)
|
||||
{
|
||||
@@ -263,7 +263,7 @@ abstract class BaseLoop
|
||||
* @param PropelModelPager $pagination the pagination part
|
||||
*
|
||||
* @return array|PropelModelPager|ObjectCollection
|
||||
* @throws \InvalidArgumentException if the search mode is undefined.
|
||||
* @throws \InvalidArgumentException if the search mode is undefined.
|
||||
*/
|
||||
protected function search(ModelCriteria $search, &$pagination = null)
|
||||
{
|
||||
@@ -356,7 +356,7 @@ abstract class BaseLoop
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModelCriteria $search
|
||||
* @param ModelCriteria $search
|
||||
* @param PropelModelPager $pagination
|
||||
*
|
||||
* @return array|PropelModelPager
|
||||
|
||||
@@ -59,7 +59,7 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $loopName
|
||||
* @param string $loopName
|
||||
* @return PropelModelPager
|
||||
* @throws \InvalidArgumentException if no pagination was found for loop
|
||||
*/
|
||||
@@ -77,10 +77,10 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Process the count function: executes a loop and return the number of items found
|
||||
*
|
||||
* @param array $params parameters array
|
||||
* @param array $params parameters array
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*
|
||||
* @return int the item count
|
||||
* @return int the item count
|
||||
* @throws \InvalidArgumentException if a parameter is missing
|
||||
*
|
||||
*/
|
||||
@@ -104,10 +104,10 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Process {loop name="loop name" type="loop type" ... } ... {/loop} block
|
||||
*
|
||||
* @param array $params
|
||||
* @param string $content
|
||||
* @param \Smarty_Internal_Template $template
|
||||
* @param boolean $repeat
|
||||
* @param array $params
|
||||
* @param string $content
|
||||
* @param \Smarty_Internal_Template $template
|
||||
* @param boolean $repeat
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
@@ -209,11 +209,11 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Process {elseloop rel="loopname"} ... {/elseloop} block
|
||||
*
|
||||
* @param array $params loop parameters
|
||||
* @param string $content loop text content
|
||||
* @param array $params loop parameters
|
||||
* @param string $content loop text content
|
||||
* @param \Smarty_Internal_Template $template the Smarty object
|
||||
* @param boolean $repeat repeat indicator (see Smarty doc.)
|
||||
* @return string the loop output
|
||||
* @param boolean $repeat repeat indicator (see Smarty doc.)
|
||||
* @return string the loop output
|
||||
*/
|
||||
public function theliaElseloop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat)
|
||||
{
|
||||
@@ -228,11 +228,11 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Process {ifloop rel="loopname"} ... {/ifloop} block
|
||||
*
|
||||
* @param array $params loop parameters
|
||||
* @param string $content loop text content
|
||||
* @param array $params loop parameters
|
||||
* @param string $content loop text content
|
||||
* @param \Smarty_Internal_Template $template the Smarty object
|
||||
* @param boolean $repeat repeat indicator (see Smarty doc.)
|
||||
* @return string the loop output
|
||||
* @param boolean $repeat repeat indicator (see Smarty doc.)
|
||||
* @return string the loop output
|
||||
*/
|
||||
public function theliaIfLoop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat)
|
||||
{
|
||||
@@ -247,11 +247,11 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Process {pageloop rel="loopname"} ... {/pageloop} block
|
||||
*
|
||||
* @param array $params loop parameters
|
||||
* @param string $content loop text content
|
||||
* @param array $params loop parameters
|
||||
* @param string $content loop text content
|
||||
* @param \Smarty_Internal_Template $template the Smarty object
|
||||
* @param boolean $repeat repeat indicator (see Smarty doc.)
|
||||
* @return string the loop output
|
||||
* @param boolean $repeat repeat indicator (see Smarty doc.)
|
||||
* @return string the loop output
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function theliaPageLoop($params, $content, $template, &$repeat)
|
||||
@@ -337,9 +337,9 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
* Check if a loop has returned results. The loop shoud have been executed before, or an
|
||||
* InvalidArgumentException is thrown
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $params
|
||||
*
|
||||
* @return boolean true if the loop is empty
|
||||
* @return boolean true if the loop is empty
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function checkEmptyLoop($params)
|
||||
|
||||
@@ -29,7 +29,7 @@ class Translation extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Set the default translation domain
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $params
|
||||
* @param \Smarty_Internal_Template $smarty
|
||||
* @return string
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ class Translation extends AbstractSmartyPlugin
|
||||
/**
|
||||
* Process translate function
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $params
|
||||
* @param \Smarty_Internal_Template $smarty
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -242,6 +242,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
if (false === $this->templateExists($realTemplateName) || false === $this->checkTemplate($realTemplateName)) {
|
||||
throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file' => $realTemplateName)));
|
||||
}
|
||||
|
||||
return $this->internalRenderer('file', $realTemplateName, $parameters);
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ class TemplateDefinition
|
||||
}
|
||||
}
|
||||
|
||||
public function getTranslationDomain() {
|
||||
public function getTranslationDomain()
|
||||
{
|
||||
return $this->translationDomainPrefix . strtolower($this->getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class TemplateHelper
|
||||
/**
|
||||
* Return a list of existing templates for a given template type
|
||||
*
|
||||
* @param int $templateType the template type
|
||||
* @param int $templateType the template type
|
||||
* @param string the template base (module or core, default to core).
|
||||
* @return TemplateDefinition[] of \Thelia\Core\Template\TemplateDefinition
|
||||
*/
|
||||
@@ -126,8 +126,7 @@ class TemplateHelper
|
||||
|
||||
$list[] = new TemplateDefinition($file->getFilename(), $templateType);
|
||||
}
|
||||
}
|
||||
catch (\UnexpectedValueException $ex) {
|
||||
} catch (\UnexpectedValueException $ex) {
|
||||
// Ignore the exception and continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ class Thelia extends Kernel
|
||||
$module->getAbsoluteTemplateBasePath()
|
||||
);
|
||||
|
||||
foreach($templates as $template) {
|
||||
foreach ($templates as $template) {
|
||||
$translationDirs[$module->getBackOfficeTemplateTranslationDomain($template->getName())] =
|
||||
$module->getAbsoluteBackOfficeI18nTemplatePath($template->getName());
|
||||
}
|
||||
@@ -229,7 +229,7 @@ class Thelia extends Kernel
|
||||
$module->getAbsoluteTemplateBasePath()
|
||||
);
|
||||
|
||||
foreach($templates as $template) {
|
||||
foreach ($templates as $template) {
|
||||
$translationDirs[$module->getFrontOfficeTemplateTranslationDomain($template->getName())] =
|
||||
$module->getAbsoluteFrontOfficeI18nTemplatePath($template->getName());
|
||||
}
|
||||
@@ -279,8 +279,7 @@ class Thelia extends Kernel
|
||||
|
||||
$translator->addMethodCall('addResource', array($format, (string) $file, $locale, $domain));
|
||||
}
|
||||
}
|
||||
catch (\InvalidArgumentException $ex) {
|
||||
} catch (\InvalidArgumentException $ex) {
|
||||
// Ignore missing I18n directories
|
||||
Tlog::getInstance()->addWarning("loadTranslation: missing $dir directory");
|
||||
}
|
||||
|
||||
@@ -16,17 +16,18 @@ class Module extends BaseModule
|
||||
|
||||
const ADMIN_INCLUDES_DIRECTORY_NAME = "AdminIncludes";
|
||||
|
||||
|
||||
public function postSave(ConnectionInterface $con = null)
|
||||
{
|
||||
ModuleQuery::resetActivated();
|
||||
}
|
||||
|
||||
public function getTranslationDomain() {
|
||||
public function getTranslationDomain()
|
||||
{
|
||||
return strtolower($this->getCode());
|
||||
}
|
||||
|
||||
public function getAdminIncludesTranslationDomain() {
|
||||
public function getAdminIncludesTranslationDomain()
|
||||
{
|
||||
return $this->getTranslationDomain().'.ai';
|
||||
}
|
||||
|
||||
@@ -48,7 +49,8 @@ class Module extends BaseModule
|
||||
);
|
||||
}
|
||||
|
||||
public function getBackOfficeTemplateTranslationDomain($templateName) {
|
||||
public function getBackOfficeTemplateTranslationDomain($templateName)
|
||||
{
|
||||
return $this->getTranslationDomain(). '.bo.' . $templateName;
|
||||
}
|
||||
|
||||
@@ -70,7 +72,8 @@ class Module extends BaseModule
|
||||
);
|
||||
}
|
||||
|
||||
public function getFrontOfficeTemplateTranslationDomain($templateName) {
|
||||
public function getFrontOfficeTemplateTranslationDomain($templateName)
|
||||
{
|
||||
return $this->getTranslationDomain(). '.fo.' . $templateName;
|
||||
}
|
||||
|
||||
@@ -151,7 +154,7 @@ class Module extends BaseModule
|
||||
/**
|
||||
* Return the absolute path to one of the module's template directories
|
||||
*
|
||||
* @param int $templateSubdirName the name of the, probably one of TemplateDefinition::xxx_SUBDIR constants
|
||||
* @param int $templateSubdirName the name of the, probably one of TemplateDefinition::xxx_SUBDIR constants
|
||||
* @return string a path
|
||||
*/
|
||||
public function getAbsoluteTemplateDirectoryPath($templateSubdirName)
|
||||
|
||||
@@ -159,7 +159,7 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
|
||||
* Sets a module titles for various languages
|
||||
*
|
||||
* @param Module $module the module.
|
||||
* @param array $titles an associative array of locale => title_string
|
||||
* @param array $titles an associative array of locale => title_string
|
||||
*/
|
||||
public function setTitle(Module $module, $titles)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ interface DeliveryModuleInterface extends BaseModuleInterface
|
||||
*
|
||||
* @param Country $country the country to deliver to.
|
||||
*
|
||||
* @return float the delivery price
|
||||
* @return float the delivery price
|
||||
* @throws DeliveryException if the postage price cannot be calculated.
|
||||
*/
|
||||
public function getPostage(Country $country);
|
||||
|
||||
Reference in New Issue
Block a user