first commit

This commit is contained in:
2025-02-24 22:33:42 +01:00
commit 737c037e85
18358 changed files with 5392983 additions and 0 deletions

View File

@@ -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();
}
}

View File

@@ -0,0 +1,170 @@
<?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
}
$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;
$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' ];
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 );
}
$wpdb->query( $duplicate_insert_query . $insert );
}
}
wp_safe_redirect( $redirect_url );
}
}

View File

@@ -0,0 +1,184 @@
<?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' ] );
}
}
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 widgets 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();
}
}

View File

@@ -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();
}
}

View File

@@ -0,0 +1,443 @@
<?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_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();
}
}

View File

@@ -0,0 +1,74 @@
<?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' ], 1 );
}
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->end_controls_section();
}
public function before_render( $element ) {
$wrapper_link_settings = $element->get_settings_for_display( 'eael_wrapper_link' );
if ( ! empty( $element->get_settings_for_display( 'eael_wrapper_link_switch' ) ) && ! empty( $wrapper_link_settings['url'] ) ) {
$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'] )
] )
);
}
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden