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,18 @@
<?php
/**
* Class trait files
*
* @package Essential-addons-for-elementor-lite\classes
*/
namespace Essential_Addons_Elementor\Classes;
use Essential_Addons_Elementor\Template\Woocommerce\Checkout\Woo_Checkout_Helper;
use Essential_Addons_Elementor\Traits\Helper;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly
class AllTraits{
use Helper, Woo_Checkout_Helper;
}
@@ -0,0 +1,529 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
use Elementor\Plugin;
use Essential_Addons_Elementor\Classes\Elements_Manager;
use Essential_Addons_Elementor\Traits\Library;
class Asset_Builder {
/**
* @theTraitAnnotation Library
*/
use Library;
/**
* Post ID
* @var int
*/
protected $post_id;
/**
* @var string
*/
protected $custom_js = '';
/**
* @var string
*/
protected $css_strings = '';
/**
* @var \Essential_Addons_Elementor\Classes\Elements_Manager
*/
protected $elements_manager;
/**
* @var false|mixed|string|void
*/
protected $css_print_method = '';
/**
* @var false|mixed|string|void
*/
protected $js_print_method = '';
/**
* @var array
*/
protected $registered_elements;
/**
* @var array
*/
protected $registered_extensions;
/**
* @var object
*/
protected $localize_objects;
/**
* @var int|int[]|mixed|string[]
*/
protected $custom_js_enable;
/**
* @var bool
*/
protected $main_page;
/**
* construct
*
* @param array $registered_elements
* @param array $registered_extensions
*/
public function __construct( $registered_elements, $registered_extensions ) {
$this->registered_elements = $registered_elements;
$this->registered_extensions = $registered_extensions;
$this->elements_manager = new Elements_Manager( $this->registered_elements, $this->registered_extensions );
$this->elements_manager->css_print_method = $this->css_print_method = get_option( 'elementor_css_print_method' );
$this->elements_manager->js_print_method = $this->js_print_method = get_option( 'eael_js_print_method' );
$this->init_hook();
$this->custom_js_enable = $this->get_settings( 'custom-js' );
}
/**
* init_hook
* Load Hook
*/
protected function init_hook() {
add_action( 'wp_footer', [ $this, 'add_inline_js' ], 100 );
add_action( 'wp_footer', [ $this, 'add_inline_css' ], 15 );
add_action( 'after_delete_post', [ $this, 'delete_cache_data' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'frontend_asset_load' ], 100 );
add_action( 'elementor/frontend/before_enqueue_styles', [ $this, 'ea_before_enqueue_styles' ] );
add_action( 'elementor/theme/register_locations', [ $this, 'load_asset_per_location' ], 20 );
add_filter( 'elementor/files/file_name', [ $this, 'load_asset_per_file' ] );
}
/**
* frontend_asset_load
* Load asset as per condition
* @return false|void
*/
public function frontend_asset_load() {
$handle = 'eael-general';
$this->post_id = get_the_ID();
$this->elements_manager->get_element_list( $this->post_id );
$this->load_commnon_asset();
$this->register_script();
if ( ! $this->is_edit() ) {
wp_enqueue_script( 'eael-general' );
wp_enqueue_style( 'eael-general' );
$this->load_custom_js( $this->post_id );
} else {
$elements = $this->get_settings();
if ( empty( $elements ) ) {
return false;
}
if ( $this->js_print_method == 'internal' ) {
wp_enqueue_script( 'eael-general' );
}
if ( $this->css_print_method == 'internal' ) {
wp_enqueue_style( 'eael-general' );
}
do_action( 'eael/before_enqueue_styles', $elements );
do_action( 'eael/before_enqueue_scripts', $elements );
$this->enqueue_asset( null, $elements, 'edit' );
$this->load_custom_js( $this->post_id );
}
wp_localize_script( $handle, 'localize', $this->localize_objects );
}
/**
* ea_before_enqueue_styles
* @return false|void
*/
public function ea_before_enqueue_styles() {
if ( $this->is_edit() ) {
return false;
}
$this->post_id = get_the_ID();
$this->set_main_page( $this->post_id );
$this->elements_manager->get_element_list( $this->post_id );
$elements = get_post_meta( $this->post_id, '_eael_widget_elements', true );
if ( ! empty( $elements ) ) {
$this->enqueue_asset( $this->post_id, $elements );
}
if ( ! $this->main_page ) {
$this->load_custom_js( $this->post_id );
}
}
/**
* load_asset_per_location
*
* @param $instance
*
* @return false|void
*/
public function load_asset_per_location( $instance ) {
if ( is_admin() || ! ( class_exists( 'ElementorPro\Modules\ThemeBuilder\Module' ) ) ) {
return false;
}
$locations = $instance->get_locations();
foreach ( $locations as $location => $settings ) {
$documents_module = \ElementorPro\Modules\ThemeBuilder\Module::instance();
if( method_exists( $documents_module, 'get_locations_manager' ) && method_exists( $documents_module->get_locations_manager(), 'get_documents_for_location' ) ){
$documents = $documents_module->get_locations_manager()->get_documents_for_location( $location );
} else {
$documents = $documents_module->get_conditions_manager()->get_documents_for_location( $location );
}
foreach ( $documents as $document ) {
if ( ! is_object( $document ) ) {
continue;
}
$post_id = $document->get_post()->ID;
$this->post_id = $post_id;
$this->set_main_page( $this->post_id );
$this->elements_manager->get_element_list( $this->post_id );
$elements = get_post_meta( $this->post_id, '_eael_widget_elements', true );
if ( ! empty( $elements ) ) {
do_action( 'eael/before_enqueue_styles', $elements );
do_action( 'eael/before_enqueue_scripts', $elements );
$this->enqueue_asset( $this->post_id, $elements );
}
if ( ! $this->main_page ) {
$this->load_custom_js( $this->post_id );
}
}
}
}
/**
* load_asset_per_file
* @param $file_name
*
* @return mixed
*/
public function load_asset_per_file( $file_name ) {
if( empty( $file_name ) ){
return $file_name;
}
$post_id = preg_replace( '/[^0-9]/', '', $file_name );
if ( $post_id < 1 ) {
return $file_name;
}
$this->post_id = $post_id;
$type = get_post_meta( $this->post_id, '_elementor_template_type', true );
$template_list = ['popup'];
$this->set_main_page( $this->post_id );
$this->elements_manager->get_element_list( $this->post_id );
$elements = get_post_meta( $this->post_id, '_eael_widget_elements', true );
if ( ! empty( $elements ) ) {
do_action( 'eael/before_enqueue_styles', $elements );
do_action( 'eael/before_enqueue_scripts', $elements );
$this->enqueue_asset( $this->post_id, $elements );
}
if ( ! $this->main_page ) {
$this->load_custom_js( $this->post_id );
}
return $file_name;
}
/**
* add_inline_js
* Load inline js data
*/
public function add_inline_js() {
if ( $this->is_edit_mode() || $this->is_preview_mode() ) {
if ( $this->custom_js ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<script>%1$s</script>', 'var localize =' . wp_json_encode( $this->localize_objects ) );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<script id="eael-inline-js">%s</script>', $this->custom_js );
}
}
}
/**
* add_inline_css
* Load inline css file
*/
public function add_inline_css() {
if ( $this->is_edit_mode() || $this->is_preview_mode() ) {
if ( $this->css_strings ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<style id="eael-inline-css">%s</style>', $this->css_strings );
}
}
}
public function register_script() {
$css_deps = [ 'elementor-frontend' ];
$js_deps = [ 'jquery' ];
$theme = wp_get_theme(); // gets the current theme
$theme_data = $theme->parent() ? $theme->parent() : $theme;
if ( 'Hello Elementor' === $theme_data->name && version_compare( $theme_data->Version, '2.1.0', '>=' ) && wp_style_is( 'hello-elementor-theme-style', 'registered' ) ) {
array_unshift( $css_deps, 'hello-elementor-theme-style' );
} elseif ( in_array( 'Astra', [ $theme->name, $theme->parent_theme ] ) && wp_style_is( 'astra-theme-css', 'registered' ) ) {
array_unshift( $css_deps, 'astra-theme-css' );
} elseif ( in_array( 'XStore', [ $theme->name, $theme->parent_theme ] ) ) {
$js_deps[] = 'etheme';
}
if ( class_exists( 'Cartflows_Loader' ) && wcf()->utils->is_step_post_type() ) {
$css_deps = [ 'elementor-frontend' ];
}
wp_register_script( 'eael-general', EAEL_PLUGIN_URL . 'assets/front-end/js/view/general.min.js', $js_deps, EAEL_PLUGIN_VERSION, true );
wp_register_style( 'eael-general', EAEL_PLUGIN_URL . "assets/front-end/css/view/general.min.css", $css_deps, EAEL_PLUGIN_VERSION );
}
/**
* load_common_asset
* Load common asset file
*/
public function load_commnon_asset() {
wp_register_style(
'font-awesome-5-all',
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',
false,
EAEL_PLUGIN_VERSION
);
wp_register_style(
'font-awesome-4-shim',
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/v4-shims.min.css',
false,
EAEL_PLUGIN_VERSION
);
wp_register_script(
'font-awesome-4-shim',
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/js/v4-shims.min.js',
false,
EAEL_PLUGIN_VERSION
);
// register reading progress assets
wp_register_style(
'eael-reading-progress',
EAEL_PLUGIN_URL . 'assets/front-end/css/view/reading-progress.min.css',
false,
EAEL_PLUGIN_VERSION
);
wp_register_script(
'eael-reading-progress',
EAEL_PLUGIN_URL . 'assets/front-end/js/view/reading-progress.min.js',
[ 'jquery' ],
EAEL_PLUGIN_VERSION
);
// register Table of contents assets
wp_register_style(
'eael-table-of-content',
EAEL_PLUGIN_URL . 'assets/front-end/css/view/table-of-content.min.css',
false,
EAEL_PLUGIN_VERSION
);
wp_register_script(
'eael-table-of-content',
EAEL_PLUGIN_URL . 'assets/front-end/js/view/table-of-content.min.js',
[ 'jquery' ],
EAEL_PLUGIN_VERSION
);
// register scroll to top assets
wp_register_style(
'eael-scroll-to-top',
EAEL_PLUGIN_URL . 'assets/front-end/css/view/scroll-to-top.min.css',
false,
EAEL_PLUGIN_VERSION
);
wp_register_script(
'eael-scroll-to-top',
EAEL_PLUGIN_URL . 'assets/front-end/js/view/scroll-to-top.min.js',
[ 'jquery' ],
EAEL_PLUGIN_VERSION
);
// register custom cursor assets
do_action( 'eael/register_custom_cursor_assets' );
// localize object
$this->localize_objects = apply_filters( 'eael/localize_objects', [
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'essential-addons-elementor' ),
'i18n' => [
'added' => __( 'Added ', 'essential-addons-for-elementor-lite' ),
'compare' => __( 'Compare', 'essential-addons-for-elementor-lite' ),
'loading' => esc_html__( 'Loading...', 'essential-addons-for-elementor-lite' )
],
'eael_translate_text' => [
'required_text' => esc_html__( 'is a required field', 'essential-addons-for-elementor-lite' ),
'invalid_text' => esc_html__( 'Invalid', 'essential-addons-for-elementor-lite' ),
'billing_text' => esc_html__( 'Billing', 'essential-addons-for-elementor-lite' ),
'shipping_text' => esc_html__( 'Shipping', 'essential-addons-for-elementor-lite' ),
'fg_mfp_counter_text' => apply_filters( 'eael/filterble-gallery/mfp-counter-text', __( 'of', 'essential-addons-for-elementor-lite' ) ),
],
'page_permalink' => get_the_permalink(),
'cart_redirectition' => get_option( 'woocommerce_cart_redirect_after_add' ),
'cart_page_url' => function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : '',
'el_breakpoints' => method_exists( Plugin::$instance->breakpoints, 'get_breakpoints_config' ) ? Plugin::$instance->breakpoints->get_breakpoints_config() : '',
] );
}
/**
* enqueue_asset
*
* @param int $post_id
* @param array $elements
* @param string $context
*/
public function enqueue_asset( $post_id = null, $elements = [], $context = 'view' ) {
$dynamic_asset_id = ( $post_id ? '-' . $post_id : '' );
if ( $this->css_print_method == 'internal' ) {
$this->css_strings .= $this->elements_manager->generate_strings( $elements, $context, 'css' );
} else {
if ( ! $this->has_asset( $post_id, 'css' ) ) {
$this->elements_manager->generate_script( $post_id, $elements, $context, 'css' );
}
wp_enqueue_style(
'eael' . $dynamic_asset_id,
$this->safe_url( EAEL_ASSET_URL . '/' . 'eael' . $dynamic_asset_id . '.css' ),
[ 'eael-general' ],
get_post_modified_time()
);
}
if ( $this->js_print_method == 'internal' ) {
$this->custom_js .= $this->elements_manager->generate_strings( $elements, $context, 'js' );
} else {
if ( ! $this->has_asset( $post_id, 'js' ) ) {
$this->elements_manager->generate_script( $post_id, $elements, $context, 'js' );
}
wp_enqueue_script(
'eael' . $dynamic_asset_id,
$this->safe_url( EAEL_ASSET_URL . '/' . 'eael' . $dynamic_asset_id . '.js' ),
[ 'eael-general' ],
get_post_modified_time(),
true
);
}
}
/**
* delete_cache_data
*
* @param int $post_id
*/
public function delete_cache_data( $post_id ) {
$this->elements_manager->remove_files( $post_id );
delete_post_meta( $post_id, '_eael_custom_js' );
delete_post_meta( $post_id, '_eael_widget_elements' );
}
/**
* has_asset
*
* @param int $post_id
* @param string $file
*
* @return bool
*/
public function has_asset( $post_id, $file = 'css' ) {
if ( file_exists( $this->safe_path( EAEL_ASSET_PATH . '/' . 'eael' . ( $post_id ? '-' . $post_id : '' ) . '.' . $file ) ) ) {
return true;
}
return false;
}
public function load_custom_js( $post_id ) {
static $post_ids_array = [];
if ( in_array( $post_id, $post_ids_array ) ) {
return false;
}
$post_ids_array[] = $post_id;
if ( ! $this->custom_js_enable ) {
return false;
}
$custom_js = get_post_meta( $post_id, '_eael_custom_js', true );
if ( $custom_js ) {
// add semicolon if someone misses adding this in custom js code .
$this->custom_js .= $custom_js.';';
}
}
/**
* is_edit
* check is edit page
* @return bool
*/
public function is_edit() {
return (
Plugin::instance()->editor->is_edit_mode() ||
Plugin::instance()->preview->is_preview_mode() ||
is_preview()
);
}
/**
* set_main_page
*
* @param $post_id
*/
protected function set_main_page( $post_id ) {
$this->main_page = get_post_meta( $post_id, '_elementor_template_type', true ) == 'wp-page';
}
}
@@ -0,0 +1,382 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly
use Elementor\Plugin;
use Essential_Addons_Elementor\Traits\Admin;
use Essential_Addons_Elementor\Traits\Core;
use Essential_Addons_Elementor\Traits\Elements;
use Essential_Addons_Elementor\Traits\Enqueue;
use Essential_Addons_Elementor\Traits\Helper;
use Essential_Addons_Elementor\Traits\Library;
use Essential_Addons_Elementor\Traits\Login_Registration;
use Essential_Addons_Elementor\Traits\Woo_Product_Comparable;
use Essential_Addons_Elementor\Traits\Controls;
use Essential_Addons_Elementor\Traits\Facebook_Feed;
use Essential_Addons_Elementor\Classes\Asset_Builder;
use Essential_Addons_Elementor\Traits\Ajax_Handler;
use Essential_Addons_Elementor\Pro\Classes\License\LicenseManager;
class Bootstrap
{
use Library;
use Core;
use Helper;
use Enqueue;
use Admin;
use Elements;
use Login_Registration;
use Woo_Product_Comparable;
use Controls;
use Facebook_Feed;
use Ajax_Handler;
// instance container
private static $instance = null;
// request unique id container
protected $uid = null;
// registered elements container
protected $registered_elements;
// registered extensions container
protected $registered_extensions;
// identify whether pro is enabled
protected $pro_enabled;
// localize objects
public $localize_objects = [];
// request data container
protected $request_requires_update;
// loaded templates in a request
protected $loaded_templates = [];
// loaded elements in a request
protected $loaded_elements = [];
// used for internal css
protected $css_strings;
// used for internal js
protected $js_strings;
// used to store custom js
protected $custom_js_strings;
// modules
protected $installer;
const EAEL_PROMOTION_FLAG = 18;
const EAEL_ADMIN_MENU_FLAG = 18;
/**
* Singleton instance
*
* @since 3.0.0
*/
public static function instance()
{
if (self::$instance == null) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Constructor of plugin class
*
* @since 3.0.0
*/
private function __construct()
{
// init modules
$this->installer = new WPDeveloper_Plugin_Installer();
// before init hook
do_action('eael/before_init');
// search for pro version
$this->pro_enabled = apply_filters('eael/pro_enabled', false);
// elements classmap
$this->registered_elements = apply_filters('eael/registered_elements', $GLOBALS['eael_config']['elements']);
// extensions classmap
$this->registered_extensions = apply_filters('eael/registered_extensions', $GLOBALS['eael_config']['extensions']);
// start plugin tracking
if ( ! $this->pro_enabled ) {
add_action( 'init', [ $this, 'start_plugin_tracking' ] );
}
// register extensions
$this->register_extensions();
// register hooks
$this->register_hooks();
if ( $this->is_activate_elementor() ) {
new Asset_Builder( $this->registered_elements, $this->registered_extensions );
}
// Compatibility Support
new Compatibility_Support();
}
protected function register_hooks() {
// Core
add_action('init', [$this, 'i18n']);
// TODO::RM
add_filter('eael/active_plugins', [$this, 'is_plugin_active'], 10, 1);
add_filter('eael/is_plugin_active', [$this, 'is_plugin_active'], 10, 1);
add_action('elementor/editor/after_save', array($this, 'save_global_values'), 10, 2);
add_action('trashed_post', array($this, 'save_global_values_trashed_post'), 10, 1);
// Enqueue
add_action('eael/before_enqueue_styles', [$this, 'before_enqueue_styles']);
add_action('elementor/editor/before_enqueue_scripts', [$this, 'editor_enqueue_scripts']);
add_action('elementor/frontend/before_register_scripts', [$this, 'frontend_enqueue_scripts']);
// Generator
$this->init_ajax_hooks();
// Ajax
add_action('wp_ajax_facebook_feed_load_more', [$this, 'facebook_feed_render_items']);
add_action('wp_ajax_nopriv_facebook_feed_load_more', [$this, 'facebook_feed_render_items']);
// Compare table
add_action( 'wp_ajax_nopriv_eael_product_grid', [$this, 'get_compare_table']);
add_action( 'wp_ajax_eael_product_grid', [$this, 'get_compare_table']);
add_action( 'wp_ajax_eael_clear_widget_cache_data', [ $this, 'eael_clear_widget_cache_data' ] );
if ( defined( 'ELEMENTOR_VERSION' ) ) {
if ( version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
add_action( 'elementor/controls/register', array( $this, 'register_controls' ) );
add_action('elementor/widgets/register', array($this, 'register_elements'));
} else {
add_action( 'elementor/controls/controls_registered', array( $this, 'register_controls' ) );
add_action('elementor/widgets/widgets_registered', array($this, 'register_elements'));
}
}
// Elements
add_action('elementor/elements/categories_registered', array($this, 'register_widget_categories'));
add_filter('elementor/editor/localize_settings', [$this, 'promote_pro_elements']);
add_action('wp_footer', [$this, 'render_global_html']);
add_action('wp_footer', [$this, 'render_advanced_accordion_global_faq']);
// Controls
add_action('eael/controls/query', [$this, 'query'], 10, 1);
add_action('eael/controls/betterdocs/query', [$this, 'betterdocs_query'], 10, 1);
add_action('eael/controls/layout', [$this, 'layout'], 10, 1);
add_action('eael/controls/terms_style', [$this, 'terms_style'], 10, 1);
add_action('eael/controls/read_more_button_style', [$this, 'read_more_button_style'], 10, 1);
add_action('eael/controls/load_more_button_style', [$this, 'load_more_button_style'], 10, 1);
add_action('eael/controls/custom_positioning', [$this, 'custom_positioning'], 10, 5);
add_action('eael/controls/nothing_found_style', [$this, 'nothing_found_style'], 10, 1);
add_filter('eael/controls/event-calendar/source', [$this, 'event_calendar_source']);
add_action('eael/controls/advanced-data-table/source', [$this, 'advanced_data_table_source']);
// Login | Register
add_action('init', [$this, 'login_or_register_user']);
add_filter('wp_new_user_notification_email', array($this, 'new_user_notification_email'), 10, 3);
add_filter('wp_new_user_notification_email_admin', array($this, 'new_user_notification_email_admin'), 10, 3);
add_action( 'init', [$this, 'eael_redirect_to_reset_password'] );
if( 'on' === get_option( 'eael_custom_profile_fields' ) ){
add_action( 'show_user_profile', [ $this, 'eael_extra_user_profile_fields' ] );
add_action( 'edit_user_profile', [ $this, 'eael_extra_user_profile_fields' ] );
add_action( 'personal_options_update', [ $this, 'eael_save_extra_user_profile_fields' ] );
add_action( 'edit_user_profile_update', [ $this, 'eael_save_extra_user_profile_fields' ] );
}
//rank math support
add_filter('rank_math/researches/toc_plugins', [$this, 'toc_rank_math_support']);
// if(defined('WPML_TM_VERSION')){
// add_filter( 'elementor/documents/get/post_id',[$this, 'eael_wpml_template_translation']);
// }
//templately plugin support
if( !class_exists('Templately\Plugin') && !get_option('eael_templately_promo_hide') ) {
add_action( 'elementor/editor/before_enqueue_scripts', [$this, 'templately_promo_enqueue_scripts'] );
add_action( 'eael/before_enqueue_styles', [$this, 'templately_promo_enqueue_style'] );
add_action( 'elementor/editor/footer', [ $this, 'print_template_views' ] );
add_action( 'wp_ajax_templately_promo_status', array($this, 'templately_promo_status'));
}
if( class_exists( 'woocommerce' ) ) {
// quick view
add_action( 'eael_woo_single_product_image', 'woocommerce_show_product_images', 20 );
add_action( 'eael_woo_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'eael_woo_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'eael_woo_single_product_summary', 'woocommerce_template_single_price', 15 );
add_action( 'eael_woo_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'eael_woo_single_product_summary', 'woocommerce_template_single_add_to_cart', 25 );
add_action( 'eael_woo_single_product_summary', 'woocommerce_template_single_meta', 30 );
add_filter( 'eael_product_wrapper_class', [ $this, 'eael_product_wrapper_class' ], 10, 3 );
add_action('wp_ajax_eael_checkout_cart_qty_update', [$this, 'eael_checkout_cart_qty_update'] );
add_action('wp_ajax_nopriv_eael_checkout_cart_qty_update', [$this, 'eael_checkout_cart_qty_update'] );
add_action( 'wp_loaded', [ $this, 'eael_woo_cart_empty_action' ], 20 );
add_filter( 'woocommerce_checkout_fields', [ $this, 'eael_customize_woo_checkout_fields' ] );
add_action( 'eael_woo_before_product_loop', function ( $layout ) {
if ( $layout === 'eael-product-default' ) {
return;
}
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open' );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close' );
remove_action( 'woocommerce_after_shop_loop_item', 'astra_woo_woocommerce_shop_product_content' );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
} );
add_action( 'eael_woo_after_product_loop', function ( $layout ) {
if ( $layout === 'eael-product-default' ) {
return;
}
add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open' );
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close' );
//Get current active theme
$theme = wp_get_theme();
$theme = $theme->parent() ? $theme->parent() : $theme;
//Astra Theme
if( function_exists( 'astra_woo_woocommerce_shop_product_content' ) ){
add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_woocommerce_shop_product_content' );
} else {
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}
//Theme Support
$theme_to_check = ['OceanWP', 'Blocksy', 'Travel Ocean'];
if( in_array( $theme->name, $theme_to_check, true ) ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}
} );
add_filter( 'wcml_multi_currency_ajax_actions', function ( $ajax_actions ) {
$ajax_actions[] = 'load_more';
return $ajax_actions;
} );
}
// Admin
if ( is_admin() ) {
// Admin
if (!$this->pro_enabled) {
add_action( 'admin_init', [ $this, 'admin_notice' ] );
} else {
new WPDeveloper_Core_Installer( basename( EAEL_PLUGIN_BASENAME, '.php' ) );
}
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_dequeue_scripts' ), 100 );
// Core
add_filter('plugin_action_links_' . EAEL_PLUGIN_BASENAME, array($this, 'insert_plugin_links'));
add_filter('plugin_row_meta', array($this, 'insert_plugin_row_meta'), 10, 2);
// removed activation redirection temporarily
// add_action('admin_init', array($this, 'redirect_on_activation'));
if ( ! did_action( 'elementor/loaded' ) ) {
add_action( 'admin_notices', array( $this, 'elementor_not_loaded' ) );
add_action( 'eael_admin_notices', array( $this, 'elementor_not_loaded' ) );
}
add_action( 'in_admin_header', [ $this, 'remove_admin_notice' ], 99 );
//handle typeform auth token
add_action('admin_init', [$this, 'typeform_auth_handle']);
// On Editor - Register WooCommerce frontend hooks before the Editor init.
// Priority = 5, in order to allow plugins remove/add their wc hooks on init.
if ( ! empty( $_REQUEST['action'] ) && 'elementor' === $_REQUEST['action'] ) {
add_action( 'init', [ $this, 'register_wc_hooks' ], 5 );
}
// update admin menu notice flag once visit EA settings page
add_action( 'eael_admin_page_setting', [ $this, 'eael_show_admin_menu_notice' ] );
if ( ! current_user_can( 'administrator' ) ) {
add_filter( 'elementor/document/save/data', function ( $data ) {
if ( isset( $data['settings']['eael_custom_js'] ) ) {
$data['settings']['eael_custom_js'] = get_post_meta( get_the_ID(), '_eael_custom_js', true );
}
if ( empty( $data['elements'] ) ) {
return $data;
}
$data['elements'] = Plugin::$instance->db->iterate_data( $data['elements'], function ( $element ) {
if ( isset( $element['widgetType'] ) && $element['widgetType'] === 'eael-login-register' ) {
if ( ! empty( $element['settings']['register_user_role'] ) ) {
$element['settings']['register_user_role'] = '';
}
}
if ( isset( $element['widgetType'] ) && $element['widgetType'] === 'eicon-woocommerce' ) {
if ( ! empty( $element['settings']['eael_product_grid_products_status'] ) ) {
$element['settings']['eael_product_grid_products_status'] = [ 'publish' ];
}
}
if ( ! current_user_can( 'install_plugins' ) && isset( $element['widgetType'] ) && $element['widgetType'] === 'eaicon-advanced-data-table' ) {
if ( ! empty( $element['settings']['ea_adv_data_table_source'] ) ) {
$element['settings']['ea_adv_data_table_source'] = 'static';
}
}
return $element;
} );
return $data;
} );
}
} else {
add_action( 'wp', [ $this, 'eael_post_view_count' ] );
}
// beehive theme compatibility
add_filter( 'beehive_scripts', array( $this, 'beehive_theme_swiper_slider_compatibility' ), 999 );
// init plugin updater with version check
if ( defined( 'EAEL_PRO_PLUGIN_VERSION' ) && version_compare( EAEL_PRO_PLUGIN_VERSION, '6.2.2', '>=' ) && version_compare( EAEL_PRO_PLUGIN_VERSION, '6.2.3', '<=' ) ) {
add_action( 'init', [ $this, 'eael_init_plugin_updater' ], 99 );
}
}
/**
* Initialize plugin updater
*
* @since 6.1.14
*/
function eael_init_plugin_updater() {
if ( is_admin() ) {
$license_manager = LicenseManager::get_instance( [] );
$license_manager->plugin_updater();
}
}
}
@@ -0,0 +1,80 @@
<?php
namespace Essential_Addons_Elementor\Classes;
class Compatibility_Support {
public function __construct() {
if ( $this->is_mondialrelay_plugin_active() ) {
add_action( 'eael_mondialrelay_order_after_shipping', [$this, 'eael_mondialrelay_shipping_action'] );
}
}
/**
* Handles Mondial Relay shipping method integration
* Checks if the plugin is active and adds necessary shipping form actions
*
* @return void
*/
public function eael_mondialrelay_shipping_action() {
// Check if Mondial Relay plugin is active
if (!$this->is_mondialrelay_plugin_active()) {
return;
}
// Get the chosen shipping method
$chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');
if (empty($chosen_shipping_methods)) {
return;
}
// Parse shipping method details
$method_string = $chosen_shipping_methods[0];
list($method_id, $instance_id) = explode(':', $method_string);
// Add shipping form if Mondial Relay is selected
if ($method_id === 'mondialrelay_official_shipping') {
add_action( 'woocommerce_review_order_after_shipping', [$this, 'eael_mondialrelay_shipping_form_after'] );
}
}
/**
* Checks if Mondial Relay plugin is active
*
* @return bool
*/
private function is_mondialrelay_plugin_active() {
// Include plugin.php to ensure plugin functions are available
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugin_path = 'mondialrelay-wordpress/mondialrelay-wordpress.php';
return in_array( $plugin_path, apply_filters('active_plugins', get_option('active_plugins' ) ) ) || is_plugin_active_for_network( $plugin_path );
}
/**
* Renders the Mondial Relay shipping form in the WooCommerce checkout page.
* This method adds a table row customly from EA plugin
* @since 1.0.0
* @return void
*/
public function eael_mondialrelay_shipping_form_after() {
?>
<tr class="mrwp" style="display:none">
<th><?php echo __('Livraison Mondial Relay','essential-addons-for-elementor-lite');?>
<br>
<em id="parcel_shop_info" class="parcel_shop_info"><?php echo __("Vous n'avez pas encore choisi de Point Relais®",'essential-addons-for-elementor-lite');?></em>
</th>
<td><a id="modaal_link" class="modaal_link" href="#modaal"><?php echo __('Choisir un Point Relais®', 'essential-addons-for-elementor-lite'); ?></a></td>
</tr>
<script>
jQuery(".modaal_link").modaal({
overlay_opacity: .4,
after_open: mrwpModaalOpen,
after_callback_delay: 100,
before_open: mrwpResetSearch,
content_source: "#modaal"
});
</script>
<?php
}
}
@@ -0,0 +1,413 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
use Elementor\Plugin;
use Essential_Addons_Elementor\Traits\Library;
class Elements_Manager {
use Library;
/**
* custom key name which are used for store widget list in option table
*/
const ELEMENT_KEY = '_eael_widget_elements';
/**
* This is hold custom js data in option table
*/
const JS_KEY = '_eael_custom_js';
public $css_print_method;
public $js_print_method;
/**
* Post id
* @var string
*/
protected $post_id;
/**
* registered element list from essential addons settings
* @var array
*/
protected $registered_elements;
/**
* registered extensions list from essential addons settings
* @var array
*/
protected $registered_extensions;
/**
* __construct
* @param array $registered_elements
* @param array $registered_extensions
*/
public function __construct( $registered_elements, $registered_extensions ) {
$this->registered_elements = $registered_elements;
$this->registered_extensions = $registered_extensions;
add_action( 'elementor/editor/after_save', array( $this, 'eael_elements_cache' ), 10, 2 );
}
/**
* eael_elements_cache
* Save widget name list in option table for improve performance.
* @param int $post_id
* @param array $data
*/
public function eael_elements_cache( $post_id, $data ) {
$widget_list = $this->get_widget_list( $data );
$page_setting = get_post_meta( $post_id, '_elementor_page_settings', true );
$custom_js = isset( $page_setting['eael_custom_js'] ) ? trim( $page_setting['eael_custom_js'] ) : '';
$this->save_widgets_list( $post_id, $widget_list, $custom_js );
}
/**
* get_widget_list
* get widget names
* @param array $data
*
* @return array
*/
public function get_widget_list( $data ) {
$widget_list = [];
$replace = $this->replace_widget_name();
if ( is_object( Plugin::$instance->db ) ) {
Plugin::$instance->db->iterate_data( $data, function ( $element ) use ( &$widget_list, $replace ) {
if ( empty( $element['widgetType'] ) ) {
$type = $element['elType'];
} else {
$type = $element['widgetType'];
}
if ( ! empty( $element['widgetType'] ) && $element['widgetType'] === 'global' ) {
$document = Plugin::$instance->documents->get( $element['templateID'] );
$type = is_object( $document ) ? current( $this->get_widget_list( $document->get_elements_data() ) ) : $type;
if ( ! empty( $type ) ) {
$type = 'eael-' . $type;
}
}
if ( ! empty( $type ) && ! is_array( $type ) ) {
if ( isset( $replace[ $type ] ) ) {
$type = $replace[ $type ];
}
if ( strpos( $type, 'eael-' ) !== false ) {
$type = str_replace( 'eael-', '', $type );
if ( ! isset( $widget_list[ $type ] ) ) {
$widget_list[ $type ] = $type;
}
}
$widget_list += $this->get_extension_list( $element );
}
} );
}
return $widget_list;
}
/**
* get_element_list
* get cached widget list
* @param $post_id
*
* @return bool
*/
public function get_element_list( $post_id ) {
if ( is_object( Plugin::instance()->editor ) && Plugin::instance()->editor->is_edit_mode() ) {
return false;
}
if ( $this->has_exist( $post_id ) ) {
return false;
}
$document = is_object( Plugin::$instance->documents ) ? Plugin::$instance->documents->get( $post_id ) : [];
$data = is_object( $document ) ? $document->get_elements_data() : [];
$data = $this->get_widget_list( $data );
$this->save_widgets_list( $post_id, $data, false );
return true;
}
/**
* get_extension_list
* get extension name those name had been changed for some reason.
* @param array $element
*
* @return array
*/
public function get_extension_list( $element ) {
$list = [];
if ( isset( $element['elType'] ) && ( $element['elType'] == 'section' || $element['elType'] == 'container' ) ) {
if ( ! empty( $element['settings']['eael_particle_switch'] ) ) {
$list['section-particles'] = 'section-particles';
}
if ( ! empty( $element['settings']['eael_parallax_switcher'] ) ) {
$list['section-parallax'] = 'section-parallax';
}
} else {
if ( ! empty( $element['settings']['eael_tooltip_section_enable'] ) ) {
$list['tooltip-section'] = 'tooltip-section';
}
if ( ! empty( $element['settings']['eael_ext_content_protection'] ) ) {
$list['content-protection'] = 'content-protection';
}
}
if ( ! empty( $element['settings']['eael_wrapper_link_switch'] ) ) {
$list['wrapper-link'] = 'wrapper-link';
}
if ( ! empty( $element['settings']['eael_enable_custom_cursor'] ) || ! empty( $element['settings']['eael_cursor_trail_show'] ) ) {
$list['custom-cursor'] = 'custom-cursor';
}
if ( ! empty( $element['settings']['eael_ext_advanced_dynamic_tags'] ) ) {
$list['advanced-dynamic-tags'] = 'advanced-dynamic-tags';
}
//Smooth Animation
if ( ! empty( $element['settings']['eael_smooth_animation_section'] ) ) {
$list['smooth-animation'] = 'smooth-animation';
}
//Hover Interactions
if ( ! empty( $element['settings']['eael_hover_effect_switch'] ) ) {
$list['special-hover-effect'] = 'special-hover-effect';
}
//Liquid Glass Effects
if ( ! empty( $element['settings']['eael_liquid_glass_effect_switch'] ) ) {
$list['liquid-glass-effect'] = 'liquid-glass-effect';
}
//Image Masking
if ( ! empty( $element['settings']['eael_enable_image_masking'] ) ) {
$list['image-masking'] = 'image-masking';
}
return $list;
}
/*
* replace_widget_name
* Added backward compatibility
*/
public static function replace_widget_name() {
return [
'eicon-woocommerce' => 'eael-product-grid',
'eael-countdown' => 'eael-count-down',
'eael-creative-button' => 'eael-creative-btn',
'eael-team-member' => 'eael-team-members',
'eael-testimonial' => 'eael-testimonials',
'eael-weform' => 'eael-weforms',
'eael-cta-box' => 'eael-call-to-action',
'eael-dual-color-header' => 'eael-dual-header',
'eael-pricing-table' => 'eael-price-table',
'eael-filterable-gallery' => 'eael-filter-gallery',
'eael-one-page-nav' => 'eael-one-page-navigation',
'eael-interactive-card' => 'eael-interactive-cards',
'eael-image-comparison' => 'eael-img-comparison',
'eael-dynamic-filterable-gallery' => 'eael-dynamic-filter-gallery',
'eael-google-map' => 'eael-adv-google-map',
'eael-instafeed' => 'eael-instagram-gallery',
'eael-ninja' => 'eael-ninja-form',
];
}
/**
* save_widgets_list
* save widget list and custom js data in option table
* @param int $post_id
* @param array $list
* @param string $custom_js
*
* @return bool|mixed
*/
public function save_widgets_list( $post_id, $list, $custom_js = '' ) {
if ( \defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_id;
}
$documents = is_object( Plugin::$instance->documents ) ? Plugin::$instance->documents->get( $post_id ) : [];
if ( ! in_array( get_post_status( $post_id ), [ 'publish', 'private' ] ) || ( is_object( $documents ) && ! $documents->is_built_with_elementor() ) ) {
return false;
}
if ( in_array( get_post_meta( $post_id, '_elementor_template_type', true ), $this->excluded_template_type() ) ) {
return false;
}
if ( $custom_js !== false ) {
update_post_meta( $post_id, '_eael_custom_js', $custom_js );
}
if ( md5( implode( '', (array) $list ) ) == md5( implode( '', (array) get_post_meta( $post_id, self::ELEMENT_KEY, true ) ) ) ) {
return false;
}
try {
update_post_meta( $post_id, self::ELEMENT_KEY, $list );
$this->remove_files( $post_id );
if ( $this->has_exist( $post_id ) ) {
$this->update_asset( $post_id, $list );
}
return true;
} catch ( \Exception $e ) {
return false;
}
}
/**
* generate_script
* create js/css file as per widget loaded in page
* @param int $post_id
* @param array $elements
* @param string $context
* @param string $ext
*/
public function generate_script( $post_id, $elements, $context, $ext ) {
// if folder not exists, create new folder
if ( ! file_exists( EAEL_ASSET_PATH ) ) {
wp_mkdir_p( EAEL_ASSET_PATH );
}
// naming asset file
$file_name = 'eael' . ( $post_id ? '-' . $post_id : '' ) . '.' . $ext;
// output asset string
$output = $this->generate_strings( $elements, $context, $ext );
// write to file
$file_path = $this->safe_path( EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . $file_name );
file_put_contents( $file_path, $output );
}
/**
* generate_strings
* Load assets for inline loading
* @param string $elements
* @param string $context
* @param string $ext
*
* @return string
*/
public function generate_strings( $elements, $context, $ext ) {
$output = '';
$paths = $this->generate_dependency( $elements, $context, $ext );
if ( ! empty( $paths ) ) {
foreach ( $paths as $path ) {
$output .= file_get_contents( $this->safe_path( $path ) );
}
}
return $output;
}
/**
* generate_dependency
* Load core library for widget list which are defined on config.php file
* @param array $elements
* @param string $context
* @param string $type
*
* @return array
*/
public function generate_dependency( $elements, $context, $type ) {
$lib = [ 'view' => [], 'edit' => [] ];
$self = [ 'general' => [], 'view' => [], 'edit' => [] ];
if ( $type == 'js' ) {
$self['general'][] = EAEL_PLUGIN_PATH . 'assets/front-end/js/view/general.min.js';
$self['edit'][] = EAEL_PLUGIN_PATH . 'assets/front-end/js/edit/promotion.min.js';
} else if ( $type == 'css' && ! $this->is_edit_mode() ) {
$self['view'][] = EAEL_PLUGIN_PATH . "assets/front-end/css/view/general.min.css";
}
foreach ( $elements as $element ) {
if ( isset( $this->registered_elements[ $element ] ) ) {
if ( ! empty( $this->registered_elements[ $element ]['dependency'][ $type ] ) ) {
foreach ( $this->registered_elements[ $element ]['dependency'][ $type ] as $file ) {
if ( ! empty( $file['type'] ) && ! empty( $file['context'] ) && ! empty( $file['file'] ) ) {
${$file['type']}[ $file['context'] ][] = $file['file'];
}
}
}
} elseif ( isset( $this->registered_extensions[ $element ] ) ) {
if ( ! empty( $this->registered_extensions[ $element ]['dependency'][ $type ] ) ) {
foreach ( $this->registered_extensions[ $element ]['dependency'][ $type ] as $file ) {
if ( ! empty( $file['type'] ) && ! empty( $file['context'] ) && ! empty( $file['file'] ) ) {
${$file['type']}[ $file['context'] ][] = $file['file'];
}
}
}
}
}
if ( $context == 'view' ) {
return array_unique( array_merge( $lib['view'], $self['view'] ) );
}
return array_unique( array_merge( $lib['view'], $lib['edit'], $self['edit'], $self['view'] ) );
}
/**
* has_exist
* @param $post_id
* check widget list already saved in option table weather load or not
* @return bool
*/
public function has_exist( $post_id ) {
$status = get_post_meta( $post_id, self::ELEMENT_KEY, true );
return ! empty( $status );
}
/**
* update_asset
* @param int $post_id
* @param $elements
*/
public function update_asset( $post_id, $elements ) {
if ( $this->css_print_method != 'internal' ) {
$this->generate_script( $post_id, $elements, 'view', 'css' );
}
if ( $this->js_print_method != 'internal' ) {
$this->generate_script( $post_id, $elements, 'view', 'js' );
}
}
/**
* excluded_template_type
* @return string[]
*/
public function excluded_template_type() {
return [
'kit',
];
}
}
@@ -0,0 +1,112 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly
class Migration
{
use \Essential_Addons_Elementor\Traits\Core;
use \Essential_Addons_Elementor\Traits\Library;
/**
* Plugin activation hook
*
* @since 3.0.0
*/
public function plugin_activation_hook()
{
// remove old cache files
$this->empty_dir(EAEL_ASSET_PATH);
//check setup wizard condition
$this->enable_setup_wizard();
// save default values
$this->set_default_values();
}
/**
* Plugin deactivation hook
*
* @since 3.0.0
*/
public function plugin_deactivation_hook()
{
$this->empty_dir(EAEL_ASSET_PATH);
}
/**
* Plugin upgrade hook
*
* @since 3.0.0
*/
public function plugin_upgrade_hook( $upgrader_object, $options ) {
if ( isset( $options['action'], $options['type'] ) && $options['action'] === 'update' && $options['type'] === 'plugin' ) {
if ( ( isset( $options['plugins'] ) &&
( in_array( EAEL_PLUGIN_BASENAME, $options['plugins'] ) ||
in_array( 'essential-addons-elementor/essential_adons_elementor.php', $options['plugins'] )
)
) || ( isset( $options['plugin'] ) &&
in_array( $options['plugin'], [ EAEL_PLUGIN_BASENAME, 'essential-addons-elementor/essential_adons_elementor.php' ] )
)
) {
// remove old cache files
$this->empty_dir( EAEL_ASSET_PATH );
}
}
}
/**
* Plugin migrator
*
* @since 3.0.0
*/
public function migrator() {
// set current version to db
if ( get_option( 'eael_version' ) != EAEL_PLUGIN_VERSION ) {
// update plugin version
update_option( 'eael_version', EAEL_PLUGIN_VERSION );
}
add_action( 'eael_after_clear_cache_files', [ $this, 'reduce_options_data' ] );
}
public function reduce_options_data() {
$status = get_transient( 'eael_reduce_op_table_data' );
if ( $status ) {
return false;
}
global $wpdb;
$sql = "from {$wpdb->options} as options_tb
inner join (SELECT option_id FROM {$wpdb->options}
WHERE ((option_name like '%\_eael_elements' and LENGTH(option_name) = 23 )
or (option_name like '%\_eael_custom_js' and LENGTH(option_name) = 24)
or (option_name like '%\_eael_updated_at' and LENGTH(option_name) = 25)
or (option_name = 'eael_reduce_op_table_data')
or (option_name = 'eael_remove_old_cache')
or (option_name = 'eael_editor_updated_at')
or (option_name = 'eael_gb_eb_popup_hide')
or (option_name like 'eael_login_error_%'))
) AS options_tb2
ON options_tb2.option_id = options_tb.option_id";
$selection_sql = "select count(options_tb.option_id) as total " . $sql;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$results = $wpdb->get_var( $selection_sql );
if ( $results > 0 ) {
$deletiation_sql = "delete options_tb " . $sql;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->query( $deletiation_sql );
}
set_transient( 'eael_reduce_op_table_data', 1, DAY_IN_SECONDS );
wp_clear_scheduled_hook( 'eael_remove_unused_options_data' );
}
}
@@ -0,0 +1,106 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly.
/**
* WPDeveloper Core Install
*/
class WPDeveloper_Core_Installer {
/**
* Plugin Base Name
*
* @var string
*/
private $plugin_basename;
/**
* Instantiate the class
*
* @param string $affiliate
*/
function __construct( $plugin_basename = '' ) {
$this->plugin_basename = $plugin_basename;
add_action( 'init', array( $this, 'init_hooks' ) );
}
/**
* Initialize the hooks
*
* @return void
*/
public function init_hooks() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
add_action( 'wp_ajax_wpdeveloper_upsale_core_install_' . $this->plugin_basename, array( $this, 'core_install' ) );
}
/**
* Fail if plugin installtion/activation fails
*
* @param Object $thing
*
* @return void
*/
public function fail_on_error( $thing ) {
if ( is_wp_error( $thing ) ) {
wp_send_json_error( $thing->get_error_message() );
}
}
/**
* Install Upsale Plugin
*
* @return void
*/
public function core_install() {
check_ajax_referer( 'wpdeveloper_upsale_core_install_' . $this->plugin_basename );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You don\'t have permission to install the plugins', 'essential-addons-for-elementor-lite' ) );
}
$plugin_slug = ( isset( $_POST['slug'] ) ) ? sanitize_text_field( $_POST['slug'] ) : '';
$plugin_file = ( isset( $_POST['file'] ) ) ? sanitize_text_field( $_POST['file'] ) : '';
if( empty( $plugin_file ) || empty( $plugin_slug ) ) {
wp_send_json_error( __( 'You don\'t have set any slug and file name to install the plugins', 'essential-addons-for-elementor-lite' ) );
}
$plugin_status = $this->install_plugin( $plugin_slug, $plugin_file );
$this->fail_on_error( $plugin_status );
wp_send_json_success();
}
/**
* Install and activate a plugin
*
* @param string $slug
* @param string $file
*
* @return WP_Error|null
*/
public function install_plugin( $slug, $file ) {
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$plugin_basename = $slug . '/' . $file;
// if exists and not activated
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_basename ) ) {
return activate_plugin( $plugin_basename );
}
// seems like the plugin doesn't exists. Download and activate it
$upgrader = new \Plugin_Upgrader( new \WP_Ajax_Upgrader_Skin() );
$api = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
$result = $upgrader->install( $api->download_link );
if ( is_wp_error( $result ) ) {
return $result;
}
return activate_plugin( $plugin_basename );
}
}
@@ -0,0 +1,941 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly.
use Essential_Addons_Elementor\Classes\Helper;
use Essential_Addons_Elementor\Classes\WPDeveloper_Core_Installer;
class WPDeveloper_Notice {
/**
* Admin Notice Key
*
* @var array
*/
const ADMIN_UPDATE_NOTICE_KEY = 'wpdeveloper_notices_seen';
/**
* All Data
* @var array
*/
private $data = array();
private $properties = array(
'links', 'message', 'thumbnail',
);
private $methods = array(
'message', 'thumbnail', 'classes'
);
/**
* cne_day == current_notice_end_day
*
* @var integer
*/
public $cne_time = '2 day';
public $maybe_later_time = '7 day';
public $finish_time = [];
/**
* Plugin Name
*
* @var string
*/
private $plugin_name;
/**
* Plugin File Name
* @var string
*/
private $plugin_file;
/**
* First Install Version Of The Plugin
*
* @var string
*/
private $version;
/**
* Saved Data in DB
* @var array
*/
private $options_data;
/**
* Current Timestamp
* @var integer
*/
public $timestamp;
/**
* Primary Notice Action
*
* @var string
*/
private $do_notice_action;
/**
* Default Options Set
*
* @var array
*/
public $options_args = array(
);
/**
* Notice ID for users.
* @var string
*/
private $notice_id;
/**
* Upsale Notice Arguments
* @var array
*/
public $upsale_args;
/**
* Revoke this function when the object is created.
*
* @param string $plugin_name
* @param string $version
*/
public function __construct( $plugin_file = '', $version = '' ) {
$this->plugin_file = $plugin_file;
$this->plugin_name = basename( $plugin_file, '.php' );
$this->version = $version;
$this->timestamp = intval( current_time( 'timestamp' ) );
$this->notice_id = 'wpdeveloper_notice_' . str_replace( '.', '_', $this->version );
$this->do_notice_action = 'wpdeveloper_notices_for_' . $this->plugin_name;
new WPDeveloper_Core_Installer( $this->plugin_name );
}
/**
* Initiate The Plugin
* @return void
*/
public function init(){
$this->migration();
add_action( 'init', array( $this, 'first_install_track') );
add_action( 'deactivate_' . $this->plugin_file, array( $this, 'first_install_end' ) );
add_action( 'init', array( $this, 'hooks' ) );
}
public function migration(){
$user_notices = $this->get_user_notices();
if( \version_compare( get_option( 'eael_version', false ), '3.7.2', '==' ) && ! get_option( 'eael_notice_migration', false ) ) {
if( is_array( $user_notices ) ) {
array_walk( $user_notices, function( $value, $key ){
array_walk( $value, function( $v, $k ){
array_walk( $v, function( $vv, $kk ){
update_user_meta( get_current_user_id(), $this->plugin_name . '_' . $vv, true );
} );
} );
} );
}
update_option( 'eael_notice_migration', true );
}
}
/**
* All Hooks
* @return void
*/
public function hooks(){
add_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name, array( $this, 'clicked' ) );
add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss_for_' . $this->plugin_name, array( $this, 'upsale_notice_dissmiss' ) );
add_action( 'wp_ajax_wpdeveloper_notice_dissmiss_for_' . $this->plugin_name, array( $this, 'notice_dissmiss' ) );
add_action( 'wpdeveloper_before_notice_for_' . $this->plugin_name, array( $this, 'before' ) );
add_action( 'wpdeveloper_after_notice_for_' . $this->plugin_name, array( $this, 'after' ) );
add_action( 'wpdeveloper_before_upsale_notice_for_' . $this->plugin_name, array( $this, 'before_upsale' ) );
add_action( 'wpdeveloper_after_upsale_notice_for_' . $this->plugin_name, array( $this, 'after' ) );
add_action( $this->do_notice_action, array( $this, 'content' ) );
// if( current_user_can( 'install_plugins' ) ) {
if( isset( $_GET['plugin'] ) && $_GET['plugin'] == $this->plugin_name ) {
do_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name );
/**
* Redirect User To the Current URL, but without set query arguments.
*/
wp_safe_redirect( $this->redirect_to() );
}
$return_notice = $this->next_notice();
$current_notice = current( $return_notice );
$next_notice = next( $return_notice );
$deserve_notice = $this->deserve_notice( $current_notice );
$options_data = $this->get_options_data();
$user_notices = $this->get_user_notices();
$notice_time = isset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] )
? $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] : $this->timestamp;
$next_notice_time = $next_notice ? $options_data[ $this->plugin_name ]['notice_will_show'][ $next_notice ] : $this->timestamp;
$current_notice_end = $this->makeTime( $notice_time, $this->cne_time );
if( ! $deserve_notice ) {
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
$this->update_options_data( $options_data[ $this->plugin_name ] );
}
if( $deserve_notice ) {
/**
* TODO: automatic maybe later setup with time.
*/
if( ( $this->timestamp >= $current_notice_end ) || ( $this->timestamp > $next_notice_time ) ) {
$this->maybe_later( $current_notice );
$notice_time = false;
}
if( isset( $this->finish_time[ $current_notice ] ) ) {
if( $this->timestamp >= strtotime( $this->finish_time[ $current_notice ] ) ) {
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
$this->update_options_data( $options_data[ $this->plugin_name ] );
$notice_time = false;
}
}
if( $notice_time != false ) {
if( $notice_time <= $this->timestamp ) {
if( $current_notice === 'upsale' ) {
$upsale_args = $this->get_upsale_args();
if( empty( $upsale_args ) ) {
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
$this->update_options_data( $options_data[ $this->plugin_name ] );
} else {
/**
* For Upsale Remove
* if the plugin is activated.
*/
if( isset( $upsale_args['condition'], $upsale_args['condition']['by'] ) ) {
switch( $upsale_args['condition']['by'] ) {
case 'class' :
if( isset( $upsale_args['condition']['class'] ) && class_exists( $upsale_args['condition']['class'] ) ) {
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
$this->update_options_data( $options_data[ $this->plugin_name ] );
return;
}
break;
case 'function' :
if( isset( $upsale_args['condition']['function'] ) && function_exists( $upsale_args['condition']['function'] ) ) {
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
$this->update_options_data( $options_data[ $this->plugin_name ] );
return;
}
break;
}
}
if ( ! function_exists( 'get_plugins' ) ) {
include ABSPATH . '/wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
$pkey = $upsale_args['slug'] . '/' . $upsale_args['file'];
if( isset( $plugins[ $pkey ] ) ) {
$this->update( $current_notice );
return;
}
add_action( 'admin_notices', array( $this, 'upsale_notice' ) );
add_action( 'eael_admin_notices', array( $this, 'upsale_notice' ) );
}
} else {
if( $this->is_ok( 'message', $current_notice ) || $current_notice === 'opt_in' ) {
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
add_action( 'eael_admin_notices', array( $this, 'admin_notices' ) );
}
}
}
}
}
// }
}
/**
* Make time using timestamp and a string like 2 Hour, 2 Day, 30 Minutes, 1 Week, 1 year
* @param integer $current
* @param string $time
* @return integer
*/
public function makeTime( $current, $time ) {
return intval( strtotime( date( 'Y-m-d h:i:s', intval( $current ) ) . " +$time" ) );
}
/**
* Automatice Maybe Later.
* @param string $notice
* @return void
*/
private function maybe_later( $notice ){
if( empty( $notice ) ) {
return;
}
$options_data = $this->get_options_data();
$options_data[ $this->plugin_name ]['notice_will_show'][ $notice ] = $this->makeTime( $this->timestamp, $this->maybe_later_time );
$this->update_options_data( $options_data[ $this->plugin_name ] );
}
/**
* When links are clicked, this function will invoked.
* @return void
*/
public function clicked(){
if( isset( $_GET['plugin'] ) ) {
$plugin = sanitize_text_field( $_GET['plugin'] );
if( $plugin === $this->plugin_name ) {
$options_data = $this->get_options_data();
$clicked_from = current( $this->next_notice() );
if( isset( $_GET['plugin_action'] ) ) {
$plugin_action = sanitize_text_field( $_GET['plugin_action'] );
}
if( isset( $_GET['dismiss'] ) ) {
$dismiss = sanitize_text_field( $_GET['dismiss'] );
}
if( isset( $_GET['later'] ) ) {
$later = sanitize_text_field( $_GET['later'] );
}
$later_time = '';
switch( $clicked_from ) {
case 'opt_in' :
$dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
case 'first_install' :
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
case 'update' :
$dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
// case 'update_400k' :
// $dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
// $later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
// break;
case 'review' :
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
case 'upsale' :
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
}
if( isset( $later ) && $later == true ) {
$options_data[ $this->plugin_name ]['notice_will_show'][ $clicked_from ] = $later_time;
}
if( isset( $dismiss ) && $dismiss == true ) {
update_user_meta( get_current_user_id(), $this->plugin_name . '_' . $clicked_from, true );
$this->update( $clicked_from );
}
$this->update_options_data( $options_data[ $this->plugin_name ] );
}
}
}
/**
* For Redirecting Current Page without Arguments!
*
* @return void
*/
private function redirect_to(){
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
wp_parse_str( $query_string, $current_url );
$unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later', 'plugin_action', 'marketing_optin' );
foreach( $unset_array as $value ) {
if( isset( $current_url[ $value ] ) ) {
unset( $current_url[ $value ] );
}
}
$current_url = http_build_query($current_url);
$redirect_url = $request_uri . '?' . $current_url;
return $redirect_url;
}
/**
* Before Notice
* @return void
*/
public function before(){
$current_notice = current( $this->next_notice() );
$classes = 'notice notice-info put-dismiss-notice';
if( isset( $this->data['classes'] ) ) {
if( isset( $this->data['classes'][ $current_notice ] ) ) {
$classes = $this->data['classes'][ $current_notice ];
}
}
if( $this->has_thumbnail( $current_notice ) ) {
$classes .= 'notice-has-thumbnail';
}
echo '<div class="'. esc_attr( $classes ) .' wpdeveloper-'. esc_attr( $current_notice ) .'-notice" data-notice="'. esc_attr( $current_notice ) .'">';
}
/**
* After Notice
* @return void
*/
public function after(){
echo '</div>';
}
/**
* Content generation & Hooks Funciton.
* @return void
*/
public function content(){
$options_data = $this->get_options_data();
$notice = current( $this->next_notice() );
switch( $notice ) {
case 'opt_in' :
do_action('wpdeveloper_optin_notice_for_' . $this->plugin_name );
break;
case 'first_install' :
if( $options_data[ $this->plugin_name ]['first_install'] !== 'deactivated' ) {
do_action( 'wpdeveloper_first_install_notice_for_' . $this->plugin_name );
$this->get_thumbnail( 'first_install' );
$this->get_message( 'first_install' );
}
break;
case 'update' :
do_action( 'wpdeveloper_update_notice_for_' . $this->plugin_name );
$this->dismiss_button_scripts();
$this->get_thumbnail( 'update' );
$this->get_message( 'update' );
break;
// case 'update_400k' :
// do_action( 'wpdeveloper_update_notice_for_' . $this->plugin_name );
// $this->dismiss_button_scripts();
// $this->get_thumbnail( 'update_400k' );
// $this->get_message( 'update_400k' );
// break;
case 'review' :
do_action( 'wpdeveloper_review_notice_for_' . $this->plugin_name );
$this->get_thumbnail( 'review' );
$this->get_message( 'review' );
break;
}
}
/**
* Before Upsale Notice
* @return void
*/
public function before_upsale(){
$classes = '';
if( $this->has_thumbnail('upsale') ) {
$classes = 'notice-has-thumbnail';
}
echo '<div class="error notice is-dismissible wpdeveloper-upsale-notice '. esc_attr( $classes ) .'">';
}
/**
* Upsale Notice
*/
public function upsale_notice(){
do_action( 'wpdeveloper_before_upsale_notice_for_' . $this->plugin_name );
do_action('wpdeveloper_upsale_notice_for_' . $this->plugin_name);
$this->get_thumbnail( 'upsale' );
$this->get_message( 'upsale' );
do_action( 'wpdeveloper_after_upsale_notice_for_' . $this->plugin_name );
$this->upsale_button_script();
}
/**
* Get upsale arguments.
* @return void
*/
private function get_upsale_args(){
return ( empty( $this->upsale_args ) ) ? array() : $this->upsale_args;
}
/**
* This function is responsible for making the button visible to the upsale notice.
*/
private function upsale_button(){
$upsale_args = $this->get_upsale_args();
$plugin_slug = ( isset( $upsale_args['slug'] )) ? $upsale_args['slug'] : '' ;
$btn_text = ( isset( $upsale_args['btn_text'] )) ? $upsale_args['btn_text'] : __( 'Install Now!', 'essential-addons-for-elementor-lite' ) ;
if( empty( $plugin_slug ) ) {
return;
}
echo '<button data-slug="'. esc_attr( $plugin_slug ) .'" id="plugin-install-core-'. esc_attr( $this->plugin_name ) .'" class="button button-primary">'. wp_kses( $btn_text, Helper::eael_allowed_tags() ) .'</button>';
}
/**
* This methods is responsible for get notice image.
*
* @param string $msg_for
* @return void
*/
protected function get_thumbnail( $msg_for ){
$output = '';
if( isset( $this->data['thumbnail'] ) && isset( $this->data['thumbnail'][ $msg_for ] ) ) {
$output = '<div class="wpdeveloper-notice-thumbnail">';
$output .= '<img src="'. esc_url( $this->data['thumbnail'][ $msg_for ] ) .'" alt="">';
$output .= '</div>';
}
echo wp_kses_post( $output );
}
/**
* Has Thumbnail Check
*
* @param string $msg_for
* @return boolean
*/
protected function has_thumbnail( $msg_for = '' ){
if( empty( $msg_for ) ) {
return false;
}
if( isset( $this->data['thumbnail'] ) && isset( $this->data['thumbnail'][ $msg_for ] ) ) {
return true;
}
return false;
}
/**
* This method is responsible for get messages.
*
* @param string $msg_for
* @return void
*/
protected function get_message( $msg_for ){
if( isset( $this->data['message'] ) && isset( $this->data['message'][ $msg_for ] ) ) {
echo '<div class="wpdeveloper-notice-message">';
echo wp_kses( $this->data['message'][ $msg_for ], Helper::eael_allowed_tags() );
if( $msg_for === 'upsale' ) {
$this->upsale_button();
}
$this->dismissible_notice( $msg_for );
echo '</div>';
}
}
/**
* Detect which notice will show @ next.
* @return array
*/
protected function next_notice() {
$options_data = $this->get_options_data();
if ( ! $options_data ) {
$args = $this->get_args();
$return_notice = $args['notice_will_show'];
} else {
$return_notice = $options_data[ $this->plugin_name ]['notice_will_show'];
}
if ( is_array( $return_notice ) ) {
$return_notice = array_flip( $return_notice );
ksort( $return_notice );
}
return (array) $return_notice;
}
/**
* Which notice is deserve to show in next slot.
* @param string $notice
* @return boolean
*/
private function deserve_notice( $notice ) {
$notices = $this->get_user_notices();
if( $notice === false ) {
return false;
}
if( empty( $notices ) ) {
return true;
} else {
if( isset( $notices[ $this->notice_id ] ) && isset( $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
if( in_array( $notice, $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
return false;
} else {
return true;
}
} else {
return true;
}
}
}
/**
* This is the main methods for generate the notice.
* @return void
*/
public function admin_notices(){
$current_notice = current( $this->next_notice() );
if( get_user_meta( get_current_user_id(), $this->plugin_name . '_' . $current_notice, true ) ) {
return;
}
if( $current_notice == 'opt_in' ) {
do_action( $this->do_notice_action );
return;
}
do_action( 'wpdeveloper_before_notice_for_' . $this->plugin_name );
do_action( $this->do_notice_action );
do_action( 'wpdeveloper_after_notice_for_' . $this->plugin_name );
}
/**
* This method is responsible for all dismissible links generation.
* @param string $links_for
* @return void
*/
public function dismissible_notice( $links_for = '' ){
if( empty( $links_for ) ) {
return;
}
$links = isset( $this->data['links'][ $links_for ] ) ? $this->data['links'][ $links_for ] : false;
if( $links ) :
$output = '<ul class="wpdeveloper-notice-link">';
foreach( $links as $key => $link_value ) {
if( ! empty( $link_value['label'] ) ) {
$output .= '<li>';
if( isset( $link_value['link'] ) ) {
$link = $link_value['link'];
$target = isset( $link_value['target'] ) ? 'target="'. esc_attr( $link_value['target'] ) .'"' : '';
if( isset( $link_value['data_args'] ) && is_array( $link_value['data_args'] ) ) {
$data_args = [];
foreach( $link_value['data_args'] as $key => $args_value ) {
$data_args[ $key ] = $args_value;
}
$data_args[ 'plugin' ] = $this->plugin_name;
$normal_link = add_query_arg( $data_args, $link );
$link = wp_nonce_url( $normal_link, 'wpdeveloper-nonce' );
}
$class = '';
if( isset( $link_value['link_class'] ) ) {
$class = 'class="' . sanitize_html_class( implode( ' ', $link_value['link_class'] ) ) . '"';
}
$output .= '<a '. $class .' href="'. esc_url( $link ) .'" '. $target .'>';
}
if( isset( $link_value['icon_class'] ) ) {
$output .= '<span class="'. esc_attr( $link_value['icon_class'] ) .'"></span>';
}
if( isset( $link_value['icon_img'] ) ) {
$output .= '<img src="'. esc_url( $link_value['icon_img'] ) .'" alt="" />';
}
$output .= $link_value['label'];
if( isset( $link_value['link'] ) ) {
$output .= '</a>';
}
$output .= '</li>';
}
}
$output .= '</ul>';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '%1$s', $output );
endif;
}
/**
* First Installation Track
* @return void
*/
public function first_install_track( $args = array() ){
if( ! current_user_can( 'manage_options' ) ) {
return;
}
if( empty( $args ) ) {
$args = array(
'time' => $this->timestamp,
'version' => $this->version,
);
}
$options_data = $this->get_options_data();
$args = wp_parse_args( $args, $this->get_args() );
if( ! isset( $options_data[ $this->plugin_name ] )
|| ( isset( $options_data[ $this->plugin_name ]['version'] ) && version_compare( $options_data[ $this->plugin_name ]['version'], $this->version, '!=' ) ) ) {
$this->update_options_data( $args );
}
}
/**
* First Installation Deactive Track
*
* @return void
*/
public function first_install_end(){
// $args = array(
// 'first_install' => 'deactivated'
// );
// $options_data = $this->get_options_data();
// if( isset( $options_data[ $this->plugin_name ] ) ) {
// $args = wp_parse_args( $args, $options_data[ $this->plugin_name ] );
// $this->update_options_data( $args );
// }
delete_option( 'wpdeveloper_plugins_data' );
}
/**
* Get all options from database!
* @return void
*/
protected function get_options_data( $key = '' ) {
$options_data = get_option( 'wpdeveloper_plugins_data', [] );
if ( empty( $key ) ) {
return $options_data;
}
if ( isset( $options_data[ $this->plugin_name ][ $key ] ) ) {
return $options_data[ $this->plugin_name ][ $key ];
}
return [];
}
/**
* This will update the options table for plugins.
*
* @param mixed $new_data
* @param array $args
* @return void
*/
protected function update_options_data( $args = array() ){
$options_data = $this->get_options_data();
$options_data[ $this->plugin_name ] = $args;
update_option( 'wpdeveloper_plugins_data', $options_data );
}
/**
* Set properties data, for some selected properties.
*
* @param string $name
* @param mixed $value
*/
public function __set( $name, $value ){
if( in_array( $name, $this->properties ) ) {
$this->data[ $name ] = $value;
}
}
/**
* Invoked when some selected methods are called
*
* @param string $name
* @param array $values
* @return void
*/
public function __call( $name, $values ){
if( in_array( $name, $this->methods ) ) {
$this->data[ $name ][ $values[0] ] = $values[1];
}
}
protected function is_ok( $name, $notice ){
if( isset( $this->data[ $name ], $this->data[ $name ][ $notice ] ) ) {
return true;
}
return false;
}
/**
* Get all option arguments.
* @param string $key
* @return array
*/
private function get_args( $key = '' ){
if( empty( $key ) ) {
return $this->options_args;
}
if( isset( $this->options_args[ $key ] ) ) {
return $this->options_args[ $key ];
}
return false;
}
/**
* Resetting data on update.
* @return void
*/
private function set_args_on_update(){
$args = $this->get_args();
$options_data = $this->get_options_data();
$set_data = $options_data[ $this->plugin_name ];
$args = wp_parse_args( $set_data, $args );
$this->update_options_data( $args );
}
/**
* When upgrade is complete. it will fired.
* @param WP_Upgrader $upgrader_object
* @param array $options
* @return void
*/
public function upgrade_completed( $upgrader_object, $options ) {
// If an update has taken place and the updated type is plugins and the plugins element exists
if( isset( $options['action'] ) && $options['action'] == 'update' && $options['type'] == 'plugin' ) {
if( ! isset( $options['plugin'] ) && isset( $options['plugins'] ) ) {
foreach( $options['plugins'] as $plugin ) {
if( $plugin == $this->plugin_name ) {
$this->set_args_on_update();
}
}
}
if( isset( $options['plugin'] ) && $options['plugin'] == $this->plugin_name ) {
$this->set_args_on_update();
}
}
}
/**
* This function is responsible for get_user_notices
* @return void
*/
private function get_user_notices() {
$notices = get_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, true );
return ! $notices ? array() : $notices;
}
/**
* This function is responsible for update meta information.
*
* @param string $notice
* @return void
*/
private function update( $notice ){
if( empty( $notice ) ) {
return;
}
$options_data = $this->get_options_data();
$user_notices = $this->get_user_notices();
$user_notices[ $this->notice_id ][ $this->plugin_name ][] = $notice;
// Remove the upsale from notice_will_show field in options DB.
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $notice ] );
$this->update_options_data( $options_data[ $this->plugin_name ] );
// Set users meta, not to show again current_version notice.
update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
}
public function notice_dissmiss(){
if( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'wpdeveloper_notice_dissmiss' ) ) {
return;
}
if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_notice_dissmiss_for_' . $this->plugin_name ) ) {
return;
}
$dismiss = isset( $_POST['dismiss'] ) ? sanitize_text_field( $_POST['dismiss'] ) : false;
$notice = isset( $_POST['notice'] ) ? sanitize_text_field( $_POST['notice'] ) : false;
if( $dismiss ) {
$this->update( $notice );
update_user_meta( get_current_user_id(), $this->plugin_name . '_' . $notice, true );
echo 'success';
} else {
echo 'failed';
}
die();
}
/**
* This function is responsible for do action when
* the dismiss button clicked in upsale notice.
*/
public function upsale_notice_dissmiss(){
if( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'wpdeveloper_upsale_notice_dissmiss' ) ) {
return;
}
if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_upsale_notice_dissmiss_for_' . $this->plugin_name ) ) {
return;
}
$dismiss = isset( $_POST['dismiss'] ) ? sanitize_text_field( $_POST['dismiss'] ) : false;
if( $dismiss ) {
$this->update( 'upsale' );
echo 'success';
} else {
echo 'failed';
}
die();
}
public function dismiss_button_scripts(){
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
var wpdevNotice = $('.notice.is-dismissible');
if( wpdevNotice.length > 0 ) {
$('body').on('click', 'button.notice-dismiss', function (e) {
e.preventDefault();
$.ajax({
url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
type: 'post',
data: {
action: 'wpdeveloper_notice_dissmiss_for_<?php echo esc_html( $this->plugin_name ); ?>',
_wpnonce: '<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wp_create_nonce('wpdeveloper_notice_dissmiss'); ?>',
dismiss: true,
notice: wpdevNotice.data('notice'),
},
success: function(response) {
$('.notice').hide();
console.log('Successfully saved!');
},
error: function(error) {
console.log('Something went wrong!');
},
complete: function() {
console.log('Its Complete.');
}
});
});
}
} );
</script>
<?php
}
/**
* Upsale Button Script.
* When install button is clicked, it will do its own things.
* also for dismiss button JS.
* @return void
*/
public function upsale_button_script(){
$upsale_args = $this->get_upsale_args();
$plugin_slug = ( isset( $upsale_args['slug'] ) ) ? $upsale_args['slug'] : '';
$plugin_file = ( isset( $upsale_args['file'] ) ) ? $upsale_args['file'] : '';
$page_slug = ( isset( $upsale_args['page_slug'] ) ) ? $upsale_args['page_slug'] : '';
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
<?php if( ! empty( $plugin_slug ) && ! empty( $plugin_file ) ) : ?>
$('#plugin-install-core-<?php echo esc_html( $this->plugin_name ); ?>').on('click', function (e) {
var self = $(this);
e.preventDefault();
self.addClass('install-now updating-message');
self.text('<?php echo esc_js( 'Installing...' ); ?>');
$.ajax({
url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
type: 'POST',
data: {
action: 'wpdeveloper_upsale_core_install_<?php echo esc_html( $this->plugin_name ); ?>',
_wpnonce: '<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wp_create_nonce('wpdeveloper_upsale_core_install_' . esc_html( $this->plugin_name )); ?>',
slug : '<?php echo esc_html( $plugin_slug ); ?>',
file : '<?php echo esc_html( $plugin_file ); ?>'
},
success: function(response) {
self.text('<?php echo esc_js( 'Installed' ); ?>');
<?php if( ! empty( $page_slug ) ) : ?>
window.location.href = '<?php echo esc_url( admin_url( "admin.php?page={$page_slug}" ) ); ?>';
<?php endif; ?>
},
error: function(error) {
self.removeClass('install-now updating-message');
},
complete: function() {
self.attr('disabled', 'disabled');
self.removeClass('install-now updating-message');
}
});
});
<?php endif; ?>
$('.wpdeveloper-upsale-notice').on('click', 'button.notice-dismiss', function (e) {
e.preventDefault();
$.ajax({
url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
type: 'post',
data: {
action: 'wpdeveloper_upsale_notice_dissmiss_for_<?php echo esc_html( $this->plugin_name ); ?>',
_wpnonce: '<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wp_create_nonce('wpdeveloper_upsale_notice_dissmiss'); ?>',
dismiss: true
},
success: function(response) {
console.log('Successfully saved!');
},
error: function(error) {
console.log('Something went wrong!');
},
complete: function() {
console.log('Its Complete.');
}
});
});
} );
</script>
<?php
}
}
@@ -0,0 +1,244 @@
<?php
namespace Essential_Addons_Elementor\Classes;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly.
use \WP_Error;
class WPDeveloper_Plugin_Installer
{
public function __construct() {
add_action( 'wp_ajax_wpdeveloper_auto_active_even_not_installed', [ $this, 'ajax_auto_active_even_not_installed' ] );
add_action( 'wp_ajax_wpdeveloper_install_plugin', [ $this, 'ajax_install_plugin' ] );
add_action( 'wp_ajax_wpdeveloper_upgrade_plugin', [ $this, 'ajax_upgrade_plugin' ] );
add_action( 'wp_ajax_wpdeveloper_activate_plugin', [ $this, 'ajax_activate_plugin' ] );
add_action( 'wp_ajax_wpdeveloper_deactivate_plugin', [ $this, 'ajax_deactivate_plugin' ] );
}
/**
* get_local_plugin_data
*
* @param mixed $basename
* @return array|false
*/
public function get_local_plugin_data($basename = '')
{
if (empty($basename)) {
return false;
}
if (!function_exists('get_plugins')) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
if (!isset($plugins[$basename])) {
return false;
}
return $plugins[$basename];
}
/**
* get_remote_plugin_data
*
* @param mixed $slug
* @return mixed array|WP_Error
*/
public function get_remote_plugin_data($slug = '')
{
if (empty($slug)) {
return new WP_Error('empty_arg', __('Argument should not be empty.', 'essential-addons-for-elementor-lite'));
}
$response = wp_remote_post(
'http://api.wordpress.org/plugins/info/1.0/',
[
'body' => [
'action' => 'plugin_information',
'request' => serialize((object) [
'slug' => $slug,
'fields' => [
'version' => false,
],
]),
],
]
);
if (is_wp_error($response)) {
return $response;
}
return unserialize(wp_remote_retrieve_body($response));
}
/**
* install_plugin
*
* @param mixed $slug
* @param bool $active
* @return mixed bool|WP_Error
*/
public function install_plugin($slug = '', $active = true)
{
if (empty($slug)) {
return new WP_Error('empty_arg', __('Argument should not be empty.', 'essential-addons-for-elementor-lite'));
}
include_once ABSPATH . 'wp-admin/includes/file.php';
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/class-automatic-upgrader-skin.php';
$plugin_data = $this->get_remote_plugin_data($slug);
if (is_wp_error($plugin_data)) {
return $plugin_data;
}
$upgrader = new \Plugin_Upgrader(new \Automatic_Upgrader_Skin());
// install plugin
$install = $upgrader->install($plugin_data->download_link);
if (is_wp_error($install)) {
return $install;
}
// activate plugin
if ($install === true && $active) {
$active = activate_plugin($upgrader->plugin_info(), '', false, true);
if (is_wp_error($active)) {
return $active;
}
return $active === null;
}
return $install;
}
/**
* upgrade_plugin
*
* @param mixed $basename
* @return mixed bool|WP_Error
*/
public function upgrade_plugin($basename = '')
{
if (empty($slug)) {
return new WP_Error('empty_arg', __('Argument should not be empty.', 'essential-addons-for-elementor-lite'));
}
include_once ABSPATH . 'wp-admin/includes/file.php';
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/class-automatic-upgrader-skin.php';
$upgrader = new \Plugin_Upgrader(new \Automatic_Upgrader_Skin());
// upgrade plugin
return $upgrader->upgrade($basename);
}
public function ajax_install_plugin()
{
check_ajax_referer('essential-addons-elementor', 'security');
if(!current_user_can( 'install_plugins' )) {
wp_send_json_error(__('you are not allowed to do this action', 'essential-addons-for-elementor-lite'));
}
$slug = isset( $_POST['slug'] ) ? sanitize_text_field( $_POST['slug'] ) : '';
$result = $this->install_plugin( $slug );
if ( isset( $_POST['promotype'], $_POST['slug'] ) ) {
$promotype = sanitize_text_field( $_POST['promotype'] );
$slug = sanitize_text_field( $_POST['slug'] );
$remote_urls = [
'quick-setup' => [
'essential-blocks' => 'https://essential-addons.com/essential-blocks-install-quick-setup',
'templately' => 'https://essential-addons.com/templately-install-quick-setup',
]
];
if ( isset( $remote_urls[ $promotype ][ $slug ] ) ) {
wp_remote_get( $remote_urls[ $promotype ][ $slug ] );
}
}
if ( is_wp_error( $result ) ) {
wp_send_json_error( $result->get_error_message() );
}
wp_send_json_success(__('Plugin is installed successfully!', 'essential-addons-for-elementor-lite'));
}
public function ajax_upgrade_plugin()
{
check_ajax_referer('essential-addons-elementor', 'security');
//check user capabilities
if(!current_user_can( 'update_plugins' )) {
wp_send_json_error(__('you are not allowed to do this action', 'essential-addons-for-elementor-lite'));
}
$basename = isset( $_POST['basename'] ) ? sanitize_text_field( $_POST['basename'] ) : '';
$result = $this->upgrade_plugin( $basename );
if (is_wp_error($result)) {
wp_send_json_error($result->get_error_message());
}
wp_send_json_success(__('Plugin is updated successfully!', 'essential-addons-for-elementor-lite'));
}
public function ajax_activate_plugin()
{
check_ajax_referer('essential-addons-elementor', 'security');
//check user capabilities
if(!current_user_can( 'activate_plugins' )) {
wp_send_json_error(__('you are not allowed to do this action', 'essential-addons-for-elementor-lite'));
}
$basename = isset( $_POST['basename'] ) ? sanitize_text_field( $_POST['basename'] ) : '';
$result = activate_plugin( $basename, '', false, true );
if ( is_wp_error( $result ) ) {
wp_send_json_error( $result->get_error_message() );
}
if ($result === false) {
wp_send_json_error(__('Plugin couldn\'t be activated.', 'essential-addons-for-elementor-lite'));
}
wp_send_json_success(__('Plugin is activated successfully!', 'essential-addons-for-elementor-lite'));
}
public function ajax_deactivate_plugin() {
check_ajax_referer( 'essential-addons-elementor', 'security' );
//check user capabilities
if ( ! current_user_can( 'activate_plugins' ) ) {
wp_send_json_error( __( 'you are not allowed to do this action', 'essential-addons-for-elementor-lite' ) );
}
$basename = isset( $_POST['basename'] ) ? sanitize_text_field( $_POST['basename'] ) : '';
deactivate_plugins( $basename, true );
wp_send_json_success( __( 'Plugin is deactivated successfully!', 'essential-addons-for-elementor-lite' ) );
}
public function ajax_auto_active_even_not_installed() {
check_ajax_referer( 'essential-addons-elementor', 'security' );
if ( $this->get_local_plugin_data( $_POST['basename'] ) === false ) {
$this->ajax_install_plugin();
} else {
$this->ajax_activate_plugin();
}
}
}
@@ -0,0 +1,927 @@
<?php
namespace Essential_Addons_Elementor\Classes;
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) {
exit;
}
// Ensure WordPress core functions are available
if ( !function_exists('__') ) {
require_once( ABSPATH . 'wp-includes/l10n.php' );
}
class WPDeveloper_Setup_Wizard {
public $templately_status;
public $eblocks_status;
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'setup_wizard_scripts' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'wp_ajax_save_setup_wizard_data', [ $this, 'save_setup_wizard_data' ] );
add_action( 'wp_ajax_enable_wpins_process', [ $this, 'enable_wpins_process' ] );
add_action( 'wp_ajax_save_eael_elements_data', [ $this, 'save_eael_elements_data' ] );
add_action( 'in_admin_header', [ $this, 'remove_notice' ], 1000 );
$this->templately_status = $this->templately_active_status();
$this->eblocks_status = $this->eblocks_active_status();
}
/**
* templately_active_status
* @return bool
*/
public function templately_active_status() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
return is_plugin_active( 'templately/templately.php' );
}
/**
* Essential Blocks active status
* @return bool
*/
public function eblocks_active_status() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
return is_plugin_active( 'essential-blocks/essential-blocks.php' );
}
/**
* Remove all notice in setup wizard page
*/
public function remove_notice() {
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'eael-setup-wizard' ) {
remove_all_actions( 'admin_notices' );
remove_all_actions( 'all_admin_notices' );
}
}
/**
* setup_wizard_scripts
* @param $hook
* @return array
*/
public function setup_wizard_scripts( $hook ) {
if ( isset( $hook ) && $hook == 'admin_page_eael-setup-wizard' ) {
wp_enqueue_style( 'essential_addons_elementor-setup-wizard-css', EAEL_PLUGIN_URL . 'assets/admin/css/quick-setup.css', false, EAEL_PLUGIN_VERSION );
wp_enqueue_style( 'essential_addons_elementor-setup-wizard-fonts', EAEL_PLUGIN_URL . 'includes/templates/admin/icons/style.css', false, EAEL_PLUGIN_VERSION );
wp_enqueue_style( 'sweetalert2-css', EAEL_PLUGIN_URL . 'assets/admin/vendor/sweetalert2/css/sweetalert2.min.css', false, EAEL_PLUGIN_VERSION );
wp_enqueue_script( 'sweetalert2-js', EAEL_PLUGIN_URL . 'assets/admin/vendor/sweetalert2/js/sweetalert2.min.js', array( 'jquery', 'sweetalert2-core-js' ), EAEL_PLUGIN_VERSION, true );
wp_enqueue_script( 'sweetalert2-core-js', EAEL_PLUGIN_URL . 'assets/admin/vendor/sweetalert2/js/core.js', array( 'jquery' ), EAEL_PLUGIN_VERSION, true );
// wp_enqueue_script( 'essential_addons_elementor-setup-wizard-js', EAEL_PLUGIN_URL . 'assets/admin/js/admin.js', array( 'jquery' ), EAEL_PLUGIN_VERSION, true );
// wp_enqueue_script( 'essential_addons_elementor-setup-wizard-react-css', EAEL_PLUGIN_URL . 'includes/templates/admin/quick-setup/dist/quick-setup.min.css', array(), EAEL_PLUGIN_VERSION, true );
wp_enqueue_script( 'essential_addons_elementor-setup-wizard-react-js', EAEL_PLUGIN_URL . 'includes/templates/admin/quick-setup/dist/quick-setup.min.js', array(), EAEL_PLUGIN_VERSION, true );
wp_localize_script( 'essential_addons_elementor-setup-wizard-react-js', 'localize', array(
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
'nonce' => wp_create_nonce( 'essential-addons-elementor' ),
'success_image' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/success.gif',
'eael_quick_setup_data' => $this->eael_quick_setup_data(),
) );
}
return [];
}
/**
* Create admin menu for setup wizard
*/
public function admin_menu() {
add_submenu_page(
'admin.php',
__( 'Essential Addons ', 'essential-addons-for-elementor-lite' ),
__( 'Essential Addons ', 'essential-addons-for-elementor-lite' ),
'manage_options',
'eael-setup-wizard',
[ $this, 'render_wizard' ]
);
}
/**
* render_wizard
*/
public function render_wizard() {
?>
<section id="eael-onboard--wrapper" class="eael-onboard--wrapper">
</section>
<?php
}
public function eael_quick_setup_data() {
$eael_quick_setup_data = [
'is_quick_setup' => 1,
'menu_items' => $this->data_menu_items(),
'getting_started_content' => $this->data_getting_started_content(),
'configuration_content' => $this->data_configuration_content(),
'elements_content' => $this->data_elements_content(),
'go_pro_content' => $this->data_go_pro_content(),
'plugins_content' => $this->data_plugins_content(),
'integrations_content' => $this->data_integrations_content(),
'modal_content' => $this->data_modal_content(),
];
return $eael_quick_setup_data;
}
public function data_menu_items(){
$items = [
'started' => __( 'Getting Started', 'essential-addons-for-elementor-lite' ),
'configuration' => __( 'Configuration', 'essential-addons-for-elementor-lite' ),
'elements' => __( 'Elements', 'essential-addons-for-elementor-lite' ),
'go_pro' => __( 'Go PRO', 'essential-addons-for-elementor-lite' ),
'pluginspromo' => __( 'Plugins', 'essential-addons-for-elementor-lite' ),
'integrations' => __( 'Integrations', 'essential-addons-for-elementor-lite' ),
];
$menu_items = [
'templately_status' => $this->templately_status,
'eblocks_status' => $this->eblocks_status,
'wizard_column' => ! $this->templately_status || ! $this->eblocks_status ? 'five' : 'four',
'items' => $items,
'templately_local_plugin_data' => $this->get_local_plugin_data( 'templately/templately.php' ),
'eblocks_local_plugin_data' => $this->get_local_plugin_data( 'essential-blocks/essential-blocks.php' ),
'ea_pro_local_plugin_data' => $this->get_local_plugin_data( 'essential-addons-elementor/essential_adons_elementor.php' ),
];
return $menu_items;
}
public function data_getting_started_content(){
$getting_started_content = [
'youtube_promo_src' => esc_url( EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/youtube-promo.png' ),
'is_tracking_allowed' => $this->get_is_tracking_allowed(),
];
return $getting_started_content;
}
public function data_configuration_content(){
$configuration_content = [
'ea_logo_src' => esc_url( EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/ea-new.png' ),
];
return $configuration_content;
}
public function data_elements_content(){
$elements_content = [
'elements_list' => $this->get_element_list(),
];
return $elements_content;
}
public function data_go_pro_content(){
$feature_items = [
[
'title' => 'Smart Post List',
'link' => 'https://essential-addons.com/post-list/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/smart-post-list.svg',
],
[
'title' => 'Dynamic Gallery',
'link' => 'https://essential-addons.com/dynamic-gallery/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/dynamic-gallery.svg',
],
[
'title' => 'Custom JS',
'link' => 'https://essential-addons.com/custom-js/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/custom-js.svg',
],
[
'title' => 'Protected Content',
'link' => 'https://essential-addons.com/protected-content/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/protected-content.svg',
],
[
'title' => 'Interactive Animations',
'link' => 'https://essential-addons.com/interactive-animations/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/lightbox-modal.svg',
],
[
'title' => 'Advanced Google Map',
'link' => 'https://essential-addons.com/advanced-google-map/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/advanced-google-map.svg',
],
[
'title' => 'Mailchimp',
'link' => 'https://essential-addons.com/mailchimp/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/mailchimp.svg',
],
[
'title' => 'Instagram Feed',
'link' => 'https://essential-addons.com/instagram-feed/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/instagram-feed.svg',
],
[
'title' => 'Woo Product Slider',
'link' => 'https://essential-addons.com/woo-product-slider/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/woo-product-slider.svg',
],
[
'title' => 'Parallax',
'link' => 'https://essential-addons.com/parallax-scrolling/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/parallax-scrolling.svg',
],
[
'title' => 'Post Carousel',
'link' => 'https://essential-addons.com/post-carousel/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/post-carousel.svg',
],
[
'title' => 'LearnDash Course List',
'link' => 'https://essential-addons.com/learndash-course-list/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/learndash-course-list.svg',
],
[
'title' => 'Particle Effect',
'link' => 'https://essential-addons.com/particle-effect/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/particle-effect.svg',
],
[
'title' => 'Logo Carousel',
'link' => 'https://essential-addons.com/logo-carousel/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/logo-carousel.svg',
],
[
'title' => 'Image Hotspots',
'link' => 'https://essential-addons.com/image-hotspots/',
'img_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/image-hotspots.svg',
]
];
$go_pro_content = [
'feature_items' => $feature_items,
];
return $go_pro_content;
}
public function data_plugins_content(){
$plugins_content = [
'tab_title' => __( 'Plugins', 'essential-addons-for-elementor-lite' ),
'plugins' => [
],
];
if ( ! $this->get_local_plugin_data( 'templately/templately.php' ) ) {
$plugins_content['plugins'][] = [
'slug' => 'templately',
'basename' => 'templately/templately.php',
'tab_title' => __( 'Templately', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'templately/templately.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'templately/templately.php' ),
'promo_img_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-qs-img.png',
'titles' => [
__("5000+", "essential-addons-for-elementor-lite"),
__("Ready Templates", "essential-addons-for-elementor-lite")
],
'features' => [
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-1.svg',
'content' => __( "Stunning Ready Website Templates", "essential-addons-for-elementor-lite" )
],
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-2.svg',
'content' => __( "One-Click Full Site Import", "essential-addons-for-elementor-lite" )
],
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-3.svg',
'content' => __( "Team Collaboration WorkSpace", "essential-addons-for-elementor-lite" )
],
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-4.svg',
'content' => __( "Unlimited Cloud Storage", "essential-addons-for-elementor-lite" )
],
],
];
}
if ( ! $this->get_local_plugin_data( 'essential-blocks/essential-blocks.php' ) ) {
$plugins_content['plugins'][] = [
'slug' => 'essential-blocks',
'basename' => 'essential-blocks/essential-blocks.php',
'tab_title' => __( 'Essential Blocks', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'essential-blocks/essential-blocks.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'essential-blocks/essential-blocks.php' ),
'promo_img_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/eb-promo-image.png',
'titles' => __("Power Up Gutenberg Editor", "essential-addons-for-elementor-lite") ,
'features' => [
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/eb-icon-1.png',
'content' => __( "Access 60+ Essential Gutenberg Blocks", "essential-addons-for-elementor-lite" )
],
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/eb-icon-2.png',
'content' => __( "Get Global Styling & Typography Support", "essential-addons-for-elementor-lite" )
],
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/eb-icon-3.png',
'content' => __( "Avail 2,900+ Exclusive Gutenberg Templates", "essential-addons-for-elementor-lite" )
],
[
'image_url' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/eb-icon-4.png',
'content' => __( "Use Ready Patterns & Reuse Facilities On Entire Site", "essential-addons-for-elementor-lite" )
],
],
];
}
return $plugins_content;
}
public function data_integrations_content(){
$integrations_content = [
'plugin_list' => $this->get_plugin_list(),
];
return $integrations_content;
}
public function data_modal_content(){
$modal_content = [
'success_2_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/success-2.png',
];
return $modal_content;
}
/**
* get_plugin_list
* @return array
*/
public function get_plugin_list() {
return [
[
'slug' => 'betterdocs',
'basename' => 'betterdocs/betterdocs.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/bd-new.svg',
'title' => __( 'BetterDocs', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Create and organize your knowledge base, FAQ & documentation page efficiently, making it easy for visitors to find any helpful article quickly and effortlessly.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'betterdocs/betterdocs.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'betterdocs/betterdocs.php' ),
],
[
'slug' => 'betterlinks',
'basename' => 'betterlinks/betterlinks.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/btl.svg',
'title' => __( 'BetterLinks', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Link Shortening tool to create, shorten & manage any URL. It helps to cross promote brands & products and gather analytics reports while running marketing campaigns.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'betterlinks/betterlinks.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'betterlinks/betterlinks.php' ),
],
[
'slug' => 'better-payment',
'basename' => 'better-payment/better-payment.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/bp.svg',
'title' => __( 'Better Payment', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Streamline transactions in Elementor by integrating PayPal & Stripe. Experience advanced analytics, validation, and Elementor forms for secure & efficient payments.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'better-payment/better-payment.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'better-payment/better-payment.php' ),
],
[
'slug' => 'notificationx',
'basename' => 'notificationx/notificationx.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/nx-logo.svg',
'title' => __( 'NotificationX', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Best FOMO & social proof plugin to boost sales conversion by creating stunning sales popups, growth & discount alerts, flashing tabs, notification bars & more.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'notificationx/notificationx.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'notificationx/notificationx.php' ),
],
[
'slug' => 'wp-scheduled-posts',
'basename' => 'wp-scheduled-posts/wp-scheduled-posts.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/wscp.svg',
'title' => __( 'SchedulePress', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Advanced content marketing tool for WordPress to schedule posts & pages with Schedule Calendar, Auto & Manual Scheduler, etc. It also allows auto-social sharing.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'wp-scheduled-posts/wp-scheduled-posts.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'wp-scheduled-posts/wp-scheduled-posts.php' ),
],
[
'slug' => 'easyjobs',
'basename' => 'easyjobs/easyjobs.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/easy-jobs-logo.svg',
'title' => __( 'easy.jobs', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Job recruitment tool to attract, manage, and hire the right talent faster. This talent recruitment solution lets you manage jobs and career pages in Elementor.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'easyjobs/easyjobs.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'easyjobs/easyjobs.php' ),
],
[
'slug' => 'embedpress',
'basename' => 'embedpress/embedpress.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/ep-logo.png',
'title' => __( 'EmbedPress', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Embed videos, images, gifs, charts, docs, maps, audio, live streams, pdf & more from 150+ sources into your WordPress site and get seamless customization options.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'embedpress/embedpress.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'embedpress/embedpress.php' ),
],
[
'slug' => 'essential-blocks',
'basename' => 'essential-blocks/essential-blocks.php',
'logo' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/eb-new.svg',
'title' => __( 'Essential Blocks', 'essential-addons-for-elementor-lite' ),
'desc' => __( 'Enhance Gutenberg experience with 50+ unique blocks (more coming soon). Boost your block editor with easy-to-use blocks for a simpler WordPress page or post design.', 'essential-addons-for-elementor-lite' ),
'is_active' => is_plugin_active( 'essential-blocks/essential-blocks.php' ),
'local_plugin_data' => $this->get_local_plugin_data( 'essential-blocks/essential-blocks.php' ),
],
];
}
/**
* get_local_plugin_data
*
* @param mixed $basename
* @return array|false
*/
public function get_local_plugin_data( $basename = '' ) {
if ( empty( $basename ) ) {
return false;
}
if ( !function_exists( 'get_plugins' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
if ( !isset( $plugins[ $basename ] ) ) {
return false;
}
return $plugins[ $basename ];
}
/**
* Save setup wizard data
*/
public function save_setup_wizard_data() {
check_ajax_referer( 'essential-addons-elementor', 'security' );
if ( !current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'you are not allowed to do this action', 'essential-addons-for-elementor-lite' ) );
}
if ( !isset( $_POST[ 'fields' ] ) ) {
return;
}
wp_parse_str( $_POST[ 'fields' ], $fields );
if ( isset( $fields[ 'eael_user_email_address' ] ) && intval( $fields[ 'eael_user_email_address' ] ) == 1 ) {
$this->wpins_process();
}
update_option( 'eael_setup_wizard', 'complete' );
if ( $this->save_element_list( $fields ) ) {
wp_send_json_success( [ 'redirect_url' => esc_url( admin_url( 'admin.php?page=eael-settings' ) ) ] );
}
wp_send_json_error();
}
public function enable_wpins_process() {
check_ajax_referer( 'essential-addons-elementor', 'security' );
if ( !current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'you are not allowed to do this action', 'essential-addons-for-elementor-lite' ) );
}
if ( !isset( $_POST[ 'fields' ] ) ) {
return;
}
wp_parse_str( $_POST[ 'fields' ], $fields );
$this->wpins_process();
wp_send_json_success();
}
/**
* save_eael_elements_data
*/
public function save_eael_elements_data() {
check_ajax_referer( 'essential-addons-elementor', 'security' );
if ( !current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'you are not allowed to do this action', 'essential-addons-for-elementor-lite' ) );
}
if ( !isset( $_POST[ 'fields' ] ) ) {
return;
}
wp_parse_str( $_POST[ 'fields' ], $fields );
if ( $this->save_element_list( $fields ) ) {
wp_send_json_success();
}
wp_send_json_error();
}
/**
* save_element_list
* @param $fields
* @return bool
*/
public function save_element_list( $fields ) {
if ( !empty( $fields ) ) {
$el_list = $fields[ 'eael_element' ];
$save_element = [];
foreach ( $GLOBALS[ 'eael_config' ][ 'elements' ] as $key => $item ) {
$save_element[ $key ] = ( isset( $el_list[ $key ] ) ) ? 1 : '';
}
$save_element = array_merge( $save_element, $this->get_dummy_widget() );
update_option( 'eael_save_settings', $save_element );
return true;
}
return false;
}
/**
* get_element_list
* @return array[]
*/
public function get_element_list() {
return [
'content-elements' => [
'title' => __( 'Content Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'creative-btn',
'title' => __( 'Creative Button', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'team-members',
'title' => __( 'Team Member', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'testimonials',
'title' => __( 'Testimonial', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'flip-box',
'title' => __( 'Flip Box', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'info-box',
'title' => __( 'Info Box', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'dual-header',
'title' => __( 'Dual Color Heading', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'tooltip',
'title' => __( 'Tooltip', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'adv-accordion',
'title' => __( 'Advanced Accordion', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'adv-tabs',
'title' => __( 'Advanced Tabs', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'feature-list',
'title' => __( 'Feature List', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'sticky-video',
'title' => __( 'Sticky Video', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'event-calendar',
'title' => __( 'Event Calendar', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'simple-menu',
'title' => __( 'Simple Menu', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
]
],
'dynamic-content-elements' => [
'title' => __( 'Dynamic Content Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'post-grid',
'title' => __( 'Post Grid', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'post-timeline',
'title' => __( 'Post Timeline', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'data-table',
'title' => __( 'Data Table', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'advanced-data-table',
'title' => __( 'Advanced Data Table', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'content-ticker',
'title' => __( 'Content Ticker', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'nft-gallery',
'title' => __( 'NFT Gallery', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'business-reviews',
'title' => __( 'Business Reviews', 'essential-addons-for-elementor-lite' ),
],
]
],
'creative-elements' => [
'title' => __( 'Creative Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'count-down',
'title' => __( 'Countdown', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'fancy-text',
'title' => __( 'Fancy Text', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'filter-gallery',
'title' => __( 'Filterable Gallery', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'image-accordion',
'title' => __( 'Image Accordion', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'progress-bar',
'title' => __( 'Progress Bar', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'interactive-circle',
'title' => __( 'Interactive Circle', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'svg-draw',
'title' => __( 'SVG Draw', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'fancy-chart',
'title' => __( 'Fancy Chart', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'stacked-cards',
'title' => __( 'Stacked Cards', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'sphere-photo-viewer',
'title' => __( '360 Degree Photo Viewer', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
]
],
'marketing-elements' => [
'title' => __( 'Marketing & Social Feed Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'call-to-action',
'title' => __( 'Call To Action', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'price-table',
'title' => __( 'Pricing Table', 'essential-addons-for-elementor-lite' ),
'preferences' => 'basic',
],
[
'key' => 'twitter-feed',
'title' => __( 'Twitter Feed', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'facebook-feed',
'title' => __( 'Facebook Feed', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
]
],
'form-styler-elements' => [
'title' => __( 'Form Styler Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'contact-form-7',
'title' => __( 'Contact Form 7', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'weforms',
'title' => __( 'weForms', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'ninja-form',
'title' => __( 'Ninja Form', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'gravity-form',
'title' => __( 'Gravity Form', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'caldera-form',
'title' => __( 'Caldera Form', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'wpforms',
'title' => __( 'WPForms', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'fluentform',
'title' => __( 'Fluent Forms', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'formstack',
'title' => __( 'Formstack', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'typeform',
'title' => __( 'Typeform', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'login-register',
'title' => __( 'Login Register Form', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
]
],
'documentation-elements' => [
'title' => __( 'Documentation Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'betterdocs-category-grid',
'title' => __( 'BetterDocs Category Grid', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'betterdocs-category-box',
'title' => __( 'BetterDocs Category Box', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'betterdocs-search-form',
'title' => __( 'BetterDocs Search Form', 'essential-addons-for-elementor-lite' ),
]
]
],
'woocommerce-elements' => [
'title' => __( 'WooCommerce Elements', 'essential-addons-for-elementor-lite' ),
'elements' => [
[
'key' => 'product-grid',
'title' => __( 'Woo Product Grid', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-product-list',
'title' => __( 'Woo Product List', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-product-image',
'title' => __( 'Woo Product Images', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-add-to-cart',
'title' => __( 'Woo Add To Cart', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-product-price',
'title' => __( 'Woo Product Price', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-product-rating',
'title' => __( 'Woo Product Rating', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'breadcrumbs',
'title' => __( 'Breadcrumbs', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-product-carousel',
'title' => __( 'Woo Product Carousel', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'woo-checkout',
'title' => __( 'Woo Checkout', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'woo-cart',
'title' => __( 'Woo Cart', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'woo-cross-sells',
'title' => __( 'Woo Cross Sells', 'essential-addons-for-elementor-lite' ),
],
[
'key' => 'woo-product-compare',
'title' => __( 'Woo Product Compare', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
],
[
'key' => 'woo-product-gallery',
'title' => __( 'Woo Product Gallery', 'essential-addons-for-elementor-lite' ),
'preferences' => 'advance',
]
]
]
];
}
public static function redirect() {
// Do not redirect AJAX requests
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}
update_option( 'eael_setup_wizard', 'init' );
wp_redirect( admin_url( 'admin.php?page=eael-setup-wizard' ) );
}
public function change_site_title() {
?>
<script>
document.title = "<?php esc_html_e( 'Quick Setup Wizard- Essential Addons', 'essential-addons-for-elementor-lite' ); ?>"
</script>
<?php
}
public function wpins_process() {
$plugin_name = basename( EAEL_PLUGIN_FILE, '.php' );
if ( class_exists( '\Essential_Addons_Elementor\Classes\Plugin_Usage_Tracker' ) ) {
$tracker = \Essential_Addons_Elementor\Classes\Plugin_Usage_Tracker::get_instance( EAEL_PLUGIN_FILE, [
'opt_in' => true,
'goodbye_form' => true,
'item_id' => '760e8569757fa16992d8'
] );
$tracker->set_is_tracking_allowed( true );
$tracker->do_tracking( true );
}
}
public function get_is_tracking_allowed( $plugin = 'essential_adons_elementor' ){
/**
* Get All Tracked Plugin List using this Tracker.
*/
$allow_tracking = get_option( 'wpins_allow_tracking' );
/**
* Check user is opted out for tracking or not.
*/
return intval( isset( $allow_tracking[$plugin] ) );
}
public function get_dummy_widget() {
return [
'embedpress' => 1,
'woocommerce-review' => 1,
'career-page' => 1,
'crowdfundly-single-campaign' => 1,
'crowdfundly-organization' => 1,
'crowdfundly-all-campaign' => 1,
'better-payment' => 1,
];
}
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,665 @@
<?php
namespace Essential_Addons_Elementor\Controls;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Background;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* EAEL background control.
*
* A base control for creating background control. Displays input fields to define
* the background color, background image, background gradient or background video.
*
* @since 1.2.2
*/
class EAEL_Background extends Group_Control_Background {
/**
* Fields.
*
* Holds all the background control fields.
*
* @since 1.2.2
* @access protected
* @static
*
* @var array Background control fields.
*/
protected static $fields;
/**
* Get background control type.
*
* Retrieve the control type, in this case `background`.
*
* @return string Control type.
* @since 1.0.0
* @access public
* @static
*
*/
public static function get_type() {
return 'eael-background';
}
/**
* Init fields.
*
* Initialize background control fields.
*
* @return array Control fields.
* @since 1.2.2
* @access public
*
*/
public function init_fields() {
$fields = [];
$fields['background'] = [
'label' => esc_html_x( 'Background Type', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'render_type' => 'ui',
];
$fields['color'] = [
'label' => esc_html_x( 'Color', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'title' => esc_html_x( 'Background Color', 'Background Control', 'essential-addons-for-elementor-lite' ),
'selectors' => [
'{{SELECTOR}}' => 'background: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic', 'gradient', 'video' ],
],
];
$fields['color_stop'] = [
'label' => esc_html_x( 'Location', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%', 'custom' ],
'default' => [
'unit' => '%',
'size' => 0,
],
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['color_b'] = [
'label' => esc_html_x( 'Second Color', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'default' => '#f2295b',
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['color_b_stop'] = [
'label' => esc_html_x( 'Location', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%', 'custom' ],
'default' => [
'unit' => '%',
'size' => 100,
],
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['gradient_type'] = [
'label' => esc_html_x( 'Type', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'options' => [
'linear' => esc_html_x( 'Linear', 'Background Control', 'essential-addons-for-elementor-lite' ),
'radial' => esc_html_x( 'Radial', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'default' => 'linear',
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['gradient_angle'] = [
'label' => esc_html_x( 'Angle', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ],
'default' => [
'unit' => 'deg',
'size' => 180,
],
'selectors' => [
'{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
],
'condition' => [
'background' => [ 'gradient' ],
'gradient_type' => 'linear',
],
'of_type' => 'gradient',
];
$fields['gradient_position'] = [
'label' => esc_html_x( 'Position', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'options' => [
'center center' => esc_html_x( 'Center Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center left' => esc_html_x( 'Center Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center right' => esc_html_x( 'Center Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top center' => esc_html_x( 'Top Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top left' => esc_html_x( 'Top Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top right' => esc_html_x( 'Top Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'default' => 'center center',
'selectors' => [
'{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
],
'condition' => [
'background' => [ 'gradient' ],
'gradient_type' => 'radial',
],
'of_type' => 'gradient',
];
$fields['image'] = [
'label' => esc_html_x( 'Image', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::MEDIA,
'ai' => [
'category' => 'background',
],
'dynamic' => [
'active' => true,
],
'responsive' => true,
'title' => esc_html_x( 'Background Image', 'Background Control', 'essential-addons-for-elementor-lite' ),
'selectors' => [
'{{SELECTOR}}' => 'background-image: url("{{URL}}");',
],
'has_sizes' => true,
'render_type' => 'template',
'condition' => [
'background' => [ 'classic' ],
],
];
$fields['position'] = [
'label' => esc_html_x( 'Position', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'separator' => 'before',
'responsive' => true,
'options' => [
'' => esc_html_x( 'Default', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center center' => esc_html_x( 'Center Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center left' => esc_html_x( 'Center Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center right' => esc_html_x( 'Center Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top center' => esc_html_x( 'Top Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top left' => esc_html_x( 'Top Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top right' => esc_html_x( 'Top Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'initial' => esc_html_x( 'Custom', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['xpos'] = [
'label' => esc_html_x( 'X Position', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'responsive' => true,
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
'default' => [
'size' => 0,
],
'tablet_default' => [
'size' => 0,
],
'mobile_default' => [
'size' => 0,
],
'range' => [
'px' => [
'min' => - 800,
'max' => 800,
],
'em' => [
'min' => - 100,
'max' => 100,
],
'%' => [
'min' => - 100,
'max' => 100,
],
'vw' => [
'min' => - 100,
'max' => 100,
],
],
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position' => [ 'initial' ],
'image[url]!' => '',
],
'required' => true,
];
$fields['ypos'] = [
'label' => esc_html_x( 'Y Position', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'responsive' => true,
'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
'default' => [
'size' => 0,
],
'tablet_default' => [
'size' => 0,
],
'mobile_default' => [
'size' => 0,
],
'range' => [
'px' => [
'min' => - 800,
'max' => 800,
],
'em' => [
'min' => - 100,
'max' => 100,
],
'%' => [
'min' => - 100,
'max' => 100,
],
'vh' => [
'min' => - 100,
'max' => 100,
],
],
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position' => [ 'initial' ],
'image[url]!' => '',
],
'required' => true,
];
$fields['attachment'] = [
'label' => esc_html_x( 'Attachment', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html_x( 'Default', 'Background Control', 'essential-addons-for-elementor-lite' ),
'scroll' => esc_html_x( 'Scroll', 'Background Control', 'essential-addons-for-elementor-lite' ),
'fixed' => esc_html_x( 'Fixed', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'selectors' => [
'(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['attachment_alert'] = [
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-control-field-description',
'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'essential-addons-for-elementor-lite' ),
'separator' => 'none',
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
'attachment' => 'fixed',
],
];
$fields['repeat'] = [
'label' => esc_html_x( 'Repeat', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'responsive' => true,
'options' => [
'' => esc_html_x( 'Default', 'Background Control', 'essential-addons-for-elementor-lite' ),
'no-repeat' => esc_html_x( 'No-repeat', 'Background Control', 'essential-addons-for-elementor-lite' ),
'repeat' => esc_html_x( 'Repeat', 'Background Control', 'essential-addons-for-elementor-lite' ),
'repeat-x' => esc_html_x( 'Repeat-x', 'Background Control', 'essential-addons-for-elementor-lite' ),
'repeat-y' => esc_html_x( 'Repeat-y', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'selectors' => [
'{{SELECTOR}}' => 'background-repeat: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['size'] = [
'label' => esc_html_x( 'Display Size', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'responsive' => true,
'default' => '',
'options' => [
'' => esc_html_x( 'Default', 'Background Control', 'essential-addons-for-elementor-lite' ),
'auto' => esc_html_x( 'Auto', 'Background Control', 'essential-addons-for-elementor-lite' ),
'cover' => esc_html_x( 'Cover', 'Background Control', 'essential-addons-for-elementor-lite' ),
'contain' => esc_html_x( 'Contain', 'Background Control', 'essential-addons-for-elementor-lite' ),
'initial' => esc_html_x( 'Custom', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'selectors' => [
'{{SELECTOR}}' => 'background-size: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['bg_width'] = [
'label' => esc_html_x( 'Width', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'responsive' => true,
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
],
'%' => [
'min' => 0,
'max' => 100,
],
'vw' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 100,
'unit' => '%',
],
'required' => true,
'selectors' => [
'{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
],
'condition' => [
'background' => [ 'classic' ],
'size' => [ 'initial' ],
'image[url]!' => '',
],
];
$fields['video_link'] = [
'label' => esc_html_x( 'Video Link', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E',
'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'essential-addons-for-elementor-lite' ),
'label_block' => true,
'default' => '',
'dynamic' => [
'active' => true,
'categories' => [
TagsModule::POST_META_CATEGORY,
TagsModule::URL_CATEGORY,
],
],
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['video_start'] = [
'label' => esc_html__( 'Start Time', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::NUMBER,
'description' => esc_html__( 'Specify a start time (in seconds)', 'essential-addons-for-elementor-lite' ),
'placeholder' => 10,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['video_end'] = [
'label' => esc_html__( 'End Time', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::NUMBER,
'description' => esc_html__( 'Specify an end time (in seconds)', 'essential-addons-for-elementor-lite' ),
'placeholder' => 70,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['play_once'] = [
'label' => esc_html__( 'Play Once', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['play_on_mobile'] = [
'label' => esc_html__( 'Play On Mobile', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
// This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy
// Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos
// will not run properly. This added control allows users to align all their videos to one host (either
// youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not).
$fields['privacy_mode'] = [
'label' => esc_html__( 'Privacy Mode', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['video_fallback'] = [
'label' => esc_html_x( 'Background Fallback', 'Background Control', 'essential-addons-for-elementor-lite' ),
'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'condition' => [
'background' => [ 'video' ],
],
'selectors' => [
'{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;',
],
'of_type' => 'video',
];
$fields['slideshow_gallery'] = [
'label' => esc_html_x( 'Images', 'Background Control', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::GALLERY,
'condition' => [
'background' => [ 'slideshow' ],
],
'show_label' => false,
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_loop'] = [
'label' => esc_html__( 'Infinite Loop', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_slide_duration'] = [
'label' => esc_html__( 'Duration', 'essential-addons-for-elementor-lite' ) . ' (ms)',
'type' => Controls_Manager::NUMBER,
'default' => 5000,
'condition' => [
'background' => [ 'slideshow' ],
],
'frontend_available' => true,
];
$fields['slideshow_slide_transition'] = [
'label' => esc_html__( 'Transition', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'fade',
'options' => [
'fade' => 'Fade',
'slide_right' => 'Slide Right',
'slide_left' => 'Slide Left',
'slide_up' => 'Slide Up',
'slide_down' => 'Slide Down',
],
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_transition_duration'] = [
'label' => esc_html__( 'Transition Duration', 'essential-addons-for-elementor-lite' ) . ' (ms)',
'type' => Controls_Manager::NUMBER,
'default' => 500,
'condition' => [
'background' => [ 'slideshow' ],
],
'frontend_available' => true,
];
$fields['slideshow_background_size'] = [
'label' => esc_html__( 'Background Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'responsive' => true,
'default' => '',
'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' ),
],
'selectors' => [
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};',
],
'condition' => [
'background' => [ 'slideshow' ],
],
];
$fields['slideshow_background_position'] = [
'label' => esc_html__( 'Background Position', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'responsive' => true,
'options' => [
'' => esc_html__( 'Default', 'essential-addons-for-elementor-lite' ),
'center center' => esc_html_x( 'Center Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center left' => esc_html_x( 'Center Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'center right' => esc_html_x( 'Center Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top center' => esc_html_x( 'Top Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top left' => esc_html_x( 'Top Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'top right' => esc_html_x( 'Top Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'essential-addons-for-elementor-lite' ),
'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'essential-addons-for-elementor-lite' ),
],
'selectors' => [
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};',
],
'condition' => [
'background' => [ 'slideshow' ],
],
];
$fields['slideshow_lazyload'] = [
'label' => esc_html__( 'Lazyload', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_ken_burns'] = [
'label' => esc_html__( 'Ken Burns Effect', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_ken_burns_zoom_direction'] = [
'label' => esc_html__( 'Direction', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'in',
'options' => [
'in' => esc_html__( 'In', 'essential-addons-for-elementor-lite' ),
'out' => esc_html__( 'Out', 'essential-addons-for-elementor-lite' ),
],
'condition' => [
'background' => [ 'slideshow' ],
'slideshow_ken_burns!' => '',
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
return $fields;
}
}
@@ -0,0 +1,86 @@
<?php
namespace Essential_Addons_Elementor\Controls;
use Elementor\Control_Choose;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor choose control.
*
* A base control for creating choose control. Displays radio buttons styled as
* groups of buttons with icons for each option.
*
* @since 5.6.0
*/
class EAEL_Choose extends Control_Choose {
/**
* Render choose control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 5.6.0
* @access public
*/
public function content_template() {
$control_uid_input_type = '{{value}}';
?>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<div class="elementor-choices {{ data.image_choose ? ' eael-image-choices ' : ' eael-choices ' }}{{ data.multiline ? ' eael-multiline ' : '' }} {{ data.css_class ? data.css_class : '' }}">
<# _.each( data.options, function( options, value ) { #>
<input id="<?php $this->print_control_uid( $control_uid_input_type ); ?>" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ value }}">
<label class="elementor-choices-label elementor-control-unit-1 {{ !options.text ? ' tooltip-target' : '' }} {{ options.fullwidth ? ' fullwidth' : '' }}"
for="<?php $this->print_control_uid( $control_uid_input_type ); ?>"
data-tooltip="{{ options.title }}"
title="{{ options.title }}"
style="{{ options.height ? 'height: ' + options.height + ';' : '' }}">
<# if( options.image ){ #>
<img class="eael-image-option" src="{{ options.image }}" alt="{{ options.title }}" />
<# if( options.title && options?.fullwidth ){ #>
<span class="eael-text-option">{{{ options.title }}}</span>
<# } #>
<# } else if( options.text ){ #>
<span class="eael-text-option">{{{ options.text }}}</span>
<# } else{ #>
<i class="{{ options.icon }}" aria-hidden="true"></i>
<# if( options.title && options?.fullwidth ){ #>
<span class="eael-text-option">{{{ options.title }}}</span>
<# } #>
<# } #>
<span class="elementor-screen-only">{{{ options.title }}}</span>
</label>
<# } ); #>
</div>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get choose control default settings.
*
* Retrieve the default settings of the choose control. Used to return the
* default settings while initializing the choose control.
*
* @since 5.6.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'options' => [],
'toggle' => true,
];
}
}
@@ -0,0 +1,85 @@
<?php
namespace Essential_Addons_Elementor\Controls;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Base_Data_Control;
class Select2 extends Base_Data_Control
{
public function get_type()
{
return 'eael-select2';
}
public function enqueue() {
wp_register_script( 'eael-select2', EAEL_PLUGIN_URL . 'assets/front-end/js/edit/ea-select2.js',
[ 'jquery-elementor-select2' ], EAEL_PLUGIN_VERSION, true );
wp_localize_script(
'eael-select2',
'eael_select2_localize',
[
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
'search_text' => esc_html__( 'Search', 'essential-addons-for-elementor-lite' ),
'remove' => __( 'Remove', 'essential-addons-for-elementor-lite' ),
'thumbnail' => __( 'Image', 'essential-addons-for-elementor-lite' ),
'name' => __( 'Title', 'essential-addons-for-elementor-lite' ),
'price' => __( 'Price', 'essential-addons-for-elementor-lite' ),
'quantity' => __( 'Quantity', 'essential-addons-for-elementor-lite' ),
'subtotal' => __( 'Subtotal', 'essential-addons-for-elementor-lite' ),
'cl_login_status' => __( 'User Status', 'essential-addons-for-elementor-lite' ),
'cl_post_type' => __( 'Post Type', 'essential-addons-for-elementor-lite' ),
'cl_browser' => __( 'Browser', 'essential-addons-for-elementor-lite' ),
'cl_date_time' => __( 'Date & Time', 'essential-addons-for-elementor-lite' ),
'cl_recurring_day'=> __( 'Recurring Day', 'essential-addons-for-elementor-lite' ),
'cl_dynamic' => __( 'Dynamic Field', 'essential-addons-for-elementor-lite' ),
'cl_query_string' => __( 'Query String', 'essential-addons-for-elementor-lite' ),
'cl_visit_count' => __( 'Visit Count', 'essential-addons-for-elementor-lite' ),
'cl_url_contains' => __( 'URL Contains', 'essential-addons-for-elementor-lite' ),
'cl_archive' => __( 'Archive', 'essential-addons-for-elementor-lite' ),
'cl_woo_products' => __( 'Woo Products', 'essential-addons-for-elementor-lite' ),
'cl_woo_cart' => __( 'Woo Cart', 'essential-addons-for-elementor-lite' ),
'cl_woo_orders' => __( 'Woo Orders', 'essential-addons-for-elementor-lite' ),
]
);
wp_enqueue_script( 'eael-select2' );
}
protected function get_default_settings()
{
return [
'multiple' => false,
'source_name' => 'post_type',
'source_type' => 'post',
];
}
public function content_template()
{
$control_uid = $this->get_control_uid();
?>
<# var controlUID = '<?php echo esc_html( $control_uid ); ?>'; #>
<# var currentID = elementor.panel.currentView.currentPageView.model.attributes.settings.attributes[data.name]; #>
<div class="elementor-control-field">
<# if ( data.label ) { #>
<label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{data.label }}}</label>
<# } #>
<div class="elementor-control-input-wrapper elementor-control-unit-5">
<# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
<select id="<?php echo esc_attr( $control_uid ); ?>" {{ multiple }} class="ea-select2" data-setting="{{ data.name }}"></select>
</div>
</div>
<# if ( data.source_type === 'elementor_library' ) { #>
<a href="#" target="_blank" class="elementor-button elementor-edit-template" style="margin-top:0px;"><i class="eicon-pencil" style="margin-left:10px;"></i>Edit Template</a>
<# }
( function( $ ) {
$( document.body ).trigger( 'eael_select2_init',{currentID:data.controlValue,data:data,controlUID:controlUID,multiple:data.multiple} );
}( jQuery ) );
#>
<?php
}
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,65 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Widget_Base;
class Better_Payment extends Widget_Base {
public function get_name() {
return 'eael-better-payment';
}
public function get_title() {
return esc_html__( 'Better Payment', 'essential-addons-for-elementor-lite');
}
public function get_icon() {
return 'eaicon-better-payment';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords() {
return [
'payment', 'better-payment' ,'paypal', 'stripe', 'sell', 'donate', 'transaction', 'online-transaction', 'better payment', 'online transaction', 'ea better payment', 'ea', 'essential addons'
];
}
public function get_custom_help_url() {
return '#';
}
protected function register_controls() {
$this->start_controls_section(
'eael_global_warning',
[
'label' => __('Warning!', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('<strong>Better Payment</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=better-payment&tab=search&type=tag" target="_blank">Better Payment</a> first.',
'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
]
);
$this->end_controls_section();
}
protected function render() {
return;
}
}
@@ -0,0 +1,596 @@
<?php
namespace Essential_Addons_Elementor\Elements;
use Essential_Addons_Elementor\Classes\Helper;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Typography;
use \Elementor\Group_Control_Background;
use \Elementor\Widget_Base;
class Betterdocs_Search_Form extends Widget_Base
{
public function get_name()
{
return 'eael-betterdocs-search-form';
}
public function get_title()
{
return __('BetterDocs Search Form', 'essential-addons-for-elementor-lite');
}
public function get_categories()
{
return ['essential-addons-elementor'];
}
public function get_icon()
{
return 'eaicon-betterdocs-search-form';
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @since 3.5.2
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords()
{
return [
'knowledgebase',
'knowledge Base',
'documentation',
'doc',
'kb',
'betterdocs',
'ea betterdocs',
'search',
'search form',
'ea',
'essential addons'
];
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url()
{
return 'https://essential-addons.com/elementor/docs/betterdocs-search-form/';
}
protected function register_controls()
{
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
if (!defined('BETTERDOCS_URL')) {
$this->start_controls_section(
'eael_global_warning',
[
'label' => __('Warning!', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('<strong>BetterDocs</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=BetterDocs&tab=search&type=term" target="_blank">BetterDocs</a> first.', 'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
]
);
$this->end_controls_section();
} else {
/**
* ----------------------------------------------------------
* Section: Search Box
* ----------------------------------------------------------
*/
$this->start_controls_section(
'section_search_box_settings',
[
'label' => __('Search Box', 'essential-addons-for-elementor-lite'),
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'search_box_bg',
'types' => ['classic', 'gradient'],
'selector' => '{{WRAPPER}} .betterdocs-live-search'
]
);
$this->add_responsive_control(
'search_box_padding',
[
'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'default' => [
'top' => 50,
'right' => 50,
'bottom' => 50,
'left' => 50
],
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
],
]
);
$this->end_controls_section(); # end of 'Search Box'
/**
* ----------------------------------------------------------
* Section: Search Field
* ----------------------------------------------------------
*/
$this->start_controls_section(
'section_search_field_settings',
[
'label' => __('Search Field', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'section_search_field_placeholder',
[
'label' => __('Placeholder', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'default' => esc_html__('Search', 'essential-addons-for-elementor-lite'),
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'search_field_bg',
[
'label' => esc_html__('Field Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-searchform' => 'background: {{VALUE}};',
],
]
);
$this->add_control(
'search_field_text_color',
[
'label' => esc_html__('Field Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'search_field_text_typography',
'selector' => '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field'
]
);
$this->add_responsive_control(
'search_field_padding',
[
'label' => __('Field Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'search_field_padding_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .betterdocs-searchform' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'search_field_border',
'label' => __('Border', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .betterdocs-searchform',
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'search_field_shadow',
'label' => __('Shadow', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .betterdocs-searchform',
]
);
$this->add_control(
'field_search_icon_heading',
[
'label' => esc_html__('Search Icon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_control(
'field_search_icon_color',
[
'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-searchform svg.docs-search-icon' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'field_search_icon_size',
[
'label' => esc_html__('Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%', 'em'],
'range' => [
'px' => [
'max' => 500,
],
],
'selectors' => [
'{{WRAPPER}} .betterdocs-searchform svg.docs-search-icon' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'field_close_icon_heading',
[
'label' => esc_html__('Close Icon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_control(
'search_field_close_icon_color',
[
'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .docs-search-close .close-line' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'search_field_close_icon_border_color',
[
'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .docs-search-loader, {{WRAPPER}} .docs-search-close .close-border' => 'stroke: {{VALUE}};',
],
]
);
$this->end_controls_section(); # end of 'Search Field'
/**
* ----------------------------------------------------------
* Section: Search Result Box
* ----------------------------------------------------------
*/
$this->start_controls_section(
'section_search_result_settings',
[
'label' => __('Search Result Box', 'essential-addons-for-elementor-lite'),
]
);
$this->add_responsive_control(
'result_box_width',
[
'label' => __('Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 100,
'unit' => '%',
],
'size_units' => ['%', 'px', 'em'],
'range' => [
'%' => [
'max' => 100,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'result_box_max_width',
[
'label' => __('Max Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 1600,
'unit' => 'px',
],
'size_units' => ['px', 'em'],
'range' => [
'px' => [
'max' => 1600,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'result_box_bg',
'types' => ['classic', 'gradient'],
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result'
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'result_box_border',
'label' => esc_html__('Border', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result',
]
);
$this->end_controls_section(); # end of 'Search Result Box'
/**
* ----------------------------------------------------------
* Section: Search Result Item
* ----------------------------------------------------------
*/
$this->start_controls_section(
'section_search_result_item_settings',
[
'label' => __('Search Result List', 'essential-addons-for-elementor-lite'),
]
);
$this->start_controls_tabs('item_settings_tab');
// Normal State Tab
$this->start_controls_tab(
'item_normal',
['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]
);
$this->add_control(
'result_box_item',
[
'label' => esc_html__('Item', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'result_box_item_typography',
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a'
]
);
$this->add_control(
'result_box_item_color',
[
'label' => esc_html__('Item Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result li a' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'result_item_border',
'label' => esc_html__('Border', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li'
]
);
$this->add_responsive_control(
'result_box_item_padding',
[
'label' => __('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'search_result_box_item_count',
[
'label' => esc_html__('Count', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'result_box_item_count_typography',
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li span'
]
);
$this->add_control(
'result_box_item_count_color',
[
'label' => esc_html__('Item Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result li span' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
// Hover State Tab
$this->start_controls_tab(
'item_hover',
['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]
);
$this->add_responsive_control(
'result_item_transition',
[
'label' => __('Transition', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 300,
'unit' => '%',
],
'size_units' => ['%'],
'range' => [
'%' => [
'max' => 2500,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result li, {{WRAPPER}} .betterdocs-live-search .docs-search-result li a, {{WRAPPER}} .betterdocs-live-search .docs-search-result li span, {{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'transition: {{SIZE}}ms;',
],
]
);
$this->add_control(
'result_box_item_hover_heading',
[
'label' => esc_html__('Item', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'result_box_item_hover_bg',
'types' => ['classic', 'gradient'],
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover',
'exclude' => [
'image'
]
]
);
$this->add_control(
'result_box_item_hover_color',
[
'label' => esc_html__('Item Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover a' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'result_item_hover_border',
'label' => esc_html__('Border', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover'
]
);
$this->add_control(
'result_box_item_hover_count_heading',
[
'label' => esc_html__('Count', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_control(
'result_box_item_hover_count_color',
[
'label' => esc_html__('Item Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover span' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section(); # end of 'Search Result Item'
}
}
protected function render()
{
if (!defined('BETTERDOCS_URL')) return;
$settings = $this->get_settings_for_display();
$shortcode = sprintf('[betterdocs_search_form placeholder="' . esc_html( $settings['section_search_field_placeholder'] ) . '"]', apply_filters('eael_betterdocs_search_form_params', []));
echo do_shortcode(shortcode_unautop($shortcode));
}
public function render_plain_content()
{
$settings = $this->get_settings_for_display();
// In plain mode, render without shortcode
echo '[betterdocs_search_form placeholder="' . esc_html( $settings['section_search_field_placeholder'] ) . '"]';
}
}
@@ -0,0 +1,739 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use Elementor\Widget_Base;
use Elementor\Icons_Manager;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Essential_Addons_Elementor\Classes\Helper;
class Breadcrumbs extends Widget_Base {
public function get_name() {
return 'eael-breadcrumbs';
}
public function get_title() {
return esc_html__( 'Breadcrumbs', 'essential-addons-for-elementor-lite' );
}
public function get_icon() {
return 'eaicon-breadcrumbs';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords() {
return [ 'breadcrumbs', 'shop', 'page', 'post', 'product', 'ea breadcrumbs' ];
}
public function get_custom_help_url() {
return 'https://essential-addons.com/elementor/docs/ea-breadcrumbs/';
}
protected function register_controls() {
//General Section
$this->eael_breadcrumb_general();
//Style Section
$this->eael_breadcrumb_style();
//
$this->eael_breadcrumb_separator_style();
//
$this->eael_breadcrumb_prefix_style();
}
protected function eael_breadcrumb_general() {
$this->start_controls_section(
'breadcrumb_general',
[
'label' => esc_html__( 'General', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'breadcrumb_home_text',
[
'label' => esc_html__( 'Label For Home', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Home', 'essential-addons-for-elementor-lite' ),
'ai' => [
'active' => false,
],
]
);
//
$this->add_control(
'breadcrumb_prefix_switch',
[
'label' => esc_html__( 'Show Prefix', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
'separator' => 'before',
]
);
$this->add_control(
'eael_breadcrumb_prefix_type',
[
'label' => esc_html__( 'Prefix Type', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'icon' => [
'title' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-nerd',
],
'text' => [
'title' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-area',
],
],
'default' => 'icon',
'condition' => [
'breadcrumb_prefix_switch' => 'yes',
],
]
);
$this->add_control(
'eael_breadcrumb_prefix_icon',
[
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-home',
'library' => 'fa-solid',
],
'condition' => [
'eael_breadcrumb_prefix_type' => 'icon',
'breadcrumb_prefix_switch' => 'yes',
],
]
);
$this->add_control(
'eael_breadcrumb_prefix_text',
[
'label' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Browse: ', 'essential-addons-for-elementor-lite' ),
'condition' => [
'eael_breadcrumb_prefix_type' => 'text',
'breadcrumb_prefix_switch' => 'yes',
],
'ai' => [
'active' => false,
],
]
);
$this->end_controls_tabs();
//
$this->add_control(
'eael_separator_type',
[
'label' => esc_html__( 'Separator Type', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'icon' => [
'title' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-nerd',
],
'text' => [
'title' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-area',
],
],
'default' => 'text',
'separator' => 'before',
]
);
$this->add_control(
'eael_separator_icon',
[
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-angle-double-right',
'library' => 'fa-solid',
],
'condition' => [
'eael_separator_type' => 'icon',
],
]
);
$this->add_control(
'eael_separator_type_text',
[
'label' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( '/', 'essential-addons-for-elementor-lite' ),
'condition' => [
'eael_separator_type' => 'text',
],
'ai' => [
'active' => false,
],
]
);
$this->end_controls_section();
}
protected function eael_breadcrumb_style() {
$this->start_controls_section(
'breadcrumb_style',
[
'label' => esc_html__( 'Style', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'breadcrumb_align',
[
'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-right',
],
],
'toggle' => true,
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs' => 'justify-content: {{VALUE}};',
],
]
);
$this->add_control(
'eael_breadcrumb_bg_color',
[
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'default' => '#f8f8fa',
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content' => 'background-color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_breadcrumb_border',
'selector' => '{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content',
]
);
$this->add_control(
'eael_breadcrumb_border_radious',
[
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_breadcrumb_padding',
[
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'breadcrumb_link_color',
[
'label' => esc_html__( 'Link Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content a' => 'color: {{VALUE}}',
]
]
);
$this->add_control(
'breadcrumb_text_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content' => 'color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'breadcrumb_typography',
'selector' => '{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__content',
]
);
$this->end_controls_section();
}
protected function eael_breadcrumb_prefix_style() {
$this->start_controls_section(
'prefix_style',
[
'label' => esc_html__( 'Prefix', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'breadcrumb_prefix_switch' => 'yes',
],
]
);
$this->add_control(
'prefix_style_icon_heading',
[
'label' => esc_html__( 'Icon Style', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'after',
]
);
$this->add_control(
'prefix_icon_color',
[
'label' => esc_html__( 'Icon Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix svg path' => 'fill: {{VALUE}}',
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix i' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'prefix_icon_size',
[
'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 20,
],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix i' => 'font-size: {{SIZE}}{{UNIT}}',
],
]
);
$this->add_responsive_control(
'prefix_icon_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'default' => [
'top' => 0,
'right' => 8,
'bottom' => 0,
'left' => 0,
'isLinked' => true,
],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'prefix_style_text_heading',
[
'label' => esc_html__( 'Text Style', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'after',
]
);
$this->add_control(
'prefix_text_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix span' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'prefix_text_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'default' => [
'top' => -2,
'right' => 10,
'bottom' => 0,
'left' => 0,
'isLinked' => true,
],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'prefix_text_typography',
'selector' => '{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumbs__prefix span',
]
);
$this->end_controls_section();
}
protected function eael_breadcrumb_separator_style() {
$this->start_controls_section(
'separator_style',
[
'label' => esc_html__( 'Separator', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'separator_text_color',
[
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'default' => '#A5A4B0',
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator svg path' => 'fill: {{VALUE}}',
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'eael_separator_spacing',
[
'label' => esc_html__( 'Spacing', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 10,
],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator' => 'margin: 0 {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'separator_size',
[
'label' => esc_html__( 'Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 15,
],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator i' => 'font-size: {{SIZE}}{{UNIT}};',
],
'condition' => [
'eael_separator_type' => 'icon',
],
]
);
$this->add_responsive_control(
'separator_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'default' => [
'top' => 4,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator svg,
{{WRAPPER}} .eael-breadcrumbs .eael-breadcrumb-separator i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'eael_separator_type' => 'icon',
],
]
);
$this->end_controls_section();
}
protected function eael_breadcrumb_home_label() {
$settings = $this->get_settings_for_display();
if ( ! empty( $settings['breadcrumb_home_text'] ) ) {
return wp_kses( $settings['breadcrumb_home_text'], Helper::eael_allowed_tags() );
}
return;
}
protected function eael_breadcrumb_prefix() {
$settings = $this->get_settings_for_display();
$prefix_type = $settings['eael_breadcrumb_prefix_type'];
if ( 'yes' == $settings['breadcrumb_prefix_switch'] ) {
?>
<div class="eael-breadcrumbs__prefix">
<?php
switch ( $prefix_type ) {
case 'icon':
$home_url = get_bloginfo( 'url' );
echo '<a href="' . esc_url( $home_url ) . '" class="eael-breadcrumbs__prefix-link">';
Icons_Manager::render_icon( $settings['eael_breadcrumb_prefix_icon'], [ 'aria-hidden' => 'true' ] );
echo '</a>';
break;
case 'text':
echo "<span>" . wp_kses( $settings['eael_breadcrumb_prefix_text'], Helper::eael_allowed_tags() ) . "</span>";
break;
}
?>
</a>
</div>
<?php
}
}
protected function eael_breadcrumb_separator() {
$settings = $this->get_settings_for_display();
if ( ! empty( $settings['eael_separator_icon'] ) ) {
ob_start();
Icons_Manager::render_icon($settings['eael_separator_icon'], ['aria-hidden' => 'true']);
$separator_icon = ob_get_clean();
return sprintf( '<span class="eael-breadcrumb-separator">%s</span>', $separator_icon );
} else {
return sprintf( '<span class="eael-breadcrumb-separator">%s</span>', wp_kses( $settings['eael_separator_type_text'], Helper::eael_allowed_tags() ) );
}
}
protected function eael_wc_breadcrumb() {
$args = array(
'delimiter' => $this->eael_breadcrumb_separator(),
'wrap_before' => '<nav class="eael-breadcrumbs__content woocommerce-breadcrumb" aria-label="Breadcrumb">',
'wrap_after' => '</nav>',
'before' => '',
'after' => '',
'home' => $this->eael_breadcrumb_home_label(),
);
$this->eael_breadcrumb_prefix();
woocommerce_breadcrumb( $args );
}
protected function eael_breadcrumbs() {
global $post;
$show_on_home = 1;
$delimiter = $this->eael_breadcrumb_separator();
$home = $this->eael_breadcrumb_home_label();
$show_current = 1;
$before = '<span class = "eael-current">';
$after = '</span>';
$home_link = get_bloginfo( 'url' );
//
$output = '';
if ( is_home() || is_front_page() ) {
if ( $show_on_home == 1 ) {
$this->eael_breadcrumb_prefix();
$output .= '<div class="eael-breadcrumbs__content"><a href="' . $home_link . '">' . $home . '</a></div>';
}
} else {
$this->eael_breadcrumb_prefix();
$output .= '<div class="eael-breadcrumbs__content"><a href="' . $home_link . '">' . $home . '</a> ' . $delimiter . ' ';
if ( is_category() ) {
$get_category = get_category( get_query_var( 'cat' ), false );
if ( $get_category->parent != 0 ) {
$output .= get_category_parents( $get_category->parent, true, ' ' . $delimiter . ' ' );
}
$output .= $before . esc_html__( 'Archive by category', 'essential-addons-for-elementor-lite' ) .' "' . single_cat_title( '', false ) . '"' . $after;
} elseif ( is_attachment() ) {
$parent = get_post( $post->post_parent );
$cat = get_the_category( $parent->ID );
$cat = $cat[0];
$output .= get_category_parents( $cat, TRUE, ' ' . $delimiter . ' ' );
$output .= '<a href="' . get_permalink( $parent ) . '">' . $parent->post_title . '</a>';
if ( $show_current == 1 ) {
$output .= ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
}
} elseif ( is_page() && ! $post->post_parent ) {
if ( $show_current == 1 ) {
$output .= $before . get_the_title() . $after;
}
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ( $parent_id ) {
$page = get_page( $parent_id );
$breadcrumbs[] = '<a href="' . get_permalink( $page->ID) . '">' . get_the_title($page->ID) . '</a>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
$output .= $breadcrumbs[$i];
if ($i != count($breadcrumbs)-1) {
$output .= ' ' . $delimiter . ' ';
}
}
if ($show_current == 1){
$output .= ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
}
} elseif ( is_single() && ! is_attachment() ) {
if ( 'post' !== get_post_type() ) {
$post_type = get_post_type_object( get_post_type() );
$get_slug = $post_type->rewrite ?? false;
if ($get_slug && is_array($get_slug) && isset($get_slug['slug'])) {
$slug = $get_slug['slug'];
} else {
$slug = '';
}
$output .= '<a href="' . $home_link . '/' . $slug . '/">' . $post_type->labels->singular_name . '</a>';
if ( $show_current == 1 ) {
$output .= ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
}
} else {
$cat = get_the_category();
$cat = $cat[0];
$cats = get_category_parents( $cat, TRUE, ' ' . $delimiter . ' ' );
if ( $show_current == 0 ) {
$cats = preg_replace( "#^(.+)\s$delimiter\s$#", "$1", $cats ) ;
}
$output .= $cats;
if ( $show_current == 1 ) {
$output .= $before . get_the_title() . $after;
}
}
} elseif ( ! is_single() && ! is_page() && get_post_type() !== 'post' && ! is_404() ) {
$post_type = get_post_type_object( get_post_type() );
$output .= $before . $post_type->labels->singular_name . $after;
} elseif ( is_search() ) {
$output .= $before . esc_html__( 'Search results for', 'essential-addons-for-elementor-lite' ) . ' "' . get_search_query() . '"' . $after;
} elseif ( is_day() ) {
$output .= '<a href="' . get_year_link( get_the_time( 'Y' ) ) . '">' . get_the_time( 'Y' ) . '</a> ' . $delimiter . ' ';
$output .= '<a href="' . get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) . '">' . get_the_time( 'F' ) . '</a> ' . $delimiter . ' ';
$output .= $before . get_the_time( 'd' ) . $after;
} elseif ( is_month() ) {
$output .= '<a href="' . get_year_link( get_the_time( 'Y' ) ) . '">' . get_the_time( 'Y' ) . '</a> ' . $delimiter . ' ';
$output .= $before . get_the_time( 'F' ) . $after;
} elseif ( is_year() ) {
$output .= $before . get_the_time( 'Y' ) . $after;
} elseif ( is_tag() ) {
$output .= $before . esc_html__( 'Posts tagged', 'essential-addons-for-elementor-lite' ) . ' "' . single_tag_title( '', false ) . '"' . $after;
} elseif( is_author() ) {
global $author;
$user_data = get_userdata( $author );
$output .= $before . esc_html__( 'Articles posted by', 'essential-addons-for-elementor-lite' ) . $user_data->display_name . $after;
} elseif ( is_404() ) {
$output .= $before . esc_html__( 'Error 404', 'essential-addons-for-elementor-lite' ) . $after;
}
$output .= "</div>";
}
//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $output;
}
protected function render() {
$product = false;
if ( class_exists( 'WooCommerce' ) ) {
$product = wc_get_product( get_the_ID() );
}
?>
<div class="eael-breadcrumbs">
<?php
if ( ! $product ) {
$this->eael_breadcrumbs();
} else {
$this->eael_wc_breadcrumb();
}
?>
</div>
<?php
}
}
@@ -0,0 +1,70 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Widget_Base;
class Career_Page extends Widget_Base {
public function get_name() {
return 'eael-career-page';
}
public function get_title() {
return esc_html__( 'EasyJobs Career Page', 'essential-addons-for-elementor-lite');
}
public function get_icon() {
return 'eaicon-easyjobs';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords() {
return [
'easyjobs',
'addons',
'ea',
'career',
'job',
'career page',
'essential addons',
];
}
public function get_custom_help_url() {
return 'https://easy.jobs/docs/';
}
protected function register_controls() {
$this->start_controls_section(
'eael_global_warning',
[
'label' => __('Warning!', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('<strong>EasyJobs</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=easyjobs&tab=search&type=term" target="_blank">EasyJobs</a> first.',
'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
]
);
$this->end_controls_section();
}
protected function render() {
return;
}
}
@@ -0,0 +1,858 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Typography;
use \Elementor\Widget_Base;
use \Essential_Addons_Elementor\Classes\Helper;
class Content_Ticker extends Widget_Base
{
use \Essential_Addons_Elementor\Traits\Template_Query;
use \Essential_Addons_Elementor\Traits\Helper;
public function get_name()
{
return 'eael-content-ticker';
}
public function get_title()
{
return esc_html__('Content Ticker', 'essential-addons-for-elementor-lite');
}
public function get_icon()
{
return 'eaicon-content-ticker';
}
public function get_style_depends(): array {
return [ 'e-swiper' ];
}
public function get_categories()
{
return ['essential-addons-elementor'];
}
public function get_keywords()
{
return [
'ticker',
'ea ticker',
'ea content ticker',
'news headline',
'news ticker',
'text rotate',
'text animation',
'text swing',
'text slide',
'ea',
'essential addons',
];
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url()
{
return 'https://essential-addons.com/elementor/docs/content-ticker/';
}
protected function register_controls()
{
/**
* Content Ticker Content Settings
*/
$this->start_controls_section(
'eael_section_content_ticker_settings',
[
'label' => esc_html__('Ticker Settings', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_dynamic_template_Layout',
[
'label' => esc_html__('Template Layout', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'default',
'options' => $this->get_template_list_for_dropdown(),
]
);
$ticker_options = apply_filters(
'eael_ticker_options',
[
'options' => [
'dynamic' => esc_html__('Dynamic', 'essential-addons-for-elementor-lite'),
'custom' => esc_html__('Custom', 'essential-addons-for-elementor-lite'),
],
'conditions' => [
'custom',
],
]
);
$this->add_control(
'eael_ticker_type',
[
'label' => esc_html__('Ticker Type', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'dynamic',
'label_block' => false,
'options' => $ticker_options['options'],
]
);
$this->add_control(
'eael_ticker_type_pro_alert',
[
'label' => esc_html__('Custom Content available in pro version only!', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'condition' => [
'eael_ticker_type' => $ticker_options['conditions'],
],
]
);
$this->add_control(
'eael_ticker_tag_text',
[
'label' => esc_html__('Tag Text', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => false,
'default' => esc_html__('Trending Today', 'essential-addons-for-elementor-lite'),
'ai' => [
'active' => false,
],
]
);
$this->end_controls_section();
/**
* Query Controls
* @source includes/helper.php
*/
do_action('eael/controls/query', $this);
do_action('eael_ticker_custom_content_controls', $this);
/**
* Content Tab: Carousel Settings
*/
$this->start_controls_section(
'section_additional_options',
[
'label' => __('Animation Settings', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'carousel_effect',
[
'label' => __('Effect', 'essential-addons-for-elementor-lite'),
'description' => __('Sets transition effect', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'slide',
'options' => [
'slide' => __('Slide', 'essential-addons-for-elementor-lite'),
'fade' => __('Fade', 'essential-addons-for-elementor-lite'),
],
]
);
$this->add_control(
'slider_speed',
[
'label' => __('Slider Speed', 'essential-addons-for-elementor-lite'),
'description' => __('Duration of transition between slides (in ms)', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => ['size' => 400],
'range' => [
'px' => [
'min' => 100,
'max' => 3000,
'step' => 1,
],
],
'size_units' => '',
'separator' => 'before',
]
);
$this->add_control(
'autoplay',
[
'label' => __('Autoplay', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'separator' => 'before',
]
);
$this->add_control(
'autoplay_speed',
[
'label' => __('Autoplay Speed', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => ['size' => 2000],
'range' => [
'px' => [
'min' => 500,
'max' => 5000,
'step' => 1,
],
],
'size_units' => '',
'condition' => [
'autoplay' => 'yes',
],
]
);
$this->add_control(
'pause_on_hover',
[
'label' => __('Pause On Hover', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'condition' => [
'autoplay' => 'yes',
],
]
);
$this->add_control(
'infinite_loop',
[
'label' => __('Infinite Loop', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
]
);
$this->add_control(
'grab_cursor',
[
'label' => __('Grab Cursor', 'essential-addons-for-elementor-lite'),
'description' => __('Shows grab cursor when you hover over the slider', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => __('Show', 'essential-addons-for-elementor-lite'),
'label_off' => __('Hide', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'separator' => 'before',
]
);
$this->add_control(
'navigation_heading',
[
'label' => __('Navigation', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'arrows',
[
'label' => __('Arrows', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
]
);
$this->add_control(
'direction',
[
'label' => __('Direction', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'left',
'options' => [
'left' => __('Left', 'essential-addons-for-elementor-lite'),
'right' => __('Right', 'essential-addons-for-elementor-lite'),
],
'separator' => 'before',
'condition' => [
'carousel_effect' => 'slide',
],
]
);
$this->end_controls_section();
if (!apply_filters('eael/pro_enabled', false)) {
$this->start_controls_section(
'eael_section_pro',
[
'label' => __('Go Premium for More Features', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_control_get_pro',
[
'label' => __('Unlock more possibilities', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'1' => [
'title' => '',
'icon' => 'fa fa-unlock-alt',
],
],
'default' => '1',
'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>',
]
);
$this->end_controls_section();
}
/**
* -------------------------------------------
* Tab Style (Ticker Content Style)
* -------------------------------------------
*/
$this->start_controls_section(
'eael_section_ticker_typography_settings',
[
'label' => esc_html__('Ticker Content', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_ticker_content_bg',
[
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .eael-ticker' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_ticker_content_color',
[
'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#222222',
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content a' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_ticker_hover_content_color',
[
'label' => esc_html__('Text Hover Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#f44336',
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content a:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_ticker_content_typography',
'selector' => '{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content a',
]
);
$this->add_responsive_control(
'eael_ticker_content_padding',
[
'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_ticker_content_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .eael-ticker' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_ticker_tag_style_settings',
[
'label' => esc_html__('Tag Style', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_ticker_tag_bg_color',
[
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#222222',
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_ticker_tag_color',
[
'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .ticker-badge span' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_ticker_tag_typography',
'selector' => '{{WRAPPER}} .eael-ticker-wrap .ticker-badge span',
]
);
$this->add_responsive_control(
'eael_ticker_tag_padding',
[
'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_ticker_tag_margin',
[
'label' => esc_html__('Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_ticker_tag_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
/**
* Style Tab: Arrows
*/
$this->start_controls_section(
'section_arrows_style',
[
'label' => __('Arrows', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'arrows' => 'yes',
],
]
);
$this->add_control(
'prev_arrow',
[
'label' => __('Choose Prev Arrow', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'default' => [
'value' => 'fas fa-angle-left',
'library' => 'fa-solid',
],
]
);
$this->add_control(
'arrow_new',
[
'label' => __('Choose Next Arrow', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'arrow',
'label_block' => true,
'default' => [
'value' => 'fas fa-angle-right',
'library' => 'fa-solid',
],
]
);
$this->add_responsive_control(
'arrows_size',
[
'label' => __('Arrows Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => ['size' => '22'],
'range' => [
'px' => [
'min' => 5,
'max' => 100,
'step' => 1,
],
],
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-ticker .swiper-button-next img, {{WRAPPER}} .eael-ticker .swiper-button-prev img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-ticker .swiper-button-next svg, {{WRAPPER}} .eael-ticker .swiper-button-prev svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'left_arrow_position',
[
'label' => __('Align Left Arrow', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => -100,
'max' => 100,
'step' => 1,
],
],
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-prev' => 'right: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'right_arrow_position',
[
'label' => __('Align Right Arrow', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => -100,
'max' => 100,
'step' => 1,
],
],
'size_units' => ['px'],
'default' => [
'unit' => 'px',
'size' => 0,
],
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next' => 'right: {{SIZE}}{{UNIT}};',
],
]
);
$this->start_controls_tabs('tabs_arrows_style');
$this->start_controls_tab(
'tab_arrows_normal',
[
'label' => __('Normal', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'arrows_bg_color_normal',
[
'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'arrows_color_normal',
[
'label' => __('Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-ticker .swiper-button-next svg, {{WRAPPER}} .eael-ticker .swiper-button-prev svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'arrows_border_normal',
'label' => __('Border', 'essential-addons-for-elementor-lite'),
'placeholder' => '1px',
'default' => '1px',
'selector' => '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev',
]
);
$this->add_control(
'arrows_border_radius_normal',
[
'label' => __('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_arrows_hover',
[
'label' => __('Hover', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'arrows_bg_color_hover',
[
'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next:hover, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'arrows_color_hover',
[
'label' => __('Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next:hover, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-ticker .swiper-button-next:hover svg, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'arrows_border_color_hover',
[
'label' => __('Border Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next:hover, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover' => 'border-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_responsive_control(
'arrows_padding',
[
'label' => __('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->end_controls_section();
}
protected function render()
{
$settings = $this->get_settings_for_display();
$settings = Helper::fix_old_query($settings);
$args = Helper::get_query_args($settings);
$this->add_render_attribute('content-ticker-wrap', 'class', 'eael-ticker');
$this->add_render_attribute('content-ticker', 'class', 'swiper' );
$this->add_render_attribute('content-ticker', 'class', 'swiper-8' );
$this->add_render_attribute('content-ticker', 'class', 'eael-content-ticker');
$this->add_render_attribute('content-ticker', 'class', 'swiper-container-' . esc_attr($this->get_id()));
$this->add_render_attribute('content-ticker', 'data-pagination', '.swiper-pagination-' . esc_attr($this->get_id()));
$this->add_render_attribute('content-ticker', 'data-arrow-next', '.swiper-button-next-' . esc_attr($this->get_id()));
$this->add_render_attribute('content-ticker', 'data-arrow-prev', '.swiper-button-prev-' . esc_attr($this->get_id()));
if ($settings['direction'] == 'right') {
$this->add_render_attribute('content-ticker', 'dir', 'rtl');
}
if (!empty($settings['margin_tablet']['size'])) {
$this->add_render_attribute('content-ticker', 'data-margin-tablet', $settings['margin_tablet']['size']);
}
if (!empty($settings['margin_mobile']['size'])) {
$this->add_render_attribute('content-ticker', 'data-margin-mobile', $settings['margin_mobile']['size']);
}
if ($settings['carousel_effect']) {
$this->add_render_attribute('content-ticker', 'data-effect', $settings['carousel_effect']);
}
if (!empty($settings['slider_speed']['size'])) {
$this->add_render_attribute('content-ticker', 'data-speed', $settings['slider_speed']['size']);
}
if ($settings['autoplay'] == 'yes' && !empty($settings['autoplay_speed']['size'])) {
$this->add_render_attribute('content-ticker', 'data-autoplay', $settings['autoplay_speed']['size']);
} else {
$this->add_render_attribute('content-ticker', 'data-autoplay', '999999');
}
if ($settings['pause_on_hover'] == 'yes') {
$this->add_render_attribute('content-ticker', 'data-pause-on-hover', 'true');
}
if ($settings['infinite_loop'] == 'yes') {
$this->add_render_attribute('content-ticker', 'data-loop', true);
}
if ($settings['grab_cursor'] == 'yes') {
$this->add_render_attribute('content-ticker', 'data-grab-cursor', true);
}
if ($settings['arrows'] == 'yes') {
$this->add_render_attribute('content-ticker', 'data-arrows', '1');
}
echo '<div class="eael-ticker-wrap" id="eael-ticker-wrap-' . esc_attr( $this->get_id() ) . '">';
if (!empty($settings['eael_ticker_tag_text'])) {
echo '<div class="ticker-badge">
<span>' . wp_kses( $settings['eael_ticker_tag_text'], Helper::eael_allowed_tags() ) . '</span>
</div>';
}
echo '<div '; $this->print_render_attribute_string('content-ticker-wrap'); echo '>
<div '; $this->print_render_attribute_string('content-ticker'); echo '>
<div class="swiper-wrapper">';
if ('dynamic' === $settings['eael_ticker_type']) {
if (\file_exists($this->get_template($settings['eael_dynamic_template_Layout']))) {
if ( $args['post_type'] === 'tribe_events' ) {
$this->eael_forcefully_remove_action( 'pre_get_posts', 'attach_monitor', 200 );
}
$query = new \WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
include $this->get_template($settings['eael_dynamic_template_Layout']);
}
wp_reset_postdata();
}
} else {
echo '<div class="swiper-slide"><a href="#" class="ticker-content">' . esc_html__('No content found!', 'essential-addons-for-elementor-lite') . '</a></div>';
}
} elseif ('custom' === $settings['eael_ticker_type'] && apply_filters('eael/is_plugin_active', 'essential-addons-elementor/essential_adons_elementor.php')) {
if (\file_exists($this->get_template($settings['eael_dynamic_template_Layout']))) {
foreach ($settings['eael_ticker_custom_contents'] as $content) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Helper::include_with_variable( $this->get_template( $settings['eael_dynamic_template_Layout']), ['content' => Helper::eael_wp_kses($content['eael_ticker_custom_content']), 'link' => $content['eael_ticker_custom_content_link']]);
}
}
}
echo '</div>
</div> ';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->render_arrows();
echo '</div>
</div>';
}
/**
* Render Content Ticker arrows output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @access protected
*/
protected function render_arrows()
{
$settings = $this->get_settings_for_display();
if ($settings['arrows'] == 'yes') {
if (isset($settings['__fa4_migrated']['arrow_new']) || empty($settings['arrow'])) {
$arrow = Helper::get_render_icon( $settings['arrow_new'] );
} else {
$arrow = '<i class="' . esc_attr( $settings['arrow'] ) . '"></i>';
}
$html = '<div class="content-ticker-pagination">';
$html .= '<div class="swiper-button-next swiper-button-next-' . esc_attr( $this->get_id() ) . '">';
if (isset($arrow['url'])) {
$html .= '<img src="' . esc_url($arrow['url']) . '" alt="' . esc_attr(get_post_meta($arrow['id'], '_wp_attachment_image_alt', true)) . '" />';
} else {
$html .= $arrow;
}
$html .= '</div>';
$html .= '<div class="swiper-button-prev swiper-button-prev-' . esc_attr( $this->get_id() ) . '">';
if (isset($settings['prev_arrow']['value']['url'])) {
$html .= '<img src="' . esc_url($settings['prev_arrow']['value']['url']) . '" alt="' . esc_attr(get_post_meta($settings['prev_arrow']['value']['id'], '_wp_attachment_image_alt', true)) . '" />';
} else {
$html .= Helper::get_render_icon( $settings['prev_arrow'] );
}
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}
@@ -0,0 +1,75 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Widget_Base;
class EmbedPress extends Widget_Base {
public function get_name() {
return 'eael-embedpress';
}
public function get_title() {
return esc_html__( 'EmbedPress', 'essential-addons-for-elementor-lite');
}
public function get_icon() {
return 'eaicon-embedpress';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords() {
return [
'embedpress',
'ea embedpress',
'audio',
'video',
'map',
'youtube',
'vimeo',
'wistia',
'google',
'ea',
'essential addons'
];
}
public function get_custom_help_url() {
return 'https://embedpress.com/documentation';
}
protected function register_controls() {
$this->start_controls_section(
'eael_global_warning',
[
'label' => __('Warning!', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('<strong>EmbedPress</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=embedpress&tab=search&type=term" target="_blank">EmbedPress</a> first.',
'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
]
);
$this->end_controls_section();
}
protected function render() {
return;
}
}
@@ -0,0 +1,675 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Typography;
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use \Elementor\Widget_Base;
use \Elementor\Repeater;
use Essential_Addons_Elementor\Classes\Helper as HelperClass;
class Fancy_Text extends Widget_Base {
public function get_name() {
return 'eael-fancy-text';
}
public function get_title() {
return esc_html__( 'Fancy Text', 'essential-addons-for-elementor-lite');
}
public function get_icon() {
return 'eaicon-fancy-text';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords() {
return [
'ea fancy text',
'ea typing text',
'animated headline',
'Headline',
'typewriter',
'text effect',
'text typing effect',
'text animation',
'animated heading',
'ea',
'essential addons'
];
}
public function get_style_depends() {
return [
'e-animations',
];
}
protected function is_dynamic_content():bool {
return false;
}
public function has_widget_inner_wrapper(): bool {
return ! HelperClass::eael_e_optimized_markup();
}
public function get_custom_help_url() {
return 'https://essential-addons.com/elementor/docs/fancy-text/';
}
protected function register_controls() {
// Content Controls
$this->start_controls_section(
'eael_fancy_text_content',
[
'label' => esc_html__( 'Fancy Text', 'essential-addons-for-elementor-lite')
]
);
$this->add_control(
'eael_fancy_text_prefix',
[
'label' => esc_html__( 'Prefix Text', 'essential-addons-for-elementor-lite'),
'placeholder' => esc_html__( 'Place your prefix text', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'This is the ', 'essential-addons-for-elementor-lite'),
'dynamic' => [ 'active' => true ],
'ai' => [
'active' => false,
],
]
);
$repeater = new Repeater();
$repeater->add_control(
'eael_fancy_text_strings_text_field',
[
'label' => esc_html__( 'Fancy String', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'dynamic' => [ 'active' => true ],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eael_fancy_text_strings',
[
'label' => __( 'Fancy Text Strings', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::REPEATER,
'show_label' => true,
'fields' => $repeater->get_controls(),
'title_field' => '{{ eael_fancy_text_strings_text_field }}',
'default' => [
[
'eael_fancy_text_strings_text_field' => __( 'First string', 'essential-addons-for-elementor-lite'),
],
[
'eael_fancy_text_strings_text_field' => __( 'Second string', 'essential-addons-for-elementor-lite'),
],
[
'eael_fancy_text_strings_text_field' => __( 'Third string', 'essential-addons-for-elementor-lite'),
]
],
]
);
$this->add_control(
'eael_fancy_text_suffix',
[
'label' => esc_html__( 'Suffix Text', 'essential-addons-for-elementor-lite'),
'placeholder' => esc_html__( 'Place your suffix text', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( ' of the sentence.', 'essential-addons-for-elementor-lite'),
'dynamic' => [ 'active' => true ],
'ai' => [
'active' => false,
],
]
);
$this->end_controls_section();
// Settings Control
$this->start_controls_section(
'eael_fancy_text_settings',
[
'label' => esc_html__( 'Fancy Text Settings', 'essential-addons-for-elementor-lite')
]
);
$style_options = apply_filters(
'fancy_text_style_types',
[
'styles' => [
'style-1' => esc_html__( 'Style 1', 'essential-addons-for-elementor-lite'),
'style-2' => esc_html__( 'Style 2 (Pro)', 'essential-addons-for-elementor-lite'),
],
'conditions' => ['style-2']
]
);
$this->add_control(
'eael_fancy_text_style',
[
'label' => esc_html__( 'Style Type', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'style-1',
'options' => $style_options['styles']
]
);
$this->add_control(
'eael_fancy_text_style_pro_alert',
[
'label' => esc_html__( 'Only available in pro version!', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'condition' => [
'eael_fancy_text_style' => $style_options['conditions'],
]
]
);
$this->add_responsive_control(
'eael_fancy_text_alignment',
[
'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-container' => 'text-align: {{VALUE}}',
],
]
);
$this->add_control(
'eael_fancy_text_transition_type',
[
'label' => esc_html__( 'Animation Type', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'typing',
'options' => [
'typing' => esc_html__( 'Typing', 'essential-addons-for-elementor-lite'),
'fadeIn' => esc_html__( 'Fade', 'essential-addons-for-elementor-lite'),
'fadeInUp' => esc_html__( 'Fade Up', 'essential-addons-for-elementor-lite'),
'fadeInDown' => esc_html__( 'Fade Down', 'essential-addons-for-elementor-lite'),
'fadeInLeft' => esc_html__( 'Fade Left', 'essential-addons-for-elementor-lite'),
'fadeInRight' => esc_html__( 'Fade Right', 'essential-addons-for-elementor-lite'),
'zoomIn' => esc_html__( 'Zoom', 'essential-addons-for-elementor-lite'),
'bounceIn' => esc_html__( 'Bounce', 'essential-addons-for-elementor-lite'),
'swing' => esc_html__( 'Swing', 'essential-addons-for-elementor-lite'),
],
]
);
$this->add_control(
'eael_fancy_text_animation_start_on',
[
'label' => esc_html__( 'Animation Starts', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'options' => [
'page_load' => esc_html__( 'On Page Load', 'essential-addons-for-elementor-lite'),
'view_port' => esc_html__( 'When in View Port', 'essential-addons-for-elementor-lite'),
],
'default' => 'page_load',
]
);
$this->add_control(
'eael_fancy_text_speed',
[
'label' => esc_html__( 'Typing Speed', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::NUMBER,
'default' => '50',
'condition' => [
'eael_fancy_text_transition_type' => 'typing',
],
]
);
$this->add_control(
'eael_fancy_text_delay',
[
'label' => esc_html__( 'Delay on Change', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::NUMBER,
'default' => '2500'
]
);
$this->add_control(
'eael_fancy_text_loop',
[
'label' => esc_html__( 'Loop the animation', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
'default' => 'yes'
]
);
$this->add_control(
'eael_fancy_text_cursor',
[
'label' => esc_html__( 'Display Type Cursor', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
'default' => 'yes',
'condition' => [
'eael_fancy_text_transition_type' => 'typing',
],
]
);
$this->end_controls_section();
if(!apply_filters('eael/pro_enabled', false)) {
$this->start_controls_section(
'eael_section_pro',
[
'label' => __( 'Go Premium for More Features', 'essential-addons-for-elementor-lite')
]
);
$this->add_control(
'eael_control_get_pro',
[
'label' => __( 'Unlock more possibilities', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'1' => [
'title' => '',
'icon' => 'fa fa-unlock-alt',
],
],
'default' => '1',
'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>'
]
);
$this->end_controls_section();
}
$this->start_controls_section(
'eael_fancy_text_prefix_styles',
[
'label' => esc_html__( 'Prefix Text Styles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE
]
);
$this->add_control(
'eael_fancy_text_prefix_color',
[
'label' => esc_html__( 'Prefix Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-prefix' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'typography',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_PRIMARY
],
'fields_options' => [
'typography' => ['default' => 'yes'],
'font_size' => ['default' => ['size' => 22]],
'font_weight' => ['default' => 600],
'line_height' => ['default' => ['size' => 1]],
],
'selector' => '{{WRAPPER}} .eael-fancy-text-prefix',
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_fancy_text_strings_styles',
[
'label' => esc_html__( 'Fancy Text Styles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE
]
);
$this->add_control(
'eael_fancy_text_color_selector',
[
'label' => esc_html__('Choose Background Type', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'solid-color' => [
'title' => __('Color', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-paint-brush',
],
'gradient-color' => [
'title' => __('Gradient', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-barcode',
],
],
'toggle' => true,
'default' => 'solid-color',
'condition' => [
'eael_fancy_text_style' => 'style-1',
]
]
);
$this->add_control(
'eael_fancy_text_strings_background_color',
[
'label' => esc_html__( 'Background', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-strings' => 'background: {{VALUE}};',
],
'conditions' => [
'relation' => 'or',
'terms' => [
[
'terms' => [
[
'name' => 'eael_fancy_text_color_selector',
'operator' => '==',
'value' => 'solid-color',
],
],
],
[
'name' => 'eael_fancy_text_style',
'operator' => '==',
'value' => 'style-2',
],
],
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'eael_fancy_text_color_gradient',
'types' => ['gradient'],
'fields_options' => [
'background' => [
'label' => _x( 'Gradient Color', 'Text Shadow Control', 'essential-addons-for-elementor-lite' ),
'toggle' => false,
'default' => 'gradient',
],
'color' => [
'default' => '#062ACA',
],
'color_b' => [
'default' => '#9401D9',
]
],
'selector' => '{{WRAPPER}} .eael-fancy-text-strings',
'condition' => [
'eael_fancy_text_color_selector' => 'gradient-color',
'eael_fancy_text_style' => 'style-1',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_fancy_text_strings_typography',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_PRIMARY
],
'fields_options' => [
'typography' => ['default' => 'yes'],
'font_size' => ['default' => ['size' => 22]],
'font_weight' => ['default' => 600],
],
'selector' => '{{WRAPPER}} .eael-fancy-text-strings, {{WRAPPER}} .typed-cursor',
]
);
$this->add_control(
'eael_fancy_text_strings_color',
[
'label' => esc_html__( 'Solid Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-strings' => 'color: {{VALUE}};',
],
'conditions' => [
'relation' => 'or',
'terms' => [
[
'terms' => [
[
'name' => 'eael_fancy_text_style',
'operator' => '==',
'value' => 'style-1',
]
],
],
[
'name' => 'eael_fancy_text_style',
'operator' => '==',
'value' => 'style-2',
],
],
],
]
);
$this->add_control(
'eael_fancy_text_cursor_color',
[
'label' => esc_html__( 'Typing Cursor Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-strings::after' => 'color: {{VALUE}};',
],
'condition' => [
'eael_fancy_text_cursor' => 'yes',
],
]
);
$this->add_responsive_control(
'eael_fancy_text_strings_padding',
[
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-strings' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_fancy_text_strings_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-strings' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_fancy_text_strings_border',
'selector' => '{{WRAPPER}} .eael-fancy-text-strings',
]
);
$this->add_control(
'eael_fancy_text_strings_border_radius',
[
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-strings' => 'border-radius: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_fancy_text_suffix_styles',
[
'label' => esc_html__( 'Suffix Text Styles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE
]
);
$this->add_control(
'eael_fancy_text_suffix_color',
[
'label' => esc_html__( 'Suffix Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-fancy-text-suffix' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'ending_typography',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_PRIMARY
],
'fields_options' => [
'typography' => ['default' => 'yes'],
'font_size' => ['default' => ['size' => 22]],
'font_weight' => ['default' => 600],
'line_height' => ['default' => ['size' => 1]],
],
'selector' => '{{WRAPPER}} .eael-fancy-text-suffix',
]
);
$this->end_controls_section();
}
public function fancy_text($settings) {
$fancy_text = array("");
foreach ( $settings as $item ) {
if ( ! empty( $item['eael_fancy_text_strings_text_field'] ) ) {
$fancy_text[] = HelperClass::eael_wp_kses( html_entity_decode( $item['eael_fancy_text_strings_text_field'] ) );
}
}
$fancy_text = implode("|",$fancy_text);
return str_replace( '&', '&amp;', $fancy_text);
}
protected function render() {
$settings = $this->get_settings_for_display();
$fancy_text = $this->fancy_text($settings['eael_fancy_text_strings']);
if(!apply_filters('eael/pro_enabled', false)) { $settings['eael_fancy_text_style'] = 'style-1'; }
$this->add_render_attribute( 'fancy-text', 'class', 'eael-fancy-text-container' );
$this->add_render_attribute( 'fancy-text', 'class', esc_attr($settings['eael_fancy_text_style']) );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-id', esc_attr($this->get_id()) );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text', $fancy_text );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-transition-type', $settings['eael_fancy_text_transition_type'] );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-speed', $settings['eael_fancy_text_speed'] );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-delay', $settings['eael_fancy_text_delay'] );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-cursor', $settings['eael_fancy_text_cursor'] );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-loop', $settings['eael_fancy_text_loop'] );
$this->add_render_attribute( 'fancy-text', 'data-fancy-text-action', $settings['eael_fancy_text_animation_start_on'] );
?>
<div <?php $this->print_render_attribute_string( 'fancy-text' ); ?> >
<?php if ( ! empty( $settings['eael_fancy_text_prefix'] ) ) : ?>
<span class="eael-fancy-text-prefix"><?php echo wp_kses( $settings['eael_fancy_text_prefix'], HelperClass::eael_allowed_tags() ); ?> </span>
<?php endif; ?>
<?php if ( $settings['eael_fancy_text_transition_type'] == 'fancy' ) : ?>
<span id="eael-fancy-text-<?php echo esc_attr($this->get_id()); ?>" class="eael-fancy-text-strings
<?php echo esc_attr( $settings['eael_fancy_text_color_selector'] ) ?>"></span>
<?php endif; ?>
<?php if ( $settings['eael_fancy_text_transition_type'] != 'fancy' ) : ?>
<span id="eael-fancy-text-<?php echo esc_attr($this->get_id()); ?>" class="eael-fancy-text-strings <?php echo esc_attr( $settings['eael_fancy_text_color_selector'] ); ?>">
<noscript>
<?php
$eael_fancy_text_strings_list = "";
foreach ( $settings['eael_fancy_text_strings'] as $item ) {
$eael_fancy_text_strings_list .= $item['eael_fancy_text_strings_text_field'] . ', ';
}
echo wp_kses( rtrim($eael_fancy_text_strings_list, ", "), HelperClass::eael_allowed_tags() );
?>
</noscript>
</span>
<?php endif; ?>
<?php if ( ! empty( $settings['eael_fancy_text_suffix'] ) ) : ?>
<span class="eael-fancy-text-suffix"> <?php echo wp_kses( $settings['eael_fancy_text_suffix'], HelperClass::eael_allowed_tags() ); ?></span>
<?php endif; ?>
</div><!-- close .eael-fancy-text-container -->
<div class="clearfix"></div>
<?php
}
}
@@ -0,0 +1,805 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Typography;
use \Elementor\Widget_Base;
use \Essential_Addons_Elementor\Classes\Helper as HelperClass;
use Essential_Addons_Elementor\Traits\Helper;
class Post_Timeline extends Widget_Base
{
use Helper;
protected $page_id;
public function get_name()
{
return 'eael-post-timeline';
}
public function get_title()
{
return __('Post Timeline', 'essential-addons-for-elementor-lite');
}
public function get_icon()
{
return 'eaicon-post-timeline';
}
public function get_categories()
{
return ['essential-addons-for-elementor-lite'];
}
public function get_keywords()
{
return [
'post',
'posts',
'timeline',
'ea post timeline',
'ea posts timeline',
'blog posts',
'content marketing',
'blogger',
'ea',
'essential addons',
];
}
public function has_widget_inner_wrapper(): bool {
return ! HelperClass::eael_e_optimized_markup();
}
public function get_custom_help_url()
{
return 'https://essential-addons.com/elementor/docs/post-timeline/';
}
protected function register_controls()
{
/**
* Query And Layout Controls!
* @source includes/elementor-helper.php
*/
do_action('eael/controls/query', $this);
do_action('eael/controls/layout', $this);
$this->start_controls_section(
'section_post_timeline_links',
[
'label' => __('Links', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'timeline_link_nofollow',
[
'label' => __('No Follow', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'true',
]
);
$this->add_control(
'timeline_link_target_blank',
[
'label' => __('Target Blank', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
'return_value' => 'true',
]
);
$this->end_controls_section();
if (!apply_filters('eael/pro_enabled', false)) {
HelperClass::go_premium($this);
}
$this->start_controls_section(
'eael_section_post_timeline_style',
[
'label' => __('Timeline Style', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_timeline_display_overlay',
[
'label' => __('Show Overlay', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_on' => __('Show', 'essential-addons-for-elementor-lite'),
'label_off' => __('Hide', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'default' => 'yes',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-image' => 'opacity: .6',
],
'condition'=> [
'eael_dynamic_template_Layout!' => 'card',
]
]
);
$this->add_control(
'eael_timeline_overlay_color',
[
'label' => __('Overlay Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'description' => __('Leave blank or Clear to use default gradient overlay', 'essential-addons-for-elementor-lite'),
'default' => 'linear-gradient(45deg, #3f3f46 0%, #05abe0 100%) repeat scroll 0 0 rgba(0, 0, 0, 0)',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-inner' => 'background: {{VALUE}}',
],
'condition' => [
'eael_timeline_display_overlay' => 'yes',
'eael_dynamic_template_Layout!' => 'card',
],
]
);
$this->add_control(
'eael_timeline_bg_color',
[
'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#3DB1C0',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-inner' => 'background: {{VALUE}}',
],
'condition' => [
'eael_dynamic_template_Layout' => 'card',
],
]
);
$this->add_responsive_control(
'eael_post_grid_spacing',
[
'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%', 'em'],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'eael_dynamic_template_Layout' => 'card',
],
]
);
$this->add_control(
'eael_post_timeline_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-inner' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
'condition' => [
'eael_dynamic_template_Layout' => 'card',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_post_timeline_box_shadow',
'selector' => '{{WRAPPER}} .eael-timeline-post-inner',
'condition' => [
'eael_dynamic_template_Layout' => 'card',
],
]
);
$this->add_control(
'eael_post_timeline_content_heading',
[
'label' => esc_html__('Content', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'condition' => [
'eael_dynamic_template_Layout' => 'card',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'eael_post_timeline_content_spacing',
[
'label' => esc_html__('Spacing', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%', 'em'],
'selectors' => [
'{{WRAPPER}} .eael-timeline-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'eael_dynamic_template_Layout' => 'card',
],
]
);
$this->add_control(
'eael_post_timeline_image_heading',
[
'label' => esc_html__('Image', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'eael_dynamic_template_Layout!' => 'default',
],
]
);
$this->add_responsive_control(
'eael_timeline_image_height',
[
'label' => esc_html__('Height', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 500,
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-image' => 'height: {{SIZE}}PX;',
],
'condition' => [
'eael_dynamic_template_Layout!' => 'default',
],
]
);
$this->add_control(
'eael_timeline_img_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'eael_dynamic_template_Layout!' => 'default',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_typography',
[
'label' => __('Typography', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_timeline_title_style',
[
'label' => __('Title', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'eael_timeline_title_color',
[
'label' => __('Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-title .eael-timeline-post-title-text' => 'color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eael_timeline_title_alignment',
[
'label' => __('Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __('Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __('Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __('Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-title .eael-timeline-post-title-text' => 'text-align: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_timeline_title_typography',
'label' => __('Typography', 'essential-addons-for-elementor-lite'),
'global' => [
'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
],
'selector' => '{{WRAPPER}} .eael-timeline-post-title .eael-timeline-post-title-text',
]
);
$this->add_control(
'eael_timeline_excerpt_style',
[
'label' => __('Excerpt', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'eael_timeline_excerpt_color',
[
'label' => __('Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-excerpt p' => 'color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eael_timeline_excerpt_alignment',
[
'label' => __('Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __('Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __('Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __('Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => __('Justified', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-justify',
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-excerpt p' => 'text-align: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_timeline_excerpt_typography',
'label' => __('Typography', 'essential-addons-for-elementor-lite'),
'global' => [
'default' => Global_Typography::TYPOGRAPHY_TEXT,
],
'selector' => '{{WRAPPER}} .eael-timeline-post-excerpt p',
]
);
$this->end_controls_section();
// Start Arrow Styling
$this->start_controls_section(
'eael_section_arrow',
[
'label' => __('Arrow', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_timeline_border_color',
[
'label' => __('Border & Arrow Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#e5eaed',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-inner' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .eael-timeline-post-inner::after' => 'border-left-color: {{VALUE}};',
'{{WRAPPER}} .eael-timeline-post:nth-child(2n) .eael-timeline-post-inner::after' => 'border-right-color: {{VALUE}};',
],
'condition' => [
'eael_dynamic_template_Layout' => 'default',
],
]
);
$this->add_control(
'eael_timeline_arrow_color',
[
'label' => __('Arrow Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#3DB1C0',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post-inner' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .eael-timeline-post-inner::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}}',
// '{{WRAPPER}} .eael-timeline-post:nth-child(2n) .eael-timeline-post-inner::after' => 'border-right-color: {{VALUE}};',
],
'condition' => [
'eael_dynamic_template_Layout!' => 'default',
],
]
);
$this->add_responsive_control(
'eael_timeline_arrow_size',
[
'label' => esc_html__('Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 20,
],
],
'selectors' => [
'{{WRAPPER}} .eael-post-timeline.timeline-layout-card .eael-timeline-post-inner:after' => 'border-width: {{SIZE}}px; right: -{{SIZE}}px; left: -{{SIZE}}px',
'{{WRAPPER}} .eael-post-timeline.timeline-layout-card .eael-timeline-post:nth-child(2n) .eael-timeline-post-inner:after' => 'left: -{{SIZE}}px;',
],
'condition' => [
'eael_dynamic_template_Layout!' => 'default',
],
]
);
$this->add_control(
'eael_timeline_arrow_alignment',
[
'label' => __('Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'top' => [
'title' => __( 'Top', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-v-align-top',
],
'middle' => [
'title' => __( 'Middle', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-v-align-middle',
],
'bottom' => [
'title' => __( 'Bottom', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-v-align-bottom',
],
],
'default' => 'top',
'condition' => [
'eael_dynamic_template_Layout!' => 'default',
],
]
);
$this->end_controls_section();
// Start Time Styling
$this->start_controls_section(
'eael_section_time',
[
'label' => __('Time', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_timeline_date_background_color',
[
'label' => __('Date Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => 'rgba(0, 0, 0, 0.7)',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post time' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .eael-timeline-post time::before' => 'border-bottom-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_timeline_date_color',
[
'label' => __('Date Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post time' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_timeline_time_typography',
'label' => __('Typography', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} time',
]
);
$this->add_control(
'eael_timeline_time_padding',
[
'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} time' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_timeline_time_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} time' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_line',
[
'label' => __('Line & Bullet', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_section_post_timeline_line_heading',
[
'label' => __('Line', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'eael_section_post_timeline_line_size',
[
'label' => __('Line Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 20,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post:after' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_section_post_timeline_line_position_from_right',
[
'label' => __('Line Position From Right', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 20,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post:after' => 'right: -{{SIZE}}{{UNIT}};',
],
'condition'=> [
'eael_dynamic_template_Layout!' => 'card',
]
]
);
$this->add_control(
'eael_section_post_timeline_bullet_size',
[
'label' => __('Bullet Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-bullet' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_section_post_timeline_bullet_position_from_left',
[
'label' => __('Left-sided Bullet Positon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-bullet' => 'right: -{{SIZE}}{{UNIT}};',
],
'condition'=> [
'eael_dynamic_template_Layout!' => 'card',
]
]
);
$this->add_control(
'eael_section_post_timeline_bullet_position_from_right',
[
'label' => __('Right-sided Bullet Position', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .eael-timeline-post:nth-child(2n) .eael-timeline-bullet' => 'left: -{{SIZE}}{{UNIT}};',
],
'condition'=> [
'eael_dynamic_template_Layout!' => 'card',
]
]
);
$this->add_control(
'eael_timeline_bullet_color',
[
'label' => __('Timeline Bullet Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#9fa9af',
'selectors' => [
'{{WRAPPER}} .eael-timeline-bullet' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_timeline_bullet_border_color',
[
'label' => __('Timeline Bullet Border Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .eael-timeline-bullet' => 'border-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_timeline_vertical_line_color',
[
'label' => __('Timeline Vertical Line Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => 'rgba(83, 85, 86, .2)',
'selectors' => [
'{{WRAPPER}} .eael-timeline-post:after' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
do_action('eael/controls/load_more_button_style', $this);
}
protected function render()
{
$settings = $this->get_settings_for_display();
$settings = HelperClass::fix_old_query($settings);
$args = HelperClass::get_query_args($settings);
$args = HelperClass::get_dynamic_args($settings, $args);
$settings ['expanison_indicator'] = $settings['excerpt_expanison_indicator'];
$this->add_render_attribute(
'eael_post_timeline_wrapper',
[
'id' => "eael-post-timeline-{$this->get_id()}",
'class' => ["eael-post-timeline", "timeline-layout-{$settings['eael_dynamic_template_Layout']}", "eael-post-timeline-arrow-{$settings['eael_timeline_arrow_alignment']}"],
]
);
$this->add_render_attribute(
'eael_post_timeline',
[
'class' => ['eael-post-timeline', 'eael-post-appender', "eael-post-appender-{$this->get_id()}"],
]
);
echo '<div '; $this->print_render_attribute_string('eael_post_timeline_wrapper'); echo '>
<div '; $this->print_render_attribute_string('eael_post_timeline'); echo '>';
$template = $this->get_template($this->get_settings('eael_dynamic_template_Layout'));
$settings['loadable_file_name'] = $this->get_filename_only($template);
$dir_name = $this->get_temp_dir_name($settings['loadable_file_name']);
$found_posts = 0;
$offset = ! empty( $settings['post_offset'] ) ? intval( $settings['post_offset'] ) : 0;
if(file_exists($template)){
$query = new \WP_Query($args);
if ($query->have_posts()) {
$found_posts = $query->found_posts - $offset;
$ppp = empty( $args['posts_per_page'] ) ? get_option( 'posts_per_page' ) : $args['posts_per_page'];
$max_page = ceil( $found_posts / absint( $ppp ) );
$args['max_page'] = $max_page;
while ($query->have_posts()) {
$query->the_post();
include($template);
}
} else {
echo '<p class="no-posts-found">' . esc_html__( 'No posts found!', 'essential-addons-for-elementor-lite' ) . '</p>';
}
wp_reset_postdata();
} else {
echo '<p class="no-posts-found">' . esc_html__( 'No layout found!', 'essential-addons-for-elementor-lite' ) . '</p>';
}
echo '</div>
</div>';
if ( $found_posts > $args['posts_per_page'] ) {
$this->print_load_more_button( $settings, $args, $dir_name );
}
}
}
@@ -0,0 +1,668 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use Elementor\Icons_Manager;
use \Elementor\Widget_Base;
use \Essential_Addons_Elementor\Classes\Helper;
class SVG_Draw extends Widget_Base {
public function get_name() {
return 'eael-svg-draw';
}
public function get_title() {
return esc_html__( 'SVG Draw', 'essential-addons-for-elementor-lite' );
}
public function get_icon() {
return 'eaicon-svg-draw';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords() {
return [
'svg',
'draq',
'ea svg',
'ea svg draw',
'animation',
'icon',
'icon animation',
'svg animation',
'ea',
'essential addons',
];
}
protected function is_dynamic_content():bool {
return false;
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url() {
return 'https://essential-addons.com/elementor/docs/ea-svg-draw/';
}
protected function default_custom_svg() {
return '<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" id="Icons" viewBox="0 0 74 74" width="512" height="512">
<path d="M65,72H9a3,3,0,0,1-3-3V30a1,1,0,0,1,2,0V69a1,1,0,0,0,1,1H65a1,1,0,0,0,1-1V30a1,1,0,0,1,2,0V69A3,3,0,0,1,65,72Z"/>
<path d="M70,31H52.31a1,1,0,0,1,0-2H70V19H4V29H21.69a1,1,0,1,1,0,2H4a2,2,0,0,1-2-2V19a2,2,0,0,1,2-2H70a2,2,0,0,1,2,2V29A2,2,0,0,1,70,31Z"/>
<path d="M37,19a1,1,0,0,1-.86-1.509c2.193-3.712,7.618-12.538,10.615-14.326a8.2,8.2,0,1,1,8.4,14.078c-1.222.73-3.7,1.319-7.369,1.75a1,1,0,1,1-.233-1.986c4.439-.522,6.025-1.151,6.576-1.48A6.179,6.179,0,0,0,56.971,11.7a6.194,6.194,0,0,0-9.191-6.818c-2.126,1.269-6.517,7.871-9.918,13.626A1,1,0,0,1,37,19Z"/>
<path d="M37,19a1,1,0,0,1-.862-.491c-3.4-5.756-7.792-12.358-9.917-13.626a6.2,6.2,0,1,0-6.347,10.644c.55.329,2.136.958,6.576,1.48a1,1,0,1,1-.233,1.986c-3.667-.431-6.147-1.02-7.369-1.75a8.2,8.2,0,1,1,8.4-14.078c3,1.788,8.42,10.614,10.614,14.326A1,1,0,0,1,37,19Z"/>
<path d="M42,72H32a1,1,0,0,1-1-1V29.12a1,1,0,0,1,2,0V70h8V29.12a1,1,0,0,1,2,0V71A1,1,0,0,1,42,72Z"/>
<path d="M41.94,30H32.06a1,1,0,1,1,0-2h9.88a1,1,0,0,1,0,2Z"/>
<path d="M46.692,40.563a1,1,0,0,1-.912-.59L36.088,18.41a1,1,0,0,1,1.824-.82l8.613,19.162,1.29-4.114a1,1,0,0,1,1.365-.613l3.77,1.7-7.163-15.3a1,1,0,1,1,1.812-.848L55.906,35.32a1,1,0,0,1-1.316,1.335l-5.2-2.344-1.74,5.55a1,1,0,0,1-.895.7Z"/>
<path d="M27.308,40.563l-.06,0a1,1,0,0,1-.895-.7l-1.74-5.55-5.2,2.344a1,1,0,0,1-1.316-1.335L26.4,17.576a1,1,0,1,1,1.812.848l-7.163,15.3,3.77-1.7a1,1,0,0,1,1.365.613l1.29,4.114L36.088,17.59a1,1,0,0,1,1.824.82L28.22,39.973A1,1,0,0,1,27.308,40.563Z"/>
</svg>
';
}
protected function register_controls() {
$this->start_controls_section(
'eael_section_svg_content_settings',
[
'label' => esc_html__( 'General', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'eael_svg_src',
[
'label' => esc_html__( 'Source', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'icon',
'options' => [
'icon' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'custom' => esc_html__( 'Custom SVG', 'essential-addons-for-elementor-lite' ),
],
]
);
$this->add_control(
'eael_svg_icon',
[
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => [
'url' => EAEL_PLUGIN_URL . 'assets/admin/images/svg-draw.svg',
],
'library' => 'svg',
],
'condition' => [
'eael_svg_src' => 'icon'
]
]
);
$this->add_control(
'svg_html',
[
'label' => esc_html__( 'SVG Code', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXTAREA,
'condition' => [
'eael_svg_src' => 'custom'
],
'default' => $this->default_custom_svg(),
'description' => esc_html__( 'SVG draw works best on path elements.', 'essential-addons-for-elementor-lite' ),
]
);
$this->add_control(
'eael_svg_exclude_style',
[
'label' => esc_html__( 'Exclude Style', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'No', 'essential-addons-for-elementor-lite' ),
'default' => 'no',
'description' => esc_html__( 'Exclude style from SVG Source (If any).', 'essential-addons-for-elementor-lite' )
]
);
$this->add_responsive_control(
'eael_svg_width',
[
'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 1,
'max' => 500,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 200,
],
'separator' => 'before',
'selectors' => [
'{{WRAPPER}} svg' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_svg_height',
[
'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 500,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 200,
],
'selectors' => [
'{{WRAPPER}} svg' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_svg_alignment',
[
'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .eael-svg-draw-container' => 'text-align: {{VALUE}};',
],
]
);
$this->add_control(
'eael_svg_link',
[
'label' => esc_html__( 'Link', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::URL,
'placeholder' => esc_html__( 'https://your-link.com', 'essential-addons-for-elementor-lite' ),
'options' => [ 'url' ],
'label_block' => true,
'separator' => 'before'
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_svg_appearance',
[
'label' => esc_html__( 'Appearance', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'eael_svg_fill',
[
'label' => esc_html__( 'Fill Type', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ),
'always' => esc_html__( 'Always', 'essential-addons-for-elementor-lite' ),
'after' => esc_html__( 'After Draw', 'essential-addons-for-elementor-lite' ),
'before' => esc_html__( 'Before Draw', 'essential-addons-for-elementor-lite' ),
],
]
);
$this->add_control(
'eael_svg_fill_transition',
[
'label' => esc_html__( 'Fill Transition', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::NUMBER,
'default' => 1,
'min' => 0,
'description' => esc_html__( 'Duration on SVG fills (in seconds)', 'essential-addons-for-elementor-lite' )
]
);
$this->add_control(
'eael_svg_animation_on',
[
'label' => esc_html__( 'Animation', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'page-load',
'options' => [
'none' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ),
'page-load' => esc_html__( 'On Page Load', 'essential-addons-for-elementor-lite' ),
'page-scroll' => esc_html__( 'On Page Scroll', 'essential-addons-for-elementor-lite' ),
'mouse-hover' => esc_html__( 'Mouse Hover', 'essential-addons-for-elementor-lite' ),
],
'separator' => 'before'
]
);
$this->add_control(
'eael_svg_animation_type',
[
'label' => esc_html__( 'Draw Type', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ),
'power3.inOut' => esc_html__( 'Power', 'essential-addons-for-elementor-lite' ),
'power3.in' => esc_html__( 'Power In', 'essential-addons-for-elementor-lite' ),
'power3.out' => esc_html__( 'Power Out', 'essential-addons-for-elementor-lite' ),
'back.inOut(2)' => esc_html__( 'Back', 'essential-addons-for-elementor-lite' ),
'back.in(2)' => esc_html__( 'Back In', 'essential-addons-for-elementor-lite' ),
'back.out(2)' => esc_html__( 'Back Out', 'essential-addons-for-elementor-lite' ),
'bounce.inOut' => esc_html__( 'Bounce', 'essential-addons-for-elementor-lite' ),
'bounce.in' => esc_html__( 'Bounce In', 'essential-addons-for-elementor-lite' ),
'bounce.out' => esc_html__( 'Bounce Out', 'essential-addons-for-elementor-lite' ),
'elastic.inOut(1,0.4)' => esc_html__( 'Elastic', 'essential-addons-for-elementor-lite' ),
'elastic.in(1,0.4)' => esc_html__( 'Elastic In', 'essential-addons-for-elementor-lite' ),
'elastic.out(1,0.4)' => esc_html__( 'Elastic 0ut', 'essential-addons-for-elementor-lite' ),
'steps(50)' => esc_html__( 'Steps', 'essential-addons-for-elementor-lite' ),
],
'condition' => [
'eael_svg_animation_on!' => [ 'none', 'page-scroll' ],
]
]
);
$this->add_control(
'eael_show_marker',
[
'label' => esc_html__( 'Marker', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
'description' => esc_html__( 'This will help you to understand the start and end point of the animation. It will only work on Editor mode.', 'essential-addons-for-elementor-lite' ),
'condition' => [
'eael_svg_animation_on' => 'page-scroll',
],
]
);
$this->add_control(
'eael_svg_draw_start_point',
[
'label' => esc_html__( 'Drawing Start Point(%)', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'label_block' => true,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => '%',
'size' => 0,
],
'condition' => [
'eael_svg_animation_on' => 'page-scroll',
],
'description' => esc_html__( 'The point at which the drawing begins to the page bottom.', 'essential-addons-for-elementor-lite' ),
]
);
$this->add_control(
'eael_svg_draw_end_point',
[
'label' => esc_html__( 'Drawing End Point(%)', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'label_block' => true,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => '%',
'size' => 10,
],
'condition' => [
'eael_svg_animation_on' => 'page-scroll',
],
'description' => esc_html__( 'The point at which the drawing ends to page top.', 'essential-addons-for-elementor-lite' )
]
);
$this->add_control(
'eael_svg_pause_on_hover',
[
'label' => esc_html__( 'Pause on Hover Off', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'No', 'essential-addons-for-elementor-lite' ),
'default' => 'yes',
'condition' => [
'eael_svg_animation_on' => 'mouse-hover',
],
'description' => esc_html__( 'Pause SVG drawing on mouse leave', 'essential-addons-for-elementor-lite' )
]
);
$this->add_control(
'eael_svg_loop',
[
'label' => esc_html__( 'Repeat Drawing', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'No', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
'default' => 'yes',
'condition' => [
'eael_svg_animation_on!' => [ 'page-scroll', 'none' ],
]
]
);
$this->add_control(
'eael_svg_loop_delay',
[
'label' => esc_html__( 'Repeat Delay', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::NUMBER,
'min' => 0,
'step' => 0.5,
'default' => 1.5,
'condition' => [
'eael_svg_animation_on!' => [ 'page-scroll', 'none' ],
'eael_svg_loop' => 'yes'
],
]
);
$this->add_control(
'eael_svg_animation_direction',
[
'label' => esc_html__( 'Direction', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'reverse',
'options' => [
'reverse' => esc_html__( 'Reverse', 'essential-addons-for-elementor-lite' ),
'restart' => esc_html__( 'Restart', 'essential-addons-for-elementor-lite' ),
],
'condition' => [
'eael_svg_animation_on!' => [ 'page-scroll', 'none' ],
'eael_svg_loop' => 'yes'
]
]
);
$this->add_control(
'eael_svg_drawing_speed',
[
'label' => esc_html__( 'Speed', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::NUMBER,
'min' => 0.5,
'step' => 0.5,
'condition' => [
'eael_svg_animation_on!' => [ 'none', 'page-scroll' ],
],
'description' => esc_html__( 'Duration on SVG draws (in seconds)', 'essential-addons-for-elementor-lite' )
]
);
$this->add_control(
'eael_svg_stroke_dash_adjustment',
[
'label' => esc_html__( 'Path Length', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%' ],
'range' => [
'%' => [
'min' => 10,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => 100,
],
'condition' => [
'eael_svg_animation_on!' => [ 'none', 'page-scroll' ],
],
'description' => esc_html__( 'You can control how much of the shape gets drawn by specifying a percentage of its total length.', 'essential-addons-for-elementor-lite' )
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_svg_style_settings',
[
'label' => esc_html__( 'Style', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_svg_path_thickness',
[
'label' => esc_html__( 'Path Thickness', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => .1,
],
],
'default' => [
'unit' => 'px',
'size' => 1.2,
],
'selectors' => [
'{{WRAPPER}} svg path' => 'stroke-width: {{SIZE}};',
'{{WRAPPER}} svg circle' => 'stroke-width: {{SIZE}};',
'{{WRAPPER}} svg rect' => 'stroke-width: {{SIZE}};',
'{{WRAPPER}} svg polygon' => 'stroke-width: {{SIZE}};',
],
]
);
$this->add_control(
'eael_svg_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
'selectors' => [
'{{WRAPPER}} svg path' => 'stroke:{{VALUE}};',
'{{WRAPPER}} svg circle' => 'stroke:{{VALUE}};',
'{{WRAPPER}} svg rect' => 'stroke:{{VALUE}};',
'{{WRAPPER}} svg polygon' => 'stroke:{{VALUE}};',
],
'default' => '#974CF3'
]
);
$this->add_control(
'eael_svg_fill_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Fill Color', 'essential-addons-for-elementor-lite' ),
'default' => '#D8C2F3',
'condition' => [
'eael_svg_fill!' => 'none'
]
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'eael_svg_background',
'types' => [ 'classic', 'gradient' ],
'selector' => '{{WRAPPER}} .eael-svg-draw-container svg',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_svg_border',
'selector' => '{{WRAPPER}} .eael-svg-draw-container svg',
'separator' => 'before'
]
);
$this->add_control(
'eael_svg_border_radius',
[
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .eael-svg-draw-container svg' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_svg_padding',
[
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .eael-svg-draw-container svg' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_svg_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .eael-svg-draw-container svg' => 'Margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'box_shadow',
'selector' => '{{WRAPPER}} .eael-svg-draw-container svg',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$svg_html = isset( $settings['svg_html'] ) ? preg_replace( ['#<script(.*?)>(.*?)</script>#is', '#<script(.*?)>(.*?)</script#is'], '', $settings['svg_html'] ) : '';
$this->add_render_attribute( 'eael-svg-drow-wrapper', [
'class' => [
'eael-svg-draw-container',
esc_attr( $settings['eael_svg_animation_on'] ),
$settings['eael_svg_fill'] === 'before' ? 'fill-svg' : ''
],
] );
$svg_options = [
'fill_type' => $settings['eael_svg_fill'],
'fill_color' => $settings['eael_svg_fill_color'],
'start_point' => ! empty( $settings['eael_svg_draw_start_point']['size'] ) ? ( 100 - $settings['eael_svg_draw_start_point']['size'] ) . '%' : '95%',
'end_point' => ! empty( $settings['eael_svg_draw_end_point']['size'] ) ? $settings['eael_svg_draw_end_point']['size'] . '%' : '10%',
'marker' => ! empty( $settings['eael_show_marker'] ) && 'yes' === $settings['eael_show_marker'],
'loop' => $settings['eael_svg_loop'] ? esc_attr( $settings['eael_svg_loop'] ) : 'no',
'loop_delay' => $settings['eael_svg_loop_delay'] ?? 1.5,
'pause' => $settings['eael_svg_pause_on_hover'] ? esc_attr( $settings['eael_svg_pause_on_hover'] ) : 'no',
'direction' => esc_attr( $settings['eael_svg_animation_direction'] ),
'excludeStyle' => esc_attr( $settings['eael_svg_exclude_style'] ),
'transition' => esc_attr( $settings['eael_svg_fill_transition'] ),
'stroke_length' => $settings['eael_svg_stroke_dash_adjustment']['size'] ?? '100',
'ease_type' => $settings['eael_svg_animation_type'] ?? 'none'
];
if ( ! empty( $settings['eael_svg_drawing_speed'] ) ) {
$svg_options['speed'] = $settings['eael_svg_drawing_speed'];
} elseif ( isset( $settings['eael_svg_draw_speed'] ) ) {
$svg_options['speed'] = floatval( $settings['eael_svg_draw_speed'] ) * 0.05;
} else {
$svg_options['speed'] = 1;
}
$this->add_render_attribute( 'eael-svg-drow-wrapper', [
'data-settings' => wp_json_encode( $svg_options )
] );
if ( ! empty( $settings['eael_svg_link']['url'] ) ) {
$this->add_link_attributes( 'eael_svg_link', $settings['eael_svg_link'] );
echo '<a '; $this->print_render_attribute_string( 'eael_svg_link' ); echo '>';
}
echo '<div '; $this->print_render_attribute_string( 'eael-svg-drow-wrapper' ); echo '>';
if ( $settings['eael_svg_src'] === 'icon' ):
if ( $settings['eael_svg_icon']['library'] === 'svg' ) {
if ( empty( $settings['eael_svg_icon']['value']['id'] ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->default_custom_svg();
}
Icons_Manager::render_icon( $settings['eael_svg_icon'], [ 'aria-hidden' => 'true', 'class' => [ 'eael-svg-drow-wrapper' ] ] );
} else {
echo wp_kses( Helper::get_svg_by_icon( $settings['eael_svg_icon'] ), Helper::eael_allowed_icon_tags() );
}
else:
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '%s', $svg_html );
endif;
echo ' </div>';
if ( ! empty( $settings['eael_svg_link']['url'] ) ) {
echo "</a>";
}
}
}
@@ -0,0 +1,928 @@
<?php
namespace Essential_Addons_Elementor\Elements;
use Essential_Addons_Elementor\Classes\Helper;
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Modules\DynamicTags\Module as TagsModule;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Widget_Base;
class Sticky_Video extends Widget_Base
{
protected $eaelRElem = 1;
public function get_name()
{
return 'eael-sticky-video';
}
public function get_title()
{
return esc_html__('Sticky Video', 'essential-addons-for-elementor-lite');
}
public function get_icon()
{
return 'eaicon-sticky-video';
}
public function get_categories()
{
return ['essential-addons-elementor'];
}
public function get_keywords()
{
return [
'video',
'sticky',
'ea sticky video',
'ea video player',
'youtube',
'vimeo',
'mp4',
'mpg',
'ogg',
'webm',
'mov',
'avi',
'scrollable video',
'sticky control',
'video player',
'youtube content',
'ea',
'essential addons'
];
}
protected function is_dynamic_content():bool {
return false;
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url()
{
return 'https://essential-addons.com/elementor/docs/sticky-video/';
}
public function get_style_depends()
{
return [
'font-awesome-5-all',
'font-awesome-4-shim',
];
}
public function get_script_depends()
{
return [
'font-awesome-4-shim'
];
}
protected function register_controls()
{
/**
* General
*/
$this->start_controls_section(
'eaelsv_sticky_option_section',
[
'label' => __('Sticky Options', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'eaelsv_is_sticky',
[
'label' => __('Sticky', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'label_on' => __('On', 'essential-addons-for-elementor-lite'),
'label_off' => __('Off', 'essential-addons-for-elementor-lite'),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'eaelsv_sticky_position',
[
'label' => __('Position', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'options' => [
'top-left' => __('Top Left', 'essential-addons-for-elementor-lite'),
'top-right' => __('Top Right', 'essential-addons-for-elementor-lite'),
'bottom-left' => __('Bottom Left', 'essential-addons-for-elementor-lite'),
'bottom-right' => __('Bottom Right', 'essential-addons-for-elementor-lite'),
],
'default' => 'bottom-right',
'condition' => [
'eaelsv_is_sticky' => 'yes',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_video_settings',
[
'label' => esc_html__('Video', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'eael_video_source',
[
'label' => __('Source', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'youtube',
'options' => [
'youtube' => __('YouTube', 'essential-addons-for-elementor-lite'),
'vimeo' => __('Vimeo', 'essential-addons-for-elementor-lite'),
'self_hosted' => __('Self Hosted', 'essential-addons-for-elementor-lite'),
],
]
);
$this->add_control(
'eaelsv_link_youtube',
[
'label' => __('Link', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'dynamic' => ['active' => true],
'placeholder' => __('Enter your URL (YouTube)', 'essential-addons-for-elementor-lite'),
'label_block' => true,
'default' => 'https://www.youtube.com/watch?v=uuyXfUDqRZM',
'condition' => [
'eael_video_source' => 'youtube',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eaelsv_link_vimeo',
[
'label' => __('Link', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'placeholder' => __('Enter your URL (Vimeo)', 'essential-addons-for-elementor-lite'),
'label_block' => true,
'default' => 'https://vimeo.com/235215203',
'condition' => [
'eael_video_source' => 'vimeo',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eaelsv_link_dailymotion',
[
'label' => __('Link', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'placeholder' => __('Enter your URL (Dailymotion)', 'essential-addons-for-elementor-lite'),
'label_block' => true,
'condition' => [
'eael_video_source' => 'dailymotion',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eaelsv_link_external',
[
'label' => __('External URL', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'condition' => [
'eael_video_source' => 'self_hosted',
],
]
);
$this->add_control(
'eaelsv_hosted_url',
[
'label' => __('Choose File', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
'categories' => [
TagsModule::MEDIA_CATEGORY,
],
],
'media_type' => 'video',
'condition' => [
'eael_video_source' => 'self_hosted',
'eaelsv_link_external' => '',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eaelsv_external_url',
[
'label' => __('Link', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'placeholder' => __('Enter your URL', 'essential-addons-for-elementor-lite'),
'label_block' => true,
'show_label' => false,
'condition' => [
'eael_video_source' => 'self_hosted',
'eaelsv_link_external' => 'yes',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eael_video_self_hosted_link',
[
'label' => __('Choose File', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'condition' => [
'eael_video_source' => 'self_hosted',
'eael_video_source_external' => '',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eaelsv_start_time',
[
'label' => __('Start Time', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::NUMBER,
'min' => 0,
'max' => 10000,
'step' => 1,
'default' => '',
'description' => 'Specify a start time (in seconds)',
'condition' => [
'eael_video_source' => 'self_hosted',
],
]
);
$this->add_control(
'eaelsv_end_time',
[
'label' => __('End Time', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::NUMBER,
'min' => 0,
'max' => 10000,
'step' => 1,
'default' => '',
'description' => 'Specify an end time (in seconds)',
'condition' => [
'eael_video_source' => 'self_hosted',
],
]
);
$this->add_control(
'eael_video_video_options',
[
'label' => __('Video Options', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'eaelsv_autopaly',
[
'label' => __('Autoplay', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'return_value' => 'yes',
'default' => '',
]
);
$this->add_control(
'eaelsv_autopaly_description',
[
'raw' => __('Autoplay requires mute volume.', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
'condition' => [
'eaelsv_autopaly' => 'yes',
],
]
);
$this->add_control(
'eaelsv_mute',
[
'label' => __('Mute', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'return_value' => 'yes',
'default' => '',
'condition' => [
'eaelsv_autopaly!' => 'yes',
],
]
);
$this->add_control(
'eaelsv_loop',
[
'label' => __('Loop', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'return_value' => 'yes',
'default' => '',
]
);
$this->add_control(
'eaelsv_sh_show_bar',
[
'label' => __('Show Bar', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'default' => 'yes',
'selectors' => [
'{{WRAPPER}} .plyr__controls' => 'display: flex!important;',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_video_image_overlay_section',
[
'label' => __('Image Overlay', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'eaelsv_overlay_options',
[
'label' => __('Image Overlay', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'options' => [
'' => __('Default', 'essential-addons-for-elementor-lite'),
'yes' => __('Custom', 'essential-addons-for-elementor-lite'),
'transparent' => __('Transparent', 'essential-addons-for-elementor-lite'),
],
'default' => '',
]
);
$this->add_control(
'eaelsv_overlay_image',
[
'label' => __('Choose Image', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'condition' => [
'eaelsv_overlay_options' => 'yes',
],
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
'ai' => [
'active' => false,
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'default' => 'full',
'name' => 'eaelsv_overlay_image_size',
'condition' => [
'eaelsv_overlay_options' => 'yes',
],
]
);
$this->add_control(
'eaelsv_overlay_play_icon',
[
'label' => __('Play Icon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'label_block' => false,
'return_value' => 'yes',
'default' => 'yes',
'condition' => [
'eaelsv_overlay_options' => 'yes',
],
]
);
$this->add_control(
'eaelsv_icon_new',
[
'label' => esc_html__('Choose Icon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'eaelsv_icon',
'condition' => [
'eaelsv_overlay_options' => 'yes',
'eaelsv_overlay_play_icon' => 'yes',
],
]
);
$this->add_control( 'eaelsv_icon_new_notice', [
'type' => Controls_Manager::RAW_HTML,
'raw' => __( 'Play icon appears on top of overlay image.', 'essential-addons-for-elementor-lite' ),
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
'condition' => [
'eaelsv_overlay_options' => 'yes',
],
] );
$this->end_controls_section();
/**
* Style Tab Started
*/
$this->start_controls_section(
'eaelsv_sticky_video_interface',
[
'label' => __('Sticky Video Interface', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'eaelsv_is_sticky' => 'yes',
],
]
);
$this->add_control(
'eaelsv_sticky_width',
[
'label' => __('Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::NUMBER,
'min' => 100,
'max' => 500,
'step' => 1,
'default' => 300,
'condition' => [
'eaelsv_is_sticky' => 'yes',
],
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-player2.out' => 'width: {{VALUE}}px!important;',
],
]
);
$this->add_control(
'eaelsv_sticky_height',
[
'label' => __('Height', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::NUMBER,
'min' => 55,
'max' => 280,
'step' => 1,
'default' => 169,
'condition' => [
'eaelsv_is_sticky' => 'yes',
],
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-player2.out' => 'height: {{VALUE}}px!important;',
],
]
);
$this->add_control(
'eaelsv_scroll_height_display_sticky',
[
'label' => __('Scroll Height To Display Sticky (%)', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 50,
'max' => 200,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 70,
],
'condition' => [
'eaelsv_is_sticky' => 'yes',
],
]
);
$this->add_control(
'eaelsv_sticky_close_button_color',
[
'label' => __('Close Button Color', 'essential-addons-for-elementor-lite'),
'type' => \Elementor\Controls_Manager::COLOR,
'condition' => [
'eaelsv_is_sticky' => 'yes',
],
'selectors' => [
'{{WRAPPER}} .eaelsv-sticky-player-close' => 'color: {{VALUE}}!important',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eaelsv_sh_player_section',
[
'label' => __('Player', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'eaelsv_sh_video_width',
[
'label' => esc_html__('Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 1200,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-wrapper' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'eaelsv_sh_video_border_type',
[
'label' => __('Border Type', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => __('None', 'essential-addons-for-elementor-lite'),
'solid' => __('Solid', 'essential-addons-for-elementor-lite'),
'double' => __('Double', 'essential-addons-for-elementor-lite'),
'dotted' => __('Dotted', 'essential-addons-for-elementor-lite'),
'dashed' => __('Dashed', 'essential-addons-for-elementor-lite'),
],
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-wrapper' => 'border-style: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eaelsv_sh_video_border_width',
[
'label' => esc_html__('Border Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-wrapper' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eaelsv_sh_video_border_color',
[
'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-wrapper' => 'border-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eaelsv_sh_video_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .eael-sticky-video-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .eaelsv-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .eael-sticky-video-player2' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eaelsv_sh_player_interface_section',
[
'label' => __('Interface', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eaelsv_sh_video_interface_color',
[
'label' => esc_html__('Interface Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#ADD8E6',
'selectors' => [
'{{WRAPPER}} .plyr__control.plyr__tab-focus' => 'box-shadow: 0 0 0 5px {{VALUE}}!important',
'{{WRAPPER}} .plyr__control--overlaid' => 'background: {{VALUE}}!important',
'{{WRAPPER}} .plyr--video .plyr__control.plyr__tab-focus' => 'background: {{VALUE}}!important',
'{{WRAPPER}} .plyr__control--overlaid' => 'background: {{VALUE}}!important',
'{{WRAPPER}} .plyr--video .plyr__control:hover' => 'background: {{VALUE}}!important',
],
]
);
$this->add_responsive_control(
'eaelsv_sh_play_button_size',
[
'label' => __('Play Button Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 15,
'unit' => 'px',
],
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 15,
'max' => 55,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .plyr__control--overlaid' => 'padding: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eaelsv_sh_player_bar_section',
[
'label' => __('Bar', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'eaelsv_sh_player_bar_padding',
[
'label' => __('Bar Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 10,
'unit' => 'px',
],
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 50,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .plyr--video .plyr__controls' => 'padding: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eaelsv_sh_bar_margin',
[
'label' => esc_html__('Bar Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .plyr--video .plyr__controls' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
}
protected function render()
{
$settings = $this->get_settings_for_display();
$iconNew = $settings['eaelsv_icon_new'];
$sticky = isset( $settings['eaelsv_is_sticky'] ) ? $settings['eaelsv_is_sticky'] : 'yes';
$autoplay = ($settings['eaelsv_autopaly'] == 'yes') ? $settings['eaelsv_autopaly'] : 'no';
$eaelsvPlayer = '';
$eaelsv_overlay_visibility = $settings['eaelsv_overlay_options'];
if ('youtube' == $settings['eael_video_source']) {
$eaelsvPlayer = $this->eaelsv_load_player_youtube();
}
if ('vimeo' == $settings['eael_video_source']) {
$eaelsvPlayer = $this->eaelsv_load_player_vimeo();
}
if ('self_hosted' == $settings['eael_video_source']) {
$eaelsvPlayer = $this->eaelsv_load_player_self_hosted();
}
echo '<div class="eael-sticky-video-wrapper eaelsv-overlay-visibility-' . esc_attr( $eaelsv_overlay_visibility ) . '">';
if ('yes' === $settings['eaelsv_overlay_options']) {
// $autoplay = 'yes';
$icon = '';
if ('yes' === $settings['eaelsv_overlay_play_icon']) {
if ($iconNew['value'] != '') {
if (is_array($iconNew['value'])) {
$icon = '<img src="' . esc_url( $iconNew['value']['url'] ) . '" width="100">';
} else {
$icon = '<i class="' . esc_attr( $iconNew['value'] ) . '"></i>';
}
} else {
$icon = '<i class="eicon-play"></i>';
}
}
$overlay_class = 'eaelsv-overlay';
if( 'yes' === $settings['eaelsv_overlay_options'] && empty( $settings['eaelsv_overlay_image']['url'] ) ){
$icon = '';
$overlay_class = 'eaelsv-overlay-ignore';
}
$this->add_render_attribute(
'esvp_overlay_wrapper',
[
'class' => esc_attr( $overlay_class ),
'style' => "background-image:url('" . $settings['eaelsv_overlay_image']['url'] . "');",
]
);
echo '<div '; $this->print_render_attribute_string('esvp_overlay_wrapper'); echo '>
<div class="eaelsv-overlay-icon">' . wp_kses( $icon, Helper::eael_allowed_icon_tags() ) . '</div>
</div>';
}
$this->add_render_attribute(
'esvp_overlay_wrapper2',
[
'class' => 'eael-sticky-video-player2',
'data-sticky' => $sticky,
'data-position' => $settings['eaelsv_sticky_position'],
'data-sheight' => isset( $settings['eaelsv_sticky_height'] ) ? $settings['eaelsv_sticky_height'] : 169,
'data-swidth' => isset( $settings['eaelsv_sticky_width'] ) ? $settings['eaelsv_sticky_width'] : 300,
'data-scroll_height' => !empty($settings['eaelsv_scroll_height_display_sticky']['size']) ? $settings['eaelsv_scroll_height_display_sticky']['size'] : '',
'data-autoplay' => $autoplay,
'data-overlay' => ($settings['eaelsv_overlay_options'] == 'yes') ? $settings['eaelsv_overlay_options'] : 'no',
]
);
echo '<div '; $this->print_render_attribute_string('esvp_overlay_wrapper2'); echo '>';
//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $eaelsvPlayer . '
<span class="eaelsv-sticky-player-close"><i class="fas fa-times-circle"></i></span>
</div>
</div>';
}
protected function eaelsv_load_player_youtube()
{
$settings = $this->get_settings_for_display();
$id = $this->eaelsv_get_url_id();
$autoplay = isset( $settings['eaelsv_autopaly'] ) ? $settings['eaelsv_autopaly'] : '';
$mute = $autoplay == 'yes' ? 'yes' : ( isset( $settings['eaelsv_mute'] ) ? $settings['eaelsv_mute'] : '' );
$loop = isset( $settings['eaelsv_loop'] ) ? $settings['eaelsv_loop'] : '';
$am = '"storage": {"enabled": false, "key": "plyr"}';
$am .= ( $autoplay == 'yes' ? ', "autoplay":1' : ', "autoplay":0' );
$am .= ( $mute == 'yes' ? ', "muted":1, "volume":0' : ', "muted":0' );
if ('yes' == $loop) {
$lp = '"loop": {"active": true}';
} else {
$lp = '"loop": {"active": false}';
}
return '<div
id="eaelsv-player-' . esc_attr( $this->get_id() ) . '"
data-plyr-provider="youtube"
data-plyr-embed-id="' . esc_attr($id) . '"
data-plyr-config="{' . esc_attr($am) . ', ' . esc_attr($lp) . '}"
></div>';
}
protected function eaelsv_load_player_vimeo()
{
$settings = $this->get_settings_for_display();
$id = $this->eaelsv_get_url_id();
$autoplay = isset( $settings['eaelsv_autopaly'] ) ? $settings['eaelsv_autopaly'] : '';
$mute = $autoplay == 'yes' ? 'yes' : ( isset( $settings['eaelsv_mute'] ) ? $settings['eaelsv_mute'] : '' );
$loop = isset( $settings['eaelsv_loop'] ) ? $settings['eaelsv_loop'] : '';
$am = '"storage": {"enabled": false, "key": "plyr"}';
$am .= ( $autoplay == 'yes' ? ', "autoplay":1' : ', "autoplay":0' );
$am .= ( $mute == 'yes' ? ', "muted":1, "volume":0' : ', "muted":0' );
if ('yes' == $loop) {
$lp = '"loop": {"active": true}';
} else {
$lp = '"loop": {"active": false}';
}
return '<div
id="eaelsv-player-' . esc_attr( $this->get_id() ) . '"
data-plyr-provider="vimeo"
data-plyr-embed-id="' . esc_attr($id) . '"
data-plyr-config="{' . esc_attr($am) . ', ' . esc_attr($lp) . '}"
></div>';
}
protected function eaelsv_load_player_self_hosted()
{
$settings = $this->get_settings_for_display();
$video = ($settings['eaelsv_external_url'] != '') ? $settings['eaelsv_external_url'] : $settings['eaelsv_hosted_url']['url'];
$autoplay = isset( $settings['eaelsv_autopaly'] ) ? $settings['eaelsv_autopaly'] : '';
$mute = isset( $settings['eaelsv_mute'] ) ? $settings['eaelsv_mute'] : '';
$loop = isset( $settings['eaelsv_loop'] ) ? $settings['eaelsv_loop'] : '';
$startTime = isset( $settings['eaelsv_start_time'] ) ? $settings['eaelsv_start_time'] : '';
$endTime = isset( $settings['eaelsv_end_time'] ) ? $settings['eaelsv_end_time'] : '';
$am = '';
$am .= ($autoplay == 'yes' ? '"autoplay":1' : '"autoplay":0');
$am .= ($mute == 'yes' ? ', "muted":1' : ', "muted":0');
if ('yes' == $loop) {
$lp = '"loop": {"active": true}';
} else {
$lp = '"loop": {"active": false}';
}
return '<video class="eaelsv-player" id="eaelsv-player-' . esc_attr( $this->get_id() ) . '" playsinline controls data-plyr-config="{' . esc_attr($am) . ', ' . esc_attr($lp) . '}">
<source src="' . esc_attr($video) . '#t=' . esc_attr($startTime) . ',' . esc_attr($endTime) . '" type="video/mp4" />
</video>';
}
protected function eaelsv_get_url_id()
{
$settings = $this->get_settings_for_display();
if ( 'youtube' === $settings['eael_video_source'] ) {
$url = $settings['eaelsv_link_youtube'];
$link = explode( '=', parse_url( $url, PHP_URL_QUERY ) );
$short_link = explode( '/', $url );
$id = isset( $link[1] ) ? $link[1] : ( isset( $short_link[3] ) ? $short_link[3] : '' );
}
if ('vimeo' === $settings['eael_video_source']) {
$url = $settings['eaelsv_link_vimeo'];
$link = explode('/', $url);
$id = isset( $link[3] ) ? $link[3] : '';
}
if ('self_hosted' === $settings['eael_video_source']) {
$externalUrl = $settings['eaelsv_link_external'];
if ('yes' == $externalUrl) {
$id = $settings['eaelsv_external_url'];
} else {
$id = $settings['eaelsv_hosted_url']['url'];
}
}
return $id;
}
}
@@ -0,0 +1,775 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Typography;
use \Elementor\Utils;
use \Elementor\Widget_Base;
use \Elementor\Icons_Manager;
use \Essential_Addons_Elementor\Classes\Helper;
class Tooltip extends Widget_Base {
public function get_name() {
return 'eael-tooltip';
}
public function get_title() {
return esc_html__( 'Tooltip', 'essential-addons-for-elementor-lite');
}
public function get_icon() {
return 'eaicon-tooltip';
}
public function get_categories() {
return [ 'essential-addons-elementor' ];
}
public function get_keywords()
{
return [
'tooltip',
'ea tooltip',
'popover',
'hover',
'hint',
'floating text',
'glossary',
'ea',
'essential addons'
];
}
protected function is_dynamic_content():bool {
return false;
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url()
{
return 'https://essential-addons.com/elementor/docs/tooltip/';
}
protected function register_controls() {
/**
* Tooltip Settings
*/
$this->start_controls_section(
'eael_section_tooltip_settings',
[
'label' => esc_html__( 'Content Settings', 'essential-addons-for-elementor-lite')
]
);
$this->add_control(
'eael_tooltip_type',
[
'label' => esc_html__( 'Content Type', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'icon' => [
'title' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-info',
],
'text' => [
'title' => esc_html__( 'Text', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-text-width',
],
'image' => [
'title' => esc_html__( 'Image', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-image',
],
'shortcode' => [
'title' => esc_html__( 'Shortcode', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-code',
],
],
'default' => 'icon',
]
);
$this->add_control(
'eael_tooltip_icon_content_new',
[
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'eael_tooltip_icon_content',
'default' => [
'value' => 'fas fa-home',
'library' => 'fa-solid',
],
'condition' => [
'eael_tooltip_type' => [ 'icon' ]
]
]
);
$this->add_responsive_control(
'eael_tooltip_icon_size',
[
'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%', 'px' ],
'default' => [
'size' => 60,
],
'range' => [
'px' => [
'max' => 150,
],
'%' => [
'max' => 100
]
],
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-content i' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-content svg' => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-content .ea-tooltip-svg-trigger' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
],
'condition' => [
'eael_tooltip_type' => 'icon'
]
]
);
$this->add_control(
'eael_tooltip_content',
[
'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::WYSIWYG,
'label_block' => true,
'default' => esc_html__( 'Hover Me!', 'essential-addons-for-elementor-lite'),
'condition' => [
'eael_tooltip_type' => [ 'text' ]
],
'dynamic' => [ 'active' => true ]
]
);
$this->add_control(
'eael_tooltip_content_tag',
[
'label' => esc_html__( 'Content Tag', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'span',
'label_block' => false,
'options' => [
'h1' => esc_html__( 'H1', 'essential-addons-for-elementor-lite'),
'h2' => esc_html__( 'H2', 'essential-addons-for-elementor-lite'),
'h3' => esc_html__( 'H3', 'essential-addons-for-elementor-lite'),
'h4' => esc_html__( 'H4', 'essential-addons-for-elementor-lite'),
'h5' => esc_html__( 'H5', 'essential-addons-for-elementor-lite'),
'h6' => esc_html__( 'H6', 'essential-addons-for-elementor-lite'),
'div' => esc_html__( 'DIV', 'essential-addons-for-elementor-lite'),
'span' => esc_html__( 'SPAN', 'essential-addons-for-elementor-lite'),
'p' => esc_html__( 'P', 'essential-addons-for-elementor-lite'),
],
'condition' => [
'eael_tooltip_type' => 'text'
]
]
);
$this->add_control(
'eael_tooltip_img_content',
[
'label' => esc_html__( 'Image', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
'condition' => [
'eael_tooltip_type' => [ 'image' ]
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'eael_tooltip_shortcode_content',
[
'label' => esc_html__( 'Shortcode', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
'default' => esc_html__( '[shortcode-here]', 'essential-addons-for-elementor-lite'),
'condition' => [
'eael_tooltip_type' => [ 'shortcode' ]
]
]
);
$this->add_responsive_control(
'eael_tooltip_content_alignment',
[
'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => __( 'Justified', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-justify',
],
],
'default' => 'left',
'prefix_class' => 'eael-tooltip-align%s-',
]
);
$this->add_control(
'eael_tooltip_enable_link',
[
'label' => esc_html__( 'Enable Link', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'false',
'return_value' => 'yes',
'condition' => [
'eael_tooltip_type!' => ['shortcode']
]
]
);
$this->add_control(
'eael_tooltip_link',
[
'label' => esc_html__( 'Button Link', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::URL,
'dynamic' => ['active' => true],
'label_block' => true,
'default' => [
'url' => '#',
'is_external' => '',
],
'show_external' => true,
'condition' => [
'eael_tooltip_enable_link' => 'yes'
]
]
);
$this->end_controls_section();
/**
* Tooltip Hover Content Settings
*/
$this->start_controls_section(
'eael_section_tooltip_hover_content_settings',
[
'label' => esc_html__( 'Tooltip Settings', 'essential-addons-for-elementor-lite')
]
);
$this->add_control(
'eael_tooltip_hover_content',
[
'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::WYSIWYG,
'label_block' => true,
'default' => esc_html__( 'Tooltip content', 'essential-addons-for-elementor-lite'),
'dynamic' => [ 'active' => true ]
]
);
$this->add_control(
'eael_tooltip_hover_dir',
[
'label' => esc_html__( 'Hover Direction', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => 'right',
'label_block' => false,
'options' => [
'left' => esc_html__( 'Left', 'essential-addons-for-elementor-lite'),
'right' => esc_html__( 'Right', 'essential-addons-for-elementor-lite'),
'top' => esc_html__( 'Top', 'essential-addons-for-elementor-lite'),
'bottom' => esc_html__( 'Bottom', 'essential-addons-for-elementor-lite'),
],
]
);
$this->add_control(
'eael_tooltip_hover_speed',
[
'label' => esc_html__( 'Hover Speed', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::TEXT,
'label_block' => false,
'default' => esc_html__( '300', 'essential-addons-for-elementor-lite'),
'selectors' => [
'{{WRAPPER}} .eael-tooltip:hover .eael-tooltip-text.eael-tooltip-top' => 'animation-duration: {{SIZE}}ms;',
'{{WRAPPER}} .eael-tooltip:hover .eael-tooltip-text.eael-tooltip-left' => 'animation-duration: {{SIZE}}ms;',
'{{WRAPPER}} .eael-tooltip:hover .eael-tooltip-text.eael-tooltip-bottom' => 'animation-duration: {{SIZE}}ms;',
'{{WRAPPER}} .eael-tooltip:hover .eael-tooltip-text.eael-tooltip-right' => 'animation-duration: {{SIZE}}ms;',
],
'ai' => [
'active' => false,
],
]
);
$this->end_controls_section();
/**
* -------------------------------------------
* Tab Style Tooltip Content
* -------------------------------------------
*/
$this->start_controls_section(
'eael_section_tooltip_style_settings',
[
'label' => esc_html__( 'Content Style', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'eael_tooltip_max_width',
[
'label' => __( 'Content Max Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'size_units' => [ 'px', '%' ],
'default' => [
'unit' => 'px',
'size' => 100,
],
'selectors' => [
'{{WRAPPER}} .eael-tooltip' => 'width: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'eael_tooltip_content_padding',
[
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_tooltip_content_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_tooltip_text_alignment',
[
'label' => esc_html__( 'Content Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => __( 'Justified', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-justify',
],
],
'condition' => [
'eael_tooltip_type' => 'text'
],
'default' => 'left',
'prefix_class' => 'eael-tooltip-text-align-',
]
);
$this->start_controls_tabs( 'eael_tooltip_content_style_tabs' );
// Normal State Tab
$this->start_controls_tab( 'eael_tooltip_content_normal', [ 'label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite') ] );
$this->add_control(
'eael_tooltip_content_bg_color',
[
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-tooltip' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_tooltip_content_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-tooltip' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip a' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_tooltip_shadow',
'selector' => '{{WRAPPER}} .eael-tooltip',
'separator' => 'before'
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_tooltip_border',
'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .eael-tooltip',
]
);
$this->end_controls_tab();
// Hover State Tab
$this->start_controls_tab( 'eael_tooltip_content_hover', [ 'label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite') ] );
$this->add_control(
'eael_tooltip_content_hover_bg_color',
[
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .eael-tooltip:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_tooltip_content_hover_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#212121',
'selectors' => [
'{{WRAPPER}} .eael-tooltip:hover' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip:hover a' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip:hover svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_tooltip_hover_shadow',
'selector' => '{{WRAPPER}} .eael-tooltip:hover',
'separator' => 'before'
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_tooltip_hover_border',
'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'),
'selector' => '{{WRAPPER}} .eael-tooltip:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_tooltip_content_typography',
'selector' => '{{WRAPPER}} .eael-tooltip',
]
);
$this->add_responsive_control(
'eael_tooltip_content_radius',
[
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
if(!apply_filters('eael/pro_enabled', false)) {
$this->start_controls_section(
'eael_section_pro',
[
'label' => __( 'Go Premium for More Features', 'essential-addons-for-elementor-lite')
]
);
$this->add_control(
'eael_control_get_pro',
[
'label' => __( 'Unlock more possibilities', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'1' => [
'title' => '',
'icon' => 'fa fa-unlock-alt',
],
],
'default' => '1',
'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>'
]
);
$this->end_controls_section();
}
/**
* -------------------------------------------
* Tab Style Tooltip Hover Content
* -------------------------------------------
*/
$this->start_controls_section(
'eael_section_tooltip_hover_style_settings',
[
'label' => esc_html__( 'Tooltip Style', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'eael_tooltip_hover_width',
[
'label' => __( 'Tooltip Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => '150'
],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 5,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text' => 'width: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'eael_tooltip_hover_max_width',
[
'label' => __( 'Tooltip Max Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => '150'
],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 5,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text' => 'max-width: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'eael_tooltip_hover_content_padding',
[
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_tooltip_hover_content_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_tooltip_hover_content_bg_color',
[
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#555',
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_tooltip_hover_content_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_tooltip_hover_content_typography',
'selector' => '{{WRAPPER}} .eael-tooltip .eael-tooltip-text',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_tooltip_box_shadow',
'selector' => '{{WRAPPER}} .eael-tooltip .eael-tooltip-text',
]
);
$this->add_responsive_control(
'eael_tooltip_arrow_size',
[
'label' => __( 'Arrow Size', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 5,
'unit' => 'px',
],
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text:after' => 'border-width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-left::after' => 'top: calc( 50% - {{SIZE}}{{UNIT}} );',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-right::after' => 'top: calc( 50% - {{SIZE}}{{UNIT}} );',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-top::after' => 'left: calc( 50% - {{SIZE}}{{UNIT}} );',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-bottom::after' => 'left: calc( 50% - {{SIZE}}{{UNIT}} );',
],
]
);
$this->add_control(
'eael_tooltip_arrow_color',
[
'label' => esc_html__( 'Arrow Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'default' => '#555',
'selectors' => [
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-top:after' => 'border-top-color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-bottom:after' => 'border-bottom-color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-left:after' => 'border-left-color: {{VALUE}};',
'{{WRAPPER}} .eael-tooltip .eael-tooltip-text.eael-tooltip-right:after' => 'border-right-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
protected function render( ) {
$settings = $this->get_settings_for_display();
$icon_migrated = isset($settings['__fa4_migrated']['eael_tooltip_icon_content_new']);
$icon_is_new = empty($settings['eael_tooltip_icon_content']);
$this->add_link_attributes( 'eael_tooltip_link', (array) $settings['eael_tooltip_link'] );
// WPML Media Translation compatibility
if ( ! empty( $settings['eael_tooltip_img_content']['id'] ) ) {
$settings['eael_tooltip_img_content']['id'] = apply_filters( 'wpml_object_id', $settings['eael_tooltip_img_content']['id'], 'attachment', true );
if ( $settings['eael_tooltip_img_content']['id'] ) {
$settings['eael_tooltip_img_content']['url'] = wp_get_attachment_url( $settings['eael_tooltip_img_content']['id'] );
}
}
if ( ! empty( $settings['eael_tooltip_icon_content_new']['value']['id'] ) ) {
$settings['eael_tooltip_icon_content_new']['value']['id'] = apply_filters( 'wpml_object_id', $settings['eael_tooltip_icon_content_new']['value']['id'], 'attachment', true );
if ( $settings['eael_tooltip_icon_content_new']['value']['id'] ) {
$settings['eael_tooltip_icon_content_new']['value']['url'] = wp_get_attachment_url( $settings['eael_tooltip_icon_content_new']['value']['id'] );
}
}
?>
<div class="eael-tooltip">
<?php if( $settings['eael_tooltip_type'] === 'text' ) : ?>
<<?php echo esc_html( Helper::eael_validate_html_tag($settings['eael_tooltip_content_tag']) ); ?> class="eael-tooltip-content" tabindex="0" aria-describedby="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>"><?php if( $settings['eael_tooltip_enable_link'] === 'yes' ) : ?><a <?php $this->print_render_attribute_string( 'eael_tooltip_link' ); ?>><?php endif; ?><?php echo wp_kses_post($settings['eael_tooltip_content']); ?><?php if( $settings['eael_tooltip_enable_link'] === 'yes' ) : ?></a><?php endif; ?></<?php echo esc_html( Helper::eael_validate_html_tag($settings['eael_tooltip_content_tag']) ); ?>>
<span id="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>" class="eael-tooltip-text eael-tooltip-<?php echo esc_attr( $settings['eael_tooltip_hover_dir'] ) ?>" role="tooltip"><?php echo wp_kses( $settings['eael_tooltip_hover_content'], Helper::eael_allowed_tags() ); ?></span>
<?php elseif( $settings['eael_tooltip_type'] === 'icon' ) : ?>
<span class="eael-tooltip-content" tabindex="0" aria-describedby="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>"><?php if( $settings['eael_tooltip_enable_link'] === 'yes' ) : ?><a <?php $this->print_render_attribute_string( 'eael_tooltip_link' ); ?>><?php endif; ?>
<?php if ($icon_is_new || $icon_migrated) { ?>
<?php if( isset($settings['eael_tooltip_icon_content_new']['value']['url']) ) : ?>
<img class="ea-tooltip-svg-trigger" src="<?php echo esc_url( $settings['eael_tooltip_icon_content_new']['value']['url'] ); ?>" alt="<?php echo esc_attr(get_post_meta($settings['eael_tooltip_icon_content_new']['value']['id'], '_wp_attachment_image_alt', true)); ?>" />
<?php else :
Icons_Manager::render_icon( $settings['eael_tooltip_icon_content_new'], [ 'aria-hidden' => 'true' ] );
endif;
} else {
Icons_Manager::render_icon( $settings['eael_tooltip_icon_content'], [ 'aria-hidden' => 'true' ] );
} ?>
<?php if( $settings['eael_tooltip_enable_link'] === 'yes' ) : ?></a><?php endif; ?></span>
<span id="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>" class="eael-tooltip-text eael-tooltip-<?php echo esc_attr( $settings['eael_tooltip_hover_dir'] ) ?>" role="tooltip"><?php echo wp_kses( $settings['eael_tooltip_hover_content'], Helper::eael_allowed_tags() ); ?></span>
<?php elseif( $settings['eael_tooltip_type'] === 'image' ) : ?>
<span class="eael-tooltip-content" tabindex="0" aria-describedby="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>"><?php if( $settings['eael_tooltip_enable_link'] === 'yes' ) : ?><a <?php $this->print_render_attribute_string( 'eael_tooltip_link' ); ?>><?php endif; ?><img src="<?php echo esc_url( $settings['eael_tooltip_img_content']['url'] ); ?>" alt="<?php echo esc_attr( get_post_meta($settings['eael_tooltip_img_content']['id'], '_wp_attachment_image_alt', true) ); ?>"><?php if( $settings['eael_tooltip_enable_link'] === 'yes' ) : ?></a><?php endif; ?></span>
<span id="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>" class="eael-tooltip-text eael-tooltip-<?php echo esc_attr( $settings['eael_tooltip_hover_dir'] ) ?>" role="tooltip"><?php echo wp_kses( $settings['eael_tooltip_hover_content'], Helper::eael_allowed_tags() ); ?></span>
<?php elseif( $settings['eael_tooltip_type'] === 'shortcode' ) : ?>
<div class="eael-tooltip-content" tabindex="0" aria-describedby="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>"><?php echo do_shortcode( $settings['eael_tooltip_shortcode_content'] ); ?></div>
<span id="tooltip-text-<?php echo esc_attr( $this->get_id() ); ?>" class="eael-tooltip-text eael-tooltip-<?php echo esc_attr( $settings['eael_tooltip_hover_dir'] ) ?>" role="tooltip"><?php echo wp_kses( $settings['eael_tooltip_hover_content'], Helper::eael_allowed_tags() ); ?></span>
<?php endif; ?>
</div>
<?php
}
protected function content_template() {}
}
@@ -0,0 +1,378 @@
<?php
namespace Essential_Addons_Elementor\Elements;
use Essential_Addons_Elementor\Classes\Helper;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Widget_Base;
class TypeForm extends Widget_Base {
private $form_list = [];
public function get_name () {
return 'eael-typeform';
}
public function get_title () {
return __('Typeform', 'essential-addons-for-elementor-lite');
}
public function get_categories () {
return ['essential-addons-elementor'];
}
public function get_icon () {
return 'eaicon-typeform';
}
public function get_keywords () {
return [
'ea contact form',
'ea typeform',
'ea type form',
'ea type forms',
'contact form',
'form styler',
'elementor form',
'feedback',
'typeform',
'ea',
'essential addons'
];
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url () {
return 'https://essential-addons.com/elementor/docs/typeform/';
}
private function get_personal_token () {
return get_option('eael_save_typeform_personal_token');
}
public function get_form_list () {
$token = $this->get_personal_token();
$key = 'eael_typeform_'.md5(implode('', ['eael_type_form_data', $token]));
$form_arr = get_transient($key);
if (empty($form_arr)) {
$response = wp_remote_get(
'https://api.typeform.com/forms?page_size=200',
[
'headers' => [
'Authorization' => "Bearer $token",
]
]
);
if (is_wp_error($response)) {
return $this->form_list;
}
if (isset($response['response']['code']) && $response['response']['code'] == 200) {
$data = json_decode(wp_remote_retrieve_body($response));
if (isset($data->items)) {
$form_arr = $data->items;
set_transient($key, $form_arr, 1 * HOUR_IN_SECONDS);
}
}
}
$this->form_list[''] = __('Select Form', 'essential-addons-for-elementor-lite');
if (!empty($form_arr)) {
foreach ($form_arr as $item) {
$this->form_list[$item->_links->display] = $item->title;
}
}
return $this->form_list;
}
private function no_token_set () {
$this->start_controls_section(
'eael_global_warning',
[
'label' => __('Warning!', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('Whoops! It seems like you haven\'t connected your Typeform account. To do this, navigate to <b>WordPress Dashboard -> Essential Addons -> Elements -> Typeform</b> (<a target="_blank" href="'.esc_url(admin_url( 'admin.php?page=eael-settings')).'">Get Access</a>).',
'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
]
);
$this->end_controls_section();
}
protected function register_controls () {
if ($this->get_personal_token() == '') {
$this->no_token_set();
return;
}
$this->start_controls_section(
'section_info_box',
[
'label' => __('Typeform', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_typeform_list',
[
'label' => __('Typeform', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SELECT,
'default' => '',
'label_block' => true,
'options' => $this->get_form_list()
]
);
$this->add_control(
'eael_typeform_hideheaders',
[
'label' => __('Hide Header', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'return_value' => 'yes',
]
);
$this->add_control(
'eael_typeform_hidefooter',
[
'label' => __('Hide Footer', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'return_value' => 'yes',
]
);
$this->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Style Tab
/*-----------------------------------------------------------------------------------*/
/**
* Style Tab: Form Container
* -------------------------------------------------
*/
$this->start_controls_section(
'section_container_style',
[
'label' => __('Form Container', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_typeform_background',
[
'label' => esc_html__('Form Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-typeform' => 'background: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eael_typeform_alignment',
[
'label' => esc_html__('Form Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'default' => [
'title' => __('Default', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-ban',
],
'left' => [
'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-h-align-right',
],
],
'default' => 'default',
]
);
$this->add_responsive_control(
'eael_typeform_max_width',
[
'label' => esc_html__('Form Max Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'selectors' => [
'{{WRAPPER}} .eael-typeform' => 'width: {{SIZE}}{{UNIT}};'
],
]
);
$this->add_responsive_control(
'eael_typeform_max_height',
[
'label' => esc_html__('Form Height', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'default' => [
'size' => '700',
'unit' => 'px',
],
'selectors' => [
'{{WRAPPER}} .eael-typeform' => 'height: {{SIZE}}{{UNIT}};'
],
]
);
$this->add_control(
'eael_typeform_opacity',
[
'label' => __('Opacity', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100
]
],
'default' => [
'unit' => 'px',
'size' => 50,
],
]
);
$this->add_responsive_control(
'eael_typeform_margin',
[
'label' => esc_html__('Form Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-typeform' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_typeform_padding',
[
'label' => esc_html__('Form Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-typeform' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_type_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'separator' => 'before',
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .eael-typeform' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_type_border',
'selector' => '{{WRAPPER}} .eael-typeform',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_typeform_box_shadow',
'selector' => '{{WRAPPER}} .eael-typeform',
]
);
$this->end_controls_section();
}
protected function render () {
$settings = $this->get_settings_for_display();
if ($this->get_settings('eael_typeform_list') == '') {
return;
}
$id = 'eael-type-form-'.$this->get_id();
$this->add_render_attribute(
'eael_typeform_wrapper',
[
'id' => $id,
'class' => [
'eael-typeform',
'clearfix',
'fs_wp_sidebar',
'fsBody',
'eael-contact-form'
]
]
);
$alignment = $settings['eael_typeform_alignment'];
$this->add_render_attribute('eael_typeform_wrapper', 'class', 'eael-typeform-align-'.$alignment);
$data = [
'url' => esc_url($settings['eael_typeform_list']),
'hideFooter' => ($this->get_settings('eael_typeform_hidefooter') == 'yes'),
'hideHeaders' => ($this->get_settings('eael_typeform_hideheaders') == 'yes'),
'opacity' => $this->get_settings('eael_typeform_opacity')['size']
];
echo '<div data-typeform="'. esc_attr( htmlspecialchars(json_encode($data), ENT_QUOTES,
'UTF-8') ) .'" '; $this->print_render_attribute_string('eael_typeform_wrapper'); echo'></div>';
}
}
@@ -0,0 +1,807 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Typography;
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use \Elementor\Widget_Base;
use \Essential_Addons_Elementor\Classes\Helper;
class WeForms extends Widget_Base
{
public function get_name()
{
return 'eael-weform';
}
public function get_title()
{
return esc_html__('weForm', 'essential-addons-for-elementor-lite');
}
public function get_icon()
{
return 'eaicon-weforms';
}
public function get_categories()
{
return ['essential-addons-elementor'];
}
public function get_keywords()
{
return [
'contact form',
'ea contact form',
'ea we form',
'ea weform',
'ea weforms',
'form styler',
'ea form styler',
'elementor form',
'feedback',
'ea',
'essential addons'
];
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url()
{
return 'https://essential-addons.com/elementor/docs/weforms/';
}
protected function register_controls()
{
if (!function_exists('WeForms')) {
$this->start_controls_section(
'eael_global_warning',
[
'label' => __('Warning!', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_global_warning_text',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => __('<strong>WeForms</strong> is not installed/activated on your site. Please install and activate <strong>WeForms</strong> first.', 'essential-addons-for-elementor-lite'),
'content_classes' => 'eael-warning',
]
);
$this->end_controls_section();
} else {
$this->start_controls_section(
'eael_section_weform',
[
'label' => esc_html__('Select Form', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'wpuf_contact_form',
[
'label' => esc_html__('Select weForm', 'essential-addons-for-elementor-lite'),
'description' => esc_html__('Please save and refresh the page after selecting the form', 'essential-addons-for-elementor-lite'),
'label_block' => true,
'type' => Controls_Manager::SELECT,
'options' => Helper::get_weform_list(),
'default' => '0',
]
);
$this->end_controls_section();
if (!apply_filters('eael/pro_enabled', false)) {
$this->start_controls_section(
'eael_section_pro',
[
'label' => __('Go Premium for More Features', 'essential-addons-for-elementor-lite'),
]
);
$this->add_control(
'eael_control_get_pro',
[
'label' => __('Unlock more possibilities', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'1' => [
'title' => '',
'icon' => 'fa fa-unlock-alt',
],
],
'default' => '1',
'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>',
]
);
$this->end_controls_section();
}
}
$this->start_controls_section(
'eael_section_weform_styles',
[
'label' => esc_html__('Form Container Styles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_weform_background',
[
'label' => esc_html__('Form Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container' => 'background-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eael_weform_alignment',
[
'label' => esc_html__('Form Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'default' => [
'title' => __('Default', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-ban',
],
'left' => [
'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'default',
'prefix_class' => 'eael-contact-form-align-',
]
);
$this->add_responsive_control(
'eael_weform_width',
[
'label' => esc_html__('Form Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'selectors' => [
'{{WRAPPER}} .eael-weform-container' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_max_width',
[
'label' => esc_html__('Form Max Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'selectors' => [
'{{WRAPPER}} .eael-weform-container' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_margin',
[
'label' => esc_html__('Form Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_padding',
[
'label' => esc_html__('Form Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_weform_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'separator' => 'before',
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_weform_border',
'selector' => '{{WRAPPER}} .eael-weform-container',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_weform_box_shadow',
'selector' => '{{WRAPPER}} .eael-weform-container',
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_weform_field_styles',
[
'label' => esc_html__('Form Fields Styles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_weform_input_background',
[
'label' => esc_html__('Input Field Background', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea' => 'background-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'eael_weform_input_width',
[
'label' => esc_html__('Input Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"]' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_textarea_width',
[
'label' => esc_html__('Textarea Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_input_padding',
[
'label' => esc_html__('Fields Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_input_margin',
[
'label' => esc_html__('Fields Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_weform_input_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'separator' => 'before',
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_weform_input_border',
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_weform_input_box_shadow',
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea',
]
);
$this->add_control(
'eael_weform_focus_heading',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__('Focus State Style', 'essential-addons-for-elementor-lite'),
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_weform_input_focus_box_shadow',
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea:focus',
]
);
$this->add_control(
'eael_weform_input_focus_border',
[
'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"]:focus,
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea:focus' => 'border-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_label_style_heading',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__('Label Style', 'essential-addons-for-elementor-lite'),
'separator' => 'before',
]
);
$this->add_control(
'eael_weform_label_margin',
[
'label' => __('Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%', 'em'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container .wpuf-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_weform_typography',
[
'label' => esc_html__('Color & Typography', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'eael_weform_label_color',
[
'label' => esc_html__('Label Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container, {{WRAPPER}} .eael-weform-container .wpuf-label label' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_field_color',
[
'label' => esc_html__('Field Font Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_placeholder_color',
[
'label' => esc_html__('Placeholder Font Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-weform-container ::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-weform-container ::-ms-input-placeholder' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_label_heading',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__('Label Typography', 'essential-addons-for-elementor-lite'),
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_weform_label_typography',
'selector' => '{{WRAPPER}} .eael-weform-container, {{WRAPPER}} .eael-weform-container .wpuf-label label',
]
);
$this->add_control(
'eael_weform_heading_input_field',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__('Input Fields Typography', 'essential-addons-for-elementor-lite'),
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_weform_input_field_typography',
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="text"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="password"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="email"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="url"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields input[type="number"],
{{WRAPPER}} .eael-weform-container ul.wpuf-form li .wpuf-fields textarea',
]
);
$this->end_controls_section();
$this->start_controls_section(
'eael_section_weform_submit_button_styles',
[
'label' => esc_html__('Submit Button Styles', 'essential-addons-for-elementor-lite'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'eael_weform_submit_btn_width',
[
'label' => esc_html__('Button Width', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 10,
'max' => 1500,
],
'em' => [
'min' => 1,
'max' => 80,
],
],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_submit_btn_alignment',
[
'label' => esc_html__('Button Alignment', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::CHOOSE,
'label_block' => true,
'options' => [
'default' => [
'title' => __('Default', 'essential-addons-for-elementor-lite'),
'icon' => 'fa fa-ban',
],
'left' => [
'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'default',
'prefix_class' => 'eael-contact-form-btn-align-',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_weform_submit_btn_typography',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_PRIMARY
],
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]',
]
);
$this->add_responsive_control(
'eael_weform_submit_btn_margin',
[
'label' => esc_html__('Margin', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'eael_weform_submit_btn_padding',
[
'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->start_controls_tabs('eael_weform_submit_button_tabs');
$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]);
$this->add_control(
'eael_weform_submit_btn_text_color',
[
'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_submit_btn_background_color',
[
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'eael_weform_submit_btn_border',
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]',
]
);
$this->add_control(
'eael_weform_submit_btn_border_radius',
[
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]' => 'border-radius: {{SIZE}}px;',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab('eael_weform_submit_btn_hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]);
$this->add_control(
'eael_weform_submit_btn_hover_text_color',
[
'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_submit_btn_hover_background_color',
[
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'eael_weform_submit_btn_hover_border_color',
[
'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]:hover' => 'border-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'eael_weform_submit_btn_box_shadow',
'selector' => '{{WRAPPER}} .eael-weform-container ul.wpuf-form .wpuf-submit input[type="submit"]',
]
);
$this->end_controls_section();
}
protected function render()
{
if (!function_exists('WeForms')) {
return;
}
$settings = $this->get_settings_for_display();
if (!empty($settings['wpuf_contact_form'])) {
echo '<div class="eael-weform-container">
' . do_shortcode('[weforms id="' . esc_attr( $settings['wpuf_contact_form'] ) . '" ]') . '
</div>';
}
}
}
@@ -0,0 +1,115 @@
<?php
namespace Essential_Addons_Elementor\Elements;
use Elementor\Widget_Base;
use Essential_Addons_Elementor\Classes\Helper;
use Essential_Addons_Elementor\Traits\Woo_Product_Comparable;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
/**
* Class Woo_Product_Compare
* @package namespace Essential_Addons_Elementor\Pro\Elements;
*/
class Woo_Product_Compare extends Widget_Base {
use Woo_Product_Comparable;
protected $products_list = [];
protected $remove_action = 'eael-wcpc-remove-product';
/**
* @inheritDoc
*/
public function get_name() {
return 'eael-woo-product-compare';
}
/**
* @inheritDoc
*/
public function get_title() {
return esc_html__( 'Woo Product Compare', 'essential-addons-for-elementor-lite' );
}
/**
* @inheritDoc
*/
public function get_icon() {
return 'eaicon-product-compare';
}
/**
* @inheritDoc
*/
public function get_keywords() {
return [
'woocommerce product compare',
'woocommerce product comparison',
'product compare',
'product comparison',
'products compare',
'products comparison',
'wc',
'woocommerce',
'products',
'compare',
'comparison',
'ea',
'essential addons',
];
}
public function has_widget_inner_wrapper(): bool {
return ! Helper::eael_e_optimized_markup();
}
public function get_custom_help_url() {
return 'https://essential-addons.com/elementor/docs/woo-product-compare/';
}
/**
* @inheritDoc
*/
public function get_categories() {
return [ 'essential-addons-elementor', 'woocommerce-elements' ];
}
/**
* @inheritDoc
*/
protected function register_controls() {
$this->init_content_wc_notice_controls();
if ( ! function_exists( 'WC' ) ) {
return;
}
/*----Content Tab----*/
do_action( 'eael/wcpc/before-content-controls', $this );
$this->init_content_product_compare_controls();
$this->init_content_table_settings_controls();
do_action( 'eael/wcpc/after-content-controls', $this );
/*----Style Tab----*/
do_action( 'eael/wcpc/before-style-controls', $this );
$this->init_style_content_controls();
$this->init_style_table_controls();
do_action( 'eael/wcpc/after-style-controls', $this );
}
protected function render() {
if ( ! function_exists( 'WC' ) ) {
return;
}
$ds = $this->get_settings_for_display();
$product_ids = $this->get_settings_for_display( 'product_ids' );
$products = $this->get_products_list( $product_ids );
$fields = $this->fields();
$this->render_compare_table( compact( 'products', 'fields', 'ds' ) );
}
}
@@ -0,0 +1,927 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use Elementor\Plugin;
use Elementor\Widget_Base;
use Elementor\Icons_Manager;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Essential_Addons_Elementor\Classes\Helper;
class Woo_Product_Price extends Widget_Base {
public function get_name() {
return 'eael-woo-product-price';
}
public function get_title() {
return esc_html__( 'Woo Product Price', 'essential-addons-for-elementor-lite' );
}
public function get_icon() {
return 'eaicon-product-price';
}
public function get_categories() {
return [ 'essential-addons-elementor', 'woocommerce-elements' ];
}
public function get_keywords() {
return [
'woocommerce',
'price',
'product',
'ea',
'essential addons',
'ea price',
'ea product',
'woo',
'woo price',
'woo product',
'EA Product Price',
'Product Price',
];
}
public function get_custom_help_url() {
return 'https://essential-addons.com/elementor/docs/ea-woo-product-price';
}
protected function register_controls() {
$this->eael_wc_notice_controls();
if ( !function_exists( 'WC' ) ) {
return;
}
$this->eael_product_price_content();
// Style Tab Start
$this->start_controls_section(
'section_title_style',
[
'label' => esc_html__( 'Price', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
//Start regular price
$this->eael_product_regular_price();
//Start Currency Symbol
$this->eael_product_regular_price_currency();
//Start sale price
$this->eael_product_sale_price();
//Start Currency Symbol
$this->eael_product_sale_price_currency();
$this->end_controls_section();
// Style Tab End
//Prefix
$this->start_controls_section(
'section_prefix',
[
'label' => esc_html__( 'Prefix', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [ 'show_prefix' => 'yes' ],
]
);
$this->eael_product_price_prefix();
$this->end_controls_section();
// Style Tab End
//Suffix
$this->start_controls_section(
'section_suffix',
[
'label' => esc_html__( 'Suffix', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [ 'show_suffix' => 'yes' ],
]
);
$this->eael_product_price_suffix();
$this->end_controls_section();
// Style Tab End
}
/**
* WC Notice
*
* @return void
*/
protected function eael_wc_notice_controls() {
if ( ! function_exists( 'WC' ) ) {
$this->start_controls_section( 'eael_global_warning', [
'label' => __( 'Warning!', 'essential-addons-for-elementor-lite' ),
] );
$this->add_control( 'eael_global_warning_text', [
'type' => Controls_Manager::RAW_HTML,
'raw' => __( '<strong>WooCommerce</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=woocommerce&tab=search&type=term" target="_blank">WooCommerce</a> first.', 'essential-addons-for-elementor-lite' ),
'content_classes' => 'eael-warning',
] );
$this->end_controls_section();
return;
}
}
/**
* Undocumented function
*
* @return void
*/
protected function eael_product_price_content() {
$this->start_controls_section(
'content_section',
[
'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'sale_price_position',
[
'label' => esc_html__( 'Sale Price Position', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'row',
'options' => [
'row' => esc_html__( 'After Regular Price', 'essential-addons-for-elementor-lite' ),
'row-reverse' => esc_html__( 'Before Regular Price', 'essential-addons-for-elementor-lite' ),
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price' => 'flex-direction: {{VALUE}}',
],
]
);
$this->add_control(
'stacked_price',
[
'label' => esc_html__( 'Stacked', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'No', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price' => 'flex-wrap: wrap;',
'{{WRAPPER}} .eael-single-product-price .price del' => 'display: block; flex: 1 1 100%;',
'{{WRAPPER}} .eael-single-product-price .price ins' => 'display: block; flex: 1 1 100%;',
],
]
);
$this->add_control(
'price_hr',
[
'type' => Controls_Manager::DIVIDER,
]
);
//Prefix-Suffix Controls
$this->eael_prefix_suffix();
$this->end_controls_section();
}
/**
* Undocumented function
*
* @return void
*/
protected function eael_prefix_suffix() {
//Prefix Controls
$this->add_control(
'show_prefix',
[
'label' => esc_html__( 'Show Prefix', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
]
);
$this->add_control(
'prefix_content',
[
'label' => esc_html__( 'Prefix Content', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'text' => [
'title' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-area',
],
'icon' => [
'title' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-nerd',
],
],
'default' => 'text',
'toggle' => false,
'condition' => [
'show_prefix' => 'yes',
],
]
);
$this->add_control(
'prefix_text',
[
'label' => esc_html__( 'Prefix Text', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Limited Time Offer', 'essential-addons-for-elementor-lite' ),
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'text',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'prefix_icon',
[
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-fire',
'library' => 'fa-solid',
],
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'icon',
],
]
);
//Suffix
$this->add_control(
'show_suffix',
[
'label' => esc_html__( 'Show Suffix', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
]
);
$this->add_control(
'suffix_content',
[
'label' => esc_html__( 'Suffix Content', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'text' => [
'title' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-area',
],
'icon' => [
'title' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-nerd',
],
],
'default' => 'text',
'toggle' => false,
'condition' => [
'show_suffix' => 'yes',
],
]
);
$this->add_control(
'suffix_text',
[
'label' => esc_html__( 'Suffix Text', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Sales Ongoing', 'essential-addons-for-elementor-lite' ),
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'text',
],
'ai' => [
'active' => false,
],
]
);
$this->add_control(
'suffix_icon',
[
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-pepper-hot',
'library' => 'fa-solid',
],
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'icon',
],
]
);
}
protected function eael_product_regular_price() {
$this->add_control(
'regular_peice_heading',
[
'label' => esc_html__( 'Regular Price', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'after',
]
);
$this->add_control(
'price_color',
[
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price del .amount bdi' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-single-product-price .price .amount bdi' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-single-product-price .price' => 'color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'price_align',
[
'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'flex-start',
'toggle' => true,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price' => 'justify-content: {{VALUE}};',
'{{WRAPPER}} .eael-product-price-edit' => 'justify-content: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_typography',
'selector' => '{{WRAPPER}} .eael-single-product-price .price',
]
);
$this->add_control(
'price_text_decoration_color',
[
'label' => esc_html__( 'Text Decoration Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price del' => 'text-decoration-color: {{VALUE}};',
],
]
);
}
protected function eael_product_regular_price_currency() {
$this->add_control(
'peice_currency_heading',
[
'label' => esc_html__( 'Price Currency Symbol', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'price_currency_color',
[
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price del .woocommerce-Price-currencySymbol' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_currency_typography',
'selector' => 'woocommerce {{WRAPPER}} .eael-single-product-price .price del .woocommerce-Price-currencySymbol',
]
);
$this->add_control(
'price_currency_spacing',
[
'label' => esc_html__( 'Spacing', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'rem', 'em', '%', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'%' => [
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price del .woocommerce-Price-currencySymbol' => 'margin-right: {{SIZE}}{{UNIT}};',
],
]
);
}
protected function eael_product_sale_price() {
$this->add_control(
'sale_heading',
[
'label' => esc_html__( 'Sale Price', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'sale_color',
[
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price ins .amount bdi' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'sale_typography',
'selector' => '{{WRAPPER}} .eael-single-product-price .price ins',
]
);
$this->add_control(
'sale_spacing',
[
'label' => esc_html__( 'Spacing', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'rem', 'em', '%', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'%' => [
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 6,
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price' => 'gap: {{SIZE}}{{UNIT}}',
],
]
);
$this->add_control(
'sale_text_decoration_color',
[
'label' => esc_html__( 'Text Decoration Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price ins' => 'text-decoration-color: {{VALUE}};',
],
]
);
}
protected function eael_product_sale_price_currency() {
$this->add_control(
'sale_currency_heading',
[
'label' => esc_html__( 'Sale Currency Symbol', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'sale_currency_color',
[
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price ins .woocommerce-Price-currencySymbol' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'sale_currency_typography',
'selector' => '{{WRAPPER}} .eael-single-product-price .price ins .woocommerce-Price-currencySymbol',
]
);
$this->add_control(
'sale_currency_spacing',
[
'label' => esc_html__( 'Spacing', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'rem', 'em', '%', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'%' => [
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .price ins .woocommerce-Price-currencySymbol' => 'margin-right: {{SIZE}}{{UNIT}}',
],
]
);
}
protected function eael_product_price_prefix() {
$this->add_control(
'prefix_text_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .prefix-price-text span' => 'color: {{VALUE}}',
],
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'text',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'prefix_text_typography',
'selector' => '{{WRAPPER}} .eael-single-product-price .prefix-price-text span',
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'text',
],
]
);
$this->add_responsive_control(
'prefix_text_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .prefix-price-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'text',
],
]
);
$this->add_control(
'prefix_icon_color',
[
'label' => esc_html__( 'Icon Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .prefix-price-icon svg' => 'fill: {{VALUE}}',
'{{WRAPPER}} .eael-single-product-price .prefix-price-icon i' => 'color: {{VALUE}}',
],
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'icon',
],
]
);
$this->add_control(
'prefix_icon_size',
[
'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 25,
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .prefix-price-icon svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-single-product-price .prefix-price-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
],
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'icon',
],
]
);
$this->add_responsive_control(
'prefix_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'default' => [
'top' => 2,
'right' => 8,
'bottom' => 0,
'left' => 0,
'unit' => 'px',
'isLinked' => false,
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .prefix-price-icon svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .eael-single-product-price .prefix-price-icon i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'show_prefix' => 'yes',
'prefix_content' => 'icon',
],
]
);
}
protected function eael_product_price_suffix() {
$this->add_control(
'suffix_text_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .suffix-price-text span' => 'color: {{VALUE}}',
],
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'text',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'suffix_text_typography',
'selector' => '{{WRAPPER}} .eael-single-product-price .suffix-price-text span',
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'text',
],
]
);
$this->add_responsive_control(
'suffix_text_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .suffix-price-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'text',
],
]
);
$this->add_control(
'suffix_icon_color',
[
'label' => esc_html__( 'Icon Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .suffix-price-icon svg' => 'fill: {{VALUE}}',
'{{WRAPPER}} .eael-single-product-price .suffix-price-icon i' => 'color: {{VALUE}}',
],
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'icon',
],
]
);
$this->add_control(
'suffix_icon_size',
[
'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 25,
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .suffix-price-icon svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-single-product-price .suffix-price-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
],
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'icon',
],
]
);
$this->add_responsive_control(
'suffix_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'default' => [
'top' => 2,
'right' => 0,
'bottom' => 0,
'left' => 8,
'unit' => 'px',
'isLinked' => false,
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-price .suffix-price-icon svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .eael-single-product-price .suffix-price-icon i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'show_suffix' => 'yes',
'suffix_content' => 'icon',
],
]
);
}
protected function render() {
if ( !function_exists( 'WC' ) ) {
return;
}
global $product;
$settings = $this->get_settings_for_display();
$prefix_content = $settings['prefix_content'];
$suffix_content = $settings['suffix_content'];
$product = Helper::get_product();
if ( Plugin::$instance->editor->is_edit_mode() || get_post_type( get_the_ID() ) === 'templately_library' ) {
?>
<div class="eael-single-product-price">
<?php
if ( 'yes' === $settings['show_prefix'] ) {
switch ($prefix_content) {
case 'text':
?>
<div class="prefix-price-text">
<span><?php echo wp_kses( $settings['prefix_text'], Helper::eael_allowed_tags() ); ?></span>
</div>
<?php
break;
case 'icon':
?>
<div class="prefix-price-icon">
<?php Icons_Manager::render_icon( $settings['prefix_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</div>
<?php
break;
}
}
?>
<div class="eael-product-price-edit">
<p class="price">
<del aria-hidden="true">
<span class="woocommerce-Price-amount amount">
<bdi><span class="woocommerce-Price-currencySymbol"><?php esc_html_e( '$', 'essential-addons-for-elementor-lite' ); ?></span><?php esc_html_e( '80.00', 'essential-addons-for-elementor-lite' ); ?></bdi>
</span>
</del>
<ins aria-hidden="true">
<span class="woocommerce-Price-amount amount">
<bdi><span class="woocommerce-Price-currencySymbol"><?php esc_html_e( '$', 'essential-addons-for-elementor-lite' ); ?></span><?php esc_html_e( '50.00', 'essential-addons-for-elementor-lite' ); ?></bdi>
</span>
</ins>
</p>
</div>
<?php
if ( 'yes' === $settings['show_suffix'] ) {
switch ($suffix_content) {
case 'text':
?>
<div class="suffix-price-text">
<span><?php echo wp_kses( $settings['suffix_text'], Helper::eael_allowed_tags() ); ?></span>
</div>
<?php
break;
case 'icon':
?>
<div class="suffix-price-icon">
<?php Icons_Manager::render_icon( $settings['suffix_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</div>
<?php
break;
}
}
?>
</div>
<?php
} else {
if ( ! $product ) {
return;
}
?>
<div class="eael-single-product-price">
<?php
if ( 'yes' === $settings['show_prefix'] ) {
switch ($prefix_content) {
case 'text':
?>
<div class="prefix-price-text">
<span><?php echo wp_kses( $settings['prefix_text'], Helper::eael_allowed_tags() ); ?></span>
</div>
<?php
break;
case 'icon':
?>
<div class="prefix-price-icon">
<?php Icons_Manager::render_icon( $settings['prefix_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</div>
<?php
break;
}
}
?>
<?php
wc_get_template( '/single-product/price.php' );
if ( 'yes' === $settings['show_suffix'] ) {
switch ($suffix_content) {
case 'text':
?>
<div class="suffix-price-text">
<span><?php echo wp_kses( $settings['suffix_text'], Helper::eael_allowed_tags() ); ?></span>
</div>
<?php
break;
case 'icon':
?>
<div class="suffix-price-icon">
<?php Icons_Manager::render_icon( $settings['suffix_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</div>
<?php
break;
}
}
?>
</div>
<?php
}
}
}
@@ -0,0 +1,529 @@
<?php
namespace Essential_Addons_Elementor\Elements;
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
use Elementor\Plugin;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Widget_Base;
use Essential_Addons_Elementor\Classes\Helper;
class Woo_Product_Rating extends Widget_Base {
public function get_name() {
return 'eael-woo-product-rating';
}
public function get_title() {
return esc_html__( 'Woo Product Rating', 'essential-addons-for-elementor-lite' );
}
public function get_icon() {
return 'eaicon-product-rating';
}
public function get_categories() {
return [ 'essential-addons-elementor', 'woocommerce-elements' ];
}
public function get_keywords() {
return [
'woocommerce',
'rating',
'review',
'comments',
'product',
'ea',
'essential addons',
'ea product',
'ea rating',
'ea review',
'woo',
'woo product',
'woo rating',
'woo review',
'Product Rating',
'EA Woo Product Rating',
];
}
public function get_custom_help_url() {
return 'https://essential-addons.com/elementor/docs/ea-woo-product-rating';
}
protected function register_controls() {
$this->eael_wc_notice_controls();
if ( !function_exists( 'WC' ) ) {
return;
}
//
$this->eael_product_rating_content();
// Style Tab Start
$this->start_controls_section(
'eael_section_title_style',
[
'label' => esc_html__( 'Rating', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'eael_star_align',
[
'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
'icon' => 'eicon-text-align-right',
],
],
'prefix_class' => 'eael-product-rating--align-',
]
);
$this->add_control(
'eael_rating_color',
[
'label' => esc_html__( 'Rating Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.woocommerce {{WRAPPER}} .eael-single-product-rating .star-rating' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap .eael-product-rating.unfilled svg path' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'eael_rating_count_color',
[
'label' => esc_html__( 'Rating Given Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.woocommerce {{WRAPPER}} .eael-single-product-rating .star-rating' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap .eael-product-rating.filled svg path' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'eael_empty_star_color',
[
'label' => esc_html__( 'Empty Star Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.woocommerce {{WRAPPER}} .eael-single-product-rating .star-rating:before' => 'color: {{VALUE}};',
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap .eael-product-rating svg path' => 'fill: {{VALUE}};',
],
'condition' => [
'show_empty_review' => 'yes',
]
]
);
$this->add_control(
'eael_star_size',
[
'label' => esc_html__( 'Star Size', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'rem', '%', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'rem' => [
'max' => 50,
],
'%' => [
'max' => 100,
],
],
'selectors' => [
'.woocommerce {{WRAPPER}} .eael-single-product-rating .star-rating' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap .eael-product-rating svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'eael_star_gap',
[
'label' => esc_html__( 'Gap', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'rem', '%', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'rem' => [
'max' => 50,
],
'%' => [
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap' => 'gap: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .eael-single-product-rating .star-rating' => 'letter-spacing: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'product_rating_margin',
[
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'product_rating_hr1',
[
'type' => Controls_Manager::DIVIDER,
]
);
$this->add_control(
'eael_star_text_color',
[
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .eael-single-product-rating .woocommerce-review-link' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'eael_star_text_typography',
'selector' => '{{WRAPPER}} .eael-single-product-rating .woocommerce-review-link',
]
);
$this->add_control(
'eael_star_text_spaceing',
[
'label' => esc_html__( 'Space Between', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'rem', 'em', '%', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'rem' => [
'max' => 50,
],
'em' => [
'max' => 50,
],
'%' => [
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .eael-single-product-rating .eael-product-rating-wrap' => 'margin-right: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Tab End
}
/**
* WC Notice
*
* @return void
*/
protected function eael_wc_notice_controls() {
if ( ! function_exists( 'WC' ) ) {
$this->start_controls_section( 'eael_global_warning', [
'label' => __( 'Warning!', 'essential-addons-for-elementor-lite' ),
] );
$this->add_control( 'eael_global_warning_text', [
'type' => Controls_Manager::RAW_HTML,
'raw' => __( '<strong>WooCommerce</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=woocommerce&tab=search&type=term" target="_blank">WooCommerce</a> first.', 'essential-addons-for-elementor-lite' ),
'content_classes' => 'eael-warning',
] );
$this->end_controls_section();
return;
}
}
/**
* Undocumented function
*
* @return void
*/
protected function eael_product_rating_content() {
$this->start_controls_section(
'rating_content_section',
[
'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'show_review_count',
[
'label' => esc_html__( 'Show Review Count', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'rating_style',
[
'label' => esc_html__( 'Rating Style', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SELECT,
'default' => 'style_1',
'options' => [
'style_1' => esc_html__( 'Style 1', 'essential-addons-for-elementor-lite' ),
'style_2' => esc_html__( 'Style 2', 'essential-addons-for-elementor-lite' ),
'style_3' => esc_html__( 'Style 3', 'essential-addons-for-elementor-lite' ),
],
]
);
$this->add_control(
'rating_caption',
[
'label' => esc_html__( 'Rating Caption', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Customer Rating', 'essential-addons-for-elementor-lite' ),
'ai' => [
'active' => false,
],
'condition' => [
'show_review_count' => 'yes',
],
]
);
$this->add_control(
'before_rating_caption',
[
'label' => esc_html__( 'Before Caption', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( '( ', 'essential-addons-for-elementor-lite' ),
'ai' => [
'active' => false,
],
'condition' => [
'show_review_count' => 'yes',
],
]
);
$this->add_control(
'after_rating_caption',
[
'label' => esc_html__( 'After Caption', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( ' )', 'essential-addons-for-elementor-lite' ),
'ai' => [
'active' => false,
],
'condition' => [
'show_review_count' => 'yes',
],
]
);
$this->add_control(
'product_rating_hr',
[
'type' => Controls_Manager::DIVIDER,
]
);
$this->add_control(
'show_empty_review',
[
'label' => esc_html__( 'Show Empty Review', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ),
'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ),
'return_value' => 'yes',
]
);
$this->add_control(
'empty_rating_caption',
[
'label' => esc_html__( 'Empty Rating Caption', 'essential-addons-for-elementor-lite' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'No Customer Rating', 'essential-addons-for-elementor-lite' ),
'ai' => [
'active' => false,
],
'condition' => [
'show_empty_review' => 'yes',
],
]
);
$this->end_controls_section();
}
public function eael_star_solid( $filled ) {
?>
<span class="eael-product-rating <?php echo $filled ? 'filled' : 'unfilled'; ?>">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<path d="M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z"/>
</svg>
</span>
<?php
}
public function eael_star_classic( $filled ) {
?>
<span class="eael-product-rating <?php echo $filled ? 'filled' : 'unfilled'; ?>">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<path d="M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z"/>
</svg>
</span>
<?php
}
public function eael_star_half_stroke( $filled ) {
?>
<span class="eael-product-rating <?php echo $filled ? 'filled' : 'unfilled'; ?>">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<path d="M309.5 13.5C305.5 5.2 297.1 0 287.9 0s-17.6 5.2-21.6 13.5L197.7 154.8 44.5 177.5c-9 1.3-16.5 7.6-19.3 16.3s-.5 18.1 5.9 24.5L142.2 328.4 116 483.9c-1.5 9 2.2 18.1 9.7 23.5s17.3 6 25.3 1.7l137-73.2 137 73.2c8.1 4.3 17.9 3.7 25.3-1.7s11.2-14.5 9.7-23.5L433.6 328.4 544.8 218.2c6.5-6.4 8.7-15.9 5.9-24.5s-10.3-14.9-19.3-16.3L378.1 154.8 309.5 13.5zM288 384.7l0-305.6 52.5 108.1c3.5 7.1 10.2 12.1 18.1 13.3l118.3 17.5L391 303c-5.5 5.5-8.1 13.3-6.8 21l20.2 119.6L299.2 387.5c-3.5-1.9-7.4-2.8-11.2-2.8z"/>
</svg>
</span>
<?php
}
public function eael_rating_style( $settings, $average, $rating_count ) {
$style_methods = [
'style_1' => 'eael_star_solid',
'style_2' => 'eael_star_classic',
'style_3' => 'eael_star_half_stroke',
];
if( isset( $style_methods[ $settings['rating_style'] ] ) ) {
$method = $style_methods[ $settings['rating_style'] ];
for ( $i=1; $i <=5 ; $i++ ) {
$filled = ( $i <= ceil( $average ) ) ? true : false;
$this->$method( $filled );
}
}
}
protected function render() {
if ( !function_exists( 'WC' ) ) {
return;
}
global $product;
$settings = $this->get_settings_for_display();
if ( Plugin::$instance->editor->is_edit_mode() || get_post_type( get_the_ID() ) === 'templately_library' ) {
?>
<div class="eael-single-product-rating">
<div class="woocommerce-product-rating">
<div class="eael-product-rating-wrap">
<?php $this->eael_rating_style( $settings, $average = 3, $rating_count = 1 ); ?>
</div>
<?php if ( 'yes' === $settings['show_review_count'] ) { ?>
<a href="#reviews" class="woocommerce-review-link" rel="nofollow">
<span class="before-rating">
<?php echo wp_kses( $settings['before_rating_caption'], Helper::eael_allowed_tags() ); ?>
</span>
<span class="count">
<?php esc_html_e( '1', 'essential-addons-for-elementor-lite' ); ?>
</span>
<?php echo wp_kses( $settings['rating_caption'], Helper::eael_allowed_tags() ); ?>
<span class="after-rating">
<?php echo wp_kses( $settings['after_rating_caption'], Helper::eael_allowed_tags() ); ?>
</span>
</a>
<?php } ?>
</div>
</div>
<?php
} else {
if ( ! $product ) {
return;
}
if ( ! wc_review_ratings_enabled() ) {
return;
}
$product = Helper::get_product();
$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average = $product->get_average_rating();
$average = ( $rating_count > 0 ) ? $average : 0;
if ( $rating_count > 0 || 'yes' === $settings['show_empty_review'] ) {
$review_caption = ( $rating_count > 0 ) ? $settings['rating_caption'] : $settings['empty_rating_caption'];
$caption_suffix = ( $rating_count > 1 ) ? esc_html__( 's', 'essential-addons-for-elementor-lite' ) : '';
$review_caption .= $caption_suffix;
?>
<div class="eael-single-product-rating">
<div class="woocommerce-product-rating">
<div class="eael-product-rating-wrap">
<?php $this->eael_rating_style( $settings, $average, $rating_count ); ?>
</div>
<?php if ( comments_open() && 'yes' === $settings['show_review_count'] ) { ?>
<a href="#reviews" class="woocommerce-review-link" rel="nofollow">
<span class="before-rating"><?php echo wp_kses( $settings['before_rating_caption'], Helper::eael_allowed_tags() ); ?></span>
<span class="count">
<?php
if ( $review_count > 0 ) {
?>
<span class="count_number">
<?php echo esc_html( $review_count ); ?>
</span>
<?php
}
?>
<span class="count_text">
<?php echo wp_kses( $review_caption, Helper::eael_allowed_tags() ); ?>
</span>
</span>
<span class="after-rating"><?php echo wp_kses( $settings['after_rating_caption'], Helper::eael_allowed_tags() ); ?></span>
</a>
<?php } elseif ( $rating_count === 0 && 'yes' === $settings['show_empty_review'] ) {
?>
<a href="#reviews" class="woocommerce-review-link" rel="nofollow">
<?php echo wp_kses( $review_caption, Helper::eael_allowed_tags() ); ?>
</a>
<?php
} ?>
</div>
</div>
<?php
}
}
}
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -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
@@ -0,0 +1,45 @@
<?php
use \Essential_Addons_Elementor\Classes\Helper;
/**
* Template Name: Layout 2
*
*/
if ($default_multiple_kb) {
if(!empty($settings['selected_knowledge_base'])){
$button_link = str_replace('%knowledge_base%', $settings['selected_knowledge_base'], get_term_link($term->slug, 'doc_category'));
}else{
$button_link = str_replace('%knowledge_base%', 'non-knowledgebase', get_term_link($term->slug, 'doc_category'));
}
} else {
$button_link = get_term_link($term->slug, 'doc_category');
}
echo '<a href="' . esc_url( $button_link ) . '" class="eael-better-docs-category-box-post layout__2">';
echo '<div class="eael-bd-cb-inner">';
if ($settings['show_icon']) {
$cat_icon_id = get_term_meta($term->term_id, 'doc_category_image-id', true);
if ($cat_icon_id) {
$cat_icon = wp_get_attachment_image($cat_icon_id, 'thumbnail', true, ['alt' => esc_attr(get_post_meta($cat_icon_id, '_wp_attachment_image_alt', true))]);
} else {
$cat_icon = '<img src="' . EAEL_PLUGIN_URL . 'assets/front-end/img/betterdocs-cat-icon.svg" alt="betterdocs-category-box-icon">';
}
echo '<div class="eael-bd-cb-cat-icon__layout-2">' . wp_kses( $cat_icon, Helper::eael_allowed_icon_tags() ) . '</div>';
}
if ($settings['show_title']) {
$title_tag = Helper::eael_validate_html_tag( $settings['title_tag'] );
$title = '<' . $title_tag . ' class="eael-bd-cb-cat-title__layout-2"><span>' . $term->name . '</span></' . $title_tag . '>';
echo wp_kses( $title, Helper::eael_allowed_tags() );
}
if ($settings['show_count']) {
echo '<div class="eael-bd-cb-cat-count__layout-2"><span class="count-inner__layout-2">' . esc_html( Helper::get_doc_post_count($term->count, $term->term_id) ) . '</span></div>';
}
echo '</div>';
echo '</a>';
@@ -0,0 +1,46 @@
<?php
use \Essential_Addons_Elementor\Classes\Helper;
/**
* Template Name: Default
*
*/
if ($default_multiple_kb) {
if(!empty($settings['selected_knowledge_base'])){
$button_link = str_replace('%knowledge_base%', $settings['selected_knowledge_base'], get_term_link($term->slug, 'doc_category'));
}else{
$button_link = str_replace('%knowledge_base%', 'non-knowledgebase', get_term_link($term->slug, 'doc_category'));
}
} else {
$button_link = get_term_link($term->slug, 'doc_category');
}
echo '<a href="' . esc_url( $button_link ) . '" class="eael-better-docs-category-box-post">
<div class="eael-bd-cb-inner">';
if ($settings['show_icon']) {
$cat_icon_id = get_term_meta($term->term_id, 'doc_category_image-id', true);
if ($cat_icon_id) {
$cat_icon = wp_get_attachment_image($cat_icon_id, 'thumbnail', ['alt' => esc_attr(get_post_meta($cat_icon_id, '_wp_attachment_image_alt', true))]);
} else {
$cat_icon = '<img src="' . EAEL_PLUGIN_URL . 'assets/front-end/img/betterdocs-cat-icon.svg" alt="betterdocs-category-box-icon">';
}
echo '<div class="eael-bd-cb-cat-icon">' . wp_kses( $cat_icon, Helper::eael_allowed_icon_tags() ) . '</div>';
}
if ($settings['show_title']) {
$title_tag = Helper::eael_validate_html_tag( $settings['title_tag'] );
$title = '<' . $title_tag . ' class="eael-bd-cb-cat-title">' . $term->name . '</' . $title_tag . '>';
echo wp_kses( $title, Helper::eael_allowed_tags() );
}
if ($settings['show_count']) {
$show_count_html = '<div class="eael-bd-cb-cat-count"><span class="count-prefix">' . $settings['count_prefix'] . '</span>' . Helper::get_doc_post_count($term->count, $term->term_id) . '<span class="count-suffix">' . $settings['count_suffix'] . '</span></div>';
echo wp_kses( $show_count_html, Helper::eael_allowed_tags() );
}
echo '</div>
</a>';
@@ -0,0 +1,170 @@
<?php
use \Essential_Addons_Elementor\Classes\Helper;
/**
* Template Name: Layout 2
*
*/
echo '<article class="eael-better-docs-category-grid-post layout-2" data-id="' . esc_attr( get_the_ID() ) . '">
<div class="eael-bd-cg-inner">';
if ($settings['show_header'] === 'true') {
echo '<div class="eael-bd-cg-header">';
if ($settings['show_count']) {
echo '<div class="eael-docs-item-count" data-content="' . esc_attr( Helper::get_doc_post_count( $term->count, $term->term_id ) ) . '"></div>';
}
if ( $settings['show_title'] ) {
$title_tag = Helper::eael_validate_html_tag( $settings['title_tag'] );
$title = '<' . $title_tag . ' class="eael-docs-cat-title">' . $term->name . '</' . $title_tag . '>';
echo wp_kses( $title, Helper::eael_allowed_tags() );
}
echo '</div>';
}
if ($settings['show_list'] === 'true') {
echo '<div class="eael-bd-cg-body">';
$args = array(
'post_type' => 'docs',
'post_status' => 'publish',
'posts_per_page' => $settings['post_per_page'],
'orderby' => $settings['post_orderby'],
'order' => $settings['post_order'],
'tax_query' => array(
array(
'taxonomy' => 'doc_category',
'field' => 'slug',
'terms' => $term->slug,
'operator' => 'AND',
'include_children' => false,
),
),
);
$query = new \WP_Query($args);
if ($query->have_posts()) {
echo '<ul>';
while ($query->have_posts()) {
$query->the_post();
echo '<li>';
if (isset($settings['list_icon']['value']['url']) && !empty($settings['list_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-post-list-icon" src="' . esc_url( $settings['list_icon']['value']['url'] ). '" />';
} else {
echo '<i class="' . esc_attr( $settings['list_icon']['value'] ) . ' eael-bd-cg-post-list-icon"></i>';
}
echo '<a href="' . esc_url( get_the_permalink() ) . '">' . esc_html( get_the_title() ) . '</a>
</li>';
}
echo '</ul>';
}
wp_reset_query();
// Nested category query
if ($settings['nested_subcategory'] === 'true') {
$args = array(
'child_of' => $term->term_id,
'order' => $settings['order'],
'orderby' => $settings['orderby'],
);
$sub_categories = get_terms('doc_category', $args);
if ($sub_categories) {
foreach ($sub_categories as $sub_category) {
echo '<span class="eael-bd-grid-sub-cat-title">';
if (isset($settings['nested_list_title_closed_icon']['value']['url']) && !empty($settings['nested_list_title_closed_icon']['value']['url'])) {
echo '<img class="toggle-arrow arrow-right" src="' . esc_url( $settings['nested_list_title_closed_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['nested_list_title_closed_icon']['value'] ) . ' toggle-arrow arrow-right"></i>';
}
if (isset($settings['nested_list_title_open_icon']['value']['url']) && !empty($settings['nested_list_title_open_icon']['value']['url'])) {
echo '<img class="toggle-arrow arrow-down" src="' . esc_url( $settings['nested_list_title_open_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['nested_list_title_open_icon']['value'] ) . ' toggle-arrow arrow-down"></i>';
}
echo '<a href="#">' . esc_html( $sub_category->name ) . '</a></span>';
echo '<ul class="docs-sub-cat-list">';
$sub_args = array(
'post_type' => 'docs',
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'doc_category',
'field' => 'slug',
'terms' => $sub_category->slug,
'operator' => 'AND',
'include_children' => false,
),
),
);
$sub_args['posts_per_page'] = -1;
$sub_post_query = new \WP_Query($sub_args);
if ($sub_post_query->have_posts()):
while ($sub_post_query->have_posts()): $sub_post_query->the_post();
echo '<li class="sub-list">';
if (isset($settings['list_icon']['value']['url']) && !empty($settings['list_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-post-list-icon" src="' . esc_url( $settings['list_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['list_icon']['value'] ) . ' eael-bd-cg-post-list-icon"></i>';
}
echo '<a href="' . esc_url( get_the_permalink() ) . '">' . esc_html( get_the_title() ) . '</a></li>';
endwhile;
endif;
wp_reset_query();
echo '</ul>';
}
}
}
echo '</div>';
}
echo '<div class="eael-bd-cg-footer">';
if ($settings['show_button']) {
if ($default_multiple_kb) {
if(!empty($settings['selected_knowledge_base'])){
if(!empty($settings['selected_knowledge_base'])){
$button_link = str_replace('%knowledge_base%', $settings['selected_knowledge_base'], get_term_link($term->slug, 'doc_category'));
}else{
$button_link = str_replace('%knowledge_base%', 'non-knowledgebase', get_term_link($term->slug, 'doc_category'));
}
}else{
$button_link = str_replace('%knowledge_base%', 'non-knowledgebase', get_term_link($term->slug, 'doc_category'));
}
} else {
$button_link = get_term_link($term->slug, 'doc_category');
}
echo '<a class="eael-bd-cg-button" href="' . esc_url( $button_link ) . '">';
if ($settings['icon_position'] === 'before') {
if (isset($settings['button_icon']['value']['url']) && !empty($settings['button_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-button-icon eael-bd-cg-button-icon-left" src="' . esc_url( $settings['button_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['button_icon']['value'] ) . ' eael-bd-cg-button-icon eael-bd-cg-button-icon-left"></i>';
}
}
echo wp_kses( $settings['button_text'], Helper::eael_allowed_tags() );
if ($settings['icon_position'] === 'after') {
if (isset($settings['button_icon']['value']['url']) && !empty($settings['button_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-button-icon eael-bd-cg-button-icon-right" src="' . esc_url( $settings['button_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['button_icon']['value'] ) . ' eael-bd-cg-button-icon eael-bd-cg-button-icon-right"></i>';
}
}
echo '</a>';
}
echo '</div>
</div>
</article>';
@@ -0,0 +1,228 @@
<?php
use \Essential_Addons_Elementor\Classes\Helper;
/**
* Template Name: Default
*
*/
echo '<article class="eael-better-docs-category-grid-post" data-id="' . esc_attr( get_the_ID() ) . '">
<div class="eael-bd-cg-inner">';
if ($settings['show_header'] === 'true') {
echo '<div class="eael-bd-cg-header">
<div class="eael-bd-cg-header-inner">';
if ($settings['show_icon']) {
$cat_icon_id = get_term_meta($term->term_id, 'doc_category_image-id', true);
if ($cat_icon_id) {
$cat_icon = wp_get_attachment_image($cat_icon_id, 'thumbnail', true, ['alt' => esc_attr( get_post_meta($cat_icon_id, '_wp_attachment_image_alt', true))]);
} else {
$cat_icon = '<img src="' . EAEL_PLUGIN_URL . 'assets/front-end/img/betterdocs-cat-icon.svg" alt="betterdocs-category-grid-icon">';
}
echo '<div class="eael-docs-cat-icon">' . wp_kses( $cat_icon, Helper::eael_allowed_icon_tags() ) . '</div>';
}
$html = '';
if ( $settings['show_title'] ) {
$title_tag = Helper::eael_validate_html_tag( $settings['title_tag'] );
$html .= '<' . $title_tag . ' class="eael-docs-cat-title">' . $term->name . '</' . $title_tag . '>';
}
if ( $settings['show_count'] ) {
$html .= '<div class="eael-docs-item-count">' . Helper::get_doc_post_count( $term->count, $term->term_id ) . '</div>';
}
if( $html ) {
echo wp_kses( $html, Helper::eael_allowed_tags() );
}
echo '</div>
</div>';
}
if ($settings['show_list'] === 'true') {
echo '<div class="eael-bd-cg-body">';
$multiple_kb = Helper::get_betterdocs_multiple_kb_status();
if ($multiple_kb == true) {
$taxes = array('knowledge_base', 'doc_category');
foreach ($taxes as $tax) {
$kterms = get_terms($tax);
if (!is_wp_error($kterms)) {
foreach ($kterms as $kterm) {
$tax_map[$tax][$kterm->slug] = $kterm->term_taxonomy_id;
}
}
}
$args = array(
'post_type' => 'docs',
'post_status' => 'publish',
'posts_per_page' => $settings['post_per_page'],
'orderby' => $settings['post_orderby'],
'order' => $settings['post_order'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'doc_category',
'field' => 'term_taxonomy_id',
'operator' => 'IN',
'terms' => array($tax_map['doc_category'][$term->slug]),
'include_children' => false,
),
),
);
if(!empty($settings['selected_knowledge_base'])){
$args['tax_query'][] = array(
'taxonomy' => 'knowledge_base',
'field' => 'term_taxonomy_id',
'terms' => array($tax_map['knowledge_base'][$settings['selected_knowledge_base']]),
'operator' => 'IN',
'include_children' => false,
);
}
} else {
$args = array(
'post_type' => 'docs',
'post_status' => 'publish',
'posts_per_page' => $settings['post_per_page'],
'orderby' => $settings['post_orderby'],
'order' => $settings['post_order'],
'tax_query' => array(
array(
'taxonomy' => 'doc_category',
'field' => 'slug',
'terms' => $term->slug,
'operator' => 'AND',
'include_children' => false,
),
),
);
}
$query = new \WP_Query($args);
if ($query->have_posts()) {
echo '<ul>';
while ($query->have_posts()) {
$query->the_post();
echo '<li>';
if (isset($settings['list_icon']['value']['url']) && !empty($settings['list_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-post-list-icon" src="' . esc_url( $settings['list_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['list_icon']['value'] ) . ' eael-bd-cg-post-list-icon"></i>';
}
echo '<a href="' . esc_url( get_the_permalink() ) . '">' . esc_html( get_the_title() ) . '</a>
</li>';
}
echo '</ul>';
}
wp_reset_query();
// Nested category query
if ($settings['nested_subcategory'] === 'true') {
$args = array(
'child_of' => $term->term_id,
'order' => $settings['order'],
'orderby' => $settings['orderby'],
);
$sub_categories = get_terms('doc_category', $args);
if ($sub_categories) {
foreach ($sub_categories as $sub_category) {
echo '<span class="eael-bd-grid-sub-cat-title">';
if (isset($settings['nested_list_title_closed_icon']['value']['url']) && !empty($settings['nested_list_title_closed_icon']['value']['url'])) {
echo '<img class="toggle-arrow arrow-right" src="' . esc_url( $settings['nested_list_title_closed_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['nested_list_title_closed_icon']['value'] ) . ' toggle-arrow arrow-right"></i>';
}
if (isset($settings['nested_list_title_open_icon']['value']['url']) && !empty($settings['nested_list_title_open_icon']['value']['url'])) {
echo '<img class="toggle-arrow arrow-down" src="' . esc_url( $settings['nested_list_title_open_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['nested_list_title_open_icon']['value'] ) . ' toggle-arrow arrow-down"></i>';
}
echo '<a href="#">' . esc_html( $sub_category->name ) . '</a></span>';
echo '<ul class="docs-sub-cat-list">';
$sub_args = array(
'post_type' => 'docs',
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'doc_category',
'field' => 'slug',
'terms' => $sub_category->slug,
'operator' => 'AND',
'include_children' => false,
),
),
);
$sub_args['posts_per_page'] = -1;
$sub_post_query = new \WP_Query($sub_args);
if ($sub_post_query->have_posts()):
while ($sub_post_query->have_posts()): $sub_post_query->the_post();
$sub_attr = [''];
echo '<li class="sub-list">';
if (isset($settings['list_icon']['value']['url']) && !empty($settings['list_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-post-list-icon" src="' . esc_url( $settings['list_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['list_icon']['value'] ) . ' eael-bd-cg-post-list-icon"></i>';
}
echo '<a href="' . esc_url( get_the_permalink() ) . '">' . esc_html( get_the_title() ) . '</a></li>';
endwhile;
endif;
wp_reset_query();
echo '</ul>';
}
}
}
echo '</div>';
}
echo '<div class="eael-bd-cg-footer">';
if ($settings['show_button']) {
if ($default_multiple_kb) {
if(!empty($settings['selected_knowledge_base'])){
$button_link = str_replace('%knowledge_base%', $settings['selected_knowledge_base'], get_term_link($term->slug, 'doc_category'));
}else{
$button_link = str_replace('%knowledge_base%', 'non-knowledgebase', get_term_link($term->slug, 'doc_category'));
}
} else {
$button_link = get_term_link($term->slug, 'doc_category');
}
echo '<a class="eael-bd-cg-button" href="' . esc_url( $button_link ) . '">';
if ($settings['icon_position'] === 'before') {
if (isset($settings['button_icon']['value']['url']) && !empty($settings['button_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-button-icon eael-bd-cg-button-icon-left" src="' . esc_url( $settings['button_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['button_icon']['value'] ) . ' eael-bd-cg-button-icon eael-bd-cg-button-icon-left"></i>';
}
}
echo wp_kses( $settings['button_text'], Helper::eael_allowed_tags() );
if ($settings['icon_position'] === 'after') {
if (isset($settings['button_icon']['value']['url']) && !empty($settings['button_icon']['value']['url'])) {
echo '<img class="eael-bd-cg-button-icon eael-bd-cg-button-icon-right" src="' . esc_url( $settings['button_icon']['value']['url'] ) . '" />';
} else {
echo '<i class="' . esc_attr( $settings['button_icon']['value'] ) . ' eael-bd-cg-button-icon eael-bd-cg-button-icon-right"></i>';
}
}
echo '</a>';
}
echo '</div>';
echo '</div>';
echo '</article>';
@@ -0,0 +1,42 @@
<?php
use Essential_Addons_Elementor\Classes\Helper;
/**
* Template Name: Default
*/
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly
if (isset($content) && isset($link)) {
echo '<div class="swiper-slide">
<div class="ticker-content">';
if (!empty($link['url'])) {
echo '<a href="' . esc_url( $link['url'] ) . '" ';
if ($link['is_external'] == 'on') {
echo 'target="_blank" ';
}
if ($link['nofollow'] == 'on') {
echo 'rel="nofollow"';
}
echo '>';
}
echo wp_kses( $content, Helper::eael_allowed_tags() );
if (!empty($link['url'])) {
echo '</a>';
}
echo '</div>
</div>';
} else {
echo '<div class="swiper-slide">
<div class="ticker-content">
<a href="' . esc_url( get_the_permalink() ) . '" class="ticker-content-link">' . wp_kses( get_the_title(), Helper::eael_allowed_tags() ) . '</a>
</div>
</div>';
}
@@ -0,0 +1,125 @@
<?php
namespace Essential_Addons_Elementor\Template\Content;
use Essential_Addons_Elementor\Classes\Helper;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
trait Product_Grid {
public static function render_template_( $args, $settings ) {
$query = new \WP_Query( $args );
ob_start();
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$product = wc_get_product( get_the_ID() );
// Get secondary image data for hover effect
$show_secondary_image = isset( $settings['eael_product_grid_show_secondary_image'] ) && 'yes' === $settings['eael_product_grid_show_secondary_image'];
$image_sources = [
'src' => '',
'src_hover' => ''
];
if( $show_secondary_image ){
$image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, 'woocommerce_thumbnail' );
}
if ( $settings['eael_product_grid_style_preset'] == 'eael-product-simple' || $settings['eael_product_grid_style_preset'] == 'eael-product-reveal' ) { ?>
<li class="product">
<div class="eael-product-wrap" data-src="<?php echo esc_url( $image_sources['src'] ); ?>" data-src-hover="<?php echo esc_url( $image_sources['src_hover'] ); ?>">
<a href="<?php echo esc_url( $product->get_permalink() ); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">
<?php echo wp_kses_post( $product->get_image( 'woocommerce_thumbnail' )); ?>
<h2 class="woocommerce-loop-product__title"> <?php echo esc_html( $product->get_title()); ?> </h2>
<?php
if ( 'yes' === $settings['eael_product_grid_rating'] ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
if ( ! $product->managing_stock() && ! $product->is_in_stock() ) {
printf( '<span class="outofstock-badge">%s <br/> %s</span>', esc_html__( 'Stock', 'essential-addons-for-elementor-lite' ), esc_html__( 'Out', 'essential-addons-for-elementor-lite' ) );
} elseif ( $product->is_on_sale() ) {
printf( '<span class="onsale">%s</span>', esc_html__( 'Sale!', 'essential-addons-for-elementor-lite' ) );
}
?>
<span class="price"><?php echo wp_kses_post( $product->get_price_html()); ?></span>
</a>
<?php
woocommerce_template_loop_add_to_cart();
if ( isset( $settings['show_compare']) && 'yes' === $settings['show_compare'] ) {
self::print_compare_button( $product->get_id() );
}
?>
</div>
</li>
<?php
} else if ( $settings['eael_product_grid_style_preset'] == 'eael-product-overlay' ) {
?>
<li class="product">
<div class="eael-product-wrap" data-src="<?php echo esc_url( $image_sources['src'] ); ?>" data-src-hover="<?php echo esc_url( $image_sources['src_hover'] ); ?>">
<div class="overlay">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $product->get_image( 'woocommerce_thumbnail' ); ?>
<div class="button-wrap clearfix">
<a href="<?php echo esc_url( $product->get_permalink()); ?>" class="product-link"><span class="fas fa-link"></span></a>
<?php
woocommerce_template_loop_add_to_cart();
if ( isset( $settings['show_compare']) && 'yes' === $settings['show_compare'] ) {
self::print_compare_button( $product->get_id(), 'icon' );
}
?>
</div>
</div>
<h2 class="woocommerce-loop-product__title"><?php echo esc_html( $product->get_title()); ?></h2>
<?php
if ( 'yes' === $settings['eael_product_grid_rating'] ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
if ($product->is_on_sale()){
printf( '<span class="onsale">%s</span>', esc_html__( 'Sale!', 'essential-addons-for-elementor-lite' ));
}
?>
<span class="price"> <?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $product->get_price_html(); ?> </span>
</div>
</li>
<?php
} else {
if ( isset( $settings['show_compare']) && 'yes' === $settings['show_compare'] ) {
add_action( 'woocommerce_after_shop_loop_item', function (){
global $product;
if (!$product) return;
self::print_compare_button( $product->get_id() );
});
}
wc_get_template_part( 'content', 'product' );
}
}
} else {
printf( '<p class="no-posts-found">%</p>', esc_html__( 'No products found!', 'essential-addons-for-elementor-lite' ) );
}
wp_reset_postdata();
?>
<?php
return ob_get_clean();
}
}
@@ -0,0 +1,112 @@
<?php
namespace Essential_Addons_Elementor\Template\Content;
use Essential_Addons_Elementor\Classes\Helper;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
trait Woo_Product_List {
public static function render_template_( $args, $settings ) {
$query = new \WP_Query( $args );
ob_start();
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$product = wc_get_product( get_the_ID() );
if ( $settings['eael_woo_product_list_style_preset'] == 'eael-product-simple' || $settings['eael_woo_product_list_style_preset'] == 'eael-product-reveal' ) { ?>
<li class="product">
<a href="<?php echo esc_url( $product->get_permalink() ); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">
<?php echo wp_kses_post( $product->get_image( 'woocommerce_thumbnail' )); ?>
<h2 class="woocommerce-loop-product__title"> <?php echo esc_html( $product->get_title()); ?> </h2>
<?php
if ( 'yes' === $settings['eael_woo_product_list_rating'] ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
if ( ! $product->managing_stock() && ! $product->is_in_stock() ) {
printf( '<span class="outofstock-badge">%s <br/> %s</span>', esc_html__( 'Stock', 'essential-addons-for-elementor-lite' ), esc_html__( 'Out', 'essential-addons-for-elementor-lite' ) );
} elseif ( $product->is_on_sale() ) {
printf( '<span class="onsale">%s</span>', esc_html__( 'Sale!', 'essential-addons-for-elementor-lite' ) );
}
?>
<span class="price"><?php echo wp_kses_post( $product->get_price_html()); ?></span>
</a>
<?php
woocommerce_template_loop_add_to_cart();
if ( isset( $settings['show_compare']) && 'yes' === $settings['show_compare'] ) {
self::print_compare_button( $product->get_id() );
}
?>
</li>
<?php
} else if ( $settings['eael_woo_product_list_style_preset'] == 'eael-product-overlay' ) {
?>
<li class="product">
<div class="overlay">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $product->get_image( 'woocommerce_thumbnail' ); ?>
<div class="button-wrap clearfix">
<a href="<?php echo esc_url( $product->get_permalink()); ?>" class="product-link"><span class="fas fa-link"></span></a>
<?php
woocommerce_template_loop_add_to_cart();
if ( isset( $settings['show_compare']) && 'yes' === $settings['show_compare'] ) {
self::print_compare_button( $product->get_id(), 'icon' );
}
?>
</div>
</div>
<h2 class="woocommerce-loop-product__title"><?php echo esc_html( $product->get_title()); ?></h2>
<?php
if ( 'yes' === $settings['eael_woo_product_list_rating'] ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
if ($product->is_on_sale()){
printf( '<span class="onsale">%s</span>', esc_html__( 'Sale!', 'essential-addons-for-elementor-lite' ));
}
?>
<span class="price"> <?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $product->get_price_html(); ?> </span>
</li>
<?php
} else {
if ( isset( $settings['show_compare']) && 'yes' === $settings['show_compare'] ) {
add_action( 'woocommerce_after_shop_loop_item', function (){
global $product;
if (!$product) return;
self::print_compare_button( $product->get_id() );
});
}
wc_get_template_part( 'content', 'product' );
}
}
} else {
printf( '<p class="no-posts-found">%</p>', esc_html__( 'No products found!', 'essential-addons-for-elementor-lite' ) );
}
wp_reset_postdata();
?>
<?php
return ob_get_clean();
}
}
@@ -0,0 +1,126 @@
<?php
/**
* Template Name: Default
*/
use \Essential_Addons_Elementor\Classes\Helper;
use Essential_Addons_Elementor\Elements\Product_Grid;
use \Elementor\Group_Control_Image_Size;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
$product = wc_get_product( get_the_ID() );
if ( ! $product ) {
error_log( '$product not found in ' . __FILE__ );
return;
}
if ( has_post_thumbnail() ) {
$settings[ 'eael_image_size_customize' ] = [
'id' => get_post_thumbnail_id(),
];
$settings['eael_image_size_customize_size'] = $settings['eael_product_grid_image_size_size'];
$thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
}
$title_tag = isset( $settings['eael_product_grid_title_html_tag'] ) ? Helper::eael_validate_html_tag($settings['eael_product_grid_title_html_tag']) : 'h2';
$should_print_compare_btn = isset( $settings['show_compare'] ) && 'yes' === $settings['show_compare'];
if ( function_exists( 'YITH_WCWL' ) ) {
$should_print_wishlist_btn = isset( $settings['eael_product_grid_wishlist'] ) && 'yes' === $settings['eael_product_grid_wishlist'];
}
// Improvement
$grid_style_preset = isset($settings['eael_product_grid_style_preset']) ? $settings['eael_product_grid_style_preset'] : '';
$list_style_preset = isset($settings['eael_product_list_style_preset']) ? $settings['eael_product_list_style_preset'] : '';
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? esc_attr( $settings['eael_product_sale_badge_alignment'] ) : '';
$sale_badge_preset = isset( $settings['eael_product_sale_badge_preset'] ) ? esc_attr( $settings['eael_product_sale_badge_preset'] ) : '';
// should print vars
$should_print_rating = isset( $settings['eael_product_grid_rating'] ) && 'yes' === $settings['eael_product_grid_rating'];
$should_print_quick_view = isset( $settings['eael_product_grid_quick_view'] ) && 'yes' === $settings['eael_product_grid_quick_view'];
$should_print_image_clickable = isset( $settings['eael_product_grid_image_clickable'] ) && 'yes' === $settings['eael_product_grid_image_clickable'];
$should_print_price = isset( $settings['eael_product_grid_price'] ) && 'yes' === $settings['eael_product_grid_price'];
$should_print_excerpt = isset( $settings['eael_product_grid_excerpt'] ) && ('yes' === $settings['eael_product_grid_excerpt'] && has_excerpt());
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : '';
$sale_badge_text = !empty($settings['eael_product_sale_text']) ? $settings['eael_product_sale_text'] : __( 'Sale!', 'essential-addons-for-elementor-lite' );
$stock_out_badge_text = !empty($settings['eael_product_stockout_text']) ?$settings['eael_product_stockout_text'] : __( 'Stock <br/> Out', 'essential-addons-for-elementor-lite' );
$is_show_badge = $settings['eael_show_product_sale_badge'];
$quick_view_setting = [
'widget_id' => $widget_id,
'product_id' => $product->get_id(),
'page_id' => $settings['eael_page_id'],
];
$product_wrapper_classes = implode( " ", apply_filters( 'eael_product_wrapper_class', [], $product->get_id(), 'eicon-woocommerce' ) );
$product_data = [
'id' => get_the_ID(),
'title' => '<div class="eael-product-title">
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">' .
sprintf( '<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, $product->get_title() )
. '</a></div>',
'ratings' => $should_print_rating ? wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) : '',
'price' => $should_print_price ? '<div class="eael-product-price">' . $product->get_price_html() . '</div>' : ''
];
if ( $should_print_rating ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
$product_data['ratings'] = wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
$product_data['ratings'] = Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
if ( 'yes' !== $settings['eael_product_grid_rating'] ) {
remove_action('woocommerce_after_shop_loop_item_title','woocommerce_template_loop_rating',5);
}
add_action('woocommerce_before_shop_loop_item_title', function() use ( $stock_out_badge_text ) {
global $product;
if ( ! $product->is_in_stock() ) {
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<span class="outofstock-badge">'. $stock_out_badge_text .'</span>';
}
}, 9 );
add_filter('woocommerce_sale_flash', function($text, $post, $product) use( $sale_badge_text ) {
return '<span class="onsale" data-notification="default">'. $sale_badge_text .'</span>';
}, 10, 3);
if ( $should_print_compare_btn ) {
add_action( 'woocommerce_after_shop_loop_item', [
'\Essential_Addons_Elementor\Elements\Product_Grid',
'print_compare_button',
] );
}
$thumb_size = isset($settings['eael_product_grid_image_size_size']) ? $settings['eael_product_grid_image_size_size'] : '';
global $eael_thumb_default;
add_filter( 'single_product_archive_thumbnail_size', function( $size ) use ( $thumb_size ) {
global $eael_thumb_default;
$eael_thumb_default = $size;
return ! empty( $thumb_size ) ? $thumb_size : $size ;
} );
wc_get_template_part( 'content', 'product' );
add_filter( 'single_product_archive_thumbnail_size', function( $size ) {
global $eael_thumb_default;
return ! empty( $eael_thumb_default ) ? $eael_thumb_default : $size;
} );
if ( $should_print_compare_btn ) {
remove_action( 'woocommerce_after_shop_loop_item', [
'\Essential_Addons_Elementor\Elements\Product_Grid',
'print_compare_button',
] );
}
@@ -0,0 +1,161 @@
<?php
/**
* Template Name: List Preset 1
*/
use \Essential_Addons_Elementor\Classes\Helper;
use Essential_Addons_Elementor\Elements\Product_Grid;
use \Elementor\Group_Control_Image_Size;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
$product = wc_get_product( get_the_ID() );
if ( ! $product ) {
error_log( '$product not found in ' . __FILE__ );
return;
}
if ( has_post_thumbnail() ) {
$settings[ 'eael_image_size_customize' ] = [
'id' => get_post_thumbnail_id(),
];
$settings['eael_image_size_customize_size'] = $settings['eael_product_grid_image_size_size'];
$thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
}
$title_tag = isset( $settings['eael_product_grid_title_html_tag'] ) ? Helper::eael_validate_html_tag($settings['eael_product_grid_title_html_tag']) : 'h2';
$should_print_compare_btn = isset( $settings['show_compare'] ) && 'yes' === $settings['show_compare'];
if ( function_exists( 'YITH_WCWL' ) ) {
$should_print_wishlist_btn = isset( $settings['eael_product_grid_wishlist'] ) && 'yes' === $settings['eael_product_grid_wishlist'];
}
// Improvement
$grid_style_preset = isset($settings['eael_product_grid_style_preset']) ? $settings['eael_product_grid_style_preset'] : '';
$list_style_preset = isset($settings['eael_product_list_style_preset']) ? $settings['eael_product_list_style_preset'] : '';
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? esc_attr( $settings['eael_product_sale_badge_alignment'] ) : '';
$sale_badge_preset = isset( $settings['eael_product_sale_badge_preset'] ) ? esc_attr( $settings['eael_product_sale_badge_preset'] ) : '';
// should print vars
$should_print_rating = isset( $settings['eael_product_grid_rating'] ) && 'yes' === $settings['eael_product_grid_rating'];
$should_print_quick_view = isset( $settings['eael_product_grid_quick_view'] ) && 'yes' === $settings['eael_product_grid_quick_view'];
$should_print_image_clickable = isset( $settings['eael_product_grid_image_clickable'] ) && 'yes' === $settings['eael_product_grid_image_clickable'];
$should_print_price = isset( $settings['eael_product_grid_price'] ) && 'yes' === $settings['eael_product_grid_price'];
$should_print_excerpt = isset( $settings['eael_product_grid_excerpt'] ) && ('yes' === $settings['eael_product_grid_excerpt'] && has_excerpt());
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
$sale_badge_text = !empty($settings['eael_product_sale_text']) ? $settings['eael_product_sale_text'] : __( 'Sale!', 'essential-addons-for-elementor-lite' );
$stock_out_badge_text = !empty($settings['eael_product_stockout_text']) ?$settings['eael_product_stockout_text'] : __( 'Stock <br/> Out', 'essential-addons-for-elementor-lite' );
$is_show_badge = $settings['eael_show_product_sale_badge'];
$quick_view_setting = [
'widget_id' => $widget_id,
'product_id' => $product->get_id(),
'page_id' => $settings['eael_page_id'],
];
$product_wrapper_classes = implode( " ", apply_filters( 'eael_product_wrapper_class', [], $product->get_id(), 'eicon-woocommerce' ) );
$product_data = [
'id' => get_the_ID(),
'title' => '<div class="eael-product-title">
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">' .
sprintf( '<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, $product->get_title() )
. '</a></div>',
'ratings' => $should_print_rating ? wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) : '',
'price' => $should_print_price ? '<div class="eael-product-price">' . $product->get_price_html() . '</div>' : ''
];
if ( $should_print_rating ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
$product_data['ratings'] = wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
$product_data['ratings'] = Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
?>
<li class="product <?php echo esc_attr( "{$product_wrapper_classes} {$list_style_preset}" ) ?>">
<div class="eael-product-wrap">
<div class="product-image-wrap">
<div class="image-wrap">
<?php
if( $should_print_image_clickable ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
}
if ( $is_show_badge ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . $stock_out_badge_text . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . $sale_badge_text . '</span>' : '' ) );
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wp_kses_post( $product->get_image( $settings['eael_product_grid_image_size_size'], [ 'loading' => 'eager' ] ) );
if( $should_print_image_clickable ) {
echo '</a>';
}
?>
</div>
</div>
<div class="product-details-wrap">
<?php
do_action( 'eael_woocommerce_before_shop_loop_item' );
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
do_action( 'woocommerce_before_shop_loop_item' );
}
$_product_data['id'] = $product_data['id'];
$_product_data['title'] = $product_data['title'];
$_product_data['price'] = $product_data['price'];
$_product_data['ratings'] = $product_data['ratings'];
$_product_data['description'] = $should_print_excerpt ? '<div class="eael-product-excerpt">
<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_grid_excerpt_length'], $settings['eael_product_grid_excerpt_expanison_indicator'] ) . '</p></div>' : '';
$product_data = apply_filters( 'eael/product-grid/content/reordering', $_product_data, $settings, $product );
unset( $product_data['id'] );
if ( ! empty( $product_data ) ) {
foreach ( $product_data as $content ) {
if ( ! empty( $content ) ) {
echo wp_kses( $content, Helper::eael_allowed_tags(), Helper::eael_allowed_protocols() );
}
}
}
?>
<ul class="icons-wrap <?php echo esc_attr( $settings['eael_product_action_buttons_preset'] ); ?>">
<?php
if ( $should_print_compare_btn ) {
echo '<li class="add-to-compare">';
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
echo '</li>';
}
?>
<li class="add-to-cart"><?php
woocommerce_template_loop_add_to_cart(); ?></li>
<?php
if ( ! empty( $should_print_wishlist_btn ) ) {
echo '<li class="add-to-whishlist">';
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
echo '</li>';
}
?>
<?php
if( $should_print_quick_view ){?>
<li class="eael-product-quick-view">
<a id="eael_quick_view_<?php echo esc_attr( uniqid() ); ?>" data-quickview-setting="<?php echo esc_attr( htmlspecialchars(wp_json_encode($quick_view_setting),ENT_QUOTES) ); ?>"
class="eael-product-grid-open-popup open-popup-link">
<i class="fas fa-eye"></i>
</a>
</li>
<?php } ?>
</ul>
<?php
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
do_action( 'woocommerce_after_shop_loop_item' );
}
do_action( 'eael_woocommerce_after_shop_loop_item' );
?>
</div>
</div>
</li>
@@ -0,0 +1,161 @@
<?php
/**
* Template Name: List Preset 2
*/
use \Essential_Addons_Elementor\Classes\Helper;
use Essential_Addons_Elementor\Elements\Product_Grid;
use \Elementor\Group_Control_Image_Size;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
$product = wc_get_product( get_the_ID() );
if ( ! $product ) {
error_log( '$product not found in ' . __FILE__ );
return;
}
if ( has_post_thumbnail() ) {
$settings[ 'eael_image_size_customize' ] = [
'id' => get_post_thumbnail_id(),
];
$settings['eael_image_size_customize_size'] = $settings['eael_product_grid_image_size_size'];
$thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
}
$title_tag = isset( $settings['eael_product_grid_title_html_tag'] ) ? Helper::eael_validate_html_tag($settings['eael_product_grid_title_html_tag']) : 'h2';
$should_print_compare_btn = isset( $settings['show_compare'] ) && 'yes' === $settings['show_compare'];
if ( function_exists( 'YITH_WCWL' ) ) {
$should_print_wishlist_btn = isset( $settings['eael_product_grid_wishlist'] ) && 'yes' === $settings['eael_product_grid_wishlist'];
}
// Improvement
$grid_style_preset = isset($settings['eael_product_grid_style_preset']) ? $settings['eael_product_grid_style_preset'] : '';
$list_style_preset = isset($settings['eael_product_list_style_preset']) ? $settings['eael_product_list_style_preset'] : '';
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? esc_attr( $settings['eael_product_sale_badge_alignment'] ) : '';
$sale_badge_preset = isset( $settings['eael_product_sale_badge_preset'] ) ? esc_attr( $settings['eael_product_sale_badge_preset'] ) : '';
// should print vars
$should_print_rating = isset( $settings['eael_product_grid_rating'] ) && 'yes' === $settings['eael_product_grid_rating'];
$should_print_quick_view = isset( $settings['eael_product_grid_quick_view'] ) && 'yes' === $settings['eael_product_grid_quick_view'];
$should_print_image_clickable = isset( $settings['eael_product_grid_image_clickable'] ) && 'yes' === $settings['eael_product_grid_image_clickable'];
$should_print_price = isset( $settings['eael_product_grid_price'] ) && 'yes' === $settings['eael_product_grid_price'];
$should_print_excerpt = isset( $settings['eael_product_grid_excerpt'] ) && ('yes' === $settings['eael_product_grid_excerpt'] && has_excerpt());
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
$sale_badge_text = !empty($settings['eael_product_sale_text']) ? $settings['eael_product_sale_text'] : __( 'Sale!', 'essential-addons-for-elementor-lite' );
$stock_out_badge_text = !empty($settings['eael_product_stockout_text']) ?$settings['eael_product_stockout_text'] : __( 'Stock <br/> Out', 'essential-addons-for-elementor-lite' );
$is_show_badge = $settings['eael_show_product_sale_badge'];
$quick_view_setting = [
'widget_id' => $widget_id,
'product_id' => $product->get_id(),
'page_id' => $settings['eael_page_id'],
];
$product_wrapper_classes = implode( " ", apply_filters( 'eael_product_wrapper_class', [], $product->get_id(), 'eicon-woocommerce' ) );
$product_data = [
'id' => get_the_ID(),
'title' => '<div class="eael-product-title">
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">' .
sprintf( '<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, $product->get_title() )
. '</a></div>',
'ratings' => $should_print_rating ? wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) : '',
'price' => $should_print_price ? '<div class="eael-product-price">' . $product->get_price_html() . '</div>' : ''
];
if ( $should_print_rating ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
$product_data['ratings'] = wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
$product_data['ratings'] = Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
?>
<li class="product <?php echo esc_attr( "{$product_wrapper_classes} {$list_style_preset}" ) ?>">
<div class="eael-product-wrap">
<div class="product-image-wrap">
<div class="image-wrap">
<?php
if( $should_print_image_clickable ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
}
if ( $is_show_badge ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . $stock_out_badge_text . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . $sale_badge_text . '</span>' : '' ) );
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $product->get_image( $settings['eael_product_grid_image_size_size'], [ 'loading' => 'eager' ] );
if( $should_print_image_clickable ) {
echo '</a>';
}
?>
</div>
</div>
<div class="product-details-wrap">
<?php
do_action( 'eael_woocommerce_before_shop_loop_item' );
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
do_action( 'woocommerce_before_shop_loop_item' );
}
$_product_data['id'] = $product_data['id'];
$_product_data['title'] = $product_data['title'];
$_product_data['description'] = $should_print_excerpt ? '<div class="eael-product-excerpt">
<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_grid_excerpt_length'], $settings['eael_product_grid_excerpt_expanison_indicator'] ) . '</p></div>' : '';
$_product_data['price'] = $product_data['price'];
$_product_data['ratings'] = $product_data['ratings'];
$product_data = apply_filters( 'eael/product-grid/content/reordering', $_product_data, $settings, $product );
unset( $product_data['id'] );
if ( ! empty( $product_data ) ) {
foreach ( $product_data as $content ) {
if ( ! empty( $content ) ) {
echo wp_kses( $content, Helper::eael_allowed_tags(), Helper::eael_allowed_protocols() );
}
}
}
?>
<ul class="icons-wrap <?php echo esc_attr( $settings['eael_product_action_buttons_preset'] ); ?>">
<?php
if ( $should_print_compare_btn ) {
echo '<li class="add-to-compare">';
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
echo '</li>';
}
?>
<li class="add-to-cart"><?php
woocommerce_template_loop_add_to_cart(); ?></li>
<?php
if ( ! empty( $should_print_wishlist_btn ) ) {
echo '<li class="add-to-whishlist">';
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
echo '</li>';
}
?>
<?php
if( $should_print_quick_view ){?>
<li class="eael-product-quick-view">
<a id="eael_quick_view_<?php echo esc_attr( uniqid() ); ?>" data-quickview-setting="<?php echo esc_attr( htmlspecialchars(wp_json_encode($quick_view_setting),ENT_QUOTES) ); ?>"
class="eael-product-grid-open-popup open-popup-link">
<i class="fas fa-eye"></i>
</a>
</li>
<?php } ?>
</ul>
<?php
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
do_action( 'woocommerce_after_shop_loop_item' );
}
do_action( 'eael_woocommerce_after_shop_loop_item' );
?>
</div>
</div>
</li>
@@ -0,0 +1,190 @@
<?php
/**
* Template Name: List Preset 3
*/
use \Essential_Addons_Elementor\Classes\Helper;
use Essential_Addons_Elementor\Elements\Product_Grid;
use \Elementor\Group_Control_Image_Size;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
$product = wc_get_product( get_the_ID() );
if ( ! $product ) {
error_log( '$product not found in ' . __FILE__ );
return;
}
if ( has_post_thumbnail() ) {
$settings[ 'eael_image_size_customize' ] = [
'id' => get_post_thumbnail_id(),
];
$settings['eael_image_size_customize_size'] = $settings['eael_product_grid_image_size_size'];
$thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
}
$title_tag = isset( $settings['eael_product_grid_title_html_tag'] ) ? Helper::eael_validate_html_tag($settings['eael_product_grid_title_html_tag']) : 'h2';
$should_print_compare_btn = isset( $settings['show_compare'] ) && 'yes' === $settings['show_compare'];
if ( function_exists( 'YITH_WCWL' ) ) {
$should_print_wishlist_btn = isset( $settings['eael_product_grid_wishlist'] ) && 'yes' === $settings['eael_product_grid_wishlist'];
}
// Improvement
$grid_style_preset = isset($settings['eael_product_grid_style_preset']) ? $settings['eael_product_grid_style_preset'] : '';
$list_style_preset = isset($settings['eael_product_list_style_preset']) ? $settings['eael_product_list_style_preset'] : '';
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? esc_attr( $settings['eael_product_sale_badge_alignment'] ) : '';
$sale_badge_preset = isset( $settings['eael_product_sale_badge_preset'] ) ? esc_attr( $settings['eael_product_sale_badge_preset'] ) : '';
// should print vars
$should_print_rating = isset( $settings['eael_product_grid_rating'] ) && 'yes' === $settings['eael_product_grid_rating'];
$should_print_quick_view = isset( $settings['eael_product_grid_quick_view'] ) && 'yes' === $settings['eael_product_grid_quick_view'];
$should_print_image_clickable = isset( $settings['eael_product_grid_image_clickable'] ) && 'yes' === $settings['eael_product_grid_image_clickable'];
$should_print_price = isset( $settings['eael_product_grid_price'] ) && 'yes' === $settings['eael_product_grid_price'];
$should_print_excerpt = isset( $settings['eael_product_grid_excerpt'] ) && ('yes' === $settings['eael_product_grid_excerpt'] && has_excerpt());
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
$sale_badge_text = !empty($settings['eael_product_sale_text']) ? $settings['eael_product_sale_text'] : __( 'Sale!', 'essential-addons-for-elementor-lite' );
$stock_out_badge_text = !empty($settings['eael_product_stockout_text']) ?$settings['eael_product_stockout_text'] : __( 'Stock <br/> Out', 'essential-addons-for-elementor-lite' );
$is_show_badge = $settings['eael_show_product_sale_badge'];
$quick_view_setting = [
'widget_id' => $widget_id,
'product_id' => $product->get_id(),
'page_id' => $settings['eael_page_id'],
];
$product_wrapper_classes = implode( " ", apply_filters( 'eael_product_wrapper_class', [], $product->get_id(), 'eicon-woocommerce' ) );
$product_data = [
'id' => get_the_ID(),
'title' => '<div class="eael-product-title">
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">' .
sprintf( '<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, $product->get_title() )
. '</a></div>',
'ratings' => $should_print_rating ? wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) : '',
'price' => $should_print_price ? '<div class="eael-product-price">' . $product->get_price_html() . '</div>' : ''
];
if ( $should_print_rating ) {
$avg_rating = $product->get_average_rating();
if( $avg_rating > 0 ){
$product_data['ratings'] = wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
} else {
$product_data['ratings'] = Helper::eael_rating_markup( $product->get_average_rating(), $product->get_rating_count() );
}
}
?>
<li class="product <?php echo esc_attr( "{$product_wrapper_classes} {$list_style_preset}" ) ?>">
<div class="eael-product-wrap">
<div class="product-image-wrap">
<div class="image-wrap">
<?php
if( $should_print_image_clickable ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
}
if ( $is_show_badge ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . $stock_out_badge_text . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . $sale_badge_text . '</span>' : '' ) );
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wp_kses_post( $product->get_image( $settings['eael_product_grid_image_size_size'], [ 'loading' => 'eager' ] ) );
if( $should_print_image_clickable ) {
echo '</a>';
}
?>
</div>
</div>
<div class="product-details-wrap">
<?php
do_action( 'eael_woocommerce_before_shop_loop_item' );
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
do_action( 'woocommerce_before_shop_loop_item' );
}
$_product_data['id'] = $product_data['id'];
if ( isset( $settings['enable_eael_layout_custom_ordering'] ) && $settings['enable_eael_layout_custom_ordering'] === 'yes' ){
$_product_data['price'] = $product_data['price'];
$_product_data['ratings'] = $product_data['ratings'];
$_product_data['title'] = $product_data['title'];
$_product_data['description'] = $should_print_excerpt ? '<div class="eael-product-excerpt">
<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_grid_excerpt_length'], $settings['eael_product_grid_excerpt_expanison_indicator'] ) . '</p></div>' : '';
}
else{
echo '<div class="price-wrap">';
if ( $should_print_price ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<div class="eael-product-price">' . $product->get_price_html() . '</div>';
}
if ( $should_print_rating ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() );
}
echo '</div>
<div class="title-wrap">
<div class="eael-product-title">
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
printf( '<%1$s>%2$s</%1$s>', esc_attr( $title_tag ), wp_kses( $product->get_title(), Helper::eael_allowed_tags() ) );
echo '</a>
</div>';
if ( $should_print_excerpt ) {
echo '<div class="eael-product-excerpt">';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ? get_the_excerpt() :
get_the_content() ), $settings['eael_product_grid_excerpt_length'], $settings['eael_product_grid_excerpt_expanison_indicator'] ) . '</p>';
echo '</div>';
}
echo '</div>';
}
$product_data = apply_filters( 'eael/product-grid/content/reordering', $_product_data, $settings, $product );
unset( $product_data['id'] );
if ( ! empty( $product_data ) ) {
foreach ( $product_data as $content ) {
if ( ! empty( $content ) ) {
echo wp_kses( $content, Helper::eael_allowed_tags(), Helper::eael_allowed_protocols() );
}
}
}
?>
<ul class="icons-wrap <?php echo esc_attr( $settings['eael_product_action_buttons_preset'] ); ?>">
<?php
if ( $should_print_compare_btn ) {
echo '<li class="add-to-compare">';
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
echo '</li>';
}
?>
<li class="add-to-cart"><?php
woocommerce_template_loop_add_to_cart(); ?></li>
<?php
if ( ! empty( $should_print_wishlist_btn ) ) {
echo '<li class="add-to-whishlist">';
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
echo '</li>';
}
?>
<?php
if( $should_print_quick_view ){?>
<li class="eael-product-quick-view">
<a id="eael_quick_view_<?php echo esc_attr( uniqid() ); ?>" data-quickview-setting="<?php echo esc_attr( htmlspecialchars(wp_json_encode($quick_view_setting),ENT_QUOTES) ); ?>"
class="eael-product-grid-open-popup open-popup-link">
<i class="fas fa-eye"></i>
</a>
</li>
<?php } ?>
</ul>
<?php
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
do_action( 'woocommerce_after_shop_loop_item' );
}
do_action( 'eael_woocommerce_after_shop_loop_item' );
?>
</div>
</div>
</li>

Some files were not shown because too many files have changed in this diff Show More