udpate
This commit is contained in:
63
override/modules/hifaq/controllers/front/faq.php
Normal file
63
override/modules/hifaq/controllers/front/faq.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Page Cache Ultimate, Page Cache standard and Speed pack are powered by Jpresta (jpresta . com)
|
||||
*
|
||||
* @author Jpresta
|
||||
* @copyright Jpresta
|
||||
* @license See the license of this module in file LICENSE.txt, thank you.
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements getJprestaModelObjectClassName() and getJprestaModelObjectId() to enable the HTML cache provided by the
|
||||
* module Page Cache Ultimate created by jpresta.com
|
||||
*/
|
||||
class HiFaqFaqModuleFrontControllerOverride extends HiFaqFaqModuleFrontController
|
||||
{
|
||||
/**
|
||||
* @return string The ObjectModel class name to be used by Page Cache Ultimate module to refresh the cache of pages generated by this controller
|
||||
*/
|
||||
public static function getJprestaModelObjectClassName()
|
||||
{
|
||||
return 'HiFAQCategory';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null The ID of the current ObjectModel (if any) to be used by Page Cache Ultimate module to refresh the cache of pages generated by this controller
|
||||
*/
|
||||
public function getJprestaModelObjectId()
|
||||
{
|
||||
// Root of FAQ
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all URLs generated by this controller for the current shop context and the specified language.
|
||||
* This is used by the Jresta-Cache-Warmer service to generate the cache of these pages.
|
||||
* @param $id_lang int ID of the language
|
||||
* @return string[] All URLs to warmup
|
||||
*/
|
||||
public static function getJprestaAllURLs($id_lang) {
|
||||
$urls = [];
|
||||
$context = Context::getContext();
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS')) {
|
||||
$urls[] = $context->link->getPageLink('module-hifaq-faq', null, $id_lang, ['type' => null]);
|
||||
} else {
|
||||
$urls[] = $context->link->getModuleLink('hifaq', 'faq', ['type' => null]);
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* An estimated number of URLs that will be returned by self::getJprestaAllURLs() for the current shop context.
|
||||
* Since we don't have the id_lang parameter we recommend to return the number of URLs for the language that have
|
||||
* the most URLs.
|
||||
* @return int The estimated number of URLs to warmup for the current shop context
|
||||
*/
|
||||
public static function getJprestaAllURLsCount() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
79
override/modules/hifaq/controllers/front/faqcategory.php
Normal file
79
override/modules/hifaq/controllers/front/faqcategory.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Page Cache Ultimate, Page Cache standard and Speed pack are powered by Jpresta (jpresta . com)
|
||||
*
|
||||
* @author Jpresta
|
||||
* @copyright Jpresta
|
||||
* @license See the license of this module in file LICENSE.txt, thank you.
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements getJprestaModelObjectClassName() and getJprestaModelObjectId() to enable the HTML cache provided by the
|
||||
* module Page Cache Ultimate created by jpresta.com
|
||||
*/
|
||||
class HiFaqFaqCategoryModuleFrontControllerOverride extends HiFaqFaqCategoryModuleFrontController
|
||||
{
|
||||
/**
|
||||
* @return string The ObjectModel class name to be used by Page Cache Ultimate module to refresh the cache of pages generated by this controller
|
||||
*/
|
||||
public static function getJprestaModelObjectClassName()
|
||||
{
|
||||
return 'HiFAQCategory';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null The ID of the current ObjectModel (if any) to be used by Page Cache Ultimate module to refresh the cache of pages generated by this controller
|
||||
*/
|
||||
public function getJprestaModelObjectId()
|
||||
{
|
||||
$id_category = HiFAQCategory::getIdByLinkRewrite(Tools::getValue('faqc_link_rewrite'));
|
||||
if ($id_category) {
|
||||
return (int) $id_category;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all URLs generated by this controller for the current shop context and the specified language.
|
||||
* This is used by the Jresta-Cache-Warmer service to generate the cache of these pages.
|
||||
* @param $id_lang int ID of the language
|
||||
* @return string[] All URLs to warmup
|
||||
*/
|
||||
public static function getJprestaAllURLs($id_lang) {
|
||||
$urls = [];
|
||||
$context = Context::getContext();
|
||||
$sql = 'SELECT friendly_url
|
||||
FROM `' . _DB_PREFIX_ . 'hifaqcategory` f
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaqcategory_lang` fl ON f.id=fl.id
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaqcategory_shop` fs ON f.id=fs.id
|
||||
WHERE f.active=1 AND fl.id_lang=' . (int)$id_lang . ' AND fs.id_shop=' . (int)Shop::getContextShopID();
|
||||
$faqs = JPresta\SpeedPack\JprestaUtils::dbSelectRows($sql);
|
||||
foreach ($faqs as $faq) {
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS')) {
|
||||
$urls[] = $context->link->getPageLink('module-hifaq-faqcategory', null, $id_lang, ['faqc_link_rewrite' => $faq['friendly_url']]);
|
||||
} else {
|
||||
$urls[] = $context->link->getModuleLink('hifaq', 'faqcategory', ['faqc_link_rewrite' => $faq['friendly_url']], null, $id_lang);
|
||||
}
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* An estimated number of URLs that will be returned by self::getJprestaAllURLs() for the current shop context.
|
||||
* Since we don't have the id_lang parameter we recommend to return the number of URLs for the language that have
|
||||
* the most URLs.
|
||||
* @return int The estimated number of URLs to warmup for the current shop context
|
||||
*/
|
||||
public static function getJprestaAllURLsCount() {
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM `' . _DB_PREFIX_ . 'hifaqcategory` f
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaqcategory_lang` fl ON f.id=fl.id
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaqcategory_shop` fs ON f.id=fs.id
|
||||
WHERE f.active=1 AND fl.id_lang=' . (int)Configuration::get('PS_LANG_DEFAULT') . ' AND fs.id_shop=' . (int)Shop::getContextShopID();
|
||||
return (int) JPresta\SpeedPack\JprestaUtils::dbGetValue($sql);
|
||||
}
|
||||
}
|
||||
79
override/modules/hifaq/controllers/front/faqdetails.php
Normal file
79
override/modules/hifaq/controllers/front/faqdetails.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Page Cache Ultimate, Page Cache standard and Speed pack are powered by Jpresta (jpresta . com)
|
||||
*
|
||||
* @author Jpresta
|
||||
* @copyright Jpresta
|
||||
* @license See the license of this module in file LICENSE.txt, thank you.
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements getJprestaModelObjectClassName() and getJprestaModelObjectId() to enable the HTML cache provided by the
|
||||
* module Page Cache Ultimate created by jpresta.com
|
||||
*/
|
||||
class HiFaqFaqDetailsModuleFrontControllerOverride extends HiFaqFaqDetailsModuleFrontController
|
||||
{
|
||||
/**
|
||||
* @return string The ObjectModel class name to be used by Page Cache Ultimate module to refresh the cache of pages generated by this controller
|
||||
*/
|
||||
public static function getJprestaModelObjectClassName()
|
||||
{
|
||||
return 'HiFAQItem';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null The ID of the current ObjectModel (if any) to be used by Page Cache Ultimate module to refresh the cache of pages generated by this controller
|
||||
*/
|
||||
public function getJprestaModelObjectId()
|
||||
{
|
||||
$faq = HiFAQItem::getDetails(Tools::getValue('faq_link_rewrite'));
|
||||
if (isset($faq)) {
|
||||
return (int) $faq['id_faq'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all URLs generated by this controller for the current shop context and the specified language.
|
||||
* This is used by the Jresta-Cache-Warmer service to generate the cache of these pages.
|
||||
* @param $id_lang int ID of the language
|
||||
* @return string[] All URLs to warmup
|
||||
*/
|
||||
public static function getJprestaAllURLs($id_lang) {
|
||||
$urls = [];
|
||||
$context = Context::getContext();
|
||||
$sql = 'SELECT friendly_url
|
||||
FROM `' . _DB_PREFIX_ . 'hifaq` f
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaq_lang` fl ON f.id_faq=fl.id_faq
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaq_shop` fs ON f.id_faq=fs.id_faq
|
||||
WHERE f.active=1 AND fl.id_lang=' . (int)$id_lang . ' AND fs.id_shop=' . (int)Shop::getContextShopID();
|
||||
$faqs = JPresta\SpeedPack\JprestaUtils::dbSelectRows($sql);
|
||||
foreach ($faqs as $faq) {
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS')) {
|
||||
$urls[] = $context->link->getPageLink('module-hifaq-faqdetails', null, $id_lang, ['faq_link_rewrite' => $faq['friendly_url']]);
|
||||
} else {
|
||||
$urls[] = $context->link->getModuleLink('hifaq', 'faqdetails', [], null, $id_lang) . '&faq_link_rewrite=' . $faq['friendly_url'];
|
||||
}
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* An estimated number of URLs that will be returned by self::getJprestaAllURLs() for the current shop context.
|
||||
* Since we don't have the id_lang parameter we recommend to return the number of URLs for the language that have
|
||||
* the most URLs.
|
||||
* @return int The estimated number of URLs to warmup for the current shop context
|
||||
*/
|
||||
public static function getJprestaAllURLsCount() {
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM `' . _DB_PREFIX_ . 'hifaq` f
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaq_lang` fl ON f.id_faq=fl.id_faq
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'hifaq_shop` fs ON f.id_faq=fs.id_faq
|
||||
WHERE f.active=1 AND fl.id_lang=' . (int)Configuration::get('PS_LANG_DEFAULT') . ' AND fs.id_shop=' . (int)Shop::getContextShopID();
|
||||
return (int) JPresta\SpeedPack\JprestaUtils::dbGetValue($sql);
|
||||
}
|
||||
}
|
||||
19
override/modules/hifaq/controllers/front/index.php
Normal file
19
override/modules/hifaq/controllers/front/index.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* This file protect the directory
|
||||
* Page Cache Ultimate, Page Cache standard and Speed pack are powered by Jpresta (jpresta . com)
|
||||
*
|
||||
* @author Jpresta
|
||||
* @copyright Jpresta
|
||||
* @license See the license of this module in file LICENSE.txt, thank you.
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
19
override/modules/hifaq/controllers/index.php
Normal file
19
override/modules/hifaq/controllers/index.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* This file protect the directory
|
||||
* Page Cache Ultimate, Page Cache standard and Speed pack are powered by Jpresta (jpresta . com)
|
||||
*
|
||||
* @author Jpresta
|
||||
* @copyright Jpresta
|
||||
* @license See the license of this module in file LICENSE.txt, thank you.
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
19
override/modules/hifaq/index.php
Normal file
19
override/modules/hifaq/index.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* This file protect the directory
|
||||
* Page Cache Ultimate, Page Cache standard and Speed pack are powered by Jpresta (jpresta . com)
|
||||
*
|
||||
* @author Jpresta
|
||||
* @copyright Jpresta
|
||||
* @license See the license of this module in file LICENSE.txt, thank you.
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
Reference in New Issue
Block a user