update
This commit is contained in:
150
config/bootstrap.php
Normal file
150
config/bootstrap.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* 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.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* 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 https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
use PrestaShop\PrestaShop\Adapter\ServiceLocator;
|
||||
use PrestaShop\PrestaShop\Core\ContainerBuilder;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
$container_builder = new ContainerBuilder();
|
||||
$legacyContainer = $container_builder->build();
|
||||
ServiceLocator::setServiceContainerInstance($legacyContainer);
|
||||
|
||||
if (!file_exists(_PS_CACHE_DIR_)) {
|
||||
@mkdir(_PS_CACHE_DIR_);
|
||||
$warmer = new CacheWarmerAggregate([
|
||||
new PrestaShopBundle\Cache\LocalizationWarmer(_PS_VERSION_, 'en'), //@replace hard-coded Lang
|
||||
]);
|
||||
$warmer->warmUp(_PS_CACHE_DIR_);
|
||||
}
|
||||
|
||||
$configDirectory = __DIR__. '/../app/config';
|
||||
$phpParametersFilepath = $configDirectory . '/parameters.php';
|
||||
$yamlParametersFilepath = $configDirectory . '/parameters.yml';
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
$exportPhpConfigFile = function ($config, $destination) use ($filesystem) {
|
||||
try {
|
||||
$filesystem->dumpFile($destination, '<?php return '.var_export($config, true).';'."\n");
|
||||
} catch (IOException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
// Bootstrap an application with parameters.yml, which has been installed before PHP parameters file support
|
||||
if (!file_exists($phpParametersFilepath) && file_exists($yamlParametersFilepath)) {
|
||||
$parameters = Yaml::parseFile($yamlParametersFilepath);
|
||||
if ($exportPhpConfigFile($parameters, $phpParametersFilepath)) {
|
||||
$filesystem->dumpFile($yamlParametersFilepath, 'parameters:' . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
$lastParametersModificationTime = (int)@filemtime($phpParametersFilepath);
|
||||
|
||||
if ($lastParametersModificationTime) {
|
||||
$cachedParameters = _PS_CACHE_DIR_. 'appParameters.php';
|
||||
|
||||
$lastParametersCacheModificationTime = (int)@filemtime($cachedParameters);
|
||||
if (!$lastParametersCacheModificationTime || $lastParametersCacheModificationTime < $lastParametersModificationTime) {
|
||||
// When parameters file is available, update its cache if it is stale.
|
||||
if (file_exists($phpParametersFilepath)) {
|
||||
$config = require $phpParametersFilepath;
|
||||
$exportPhpConfigFile($config, $cachedParameters);
|
||||
} elseif (file_exists($yamlParametersFilepath)) {
|
||||
$config = Yaml::parseFile($yamlParametersFilepath);
|
||||
$exportPhpConfigFile($config, $cachedParameters);
|
||||
}
|
||||
}
|
||||
|
||||
$config = require_once _PS_CACHE_DIR_ . 'appParameters.php';
|
||||
array_walk($config['parameters'], function (&$param) {
|
||||
$param = str_replace('%%', '%', $param);
|
||||
});
|
||||
|
||||
$database_host = $config['parameters']['database_host'];
|
||||
|
||||
if (!empty($config['parameters']['database_port'])) {
|
||||
$database_host .= ':'. $config['parameters']['database_port'];
|
||||
}
|
||||
|
||||
define('_DB_SERVER_', $database_host);
|
||||
if (defined('_PS_IN_TEST_')) {
|
||||
define('_DB_NAME_', 'test_'.$config['parameters']['database_name']);
|
||||
} else {
|
||||
define('_DB_NAME_', $config['parameters']['database_name']);
|
||||
}
|
||||
|
||||
define('_DB_USER_', $config['parameters']['database_user']);
|
||||
define('_DB_PASSWD_', $config['parameters']['database_password']);
|
||||
define('_DB_PREFIX_', $config['parameters']['database_prefix']);
|
||||
define('_MYSQL_ENGINE_', $config['parameters']['database_engine']);
|
||||
define('_PS_CACHING_SYSTEM_', $config['parameters']['ps_caching']);
|
||||
|
||||
if (!defined('PS_IN_UPGRADE') && !defined('_PS_IN_TEST_')) {
|
||||
define('_PS_CACHE_ENABLED_', $config['parameters']['ps_cache_enable']);
|
||||
} else {
|
||||
define('_PS_CACHE_ENABLED_', 0);
|
||||
$config['parameters']['ps_cache_enable'] = 0;
|
||||
}
|
||||
|
||||
// Legacy cookie
|
||||
if (array_key_exists('cookie_key', $config['parameters'])) {
|
||||
define('_COOKIE_KEY_', $config['parameters']['cookie_key']);
|
||||
} else {
|
||||
// Define cookie key if missing to prevent failure in composer post-install script
|
||||
define('_COOKIE_KEY_', Tools::passwdGen(56));
|
||||
}
|
||||
|
||||
if (array_key_exists('cookie_iv', $config['parameters'])) {
|
||||
define('_COOKIE_IV_', $config['parameters']['cookie_iv']);
|
||||
} else {
|
||||
// Define cookie IV if missing to prevent failure in composer post-install script
|
||||
define('_COOKIE_IV_', Tools::passwdGen(32));
|
||||
}
|
||||
|
||||
// New cookie
|
||||
if (array_key_exists('new_cookie_key', $config['parameters'])) {
|
||||
define('_NEW_COOKIE_KEY_', $config['parameters']['new_cookie_key']);
|
||||
} else {
|
||||
// Define cookie key if missing to prevent failure in composer post-install script
|
||||
$key = PhpEncryption::createNewRandomKey();
|
||||
define('_NEW_COOKIE_KEY_', $key);
|
||||
}
|
||||
|
||||
define('_PS_CREATION_DATE_', $config['parameters']['ps_creation_date']);
|
||||
|
||||
if (isset($config['parameters']['_rijndael_key'], $config['parameters']['_rijndael_iv'])) {
|
||||
define('_RIJNDAEL_KEY_', $config['parameters']['_rijndael_key']);
|
||||
define('_RIJNDAEL_IV_', $config['parameters']['_rijndael_iv']);
|
||||
}
|
||||
} elseif (file_exists(_PS_ROOT_DIR_.'/config/settings.inc.php')) {
|
||||
require_once _PS_ROOT_DIR_.'/config/settings.inc.php';
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2018 PrestaShop
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* 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.
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
@@ -16,12 +17,11 @@
|
||||
*
|
||||
* 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.
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2018 PrestaShop SA
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/* Debug only */
|
||||
@@ -34,16 +34,30 @@ if (!defined('_PS_MODE_DEV_')) {
|
||||
/* Compatibility warning */
|
||||
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
|
||||
if (_PS_MODE_DEV_ === true) {
|
||||
$errorReportingLevel = E_ALL | E_STRICT;
|
||||
if (_PS_DISPLAY_COMPATIBILITY_WARNING_ === false) {
|
||||
$errorReportingLevel = $errorReportingLevel & ~E_DEPRECATED & ~E_USER_DEPRECATED;
|
||||
}
|
||||
@ini_set('display_errors', 'on');
|
||||
@error_reporting(E_ALL | E_STRICT);
|
||||
error_reporting( E_ALL & ~E_NOTICE & ~E_DEPRECATED );
|
||||
define('_PS_DEBUG_SQL_', true);
|
||||
} else {
|
||||
@ini_set('display_errors', 'off');
|
||||
define('_PS_DEBUG_SQL_', false);
|
||||
}
|
||||
|
||||
define('_PS_DEBUG_PROFILING_', false);
|
||||
define('_PS_MODE_DEMO_', false);
|
||||
if (!defined('_PS_DEBUG_PROFILING_')) {
|
||||
define('_PS_DEBUG_PROFILING_', false);
|
||||
}
|
||||
if (!defined('_PS_MODE_DEMO_')) {
|
||||
define('_PS_MODE_DEMO_', false);
|
||||
}
|
||||
if (!defined('_PS_SMARTY_CACHING_TYPE_')) {
|
||||
define('_PS_SMARTY_CACHING_TYPE_', 'filesystem');
|
||||
}
|
||||
if (!defined('_PS_ALLOW_MULTI_STATEMENTS_QUERIES_')) {
|
||||
define('_PS_ALLOW_MULTI_STATEMENTS_QUERIES_', false);
|
||||
}
|
||||
|
||||
$currentDir = dirname(__FILE__);
|
||||
|
||||
@@ -69,15 +83,35 @@ define('_PS_ALL_THEMES_DIR_', _PS_ROOT_DIR_.'/themes/');
|
||||
if (defined('_PS_ADMIN_DIR_')) {
|
||||
define('_PS_BO_ALL_THEMES_DIR_', _PS_ADMIN_DIR_.'/themes/');
|
||||
}
|
||||
if (!defined('_PS_CACHE_DIR_')) {
|
||||
$prestashopCacheDir = _PS_ROOT_DIR_.'/var/cache/'.(_PS_MODE_DEV_ ? 'dev': 'prod'). DIRECTORY_SEPARATOR;
|
||||
define('_PS_CACHE_DIR_',$prestashopCacheDir);
|
||||
|
||||
// Find if we are running under a Symfony command
|
||||
$cliEnvValue = null;
|
||||
if (isset($argv) && is_array($argv)) {
|
||||
if (in_array('--env', $argv)) {
|
||||
$cliEnvValue = $argv[array_search('--env', $argv) + 1];
|
||||
} elseif (in_array('-e', $argv)) {
|
||||
$cliEnvValue = $argv[array_search('-e', $argv) + 1];
|
||||
}
|
||||
}
|
||||
|
||||
if ((defined('_PS_IN_TEST_') && _PS_IN_TEST_)
|
||||
|| $cliEnvValue === 'test'
|
||||
) {
|
||||
define('_PS_ENV_', 'test');
|
||||
} else {
|
||||
define('_PS_ENV_', _PS_MODE_DEV_ ? 'dev': 'prod');
|
||||
}
|
||||
|
||||
if (!defined('_PS_CACHE_DIR_')) {
|
||||
define('_PS_CACHE_DIR_', _PS_ROOT_DIR_.'/var/cache/' . _PS_ENV_ . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
define('_PS_CONFIG_DIR_', _PS_CORE_DIR_.'/config/');
|
||||
define('_PS_CUSTOM_CONFIG_FILE_', _PS_CONFIG_DIR_.'settings_custom.inc.php');
|
||||
define('_PS_CLASS_DIR_', _PS_CORE_DIR_.'/classes/');
|
||||
if (!defined('_PS_DOWNLOAD_DIR_')) {
|
||||
define('_PS_DOWNLOAD_DIR_', _PS_ROOT_DIR_.'/download/');
|
||||
$dir = (defined('_PS_IN_TEST_') && _PS_IN_TEST_) ? '/tests/Resources/download/' : '/download/';
|
||||
define('_PS_DOWNLOAD_DIR_', _PS_ROOT_DIR_.$dir);
|
||||
}
|
||||
define('_PS_MAIL_DIR_', _PS_CORE_DIR_.'/mails/');
|
||||
if (!defined('_PS_MODULE_DIR_')) {
|
||||
@@ -109,9 +143,12 @@ define('_PS_SWIFT_DIR_', _PS_TOOL_DIR_.'swift/');
|
||||
define('_PS_TAASC_PATH_', _PS_TOOL_DIR_.'taasc/');
|
||||
define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/');
|
||||
|
||||
define('_PS_IMG_SOURCE_DIR_', _PS_ROOT_DIR_.'/img/');
|
||||
if (!defined('_PS_IMG_DIR_')) {
|
||||
define('_PS_IMG_DIR_', _PS_ROOT_DIR_.'/img/');
|
||||
$dir = (defined('_PS_IN_TEST_') && _PS_IN_TEST_) ? '/tests/Resources/img/' : '/img/';
|
||||
define('_PS_IMG_DIR_', _PS_ROOT_DIR_.$dir);
|
||||
}
|
||||
|
||||
if (!defined('_PS_HOST_MODE_')) {
|
||||
define('_PS_CORE_IMG_DIR_', _PS_CORE_DIR_.'/img/');
|
||||
} else {
|
||||
@@ -126,6 +163,7 @@ define('_PS_LANG_IMG_DIR_', _PS_IMG_DIR_.'l/');
|
||||
define('_PS_MANU_IMG_DIR_', _PS_IMG_DIR_.'m/');
|
||||
define('_PS_ORDER_STATE_IMG_DIR_', _PS_IMG_DIR_.'os/');
|
||||
define('_PS_PROD_IMG_DIR_', _PS_IMG_DIR_.'p/');
|
||||
define('_PS_PROFILE_IMG_DIR_', _PS_IMG_DIR_.'pr/');
|
||||
define('_PS_SHIP_IMG_DIR_', _PS_IMG_DIR_.'s/');
|
||||
define('_PS_STORE_IMG_DIR_', _PS_IMG_DIR_.'st/');
|
||||
define('_PS_SUPP_IMG_DIR_', _PS_IMG_DIR_.'su/');
|
||||
@@ -197,7 +235,7 @@ define('_PS_SMARTY_CONSOLE_OPEN_BY_URL_', 1);
|
||||
define('_PS_SMARTY_CONSOLE_OPEN_', 2);
|
||||
|
||||
if (!defined('_PS_JQUERY_VERSION_')) {
|
||||
define('_PS_JQUERY_VERSION_', '1.11.0');
|
||||
define('_PS_JQUERY_VERSION_', '3.4.1');
|
||||
}
|
||||
|
||||
define('_PS_CACHE_CA_CERT_FILE_', _PS_CACHE_DIR_.'cacert.pem');
|
||||
|
||||
197
config/smarty.config.inc.php
Normal file
197
config/smarty.config.inc.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* 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.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* 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 https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
define('_PS_SMARTY_DIR_', _PS_VENDOR_DIR_.'prestashop/smarty/');
|
||||
|
||||
global $smarty;
|
||||
if (Configuration::get('PS_SMARTY_LOCAL')) {
|
||||
$smarty = new SmartyCustom();
|
||||
} elseif (_PS_MODE_DEV_ && !defined('_PS_ADMIN_DIR_')) {
|
||||
$smarty = new SmartyBC();
|
||||
} else {
|
||||
$smarty = new SmartyBC();
|
||||
}
|
||||
|
||||
$smarty->setCompileDir(_PS_CACHE_DIR_.'smarty/compile');
|
||||
$smarty->setCacheDir(_PS_CACHE_DIR_.'smarty/cache');
|
||||
$smarty->use_sub_dirs = true;
|
||||
$smarty->setConfigDir(_PS_SMARTY_DIR_.'configs');
|
||||
$smarty->caching = false;
|
||||
|
||||
if (_PS_SMARTY_CACHING_TYPE_ == 'mysql') {
|
||||
include _PS_CLASS_DIR_.'Smarty/SmartyCacheResourceMysql.php';
|
||||
$smarty->caching_type = 'mysql';
|
||||
}
|
||||
$smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_) ? true : false;
|
||||
$smarty->compile_check = (Configuration::get('PS_SMARTY_FORCE_COMPILE') >= _PS_SMARTY_CHECK_COMPILE_) ? true : false;
|
||||
$smarty->debug_tpl = _PS_ALL_THEMES_DIR_.'debug.tpl';
|
||||
|
||||
/* Use this constant if you want to load smarty without all PrestaShop functions */
|
||||
if (defined('_PS_SMARTY_FAST_LOAD_') && _PS_SMARTY_FAST_LOAD_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined('_PS_ADMIN_DIR_')) {
|
||||
require_once dirname(__FILE__).'/smartyadmin.config.inc.php';
|
||||
} else {
|
||||
require_once dirname(__FILE__).'/smartyfront.config.inc.php';
|
||||
}
|
||||
|
||||
require_once SMARTY_PLUGINS_DIR.'modifier.truncate.php';
|
||||
|
||||
// This escape modifier is required for invoice PDF generation
|
||||
function smartyEscape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
|
||||
{
|
||||
$escapeModifierFile = implode(
|
||||
DIRECTORY_SEPARATOR,
|
||||
array(
|
||||
SMARTY_PLUGINS_DIR,
|
||||
'modifier.escape.php',
|
||||
)
|
||||
);
|
||||
require_once $escapeModifierFile;
|
||||
|
||||
global $smarty;
|
||||
if (($esc_type === 'html' || $esc_type === 'htmlall') && $smarty->escape_html) {
|
||||
return $string;
|
||||
} else {
|
||||
return smarty_modifier_escape($string, $esc_type, $char_set, $double_encode);
|
||||
}
|
||||
}
|
||||
|
||||
smartyRegisterFunction($smarty, 'modifier', 'escape', 'smartyEscape');
|
||||
smartyRegisterFunction($smarty, 'modifier', 'truncate', 'smarty_modifier_truncate');
|
||||
smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate', false);
|
||||
smartyRegisterFunction($smarty, 'function', 'hook', 'smartyHook');
|
||||
smartyRegisterFunction($smarty, 'modifier', 'json_encode', array('Tools', 'jsonEncode'));
|
||||
smartyRegisterFunction($smarty, 'modifier', 'json_decode', array('Tools', 'jsonDecode'));
|
||||
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
|
||||
smartyRegisterFunction($smarty, 'modifier', 'boolval', array('Tools', 'boolval'));
|
||||
smartyRegisterFunction($smarty, 'modifier', 'cleanHtml', 'smartyCleanHtml');
|
||||
smartyRegisterFunction($smarty, 'modifier', 'classname', 'smartyClassname');
|
||||
smartyRegisterFunction($smarty, 'modifier', 'classnames', 'smartyClassnames');
|
||||
smartyRegisterFunction($smarty, 'function', 'url', array('Link', 'getUrlSmarty'));
|
||||
|
||||
function smarty_modifier_htmlentitiesUTF8($string)
|
||||
{
|
||||
return Tools::htmlentitiesUTF8($string);
|
||||
}
|
||||
|
||||
function smartyRegisterFunction($smarty, $type, $function, $params, $lazy = true, $initial_lazy_register = null)
|
||||
{
|
||||
if (!in_array($type, array('function', 'modifier', 'block'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// lazy is better if the function is not called on every page
|
||||
if ($lazy) {
|
||||
if (null !== $initial_lazy_register && $initial_lazy_register->isRegistered($params)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$lazy_register = SmartyLazyRegister::getInstance($smarty);
|
||||
if ($lazy_register->isRegistered($params)) {
|
||||
return;
|
||||
}
|
||||
$lazy_register->register($params);
|
||||
|
||||
if (is_array($params)) {
|
||||
$params = $params[1];
|
||||
}
|
||||
|
||||
// SmartyLazyRegister allows to only load external class when they are needed
|
||||
$smarty->registerPlugin($type, $function, array($lazy_register, $params));
|
||||
} else {
|
||||
$smarty->registerPlugin($type, $function, $params);
|
||||
}
|
||||
}
|
||||
|
||||
function smartyHook($params, &$smarty)
|
||||
{
|
||||
$id_module = null;
|
||||
$hook_params = $params;
|
||||
$hook_params['smarty'] = $smarty;
|
||||
if (!empty($params['mod'])) {
|
||||
$module = Module::getInstanceByName($params['mod']);
|
||||
unset($hook_params['mod']);
|
||||
if ($module && $module->id) {
|
||||
$id_module = $module->id;
|
||||
} else {
|
||||
unset($hook_params['h']);
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
if (!empty($params['excl'])) {
|
||||
$result = '';
|
||||
$modules = Hook::getHookModuleExecList($hook_params['h']);
|
||||
|
||||
$moduleexcl = explode(',', $params['excl']);
|
||||
foreach ($modules as $module) {
|
||||
if (!in_array($module['module'], $moduleexcl)) {
|
||||
$result .= Hook::exec($params['h'], $hook_params, $module['id_module']);
|
||||
}
|
||||
}
|
||||
|
||||
unset(
|
||||
$hook_params['h'],
|
||||
$hook_params['excl']
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
unset($hook_params['h']);
|
||||
|
||||
return Hook::exec($params['h'], $hook_params, $id_module);
|
||||
}
|
||||
|
||||
function smartyCleanHtml($data)
|
||||
{
|
||||
// Prevent xss injection.
|
||||
if (Validate::isCleanHtml($data)) {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
function smartyClassname($classname)
|
||||
{
|
||||
$classname = Tools::replaceAccentedChars(strtolower($classname));
|
||||
$classname = preg_replace('/[^A-Za-z0-9]/', '-', $classname);
|
||||
$classname = preg_replace('/[-]+/', '-', $classname);
|
||||
|
||||
return $classname;
|
||||
}
|
||||
|
||||
function smartyClassnames(array $classnames)
|
||||
{
|
||||
$enabled_classes = array();
|
||||
foreach ($classnames as $classname => $enabled) {
|
||||
if ($enabled) {
|
||||
$enabled_classes[] = smartyClassname($classname);
|
||||
}
|
||||
}
|
||||
|
||||
return implode(' ', $enabled_classes);
|
||||
}
|
||||
Reference in New Issue
Block a user