94 lines
3.0 KiB
PHP
94 lines
3.0 KiB
PHP
<?php
|
|
|
|
class FrontController extends FrontControllerCore
|
|
{
|
|
public function display()
|
|
{
|
|
Tools::safePostVars();
|
|
|
|
// assign css_files and js_files at the very last time
|
|
if ((Configuration::get('PS_CSS_THEME_CACHE') || Configuration::get('PS_JS_THEME_CACHE')) && is_writable(_PS_THEME_DIR_.'cache'))
|
|
{
|
|
// CSS compressor management
|
|
if (Configuration::get('PS_CSS_THEME_CACHE'))
|
|
$this->css_files = Media::cccCss($this->css_files);
|
|
//JS compressor management
|
|
if (Configuration::get('PS_JS_THEME_CACHE') && !$this->useMobileTheme())
|
|
$this->js_files = Media::cccJs($this->js_files);
|
|
}
|
|
|
|
/* Override destroy all css */
|
|
$this->css_files = array();
|
|
|
|
/* Override Add real css */
|
|
$this->css_files[_THEME_CSS_DIR_.'bootstrap.css?v='.filemtime($this->getThemeDir().'css/bootstrap.css')] = 'all';
|
|
$this->css_files[_THEME_CSS_DIR_.'k2000.css?v='.filemtime($this->getThemeDir().'css/k2000.css')] = 'all';
|
|
// $this->css_files[_THEME_CSS_DIR_.'plugins.css?v='.filemtime($this->getThemeDir().'css/plugins.css')] = 'all';
|
|
$this->css_files[_THEME_CSS_DIR_.'global.css?v='.filemtime($this->getThemeDir().'css/global.css')] = 'all';
|
|
|
|
if (@filemtime($this->getThemeDir().'css/autoload/'))
|
|
{
|
|
foreach (scandir($this->getThemeDir().'css/autoload', 0) as $file)
|
|
{
|
|
if (preg_match('/^[^.].*\.css$/', $file))
|
|
{
|
|
$this->css_files[_THEME_CSS_DIR_.'autoload/'.$file.'?v='.filemtime($this->getThemeDir().'css/autoload/'.$file)] = 'all';
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach($this->js_files as $key => $file)
|
|
{
|
|
if(strpos($file, _THEME_JS_DIR_) === false)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
$this->js_files[$key] = $file.'?v='.filemtime($this->getThemeDir().'js/'.str_replace(_THEME_JS_DIR_, '', $file));
|
|
}
|
|
$this->js_files[] = _MODULE_DIR_.'netreviews/views/js/avisverifies.js';
|
|
/****************************/
|
|
|
|
$this->context->smarty->assign(array(
|
|
'css_files' => $this->css_files,
|
|
'js_files' => ($this->getLayout() && (bool)Configuration::get('PS_JS_DEFER')) ? array() : $this->js_files,
|
|
'js_defer' => (bool)Configuration::get('PS_JS_DEFER'),
|
|
'errors' => $this->errors,
|
|
'display_header' => $this->display_header,
|
|
'display_footer' => $this->display_footer,
|
|
));
|
|
|
|
$layout = $this->getLayout();
|
|
if ($layout)
|
|
{
|
|
if ($this->template)
|
|
$template = $this->context->smarty->fetch($this->template);
|
|
else // For retrocompatibility with 1.4 controller
|
|
{
|
|
ob_start();
|
|
$this->displayContent();
|
|
$template = ob_get_contents();
|
|
ob_clean();
|
|
|
|
}
|
|
$template = $this->context->smarty->assign('template', $template);
|
|
$this->smartyOutputContent($layout);
|
|
}
|
|
else
|
|
{
|
|
Tools::displayAsDeprecated('layout.tpl is missing in your theme directory');
|
|
if ($this->display_header)
|
|
$this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl');
|
|
|
|
if ($this->template)
|
|
$this->smartyOutputContent($this->template);
|
|
else // For retrocompatibility with 1.4 controller
|
|
$this->displayContent();
|
|
|
|
if ($this->display_footer)
|
|
$this->smartyOutputContent(_PS_THEME_DIR_.'footer.tpl');
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
?>
|