[*] classes : new module architecture

This commit is contained in:
rMalie
2012-01-31 16:57:19 +00:00
parent 62f105ae6e
commit 4f7b3d4550
71 changed files with 815 additions and 622 deletions
@@ -448,7 +448,7 @@ class AdminTranslationsControllerCore extends AdminController
$is_default = $theme_name === self::DEFAULT_THEME_NAME ? true : false;
if (!$dir)
$dir = ($theme_name === self::DEFAULT_THEME_NAME ? _PS_MODULE_DIR_.$module_name.'/' : _PS_ALL_THEMES_DIR_.$theme_name.'/modules/'.$module_name.'/');
$dir = ($is_default ? _PS_MODULE_DIR_.$module_name.'/' : _PS_ALL_THEMES_DIR_.$theme_name.'/modules/'.$module_name.'/');
// Thank to this var similar keys are not duplicate
// in AndminTranslation::modules_translations array
@@ -1665,9 +1665,13 @@ class AdminTranslationsControllerCore extends AdminController
{
if ($module{0} != '.' && is_dir($root_dir.$module))
{
@include($root_dir.$module.'/'.$lang.'.php');
if (file_exists($root_dir.$module.'/translations/'.$lang.'.php'))
$lang_file = $root_dir.$module.'/translations/'.$lang.'.php';
else
$lang_file = $root_dir.$module.'/'.$lang.'.php';
@include($lang_file);
AdminTranslationsController::getModuleTranslations($is_default);
$this->recursiveGetModuleFiles($root_dir.$module.'/', $array_files, $module, $root_dir.$module.'/'.$lang.'.php', $is_default);
$this->recursiveGetModuleFiles($root_dir.$module.'/', $array_files, $module, $lang_file, $is_default);
}
}
return $array_files;
-57
View File
@@ -1,57 +0,0 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* @since 1.5.0
*/
class ModuleControllerCore extends FrontController
{
/**
* @var Module
*/
public $module;
public function __construct()
{
$this->module = Module::getInstanceByName(Tools::getValue('module'));
if (!$this->module->active)
Tools::redirect('index');
$this->process = Tools::getValue('process');
parent::__construct();
}
/**
* Assign module template
*
* @param string $template
*/
public function setTemplate($template)
{
$this->template = $this->module->getTemplatePath($template);
}
}