first commit

This commit is contained in:
2024-10-28 22:14:22 +01:00
commit b65352c452
40581 changed files with 5712079 additions and 0 deletions

View File

@@ -0,0 +1,984 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor controls manager.
*
* Elementor controls manager handler class is responsible for registering and
* initializing all the supported controls, both regular controls and the group
* controls.
*
* @since 1.0.0
*/
class Controls_Manager {
/**
* Content tab.
*/
const TAB_CONTENT = 'content';
/**
* Style tab.
*/
const TAB_STYLE = 'style';
/**
* Advanced tab.
*/
const TAB_ADVANCED = 'advanced';
/**
* Responsive tab.
*/
const TAB_RESPONSIVE = 'responsive';
/**
* Layout tab.
*/
const TAB_LAYOUT = 'layout';
/**
* Settings tab.
*/
const TAB_SETTINGS = 'settings';
/**
* Text control.
*/
const TEXT = 'text';
/**
* Number control.
*/
const NUMBER = 'number';
/**
* Textarea control.
*/
const TEXTAREA = 'textarea';
/**
* Select control.
*/
const SELECT = 'select';
const LISTCHECKS = 'listchecks';
/**
* Switcher control.
*/
const SWITCHER = 'switcher';
/**
* Button control.
*/
const BUTTON = 'button';
/**
* Hidden control.
*/
const HIDDEN = 'hidden';
/**
* Heading control.
*/
const HEADING = 'heading';
/**
* Raw HTML control.
*/
const RAW_HTML = 'raw_html';
/**
* Deprecated Notice control.
*/
const DEPRECATED_NOTICE = 'deprecated_notice';
/**
* Popover Toggle control.
*/
const POPOVER_TOGGLE = 'popover_toggle';
/**
* Section control.
*/
const SECTION = 'section';
/**
* Tab control.
*/
const TAB = 'tab';
/**
* Tabs control.
*/
const TABS = 'tabs';
/**
* Divider control.
*/
const DIVIDER = 'divider';
/**
* Color control.
*/
const COLOR = 'color';
/**
* Media control.
*/
const MEDIA = 'media';
/**
* Slider control.
*/
const SLIDER = 'slider';
/**
* Dimensions control.
*/
const DIMENSIONS = 'dimensions';
/**
* Choose control.
*/
const CHOOSE = 'choose';
/**
* WYSIWYG control.
*/
const WYSIWYG = 'wysiwyg';
/**
* Code control.
*/
const CODE = 'code';
/**
* Font control.
*/
const FONT = 'font';
/**
* Image dimensions control.
*/
const IMAGE_DIMENSIONS = 'image_dimensions';
/**
* WordPress widget control.
*/
const WP_WIDGET = 'wp_widget';
/**
* URL control.
*/
const URL = 'url';
/**
* Repeater control.
*/
const REPEATER = 'repeater';
/**
* Icon control.
*/
const ICON = 'icon';
/**
* Icons control.
*/
const ICONS = 'icons';
/**
* Gallery control.
*/
const GALLERY = 'gallery';
/**
* Structure control.
*/
const STRUCTURE = 'structure';
/**
* Select2 control.
*/
const SELECT2 = 'select2';
/**
* Date/Time control.
*/
const DATE_TIME = 'date_time';
/**
* Box shadow control.
*/
const BOX_SHADOW = 'box_shadow';
/**
* Text shadow control.
*/
const TEXT_SHADOW = 'text_shadow';
/**
* Entrance animation control.
*/
const ANIMATION = 'animation';
/**
* Hover animation control.
*/
const HOVER_ANIMATION = 'hover_animation';
/**
* Exit animation control.
*/
const EXIT_ANIMATION = 'exit_animation';
const AUTOCOMPLETE = 'autocomplete';
/**
* Controls.
*
* Holds the list of all the controls. Default is `null`.
*
* @since 1.0.0
* @access private
*
* @var Base_Control[]
*/
private $controls = null;
/**
* Control groups.
*
* Holds the list of all the control groups. Default is an empty array.
*
* @since 1.0.0
* @access private
*
* @var Group_Control_Base[]
*/
private $control_groups = [];
/**
* Control stacks.
*
* Holds the list of all the control stacks. Default is an empty array.
*
* @since 1.0.0
* @access private
*
* @var array
*/
private $stacks = [];
/**
* Tabs.
*
* Holds the list of all the tabs.
*
* @since 1.0.0
* @access private
* @static
*
* @var array
*/
private static $tabs;
/**
* Init tabs.
*
* Initialize control tabs.
*
* @since 1.6.0
* @access private
* @static
*/
private static function init_tabs() {
self::$tabs = [
self::TAB_CONTENT => Leo_Helper::__( 'Content', 'elementor' ),
self::TAB_STYLE => Leo_Helper::__( 'Style', 'elementor' ),
self::TAB_ADVANCED => Leo_Helper::__( 'Advanced', 'elementor' ),
self::TAB_RESPONSIVE => Leo_Helper::__( 'Responsive', 'elementor' ),
self::TAB_LAYOUT => Leo_Helper::__( 'Layout', 'elementor' ),
self::TAB_SETTINGS => Leo_Helper::__( 'Settings', 'elementor' ),
];
}
/**
* Get tabs.
*
* Retrieve the tabs of the current control.
*
* @since 1.6.0
* @access public
* @static
*
* @return array Control tabs.
*/
public static function get_tabs() {
if ( ! self::$tabs ) {
self::init_tabs();
}
return self::$tabs;
}
/**
* Add tab.
*
* This method adds a new tab to the current control.
*
* @since 1.6.0
* @access public
* @static
*
* @param string $tab_name Tab name.
* @param string $tab_label Tab label.
*/
public static function add_tab( $tab_name, $tab_label ) {
if ( ! self::$tabs ) {
self::init_tabs();
}
if ( isset( self::$tabs[ $tab_name ] ) ) {
return;
}
self::$tabs[ $tab_name ] = $tab_label;
}
public static function get_groups_names() {
// Group name must use "-" instead of "_"
return [
'background',
'border',
'typography',
'image-size',
'box-shadow',
'css-filter',
'text-shadow',
];
}
public static function get_controls_names() {
return [
self::TEXT,
self::NUMBER,
self::TEXTAREA,
self::SELECT,
self::LISTCHECKS,
self::SWITCHER,
self::BUTTON,
self::HIDDEN,
self::HEADING,
self::RAW_HTML,
self::POPOVER_TOGGLE,
self::SECTION,
self::TAB,
self::TABS,
self::DIVIDER,
self::DEPRECATED_NOTICE,
self::COLOR,
self::MEDIA,
self::SLIDER,
self::DIMENSIONS,
self::CHOOSE,
self::WYSIWYG,
self::CODE,
self::FONT,
self::IMAGE_DIMENSIONS,
self::WP_WIDGET,
self::URL,
self::REPEATER,
self::ICON,
self::ICONS,
self::GALLERY,
self::STRUCTURE,
self::SELECT2,
self::DATE_TIME,
self::BOX_SHADOW,
self::TEXT_SHADOW,
self::ANIMATION,
self::HOVER_ANIMATION,
self::EXIT_ANIMATION,
self::AUTOCOMPLETE
];
}
/**
* Register controls.
*
* This method creates a list of all the supported controls by requiring the
* control files and initializing each one of them.
*
* The list of supported controls includes the regular controls and the group
* controls.
*
* External developers can register new controls by hooking to the
* `elementor/controls/controls_registered` action.
*
* @since 1.0.0
* @access private
*/
private function register_controls() {
$this->controls = [];
foreach ( self::get_controls_names() as $control_id ) {
$control_class_id = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $control_id ) ) );
$class_name = __NAMESPACE__ . '\Control_' . $control_class_id;
$this->register_control( $control_id, new $class_name() );
}
// Group Controls
foreach ( self::get_groups_names() as $group_name ) {
$group_class_id = str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $group_name ) ) );
$class_name = __NAMESPACE__ . '\Group_Control_' . $group_class_id;
$this->control_groups[ $group_name ] = new $class_name();
}
/**
* After controls registered.
*
* Fires after Elementor controls are registered.
*
* @since 1.0.0
*
* @param Controls_Manager $this The controls manager.
*/
Leo_Helper::do_action( 'elementor/controls/controls_registered', $this );
}
/**
* Register control.
*
* This method adds a new control to the controls list. It adds any given
* control to any given control instance.
*
* @since 1.0.0
* @access public
*
* @param string $control_id Control ID.
* @param Base_Control $control_instance Control instance, usually the
* current instance.
*/
public function register_control( $control_id, Base_Control $control_instance ) {
$this->controls[ $control_id ] = $control_instance;
}
/**
* Unregister control.
*
* This method removes control from the controls list.
*
* @since 1.0.0
* @access public
*
* @param string $control_id Control ID.
*
* @return bool True if the control was removed, False otherwise.
*/
public function unregister_control( $control_id ) {
if ( ! isset( $this->controls[ $control_id ] ) ) {
return false;
}
unset( $this->controls[ $control_id ] );
return true;
}
/**
* Get controls.
*
* Retrieve the controls list from the current instance.
*
* @since 1.0.0
* @access public
*
* @return Base_Control[] Controls list.
*/
public function get_controls() {
if ( null === $this->controls ) {
$this->register_controls();
}
return $this->controls;
}
/**
* Get control.
*
* Retrieve a specific control from the current controls instance.
*
* @since 1.0.0
* @access public
*
* @param string $control_id Control ID.
*
* @return bool|Base_Control Control instance, or False otherwise.
*/
public function get_control( $control_id ) {
$controls = $this->get_controls();
return isset( $controls[ $control_id ] ) ? $controls[ $control_id ] : false;
}
/**
* Get controls data.
*
* Retrieve all the registered controls and all the data for each control.
*
* @since 1.0.0
* @access public
*
* @return array {
* Control data.
*
* @type array $name Control data.
* }
*/
public function get_controls_data() {
$controls_data = [];
foreach ( $this->get_controls() as $name => $control ) {
$controls_data[ $name ] = $control->get_settings();
}
return $controls_data;
}
/**
* Render controls.
*
* Generate the final HTML for all the registered controls using the element
* template.
*
* @since 1.0.0
* @access public
*/
public function render_controls() {
foreach ( $this->get_controls() as $control ) {
$control->print_template();
}
}
/**
* Get control groups.
*
* Retrieve a specific group for a given ID, or a list of all the control
* groups.
*
* If the given group ID is wrong, it will return `null`. When the ID valid,
* it will return the group control instance. When no ID was given, it will
* return all the control groups.
*
* @since 1.0.10
* @access public
*
* @param string $id Optional. Group ID. Default is null.
*
* @return null|Group_Control_Base|Group_Control_Base[]
*/
public function get_control_groups( $id = null ) {
if ( $id ) {
return isset( $this->control_groups[ $id ] ) ? $this->control_groups[ $id ] : null;
}
return $this->control_groups;
}
/**
* Add group control.
*
* This method adds a new group control to the control groups list. It adds
* any given group control to any given group control instance.
*
* @since 1.0.0
* @access public
*
* @param string $id Group control ID.
* @param Group_Control_Base $instance Group control instance, usually the
* current instance.
*
* @return Group_Control_Base Group control instance.
*/
public function add_group_control( $id, $instance ) {
$this->control_groups[ $id ] = $instance;
return $instance;
}
/**
* Enqueue control scripts and styles.
*
* Used to register and enqueue custom scripts and styles used by the control.
*
* @since 1.0.0
* @access public
*/
public function enqueue_control_scripts() {
foreach ( $this->get_controls() as $control ) {
$control->enqueue();
}
}
/**
* Open new stack.
*
* This method adds a new stack to the control stacks list. It adds any
* given stack to the current control instance.
*
* @since 1.0.0
* @access public
*
* @param Controls_Stack $controls_stack Controls stack.
*/
public function open_stack( Controls_Stack $controls_stack ) {
$stack_id = $controls_stack->get_unique_name();
$this->stacks[ $stack_id ] = [
'tabs' => [],
'controls' => [],
];
}
/**
* Add control to stack.
*
* This method adds a new control to the stack.
*
* @since 1.0.0
* @access public
*
* @param Controls_Stack $element Element stack.
* @param string $control_id Control ID.
* @param array $control_data Control data.
* @param array $options Optional. Control additional options.
* Default is an empty array.
*
* @return bool True if control added, False otherwise.
*/
public function add_control_to_stack( Controls_Stack $element, $control_id, $control_data, $options = [] ) {
$default_options = [
'overwrite' => false,
'index' => null,
];
$options = array_merge( $default_options, $options );
$default_args = [
'type' => self::TEXT,
'tab' => self::TAB_CONTENT,
];
$control_data['name'] = $control_id;
$control_data = array_merge( $default_args, $control_data );
$control_type_instance = $this->get_control( $control_data['type'] );
if ( ! $control_type_instance ) {
_doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), sprintf( 'Control type "%s" not found.', $control_data['type'] ), '1.0.0' );
return false;
}
if ( $control_type_instance instanceof Base_Data_Control ) {
$control_default_value = $control_type_instance->get_default_value();
if ( is_array( $control_default_value ) ) {
$control_data['default'] = isset( $control_data['default'] ) ? array_merge( $control_default_value, $control_data['default'] ) : $control_default_value;
} else {
$control_data['default'] = isset( $control_data['default'] ) ? $control_data['default'] : $control_default_value;
}
}
$stack_id = $element->get_unique_name();
if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
_doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), sprintf( 'Cannot redeclare control with same name "%s".', $control_id ), '1.0.0' );
return false;
}
$tabs = self::get_tabs();
if ( ! isset( $tabs[ $control_data['tab'] ] ) ) {
$control_data['tab'] = $default_args['tab'];
}
$this->stacks[ $stack_id ]['tabs'][ $control_data['tab'] ] = $tabs[ $control_data['tab'] ];
$this->stacks[ $stack_id ]['controls'][ $control_id ] = $control_data;
if ( null !== $options['index'] ) {
$controls = $this->stacks[ $stack_id ]['controls'];
$controls_keys = array_keys( $controls );
array_splice( $controls_keys, $options['index'], 0, $control_id );
$this->stacks[ $stack_id ]['controls'] = array_merge( array_flip( $controls_keys ), $controls );
}
return true;
}
/**
* Remove control from stack.
*
* This method removes a control a the stack.
*
* @since 1.0.0
* @access public
*
* @param string $stack_id Stack ID.
* @param array|string $control_id The ID of the control to remove.
*
* @return bool|\WP_Error True if the stack was removed, False otherwise.
*/
public function remove_control_from_stack( $stack_id, $control_id ) {
if ( is_array( $control_id ) ) {
foreach ( $control_id as $id ) {
$this->remove_control_from_stack( $stack_id, $id );
}
return true;
}
if ( empty( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
return new \WP_Error( 'Cannot remove not-exists control.' );
}
unset( $this->stacks[ $stack_id ]['controls'][ $control_id ] );
return true;
}
/**
* Get control from stack.
*
* Retrieve a specific control for a given a specific stack.
*
* If the given control does not exist in the stack, or the stack does not
* exist, it will return `WP_Error`. Otherwise, it will retrieve the control
* from the stack.
*
* @since 1.1.0
* @access public
*
* @param string $stack_id Stack ID.
* @param string $control_id Control ID.
*
* @return array|\WP_Error The control, or an error.
*/
public function get_control_from_stack( $stack_id, $control_id ) {
if ( empty( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
return new \WP_Error( 'Cannot get a not-exists control.' );
}
return $this->stacks[ $stack_id ]['controls'][ $control_id ];
}
/**
* Update control in stack.
*
* This method updates the control data for a given stack.
*
* @since 1.1.0
* @access public
*
* @param Controls_Stack $element Element stack.
* @param string $control_id Control ID.
* @param array $control_data Control data.
* @param array $options Optional. Control additional options.
* Default is an empty array.
*
* @return bool True if control updated, False otherwise.
*/
public function update_control_in_stack( Controls_Stack $element, $control_id, $control_data, array $options = [] ) {
$old_control_data = $this->get_control_from_stack( $element->get_unique_name(), $control_id );
if ( Leo_Helper::is_wp_error( $old_control_data ) ) {
return false;
}
if ( ! empty( $options['recursive'] ) ) {
$control_data = array_replace_recursive( $old_control_data, $control_data );
} else {
$control_data = array_merge( $old_control_data, $control_data );
}
return $this->add_control_to_stack( $element, $control_id, $control_data, [
'overwrite' => true,
] );
}
/**
* Get stacks.
*
* Retrieve a specific stack for the list of stacks.
*
* If the given stack is wrong, it will return `null`. When the stack valid,
* it will return the the specific stack. When no stack was given, it will
* return all the stacks.
*
* @since 1.7.1
* @access public
*
* @param string $stack_id Optional. stack ID. Default is null.
*
* @return null|array A list of stacks.
*/
public function get_stacks( $stack_id = null ) {
if ( $stack_id ) {
if ( isset( $this->stacks[ $stack_id ] ) ) {
return $this->stacks[ $stack_id ];
}
return null;
}
return $this->stacks;
}
/**
* Get element stack.
*
* Retrieve a specific stack for the list of stacks from the current instance.
*
* @since 1.0.0
* @access public
*
* @param Controls_Stack $controls_stack Controls stack.
*
* @return null|array Stack data if it exist, `null` otherwise.
*/
public function get_element_stack( Controls_Stack $controls_stack ) {
$stack_id = $controls_stack->get_unique_name();
if ( ! isset( $this->stacks[ $stack_id ] ) ) {
return null;
}
return $this->stacks[ $stack_id ];
}
/**
* Add custom CSS controls.
*
* This method adds a new control for the "Custom CSS" feature. The free
* version of elementor uses this method to display an upgrade message to
* Elementor Pro.
*
* @since 1.0.0
* @access public
*
* @param Controls_Stack $controls_stack.
*/
public function add_custom_css_controls( Controls_Stack $controls_stack ) {
$controls_stack->start_controls_section(
'section_custom_css_pro',
[
'label' => Leo_Helper::__( 'Custom CSS', 'elementor' ),
'tab' => self::TAB_ADVANCED,
]
);
$controls_stack->add_control(
'custom_css_title',
[
'raw' => Leo_Helper::__( 'Add your own custom CSS here', 'elementor' ),
'type' => self::RAW_HTML,
]
);
$controls_stack->add_control(
'custom_css',
[
'type' => self::CODE,
'label' => Leo_Helper::__( 'Custom CSS', 'elementor' ),
'language' => 'css',
'render_type' => 'ui',
'show_label' => false,
'separator' => 'none',
]
);
$controls_stack->add_control(
'custom_css_description',
[
'raw' => Leo_Helper::__( 'Use "selector" to target wrapper element. Examples:<br>selector {color: red;} // For main element<br>selector .child-element {margin: 10px;} // For child element<br>.my-class {text-align: center;} // Or use any custom selector', 'elementor' ),
'type' => self::RAW_HTML,
'content_classes' => 'elementor-descriptor',
]
);
$controls_stack->end_controls_section();
}
/**
* Add custom attributes controls.
*
* This method adds a new control for the "Custom Attributes" feature. The free
* version of elementor uses this method to display an upgrade message to
* Elementor Pro.
*
* @since 2.8.3
* @access public
*
* @param Controls_Stack $controls_stack.
*/
public function add_custom_attributes_controls( Controls_Stack $controls_stack ) {
$controls_stack->start_controls_section(
'_section_attributes',
[
'label' => Leo_Helper::__( 'Attributes', 'elementor' ),
'tab' => Controls_Manager::TAB_ADVANCED,
]
);
$controls_stack->add_control(
'_attributes',
[
'label' => Leo_Helper::__( 'Custom Attributes', 'elementor' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'placeholder' => Leo_Helper::__( 'key|value', 'elementor' ),
'description' => sprintf( Leo_Helper::__( 'Set custom attributes for the wrapper element. Each attribute in a separate line. Separate attribute key from the value using %s character.', 'elementor' ), '<code>|</code>' ),
'classes' => 'elementor-control-direction-ltr',
]
);
$controls_stack->end_controls_section();
}
}

View File

@@ -0,0 +1,333 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor elements manager.
*
* Elementor elements manager handler class is responsible for registering and
* initializing all the supported elements.
*
* @since 1.0.0
*/
class Elements_Manager {
/**
* Element types.
*
* Holds the list of all the element types.
*
* @access private
*
* @var Element_Base[]
*/
private $_element_types;
/**
* Element categories.
*
* Holds the list of all the element categories.
*
* @access private
*
* @var
*/
private $categories;
/**
* Elements constructor.
*
* Initializing Elementor elements manager.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
$this->require_files();
}
/**
* Create element instance.
*
* This method creates a new element instance for any given element.
*
* @since 1.0.0
* @access public
*
* @param array $element_data Element data.
* @param array $element_args Optional. Element arguments. Default is
* an empty array.
* @param Element_Base $element_type Optional. Element type. Default is null.
*
* @return Element_Base|null Element instance if element created, or null
* otherwise.
*/
public function create_element_instance( array $element_data, array $element_args = [], Element_Base $element_type = null ) {
if ( null === $element_type ) {
if ( 'widget' === $element_data['elType'] ) {
$element_type = Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] );
} else {
$element_type = $this->get_element_types( $element_data['elType'] );
}
}
if ( ! $element_type ) {
return null;
}
$args = array_merge( $element_type->get_default_args(), $element_args );
$element_class = $element_type->get_class_name();
try {
$element = new $element_class( $element_data, $args );
} catch ( \Exception $e ) {
return null;
}
return $element;
}
/**
* Get element categories.
*
* Retrieve the list of categories the element belongs to.
*
* @since 1.0.0
* @access public
*
* @return array Element categories.
*/
public function get_categories() {
if ( null === $this->categories ) {
$this->init_categories();
}
return $this->categories;
}
/**
* Add element category.
*
* Register new category for the element.
*
* @since 1.7.12
* @access public
*
* @param string $category_name Category name.
* @param array $category_properties Category properties.
*/
public function add_category( $category_name, $category_properties ) {
if ( null === $this->categories ) {
$this->get_categories();
}
if ( ! isset( $this->categories[ $category_name ] ) ) {
$this->categories[ $category_name ] = $category_properties;
}
}
/**
* Register element type.
*
* Add new type to the list of registered types.
*
* @since 1.0.0
* @access public
*
* @param Element_Base $element Element instance.
*
* @return bool Whether the element type was registered.
*/
public function register_element_type( Element_Base $element ) {
$this->_element_types[ $element->get_name() ] = $element;
return true;
}
/**
* Unregister element type.
*
* Remove element type from the list of registered types.
*
* @since 1.0.0
* @access public
*
* @param string $name Element name.
*
* @return bool Whether the element type was unregister, or not.
*/
public function unregister_element_type( $name ) {
if ( ! isset( $this->_element_types[ $name ] ) ) {
return false;
}
unset( $this->_element_types[ $name ] );
return true;
}
/**
* Get element types.
*
* Retrieve the list of all the element types, or if a specific element name
* was provided retrieve his element types.
*
* @since 1.0.0
* @access public
*
* @param string $element_name Optional. Element name. Default is null.
*
* @return null|Element_Base|Element_Base[] Element types, or a list of all the element
* types, or null if element does not exist.
*/
public function get_element_types( $element_name = null ) {
if ( is_null( $this->_element_types ) ) {
$this->init_elements();
}
if ( null !== $element_name ) {
return isset( $this->_element_types[ $element_name ] ) ? $this->_element_types[ $element_name ] : null;
}
return $this->_element_types;
}
/**
* Get element types config.
*
* Retrieve the config of all the element types.
*
* @since 1.0.0
* @access public
*
* @return array Element types config.
*/
public function get_element_types_config() {
$config = [];
foreach ( $this->get_element_types() as $element ) {
$config[ $element->get_name() ] = $element->get_config();
}
return $config;
}
/**
* Render elements content.
*
* Used to generate the elements templates on the editor.
*
* @since 1.0.0
* @access public
*/
public function render_elements_content() {
foreach ( $this->get_element_types() as $element_type ) {
$element_type->print_template();
}
}
/**
* Init elements.
*
* Initialize Elementor elements by registering the supported elements.
* Elementor supports by default `section` element and `column` element.
*
* @since 2.0.0
* @access private
*/
private function init_elements() {
$this->_element_types = [];
foreach ( [ 'section', 'column' ] as $element_name ) {
$class_name = __NAMESPACE__ . '\Element_' . $element_name;
$this->register_element_type( new $class_name() );
}
/**
* After elements registered.
*
* Fires after Elementor elements are registered.
*
* @since 1.0.0
*/
Leo_Helper::do_action( 'elementor/elements/elements_registered' );
}
/**
* Init categories.
*
* Initialize the element categories.
*
* @since 1.7.12
* @access private
*/
private function init_categories() {
$this->categories = [
'leoelements' => [
'title' => Leo_Helper::__( 'Leo Elements', 'elementor' ),
],
'basic' => [
'title' => Leo_Helper::__( 'Basic', 'elementor' ),
'icon' => 'eicon-font',
],
'general' => [
'title' => Leo_Helper::__( 'General', 'elementor' ),
'icon' => 'eicon-font',
],
];
/**
* When categories are registered.
*
* Fires after basic categories are registered, before WordPress
* category have been registered.
*
* This is where categories registered by external developers are
* added.
*
* @since 2.0.0
*
* @param Elements_Manager $this Elements manager instance.
*/
Leo_Helper::do_action( 'elementor/elements/categories_registered', $this );
}
/**
* Require files.
*
* Require Elementor element base class and column, section and repeater
* elements.
*
* @since 1.0.0
* @access private
*/
private function require_files() {
require_once LEOELEMENTS_PATH . 'includes/base/element-base.php';
require LEOELEMENTS_PATH . 'includes/elements/column.php';
require LEOELEMENTS_PATH . 'includes/elements/section.php';
require LEOELEMENTS_PATH . 'includes/elements/repeater.php';
}
}

View File

@@ -0,0 +1,497 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Core\Common\Modules\Ajax\Module as Ajax;
use LeoElements\Core\Files\Assets\Svg\Svg_Handler;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icons manager.
*
* Elementor icons manager handler class
*
* @since 1.0.0
*/
class Icons_Manager {
const NEEDS_UPDATE_OPTION = 'icon_manager_needs_update';
/**
* Tabs.
*
* Holds the list of all the tabs.
*
* @access private
* @static
* @since 1.0.0
* @var array
*/
private static $tabs;
private static function get_needs_upgrade_option() {
return true;
return Leo_Helper::get_option( 'elementor_' . self::NEEDS_UPDATE_OPTION, null );
}
/**
* register styles
*
* Used to register all icon types stylesheets so they could be enqueued later by widgets
*/
public function register_styles() {
$config = self::get_icon_manager_tabs_config();
$shared_styles = [];
foreach ( $config as $type => $icon_type ) {
if ( ! isset( $icon_type['url'] ) ) {
continue;
}
$dependencies = [];
if ( isset( $icon_type['enqueue'] ) ) {
foreach ( (array) $icon_type['enqueue'] as $font_css_url ) {
if ( ! in_array( $font_css_url, array_keys( $shared_styles ) ) ) {
$style_handle = 'elementor-icons-shared-' . count( $shared_styles );
Leo_Helper::wp_register_style(
$style_handle,
$font_css_url,
[],
$icon_type['ver']
);
$shared_styles[ $font_css_url ] = $style_handle;
}
$dependencies[] = $shared_styles[ $font_css_url ];
}
}
Leo_Helper::wp_register_style(
'elementor-icons-' . $icon_type['name'],
$icon_type['url'],
$dependencies,
$icon_type['ver']
);
}
}
/**
* Init Tabs
*
* Initiate Icon Manager Tabs.
*
* @access private
* @static
* @since 1.0.0
*/
private static function init_tabs() {
self::$tabs = Leo_Helper::apply_filters( 'elementor/icons_manager/native', [
'fa-regular' => [
'name' => 'fa-regular',
'label' => Leo_Helper::__( 'Font Awesome - Regular', 'elementor' ),
'url' => self::get_fa_asset_url( 'regular' ),
'enqueue' => [ self::get_fa_asset_url( 'fontawesome' ) ],
'prefix' => 'fa-',
'displayPrefix' => 'far',
'labelIcon' => 'fab fa-font-awesome-alt',
'ver' => '5.9.0',
'fetchJson' => self::get_fa_asset_url( 'regular', 'json', false ),
'native' => true,
],
'fa-solid' => [
'name' => 'fa-solid',
'label' => Leo_Helper::__( 'Font Awesome - Solid', 'elementor' ),
'url' => self::get_fa_asset_url( 'solid' ),
'enqueue' => [ self::get_fa_asset_url( 'fontawesome' ) ],
'prefix' => 'fa-',
'displayPrefix' => 'fas',
'labelIcon' => 'fab fa-font-awesome',
'ver' => '5.9.0',
'fetchJson' => self::get_fa_asset_url( 'solid', 'json', false ),
'native' => true,
],
'fa-brands' => [
'name' => 'fa-brands',
'label' => Leo_Helper::__( 'Font Awesome - Brands', 'elementor' ),
'url' => self::get_fa_asset_url( 'brands' ),
'enqueue' => [ self::get_fa_asset_url( 'fontawesome' ) ],
'prefix' => 'fa-',
'displayPrefix' => 'fab',
'labelIcon' => 'fab fa-font-awesome-flag',
'ver' => '5.9.0',
'fetchJson' => self::get_fa_asset_url( 'brands', 'json', false ),
'native' => true,
],
'line-awesome' => [
'name' => 'line-awesome',
'label' => Leo_Helper::__( 'Line Awesome', 'elementor' ),
'url' => LEOELEMENTS_ASSETS_URL . 'lib/line-awesome/line-awesome.min.css',
'enqueue' => [],
'prefix' => 'la-',
'displayPrefix' => 'la',
'labelIcon' => 'la la-flag',
'ver' => '1.3.0',
'fetchJson' => LEOELEMENTS_ASSETS_URL . 'lib/line-awesome/line-awesome.json',
'native' => true,
],
'pe-icon' => [
'name' => 'pe-icon',
'label' => Leo_Helper::__( 'Pe Icon', 'elementor' ),
'url' => LEOELEMENTS_ASSETS_URL . 'lib/pe-icon/Pe-icon-7-stroke.min.css',
'enqueue' => [],
'prefix' => 'pe-7s-',
'displayPrefix' => '',
'labelIcon' => 'pe-7s-flag',
'ver' => '1.2.0',
'fetchJson' => LEOELEMENTS_ASSETS_URL . 'lib/pe-icon/Pe-icon.json',
'native' => true,
],
] );
}
/**
* Get Icon Manager Tabs
* @return array
*/
public static function get_icon_manager_tabs() {
if ( ! self::$tabs ) {
self::init_tabs();
}
$additional_tabs = Leo_Helper::apply_filters( 'elementor/icons_manager/additional_tabs', [] );
return array_merge( self::$tabs, $additional_tabs );
}
public static function enqueue_shim() {
Leo_Helper::wp_enqueue_script(
'font-awesome-4-shim',
self::get_fa_asset_url( 'v4-shims', 'js' ),
[],
LEOELEMENTS_VERSION
);
Leo_Helper::wp_enqueue_style(
'font-awesome-5-all',
self::get_fa_asset_url( 'all' ),
[],
LEOELEMENTS_VERSION
);
Leo_Helper::wp_enqueue_style(
'font-awesome-4-shim',
self::get_fa_asset_url( 'v4-shims' ),
[],
LEOELEMENTS_VERSION
);
}
private static function get_fa_asset_url( $filename, $ext_type = 'css', $add_suffix = true ) {
static $is_test_mode = null;
if ( null === $is_test_mode ) {
$is_test_mode = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'LEOELEMENTS_TESTS' ) && LEOELEMENTS_TESTS;
}
$url = LEOELEMENTS_ASSETS_URL . 'lib/font-awesome/' . $ext_type . '/' . $filename;
if ( ! $is_test_mode && $add_suffix ) {
$url .= '.min';
}
return $url . '.' . $ext_type;
}
public static function get_icon_manager_tabs_config() {
$tabs = [
'all' => [
'name' => 'all',
'label' => Leo_Helper::__( 'All Icons', 'elementor' ),
'labelIcon' => 'eicon-filter',
'native' => true,
],
];
return array_values( array_merge( $tabs, self::get_icon_manager_tabs() ) );
}
private static function render_svg_icon( $value ) {
if ( ! isset( $value['url'] ) ) {
return '';
}
return Svg_Handler::get_inline_svg( $value['url'] );
}
private static function render_icon_html( $icon, $attributes = [], $tag = 'i' ) {
$icon_types = self::get_icon_manager_tabs();
if ( isset( $icon_types[ $icon['library'] ]['render_callback'] ) && is_callable( $icon_types[ $icon['library'] ]['render_callback'] ) ) {
return call_user_func_array( $icon_types[ $icon['library'] ]['render_callback'], [ $icon, $attributes, $tag ] );
}
if ( empty( $attributes['class'] ) ) {
$attributes['class'] = $icon['value'];
} else {
if ( is_array( $attributes['class'] ) ) {
$attributes['class'][] = $icon['value'];
} else {
$attributes['class'] .= ' ' . $icon['value'];
}
}
return '<' . $tag . ' ' . Utils::render_html_attributes( $attributes ) . '></' . $tag . '>';
}
/**
* Render Icon
*
* Used to render Icon for \Elementor\Controls_Manager::ICONS
* @param array $icon Icon Type, Icon value
* @param array $attributes Icon HTML Attributes
* @param string $tag Icon HTML tag, defaults to <i>
*
* @return mixed|string
*/
public static function render_icon( $icon, $attributes = [], $tag = 'i' ) {
if ( empty( $icon['library'] ) ) {
return false;
}
$output = '';
// handler SVG Icon
if ( 'svg' === $icon['library'] ) {
$output = self::render_svg_icon( $icon['value'] );
} else {
$output = self::render_icon_html( $icon, $attributes, $tag );
}
echo $output;
return true;
}
/**
* Font Awesome 4 to font Awesome 5 Value Migration
*
* used to convert string value of Icon control to array value of Icons control
* ex: 'fa fa-star' => [ 'value' => 'fas fa-star', 'library' => 'fa-solid' ]
*
* @param $value
*
* @return array
*/
public static function fa4_to_fa5_value_migration( $value ) {
static $migration_dictionary = false;
if ( '' === $value ) {
return [
'value' => '',
'library' => '',
];
}
if( stripos( $value, 'la la' ) > -1 ){
return [
'value' => $value,
'library' => 'line-awesome',
];
}
if ( false === $migration_dictionary ) {
$migration_dictionary = json_decode( Tools::file_get_contents( LEOELEMENTS_ASSETS_PATH . 'lib/font-awesome/migration/mapping.json' ), true );
}
if ( isset( $migration_dictionary[ $value ] ) ) {
return $migration_dictionary[ $value ];
}
return [
'value' => 'fas ' . str_replace( 'fa ', '', $value ),
'library' => 'fa-solid',
];
}
/**
* on_import_migration
* @param array $element settings array
* @param string $old_control old control id
* @param string $new_control new control id
* @param bool $remove_old boolean weather to remove old control or not
*
* @return array
*/
public static function on_import_migration( array $element, $old_control = '', $new_control = '', $remove_old = false ) {
if ( ! isset( $element['settings'][ $old_control ] ) || isset( $element['settings'][ $new_control ] ) ) {
return $element;
}
// Case when old value is saved as empty string
$new_value = [
'value' => '',
'library' => '',
];
// Case when old value needs migration
if ( ! empty( $element['settings'][ $old_control ] ) && self::is_migration_allowed() ) {
$new_value = self::fa4_to_fa5_value_migration( $element['settings'][ $old_control ] );
}
$element['settings'][ $new_control ] = $new_value;
//remove old value
if ( $remove_old ) {
unset( $element['settings'][ $old_control ] );
}
return $element;
}
/**
* is_migration_allowed
* @return bool
*/
public static function is_migration_allowed() {
static $migration_allowed = true;
if ( false === $migration_allowed ) {
$migration_allowed = null === self::get_needs_upgrade_option();
/**
* allowed to filter migration allowed
*/
$migration_allowed = Leo_Helper::apply_filters( 'elementor/icons_manager/migration_allowed', $migration_allowed );
}
return $migration_allowed;
}
/**
* Register_Admin Settings
*
* adds Font Awesome migration / update admin settings
* @param Settings $settings
*/
public function register_admin_settings( Settings $settings ) {
$settings->add_field(
Settings::TAB_ADVANCED,
Settings::TAB_ADVANCED,
'load_fa4_shim',
[
'label' => Leo_Helper::__( 'Load Font Awesome 4 Support', 'elementor' ),
'field_args' => [
'type' => 'select',
'std' => 1,
'options' => [
'' => Leo_Helper::__( 'No', 'elementor' ),
'yes' => Leo_Helper::__( 'Yes', 'elementor' ),
],
'desc' => Leo_Helper::__( 'Font Awesome 4 support script (shim.js) is a script that makes sure all previously selected Font Awesome 4 icons are displayed correctly while using Font Awesome 5 library.', 'elementor' ),
],
]
);
}
public function register_admin_tools_settings( Tools $settings ) {
$settings->add_tab( 'fontawesome4_migration', [ 'label' => Leo_Helper::__( 'Font Awesome Upgrade', 'elementor' ) ] );
$settings->add_section( 'fontawesome4_migration', 'fontawesome4_migration', [
'callback' => function() {
echo '<h2>' . Leo_Helper::esc_html__( 'Font Awesome Upgrade', 'elementor' ) . '</h2>';
echo '<p>' .
Leo_Helper::esc_html__( 'Access 1,500+ amazing Font Awesome 5 icons and enjoy faster performance and design flexibility.', 'elementor' ) . '<br>' .
Leo_Helper::esc_html__( 'By upgrading, whenever you edit a page containing a Font Awesome 4 icon, Elementor will convert it to the new Font Awesome 5 icon.', 'elementor' ) .
'</p><p><strong>' .
Leo_Helper::esc_html__( 'Please note that the upgrade process may cause some of the previously used Font Awesome 4 icons to look a bit different due to minor design changes made by Font Awesome.', 'elementor' ) .
'</strong></p><p>' .
Leo_Helper::esc_html__( 'This action is not reversible and cannot be undone by rolling back to previous versions.', 'elementor' ) .
'</p>';
},
'fields' => [
[
'label' => Leo_Helper::__( 'Font Awesome Upgrade', 'elementor' ),
'field_args' => [
'type' => 'raw_html',
'html' => sprintf( '<span data-action="%s" data-_nonce="%s" class="button" id="elementor_upgrade_fa_button">%s</span>',
self::NEEDS_UPDATE_OPTION . '_upgrade',
wp_create_nonce( self::NEEDS_UPDATE_OPTION ),
Leo_Helper::__( 'Upgrade To Font Awesome 5', 'elementor' )
),
],
],
],
] );
}
/**
* Ajax Upgrade to FontAwesome 5
*/
public function ajax_upgrade_to_fa5() {
check_ajax_referer( self::NEEDS_UPDATE_OPTION, '_nonce' );
delete_option( 'elementor_' . self::NEEDS_UPDATE_OPTION );
wp_send_json_success( [ 'message' => '<p>' . Leo_Helper::__( 'Hurray! The upgrade process to Font Awesome 5 was completed successfully.', 'elementor' ) . '</p>' ] );
}
/**
* Add Update Needed Flag
* @param array $settings
*
* @return array;
*/
public function add_update_needed_flag( $settings ) {
$settings['icons_update_needed'] = true;
return $settings;
}
public function enqueue_fontawesome_css() {
if ( ! self::is_migration_allowed() ) {
Leo_Helper::wp_enqueue_style( 'font-awesome' );
} else {
$load_shim = Leo_Helper::get_option( 'elementor_load_fa4_shim', false );
if ( 'elementor/editor/after_enqueue_styles' === Leo_Helper::$current_filter ) {
self::enqueue_shim();
} else if ( 'yes' === $load_shim ) {
self::enqueue_shim();
}
}
}
public function add_admin_strings( $settings ) {
$settings['i18n']['confirm_fa_migration_admin_modal_body'] = Leo_Helper::__( 'I understand that by upgrading to Font Awesome 5,', 'elementor' ) . '<br>' . Leo_Helper::__( 'I acknowledge that some changes may affect my website and that this action cannot be undone.', 'elementor' );
$settings['i18n']['confirm_fa_migration_admin_modal_head'] = Leo_Helper::__( 'Font Awesome 5 Migration', 'elementor' );
return $settings;
}
public function register_ajax_actions( Ajax $ajax ) {
$ajax->register_ajax_action( 'enable_svg_uploads', [ $this, 'ajax_enable_svg_uploads' ] );
}
public function ajax_enable_svg_uploads() {
Leo_Helper::update_option( 'elementor_allow_svg', 1 );
}
/**
* Icons Manager constructor
*/
public function __construct() {
$post = $GLOBALS['_POST'];
Leo_Helper::add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_fontawesome_css' ] );
Leo_Helper::add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'enqueue_fontawesome_css' ] );
Leo_Helper::add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] );
// Ajax.
Leo_Helper::add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] );
if ( ! self::is_migration_allowed() ) {
Leo_Helper::add_filter( 'elementor/editor/localize_settings', [ $this, 'add_update_needed_flag' ] );
Leo_Helper::add_action( 'elementor/admin/after_create_settings/' . Tools::PAGE_ID, [ $this, 'register_admin_tools_settings' ], 100 );
if ( ! empty( $post ) ) { // phpcs:ignore -- nonce validation done in callback
Leo_Helper::add_action( 'wp_ajax_' . self::NEEDS_UPDATE_OPTION . '_upgrade', [ $this, 'ajax_upgrade_to_fa5' ] );
}
}
}
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor images manager.
*
* Elementor images manager handler class is responsible for retrieving image
* details.
*
* @since 1.0.0
*/
class Images_Manager {
/**
* Get images details.
*
* Retrieve details for all the images.
*
* Fired by `wp_ajax_elementor_get_images_details` action.
*
* @since 1.0.0
* @access public
*/
public function get_images_details() {
$post = $GLOBALS['_POST'];
$items = $post['items'];
$urls = [];
foreach ( $items as $item ) {
$urls[ $item['id'] ] = $this->get_details( $item['id'], $item['size'], $item['is_first_time'] );
}
echo json_encode( $urls );
}
/**
* Get image details.
*
* Retrieve single image details.
*
* Fired by `wp_ajax_elementor_get_image_details` action.
*
* @since 1.0.0
* @access public
*
* @param string $id Image attachment ID.
* @param string|array $size Image size. Accepts any valid image
* size, or an array of width and height
* values in pixels (in that order).
* @param string $is_first_time Set 'true' string to force reloading
* all image sizes.
*
* @return array URLs with different image sizes.
*/
public function get_details( $id, $size, $is_first_time ) {
if ( ! class_exists( 'Group_Control_Image_Size' ) ) {
require_once LEOELEMENTS_PATH . '/includes/controls/groups/image-size.php';
}
if ( 'true' === $is_first_time ) {
$sizes = get_intermediate_image_sizes();
$sizes[] = 'full';
} else {
$sizes = [];
}
$sizes[] = $size;
$urls = [];
foreach ( $sizes as $size ) {
if ( 0 === strpos( $size, 'custom_' ) ) {
preg_match( '/custom_(\d*)x(\d*)/', $size, $matches );
$instance = [
'image_size' => 'custom',
'image_custom_dimension' => [
'width' => $matches[1],
'height' => $matches[2],
],
];
$urls[ $size ] = Group_Control_Image_Size::get_attachment_image_src( $id, 'image', $instance );
} else {
$urls[ $size ] = wp_get_attachment_image_src( $id, $size )[0];
}
}
return $urls;
}
/**
* Images manager constructor.
*
* Initializing Elementor images manager.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
Leo_Helper::add_action( 'wp_ajax_elementor_get_images_details', [ $this, 'get_images_details' ] );
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2022 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2022 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,363 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
use LeoElements\Core\Common\Modules\Ajax\Module as Ajax;
use LeoElements\TemplateLibrary\Source_Local;
use LeoElements\Leo_Helper;
/**
* Elementor scheme manager.
*
* Elementor scheme manager handler class is responsible for registering and
* initializing all the supported schemes.
*
* @since 1.0.0
*/
class Schemes_Manager {
/**
* Registered schemes.
*
* Holds the list of all the registered schemes.
*
* @access protected
*
* @var Scheme_Base[]
*/
protected $_registered_schemes = [];
/**
* Enabled schemes.
*
* Holds the list of all the enabled schemes.
*
* @access private
* @static
*
* @var array
*/
private static $_enabled_schemes;
/**
* Schemes types.
*
* Holds the list of the schemes types. Default types are `color`,
* `typography` and `color-picker`.
*
* @access private
* @static
*
* @var array
*/
private static $_schemes_types = [
'color' => 'Scheme_Color',
'typography' => 'Scheme_Typography',
'color-picker' => 'Scheme_Color_Picker',
];
/**
* Register new scheme.
*
* Add a new scheme to the schemes list. The method creates a new scheme
* instance for any given scheme class and adds the scheme to the registered
* schemes list.
*
* @since 1.0.0
* @access public
*
* @param string $scheme_class Scheme class name.
*/
public function register_scheme( $scheme_class ) {
/** @var Scheme_Base $scheme_instance */
$scheme_instance = new $scheme_class();
$this->_registered_schemes[ $scheme_instance::get_type() ] = $scheme_instance;
}
/**
* Unregister scheme.
*
* Removes a scheme from the list of registered schemes.
*
* @since 1.0.0
* @access public
*
* @param string $id Scheme ID.
*
* @return bool True if the scheme was removed, False otherwise.
*/
public function unregister_scheme( $id ) {
if ( ! isset( $this->_registered_schemes[ $id ] ) ) {
return false;
}
unset( $this->_registered_schemes[ $id ] );
return true;
}
/**
* Get registered schemes.
*
* Retrieve the registered schemes list from the current instance.
*
* @since 1.0.0
* @access public
*
* @return Scheme_Base[] Registered schemes.
*/
public function get_registered_schemes() {
return $this->_registered_schemes;
}
/**
* Get schemes data.
*
* Retrieve all the registered schemes with data for each scheme.
*
* @since 1.0.0
* @access public
*
* @return array Registered schemes with each scheme data.
*/
public function get_registered_schemes_data() {
$data = [];
foreach ( $this->get_registered_schemes() as $scheme ) {
$data[ $scheme::get_type() ] = [
'title' => $scheme->get_title(),
'disabled_title' => $scheme->get_disabled_title(),
'items' => $scheme->get_scheme(),
];
}
return $data;
}
/**
* Get default schemes.
*
* Retrieve all the registered schemes with default scheme for each scheme.
*
* @since 1.0.0
* @access public
*
* @return array Registered schemes with with default scheme for each scheme.
*/
public function get_schemes_defaults() {
$data = [];
foreach ( $this->get_registered_schemes() as $scheme ) {
$data[ $scheme::get_type() ] = [
'title' => $scheme->get_title(),
'items' => $scheme->get_default_scheme(),
];
}
return $data;
}
/**
* Get system schemes.
*
* Retrieve all the registered schemes with system schemes for each scheme.
*
* @since 1.0.0
* @access public
*
* @return array Registered schemes with with system scheme for each scheme.
*/
public function get_system_schemes() {
$data = [];
foreach ( $this->get_registered_schemes() as $scheme ) {
$data[ $scheme::get_type() ] = $scheme->get_system_schemes();
}
return $data;
}
/**
* Get scheme.
*
* Retrieve a single scheme from the list of all the registered schemes in
* the current instance.
*
* @since 1.0.0
* @access public
*
* @param string $id Scheme ID.
*
* @return false|Scheme_Base Scheme instance if scheme exist, False otherwise.
*/
public function get_scheme( $id ) {
$schemes = $this->get_registered_schemes();
if ( ! isset( $schemes[ $id ] ) ) {
return false;
}
return $schemes[ $id ];
}
/**
* Get scheme value.
*
* Retrieve the scheme value from the list of all the registered schemes in
* the current instance.
*
* @since 1.0.0
* @access public
*
* @param string $scheme_type Scheme type.
* @param string $scheme_value Scheme value.
*
* @return false|string Scheme value if scheme exist, False otherwise.
*/
public function get_scheme_value( $scheme_type, $scheme_value ) {
$scheme = $this->get_scheme( $scheme_type );
if ( ! $scheme ) {
return false;
}
return $scheme->get_scheme_value()[ $scheme_value ];
}
/**
* Ajax apply scheme.
*
* Ajax handler for Elementor apply_scheme.
*
* Fired by `wp_ajax_elementor_apply_scheme` action.
*
* @since 1.0.0
* @access public
*/
public function ajax_apply_scheme( $data ) {
if ( ! User::is_current_user_can_edit_post_type( Source_Local::CPT ) ) {
return false;
}
if ( ! isset( $data['scheme_name'] ) ) {
return false;
}
$scheme_obj = $this->get_scheme( $data['scheme_name'] );
if ( ! $scheme_obj ) {
return false;
}
$posted = json_decode( $data['data'], true );
$scheme_obj->save_scheme( $posted );
return true;
}
/**
* Print schemes templates.
*
* Used to generate the scheme templates on the editor using Underscore JS
* template, for all the registered schemes.
*
* @since 1.0.0
* @access public
*/
public function print_schemes_templates() {
foreach ( $this->get_registered_schemes() as $scheme ) {
$scheme->print_template();
}
}
/**
* @since 1.0.0
* @access public
*/
public function register_ajax_actions( Ajax $ajax ) {
$ajax->register_ajax_action( 'apply_scheme', [ $this, 'ajax_apply_scheme' ] );
}
/**
* Get enabled schemes.
*
* Retrieve all enabled schemes from the list of the registered schemes in
* the current instance.
*
* @since 1.0.0
* @access public
* @static
*
* @return array Enabled schemes.
*/
public static function get_enabled_schemes() {
if ( null === self::$_enabled_schemes ) {
$enabled_schemes = [];
foreach ( self::$_schemes_types as $schemes_type => $scheme_class ) {
if ( 'yes' === Leo_Helper::get_option( 'elementor_disable_' . $schemes_type . '_schemes' ) ) {
continue;
}
$enabled_schemes[] = $schemes_type;
}
/**
* Enabled schemes.
*
* Filters the list of enabled schemes.
*
* @since 1.0.0
*
* @param array $enabled_schemes The list of enabled schemes.
*/
$enabled_schemes = Leo_Helper::apply_filters( 'elementor/schemes/enabled_schemes', $enabled_schemes );
self::$_enabled_schemes = $enabled_schemes;
}
return self::$_enabled_schemes;
}
/**
* Register default schemes.
*
* Add a default schemes to the register schemes list.
*
* This method is used to set initial schemes when initializing the class.
*
* @since 1.7.12
* @access private
*/
private function register_default_schemes() {
foreach ( self::$_schemes_types as $schemes_class ) {
$this->register_scheme( __NAMESPACE__ . '\\' . $schemes_class );
}
}
/**
* Schemes manager constructor.
*
* Initializing Elementor schemes manager and register default schemes.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
$this->register_default_schemes();
Leo_Helper::add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] );
}
}

View File

@@ -0,0 +1,129 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor skins manager.
*
* Elementor skins manager handler class is responsible for registering and
* initializing all the supported skins.
*
* @since 1.0.0
*/
class Skins_Manager {
/**
* Registered Skins.
*
* Holds the list of all the registered skins for all the widgets.
*
* @since 1.0.0
* @access private
*
* @var array Registered skins.
*/
private $_skins = [];
/**
* Add new skin.
*
* Register a single new skin for a widget.
*
* @since 1.0.0
* @access public
*
* @param Widget_Base $widget Elementor widget.
* @param Skin_Base $skin Elementor skin.
*
* @return true True if skin added.
*/
public function add_skin( Widget_Base $widget, Skin_Base $skin ) {
$widget_name = $widget->get_name();
if ( ! isset( $this->_skins[ $widget_name ] ) ) {
$this->_skins[ $widget_name ] = [];
}
$this->_skins[ $widget_name ][ $skin->get_id() ] = $skin;
return true;
}
/**
* Remove a skin.
*
* Unregister an existing skin from a widget.
*
* @since 1.0.0
* @access public
*
* @param Widget_Base $widget Elementor widget.
* @param string $skin_id Elementor skin ID.
*
* @return true|\WP_Error True if skin removed, `WP_Error` otherwise.
*/
public function remove_skin( Widget_Base $widget, $skin_id ) {
$widget_name = $widget->get_name();
if ( ! isset( $this->_skins[ $widget_name ][ $skin_id ] ) ) {
return new \WP_Error( 'Cannot remove not-exists skin.' );
}
unset( $this->_skins[ $widget_name ][ $skin_id ] );
return true;
}
/**
* Get skins.
*
* Retrieve all the skins assigned for a specific widget.
*
* @since 1.0.0
* @access public
*
* @param Widget_Base $widget Elementor widget.
*
* @return false|array Skins if the widget has skins, False otherwise.
*/
public function get_skins( Widget_Base $widget ) {
$widget_name = $widget->get_name();
if ( ! isset( $this->_skins[ $widget_name ] ) ) {
return false;
}
return $this->_skins[ $widget_name ];
}
/**
* Skins manager constructor.
*
* Initializing Elementor skins manager by requiring the skin base class.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
require LEOELEMENTS_PATH . 'includes/base/skin-base.php';
}
}

View File

@@ -0,0 +1,547 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Core\Common\Modules\Ajax\Module as Ajax;
use LeoElements\Core\Utils\Exceptions;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor widgets manager.
*
* Elementor widgets manager handler class is responsible for registering and
* initializing all the supported Elementor widgets.
*
* @since 1.0.0
*/
class Widgets_Manager {
/**
* Widget types.
*
* Holds the list of all the widget types.
*
* @since 1.0.0
* @access private
*
* @var Widget_Base[]
*/
private $_widget_types = null;
private $_leo_widget = null;
/**
* Init widgets.
*
* Initialize Elementor widgets manager. Include all the the widgets files
* and register each Elementor and WordPress widget.
*
* @since 2.0.0
* @access private
*/
private function init_widgets() {
$build_widgets_filename = [
'common',
'heading',
'image',
'text-editor',
'video',
'button',
'divider',
'spacer',
'image-box',
'google-maps',
'icon',
'icon-box',
'star-rating',
'icon-list',
'counter',
'progress',
'testimonial',
'tabs',
'accordion',
'toggle',
'social-icons',
'alert',
'html',
'menu-anchor',
];
$this->_leo_widget = [
'LeoProductCarousel',
'LeoProductTab',
'LeoBlockLink',
'LeoGenCode',
'LeoBlockCarousel',
'LeoManufacturersCarousel',
'LeoInstagram',
'LeoCountDown',
'LeoHotspot',
];
if( \Module::isEnabled('leoslideshow') ) {
$this->_leo_widget[] = 'LeoSlideshow';
}
if( \Module::isEnabled('leobootstrapmenu') ) {
$this->_leo_widget[] = 'LeoBootstrapmenu';
}
if( \Module::isEnabled('leoblog') ) {
$this->_leo_widget[] = 'LeoBlog';
}
$this->_leo_widget[] = 'LeoModule';
$this->_widget_types = [];
$build_widgets_filename = Leo_Helper::wp_parse_args( $build_widgets_filename, $this->_leo_widget );
foreach ( $build_widgets_filename as $widget_filename ) {
include( LEOELEMENTS_PATH . 'includes/widgets/' . $widget_filename . '.php' );
$class_name = str_replace( '-', '_', $widget_filename );
$class_name = __NAMESPACE__ . '\Widget_' . $class_name;
$this->register_widget_type( new $class_name() );
}
/**
* After widgets registered.
*
* Fires after Elementor widgets are registered.
*
* @since 1.0.0
*
* @param Widgets_Manager $this The widgets manager.
*/
Leo_Helper::do_action( 'elementor/widgets/widgets_registered', $this );
}
/**
* Register WordPress widgets.
*
* Add native WordPress widget to the list of registered widget types.
*
* Exclude the widgets that are in Elementor widgets black list. Theme and
* plugin authors can filter the black list.
*
* @since 2.0.0
* @access private
*/
private function register_wp_widgets() {
$wp_widget_factory = &$GLOBALS['wp_widget_factory'];
// Skip Pojo widgets.
$pojo_allowed_widgets = [
'Pojo_Widget_Recent_Posts',
'Pojo_Widget_Posts_Group',
'Pojo_Widget_Gallery',
'Pojo_Widget_Recent_Galleries',
'Pojo_Slideshow_Widget',
'Pojo_Forms_Widget',
'Pojo_Widget_News_Ticker',
'Pojo_Widget_WC_Products',
'Pojo_Widget_WC_Products_Category',
'Pojo_Widget_WC_Product_Categories',
];
// Allow themes/plugins to filter out their widgets.
$black_list = [];
/**
* Elementor widgets black list.
*
* Filters the widgets black list that won't be displayed in the panel.
*
* @since 1.0.0
*
* @param array $black_list A black list of widgets. Default is an empty array.
*/
$black_list = Leo_Helper::apply_filters( 'elementor/widgets/black_list', $black_list );
foreach ( $wp_widget_factory->widgets as $widget_class => $widget_obj ) {
if ( in_array( $widget_class, $black_list ) ) {
continue;
}
if ( $widget_obj instanceof \Pojo_Widget_Base && ! in_array( $widget_class, $pojo_allowed_widgets ) ) {
continue;
}
$elementor_widget_class = __NAMESPACE__ . '\Widget_WordPress';
$this->register_widget_type(
new $elementor_widget_class( [], [
'widget_name' => $widget_class,
] )
);
}
}
/**
* Require files.
*
* Require Elementor widget base class.
*
* @since 2.0.0
* @access private
*/
private function require_files() {
require LEOELEMENTS_PATH . 'includes/base/widget-base.php';
}
/**
* Register widget type.
*
* Add a new widget type to the list of registered widget types.
*
* @since 1.0.0
* @access public
*
* @param Widget_Base $widget Elementor widget.
*
* @return true True if the widget was registered.
*/
public function register_widget_type( Widget_Base $widget ) {
if ( is_null( $this->_widget_types ) ) {
$this->init_widgets();
}
$this->_widget_types[ $widget->get_name() ] = $widget;
return true;
}
/**
* Unregister widget type.
*
* Removes widget type from the list of registered widget types.
*
* @since 1.0.0
* @access public
*
* @param string $name Widget name.
*
* @return true True if the widget was unregistered, False otherwise.
*/
public function unregister_widget_type( $name ) {
if ( ! isset( $this->_widget_types[ $name ] ) ) {
return false;
}
unset( $this->_widget_types[ $name ] );
return true;
}
/**
* Get widget types.
*
* Retrieve the registered widget types list.
*
* @since 1.0.0
* @access public
*
* @param string $widget_name Optional. Widget name. Default is null.
*
* @return Widget_Base|Widget_Base[]|null Registered widget types.
*/
public function get_widget_types( $widget_name = null ) {
if ( is_null( $this->_widget_types ) ) {
$this->init_widgets();
}
if ( null !== $widget_name ) {
return isset( $this->_widget_types[ $widget_name ] ) ? $this->_widget_types[ $widget_name ] : null;
}
return $this->_widget_types;
}
/**
* Get widget types config.
*
* Retrieve all the registered widgets with config for each widgets.
*
* @since 1.0.0
* @access public
*
* @return array Registered widget types with each widget config.
*/
public function get_widget_types_config() {
$config = [];
foreach ( $this->get_widget_types() as $widget_key => $widget ) {
$w_config = $widget->get_config();
if( in_array( $widget_key, $this->_leo_widget ) && !Leo_Helper::api_is_license_active() ){
#
$w_config['editable'] = false;
}
$config[ $widget_key ] = $w_config;
}
return $config;
}
public function ajax_get_widget_types_controls_config( array $data ) {
$config = [];
foreach ( $this->get_widget_types() as $widget_key => $widget ) {
if ( isset( $data['exclude'][ $widget_key ] ) ) {
continue;
}
$config[ $widget_key ] = [
'controls' => $widget->get_stack( false )['controls'],
'tabs_controls' => $widget->get_tabs_controls(),
];
}
return $config;
}
/**
* Ajax render widget.
*
* Ajax handler for Elementor render_widget.
*
* Fired by `wp_ajax_elementor_render_widget` action.
*
* @since 1.0.0
* @access public
*
* @throws \Exception If current user don't have permissions to edit the post.
*
* @param array $request Ajax request.
*
* @return array {
* Rendered widget.
*
* @type string $render The rendered HTML.
* }
*/
public function ajax_render_widget( $request ) {
$post = $GLOBALS['_POST'];
$document = Plugin::$instance->documents->get( $request['editor_post_id'] );
$editor = Plugin::$instance->editor;
$is_edit_mode = $editor->is_edit_mode();
$editor->set_edit_mode( true );
Plugin::$instance->documents->switch_to_document( $document );
if ( isset( $request['data']['id']) )
{
$post['condia_id'] = $request['data']['id'];
}
$render_html = $document->render_element( $request['data'] );
$editor->set_edit_mode( $is_edit_mode );
return [
'render' => $render_html,
];
}
/**
* Ajax get WordPress widget form.
*
* Ajax handler for Elementor editor get_wp_widget_form.
*
* Fired by `wp_ajax_elementor_editor_get_wp_widget_form` action.
*
* @since 1.0.0
* @access public
*
* @param array $request Ajax request.
*
* @return bool|string Rendered widget form.
*/
public function ajax_get_wp_widget_form( $request ) {
if ( empty( $request['widget_type'] ) ) {
return false;
}
if ( empty( $request['data'] ) ) {
$request['data'] = [];
}
$element_data = [
'id' => $request['id'],
'elType' => 'widget',
'widgetType' => $request['widget_type'],
'settings' => $request['data'],
];
/**
* @var $widget_obj Widget_WordPress
*/
$widget_obj = Plugin::$instance->elements_manager->create_element_instance( $element_data );
if ( ! $widget_obj ) {
return false;
}
return $widget_obj->get_form();
}
/**
* Render widgets content.
*
* Used to generate the widget templates on the editor using Underscore JS
* template, for all the registered widget types.
*
* @since 1.0.0
* @access public
*/
public function render_widgets_content() {
foreach ( $this->get_widget_types() as $widget ) {
$widget->print_template();
}
}
/**
* Get widgets frontend settings keys.
*
* Retrieve frontend controls settings keys for all the registered widget
* types.
*
* @since 1.3.0
* @access public
*
* @return array Registered widget types with settings keys for each widget.
*/
public function get_widgets_frontend_settings_keys() {
$keys = [];
foreach ( $this->get_widget_types() as $widget_type_name => $widget_type ) {
$widget_type_keys = $widget_type->get_frontend_settings_keys();
if ( $widget_type_keys ) {
$keys[ $widget_type_name ] = $widget_type_keys;
}
}
return $keys;
}
/**
* Enqueue widgets scripts.
*
* Enqueue all the scripts defined as a dependency for each widget.
*
* @since 1.3.0
* @access public
*/
public function enqueue_widgets_scripts() {
foreach ( $this->get_widget_types() as $widget ) {
$widget->enqueue_scripts();
}
}
/**
* Retrieve inline editing configuration.
*
* Returns general inline editing configurations like toolbar types etc.
*
* @access public
* @since 1.8.0
*
* @return array {
* Inline editing configuration.
*
* @type array $toolbar {
* Toolbar types and the actions each toolbar includes.
* Note: Wysiwyg controls uses the advanced toolbar, textarea controls
* uses the basic toolbar and text controls has no toolbar.
*
* @type array $basic Basic actions included in the edit tool.
* @type array $advanced Advanced actions included in the edit tool.
* }
* }
*/
public function get_inline_editing_config() {
$basic_tools = [
'bold',
'underline',
'italic',
];
$advanced_tools = array_merge( $basic_tools, [
'createlink',
'unlink',
'h1' => [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'p',
'blockquote',
'pre',
],
'list' => [
'insertOrderedList',
'insertUnorderedList',
],
] );
return [
'toolbar' => [
'basic' => $basic_tools,
'advanced' => $advanced_tools,
],
];
}
/**
* Widgets manager constructor.
*
* Initializing Elementor widgets manager.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
$this->require_files();
Leo_Helper::add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] );
}
/**
* Register ajax actions.
*
* Add new actions to handle data after an ajax requests returned.
*
* @since 2.0.0
* @access public
*
* @param Ajax $ajax_manager
*/
public function register_ajax_actions( Ajax $ajax_manager ) {
$ajax_manager->register_ajax_action( 'render_widget', [ $this, 'ajax_render_widget' ] );
$ajax_manager->register_ajax_action( 'editor_get_wp_widget_form', [ $this, 'ajax_get_wp_widget_form' ] );
$ajax_manager->register_ajax_action( 'get_widgets_config', [ $this, 'ajax_get_widget_types_controls_config' ] );
}
}

View File

@@ -0,0 +1,103 @@
<?php
/**
* 2007-2022 Leotheme
*
* NOTICE OF LICENSE
*
* LeoElements is module help you can build content for your shop
*
* DISCLAIMER
*
* @author Leotheme <leotheme@gmail.com>
* @copyright 2007-2022 Leotheme
* @license http://leotheme.com - prestashop template provider
*/
namespace LeoElements;
use LeoElements\Leo_Helper;
if ( ! defined( '_PS_VERSION_' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor WordPress widgets manager.
*
* Elementor WordPress widgets manager handler class is responsible for
* registering and initializing all the supported controls, both regular
* controls and the group controls.
*
* @since 1.5.0
*/
class WordPress_Widgets_Manager {
/**
* WordPress widgets manager constructor.
*
* Initializing the WordPress widgets manager in Elementor editor.
*
* @since 1.5.0
* @access public
*/
public function __construct() {
if ( version_compare( get_bloginfo( 'version' ), '4.8', '<' ) ) {
return;
}
Leo_Helper::add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'before_enqueue_scripts' ] );
Leo_Helper::add_action( 'elementor/editor/footer', [ $this, 'footer' ] );
}
/**
* Before enqueue scripts.
*
* Prints custom scripts required to run WordPress widgets in Elementor
* editor.
*
* Fired by `elementor/editor/before_enqueue_scripts` action.
*
* @since 1.5.0
* @access public
*/
public function before_enqueue_scripts() {
$wp_scripts = &$GLOBALS['wp_scripts'];
$suffix = Utils::is_script_debug() ? '' : '.min';
// TODO: after WP >= 4.9 - it's no needed, Keep for Backward compatibility.
$wp_scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views' ) );
$wp_scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
$wp_scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
$wp_scripts->add( 'media-image-widget', "/wp-admin/js/widgets/media-image-widget$suffix.js", array( 'media-widgets' ) );
$wp_scripts->add( 'media-video-widget', "/wp-admin/js/widgets/media-video-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
$wp_scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'editor', 'wp-util' ) );
$wp_scripts->add_inline_script( 'text-widgets', 'wp.textWidgets.init();', 'after' );
Leo_Helper::wp_enqueue_style( 'widgets' );
Leo_Helper::wp_enqueue_style( 'media-views' );
// End TODO.
// Don't enqueue `code-editor` for WP Custom HTML widget.
wp_get_current_user()->syntax_highlighting = 'false';
/** This action is documented in wp-admin/admin-header.php */
Leo_Helper::do_action( 'admin_print_scripts-widgets.php' );
}
/**
* WordPress widgets footer.
*
* Prints WordPress widgets scripts in Elementor editor footer.
*
* Fired by `elementor/editor/footer` action.
*
* @since 1.5.0
* @access public
*/
public function footer() {
/** This action is documented in wp-admin/admin-footer.php */
Leo_Helper::do_action( 'admin_footer-widgets.php' );
}
}