263 lines
6.9 KiB
PHP
263 lines
6.9 KiB
PHP
<?php
|
|
class FrontController extends FrontControllerCore
|
|
{
|
|
|
|
protected function smartyOutputContent($content)
|
|
{
|
|
if (Module::isEnabled('pshowlazyimg')) {
|
|
ob_start();
|
|
parent::smartyOutputContent($content);
|
|
$html = ob_get_clean();
|
|
ob_flush();
|
|
|
|
$module = Module::getInstanceByName('pshowlazyimg');
|
|
echo $module->parseOutputContent($html);
|
|
return;
|
|
}
|
|
parent::smartyOutputContent($content);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
protected static $moduleInstance;
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
public function arSeoProOverrideVersion()
|
|
{
|
|
return '1.8.8';
|
|
}
|
|
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
public function getModuleInstance()
|
|
{
|
|
if (self::$moduleInstance == null) {
|
|
self::$moduleInstance = Module::getInstanceByName('arseopro');
|
|
}
|
|
return self::$moduleInstance;
|
|
}
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
public function getTemplateVarShop()
|
|
{
|
|
$shop = parent::getTemplateVarShop();
|
|
$shop['favicon'] = $this->getShopFavicon();
|
|
return $shop;
|
|
}
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
public function getTemplateVarUrls()
|
|
{
|
|
$urls = parent::getTemplateVarUrls();
|
|
if (Module::isEnabled('arseopro') && Configuration::get('ARS_REMOVE_DEF_LANG')) {
|
|
if (Context::getContext()->language->id != Configuration::get('PS_LANG_DEFAULT')) {
|
|
$urls['base_url'] .= $_GET['isolang'] . '/' ;
|
|
}
|
|
}
|
|
return $urls;
|
|
}
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
public function getShopFavicon()
|
|
{
|
|
$icon = Configuration::get('PS_FAVICON');
|
|
$favicon = ($icon) ? _PS_IMG_.$icon : '';
|
|
if (Module::isEnabled('arseopro')) {
|
|
$module = $this->getModuleInstance();
|
|
$module->getFaviconConfig()->loadFromConfig();
|
|
if ($module->getFaviconConfig()->icon) {
|
|
$filename = pathinfo($module->getFaviconConfig()->icon, PATHINFO_FILENAME);
|
|
$ext = pathinfo($module->getFaviconConfig()->icon, PATHINFO_EXTENSION);
|
|
$favicon = $module->getUploadsUrl() . $filename . '_96x96.' . $ext;
|
|
}
|
|
}
|
|
return $favicon;
|
|
}
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
public function initLogoAndFavicon()
|
|
{
|
|
$res = parent::initLogoAndFavicon();
|
|
$res['favicon_url'] = $this->getShopFavicon();
|
|
return $res;
|
|
}
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
protected function canonicalRedirection($canonical_url = '')
|
|
{
|
|
$params = array();
|
|
if (Module::isEnabled('arseopro')) {
|
|
$module = $this->getModuleInstance();
|
|
$data = $module->getUrlConfig()->canonicalUrl($canonical_url);
|
|
$canonical_url = $data['url'];
|
|
if (isset($data['params']) && is_array($data['params']) && $data['params']) {
|
|
$params = $data['params'];
|
|
}
|
|
}
|
|
parent::canonicalRedirection($canonical_url);
|
|
if ($params) {
|
|
$_GET = array_merge($_GET, $params);
|
|
}
|
|
}
|
|
/*
|
|
* module: arseopro
|
|
* date: 2023-11-02 21:34:52
|
|
* version: 1.8.8
|
|
*/
|
|
protected function updateQueryString(array $extraParams = null)
|
|
{
|
|
if (!Module::isEnabled('arseopro')) {
|
|
return parent::updateQueryString($extraParams);
|
|
}
|
|
|
|
$uriWithoutParams = explode('?', $_SERVER['REQUEST_URI']);
|
|
if (isset($uriWithoutParams[0])) {
|
|
$uriWithoutParams = $uriWithoutParams[0];
|
|
}
|
|
$url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().$uriWithoutParams;
|
|
if (Module::isEnabled('arseopro')) {
|
|
$module = $this->getModuleInstance();
|
|
$url = $module->getUrlConfig()->overrideUpdateQueryStringBaseUrl($url, $extraParams);
|
|
}
|
|
$params = array();
|
|
parse_str($_SERVER['QUERY_STRING'], $params);
|
|
if (null !== $extraParams) {
|
|
foreach ($extraParams as $key => $value) {
|
|
if (null === $value) {
|
|
unset($params[$key]);
|
|
} else {
|
|
$params[$key] = $value;
|
|
}
|
|
}
|
|
}
|
|
ksort($params);
|
|
if (null !== $extraParams) {
|
|
foreach ($params as $key => $param) {
|
|
if (null === $param || '' === $param) {
|
|
unset($params[$key]);
|
|
}
|
|
}
|
|
} else {
|
|
$params = array();
|
|
}
|
|
$queryString = str_replace('%2F', '/', http_build_query($params));
|
|
return $url . ($queryString? "?{$queryString}" : '');
|
|
}
|
|
/*
|
|
* module: pagecache
|
|
* date: 2025-11-28 11:17:30
|
|
* version: 9.6.1
|
|
*/
|
|
protected function displayAjax()
|
|
{
|
|
if (!Tools::getIsset('page_cache_dynamics_mods')) {
|
|
if (is_callable('parent::displayAjax')) {
|
|
return parent::displayAjax();
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
}
|
|
$this->initHeader();
|
|
$this->assignGeneralPurposeVariables();
|
|
require_once _PS_MODULE_DIR_ . 'pagecache/pagecache.php';
|
|
$result = PageCache::execDynamicHooks($this);
|
|
if (Tools::version_compare(_PS_VERSION_,'1.6','>')) {
|
|
$this->context->smarty->assign(array(
|
|
'js_def' => PageCache::getJsDef($this),
|
|
));
|
|
$result['js'] = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_.'javascript.tpl');
|
|
}
|
|
$this->context->cookie->write();
|
|
header('Content-Type: text/html');
|
|
header('Cache-Control: no-cache');
|
|
header('X-Robots-Tag: noindex');
|
|
$json = json_encode($result);
|
|
if ($json === false) {
|
|
header("HTTP/1.1 500 Internal Server Error");
|
|
die(json_last_error_msg());
|
|
}
|
|
die($json);
|
|
}
|
|
/*
|
|
* module: pagecache
|
|
* date: 2025-11-28 11:17:30
|
|
* version: 9.6.1
|
|
*/
|
|
public function isRestrictedCountry()
|
|
{
|
|
return $this->restrictedCountry;
|
|
}
|
|
/*
|
|
* module: pagecache
|
|
* date: 2025-11-28 11:17:30
|
|
* version: 9.6.1
|
|
*/
|
|
public function geolocationManagementPublic($default_country)
|
|
{
|
|
$ret = $this->geolocationManagement($default_country);
|
|
if (!$ret) {
|
|
return $default_country;
|
|
}
|
|
return $ret;
|
|
}
|
|
}
|