class CmsControllerCore extends FrontController
{
public $php_self = 'cms';
public $assignCase;
public $cms;
/** @var CMSCategory */
public $cms_category;
public $ssl = false;
public function canonicalRedirection($canonicalURL = '')
{
if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms, $this->cms->link_rewrite, $this->ssl))) {
parent::canonicalRedirection($canonicalURL);
} elseif (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category))) {
parent::canonicalRedirection($canonicalURL);
}
}
/**
* Initialize cms controller.
*
* @see FrontController::init()
*/
public function init()
{
// Récupérer l'ID de la page CMS via l'URL
$id_cms = (int) Tools::getValue('id_cms', 0);
// Si l'ID est 0, rediriger vers la page 404
if ($id_cms == 0) {
Tools::redirect('index.php?controller=404');
}
// Vérification de l'existence de la page CMS
$this->cms = new CMS($id_cms, $this->context->language->id, $this->context->shop->id);
if (!Validate::isLoadedObject($this->cms)) {
Tools::redirect('index.php?controller=404');
}
// Vérification de la page CMS et SSL
if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && $id_cms && Validate::isLoadedObject($this->cms)
&& in_array($id_cms, $this->getSSLCMSPageIds())) {
$this->ssl = true;
}
parent::init();
$this->canonicalRedirection();
// Vérifier si la page CMS est active et associée à un magasin
if (!$this->cms->isAssociatedToShop() || !$this->cms->active) {
$this->redirect_after = '404';
$this->redirect();
} else {
$this->assignCase = 1;
}
}
/**
* Assign template vars related to page content.
*
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
// Vérifier si la page CMS existe et est active
if (Validate::isLoadedObject($this->cms)) {
// Vérification de l'indexation de la page
if ($this->cms->indexation == 0) {
$this->context->smarty->assign('nobots', true);
}
// Assignation de la page CMS au template
$cmsVar = $this->objectPresenter->present($this->cms);
// Filtrage du contenu via les hooks
$filteredCmsContent = Hook::exec(
'filterCmsContent',
['object' => $cmsVar],
null,
false,
true,
false,
null,
true
);
if (!empty($filteredCmsContent['object'])) {
$cmsVar = $filteredCmsContent['object'];
}
$this->context->smarty->assign('cms', $cmsVar);
// Définir le template de la page CMS
$this->setTemplate('cms/page', ['entity' => 'cms', 'id' => $this->cms->id]);
} else {
// Si la page CMS n'est pas trouvée, rediriger vers 404
Tools::redirect('index.php?controller=404');
}
}
/**
* Return an array of IDs of CMS pages, which shouldn't be forwarded to their canonical URLs in SSL environment.
* Required for pages which are shown in iframes.
*/
protected function getSSLCMSPageIds()
{
return [(int) Configuration::get('PS_CONDITIONS_CMS_ID'), (int) Configuration::get('LEGAL_CMS_ID_REVOCATION')];
}
public function getBreadcrumbLinks()
{
$breadcrumb = parent::getBreadcrumbLinks();
if ($this->assignCase == 2) {
$cmsCategory = new CMSCategory($this->cms_category->id_cms_category);
} else {
$cmsCategory = new CMSCategory($this->cms->id_cms_category);
}
if ($cmsCategory->id_parent != 0) {
foreach (array_reverse($cmsCategory->getParentsCategories()) as $category) {
$cmsSubCategory = new CMSCategory($category['id_cms_category']);
$breadcrumb['links'][] = [
'title' => $cmsSubCategory->getName(),
'url' => $this->context->link->getCMSCategoryLink($cmsSubCategory),
];
}
}
if ($this->assignCase == 1) {
$breadcrumb['links'][] = [
'title' => $this->context->controller->cms->meta_title,
'url' => $this->context->link->getCMSLink($this->context->controller->cms),
];
}
return $breadcrumb;
}
public function getTemplateVarPage()
{
$page = parent::getTemplateVarPage();
if ($this->assignCase == 2) {
$page['body_classes']['cms-id-' . $this->cms_category->id] = true;
} else {
$page['body_classes']['cms-id-' . $this->cms->id] = true;
if (!$this->cms->indexation) {
$page['meta']['robots'] = 'noindex';
}
}
return $page;
}
}
Fatal error: Uncaught Error: Class 'CmsControllerCore' not found in /home/lodisscokg/www/override/controllers/front/CmsController.php:3
Stack trace:
#0 /home/lodisscokg/www/classes/PrestaShopAutoload.php(152): require_once()
#1 [internal function]: PrestaShopAutoload->load('CmsController')
#2 /home/lodisscokg/www/classes/controller/Controller.php(233): spl_autoload_call('CmsController')
#3 /home/lodisscokg/www/classes/Dispatcher.php(510): ControllerCore::getController('CmsController')
#4 /home/lodisscokg/www/index.php(28): DispatcherCore->dispatch()
#5 {main}
thrown in /home/lodisscokg/www/override/controllers/front/CmsController.php on line 3