Add Creative Elements templates and update index files
- Introduced new templates for catalog, checkout, contact, and error pages. - Implemented caching headers and redirection in index.php files across various directories. - Enhanced product and layout templates for better integration with Creative Elements. - Added backoffice header styles and scripts for improved UI/UX in the admin panel.
This commit is contained in:
157
modules/creativeelements/core/responsive/files/frontend.php
Normal file
157
modules/creativeelements/core/responsive/files/frontend.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* Creative Elements - live Theme & Page Builder
|
||||
*
|
||||
* @author WebshopWorks, Elementor
|
||||
* @copyright 2019-2022 WebshopWorks.com & Elementor.com
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
namespace CE;
|
||||
|
||||
defined('_PS_VERSION_') or die;
|
||||
|
||||
use CE\CoreXFilesXBase as Base;
|
||||
use CE\CoreXResponsiveXResponsive as Responsive;
|
||||
|
||||
class CoreXResponsiveXFilesXFrontend extends Base
|
||||
{
|
||||
const META_KEY = 'elementor-custom-breakpoints-files';
|
||||
|
||||
private $template_file;
|
||||
|
||||
/**
|
||||
* @since 2.1.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($file_name, $template_file = null)
|
||||
{
|
||||
$this->template_file = $template_file;
|
||||
|
||||
parent::__construct($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.1.0
|
||||
* @access public
|
||||
*/
|
||||
public function parseContent()
|
||||
{
|
||||
$breakpoints = Responsive::getBreakpoints();
|
||||
|
||||
$breakpoints_keys = array_keys($breakpoints);
|
||||
|
||||
$file_content = call_user_func('file_get_contents', $this->template_file);
|
||||
|
||||
$file_content = preg_replace_callback('/-width:\s*(767|768|1024|1025)px\s*\)/', function ($placeholder_data) use ($breakpoints_keys, $breakpoints) {
|
||||
$width = (int) $placeholder_data[1];
|
||||
$size = $width < 768 ? 'sm' : ($width < 1025 ? 'md' : 'lg');
|
||||
$breakpoint_index = array_search($size, $breakpoints_keys);
|
||||
|
||||
$is_max_point = 767 === $width || 1024 === $width;
|
||||
|
||||
if ($is_max_point) {
|
||||
$breakpoint_index++;
|
||||
}
|
||||
|
||||
$value = $breakpoints[$breakpoints_keys[$breakpoint_index]];
|
||||
|
||||
if ($is_max_point) {
|
||||
$value--;
|
||||
}
|
||||
|
||||
return "-width:{$value}px)";
|
||||
}, $file_content);
|
||||
|
||||
return $file_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load meta.
|
||||
*
|
||||
* Retrieve the file meta data.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access protected
|
||||
*/
|
||||
protected function loadMeta()
|
||||
{
|
||||
$option = $this->loadMetaOption();
|
||||
|
||||
$file_meta_key = $this->getFileMetaKey();
|
||||
|
||||
if (empty($option[$file_meta_key])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $option[$file_meta_key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update meta.
|
||||
*
|
||||
* Update the file meta data.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access protected
|
||||
*
|
||||
* @param array $meta New meta data.
|
||||
*/
|
||||
protected function updateMeta($meta)
|
||||
{
|
||||
$option = $this->loadMetaOption();
|
||||
|
||||
$option[$this->getFileMetaKey()] = $meta;
|
||||
|
||||
update_option(static::META_KEY, $option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete meta.
|
||||
*
|
||||
* Delete the file meta data.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access protected
|
||||
*/
|
||||
protected function deleteMeta()
|
||||
{
|
||||
$option = $this->loadMetaOption();
|
||||
|
||||
$file_meta_key = $this->getFileMetaKey();
|
||||
|
||||
if (isset($option[$file_meta_key])) {
|
||||
unset($option[$file_meta_key]);
|
||||
}
|
||||
|
||||
if ($option) {
|
||||
update_option(static::META_KEY, $option);
|
||||
} else {
|
||||
delete_option(static::META_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.1.0
|
||||
* @access private
|
||||
*/
|
||||
private function getFileMetaKey()
|
||||
{
|
||||
return pathinfo($this->getFileName(), PATHINFO_FILENAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.1.0
|
||||
* @access private
|
||||
*/
|
||||
private function loadMetaOption()
|
||||
{
|
||||
$option = get_option(static::META_KEY);
|
||||
|
||||
if (!$option) {
|
||||
$option = [];
|
||||
}
|
||||
|
||||
return $option;
|
||||
}
|
||||
}
|
||||
8
modules/creativeelements/core/responsive/files/index.php
Normal file
8
modules/creativeelements/core/responsive/files/index.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Thu, 28 Feb 2019 00:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../../../../../');
|
||||
die;
|
||||
Reference in New Issue
Block a user