<?php
class Hook extends HookCore
{
private static $cache_debug = false;
private static $hook_need_comment = array('extraleft','productfooter','extraright','productoutofstock','productactions','producttab','producttabcontent','displayleftcolumnproduct','displayrightcolumnproduct','actionproductoutofstock','displayfooterproduct','displayproductbuttons','displayproducttab','displayproducttabcontent');
private static $hook_need_comment_result = array();
private static $_DispatcherControllerInstance = null;
public function __construct($name = NULL)
{
if (self::$cache_debug && !class_exists('FB') && file_exists(_PS_ROOT_DIR_ . '/override/classes/fb.php'))
include_once (_PS_ROOT_DIR_ . '/override/classes/fb.php');
parent::__construct($name);
if (self::$_DispatcherControllerInstance == null) self::$_DispatcherControllerInstance = Dispatcher::getInstance()->getController();
}
private static function hookNeedComment($hook_name) {
if (isset(self::$hook_need_comment_result[$hook_name])) return self::$hook_need_comment_result[$hook_name];
if (in_array(strtolower($hook_name), self::$hook_need_comment)) self::$hook_need_comment_result[$hook_name] = true;
else self::$hook_need_comment_result[$hook_name] = false;
return self::$hook_need_comment_result[$hook_name];
}
public static function execCache($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true)
{
// Check arguments validity
if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name))
throw new PrestaShopException('Invalid id_module or hook_name');
// If no modules associated to hook_name or recompatible hook name, we stop the function
if (!$module_list = Hook::getHookModuleExecList($hook_name))
return '';
// Check if hook exists
if (!$id_hook = Hook::getIdByName($hook_name))
if (in_array($hook_name,self::$hook_need_comment))
return '<!-- PM_CM START '.$hook_name.' --><!-- PM_CM END '.$hook_name.' -->';
else return '';
}
?>