Merge branch 'cleanmaster' into modules

This commit is contained in:
Etienne Roudeix
2013-12-10 15:57:37 +01:00
31 changed files with 1238 additions and 350 deletions

View File

@@ -107,7 +107,7 @@ final class TheliaEvents
/**
* sent just before customer removal
*/
const BEFORE_DELETECUSTOMER = "action.before_updateCustomer";
const BEFORE_DELETECUSTOMER = "action.before_deleteCustomer";
/**
* sent just after customer removal
@@ -121,7 +121,7 @@ final class TheliaEvents
const ADDRESS_CREATE = "action.createAddress";
/**
* sent for address creation
* sent for address modification
*/
const ADDRESS_UPDATE = "action.updateAddress";
@@ -135,7 +135,14 @@ final class TheliaEvents
*/
const ADDRESS_DEFAULT = "action.defaultAddress";
/**
* sent once the address creation form has been successfully validated, and before address insertion in the database.
*/
const BEFORE_CREATEADDRESS = "action.before_createAddress";
/**
* Sent just after a successful insert of a new address in the database.
*/
const AFTER_CREATEADDRESS = "action.after_createAddress";
const BEFORE_UPDATEADDRESS = "action.before_updateAddress";

View File

@@ -23,12 +23,28 @@
namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Model\ModuleQuery;
class Module extends AbstractSmartyPlugin
{
/**
* @var bool application debug mode
*/
protected $debug;
/**
* @var Request $request
*/
protected $request;
public function __construct($debug, Request $request)
{
$this->debug = $debug;
$this->request = $request;
}
/**
* Process theliaModule template inclusion function
*
@@ -44,6 +60,10 @@ class Module extends AbstractSmartyPlugin
if (false !== $location = $this->getParam($params, 'location', false)) {
if($this->debug === true && $this->request->get('SHOW_INCLUDE')) {
echo sprintf('<div style="background-color: #C82D26; border-color: #000000; border: solid;">%s</div>', $location);
}
$moduleLimit = $this->getParam($params, 'module', null);
$modules = ModuleQuery::getActivated();

View File

@@ -240,20 +240,18 @@ class TemplateHelper
fwrite($fp, '<' . "?php\n\n");
fwrite($fp, "return array(\n");
$idx = 0;
// Sort keys alphabetically while keeping index
asort($texts);
foreach($texts as $text)
{
foreach ($texts as $key => $text) {
// Write only defined (not empty) translations
if (! empty($translations[$idx])) {
if (! empty($translations[$key])) {
$text = str_replace("'", "\'", $text);
$translation = str_replace("'", "\'", $translations[$idx]);
$translation = str_replace("'", "\'", $translations[$key]);
fwrite($fp, sprintf("\t'%s' => '%s',\n", $text, $translation));
fwrite($fp, sprintf(" '%s' => '%s',\n", $text, $translation));
}
$idx++;
}
fwrite($fp, ");\n");