// missing static keyword
This commit is contained in:
1 parent
90fcde2539
commit
4c5104462f
1 file changed
+60
-60
+60
-60
@@ -44,7 +44,7 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
/** @var string author of the module */
|
/** @var string author of the module */
|
||||||
public $author;
|
public $author;
|
||||||
|
|
||||||
/** @var int need_instance */
|
/** @var int need_instance */
|
||||||
public $need_instance = 1;
|
public $need_instance = 1;
|
||||||
|
|
||||||
@@ -79,13 +79,13 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
protected static $modulesCache;
|
protected static $modulesCache;
|
||||||
protected static $_hookModulesCache;
|
protected static $_hookModulesCache;
|
||||||
|
|
||||||
protected static $_INSTANCE = array();
|
protected static $_INSTANCE = array();
|
||||||
|
|
||||||
protected static $_generateConfigXmlMode = false;
|
protected static $_generateConfigXmlMode = false;
|
||||||
|
|
||||||
protected static $l_cache = array();
|
protected static $l_cache = array();
|
||||||
|
|
||||||
protected static $cache_permissions = array();
|
protected static $cache_permissions = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,14 +158,14 @@ abstract class ModuleCore
|
|||||||
WHERE `name` = \''.pSQL($this->name).'\'');
|
WHERE `name` = \''.pSQL($this->name).'\'');
|
||||||
if ($result)
|
if ($result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$result = Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table, array('name' => $this->name, 'active' => 1), 'INSERT');
|
$result = Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table, array('name' => $this->name, 'active' => 1), 'INSERT');
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
$this->id = Db::getInstance()->Insert_ID();
|
$this->id = Db::getInstance()->Insert_ID();
|
||||||
|
|
||||||
$this->enable(true);
|
$this->enable(true);
|
||||||
|
|
||||||
// Permissions management
|
// Permissions management
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||||
@@ -208,7 +208,7 @@ abstract class ModuleCore
|
|||||||
$this->cleanPositions($row['id_hook']);
|
$this->cleanPositions($row['id_hook']);
|
||||||
}
|
}
|
||||||
$this->disable(true);
|
$this->disable(true);
|
||||||
|
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_module` = '.(int)$this->id);
|
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_module` = '.(int)$this->id);
|
||||||
|
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->Execute('
|
||||||
@@ -217,14 +217,14 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function enable module $name. If an $name is an array,
|
* This function enable module $name. If an $name is an array,
|
||||||
* this will enable all of them
|
* this will enable all of them
|
||||||
*
|
*
|
||||||
* @param array|string $name
|
* @param array|string $name
|
||||||
* @return true if succeed
|
* @return true if succeed
|
||||||
* @since 1.4.1
|
* @since 1.4.1
|
||||||
*/
|
*/
|
||||||
public static function enableByName($name)
|
public static function enableByName($name)
|
||||||
{
|
{
|
||||||
if (!is_array($name))
|
if (!is_array($name))
|
||||||
$name = array($name);
|
$name = array($name);
|
||||||
@@ -235,7 +235,7 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate current module.
|
* Activate current module.
|
||||||
*
|
*
|
||||||
* @param bool $forceAll If true, enable module for all shop
|
* @param bool $forceAll If true, enable module for all shop
|
||||||
*/
|
*/
|
||||||
public function enable($forceAll = false)
|
public function enable($forceAll = false)
|
||||||
@@ -256,37 +256,37 @@ abstract class ModuleCore
|
|||||||
'id_module' => $this->id,
|
'id_module' => $this->id,
|
||||||
'id_shop' => $id,
|
'id_shop' => $id,
|
||||||
), 'INSERT');
|
), 'INSERT');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function disable module $name. If an $name is an array,
|
* This function disable module $name. If an $name is an array,
|
||||||
* this will disable all of them
|
* this will disable all of them
|
||||||
*
|
*
|
||||||
* @param array|string $name
|
* @param array|string $name
|
||||||
* @return true if succeed
|
* @return true if succeed
|
||||||
* @since 1.4.1
|
* @since 1.4.1
|
||||||
*/
|
*/
|
||||||
public static function disableByName($name)
|
public static function disableByName($name)
|
||||||
{
|
{
|
||||||
if (!is_array($name))
|
if (!is_array($name))
|
||||||
$name = array($name);
|
$name = array($name);
|
||||||
|
|
||||||
foreach ($name as $k => $v)
|
foreach ($name as $k => $v)
|
||||||
Module::getInstanceByName($name)->disable();
|
Module::getInstanceByName($name)->disable();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desactivate current module.
|
* Desactivate current module.
|
||||||
*
|
*
|
||||||
* @param bool $forceAll If true, disable module for all shop
|
* @param bool $forceAll If true, disable module for all shop
|
||||||
*/
|
*/
|
||||||
public function disable($forceAll = false)
|
public function disable($forceAll = false)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'module_shop
|
$sql = 'DELETE FROM '._DB_PREFIX_.'module_shop
|
||||||
WHERE id_module = '.$this->id.'
|
WHERE id_module = '.$this->id.'
|
||||||
'.((!$forceAll) ? ' AND id_shop IN('.implode(', ', $this->context->shop->getListOfID()).')' : '');
|
'.((!$forceAll) ? ' AND id_shop IN('.implode(', ', $this->context->shop->getListOfID()).')' : '');
|
||||||
Db::getInstance()->execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
@@ -341,7 +341,7 @@ abstract class ModuleCore
|
|||||||
$hookID = Db::getInstance()->getValue($sql);
|
$hookID = Db::getInstance()->getValue($sql);
|
||||||
if (!$hookID)
|
if (!$hookID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (is_null($shopList))
|
if (is_null($shopList))
|
||||||
$shopList = Shop::getShops(true, null, true);
|
$shopList = Shop::getShops(true, null, true);
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ abstract class ModuleCore
|
|||||||
AND id_shop = '.$shopID;
|
AND id_shop = '.$shopID;
|
||||||
if (Db::getInstance()->getRow($sql))
|
if (Db::getInstance()->getRow($sql))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Get module position in hook
|
// Get module position in hook
|
||||||
$sql = 'SELECT MAX(`position`) AS position
|
$sql = 'SELECT MAX(`position`) AS position
|
||||||
FROM `'._DB_PREFIX_.'hook_module`
|
FROM `'._DB_PREFIX_.'hook_module`
|
||||||
@@ -365,7 +365,7 @@ abstract class ModuleCore
|
|||||||
.' AND id_shop = '.$shopID;
|
.' AND id_shop = '.$shopID;
|
||||||
if (!$position = Db::getInstance()->getValue($sql))
|
if (!$position = Db::getInstance()->getValue($sql))
|
||||||
$position = 0;
|
$position = 0;
|
||||||
|
|
||||||
// Register module in hook
|
// Register module in hook
|
||||||
$result = Db::getInstance()->autoExecute(_DB_PREFIX_.'hook_module', array(
|
$result = Db::getInstance()->autoExecute(_DB_PREFIX_.'hook_module', array(
|
||||||
'id_module' => $this->id,
|
'id_module' => $this->id,
|
||||||
@@ -376,7 +376,7 @@ abstract class ModuleCore
|
|||||||
if (!$result)
|
if (!$result)
|
||||||
$return &= false;
|
$return &= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cleanPositions($hookID, $shopList);
|
$this->cleanPositions($hookID, $shopList);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
if (!$except)
|
if (!$except)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$result = Db::getInstance()->autoExecute(_DB_PREFIX_.'hook_module_exceptions', array(
|
$result = Db::getInstance()->autoExecute(_DB_PREFIX_.'hook_module_exceptions', array(
|
||||||
'id_module' => $this->id,
|
'id_module' => $this->id,
|
||||||
'id_hook' => (int)$id_hook,
|
'id_hook' => (int)$id_hook,
|
||||||
@@ -468,17 +468,17 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to determine the module name
|
* This function is used to determine the module name
|
||||||
* of an AdminTab which belongs to a module, in order to keep translation
|
* of an AdminTab which belongs to a module, in order to keep translation
|
||||||
* related to a module in its directory (instead of $_LANGADM)
|
* related to a module in its directory (instead of $_LANGADM)
|
||||||
*
|
*
|
||||||
* @param mixed $currentClass the
|
* @param mixed $currentClass the
|
||||||
* @return boolean|string if the class belongs to a module, will return the module name. Otherwise, return false.
|
* @return boolean|string if the class belongs to a module, will return the module name. Otherwise, return false.
|
||||||
*/
|
*/
|
||||||
public static function getModuleNameFromClass($currentClass)
|
public static function getModuleNameFromClass($currentClass)
|
||||||
{
|
{
|
||||||
global $cookie;
|
global $cookie;
|
||||||
|
|
||||||
// Module can now define AdminTab keeping the module translations method,
|
// Module can now define AdminTab keeping the module translations method,
|
||||||
// i.e. in modules/[module name]/[iso_code].php
|
// i.e. in modules/[module name]/[iso_code].php
|
||||||
if (!isset(self::$classInModule[$currentClass]))
|
if (!isset(self::$classInModule[$currentClass]))
|
||||||
@@ -495,7 +495,7 @@ abstract class ModuleCore
|
|||||||
if (Tools::file_exists_cache($file) AND include_once($file))
|
if (Tools::file_exists_cache($file) AND include_once($file))
|
||||||
$_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
|
$_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
self::$classInModule[$currentClass] = false;
|
self::$classInModule[$currentClass] = false;
|
||||||
}
|
}
|
||||||
// return name of the module, or false
|
// return name of the module, or false
|
||||||
@@ -530,7 +530,7 @@ abstract class ModuleCore
|
|||||||
static public function getInstanceById($moduleID)
|
static public function getInstanceById($moduleID)
|
||||||
{
|
{
|
||||||
static $id2name = null;
|
static $id2name = null;
|
||||||
|
|
||||||
if (is_null($id2name))
|
if (is_null($id2name))
|
||||||
{
|
{
|
||||||
$id2name = array();
|
$id2name = array();
|
||||||
@@ -540,7 +540,7 @@ abstract class ModuleCore
|
|||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
$id2name[$row['id_module']] = $row['name'];
|
$id2name[$row['id_module']] = $row['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($id2name[$moduleID]))
|
if (isset($id2name[$moduleID]))
|
||||||
return Module::getInstanceByName($id2name[$moduleID]);
|
return Module::getInstanceByName($id2name[$moduleID]);
|
||||||
return false;
|
return false;
|
||||||
@@ -636,7 +636,7 @@ abstract class ModuleCore
|
|||||||
// Get modules information from database
|
// Get modules information from database
|
||||||
if (!empty($moduleNameList))
|
if (!empty($moduleNameList))
|
||||||
{
|
{
|
||||||
$list = Context::getContext()->shop->getListOfID();
|
$list = Context::getContext()->shop->getListOfID();
|
||||||
|
|
||||||
$sql = 'SELECT m.id_module, m.name, (
|
$sql = 'SELECT m.id_module, m.name, (
|
||||||
SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE m.id_module = ms.id_module AND ms.id_shop IN ('.implode(',', $list).')
|
SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE m.id_module = ms.id_module AND ms.id_shop IN ('.implode(',', $list).')
|
||||||
@@ -761,7 +761,7 @@ abstract class ModuleCore
|
|||||||
ORDER BY hm.`position`';
|
ORDER BY hm.`position`';
|
||||||
$result = $db->ExecuteS($sql, false);
|
$result = $db->ExecuteS($sql, false);
|
||||||
self::$_hookModulesCache = array();
|
self::$_hookModulesCache = array();
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
while ($row = $db->nextRow())
|
while ($row = $db->nextRow())
|
||||||
{
|
{
|
||||||
@@ -799,7 +799,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
$live_edit = true;
|
$live_edit = true;
|
||||||
$output .= '<script type="text/javascript"> modules_list.push(\''.$moduleInstance->name.'\');</script>
|
$output .= '<script type="text/javascript"> modules_list.push(\''.$moduleInstance->name.'\');</script>
|
||||||
<div id="hook_'.$array['id_hook'].'_module_'.$moduleInstance->id.'_moduleName_'.$moduleInstance->name.'"
|
<div id="hook_'.$array['id_hook'].'_module_'.$moduleInstance->id.'_moduleName_'.$moduleInstance->name.'"
|
||||||
class="dndModule" style="border: 1px dotted red;'.(!strlen($display) ? 'height:50px;' : '').'">
|
class="dndModule" style="border: 1px dotted red;'.(!strlen($display) ? 'height:50px;' : '').'">
|
||||||
<span><img src="'.$moduleInstance->_path.'/logo.gif">'
|
<span><img src="'.$moduleInstance->_path.'/logo.gif">'
|
||||||
.$moduleInstance->displayName.'<span style="float:right">
|
.$moduleInstance->displayName.'<span style="float:right">
|
||||||
@@ -832,7 +832,7 @@ abstract class ModuleCore
|
|||||||
$output .= call_user_func(array($moduleInstance, 'hookpayment'), $hookArgs);
|
$output .= call_user_func(array($moduleInstance, 'hookpayment'), $hookArgs);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPaymentModules()
|
public static function getPaymentModules()
|
||||||
{
|
{
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
@@ -856,14 +856,14 @@ abstract class ModuleCore
|
|||||||
GROUP BY hm.id_hook, hm.id_module
|
GROUP BY hm.id_hook, hm.id_module
|
||||||
ORDER BY hm.`position`, m.`name` DESC';
|
ORDER BY hm.`position`, m.`name` DESC';
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find translation from $_MODULES and put it in self::$l_cache if not already exist
|
* find translation from $_MODULES and put it in self::$l_cache if not already exist
|
||||||
* and return it.
|
* and return it.
|
||||||
*
|
*
|
||||||
* @param string $name name of the module
|
* @param string $name name of the module
|
||||||
* @param string $string term to find
|
* @param string $string term to find
|
||||||
* @param string $source additional param for building translation key
|
* @param string $source additional param for building translation key
|
||||||
@@ -872,9 +872,9 @@ abstract class ModuleCore
|
|||||||
public static function findTranslation($name, $string, $source)
|
public static function findTranslation($name, $string, $source)
|
||||||
{
|
{
|
||||||
global $_MODULES;
|
global $_MODULES;
|
||||||
|
|
||||||
$cache_key = $name . '|' . $string . '|' . $source;
|
$cache_key = $name . '|' . $string . '|' . $source;
|
||||||
|
|
||||||
if (!isset(self::$l_cache[$cache_key]))
|
if (!isset(self::$l_cache[$cache_key]))
|
||||||
{
|
{
|
||||||
if (!is_array($_MODULES))
|
if (!is_array($_MODULES))
|
||||||
@@ -883,7 +883,7 @@ abstract class ModuleCore
|
|||||||
$_MODULES = array_change_key_case($_MODULES);
|
$_MODULES = array_change_key_case($_MODULES);
|
||||||
$currentKey = '<{'.strtolower($name).'}'.strtolower(_THEME_NAME_).'>'.strtolower($source).'_'.md5($string);
|
$currentKey = '<{'.strtolower($name).'}'.strtolower(_THEME_NAME_).'>'.strtolower($source).'_'.md5($string);
|
||||||
$defaultKey = '<{'.strtolower($name).'}prestashop>'.strtolower($source).'_'.md5($string);
|
$defaultKey = '<{'.strtolower($name).'}prestashop>'.strtolower($source).'_'.md5($string);
|
||||||
|
|
||||||
if (isset($_MODULES[$currentKey]))
|
if (isset($_MODULES[$currentKey]))
|
||||||
$ret = stripslashes($_MODULES[$currentKey]);
|
$ret = stripslashes($_MODULES[$currentKey]);
|
||||||
elseif (isset($_MODULES[Tools::strtolower($currentKey)]))
|
elseif (isset($_MODULES[Tools::strtolower($currentKey)]))
|
||||||
@@ -894,16 +894,16 @@ abstract class ModuleCore
|
|||||||
$ret = stripslashes($_MODULES[Tools::strtolower($defaultKey)]);
|
$ret = stripslashes($_MODULES[Tools::strtolower($defaultKey)]);
|
||||||
else
|
else
|
||||||
$ret = stripslashes($string);
|
$ret = stripslashes($string);
|
||||||
|
|
||||||
self::$l_cache[$cache_key] = str_replace('"', '"', $ret);
|
self::$l_cache[$cache_key] = str_replace('"', '"', $ret);
|
||||||
}
|
}
|
||||||
return self::$l_cache[$cache_key];
|
return self::$l_cache[$cache_key];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get translation for a given module text
|
* Get translation for a given module text
|
||||||
*
|
*
|
||||||
* Note: $specific parameter is mandatory for library files.
|
* Note: $specific parameter is mandatory for library files.
|
||||||
* Otherwise, translation key will not match for Module library
|
* Otherwise, translation key will not match for Module library
|
||||||
* when module is loaded with eval() Module::getModulesOnDisk()
|
* when module is loaded with eval() Module::getModulesOnDisk()
|
||||||
*
|
*
|
||||||
* @param string $string String to translate
|
* @param string $string String to translate
|
||||||
@@ -914,7 +914,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
if (self::$_generateConfigXmlMode)
|
if (self::$_generateConfigXmlMode)
|
||||||
return $string;
|
return $string;
|
||||||
|
|
||||||
global $_MODULES, $_MODULE;
|
global $_MODULES, $_MODULE;
|
||||||
|
|
||||||
if ($id_lang == null)
|
if ($id_lang == null)
|
||||||
@@ -923,7 +923,7 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
if (Tools::file_exists_cache($file) AND include_once($file))
|
if (Tools::file_exists_cache($file) AND include_once($file))
|
||||||
$_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
|
$_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
|
||||||
|
|
||||||
$source = $specific ? $specific : $this->name;
|
$source = $specific ? $specific : $this->name;
|
||||||
$string = str_replace('\'', '\\\'', $string);
|
$string = str_replace('\'', '\\\'', $string);
|
||||||
$ret = $this->findTranslation($this->name, $string, $source);
|
$ret = $this->findTranslation($this->name, $string, $source);
|
||||||
@@ -959,10 +959,10 @@ abstract class ModuleCore
|
|||||||
return false;
|
return false;
|
||||||
$from = $res[$k];
|
$from = $res[$k];
|
||||||
$to = $res[$k + 1];
|
$to = $res[$k + 1];
|
||||||
|
|
||||||
if (isset($position) and !empty($position))
|
if (isset($position) and !empty($position))
|
||||||
$to['position'] = (int)($position);
|
$to['position'] = (int)($position);
|
||||||
|
|
||||||
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
||||||
SET `position`= position '.($way ? '-1' : '+1').'
|
SET `position`= position '.($way ? '-1' : '+1').'
|
||||||
WHERE position between '.(int)(min(array($from['position'], $to['position']))) .' AND '.(int)(max(array($from['position'], $to['position']))).'
|
WHERE position between '.(int)(min(array($from['position'], $to['position']))) .' AND '.(int)(max(array($from['position'], $to['position']))).'
|
||||||
@@ -970,7 +970,7 @@ abstract class ModuleCore
|
|||||||
AND id_shop = '.$shopID;
|
AND id_shop = '.$shopID;
|
||||||
if (!Db::getInstance()->Execute($sql))
|
if (!Db::getInstance()->Execute($sql))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
||||||
SET `position`='.(int)($to['position']).'
|
SET `position`='.(int)($to['position']).'
|
||||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($from[$this->identifier]).'
|
WHERE `'.pSQL($this->identifier).'` = '.(int)($from[$this->identifier]).'
|
||||||
@@ -1000,7 +1000,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
if (!isset($position[$row['id_shop']]))
|
if (!isset($position[$row['id_shop']]))
|
||||||
$position[$row['id_shop']] = 1;
|
$position[$row['id_shop']] = 1;
|
||||||
|
|
||||||
$sql = 'UPDATE '._DB_PREFIX_.'hook_module
|
$sql = 'UPDATE '._DB_PREFIX_.'hook_module
|
||||||
SET position = '.$position[$row['id_shop']].'
|
SET position = '.$position[$row['id_shop']].'
|
||||||
WHERE id_hook = '.(int)$id_hook.'
|
WHERE id_hook = '.(int)$id_hook.'
|
||||||
@@ -1060,7 +1060,7 @@ abstract class ModuleCore
|
|||||||
self::$exceptionsCache[$key][$row['id_shop']][] = $row['file_name'];
|
self::$exceptionsCache[$key][$row['id_shop']][] = $row['file_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $hookID.'-'.$this->id;
|
$key = $hookID.'-'.$this->id;
|
||||||
if (!$dispatch)
|
if (!$dispatch)
|
||||||
{
|
{
|
||||||
@@ -1161,7 +1161,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
Tools::clearCache(Context::getContext()->smarty);
|
Tools::clearCache(Context::getContext()->smarty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _generateConfigXml()
|
protected function _generateConfigXml()
|
||||||
{
|
{
|
||||||
$xml = '<?xml version="1.0" encoding="UTF-8" ?>
|
$xml = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
@@ -1178,7 +1178,7 @@ abstract class ModuleCore
|
|||||||
if (is_writable(_PS_MODULE_DIR_.$this->name.'/'))
|
if (is_writable(_PS_MODULE_DIR_.$this->name.'/'))
|
||||||
file_put_contents(_PS_MODULE_DIR_.$this->name.'/config.xml', $xml);
|
file_put_contents(_PS_MODULE_DIR_.$this->name.'/config.xml', $xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $hook_name
|
* @param string $hook_name
|
||||||
* @return bool if module can be transplanted on hook
|
* @return bool if module can be transplanted on hook
|
||||||
@@ -1187,18 +1187,18 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
return is_callable(array($this, 'hook'.ucfirst($hook_name)));
|
return is_callable(array($this, 'hook'.ucfirst($hook_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPermission($variable, $employee = null)
|
public function getPermission($variable, $employee = null)
|
||||||
{
|
{
|
||||||
return self::getPermissionStatic($this->id, $variable, $employee);
|
return self::getPermissionStatic($this->id, $variable, $employee);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPermissionStatic($id_module, $variable, $employee = null)
|
public static function getPermissionStatic($id_module, $variable, $employee = null)
|
||||||
{
|
{
|
||||||
if (!in_array($variable, array('view', 'configure')))
|
if (!in_array($variable, array('view', 'configure')))
|
||||||
return false;
|
return false;
|
||||||
if (!$employee)
|
if (!$employee)
|
||||||
$employee = $this->context->employee;
|
$employee = Context::getContext()->employee;
|
||||||
if (!isset($cache_permissions[$employee->id_profile]))
|
if (!isset($cache_permissions[$employee->id_profile]))
|
||||||
{
|
{
|
||||||
$cache_permissions[$employee->id_profile] = array();
|
$cache_permissions[$employee->id_profile] = array();
|
||||||
|
|||||||
Reference in new issue
Block a user