- 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.
150 lines
3.0 KiB
PHP
150 lines
3.0 KiB
PHP
<?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;
|
|
|
|
/**
|
|
* Elementor shortcode widget.
|
|
*
|
|
* Elementor widget that insert any shortcodes into the page.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class WidgetShortcode extends WidgetBase
|
|
{
|
|
const REMOTE_RENDER = true;
|
|
|
|
/**
|
|
* Get widget name.
|
|
*
|
|
* Retrieve shortcode widget name.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
*
|
|
* @return string Widget name.
|
|
*/
|
|
public function getName()
|
|
{
|
|
return 'shortcode';
|
|
}
|
|
|
|
/**
|
|
* Get widget title.
|
|
*
|
|
* Retrieve shortcode widget title.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
*
|
|
* @return string Widget title.
|
|
*/
|
|
public function getTitle()
|
|
{
|
|
return __('Shortcode');
|
|
}
|
|
|
|
/**
|
|
* Get widget icon.
|
|
*
|
|
* Retrieve shortcode widget icon.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
*
|
|
* @return string Widget icon.
|
|
*/
|
|
public function getIcon()
|
|
{
|
|
return 'eicon-shortcode';
|
|
}
|
|
|
|
/**
|
|
* Get widget keywords.
|
|
*
|
|
* Retrieve the list of keywords the widget belongs to.
|
|
*
|
|
* @since 2.1.0
|
|
* @access public
|
|
*
|
|
* @return array Widget keywords.
|
|
*/
|
|
public function getKeywords()
|
|
{
|
|
return ['shortcode', 'code', 'hook'];
|
|
}
|
|
|
|
/**
|
|
* Register shortcode widget controls.
|
|
*
|
|
* Adds different input fields to allow the user to change and customize the widget settings.
|
|
*
|
|
* @since 1.0.0
|
|
* @access protected
|
|
*/
|
|
protected function _registerControls()
|
|
{
|
|
$this->startControlsSection(
|
|
'section_shortcode',
|
|
[
|
|
'label' => __('Shortcode'),
|
|
]
|
|
);
|
|
|
|
$this->addControl(
|
|
'shortcode',
|
|
[
|
|
'label' => __('Enter your shortcode'),
|
|
'type' => ControlsManager::TEXTAREA,
|
|
'dynamic' => [
|
|
'active' => true,
|
|
],
|
|
'placeholder' => "{hook h='displayShortcode'}",
|
|
'default' => '',
|
|
]
|
|
);
|
|
|
|
$this->endControlsSection();
|
|
}
|
|
|
|
/**
|
|
* Render shortcode widget output on the frontend.
|
|
*
|
|
* Written in PHP and used to generate the final HTML.
|
|
*
|
|
* @since 1.0.0
|
|
* @access protected
|
|
*/
|
|
protected function render()
|
|
{
|
|
echo do_shortcode($this->getSettings('shortcode'));
|
|
}
|
|
|
|
protected function renderSmarty()
|
|
{
|
|
echo $this->getSettings('shortcode');
|
|
}
|
|
|
|
/**
|
|
* Render shortcode widget as plain content.
|
|
*
|
|
* Override the default behavior by printing the shortcode instead of rendering it.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
*/
|
|
public function renderPlainContent()
|
|
{
|
|
// In plain mode, render without shortcode
|
|
echo $this->getSettings('shortcode');
|
|
}
|
|
}
|