210 lines
5.2 KiB
PHP
210 lines
5.2 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: 2025-05-30 11:21:28
|
|
* version: 1.8.8
|
|
*/
|
|
protected static $moduleInstance;
|
|
/*
|
|
* module: arseopro
|
|
* date: 2025-05-30 11:21:28
|
|
* version: 1.8.8
|
|
*/
|
|
public function arSeoProOverrideVersion()
|
|
{
|
|
return '1.8.8';
|
|
}
|
|
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2025-05-30 11:21:28
|
|
* version: 1.8.8
|
|
*/
|
|
public function getModuleInstance()
|
|
{
|
|
if (self::$moduleInstance == null) {
|
|
self::$moduleInstance = Module::getInstanceByName('arseopro');
|
|
}
|
|
return self::$moduleInstance;
|
|
}
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2025-05-30 11:21:28
|
|
* version: 1.8.8
|
|
*/
|
|
public function getTemplateVarShop()
|
|
{
|
|
$shop = parent::getTemplateVarShop();
|
|
$shop['favicon'] = $this->getShopFavicon();
|
|
return $shop;
|
|
}
|
|
|
|
/*
|
|
* module: arseopro
|
|
* date: 2025-05-30 11:21:28
|
|
* 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: 2025-05-30 11:21:28
|
|
* 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: 2025-05-30 11:21:28
|
|
* version: 1.8.8
|
|
*/
|
|
public function initLogoAndFavicon()
|
|
{
|
|
$res = parent::initLogoAndFavicon();
|
|
$res['favicon_url'] = $this->getShopFavicon();
|
|
return $res;
|
|
}
|
|
/*
|
|
* module: arseopro
|
|
* date: 2025-05-30 11:21:28
|
|
* 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: 2025-05-30 11:21:28
|
|
* 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}" : '');
|
|
}
|
|
}
|