Files
interblue.pl/override/classes/Hook.php

48 lines
1.8 KiB
PHP

<?php
/**
* LiteSpeed Cache needs to do ESI hole punch automatically.
* To override Hook is the only way to do it without changing Prestashop core code.
* This should not affect any existing functionalities of your Prestashop installation and it is safe to use.
*/
class Hook extends HookCore
{
/*
* module: litespeedcache
* date: 2019-06-29 10:06:58
* version: 1.2.6
*/
public static function coreCallHook($module, $method, $params)
{
if (defined('_LITESPEED_DEBUG_')
&& _LITESPEED_DEBUG_ >= LiteSpeedCacheLog::LEVEL_HOOK_DETAIL) {
$mesg = ' in hook coreCallHook ' . get_class($module) . ' - ' . $method;
LiteSpeedCacheLog::log($mesg, LiteSpeedCacheLog::LEVEL_HOOK_DETAIL);
}
$html = parent::coreCallHook($module, $method, $params);
if (defined('_LITESPEED_CACHE_')
&& ($marker = LiteSpeedCache::injectCallHook($module, $method)) !== false) {
$html = $marker . $html . LiteSpeedCache::ESI_MARKER_END;
}
return $html;
}
/*
* module: litespeedcache
* date: 2019-06-29 10:06:58
* version: 1.2.6
*/
public static function coreRenderWidget($module, $hook_name, $params)
{
if (defined('_LITESPEED_DEBUG_')
&& _LITESPEED_DEBUG_ >= LiteSpeedCacheLog::LEVEL_HOOK_DETAIL) {
$mesg = ' in hook coreRenderWidget module ' . get_class($module) . ' - ' . $hook_name;
LiteSpeedCacheLog::log($mesg, LiteSpeedCacheLog::LEVEL_HOOK_DETAIL);
}
$html = parent::coreRenderWidget($module, $hook_name, $params);
if (defined('_LITESPEED_CACHE_')
&& ($marker = LiteSpeedCache::injectRenderWidget($module, $hook_name)) !== false) {
$html = $marker . $html . LiteSpeedCache::ESI_MARKER_END;
}
return $html;
}
}