This commit is contained in:
2025-11-18 16:39:33 +00:00
parent c70394d367
commit df1f90c6cd
9673 changed files with 3464697 additions and 34 deletions
@@ -0,0 +1,75 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
class Custom_JS
{
public function __construct()
{
add_action('elementor/documents/register_controls', [$this, 'section_custom_js'], 20);
}
public function section_custom_js($controls)
{
$controls->start_controls_section(
'eael_ext_section_custom_js',
[
'label' => sprintf('<i class="eaicon-logo"></i> %s', __('Custom JS', 'essential-addons-for-elementor-lite')),
'tab' => Controls_Manager::TAB_ADVANCED,
]
);
$controls->add_control(
'eael_custom_js_label',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('Add your own custom JS here', 'essential-addons-for-elementor-lite'),
]
);
$controls->add_control(
'eael_custom_js',
[
'type' => Controls_Manager::CODE,
'show_label' => false,
'language' => 'javascript',
]
);
if ( ! current_user_can( 'administrator' ) ) {
$controls->add_control(
'eael_custom_js_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __( '<strong>Note:</strong> Only the Administrator can add/edit JavaScript code from here', 'essential-addons-for-elementor-lite' ),
'content_classes' => 'eael-warning',
]
);
}
$controls->add_control(
'eael_custom_js_usage',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('You may use both jQuery selector e.g. $(‘.selector’) or Vanilla JS selector e.g. document.queryselector(‘.selector’)', 'essential-addons-for-elementor-lite'),
'content_classes' => 'elementor-descriptor',
]
);
$controls->add_control(
'eael_custom_js_docs',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('For more information, <a href="https://essential-addons.com/elementor/docs/custom-js/" target="_blank">click here</a>', 'essential-addons-for-elementor-lite'),
'content_classes' => 'elementor-descriptor',
]
);
$controls->end_controls_section();
}
}
@@ -0,0 +1,596 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
use Elementor\Controls_Manager;
use Elementor\Repeater;
use Essential_Addons_Elementor\Classes\Helper;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Image_Masking {
/**
* Initialize hooks
*/
public function __construct() {
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/frontend/before_render', [ $this, 'before_render' ], 100 );
}
private function clip_paths( $shape ){
$shapes = [
'bavel' => 'polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%)',
'rabbet' => 'polygon(0% 15%, 15% 15%, 15% 0%, 85% 0%, 85% 15%, 100% 15%, 100% 85%, 85% 85%, 85% 100%, 15% 100%, 15% 85%, 0% 85%)',
'chevron-left' => 'polygon(100% 0%, 75% 50%, 100% 100%, 25% 100%, 0% 50%, 25% 0%)',
'chevron-right' => 'polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%)',
'star' => 'polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)',
];
return $shapes[$shape] ?? '';
}
private function masking_controllers( $element, $tab = '' ) {
$condition = [];
if( '_hover' === $tab ) {
$element->add_control(
'eael_image_masking_hover_effect',
[
'label' => esc_html__( 'Enable', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
]
);
$condition = [
'eael_image_masking_hover_effect' => 'yes',
];
}
$condition['eael_image_masking_type'] = 'clip';
$image_dir_url = EAEL_PLUGIN_URL . 'assets/front-end/img/image-masking/clip-paths/';
$element->add_control(
'eael_image_masking_clip_path' . $tab,
[
'label' => esc_html__( 'Select Clip Path', 'essential-addons-for-elementor-lite' ),
'label_block' => true,
'type' => Controls_Manager::CHOOSE,
'options' => [
'bavel' => [
'title' => esc_html__( 'Bavel', 'essential-addons-for-elementor-lite' ),
'image' => $image_dir_url . 'bavel.svg',
],
'rabbet' => [
'title' => esc_html__( 'Rabbet', 'essential-addons-for-elementor-lite' ),
'image' => $image_dir_url . 'rabbet.svg',
],
'chevron-left' => [
'title' => esc_html__( 'Chevron Left', 'essential-addons-for-elementor-lite' ),
'image' => $image_dir_url . 'chevron-left.svg',
],
'chevron-right' => [
'title' => esc_html__( 'Chevron Right', 'essential-addons-for-elementor-lite' ),
'image' => $image_dir_url . 'chevron-right.svg',
],
'star' => [
'title' => esc_html__( 'Start', 'essential-addons-for-elementor-lite' ),
'image' => $image_dir_url . 'star.svg',
],
],
'default' => 'bavel',
'toggle' => false,
'image_choose' => true,
'css_class' => 'eael-image-masking-choose',
'condition' => array_merge( $condition, [ 'eael_image_masking_enable_custom_clip_path' . $tab . '!' => 'yes' ] )
]
);
$element->add_control(
'eael_image_masking_enable_custom_clip_path' . $tab,
[
'label' => esc_html__( 'Use Custom Clip Path', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
'condition' => $condition,
]
);
$element->add_control(
'eael_image_masking_custom_clip_path' . $tab,
[
'label' => '',
'type' => Controls_Manager::TEXTAREA,
'rows' => 10,
'label_block' => true,
'dynamic' => [
'active' => false,
],
'ai' => [
'active' => false,
],
'default' => 'clip-path: polygon(50% 0%, 80% 10%, 100% 35%, 100% 70%, 80% 90%, 50% 100%, 20% 90%, 0% 70%, 0% 35%, 20% 10%);',
'placeholder' => 'clip-path: polygon(50% 0%, 0% 100%, 100% 100%);',
'description' => __( 'Enter your custom clip path value. You can use <a href = "https://bennettfeely.com/clippy/" target = "_blank">Clippy</a> to generate your custom clip path.', 'essential-addons-for-elementor-lite' ),
'condition' => array_merge( $condition, [ 'eael_image_masking_enable_custom_clip_path' . $tab => 'yes' ] ),
]
);
$condition = [ 'eael_image_masking_type' => 'image' ];
if( '_hover' === $tab ){
$condition['eael_image_masking_hover_effect'] = 'yes';
}
$svg_url = EAEL_PLUGIN_URL . 'assets/front-end/img/image-masking/svg-shapes/';
$element->add_control(
'eael_image_masking_svg' . $tab,
[
'label' => esc_html__( 'Choose Shape', 'essential-addons-for-elementor-lite' ),
'label_block' => true,
'type' => Controls_Manager::CHOOSE,
'options' => [
'polygon' => [
'title' => esc_html__( 'Polygon', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'polygon.svg',
],
'rounded' => [
'title' => esc_html__( 'Rounded', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'rounded.svg',
],
'arch-down' => [
'title' => esc_html__( 'Arch Down', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'arch-down.svg',
],
'arch-group' => [
'title' => esc_html__( 'Arch Group', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'arch-group.svg',
],
'arch-up' => [
'title' => esc_html__( 'Arch Up', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'arch-up.svg',
],
'asterisk' => [
'title' => esc_html__( 'Asterisk', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'asterisk.svg',
],
'blob' => [
'title' => esc_html__( 'Blob', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'blob.svg',
],
'blocks' => [
'title' => esc_html__( 'Blocks', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'blocks.svg',
],
'brash-1' => [
'title' => esc_html__( 'Brash 1', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'brash-1.svg',
],
'brash-2' => [
'title' => esc_html__( 'Brash 2', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'brash-2.svg',
],
'brash-3' => [
'title' => esc_html__( 'Brash 3', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'brash-3.svg',
],
'burst' => [
'title' => esc_html__( 'Burst', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'burst.svg',
],
'chat' => [
'title' => esc_html__( 'Chat', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'chat.svg',
],
'hex-tile' => [
'title' => esc_html__( 'Hex Tile', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'hex-tile.svg',
],
'leaf' => [
'title' => esc_html__( 'Leaf', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'leaf.svg',
],
'oval' => [
'title' => esc_html__( 'Oval', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'oval.svg',
],
'pixel-cross' => [
'title' => esc_html__( 'Pixel Cross', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'pixel-cross.svg',
],
'quote' => [
'title' => esc_html__( 'Quote', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'quote.svg',
],
'star-dimond' => [
'title' => esc_html__( 'Star Diamond', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'star-dimond.svg',
],
'upload' => [
'title' => esc_html__( 'Upload', 'essential-addons-for-elementor-lite' ),
'image' => $svg_url . 'upload.svg',
'fullwidth' => true,
],
],
'toggle' => false,
'image_choose' => true,
'css_class' => 'eael-image-masking-choose col-5',
'default' => 'polygon',
'condition' => $condition
]
);
if ( !apply_filters('eael/pro_enabled', false ) ) {
$element->add_control(
'eael_image_masking_upload_pro_message',
[
'label' => '',
'type' => Controls_Manager::RAW_HTML,
'raw' => '<div class="ea-nerd-box">
<div class="ea-nerd-box-message">' . __('This feature is available in the pro version.', 'essential-addons-for-elementor-lite') . '</div>
<a class="ea-nerd-box-link elementor-button elementor-button-default" href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">
' . __('Upgrade to EA PRO', 'essential-addons-for-elementor-lite') . '
</a>
</div>',
'content_classes' => 'eael-pro-notice',
'condition' => array_merge( $condition, [ 'eael_image_masking_svg' . $tab => 'upload' ] )
]
);
} else {
do_action( 'eael/image-masking/image_control', $element, array_merge( $condition, [ 'eael_image_masking_svg' . $tab => 'upload' ] ), $tab );
}
if( '_hover' === $tab ){
$element->add_control(
'eael_image_masking_hover_selector',
[
'label' => esc_html__( 'Hover Selector', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'dynamic' => [
'active' => false,
],
'ai' => [
'active' => false,
],
'placeholder' => '.not-masked-element, #not-masked-element',
'description' => __( 'Enter the selector for the element you want to apply the hover effect on. If you leave this field empty, the hover effect will be applied on hover for full section.', 'essential-addons-for-elementor-lite' ),
'condition' => [
'eael_image_masking_hover_effect' => 'yes',
]
]
);
}
}
public function register_controls( $element ) {
$element->start_controls_section(
'eael_image_masking_section',
[
'label' => __( '<i class="eaicon-logo"></i> Image Masking', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_ADVANCED
]
);
$element->add_control(
'eael_enable_image_masking',
[
'label' => __( 'Enable Image Masking', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER
]
);
$element->add_control(
'eael_image_masking_type',
[
'label' => esc_html__( 'Type', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'image' => [
'title' => esc_html__( 'Image/SVG Masking', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-image',
],
'clip' => [
'title' => esc_html__( 'Clip Path', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-integration',
],
'morphing' => [
'title' => esc_html__( 'Morphing', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-animation',
]
],
'condition' => [
'eael_enable_image_masking' => 'yes'
],
'default' => 'clip',
'toggle' => false,
]
);
$element->start_controls_tabs( 'eael_image_masking_tabs', [
'condition' => [
'eael_enable_image_masking' => 'yes',
'eael_image_masking_type!' => 'morphing'
]
] );
$element->start_controls_tab(
'eael_image_masking_normal_tab',
[
'label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite' ),
]
);
$this->masking_controllers( $element );
$element->end_controls_tab();
$element->start_controls_tab(
'eael_image_masking_hover_tab',
[
'label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite' ),
]
);
$this->masking_controllers( $element, '_hover' );
$element->end_controls_tab();
$element->end_controls_tabs();
$element->add_control(
'eael_image_masking_image_size',
[
'label' => esc_html__( 'Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'contain',
'options' => [
'' => esc_html__( 'Default', 'essential-addons-for-elementor-lite' ),
'auto' => esc_html__( 'Auto', 'essential-addons-for-elementor-lite' ),
'cover' => esc_html__( 'Cover', 'essential-addons-for-elementor-lite' ),
'contain' => esc_html__( 'Contain', 'essential-addons-for-elementor-lite' ),
'custom' => esc_html__( 'Custom', 'essential-addons-for-elementor-lite' ),
],
'condition' => [
'eael_enable_image_masking' => 'yes',
'eael_image_masking_type' => 'image'
],
'selectors' => [
'{{WRAPPER}} img' => 'mask-size: {{VALUE}}; -webkit-mask-size: {{VALUE}};',
],
]
);
$element->add_control(
'eael_image_masking_image_custom_size_custom',
[
'label' => '',
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 5,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} img' => 'mask-size: {{SIZE}}{{UNIT}}; -webkit-mask-size: {{SIZE}}{{UNIT}};',
],
'condition' => [
'eael_enable_image_masking' => 'yes',
'eael_image_masking_type' => 'image',
'eael_image_masking_image_size' => 'custom'
],
]
);
$element->add_control(
'eael_image_masking_image_position',
[
'label' => esc_html__( 'Position', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'center center',
'options' => [
'' => esc_html__( 'Default', 'essential-addons-for-elementor-lite' ),
'left top' => esc_html__( 'Left Top', 'essential-addons-for-elementor-lite' ),
'left center' => esc_html__( 'Left Center', 'essential-addons-for-elementor-lite' ),
'left bottom' => esc_html__( 'Left Bottom', 'essential-addons-for-elementor-lite' ),
'center top' => esc_html__( 'Center Top', 'essential-addons-for-elementor-lite' ),
'center center' => esc_html__( 'Center Center', 'essential-addons-for-elementor-lite' ),
'center bottom' => esc_html__( 'Center Bottom', 'essential-addons-for-elementor-lite' ),
'right top' => esc_html__( 'Right Top', 'essential-addons-for-elementor-lite' ),
'right center' => esc_html__( 'Right Center', 'essential-addons-for-elementor-lite' ),
'right bottom' => esc_html__( 'Right Bottom', 'essential-addons-for-elementor-lite' )
],
'condition' => [
'eael_enable_image_masking' => 'yes',
'eael_image_masking_type' => 'image'
],
'selectors' => [
'{{WRAPPER}} img' => 'mask-position: {{VALUE}}; -webkit-mask-position: {{VALUE}};',
],
]
);
$element->add_control(
'eael_image_masking_image_repeat',
[
'label' => esc_html__( 'Repeat', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'no-repeat',
'options' => [
'no-repeat' => esc_html__( 'No-repeat', 'essential-addons-for-elementor-lite' ),
'repeat' => esc_html__( 'Repeat', 'essential-addons-for-elementor-lite' ),
'repeat-x' => esc_html__( 'Repeat-x', 'essential-addons-for-elementor-lite' ),
'repeat-y' => esc_html__( 'Repeat-y', 'essential-addons-for-elementor-lite' ),
],
'condition' => [
'eael_enable_image_masking' => 'yes',
'eael_image_masking_type' => 'image'
],
'selectors' => [
'{{WRAPPER}} img' => 'mask-repeat: {{VALUE}}; -webkit-mask-repeat: {{VALUE}};',
],
]
);
if ( !apply_filters('eael/pro_enabled', false ) ) {
$element->add_control(
'eael_image_masking_pro_message',
[
'label' => '',
'type' => Controls_Manager::RAW_HTML,
'raw' => '<div class="ea-nerd-box">
<div class="ea-nerd-box-message">' . __('This feature is available in the pro version.', 'essential-addons-for-elementor-lite') . '</div>
<a class="ea-nerd-box-link elementor-button elementor-button-default" href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">
' . __('Upgrade to EA PRO', 'essential-addons-for-elementor-lite') . '
</a>
</div>',
'content_classes' => 'eael-pro-notice',
'condition' => [
'eael_enable_image_masking' => 'yes',
'eael_image_masking_type' => 'morphing'
]
]
);
} else {
do_action( 'eael/image_masking/morphing_controls', $element );
}
$svg_url = EAEL_PLUGIN_URL . 'assets/front-end/img/image-masking/svg-shapes/';
$element->add_control(
'eael_image_masking_svg_url',
[
'label' => '',
'type' => Controls_Manager::HIDDEN,
'default' => $svg_url,
]
);
$element->end_controls_section();
}
private function extract_first_path_d($svg) {
// Try DOM first
libxml_use_internal_errors(true);
$dom = new \DOMDocument();
if (@$dom->loadXML($svg)) {
$path = $dom->getElementsByTagName('path')->item(0);
if ($path) {
return $path->getAttribute('d');
}
}
// Regex fallback
if (preg_match('/<path[^>]+d="([^"]+)"/i', $svg, $match)) {
return $match[1];
}
return null; // not found
}
public function before_render( $element ) {
$is_enabled = $element->get_settings_for_display( 'eael_enable_image_masking' );
$settings = $element->get_settings_for_display();
if ( 'yes' === $is_enabled ) {
$type = $settings['eael_image_masking_type'];
$element_id = $element->get_id();
$style = '';
$element->add_render_attribute( '_wrapper', 'class', 'eael-image-masking-' . $element_id );
if( 'clip' === $type ){
$clip_path_value = '';
if( 'yes' === $settings['eael_image_masking_enable_custom_clip_path'] ){
$clip_path_value = $settings['eael_image_masking_custom_clip_path'];
$clip_path_value = str_replace( 'clip-path: ', '', $clip_path_value );
} else {
$clip_path = $settings['eael_image_masking_clip_path'];
$clip_path_value = $this->clip_paths( $clip_path );
}
if( $clip_path_value ) {
$style .= '.eael-image-masking-'.$element_id.' img {clip-path: '.$clip_path_value.'}';
}
if( 'yes' === $settings['eael_image_masking_hover_effect'] ){
$hover_clip_path_value = '';
if( 'yes' === $settings['eael_image_masking_enable_custom_clip_path_hover'] ){
$hover_clip_path_value = $settings['eael_image_masking_custom_clip_path_hover'];
$hover_clip_path_value = str_replace( 'clip-path: ', '', $hover_clip_path_value );
} else {
$hover_clip_path = $settings['eael_image_masking_clip_path_hover'];
$hover_clip_path_value = $this->clip_paths( $hover_clip_path );
}
if( $hover_clip_path_value ) {
$hover_selector = $settings['eael_image_masking_hover_selector'];
if( $hover_selector ){
$hover_selector = ' ' . trim( $hover_selector );
}
$style .= '.eael-image-masking-'.$element_id.$hover_selector.':hover img {clip-path: '.$hover_clip_path_value.'}';
}
$hover_selector = $settings['eael_image_masking_hover_selector'];
if( $hover_selector ){
$hover_selector = ' ' . trim( $hover_selector );
}
$style .= '.eael-image-masking-'.$element_id.$hover_selector.':hover img {clip-path: '.$hover_clip_path_value.'}';
}
} else if( 'image' === $type ) {
$svg = $element->get_settings_for_display( 'eael_image_masking_svg' );
$mask_url = '';
if( 'upload' !== $svg ){
$svg_url = $element->get_settings_for_display( 'eael_image_masking_svg_url' );
$mask_url = $svg_url . $svg . '.svg';
} else if( 'upload' === $svg ){
$image = $element->get_settings_for_display( 'eael_image_masking_image' );
$mask_url = isset( $image['url'] ) ? $image['url'] : '';
}
if( $mask_url ) {
$style .= '.eael-image-masking-'.$element_id.' img {mask-image: url('.$mask_url.'); -webkit-mask-image: url('.$mask_url.');}';
}
if( 'yes' === $settings['eael_image_masking_hover_effect'] ){
$hover_image = $element->get_settings_for_display( 'eael_image_masking_svg_hover' );
$hover_mask_url = '';
if( 'upload' !== $hover_image ){
$svg = $element->get_settings_for_display( 'eael_image_masking_svg' );
$svg_url = $element->get_settings_for_display( 'eael_image_masking_svg_url' );
$hover_mask_url = $svg_url . $hover_image . '.svg';
} else if( 'upload' === $hover_image ){
$hover_image = $element->get_settings_for_display( 'eael_image_masking_image_hover' );
$hover_mask_url = $hover_image['url'];
}
if( $hover_mask_url ) {
$hover_selector = $element->get_settings_for_display( 'eael_image_masking_hover_selector' );
if( $hover_selector ){
$hover_selector = ' ' . trim( $hover_selector );
}
$style .= '.eael-image-masking-'.$element_id. $hover_selector .':hover img {mask-image: url('.$hover_mask_url.'); -webkit-mask-image: url('.$hover_mask_url.');}';
}
}
} else if( 'morphing' === $type ) {
$morphing_options = apply_filters( 'eael/image_masking/morphing_options', [], $element, $element_id );
if( !empty( $morphing_options ) ){
if( !empty( $morphing_options['svg_html'] ) ){
//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $morphing_options['svg_html'];
}
unset( $morphing_options['svg_html'] );
$element->add_render_attribute( '_wrapper', 'data-morphing-options', wp_json_encode( $morphing_options ) );
$element->add_render_attribute( '_wrapper', 'class', 'eael-morphing-enabled' );
}
}
if( $style ){
echo '<style id="eael-image-masking-'.$element_id.'">'.$style.'</style>';
}
}
}
}
@@ -0,0 +1,568 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
use Elementor\Controls_Manager;
use Essential_Addons_Elementor\Traits\Helper as HelperTrait;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Liquid_Glass_Effect {
use HelperTrait;
/**
* Initialize hooks
*/
public function __construct() {
add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/frontend/before_render', [ $this, 'before_render' ], 100 );
add_filter( 'elementor/widget/render_content', [ $this, 'eael_liquid_glass_effect_svg_render' ], 10, 2 );
// Add support for containers
add_action( 'elementor/frontend/container/after_render', [ $this, 'eael_liquid_glass_effect_container_svg_render' ], 10 );
}
public function eael_liquid_glass_effect_bg_color_effect( $element, $effect, $default_bg_color ) {
$element->add_control(
'eael_liquid_glass_effect_bg_color_' . $effect,
[
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'default' => $default_bg_color,
'selectors' => [
'{{WRAPPER}}.eael_liquid_glass-'.$effect => 'background-color: {{VALUE}}',
],
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_effect' => $effect,
],
]
);
}
public function eael_liquid_glass_effect_backdrop_filter( $element, $effect, $default_size ) {
$element->add_control(
'eael_liquid_glass_effect_backdrop_filter_'.$effect,
[
'label' => esc_html__( 'Backdrop Filter', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
],
'default' => [
'size' => $default_size,
],
'selectors' => [
'{{WRAPPER}}.eael_liquid_glass-'.$effect => 'backdrop-filter: blur({{SIZE}}px)',
],
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_effect' => $effect,
],
]
);
}
public function eael_liquid_glass_effect_border( $element, $effect, $default_color, $condition ) {
$element->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'eael_liquid_glass_border_'.$effect,
'fields_options' => [
'border' => [
'default' => 'solid',
],
'width' => [
'default' => [
'top' => '1',
'right' => '1',
'bottom' => '1',
'left' => '1',
'isLinked' => false,
],
],
'color' => [
'default' => $default_color,
],
],
'selector' => '{{WRAPPER}}.eael_liquid_glass_shadow-'.$effect,
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_shadow_effect' => $effect,
'eael_liquid_glass_effect' => $condition,
],
]
);
}
public function eael_liquid_glass_effect_border_radius( $element, $effect, $default_radius, $condition ) {
$element->add_control(
'eael_liquid_glass_border_radius_'.$effect,
[
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'default' => $default_radius,
'selectors' => [
'{{WRAPPER}}.eael_liquid_glass_shadow-'.$effect => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_shadow_effect' => $effect,
'eael_liquid_glass_effect' => $condition,
],
]
);
}
public function eael_liquid_glass_effect_box_shadow( $element, $effect, $default_shadow, $condition ) {
$element->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_liquid_glass_shadow_'.$effect,
'fields_options' => [
'box_shadow_type' => [ 'default' => 'yes' ],
'box_shadow' => [
'default' => $default_shadow,
],
],
'selector' => '{{WRAPPER}}.eael_liquid_glass_shadow-'.$effect,
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_shadow_effect' => $effect,
'eael_liquid_glass_effect' => $condition,
],
]
);
}
/**
* Summary of teaser_template
*/
public function teaser_template($texts) {
$html = '<div class="ea-nerd-box">
<div class="ea-nerd-box-message">' . $texts['messages'] . '</div>
<a class="ea-nerd-box-link elementor-button elementor-button-default" href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">
' . __('Upgrade to EA PRO', 'essential-addons-for-elementor-lite') . '
</a>
</div>';
return $html;
}
public function eael_pro_lock_icon() {
if ( !apply_filters('eael/pro_enabled', false ) ) {
$html = '<span class="e-control-motion-effects-promotion__lock-wrapper"><i class="eicon-lock"></i></span>';
return $html;
}
return;
}
public function register_controls( $element ) {
$element->start_controls_section(
'eael_liquid_glass_effect_section',
[
'label' => __( '<i class="eaicon-logo"></i> Liquid Glass Effects', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_ADVANCED
]
);
$element->add_control(
'eael_liquid_glass_effect_switch',
[
'label' => __( 'Enable Liquid Glass Effects', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
]
);
$element->add_control(
'eael_liquid_glass_effect_notice',
[
'type' => Controls_Manager::ALERT,
'alert_type' => 'info',
'content' => esc_html__( 'Liquid glass effect is only visible when a semi-transparent background color is applied.', 'essential-addons-for-elementor-lite' ) . '<a href="https://essential-addons.com/docs/ea-liquid-glass-effects/" target="_blank">' . esc_html__( 'Learn More', 'essential-addons-for-elementor-lite' ) . '</a>',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
]
]
);
$eael_liquid_glass_effect = apply_filters(
'eael_liquid_glass_effect_filter',
[
'styles' => [
'effect1' => esc_html__( 'Heavy Frost', 'essential-addons-for-elementor-lite' ),
'effect2' => esc_html__( 'Soft Mist', 'essential-addons-for-elementor-lite' ),
'effect4' => esc_html__( 'Light Frost', 'essential-addons-for-elementor-lite' ),
'effect5' => esc_html__( 'Grain Frost', 'essential-addons-for-elementor-lite' ),
'effect6' => esc_html__( 'Fine Frost', 'essential-addons-for-elementor-lite' ),
],
]
);
$element->add_control(
'eael_liquid_glass_effect',
[
'label' => esc_html__( 'Liquid Glass Presets', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'effect1' => [
'title' => esc_html__( $eael_liquid_glass_effect['styles']['effect1'], 'essential-addons-for-elementor-lite' ),
'text' => esc_html__( $eael_liquid_glass_effect['styles']['effect1'], 'essential-addons-for-elementor-lite' ),
],
'effect2' => [
'title' => esc_html__( $eael_liquid_glass_effect['styles']['effect2'], 'essential-addons-for-elementor-lite' ),
'text' => esc_html__( $eael_liquid_glass_effect['styles']['effect2'], 'essential-addons-for-elementor-lite' ),
],
'effect4' => [
'title' => esc_html__( $eael_liquid_glass_effect['styles']['effect4'], 'essential-addons-for-elementor-lite' ),
'text' => esc_html__( $eael_liquid_glass_effect['styles']['effect4'], 'essential-addons-for-elementor-lite' ) . $this->eael_pro_lock_icon(),
],
'effect5' => [
'title' => esc_html__( $eael_liquid_glass_effect['styles']['effect5'], 'essential-addons-for-elementor-lite' ),
'text' => esc_html__( $eael_liquid_glass_effect['styles']['effect5'], 'essential-addons-for-elementor-lite' ) . $this->eael_pro_lock_icon(),
],
'effect6' => [
'title' => esc_html__( $eael_liquid_glass_effect['styles']['effect6'], 'essential-addons-for-elementor-lite' ),
'text' => esc_html__( $eael_liquid_glass_effect['styles']['effect6'], 'essential-addons-for-elementor-lite' ) . $this->eael_pro_lock_icon(),
],
],
'prefix_class' => 'eael_liquid_glass-',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
],
'default' => 'effect1',
'multiline' => true,
]
);
if ( !apply_filters('eael/pro_enabled', false ) ) {
$element->add_control(
'eael_liquid_glass_effect_pro_alert',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template( [
'messages' => __( "To use this Liquid glass preset, Upgrade to Essential Addons Pro", 'essential-addons-for-elementor-lite' ),
] ),
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_effect' => ['effect4', 'effect5', 'effect6'],
]
]
);
} else {
$element->add_control(
'eael_liquid_glass_effect_settings',
[
'label' => esc_html__( 'Liquid Glass Settings', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
]
]
);
}
// Background Color Controls
$this->eael_liquid_glass_effect_bg_color_effect( $element, 'effect1', '#FFFFFF1F' );
$this->eael_liquid_glass_effect_bg_color_effect( $element, 'effect2', '#FFFFFF1F' );
// Background Color Controls for Pro
do_action( 'eael_liquid_glass_effect_bg_color_effect4', $element, 'effect4', '' );
do_action( 'eael_liquid_glass_effect_bg_color_effect5', $element, 'effect5', '' );
do_action( 'eael_liquid_glass_effect_bg_color_effect6', $element, 'effect6', '' );
// Backdrop Filter Controls
$this->eael_liquid_glass_effect_backdrop_filter( $element, 'effect1', 24 );
$this->eael_liquid_glass_effect_backdrop_filter( $element, 'effect2', 20 );
// Brightness Effect Controls
$element->add_control(
'eael_liquid_glass_effect_brightness_effect2',
[
'label' => esc_html__( 'Brightness', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 5,
'step' => .1,
],
],
'default' => [
'size' => 1,
],
'selectors' => [
'{{WRAPPER}}.eael_liquid_glass-effect2' => 'backdrop-filter: blur({{eael_liquid_glass_effect_backdrop_filter_effect2.SIZE}}px) brightness({{SIZE}});',
],
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_effect' => 'effect2',
]
]
);
// Backdrop Filter Controls for Pro
do_action( 'eael_liquid_glass_effect_backdrop_filter_effect4', $element, 'effect4', 5 );
do_action( 'eael_liquid_glass_effect_backdrop_filter_effect5', $element, 'effect5', '' );
do_action( 'eael_liquid_glass_effect_backdrop_filter_effect6', $element, 'effect6', 7 );
// Noise Distortion Settings (Pro)
do_action( 'eael_liquid_glass_effect_noise_action', $element );
if ( !apply_filters('eael/pro_enabled', false ) ) {
$element->add_control(
'eael_liquid_glass_shadow_effect',
[
'label' => esc_html__( 'Shadow Effects', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT2,
'default' => 'effect1',
'separator' => 'before',
'options' => [
'' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ),
'effect1' => esc_html__( 'Effect 1', 'essential-addons-for-elementor-lite' ),
'effect2' => esc_html__( 'Effect 2', 'essential-addons-for-elementor-lite' ),
'effect3' => esc_html__( 'Effect 3', 'essential-addons-for-elementor-lite' ),
'effect4' => esc_html__( 'Effect 4', 'essential-addons-for-elementor-lite' ),
],
'prefix_class' => 'eael_liquid_glass_shadow-',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_effect' => ['effect1', 'effect2'],
]
]
);
$element->add_control(
'eael_liquid_glass_shadow_inner',
[
'label' => esc_html__( 'Shadow Settings', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_shadow_effect!' => '',
'eael_liquid_glass_effect' => ['effect1', 'effect2'],
],
]
);
// Add border effect for Liquid Glass Effects
$this->eael_liquid_glass_effect_border( $element, 'effect1', '#FFFFFF1F', ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_border( $element, 'effect2', '#FFFFFF1F', ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_border( $element, 'effect3', '#FFFFFF1F', ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_border( $element, 'effect4', '#AAAAAA1A', ['effect1', 'effect2'] );
// Add border radius effect for Liquid Glass Effects
$this->eael_liquid_glass_effect_border_radius( $element, 'effect1', [
'top' => 24,
'right' => 24,
'bottom' => 24,
'left' => 24,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_border_radius( $element, 'effect2', [
'top' => 16,
'right' => 16,
'bottom' => 16,
'left' => 16,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_border_radius( $element, 'effect3', [
'top' => 8,
'right' => 8,
'bottom' => 8,
'left' => 8,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_border_radius( $element, 'effect4', [
'top' => 24,
'right' => 24,
'bottom' => 24,
'left' => 24,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2'] );
// Add box shadow effect for Liquid Glass Effects
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect1', [
'color' => 'rgba(0,0,0,0.78)',
'horizontal' => 0,
'vertical' => 19,
'blur' => 26,
'spread' => 1,
], ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect2', [
'color' => '#383C65',
'horizontal' => 0,
'vertical' => 0,
'blur' => 33,
'spread' => -2,
], ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect3', [
'color' => 'rgba(255, 255, 255, 0.4)',
'horizontal' => 1,
'vertical' => 1,
'blur' => 10,
'spread' => 5,
], ['effect1', 'effect2'] );
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect4', [
'color' => '#00000040',
'horizontal' => 0,
'vertical' => 9,
'blur' => 21,
'spread' => 0,
], ['effect1', 'effect2'] );
} else {
$element->add_control(
'eael_liquid_glass_shadow_effect',
[
'label' => esc_html__( 'Shadow Effects', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT2,
'default' => 'effect1',
'separator' => 'before',
'options' => [
'' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ),
'effect1' => esc_html__( 'Effect 1', 'essential-addons-for-elementor-lite' ),
'effect2' => esc_html__( 'Effect 2', 'essential-addons-for-elementor-lite' ),
'effect3' => esc_html__( 'Effect 3', 'essential-addons-for-elementor-lite' ),
'effect4' => esc_html__( 'Effect 4', 'essential-addons-for-elementor-lite' ),
],
'prefix_class' => 'eael_liquid_glass_shadow-',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_effect' => ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'],
]
]
);
$element->add_control(
'eael_liquid_glass_shadow_inner',
[
'label' => esc_html__( 'Shadow Settings', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'eael_liquid_glass_effect_switch' => 'yes',
'eael_liquid_glass_shadow_effect!' => '',
'eael_liquid_glass_effect' => ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'],
],
]
);
// Add border effect for Liquid Glass Effects
$this->eael_liquid_glass_effect_border( $element, 'effect1', '#FFFFFF1F', ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_border( $element, 'effect2', '#FFFFFF1F', ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_border( $element, 'effect3', '#FFFFFF1F', ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_border( $element, 'effect4', '#AAAAAA1A', ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
// Add border radius effect for Liquid Glass Effects
$this->eael_liquid_glass_effect_border_radius( $element, 'effect1', [
'top' => 24,
'right' => 24,
'bottom' => 24,
'left' => 24,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_border_radius( $element, 'effect2', [
'top' => 16,
'right' => 16,
'bottom' => 16,
'left' => 16,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_border_radius( $element, 'effect3', [
'top' => 8,
'right' => 8,
'bottom' => 8,
'left' => 8,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_border_radius( $element, 'effect4', [
'top' => 24,
'right' => 24,
'bottom' => 24,
'left' => 24,
'unit' => 'px',
'isLinked' => true,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
// Add box shadow effect for Liquid Glass Effects
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect1', [
'color' => 'rgba(0,0,0,0.78)',
'horizontal' => 0,
'vertical' => 19,
'blur' => 26,
'spread' => 1,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect2', [
'color' => '#383C65',
'horizontal' => 0,
'vertical' => 0,
'blur' => 33,
'spread' => -2,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect3', [
'color' => 'rgba(255, 255, 255, 0.4)',
'horizontal' => 1,
'vertical' => 1,
'blur' => 10,
'spread' => 5,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
$this->eael_liquid_glass_effect_box_shadow( $element, 'effect4', [
'color' => '#00000040',
'horizontal' => 0,
'vertical' => 9,
'blur' => 21,
'spread' => 0,
], ['effect1', 'effect2', 'effect4', 'effect5', 'effect6'] );
}
$element->end_controls_section();
}
public function before_render( $element ) {
$settings = $element->get_settings_for_display();
}
public function eael_liquid_glass_effect_svg_render( $content, $element ) {
$settings = $element->get_settings_for_display();
do_action( 'eael_liquid_glass_effect_svg_pro', $element, $settings );
return $content;
}
public function eael_liquid_glass_effect_container_svg_render( $element ) {
$settings = $element->get_settings_for_display();
do_action( 'eael_liquid_glass_effect_svg_pro', $element, $settings );
}
}
@@ -0,0 +1,177 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Post_Duplicator {
public function __construct() {
add_filter( 'admin_action_eae_duplicate', array( $this, 'duplicate' ) );
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 10000 );
add_filter( 'post_row_actions', array( $this, 'row_actions' ), 10, 2 );
add_filter( 'page_row_actions', array( $this, 'row_actions' ), 10, 2 );
}
public function admin_bar_menu( $wp_admin_bar ) {
global $pagenow;
global $post;
$enabled_on = get_option( 'eael_save_post_duplicator_post_type', 'all' );
if ( ! is_admin() || $pagenow !== 'post.php' || ( $enabled_on != 'all' || $post->post_type != $enabled_on ) ) {
return;
}
$duplicate_url = admin_url( 'admin.php?action=eae_duplicate&post=' . $post->ID );
$duplicate_url = wp_nonce_url( $duplicate_url, 'ea_duplicator' );
$wp_admin_bar->add_menu(
array(
'id' => 'eae-duplicator',
'title' => __( 'EA Duplicator', 'essential-addons-for-elementor-lite' ),
'href' => $duplicate_url
)
);
}
/**
* EA Duplicator Button added in table row
*
* @param array $actions
* @param WP_Post $post
*
* @return array
*/
public function row_actions( $actions, $post ) {
$enabled_on = get_option( 'eael_save_post_duplicator_post_type', 'all' );
if ( current_user_can( 'edit_posts' ) && ( $enabled_on == 'all' || $post->post_type == $enabled_on ) ) {
$duplicate_url = admin_url( 'admin.php?action=eae_duplicate&post=' . $post->ID );
$duplicate_url = wp_nonce_url( $duplicate_url, 'ea_duplicator' );
$actions['eae_duplicate'] = sprintf( '<a href="%s" title="%s">%s</a>', $duplicate_url, __( 'Duplicate ' . esc_attr( $post->post_title ), 'essential-addons-for-elementor-lite' ), __( 'EA Duplicator', 'essential-addons-for-elementor-lite' ) );
}
return $actions;
}
/**
* Duplicate a post
* @return void
*/
public function duplicate() {
$nonce = isset( $_REQUEST['_wpnonce'] ) && ! empty( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : null;
$post_id = isset( $_REQUEST['post'] ) && ! empty( $_REQUEST['post'] ) ? intval( $_REQUEST['post'] ) : null;
$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? trim( sanitize_text_field( $_REQUEST['action'] ) ) : null;
if ( is_null( $nonce ) || is_null( $post_id ) || $action !== 'eae_duplicate' ) {
return; // Return if action is not eae_duplicate
}
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ea_duplicator' ) ) {
return; // Return if nonce is not valid
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( __( 'You do not have sufficient permissions to edit this post.', 'essential-addons-for-elementor-lite' ) );
}
$post = sanitize_post( get_post( $post_id ), 'db' );
if ( is_null( $post ) ) {
return; // Return if post is not there.
}
$current_user = wp_get_current_user();
$allowed_roles = array('editor', 'administrator', 'author');
$redirect_url = admin_url( 'edit.php?post_type=' . $post->post_type );
if ( ! array_intersect( $allowed_roles, $current_user->roles ) ) {
switch ( $post->post_type ) {
case 'post':
$can_edit_others_posts = current_user_can('edit_others_posts');
break;
case 'page':
$can_edit_others_posts = current_user_can('edit_others_pages');
break;
default :
$can_edit_others_posts = current_user_can('edit_others_posts');
break;
}
if ( $current_user->ID !== $post->post_author && ! $can_edit_others_posts ){
wp_safe_redirect( $redirect_url );
return;
}
}
$duplicate_post_args = array(
'post_author' => $current_user->ID,
'post_title' => $post->post_title . ' - Copy',
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_parent' => $post->post_parent,
'post_status' => 'draft',
'ping_status' => $post->ping_status,
'comment_status' => $post->comment_status,
'post_password' => $post->post_password,
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order,
);
$duplicated_id = wp_insert_post( $duplicate_post_args );
if ( ! is_wp_error( $duplicated_id ) ) {
$taxonomies = get_object_taxonomies( $post->post_type );
if ( ! empty( $taxonomies ) && is_array( $taxonomies ) ) {
foreach ( $taxonomies as $taxonomy ) {
$post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
wp_set_object_terms( $duplicated_id, $post_terms, $taxonomy, false );
}
}
global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$post_meta = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $post_id ) );
if ( ! empty( $post_meta ) && is_array( $post_meta ) ) {
$duplicate_insert_query = "INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value ) VALUES ";
$insert = '';
foreach ( $post_meta as $meta_info ) {
$meta_key = sanitize_text_field( $meta_info->meta_key );
$meta_value = $meta_info->meta_value;
$exclude_meta_keys = [ '_wc_average_rating', '_wc_review_count', '_wc_rating_count', '_elementor_css' ];
if( in_array($meta_key, $exclude_meta_keys) ){
continue;
}
if ( $meta_key === '_elementor_template_type' ) {
delete_post_meta( $duplicated_id, '_elementor_template_type' );
}
if ( ! empty( $insert ) ) {
$insert .= ', ';
}
$insert .= $wpdb->prepare( '(%d, %s, %s)', $duplicated_id, $meta_key, $meta_value );
}
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->query( $duplicate_insert_query . $insert );
}
}
wp_safe_redirect( $redirect_url );
}
}
@@ -0,0 +1,221 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
if (!defined('ABSPATH')) {
exit;
}
use Elementor\Controls_Manager;
class Promotion
{
public function __construct() {
if ( ! apply_filters( 'eael/pro_enabled', false ) ) {
add_action( 'elementor/element/section/section_layout/after_section_end', [ $this, 'section_parallax' ], 10 );
add_action( 'elementor/element/section/section_layout/after_section_end', [ $this, 'section_particles' ], 10 );
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'content_protection' ], 10 );
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'section_tooltip' ], 10 );
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'conditional_display' ] );
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'conditional_display' ] );
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'conditional_display' ] );
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'smooth_animation' ] );
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'smooth_animation' ] );
//Custom Cursor
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'custom_cursor' ] );
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'custom_cursor' ] );
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'custom_cursor' ] );
add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'custom_cursor' ] );
add_action( 'elementor/documents/register_controls', [ $this, 'custom_cursor_page' ] );
}
}
public function teaser_template($texts)
{
$html = '<div class="ea-nerd-box">
<div class="ea-nerd-box-icon">
<img src="' . EAEL_PLUGIN_URL . 'assets/admin/images/icon-ea-new-logo.svg' . '">
</div>
<div class="ea-nerd-box-title">' . $texts['title'] . '</div>
<div class="ea-nerd-box-message">' . $texts['messages'] . '</div>
<a class="ea-nerd-box-link elementor-button elementor-button-default" href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">
' . __('Upgrade Essential Addons', 'essential-addons-for-elementor-lite') . '
</a>
</div>';
return $html;
}
public function section_parallax($element)
{
$element->start_controls_section(
'eael_ext_section_parallax_section',
[
'label' => __('<i class="eaicon-logo"></i> Parallax', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_LAYOUT,
]
);
$element->add_control(
'eael_ext_section_parallax_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template([
'title' => __('Meet EA Parallax', 'essential-addons-for-elementor-lite'),
'messages' => __('Create stunning Parallax effects on your site and blow everyone away.', 'essential-addons-for-elementor-lite'),
]),
]
);
$element->end_controls_section();
}
public function section_particles($element)
{
$element->start_controls_section(
'eael_ext_section_particles_section',
[
'label' => __('<i class="eaicon-logo"></i> Particles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_LAYOUT,
]
);
$element->add_control(
'eael_ext_section_particles_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template([
'title' => __('Meet EA Particles', 'essential-addons-for-elementor-lite'),
'messages' => __('Create stunning Particles effects on your site and blow everyone away.', 'essential-addons-for-elementor-lite'),
]),
]
);
$element->end_controls_section();
}
public function content_protection($element)
{
$element->start_controls_section(
'eael_ext_content_protection_section',
[
'label' => __('<i class="eaicon-logo"></i> Content Protection', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_ADVANCED,
]
);
$element->add_control(
'eael_ext_content_protection_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template([
'title' => __('Meet EA Content Protection', 'essential-addons-for-elementor-lite'),
'messages' => __('Put a restriction on any of your content and protect your privacy.', 'essential-addons-for-elementor-lite'),
]),
]
);
$element->end_controls_section();
}
public function section_tooltip($element)
{
$element->start_controls_section(
'eael_ext_section_tooltip_section',
[
'label' => __('<i class="eaicon-logo"></i> Advanced Tooltip', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_ADVANCED,
]
);
$element->add_control(
'eael_ext_section_tooltip_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template([
'title' => __('Meet EA Advanced Tooltip', 'essential-addons-for-elementor-lite'),
'messages' => __('Highlight any Elementor widgets with a key message when they are hovered.', 'essential-addons-for-elementor-lite'),
]),
]
);
$element->end_controls_section();
}
public function conditional_display( $element ) {
$element->start_controls_section(
'eael_conditional_display_section',
[
'label' => __( '<i class="eaicon-logo"></i> Conditional Display', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_ADVANCED
]
);
$element->add_control(
'eael_conditional_display_section_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template( [
'title' => __( 'Meet EA Conditional Display', 'essential-addons-for-elementor-lite' ),
'messages' => __( "Control any section, column, container or widget’s visibility with your own logic.", 'essential-addons-for-elementor-lite' ),
] ),
]
);
$element->end_controls_section();
}
public function smooth_animation( $element ) {
$element->start_controls_section(
'eael_smooth_animation_section',
[
'label' => __( '<i class="eaicon-logo"></i> Interactive Animations', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_ADVANCED
]
);
$element->add_control(
'eael_smooth_animation_section_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template( [
'title' => __( 'Meet EA Interactive Animations', 'essential-addons-for-elementor-lite' ),
'messages' => __( "Witness magic in Elementor - animate any section, column, container, or widget", 'essential-addons-for-elementor-lite' ),
] ),
]
);
$element->end_controls_section();
}
public function custom_cursor($element, $page = false)
{
$element->start_controls_section(
'eael_ext_custom_cursor_section',
[
'label' => __('<i class="eaicon-logo"></i> Custom Cursor', 'essential-addons-for-elementor-lite'),
'tab' => !$page ? Controls_Manager::TAB_ADVANCED : Controls_Manager::TAB_SETTINGS,
]
);
$element->add_control(
'eael_ext_custom_cursor_section_pro_required',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->teaser_template([
'title' => __('Meet EA Custom Cursor', 'essential-addons-for-elementor-lite'),
'messages' => __('Personalize your cursor with a unique style to enhance user experience and visual appeal.', 'essential-addons-for-elementor-lite'),
]),
]
);
$element->end_controls_section();
}
public function custom_cursor_page($element)
{
$this->custom_cursor( $element, true );
}
}
@@ -0,0 +1,214 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Essential_Addons_Elementor\Classes\Helper;
class Reading_Progress
{
public function __construct()
{
add_action('elementor/documents/register_controls', [$this, 'register_controls'], 10);
}
public function register_controls($element)
{
if (Helper::prevent_extension_loading(get_the_ID())) {
return;
}
$global_settings = get_option('eael_global_settings');
$element->start_controls_section(
'eael_ext_reading_progress_section',
[
'label' => __('<i class="eaicon-logo"></i> Reading Progress Bar', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_SETTINGS,
]
);
$element->add_control(
'eael_ext_reading_progress',
[
'label' => __('Enable Reading Progress Bar', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
]
);
$element->add_control(
'eael_ext_reading_progress_has_global',
[
'label' => __('Enabled Globally?', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HIDDEN,
'default' => (isset($global_settings['reading_progress']['enabled']) ? $global_settings['reading_progress']['enabled'] : false),
]
);
if (isset($global_settings['reading_progress']['enabled']) && ($global_settings['reading_progress']['enabled'] == true) && get_the_ID() != $global_settings['reading_progress']['post_id'] && get_post_status($global_settings['reading_progress']['post_id']) == 'publish') {
$element->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('You can modify the Global Reading Progress Bar by <strong><a href="' . get_bloginfo('url') . '/wp-admin/post.php?post=' . $global_settings['reading_progress']['post_id'] . '&action=elementor">Clicking Here</a></strong>', 'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
} else {
$element->add_control(
'eael_ext_reading_progress_global',
[
'label' => __('Enable Reading Progress Bar Globally', 'essential-addons-for-elementor-lite'),
'description' => __('Enabling this option will effect on entire site.', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
$element->add_control(
'eael_ext_reading_progress_global_display_condition',
[
'label' => __('Display On', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'all',
'options' => [
'posts' => __('All Posts', 'essential-addons-for-elementor-lite'),
'pages' => __('All Pages', 'essential-addons-for-elementor-lite'),
'all' => __('All Posts & Pages', 'essential-addons-for-elementor-lite'),
],
'condition' => [
'eael_ext_reading_progress' => 'yes',
'eael_ext_reading_progress_global' => 'yes',
],
'separator' => 'before',
]
);
}
$element->add_control(
'eael_ext_reading_progress_position',
[
'label' => esc_html__('Position', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'top',
'label_block' => false,
'options' => [
'top' => esc_html__('Top', 'essential-addons-for-elementor-lite'),
'bottom' => esc_html__('Bottom', 'essential-addons-for-elementor-lite'),
],
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
$element->add_control(
'eael_ext_reading_progress_height',
[
'label' => __('Height', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 5,
],
'selectors' => [
'.eael-reading-progress-wrap .eael-reading-progress' => 'height: {{SIZE}}{{UNIT}} !important',
'.eael-reading-progress-wrap .eael-reading-progress .eael-reading-progress-fill' => 'height: {{SIZE}}{{UNIT}} !important',
],
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
$element->add_control(
'eael_ext_reading_progress_bg_color',
[
'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'.eael-reading-progress' => 'background-color: {{VALUE}}',
],
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
$element->add_control(
'eael_ext_reading_progress_fill_color',
[
'label' => __('Fill Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#1fd18e',
'selectors' => [
'.eael-reading-progress-wrap .eael-reading-progress .eael-reading-progress-fill' => 'background-color: {{VALUE}}',
],
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
$element->add_control(
'eael_ext_reading_progress_animation_speed',
[
'label' => __('Animation Speed', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 50,
],
'selectors' => [
'.eael-reading-progress-wrap .eael-reading-progress .eael-reading-progress-fill' => 'transition: width {{SIZE}}ms ease;',
],
'separator' => 'before',
'condition' => [
'eael_ext_reading_progress' => 'yes',
],
]
);
$element->end_controls_section();
}
}
@@ -0,0 +1,455 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Essential_Addons_Elementor\Classes\Helper;
class Scroll_to_Top
{
public function __construct()
{
add_action('elementor/documents/register_controls', [$this, 'register_controls'], 10);
}
public function register_controls($element)
{
if (Helper::prevent_extension_loading(get_the_ID())) {
return;
}
$global_settings = get_option('eael_global_settings');
$element->start_controls_section(
'eael_ext_scroll_to_top_section',
[
'label' => __('<i class="eaicon-logo"></i> Scroll to Top', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_SETTINGS,
]
);
$element->add_control(
'eael_ext_scroll_to_top',
[
'label' => __('Enable Scroll to Top', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
]
);
$element->add_control(
'eael_ext_scroll_to_top_has_global',
[
'label' => __('Enabled Globally?', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HIDDEN,
'default' => (isset($global_settings['eael_ext_scroll_to_top']['enabled']) ? $global_settings['eael_ext_scroll_to_top']['enabled'] : false),
]
);
if (isset($global_settings['eael_ext_scroll_to_top']['enabled']) && ($global_settings['eael_ext_scroll_to_top']['enabled'] == true) && get_the_ID() != $global_settings['eael_ext_scroll_to_top']['post_id'] && get_post_status($global_settings['eael_ext_scroll_to_top']['post_id']) == 'publish') {
$element->add_control(
'eael_ext_scroll_to_top_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('You can modify the Global Scroll to Top by <strong><a href="' . get_bloginfo('url') . '/wp-admin/post.php?post=' . $global_settings['eael_ext_scroll_to_top']['post_id'] . '&action=elementor">Clicking Here</a></strong>', 'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
'separator' => 'before',
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
} else {
$element->add_control(
'eael_ext_scroll_to_top_global',
[
'label' => __('Enable Scroll to Top Globally', 'essential-addons-for-elementor-lite'),
'description' => __('Enabling this option will effect on entire site.', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'separator' => 'before',
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_global_display_condition',
[
'label' => __('Display On', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'all',
'options' => [
'posts' => __('All Posts', 'essential-addons-for-elementor-lite'),
'pages' => __('All Pages', 'essential-addons-for-elementor-lite'),
'all' => __('All Posts & Pages', 'essential-addons-for-elementor-lite'),
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
'eael_ext_scroll_to_top_global' => 'yes',
],
'separator' => 'before',
]
);
}
$element->add_control(
'eael_ext_scroll_to_top_position_text',
[
'label' => esc_html__('Position', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'bottom-right',
'label_block' => false,
'options' => [
'bottom-left' => esc_html__('Bottom Left', 'essential-addons-for-elementor-lite'),
'bottom-right' => esc_html__('Bottom Right', 'essential-addons-for-elementor-lite'),
],
'separator' => 'before',
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_position_bottom',
[
'label' => __('Bottom', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
'em' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 15,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'bottom: {{SIZE}}{{UNIT}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_position_left',
[
'label' => __('Left', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
'em' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 15,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'left: {{SIZE}}{{UNIT}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
'eael_ext_scroll_to_top_position_text' => 'bottom-left',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_position_right',
[
'label' => __('Right', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
'em' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 15,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'right: {{SIZE}}{{UNIT}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
'eael_ext_scroll_to_top_position_text' => 'bottom-right',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_width',
[
'label' => __('Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 50,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'width: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_height',
[
'label' => __('Height', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 50,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'height: {{SIZE}}{{UNIT}};',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_z_index',
[
'label' => __('Z Index', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 9999,
'step' => 10,
],
],
'default' => [
'unit' => 'px',
'size' => 9999,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'z-index: {{SIZE}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_opacity',
[
'label' => __('Opacity', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 1,
'step' => 0.01,
],
],
'default' => [
'unit' => 'px',
'size' => 0.7,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'opacity: {{SIZE}};',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_icon_image',
[
'label' => esc_html__('Icon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-chevron-up',
'library' => 'fa-solid',
],
'separator' => 'before',
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_icon_note',
[
'type' => Controls_Manager :: RAW_HTML,
'raw' => __( 'If a page is not supported <strong>Font Awesome Icon</strong> please use <strong>SVG</strong> icon instead of it.', 'essential-addons-for-elementor-lite' ),
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_icon_size',
[
'label' => __('Icon Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 16,
'unit' => 'px',
],
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button i' => 'font-size: {{SIZE}}{{UNIT}};',
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_icon_color',
[
'label' => __('Icon Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button i' => 'color: {{VALUE}}',
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button svg' => 'fill: {{VALUE}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_bg_color',
[
'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#000000',
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'background-color: {{VALUE}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->add_control(
'eael_ext_scroll_to_top_button_border_radius',
[
'label' => __('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 5,
],
'selectors' => [
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'border-radius: {{SIZE}}{{UNIT}}',
],
'condition' => [
'eael_ext_scroll_to_top' => 'yes',
],
]
);
$element->end_controls_section();
}
}
@@ -0,0 +1,112 @@
<?php
namespace Essential_Addons_Elementor\Extensions;
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Wrapper_Link {
/**
* Initialize hooks
*/
public function __construct() {
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'register_controls' ] );
add_action( 'elementor/frontend/before_render', [ $this, 'before_render' ], 100 );
}
public function register_controls( $element ) {
$element->start_controls_section(
'eael_wrapper_link_section',
[
'label' => __( '<i class="eaicon-logo"></i> Wrapper Link', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_ADVANCED
]
);
$element->add_control(
'eael_wrapper_link_switch',
[
'label' => __( 'Enable Wrapper Link', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER
]
);
$element->add_control(
'eael_wrapper_link',
[
'label' => __( 'Link', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'condition' => [
'eael_wrapper_link_switch!' => ''
]
]
);
$element->add_control(
'eael_wrapper_link_disable_traditional',
[
'label' => __( 'Disable Traditional Link', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Off', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
'condition' => [
'eael_wrapper_link_switch!' => ''
]
]
);
$element->add_control(
'ael_wrapper_link_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('By Disabling <strong>Traditional Link</strong> some features (ex: dynamic tags, custom atrributes etc.) may not work.', 'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
'condition' => [
'eael_wrapper_link_switch!' => '',
'eael_wrapper_link_disable_traditional' => 'yes'
]
]
);
$element->end_controls_section();
}
public function before_render( $element ) {
$wrapper_link_settings = $element->get_settings_for_display( 'eael_wrapper_link' );
if ( "yes" === $element->get_settings_for_display( 'eael_wrapper_link_switch' ) && ! empty( $wrapper_link_settings['url'] ) ) {
$disable_traditional = $element->get_settings_for_display( 'eael_wrapper_link_disable_traditional' );
if( 'yes' === $disable_traditional ){
$element->add_render_attribute( '_wrapper',
'data-eael-wrapper-link',
wp_json_encode( [
'url' => esc_url( $wrapper_link_settings['url'] ),
'is_external' => esc_attr( $wrapper_link_settings['is_external'] ),
'nofollow' => esc_attr( $wrapper_link_settings['nofollow'] )
] )
);
$element->add_render_attribute( '_wrapper', 'class', 'eael-non-traditional-link' );
} else {
$link_id = 'eael-wrapper-link-' . $element->get_id();
$element->add_render_attribute( 'eael_wrapper_link', 'class', $link_id . ' --eael-wrapper-link-tag' );
$element->add_link_attributes( 'eael_wrapper_link', $wrapper_link_settings );
echo "<a "; $element->print_render_attribute_string( 'eael_wrapper_link' ); echo "></a>";
$element->add_render_attribute( '_wrapper', 'data-eael-wrapper-link', $link_id );
}
}
}
}
@@ -0,0 +1 @@
<?php // Silence is golden