first commit
This commit is contained in:
@@ -0,0 +1,512 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Classes;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
use Elementor\Core\Files\CSS\Post as Post_CSS;
|
||||
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 = \ElementorPro\Modules\ThemeBuilder\Module::instance()->get_conditions_manager()->get_documents_for_location( $location );
|
||||
foreach ( $documents as $document ) {
|
||||
$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 ) {
|
||||
printf( '<script>%1$s</script>', 'var localize =' . wp_json_encode( $this->localize_objects ) );
|
||||
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 ) {
|
||||
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
|
||||
);
|
||||
|
||||
// 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,354 @@
|
||||
<?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;
|
||||
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 = 11;
|
||||
const EAEL_ADMIN_MENU_FLAG = 11;
|
||||
/**
|
||||
* 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 ) {
|
||||
$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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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( 'login_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'));
|
||||
}
|
||||
|
||||
//Essential Blocks Promo
|
||||
if ( ! class_exists( 'Classic_Editor' ) && ! class_exists( 'EssentialBlocks' ) && ( ! get_option( 'eael_eb_optin_hide' ) || ! get_option( 'eael_gb_eb_popup_hide' ) ) ) {
|
||||
add_action( 'enqueue_block_editor_assets', [ $this, 'essential_blocks_promo_enqueue_scripts' ] );
|
||||
add_action( 'admin_notices', [ $this, 'essential_block_optin' ] );
|
||||
add_action( 'eael_admin_notices', [ $this, 'essential_block_special_optin' ], 100 );
|
||||
add_action( 'wp_ajax_eael_eb_optin_notice_dismiss', [ $this, 'eael_eb_optin_notice_dismiss' ] );
|
||||
add_action( 'wp_ajax_eael_gb_eb_popup_dismiss', [ $this, 'eael_gb_eb_popup_dismiss' ] );
|
||||
}
|
||||
|
||||
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( 'woocommerce_product_get_rating_html', [ $this, 'eael_rating_markup' ], 10, 3 );
|
||||
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' );
|
||||
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
|
||||
if( function_exists( 'astra_woo_woocommerce_shop_product_content' ) ){
|
||||
add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_woocommerce_shop_product_content' );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// Admin
|
||||
if ( is_admin() ) {
|
||||
// Admin
|
||||
if (!$this->pro_enabled) {
|
||||
$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' ] );
|
||||
|
||||
// Black Friday Optin
|
||||
add_action( 'admin_notices', [ $this, 'eael_black_friday_optin' ] );
|
||||
add_action( 'eael_admin_notices', [ $this, 'eael_black_friday_optin' ] );
|
||||
add_action( 'wp_ajax_eael_black_friday_optin_dismiss', [ $this, 'eael_black_friday_optin_dismiss' ] );
|
||||
|
||||
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' ];
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
<?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_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';
|
||||
}
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,108 @@
|
||||
<?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 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;
|
||||
|
||||
$results = $wpdb->get_var( $selection_sql );
|
||||
if ( $results > 0 ) {
|
||||
$deletiation_sql = "delete options_tb " . $sql;
|
||||
$wpdb->query( $deletiation_sql );
|
||||
}
|
||||
|
||||
set_transient( 'eael_reduce_op_table_data', 1, DAY_IN_SECONDS );
|
||||
wp_clear_scheduled_hook( 'eael_remove_unused_options_data' );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,934 @@
|
||||
<?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="'. $classes .' wpdeveloper-'. $current_notice .'-notice" data-notice="'. $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 '. $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-'. $this->plugin_name .'" class="button button-primary">'. Helper::eael_wp_kses( $btn_text ) .'</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 Helper::eael_wp_kses( $this->data['message'][ $msg_for ] );
|
||||
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>';
|
||||
|
||||
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 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 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 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,228 @@
|
||||
<?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.'));
|
||||
}
|
||||
|
||||
$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.'));
|
||||
}
|
||||
|
||||
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.'));
|
||||
}
|
||||
|
||||
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 ( 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,807 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Classes;
|
||||
|
||||
if ( !defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly.
|
||||
|
||||
class WPDeveloper_Setup_Wizard {
|
||||
public $templately_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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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' );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(
|
||||
'',
|
||||
__( '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(),
|
||||
'templately_content' => $this->data_templately_content(),
|
||||
'integrations_content' => $this->data_integrations_content(),
|
||||
'modal_content' => $this->data_modal_content(),
|
||||
];
|
||||
|
||||
return $eael_quick_setup_data;
|
||||
}
|
||||
|
||||
public function data_menu_items(){
|
||||
$items = [
|
||||
__( 'Getting Started', 'essential-addons-for-elementor-lite' ),
|
||||
__( 'Configuration', 'essential-addons-for-elementor-lite' ),
|
||||
__( 'Elements', 'essential-addons-for-elementor-lite' ),
|
||||
__( 'Go PRO', 'essential-addons-for-elementor-lite' ),
|
||||
__( 'Templately', 'essential-addons-for-elementor-lite' ),
|
||||
__( 'Integrations', 'essential-addons-for-elementor-lite' ),
|
||||
];
|
||||
|
||||
$menu_items = [
|
||||
'templately_status' => $this->templately_status,
|
||||
'wizard_column' => !$this->templately_status ? 'five' : 'four',
|
||||
'items' => $items,
|
||||
'templately_local_plugin_data' => $this->get_local_plugin_data( 'templately/templately.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_templately_content(){
|
||||
$templately_content = [
|
||||
'templately_icon_1_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-1.svg',
|
||||
'templately_icon_2_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-2.svg',
|
||||
'templately_icon_3_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-3.svg',
|
||||
'templately_icon_4_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-icon-4.svg',
|
||||
'templately_promo_src' => EAEL_PLUGIN_URL . 'assets/admin/images/quick-setup/templately-qs-img.png'
|
||||
];
|
||||
|
||||
return $templately_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',
|
||||
],
|
||||
]
|
||||
],
|
||||
'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-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() {
|
||||
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 _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', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'render_type' => 'ui',
|
||||
];
|
||||
|
||||
$fields['color'] = [
|
||||
'label' => esc_html_x( 'Color', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'title' => esc_html_x( 'Background Color', 'Background Control', 'elementor' ),
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic', 'gradient', 'video' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['color_stop'] = [
|
||||
'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'linear' => esc_html_x( 'Linear', 'Background Control', 'elementor' ),
|
||||
'radial' => esc_html_x( 'Radial', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'default' => 'linear',
|
||||
'render_type' => 'ui',
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['gradient_angle'] = [
|
||||
'label' => esc_html_x( 'Angle', 'Background Control', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'center center' => esc_html_x( 'Center Center', 'Background Control', 'elementor' ),
|
||||
'center left' => esc_html_x( 'Center Left', 'Background Control', 'elementor' ),
|
||||
'center right' => esc_html_x( 'Center Right', 'Background Control', 'elementor' ),
|
||||
'top center' => esc_html_x( 'Top Center', 'Background Control', 'elementor' ),
|
||||
'top left' => esc_html_x( 'Top Left', 'Background Control', 'elementor' ),
|
||||
'top right' => esc_html_x( 'Top Right', 'Background Control', 'elementor' ),
|
||||
'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'elementor' ),
|
||||
'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'elementor' ),
|
||||
'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'ai' => [
|
||||
'category' => 'background',
|
||||
],
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'responsive' => true,
|
||||
'title' => esc_html_x( 'Background Image', 'Background Control', 'elementor' ),
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-image: url("{{URL}}");',
|
||||
],
|
||||
'has_sizes' => true,
|
||||
'render_type' => 'template',
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['position'] = [
|
||||
'label' => esc_html_x( 'Position', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'separator' => 'before',
|
||||
'responsive' => true,
|
||||
'options' => [
|
||||
'' => esc_html_x( 'Default', 'Background Control', 'elementor' ),
|
||||
'center center' => esc_html_x( 'Center Center', 'Background Control', 'elementor' ),
|
||||
'center left' => esc_html_x( 'Center Left', 'Background Control', 'elementor' ),
|
||||
'center right' => esc_html_x( 'Center Right', 'Background Control', 'elementor' ),
|
||||
'top center' => esc_html_x( 'Top Center', 'Background Control', 'elementor' ),
|
||||
'top left' => esc_html_x( 'Top Left', 'Background Control', 'elementor' ),
|
||||
'top right' => esc_html_x( 'Top Right', 'Background Control', 'elementor' ),
|
||||
'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'elementor' ),
|
||||
'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'elementor' ),
|
||||
'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'elementor' ),
|
||||
'initial' => esc_html_x( 'Custom', 'Background Control', 'elementor' ),
|
||||
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-position: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['xpos'] = [
|
||||
'label' => esc_html_x( 'X Position', 'Background Control', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html_x( 'Default', 'Background Control', 'elementor' ),
|
||||
'scroll' => esc_html_x( 'Scroll', 'Background Control', 'elementor' ),
|
||||
'fixed' => esc_html_x( 'Fixed', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'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.', 'elementor' ),
|
||||
'separator' => 'none',
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
'attachment' => 'fixed',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['repeat'] = [
|
||||
'label' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'responsive' => true,
|
||||
'options' => [
|
||||
'' => esc_html_x( 'Default', 'Background Control', 'elementor' ),
|
||||
'no-repeat' => esc_html_x( 'No-repeat', 'Background Control', 'elementor' ),
|
||||
'repeat' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ),
|
||||
'repeat-x' => esc_html_x( 'Repeat-x', 'Background Control', 'elementor' ),
|
||||
'repeat-y' => esc_html_x( 'Repeat-y', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-repeat: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['size'] = [
|
||||
'label' => esc_html_x( 'Display Size', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'responsive' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html_x( 'Default', 'Background Control', 'elementor' ),
|
||||
'auto' => esc_html_x( 'Auto', 'Background Control', 'elementor' ),
|
||||
'cover' => esc_html_x( 'Cover', 'Background Control', 'elementor' ),
|
||||
'contain' => esc_html_x( 'Contain', 'Background Control', 'elementor' ),
|
||||
'initial' => esc_html_x( 'Custom', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-size: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['bg_width'] = [
|
||||
'label' => esc_html_x( 'Width', 'Background Control', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'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).', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ),
|
||||
'placeholder' => 10,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['video_end'] = [
|
||||
'label' => esc_html__( 'End Time', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ),
|
||||
'placeholder' => 70,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['play_once'] = [
|
||||
'label' => esc_html__( 'Play Once', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['play_on_mobile'] = [
|
||||
'label' => esc_html__( 'Play On Mobile', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['video_fallback'] = [
|
||||
'label' => esc_html_x( 'Background Fallback', 'Background Control', 'elementor' ),
|
||||
'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::GALLERY,
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'show_label' => false,
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_loop'] = [
|
||||
'label' => esc_html__( 'Infinite Loop', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_slide_duration'] = [
|
||||
'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)',
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 5000,
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_slide_transition'] = [
|
||||
'label' => esc_html__( 'Transition', 'elementor' ),
|
||||
'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', 'elementor' ) . ' (ms)',
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 500,
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_background_size'] = [
|
||||
'label' => esc_html__( 'Background Size', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'responsive' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'auto' => esc_html__( 'Auto', 'elementor' ),
|
||||
'cover' => esc_html__( 'Cover', 'elementor' ),
|
||||
'contain' => esc_html__( 'Contain', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['slideshow_background_position'] = [
|
||||
'label' => esc_html__( 'Background Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'responsive' => true,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'center center' => esc_html_x( 'Center Center', 'Background Control', 'elementor' ),
|
||||
'center left' => esc_html_x( 'Center Left', 'Background Control', 'elementor' ),
|
||||
'center right' => esc_html_x( 'Center Right', 'Background Control', 'elementor' ),
|
||||
'top center' => esc_html_x( 'Top Center', 'Background Control', 'elementor' ),
|
||||
'top left' => esc_html_x( 'Top Left', 'Background Control', 'elementor' ),
|
||||
'top right' => esc_html_x( 'Top Right', 'Background Control', 'elementor' ),
|
||||
'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'elementor' ),
|
||||
'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'elementor' ),
|
||||
'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['slideshow_lazyload'] = [
|
||||
'label' => esc_html__( 'Lazyload', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'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', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'in',
|
||||
'options' => [
|
||||
'in' => esc_html__( 'In', 'elementor' ),
|
||||
'out' => esc_html__( 'Out', 'elementor' ),
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
'slideshow_ken_burns!' => '',
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
namespace Essential_Addons_Elementor\Controls;
|
||||
use Elementor\Base_Data_Control;
|
||||
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' }}">
|
||||
<# _.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 tooltip-target" for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}">
|
||||
<# if( options.image ){ #>
|
||||
<img class="eael-image-option" src="{{ options.image }}" alt="{{ options.title }}" />
|
||||
<# } else if( options.text ){ #>
|
||||
<span class="eael-text-option" alt="{{ options.title }}">{{{ options.text }}}</span>
|
||||
<# } else{ #>
|
||||
<i class="{{ options.icon }}" aria-hidden="true"></i>
|
||||
<# } #>
|
||||
<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,83 @@
|
||||
<?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>
|
||||
<#
|
||||
( 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
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,591 @@
|
||||
<?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\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 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="'.$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="'.$settings['section_search_field_placeholder'].'"]';
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,853 @@
|
||||
<?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\Modules\DynamicTags\Module as TagsModule;
|
||||
use \Elementor\Widget_Base;
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
use \Essential_Addons_Elementor\Classes\Controls;
|
||||
|
||||
class Content_Ticker extends Widget_Base
|
||||
{
|
||||
|
||||
use \Essential_Addons_Elementor\Traits\Template_Query;
|
||||
|
||||
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_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 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);
|
||||
|
||||
//Supported New SwiperJS version
|
||||
$swiper_class = $swiper_version_class = '';
|
||||
if ( class_exists( 'Elementor\Plugin' ) ) {
|
||||
$swiper_class = \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container';
|
||||
$swiper_version_class = 'swiper' === $swiper_class ? 'swiper-8' : 'swiper-8-lower';
|
||||
}
|
||||
|
||||
$this->add_render_attribute('content-ticker-wrap', 'class', 'eael-ticker');
|
||||
$this->add_render_attribute('content-ticker', 'class', esc_attr( $swiper_class ) );
|
||||
$this->add_render_attribute('content-ticker', 'class', esc_attr( $swiper_version_class ) );
|
||||
$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>' . Helper::eael_wp_kses($settings['eael_ticker_tag_text']) . '</span>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '<div ' . $this->get_render_attribute_string('content-ticker-wrap') . '>
|
||||
<div ' . $this->get_render_attribute_string('content-ticker') . '>
|
||||
<div class="swiper-wrapper">';
|
||||
|
||||
if ('dynamic' === $settings['eael_ticker_type']) {
|
||||
|
||||
if (\file_exists($this->get_template($settings['eael_dynamic_template_Layout']))) {
|
||||
$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">' . __('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) {
|
||||
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>
|
||||
' . $this->render_arrows() . '
|
||||
</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;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,630 @@
|
||||
<?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\Group_Control_Typography;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use \Elementor\Widget_Base;
|
||||
use Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
|
||||
class Creative_Button extends Widget_Base
|
||||
{
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'eael-creative-button';
|
||||
}
|
||||
|
||||
public function get_title()
|
||||
{
|
||||
return esc_html__('Creative Button', 'essential-addons-for-elementor-lite');
|
||||
}
|
||||
|
||||
public function get_icon()
|
||||
{
|
||||
return 'eaicon-creative-button';
|
||||
}
|
||||
|
||||
public function get_categories()
|
||||
{
|
||||
return ['essential-addons-elementor'];
|
||||
}
|
||||
|
||||
public function get_keywords()
|
||||
{
|
||||
return [
|
||||
'button',
|
||||
'ea button',
|
||||
'creative button',
|
||||
'ea creative button',
|
||||
'cta',
|
||||
'call to action',
|
||||
'ea',
|
||||
'marketing button',
|
||||
'essential addons',
|
||||
];
|
||||
}
|
||||
|
||||
public function get_custom_help_url()
|
||||
{
|
||||
return 'https://essential-addons.com/elementor/docs/creative-buttons/';
|
||||
}
|
||||
|
||||
protected function register_controls()
|
||||
{
|
||||
|
||||
if ( !apply_filters( 'eael/pro_enabled', false ) ) {
|
||||
// Content Controls
|
||||
$this->start_controls_section(
|
||||
'eael_section_creative_button_content',
|
||||
[
|
||||
'label' => esc_html__('Button Content', 'essential-addons-for-elementor-lite'),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'creative_button_text',
|
||||
[
|
||||
'label' => __('Button Text', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'label_block' => true,
|
||||
'default' => 'Click Me!',
|
||||
'placeholder' => __('Enter button text', 'essential-addons-for-elementor-lite'),
|
||||
'title' => __('Enter button text here', 'essential-addons-for-elementor-lite'),
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'creative_button_secondary_text',
|
||||
[
|
||||
'label' => __('Button Secondary Text', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'label_block' => true,
|
||||
'default' => 'Go!',
|
||||
'placeholder' => __('Enter button secondary text', 'essential-addons-for-elementor-lite'),
|
||||
'title' => __('Enter button secondary text here', 'essential-addons-for-elementor-lite'),
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'creative_button_link_url',
|
||||
[
|
||||
'label' => esc_html__('Link URL', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::URL,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
'categories' => [
|
||||
TagsModule::POST_META_CATEGORY,
|
||||
TagsModule::URL_CATEGORY,
|
||||
],
|
||||
],
|
||||
'label_block' => true,
|
||||
'default' => [
|
||||
'url' => '#',
|
||||
'is_external' => '',
|
||||
],
|
||||
'show_external' => true,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_icon_new',
|
||||
[
|
||||
'label' => esc_html__('Icon', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'fa4compatibility' => 'eael_creative_button_icon',
|
||||
'condition' => [
|
||||
'creative_button_effect!' => ['eael-creative-button--tamaya'],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_icon_alignment',
|
||||
[
|
||||
'label' => esc_html__('Icon Position', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
'left' => esc_html__('Before', 'essential-addons-for-elementor-lite'),
|
||||
'right' => esc_html__('After', 'essential-addons-for-elementor-lite'),
|
||||
],
|
||||
'condition' => [
|
||||
'eael_creative_button_icon_new!' => '',
|
||||
'creative_button_effect!' => ['eael-creative-button--tamaya'],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_creative_button_icon_indent',
|
||||
[
|
||||
'label' => esc_html__('Icon Spacing', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 60,
|
||||
],
|
||||
],
|
||||
'condition' => [
|
||||
'eael_creative_button_icon_new!' => '',
|
||||
'creative_button_effect!' => ['eael-creative-button--tamaya'],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button-icon-right' => 'margin-left: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-creative-button-icon-left' => 'margin-right: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-creative-button--shikoba i' => 'left: {{SIZE}}%;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
} else {
|
||||
do_action('eael_creative_button_pro_controls', $this);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// Style Controls
|
||||
$this->start_controls_section(
|
||||
'eael_section_creative_button_settings',
|
||||
[
|
||||
'label' => esc_html__('Button Effects & Styles', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
if (!apply_filters('eael/pro_enabled', false)) {
|
||||
$this->add_control(
|
||||
'creative_button_effect',
|
||||
[
|
||||
'label' => esc_html__('Set Button Effect', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'eael-creative-button--default',
|
||||
'options' => [
|
||||
'eael-creative-button--default' => esc_html__('Default', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--winona' => esc_html__('Winona', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--ujarak' => esc_html__('Ujarak', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--wayra' => esc_html__('Wayra', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--tamaya' => esc_html__('Tamaya', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--rayen' => esc_html__('Rayen', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--pipaluk' => esc_html__('Pipaluk (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--moema' => esc_html__('Moema (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--wave' => esc_html__('Wave (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--aylen' => esc_html__('Aylen (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--saqui' => esc_html__('Saqui (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--wapasha' => esc_html__('Wapasha (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--nuka' => esc_html__('Nuka (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--antiman' => esc_html__('Antiman (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--quidel' => esc_html__('Quidel (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
'eael-creative-button--shikoba' => esc_html__('Shikoba (Pro)', 'essential-addons-for-elementor-lite'),
|
||||
],
|
||||
'description' => '10 more effects on <a href="https://wpdeveloper.com/in/upgrade-essential-addons-elementor">Pro version</a>',
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'use_gradient_background',
|
||||
[
|
||||
'label' => __('Use Gradient Background', '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' => '',
|
||||
]
|
||||
);
|
||||
$this->start_controls_tabs('eael_creative_button_tabs');
|
||||
|
||||
$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]);
|
||||
|
||||
$this->add_control('eael_creative_button_icon_color',
|
||||
[
|
||||
'label' => esc_html__('Icon Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button .creative-button-inner svg' => 'fill: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_text_color',
|
||||
[
|
||||
'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button svg' => 'fill: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button .eael-creative-button--tamaya-secondary' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'eael_creative_button_background_color',
|
||||
[
|
||||
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f54',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--ujarak:hover' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--wayra:hover' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya::before' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya::after' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'use_gradient_background' => '',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Background::get_type(),
|
||||
[
|
||||
'name' => 'eael_creative_button_gradient_background',
|
||||
'types' => ['gradient', 'classic'],
|
||||
'selector' => '
|
||||
{{WRAPPER}} .eael-creative-button,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--ujarak:hover,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--wayra:hover,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya::before,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya::after
|
||||
',
|
||||
'condition' => [
|
||||
'use_gradient_background' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_creative_button_border',
|
||||
'selector' => '{{WRAPPER}} .eael-creative-button',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_border_radius',
|
||||
[
|
||||
'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button' => 'border-radius: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-creative-button::before' => 'border-radius: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-creative-button::after' => 'border-radius: {{SIZE}}px;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab('eael_creative_button_hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]);
|
||||
|
||||
$this->add_control('eael_creative_button_hover_icon_color',
|
||||
[
|
||||
'label' => esc_html__('Icon Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button:hover i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button:hover .creative-button-inner svg' => 'fill: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_hover_text_color',
|
||||
[
|
||||
'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button:hover .cretive-button-text' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--winona::after' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen:hover::before' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_hover_background_color',
|
||||
[
|
||||
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f54',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button:hover' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--ujarak::before' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--wayra:hover::before' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya:hover' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen::before' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen:hover::before' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'use_gradient_background' => '',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Background::get_type(),
|
||||
[
|
||||
'name' => 'eael_creative_button_hover_gradient_background',
|
||||
'types' => ['gradient', 'classic'],
|
||||
'selector' => '
|
||||
{{WRAPPER}} .eael-creative-button:hover,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--ujarak::before,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--wayra:hover::before,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya:hover,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen::before,
|
||||
{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen:hover::before
|
||||
',
|
||||
'condition' => [
|
||||
'use_gradient_background' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_creative_button_hover_border_color',
|
||||
[
|
||||
'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button:hover' => 'border-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--wapasha::before' => 'border-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--antiman::before' => 'border-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--pipaluk::before' => 'border-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--quidel::before' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_creative_button_alignment',
|
||||
[
|
||||
'label' => esc_html__('Button Alignment', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => true,
|
||||
'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' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button-wrapper' => 'justify-content: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_creative_button_width',
|
||||
[
|
||||
'label' => esc_html__('Width', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', '%'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 500,
|
||||
'step' => 1,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button' => 'width: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_creative_button_typography',
|
||||
'global' => [
|
||||
'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .eael-creative-button .cretive-button-text, {{WRAPPER}} .eael-creative-button--winona::after, {{WRAPPER}} .eael-creative-button--rayen::before, {{WRAPPER}} .eael-creative-button--tamaya::after, {{WRAPPER}} .eael-creative-button--tamaya::before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_creative_button_icon_size',
|
||||
[
|
||||
'label' => esc_html__('Icon Size', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', '%'],
|
||||
'default' => [
|
||||
'size' => 30,
|
||||
'unit' => 'px',
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 500,
|
||||
'step' => 1,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_creative_button_padding',
|
||||
[
|
||||
'label' => esc_html__('Button Padding', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => ['px', 'em', '%'],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-creative-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--winona::after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--winona > .creative-button-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--tamaya::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--rayen > .creative-button-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-creative-button.eael-creative-button--saqui::after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
} else {
|
||||
do_action('eael_creative_button_style_pro_controls', $this);
|
||||
}
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'button_box_shadow',
|
||||
'selector' => '{{WRAPPER}} .eael-creative-button',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
protected function render()
|
||||
{
|
||||
$settings = $this->get_settings_for_display();
|
||||
$icon_migrated = isset($settings['__fa4_migrated']['eael_creative_button_icon_new']);
|
||||
$icon_is_new = empty($settings['eael_creative_button_icon']);
|
||||
|
||||
$this->add_render_attribute('eael_creative_button', [
|
||||
'class' => ['eael-creative-button', esc_attr($settings['creative_button_effect'])],
|
||||
]);
|
||||
|
||||
if ( ! empty( $settings['creative_button_link_url']['url'] ) ) {
|
||||
$this->add_link_attributes( 'eael_creative_button', $settings['creative_button_link_url'] );
|
||||
}
|
||||
|
||||
if ($settings['creative_button_link_url']['is_external']) {
|
||||
$this->add_render_attribute('eael_creative_button', 'target');
|
||||
}
|
||||
|
||||
if ($settings['creative_button_link_url']['nofollow']) {
|
||||
$this->add_render_attribute('eael_creative_button', 'rel', 'nofollow');
|
||||
}
|
||||
|
||||
$this->add_render_attribute('eael_creative_button', 'data-text', esc_attr($settings['creative_button_secondary_text']));
|
||||
?>
|
||||
<div class="eael-creative-button-wrapper">
|
||||
|
||||
<a <?php echo $this->get_render_attribute_string('eael_creative_button'); ?>>
|
||||
|
||||
<?php if ($settings['creative_button_effect'] === 'eael-creative-button--tamaya' ) : ?>
|
||||
<div class="eael-creative-button--tamaya-secondary eael-creative-button--tamaya-before"><span><?php echo Helper::eael_wp_kses($settings['creative_button_secondary_text']); ?></span></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="creative-button-inner">
|
||||
|
||||
<?php if ($settings['creative_button_effect'] !== 'eael-creative-button--tamaya' && $settings['eael_creative_button_icon_alignment'] == 'left') : ?>
|
||||
<?php if ($icon_migrated || $icon_is_new) {
|
||||
echo '<span class="eael-creative-button-icon-left">';
|
||||
Icons_Manager::render_icon( $settings['eael_creative_button_icon_new'], [ 'aria-hidden' => 'true' ] );
|
||||
echo '</span>';
|
||||
} else { ?>
|
||||
<i class="<?php echo esc_attr($settings['eael_creative_button_icon']); ?> eael-creative-button-icon-left" aria-hidden="true"></i>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="cretive-button-text"><?php echo Helper::eael_wp_kses($settings['creative_button_text']); ?></span>
|
||||
|
||||
<?php if ($settings['creative_button_effect'] !== 'eael-creative-button--tamaya' && $settings['eael_creative_button_icon_alignment'] == 'right') : ?>
|
||||
<?php if ($icon_migrated || $icon_is_new) {
|
||||
echo '<span class="eael-creative-button-icon-right">';
|
||||
Icons_Manager::render_icon( $settings['eael_creative_button_icon_new'], [ 'aria-hidden' => 'true' ] );
|
||||
echo '</span>';
|
||||
} else { ?>
|
||||
<i class="<?php echo esc_attr($settings['eael_creative_button_icon']); ?> eael-creative-button-icon-right" aria-hidden="true"></i>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($settings['creative_button_effect'] === 'eael-creative-button--tamaya' ) : ?>
|
||||
<div class="eael-creative-button--tamaya-secondary eael-creative-button--tamaya-after"><span><?php echo Helper::eael_wp_kses($settings['creative_button_secondary_text']); ?></span></div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,654 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
|
||||
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_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', 'elementor' ),
|
||||
'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'] ) );
|
||||
}
|
||||
}
|
||||
return implode("|",$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'] );
|
||||
?>
|
||||
|
||||
<div <?php echo $this->get_render_attribute_string( 'fancy-text' ); ?> >
|
||||
<?php if ( ! empty( $settings['eael_fancy_text_prefix'] ) ) : ?>
|
||||
<span class="eael-fancy-text-prefix"><?php echo HelperClass::eael_wp_kses($settings['eael_fancy_text_prefix']); ?> </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 .= HelperClass::eael_wp_kses($item['eael_fancy_text_strings_text_field']) . ', ';
|
||||
}
|
||||
echo rtrim($eael_fancy_text_strings_list, ", ");
|
||||
?>
|
||||
</noscript>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $settings['eael_fancy_text_suffix'] ) ) : ?>
|
||||
<span class="eael-fancy-text-suffix"> <?php echo HelperClass::eael_wp_kses($settings['eael_fancy_text_suffix']); ?></span>
|
||||
<?php endif; ?>
|
||||
</div><!-- close .eael-fancy-text-container -->
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
protected function content_template() {}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,640 @@
|
||||
<?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\Widget_Base;
|
||||
use \Elementor\Repeater;
|
||||
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
class Image_Accordion extends Widget_Base {
|
||||
public function get_name() {
|
||||
return 'eael-image-accordion';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Image Accordion', 'essential-addons-for-elementor-lite' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'eaicon-image-accrodion';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return [ 'essential-addons-elementor' ];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [
|
||||
'image',
|
||||
'ea image accordion',
|
||||
'image effect',
|
||||
'hover effect',
|
||||
'creative image',
|
||||
'gallery',
|
||||
'ea',
|
||||
'essential addons',
|
||||
];
|
||||
}
|
||||
|
||||
public function get_custom_help_url() {
|
||||
return 'https://essential-addons.com/elementor/docs/image-accordion/';
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
/**
|
||||
* Image accordion Content Settings
|
||||
*/
|
||||
$this->start_controls_section(
|
||||
'eael_section_img_accordion_settings',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'essential-addons-for-elementor-lite' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_img_accordion_type',
|
||||
[
|
||||
'label' => esc_html__( 'Accordion Style', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'on-hover',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'on-hover' => esc_html__( 'On Hover', 'essential-addons-for-elementor-lite' ),
|
||||
'on-click' => esc_html__( 'On Click', 'essential-addons-for-elementor-lite' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_img_accordion_direction',
|
||||
[
|
||||
'label' => esc_html__( 'Direction', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'on-hover',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'accordion-direction-horizontal' => esc_html__( 'Horizontal', 'essential-addons-for-elementor-lite' ),
|
||||
'accordion-direction-vertical' => esc_html__( 'Vertical', 'essential-addons-for-elementor-lite' ),
|
||||
],
|
||||
'default' => 'accordion-direction-horizontal',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_img_accordion_content_heading',
|
||||
[
|
||||
'label' => __( 'Content', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => \Elementor\Controls_Manager::HEADING,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_img_accordion_content_horizontal_align',
|
||||
[
|
||||
'label' => __( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => \Elementor\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',
|
||||
],
|
||||
],
|
||||
'default' => 'center',
|
||||
'toggle' => true,
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'eael_img_accordion_content_vertical_align',
|
||||
[
|
||||
'label' => __( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => \Elementor\Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'top' => [
|
||||
'title' => __( 'Top', 'essential-addons-for-elementor-lite' ),
|
||||
'icon' => 'fa fa-arrow-circle-up',
|
||||
],
|
||||
'center' => [
|
||||
'title' => __( 'Center', 'essential-addons-for-elementor-lite' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'bottom' => [
|
||||
'title' => __( 'Bottom', 'essential-addons-for-elementor-lite' ),
|
||||
'icon' => 'fa fa-arrow-circle-down',
|
||||
],
|
||||
],
|
||||
'default' => 'center',
|
||||
'toggle' => true,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_tag',
|
||||
[
|
||||
'label' => __( 'Select Tag', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'h2',
|
||||
'options' => [
|
||||
'h1' => __( 'H1', 'essential-addons-for-elementor-lite' ),
|
||||
'h2' => __( 'H2', 'essential-addons-for-elementor-lite' ),
|
||||
'h3' => __( 'H3', 'essential-addons-for-elementor-lite' ),
|
||||
'h4' => __( 'H4', 'essential-addons-for-elementor-lite' ),
|
||||
'h5' => __( 'H5', 'essential-addons-for-elementor-lite' ),
|
||||
'h6' => __( 'H6', 'essential-addons-for-elementor-lite' ),
|
||||
'span' => __( 'Span', 'essential-addons-for-elementor-lite' ),
|
||||
'p' => __( 'P', 'essential-addons-for-elementor-lite' ),
|
||||
'div' => __( 'Div', 'essential-addons-for-elementor-lite' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$repeater = new Repeater();
|
||||
|
||||
$repeater->add_control(
|
||||
'eael_accordion_is_active',
|
||||
[
|
||||
'label' => __( 'Make it active?', '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' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'eael_accordion_bg',
|
||||
[
|
||||
'label' => esc_html__( 'Background Image', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'label_block' => true,
|
||||
'default' => [
|
||||
'url' => EAEL_PLUGIN_URL . '/assets/front-end/img/accordion.png',
|
||||
],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'eael_accordion_tittle',
|
||||
[
|
||||
'label' => esc_html__( 'Title', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'label_block' => true,
|
||||
'default' => esc_html__( 'Accordion item title', 'essential-addons-for-elementor-lite' ),
|
||||
'dynamic' => [ 'active' => true ],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'eael_accordion_content',
|
||||
[
|
||||
'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::WYSIWYG,
|
||||
'label_block' => true,
|
||||
'default' => esc_html__( 'Accordion content goes here!', 'essential-addons-for-elementor-lite' ),
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'eael_accordion_enable_title_link',
|
||||
[
|
||||
'label' => esc_html__( 'Enable Title Link', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'Show', 'your-plugin' ),
|
||||
'label_off' => __( 'Hide', 'your-plugin' ),
|
||||
'return_value' => 'yes',
|
||||
'default' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'eael_accordion_title_link',
|
||||
[
|
||||
'name' => 'eael_accordion_title_link',
|
||||
'label' => esc_html__( 'Title 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_accordion_enable_title_link' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_img_accordions',
|
||||
[
|
||||
'type' => Controls_Manager::REPEATER,
|
||||
'seperator' => 'before',
|
||||
'default' => [
|
||||
[
|
||||
'eael_accordion_tittle' => esc_html__( 'Image Accordion #1', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_content' => esc_html__( 'Image Accordion Content Goes Here! Click edit button to change this text.', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_bg' => [
|
||||
'url' => EAEL_PLUGIN_URL . '/assets/front-end/img/accordion.png',
|
||||
]
|
||||
],
|
||||
[
|
||||
'eael_accordion_tittle' => esc_html__( 'Image Accordion #2', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_content' => esc_html__( 'Image Accordion Content Goes Here! Click edit button to change this text.', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_bg' => [
|
||||
'url' => EAEL_PLUGIN_URL . '/assets/front-end/img/accordion.png',
|
||||
]
|
||||
],
|
||||
[
|
||||
'eael_accordion_tittle' => esc_html__( 'Image Accordion #3', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_content' => esc_html__( 'Image Accordion Content Goes Here! Click edit button to change this text.', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_bg' => [
|
||||
'url' => EAEL_PLUGIN_URL . '/assets/front-end/img/accordion.png',
|
||||
]
|
||||
],
|
||||
[
|
||||
'eael_accordion_tittle' => esc_html__( 'Image Accordion #4', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_content' => esc_html__( 'Image Accordion Content Goes Here! Click edit button to change this text.', 'essential-addons-for-elementor-lite' ),
|
||||
'eael_accordion_bg' => [
|
||||
'url' => EAEL_PLUGIN_URL . '/assets/front-end/img/accordion.png',
|
||||
]
|
||||
],
|
||||
],
|
||||
'fields' => $repeater->get_controls(),
|
||||
'title_field' => '{{eael_accordion_tittle}}',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
/**
|
||||
* -------------------------------------------
|
||||
* Tab Style (Image accordion)
|
||||
* -------------------------------------------
|
||||
*/
|
||||
$this->start_controls_section(
|
||||
'eael_section_img_accordion_style_settings',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'essential-addons-for-elementor-lite' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_height',
|
||||
[
|
||||
'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'default' => '400',
|
||||
'description' => 'Unit in px',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion ' => 'height: {{VALUE}}px;',
|
||||
],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_accordion_container_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_accordion_container_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_accordion_border',
|
||||
'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite' ),
|
||||
'selector' => '{{WRAPPER}} .eael-img-accordion',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 4,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 500,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion' => 'border-radius: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-img-accordion a:first-child' => 'border-radius: {{SIZE}}px 0 0 {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-img-accordion a:last-child' => 'border-radius: 0 {{SIZE}}px {{SIZE}}px 0;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'eael_accordion_shadow',
|
||||
'selector' => '{{WRAPPER}} .eael-img-accordion',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_img_overlay_color',
|
||||
[
|
||||
'label' => esc_html__( 'Overlay Color', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => 'rgba(0, 0, 0, .3)',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-hover:before' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_img_hover_color',
|
||||
[
|
||||
'label' => esc_html__( 'Hover Overlay Color', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => 'rgba(0, 0, 0, .5)',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-hover:hover::before' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-hover.overlay-active:hover::before' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-hover.overlay-active:before' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
/**
|
||||
* -------------------------------------------
|
||||
* Tab Style (Thumbnail Style)
|
||||
* -------------------------------------------
|
||||
*/
|
||||
$this->start_controls_section(
|
||||
'eael_section_img_accordion_thumbnail_style_settings',
|
||||
[
|
||||
'label' => esc_html__( 'Thumbnail', 'essential-addons-for-elementor-lite' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_image_accordion_thumbnail_margin',
|
||||
[
|
||||
'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'eael_image_accordion_thumbnail_padding',
|
||||
[
|
||||
'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'eael_image_accordion_thumbnail_radius',
|
||||
[
|
||||
'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .eael-image-accordion-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;',
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_image_accordion_thumbnail_border',
|
||||
'label' => __( 'Border', 'essential-addons-for-elementor-lite' ),
|
||||
'selector' => '{{WRAPPER}} .eael-img-accordion .eael-image-accordion-item',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
/**
|
||||
* -------------------------------------------
|
||||
* Tab Style (Image accordion Content Style)
|
||||
* -------------------------------------------
|
||||
*/
|
||||
$this->start_controls_section(
|
||||
'eael_section_img_accordion_typography_settings',
|
||||
[
|
||||
'label' => esc_html__( 'Color & Typography', 'essential-addons-for-elementor-lite' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_title_text',
|
||||
[
|
||||
'label' => esc_html__( 'Title', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_title_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#fff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .overlay .img-accordion-title' => 'color: {{VALUE}} !important;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_accordion_title_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-img-accordion .overlay .img-accordion-title',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_content_text',
|
||||
[
|
||||
'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_accordion_content_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#fff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-img-accordion .overlay p' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_accordion_content_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-img-accordion .overlay p',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
$horizontal_alignment = 'eael-img-accordion-horizontal-align-' . $settings[ 'eael_img_accordion_content_horizontal_align' ];
|
||||
$vertical_alignment = 'eael-img-accordion-vertical-align-' . $settings[ 'eael_img_accordion_content_vertical_align' ];
|
||||
|
||||
$this->add_render_attribute(
|
||||
'eael-image-accordion',
|
||||
[
|
||||
'class' => [
|
||||
'eael-img-accordion',
|
||||
$settings[ 'eael_img_accordion_direction' ],
|
||||
$horizontal_alignment,
|
||||
$vertical_alignment,
|
||||
],
|
||||
'id' => 'eael-img-accordion-' . $this->get_id(),
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_render_attribute( 'eael-image-accordion', 'data-img-accordion-id', esc_attr( $this->get_id() ) );
|
||||
$this->add_render_attribute( 'eael-image-accordion', 'data-img-accordion-type', $settings[ 'eael_img_accordion_type' ] );
|
||||
if ( empty( $settings[ 'eael_img_accordions' ] ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div <?php echo $this->get_render_attribute_string( 'eael-image-accordion' ); ?>>
|
||||
<?php foreach ( $settings[ 'eael_img_accordions' ] as $key => $img_accordion ): ?>
|
||||
<?php
|
||||
$active = $img_accordion['eael_accordion_is_active'];
|
||||
$activeCSS = ( $active === 'yes' ? ' flex: 3 1 0%;' : '' );
|
||||
$this->add_render_attribute(
|
||||
'eael-image-accordion-item-wrapper-' . $key,
|
||||
[
|
||||
'class' => 'eael-image-accordion-hover eael-image-accordion-item',
|
||||
'style' => "background-image: url(" . esc_url( $img_accordion['eael_accordion_bg']['url'] ) . ");" . $activeCSS,
|
||||
]
|
||||
);
|
||||
if ( $active === 'yes' ) {
|
||||
$this->add_render_attribute( 'eael-image-accordion-item-wrapper-' . $key, 'class', 'overlay-active' );
|
||||
}
|
||||
?>
|
||||
|
||||
<div <?php echo $this->get_render_attribute_string( 'eael-image-accordion-item-wrapper-' . $key ); ?> tabindex="0">
|
||||
<div class="overlay">
|
||||
<div class="overlay-inner <?php echo( $active === 'yes' ? ' overlay-inner-show' : '' ); ?>">
|
||||
<?php
|
||||
$title_linked = false;
|
||||
if ( $img_accordion['eael_accordion_enable_title_link'] == 'yes' && $img_accordion['eael_accordion_title_link']['url'] !== '#' && $img_accordion['eael_accordion_title_link']['url'] ) {
|
||||
$this->add_link_attributes( 'eael-image-accordion-link-' . $key, $img_accordion['eael_accordion_title_link'] );
|
||||
$title_linked = true;
|
||||
echo "<a ". $this->get_render_attribute_string( 'eael-image-accordion-link-' . $key ) .">";
|
||||
}
|
||||
if ( !empty( $img_accordion[ 'eael_accordion_tittle' ] ) ):
|
||||
printf( '<%1$s class="img-accordion-title">%2$s</%1$s>', Helper::eael_validate_html_tag($settings[ 'title_tag' ]), Helper::eael_wp_kses($img_accordion[ 'eael_accordion_tittle' ]) );
|
||||
endif;
|
||||
|
||||
echo $title_linked ? '</a>' : '';
|
||||
|
||||
if ( !empty( $img_accordion[ 'eael_accordion_content' ] ) ):
|
||||
?>
|
||||
<p><?php echo sprintf( "%s", $this->parse_text_editor( $img_accordion[ 'eael_accordion_content' ] ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
if ( !empty( $settings[ 'eael_img_accordions' ] ) ) {
|
||||
if ( 'on-hover' === $settings[ 'eael_img_accordion_type' ] ) {
|
||||
echo '<style typr="text/css">
|
||||
#eael-img-accordion-' . esc_html( $this->get_id() ) . ' .eael-image-accordion-hover:hover {
|
||||
flex: 3 1 0% !important;
|
||||
}
|
||||
#eael-img-accordion-' . esc_html( $this->get_id() ) . ' .eael-image-accordion-hover:hover:hover .overlay-inner * {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: none;
|
||||
transition: all .3s .3s;
|
||||
}
|
||||
</style>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,801 @@
|
||||
<?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 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 Style', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_timeline_title_color',
|
||||
[
|
||||
'label' => __('Title 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}};',
|
||||
'{{WRAPPER}} .timeline-layout-card .eael-timeline-post-title .eael-timeline-post-title-text-card' => 'color: {{VALUE}};',
|
||||
],
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_timeline_title_alignment',
|
||||
[
|
||||
'label' => __('Title 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' => __('Title 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 Style', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_timeline_excerpt_color',
|
||||
[
|
||||
'label' => __('Excerpt 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' => __('Excerpt 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' => __('Excerpt 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->get_render_attribute_string('eael_post_timeline_wrapper') . '>
|
||||
<div ' . $this->get_render_attribute_string('eael_post_timeline') . '>';
|
||||
|
||||
$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;
|
||||
|
||||
if(file_exists($template)){
|
||||
$query = new \WP_Query($args);
|
||||
if ($query->have_posts()) {
|
||||
$found_posts = $query->found_posts;
|
||||
$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 {
|
||||
_e('<p class="no-posts-found">No posts found!</p>', 'essential-addons-for-elementor-lite');
|
||||
}
|
||||
wp_reset_postdata();
|
||||
} else {
|
||||
_e('<p class="no-posts-found">No layout found!</p>', 'essential-addons-for-elementor-lite');
|
||||
}
|
||||
echo '</div>
|
||||
</div>';
|
||||
|
||||
if ( $found_posts > $args['posts_per_page'] ) {
|
||||
$this->print_load_more_button( $settings, $args, $dir_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,543 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
|
||||
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' => \Elementor\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__( 'SVG Fill Type', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'none',
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'essential-addons-for-elementor-lite' ),
|
||||
'after' => esc_html__( 'Fill After Draw', 'essential-addons-for-elementor-lite' ),
|
||||
'before' => esc_html__( 'Fill 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,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .fill-svg svg path' => 'animation-duration: {{SIZE}}s;',
|
||||
],
|
||||
'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' ),
|
||||
'hover' => esc_html__( 'Mouse Hover', 'essential-addons-for-elementor-lite' ),
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_svg_draw_offset',
|
||||
[
|
||||
'label' => esc_html__( 'Drawing Start Point', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'min' => 1,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
'default' => 50,
|
||||
'condition' => [
|
||||
'eael_svg_animation_on' => [ 'page-scroll' ],
|
||||
],
|
||||
'description' => esc_html__( 'The point at which the drawing begins to animate as scrolls down (in pixels).', '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' => '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_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_draw_speed',
|
||||
[
|
||||
'label' => esc_html__( 'Speed', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'min' => 1,
|
||||
'max' => 300,
|
||||
'step' => 1,
|
||||
'default' => 20,
|
||||
'condition' => [
|
||||
'eael_svg_animation_on!' => [ 'page-scroll' ],
|
||||
],
|
||||
'description' => esc_html__( 'Duration on SVG draws (in ms)', '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' ),
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-widget-container .fill-svg svg path' => 'fill:{{VALUE}};',
|
||||
'{{WRAPPER}} .elementor-widget-container .eael-svg-draw-container.fill-svg svg path' => 'fill:{{VALUE}};',
|
||||
'{{WRAPPER}} .elementor-widget-container .eael-svg-draw-container.fill-svg svg circle' => 'fill:{{VALUE}};',
|
||||
'{{WRAPPER}} .elementor-widget-container .eael-svg-draw-container.fill-svg svg rect' => 'fill:{{VALUE}};',
|
||||
'{{WRAPPER}} .elementor-widget-container .eael-svg-draw-container.fill-svg svg polygon' => 'fill:{{VALUE}};'
|
||||
],
|
||||
'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', '', $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' => $settings['eael_svg_fill'] === 'after' ? 'fill-svg' : '',
|
||||
'speed' => esc_attr( $settings['eael_svg_draw_speed'] ),
|
||||
'offset' => esc_attr( $settings['eael_svg_draw_offset'] ),
|
||||
'loop' => $settings['eael_svg_loop'] ? esc_attr( $settings['eael_svg_loop'] ) : 'no',
|
||||
'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'] )
|
||||
];
|
||||
|
||||
$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->get_render_attribute_string( 'eael_svg_link' ) . '>';
|
||||
}
|
||||
|
||||
echo '<div ' . $this->get_render_attribute_string( 'eael-svg-drow-wrapper' ) . '>';
|
||||
|
||||
if ( $settings['eael_svg_src'] === 'icon' ):
|
||||
|
||||
if ( $settings['eael_svg_icon']['library'] === 'svg' ) {
|
||||
if ( empty( $settings['eael_svg_icon']['value']['id'] ) ) {
|
||||
echo $this->default_custom_svg();
|
||||
}
|
||||
|
||||
Icons_Manager::render_icon( $settings['eael_svg_icon'], [ 'aria-hidden' => 'true', 'class' => [ 'eael-svg-drow-wrapper' ] ] );
|
||||
} else {
|
||||
echo Helper::get_svg_by_icon( $settings['eael_svg_icon'] );
|
||||
}
|
||||
|
||||
else:
|
||||
printf( '%s', $svg_html );
|
||||
endif;
|
||||
|
||||
echo ' </div>';
|
||||
|
||||
if ( ! empty( $settings['eael_svg_link']['url'] ) ) {
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,925 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Elements;
|
||||
|
||||
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'
|
||||
];
|
||||
}
|
||||
|
||||
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',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} div.eaelsv-sticky-player' => 'display: block',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$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', 'elementor'),
|
||||
'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 = $settings['eaelsv_is_sticky'];
|
||||
$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->get_render_attribute_string('esvp_overlay_wrapper') . '>
|
||||
<div class="eaelsv-overlay-icon">' . $icon . '</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' => $settings['eaelsv_sticky_height'],
|
||||
'data-swidth' => $settings['eaelsv_sticky_width'],
|
||||
'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->get_render_attribute_string('esvp_overlay_wrapper2') . '>
|
||||
' . $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 = $settings['eaelsv_autopaly'];
|
||||
$mute = $autoplay == 'yes' ? 'yes' : $settings['eaelsv_mute'];
|
||||
$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 = $settings['eaelsv_autopaly'];
|
||||
$mute = $autoplay == 'yes' ? 'yes' : $settings['eaelsv_mute'];
|
||||
$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'];
|
||||
$controlBars = $settings['eaelsv_sh_show_bar'];
|
||||
$autoplay = $settings['eaelsv_autopaly'];
|
||||
$mute = $settings['eaelsv_mute'];
|
||||
$loop = $settings['eaelsv_loop'];
|
||||
$interfaceColor = $settings['eaelsv_sh_video_interface_color'];
|
||||
$startTime = $settings['eaelsv_start_time'];
|
||||
$endTime = $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,981 @@
|
||||
<?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_Image_Size;
|
||||
use \Elementor\Group_Control_Typography;
|
||||
use \Elementor\Group_Control_Background;
|
||||
use Elementor\Repeater;
|
||||
use \Elementor\Utils;
|
||||
use \Elementor\Widget_Base;
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper as HelperClass;
|
||||
class Team_Member extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'eael-team-member';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Team Member', 'essential-addons-for-elementor-lite');
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'eaicon-team-mamber';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return [ 'essential-addons-elementor' ];
|
||||
}
|
||||
|
||||
public function get_keywords()
|
||||
{
|
||||
return [
|
||||
'team',
|
||||
'member',
|
||||
'team member',
|
||||
'ea team member',
|
||||
'ea team members',
|
||||
'person',
|
||||
'card',
|
||||
'meet the team',
|
||||
'team builder',
|
||||
'our team',
|
||||
'ea',
|
||||
'essential addons'
|
||||
];
|
||||
}
|
||||
|
||||
public function get_custom_help_url()
|
||||
{
|
||||
return 'https://essential-addons.com/elementor/docs/team-members/';
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_team_member_image',
|
||||
[
|
||||
'label' => esc_html__( 'Team Member Image', 'essential-addons-for-elementor-lite')
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_member_image',
|
||||
[
|
||||
'label' => __( 'Team Member Avatar', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'default' => [
|
||||
'url' => Utils::get_placeholder_image_src(),
|
||||
],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Image_Size::get_type(),
|
||||
[
|
||||
'name' => 'thumbnail',
|
||||
'default' => 'full',
|
||||
'condition' => [
|
||||
'eael_team_member_image[url]!' => '',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_team_member_content',
|
||||
[
|
||||
'label' => esc_html__( 'Team Member Content', 'essential-addons-for-elementor-lite')
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_member_name',
|
||||
[
|
||||
'label' => esc_html__( 'Name', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => esc_html__( 'John Doe', 'essential-addons-for-elementor-lite'),
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_member_job_title',
|
||||
[
|
||||
'label' => esc_html__( 'Job Position', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => esc_html__( 'Software Engineer', 'essential-addons-for-elementor-lite'),
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_member_description',
|
||||
[
|
||||
'label' => esc_html__( 'Description', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXTAREA,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => esc_html__( 'Add team member description here. Remove the text if not necessary.', 'essential-addons-for-elementor-lite'),
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_team_member_social_profiles',
|
||||
[
|
||||
'label' => esc_html__( 'Social Profiles', 'essential-addons-for-elementor-lite')
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_member_enable_social_profiles',
|
||||
[
|
||||
'label' => esc_html__( 'Display Social Profiles?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
$repeater = new Repeater();
|
||||
|
||||
$repeater->add_control(
|
||||
'social_new',
|
||||
[
|
||||
'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'fa4compatibility' => 'social',
|
||||
'default' => [
|
||||
'value' => 'fab fa-wordpress',
|
||||
'library' => 'fa-brands',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'link',
|
||||
[
|
||||
'name' => 'link',
|
||||
'label' => esc_html__( 'Link', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::URL,
|
||||
'dynamic' => ['active' => true],
|
||||
'label_block' => true,
|
||||
'default' => [
|
||||
'url' => '',
|
||||
'is_external' => 'true',
|
||||
],
|
||||
'placeholder' => esc_html__( 'Place URL here', 'essential-addons-for-elementor-lite'),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_member_social_profile_links',
|
||||
[
|
||||
'type' => Controls_Manager::REPEATER,
|
||||
'condition' => [
|
||||
'eael_team_member_enable_social_profiles!' => '',
|
||||
],
|
||||
'default' => [
|
||||
[
|
||||
'social_new' => [
|
||||
'value' => 'fab fa-facebook',
|
||||
'library' => 'fa-brands'
|
||||
]
|
||||
],
|
||||
[
|
||||
'social_new' => [
|
||||
'value' => 'fab fa-twitter',
|
||||
'library' => 'fa-brands'
|
||||
]
|
||||
],
|
||||
[
|
||||
'social_new' => [
|
||||
'value' => 'fab fa-google-plus',
|
||||
'library' => 'fa-brands'
|
||||
]
|
||||
],
|
||||
[
|
||||
'social_new' => [
|
||||
'value' => 'fab fa-linkedin',
|
||||
'library' => 'fa-brands'
|
||||
]
|
||||
],
|
||||
],
|
||||
'fields' => $repeater->get_controls(),
|
||||
'title_field' => '<i class="{{ social_new.value }}"></i>',
|
||||
]
|
||||
);
|
||||
|
||||
$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_team_members_styles_general',
|
||||
[
|
||||
'label' => esc_html__( 'Team Member Styles', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
$template_list = apply_filters('eael_team_member_style_presets_options', [
|
||||
'eael-team-members-simple' => esc_html__( 'Simple Style', 'essential-addons-for-elementor-lite' ),
|
||||
'eael-team-members-overlay' => esc_html__( 'Overlay Style', 'essential-addons-for-elementor-lite' ),
|
||||
'eael-team-members-centered' => esc_html__( 'Centered Style', 'essential-addons-for-elementor-lite' ),
|
||||
'eael-team-members-circle' => esc_html__( 'Circle Style', 'essential-addons-for-elementor-lite' ),
|
||||
'eael-team-members-social-bottom' => esc_html__( 'Social on Bottom', 'essential-addons-for-elementor-lite' ),
|
||||
'eael-team-members-social-right' => esc_html__( 'Social on Right', 'essential-addons-for-elementor-lite' ),
|
||||
]);
|
||||
|
||||
$layout_options = [];
|
||||
|
||||
if( ! empty( $template_list ) ){
|
||||
$image_path = EAEL_PLUGIN_URL . 'assets/admin/images/layout-previews/team-preset-';
|
||||
foreach( $template_list as $key => $label ){
|
||||
$layout_options[ $key ] = [
|
||||
'title' => $label,
|
||||
'image' => $image_path . str_replace( 'eael-team-members-', '', $key ) . '.png'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_preset',
|
||||
[
|
||||
'label' => esc_html__( 'Layout', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => $layout_options,
|
||||
'default' => 'eael-team-members-simple',
|
||||
'label_block' => true,
|
||||
'toggle' => false,
|
||||
'image_choose'=> true,
|
||||
]
|
||||
);
|
||||
|
||||
$team_member_style_presets_condition = apply_filters('eael_team_member_style_presets_condition', [
|
||||
'eael-team-members-centered',
|
||||
'eael-team-members-circle',
|
||||
'eael-team-members-social-bottom',
|
||||
'eael-team-members-social-right'
|
||||
]);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_preset_pro_alert',
|
||||
[
|
||||
'label' => esc_html__( 'Only available in pro version!', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'condition' => [
|
||||
'eael_team_members_preset' => $team_member_style_presets_condition
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'content_card_style',
|
||||
[
|
||||
'label' => __( 'Content Card', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'content_card_height',
|
||||
[
|
||||
'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', 'em' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 500,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 200
|
||||
]
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-content' => 'min-height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_enable_text_overlay',
|
||||
[
|
||||
'label' => esc_html__( 'Enable Description Overlay', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'no',
|
||||
'return_value' => 'yes',
|
||||
'condition' => [
|
||||
'eael_team_members_preset' => 'eael-team-members-simple'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_overlay_background',
|
||||
[
|
||||
'label' => esc_html__( 'Overlay Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => 'rgba(255,255,255,0.8)',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-members-overlay .eael-team-content' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-team-image .eael-team-text-overlay' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'conditions' => [
|
||||
'relation' => 'or',
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'eael_team_members_preset',
|
||||
'operator' => '=',
|
||||
'value' => 'eael-team-members-overlay'
|
||||
],
|
||||
[
|
||||
'name' => 'eael_team_members_enable_text_overlay',
|
||||
'operator' => '=',
|
||||
'value' => 'yes'
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_background',
|
||||
[
|
||||
'label' => esc_html__( 'Content Background Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-content' => 'background-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-image .eael-team-text-overlay' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_alignment',
|
||||
[
|
||||
'label' => esc_html__( 'Set 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',
|
||||
],
|
||||
'centered' => [
|
||||
'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' => 'eael-team-align-default',
|
||||
'prefix_class' => 'eael-team-align-',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Content Padding', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_border',
|
||||
'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'),
|
||||
'selector' => '{{WRAPPER}} .eael-team-item',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_team_members_image_styles',
|
||||
[
|
||||
'label' => esc_html__( 'Team Member Image Style', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_image_width',
|
||||
[
|
||||
'label' => esc_html__( 'Image Width', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
'unit' => '%',
|
||||
],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
],
|
||||
],
|
||||
'size_units' => [ '%', 'px' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item figure img' => 'width:{{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_team_members_preset!' => 'eael-team-members-circle'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
do_action('eael/team_member_circle_controls', $this);
|
||||
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_image_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item figure img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_image_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item figure img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_image_border',
|
||||
'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'),
|
||||
'selector' => '{{WRAPPER}} .eael-team-item figure img',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_image_rounded',
|
||||
[
|
||||
'label' => esc_html__( 'Rounded Avatar?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'team-avatar-rounded',
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_image_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item figure img' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_team_members_image_rounded!' => 'team-avatar-rounded',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_team_members_typography',
|
||||
[
|
||||
'label' => esc_html__( 'Color & Typography', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_name_heading',
|
||||
[
|
||||
'label' => __( 'Member Name', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_name_color',
|
||||
[
|
||||
'label' => esc_html__( 'Member Name Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#272727',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-member-name' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_name_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-team-item .eael-team-member-name',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_position_heading',
|
||||
[
|
||||
'label' => __( 'Member Job Position', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_position_color',
|
||||
[
|
||||
'label' => esc_html__( 'Job Position Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#272727',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-member-position' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_position_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-team-item .eael-team-member-position',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_description_heading',
|
||||
[
|
||||
'label' => __( 'Member Description', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_description_color',
|
||||
[
|
||||
'label' => esc_html__( 'Description Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#272727',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-content .eael-team-text' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-team-item .eael-team-image .eael-team-text.eael-team-text-overlay' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_description_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-team-item .eael-team-content .eael-team-text,
|
||||
{{WRAPPER}} .eael-team-item .eael-team-image .eael-team-text.eael-team-text-overlay',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_team_members_social_profiles_styles',
|
||||
[
|
||||
'label' => esc_html__( 'Social Profiles Style', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_size',
|
||||
[
|
||||
'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 200,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'size' => 35,
|
||||
'unit' => 'px'
|
||||
],
|
||||
'selectors' => [
|
||||
// '{{WRAPPER}} .eael-team-member-social-link > a' => 'width: {{SIZE}}px; height: {{SIZE}}px; line-height: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a img' => 'width: {{SIZE}}px; height: {{SIZE}}px; line-height: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a svg' => 'width: {{SIZE}}px; height: {{SIZE}}px; line-height: {{SIZE}}px;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_social_profiles_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Social Profiles Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-content > .eael-team-member-social-profiles' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-team-image > .eael-team-member-social-profiles' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_social_icons_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Social Icon Padding', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-content > .eael-team-member-social-profiles li.eael-team-member-social-link > a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-team-image > .eael-team-member-social-profiles li.eael-team-member-social-link > a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_responsive_control(
|
||||
'eael_team_members_social_icons_spacing',
|
||||
[
|
||||
'label' => esc_html__( 'Social Icon Distance', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-content > .eael-team-member-social-profiles li.eael-team-member-social-link' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .eael-team-image > .eael-team-member-social-profiles li.eael-team-member-social-link' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icons_used_gradient_bg',
|
||||
[
|
||||
'label' => __( 'Use Gradient Background', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => \Elementor\Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
|
||||
'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
|
||||
'return_value' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->start_controls_tabs( 'eael_team_members_social_icons_style_tabs' );
|
||||
|
||||
$this->start_controls_tab( 'normal', [ 'label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite') ] );
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_color',
|
||||
[
|
||||
'label' => esc_html__( 'Icon Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f1ba63',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a svg' => 'fill: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_background',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_team_members_social_icons_used_gradient_bg' => ''
|
||||
]
|
||||
]
|
||||
);
|
||||
$this->add_group_control(
|
||||
Group_Control_Background::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_social_icon_gradient_background',
|
||||
'label' => __( 'Background', 'essential-addons-for-elementor-lite' ),
|
||||
'types' => [ 'classic', 'gradient' ],
|
||||
'selector' => '{{WRAPPER}} .eael-team-member-social-link > a',
|
||||
'condition' => [
|
||||
'eael_team_members_social_icons_used_gradient_bg' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_social_icon_border',
|
||||
'selector' => '{{WRAPPER}} .eael-team-member-social-link > a',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a' => 'border-radius: {{SIZE}}px;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_social_icon_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-team-member-social-link > a',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab( 'eael_team_members_social_icon_hover', [ 'label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite') ] );
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_hover_color',
|
||||
[
|
||||
'label' => esc_html__( 'Icon Hover Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ad8647',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a:hover' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a:hover svg' => 'fill: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_hover_background',
|
||||
[
|
||||
'label' => esc_html__( 'Hover Background', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a:hover' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_team_members_social_icons_used_gradient_bg' => ''
|
||||
]
|
||||
]
|
||||
);
|
||||
$this->add_group_control(
|
||||
Group_Control_Background::get_type(),
|
||||
[
|
||||
'name' => 'eael_team_members_social_icon_hover_gradient_background',
|
||||
'label' => __( 'Background', 'essential-addons-for-elementor-lite' ),
|
||||
'types' => [ 'classic', 'gradient' ],
|
||||
'selector' => '{{WRAPPER}} .eael-team-member-social-link > a:hover',
|
||||
'condition' => [
|
||||
'eael_team_members_social_icons_used_gradient_bg' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_team_members_social_icon_hover_border_color',
|
||||
[
|
||||
'label' => esc_html__( 'Hover Border Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-team-member-social-link > a:hover' => 'border-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function render( ) {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
$team_member_image = $this->get_settings( 'eael_team_member_image' );
|
||||
$team_member_image_url = Group_Control_Image_Size::get_attachment_image_src( $team_member_image['id'], 'thumbnail', $settings );
|
||||
if( empty( $team_member_image_url ) ) : $team_member_image_url = $team_member_image['url']; else: $team_member_image_url = $team_member_image_url; endif;
|
||||
$team_member_classes = $this->get_settings('eael_team_members_preset') . " " . $this->get_settings('eael_team_members_image_rounded');
|
||||
|
||||
$this->add_render_attribute( 'eael_team_text', 'class', 'eael-team-text' );
|
||||
|
||||
if ( isset( $settings['eael_team_members_enable_text_overlay'] ) && $settings['eael_team_members_enable_text_overlay'] == 'yes' ) {
|
||||
$this->add_render_attribute( 'eael_team_text', 'class', 'eael-team-text-overlay' );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div id="eael-team-member-<?php echo esc_attr($this->get_id()); ?>" class="eael-team-item <?php echo esc_attr( $team_member_classes ); ?>">
|
||||
<div class="eael-team-item-inner">
|
||||
<div class="eael-team-image">
|
||||
<figure>
|
||||
<img src="<?php echo esc_url($team_member_image_url);?>" alt="<?php echo esc_attr( get_post_meta($team_member_image['id'], '_wp_attachment_image_alt', true) ); ?>">
|
||||
</figure>
|
||||
<?php if( 'eael-team-members-social-right' === $settings['eael_team_members_preset'] ) : ?>
|
||||
<?php do_action( 'eael/team_member_social_right_markup', $settings, $this ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if ( isset( $settings['eael_team_members_enable_text_overlay'] ) && $settings['eael_team_members_enable_text_overlay'] == 'yes' ) {
|
||||
?>
|
||||
<p <?php echo $this->get_render_attribute_string('eael_team_text'); ?>><?php echo HelperClass::eael_wp_kses($settings['eael_team_member_description']); ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="eael-team-content">
|
||||
<h2 class="eael-team-member-name"><?php echo HelperClass::eael_wp_kses($settings['eael_team_member_name']); ?></h2>
|
||||
<h3 class="eael-team-member-position"><?php echo HelperClass::eael_wp_kses($settings['eael_team_member_job_title']); ?></h3>
|
||||
|
||||
<?php if( 'eael-team-members-social-bottom' === $settings['eael_team_members_preset'] ) : ?>
|
||||
<?php do_action( 'eael/team_member_social_botton_markup', $settings, $this ); ?>
|
||||
<?php else: ?>
|
||||
<?php if ( ! empty( $settings['eael_team_member_enable_social_profiles'] ) && 'eael-team-members-social-right' !== $settings['eael_team_members_preset'] ): ?>
|
||||
<ul class="eael-team-member-social-profiles">
|
||||
<?php foreach ( $settings['eael_team_member_social_profile_links'] as $index => $item ) : ?>
|
||||
<?php $icon_migrated = isset($item['__fa4_migrated']['social_new']);
|
||||
$icon_is_new = empty($item['social']); ?>
|
||||
<?php if ( ! empty( $item['social'] ) || !empty($item['social_new'])) : ?>
|
||||
<?php $this->add_link_attributes( 'social_link_' . $index, $item['link'] ); ?>
|
||||
<li class="eael-team-member-social-link">
|
||||
<a <?php $this->print_render_attribute_string( 'social_link_' . $index ); ?>>
|
||||
<?php if ($icon_is_new || $icon_migrated) { ?>
|
||||
<?php if( isset( $item['social_new']['value']['url'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $item['social_new']['value']['url'] ); ?>" alt="<?php echo esc_attr(get_post_meta($item['social_new']['value']['id'], '_wp_attachment_image_alt', true)); ?>" />
|
||||
<?php else :
|
||||
\Elementor\Icons_Manager::render_icon( $item['social_new'], [ 'aria-hidden' => 'true' ] );
|
||||
endif; ?>
|
||||
<?php } else { ?>
|
||||
<i class="<?php echo esc_attr($item['social'] ); ?>"></i>
|
||||
<?php } ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<p <?php echo $this->get_render_attribute_string('eael_team_text'); ?>><?php echo HelperClass::eael_wp_kses($settings['eael_team_member_description']); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,950 @@
|
||||
<?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_Image_Size;
|
||||
use \Elementor\Group_Control_Typography;
|
||||
use \Elementor\Utils;
|
||||
use \Elementor\Widget_Base;
|
||||
use Essential_Addons_Elementor\Classes\Helper as HelperClass;
|
||||
|
||||
class Testimonial extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'eael-testimonial';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Testimonial', 'essential-addons-for-elementor-lite');
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'eaicon-testimonial';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return [ 'essential-addons-elementor' ];
|
||||
}
|
||||
|
||||
public function get_keywords()
|
||||
{
|
||||
return [
|
||||
'testimonial',
|
||||
'ea testimonial',
|
||||
'ea testimonials',
|
||||
'testimony',
|
||||
'review',
|
||||
'endorsement',
|
||||
'recommendation',
|
||||
'reference',
|
||||
'appreciation',
|
||||
'feedback',
|
||||
'star rating',
|
||||
'social proof',
|
||||
'ea',
|
||||
'essential addons'
|
||||
];
|
||||
}
|
||||
|
||||
public function get_custom_help_url()
|
||||
{
|
||||
return 'https://essential-addons.com/elementor/docs/testimonials/';
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_testimonial_image',
|
||||
[
|
||||
'label' => esc_html__( 'Testimonial Image', 'essential-addons-for-elementor-lite')
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_enable_avatar',
|
||||
[
|
||||
'label' => esc_html__( 'Display Avatar?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'image',
|
||||
[
|
||||
'label' => __( 'Testimonial Avatar', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'default' => [
|
||||
'url' => Utils::get_placeholder_image_src(),
|
||||
],
|
||||
'condition' => [
|
||||
'eael_testimonial_enable_avatar' => 'yes',
|
||||
],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Image_Size::get_type(),
|
||||
[
|
||||
'name' => 'image',
|
||||
'default' => 'thumbnail',
|
||||
'condition' => [
|
||||
'image[url]!' => '',
|
||||
'eael_testimonial_enable_avatar' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_testimonial_content',
|
||||
[
|
||||
'label' => esc_html__( 'Testimonial Content', 'essential-addons-for-elementor-lite')
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_name',
|
||||
[
|
||||
'label' => esc_html__( 'User Name', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'default' => esc_html__( 'John Doe', 'essential-addons-for-elementor-lite'),
|
||||
'dynamic' => [ 'active' => true ],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_company_title',
|
||||
[
|
||||
'label' => esc_html__( 'Company Name', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'default' => esc_html__( 'Codetic', 'essential-addons-for-elementor-lite'),
|
||||
'dynamic' => [ 'active' => true ],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_description',
|
||||
[
|
||||
'label' => esc_html__( 'Testimonial Description', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::WYSIWYG,
|
||||
'default' => esc_html__( 'Add testimonial description here. Edit and place your own text.', 'essential-addons-for-elementor-lite'),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'content_height',
|
||||
[
|
||||
'label' => esc_html__( 'Description Height', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', '%', 'em'],
|
||||
'range' => [
|
||||
'px' => [ 'max' => 300 ],
|
||||
'%' => [ 'max' => 100 ]
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content' => 'height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_enable_rating',
|
||||
[
|
||||
'label' => esc_html__( 'Display Rating?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_rating_number',
|
||||
[
|
||||
'label' => __( 'Rating Number', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'rating-five',
|
||||
'options' => [
|
||||
'rating-one' => __( '1', 'essential-addons-for-elementor-lite'),
|
||||
'rating-two' => __( '2', 'essential-addons-for-elementor-lite'),
|
||||
'rating-three' => __( '3', 'essential-addons-for-elementor-lite'),
|
||||
'rating-four' => __( '4', 'essential-addons-for-elementor-lite'),
|
||||
'rating-five' => __( '5', 'essential-addons-for-elementor-lite'),
|
||||
],
|
||||
'condition' => [
|
||||
'eael_testimonial_enable_rating' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$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_testimonial_styles_general',
|
||||
[
|
||||
'label' => esc_html__( 'Testimonial Styles', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
$image_path = EAEL_PLUGIN_URL . 'assets/admin/images/layout-previews/testimonial-';
|
||||
$this->add_control(
|
||||
'eael_testimonial_style',
|
||||
[
|
||||
'label' => esc_html__( 'Select Style', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'default-style' => [
|
||||
'title' => esc_html__('Default', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'default-style.png'
|
||||
],
|
||||
'classic-style' => [
|
||||
'title' => esc_html__('Classic', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'classic-style.png'
|
||||
],
|
||||
'middle-style' => [
|
||||
'title' => esc_html__('Content | Icon/Image | Bio', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'middle-style.png'
|
||||
],
|
||||
'icon-img-left-content' => [
|
||||
'title' => esc_html__('Icon/Image | Content', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'icon-img-left-content.png'
|
||||
],
|
||||
'icon-img-right-content' => [
|
||||
'title' => esc_html__('Content | Icon/Image', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'icon-img-right-content.png'
|
||||
],
|
||||
'content-top-icon-title-inline' => [
|
||||
'title' => esc_html__('Content Top | Icon Title Inline', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'content-top-icon-title-inline.png'
|
||||
],
|
||||
'content-bottom-icon-title-inline' => [
|
||||
'title' => esc_html__('Content Bottom | Icon Title Inline', 'essential-addons-for-elementor-lite'),
|
||||
'image' => $image_path . 'content-bottom-icon-title-inline.png'
|
||||
],
|
||||
],
|
||||
'default' => 'default-style',
|
||||
'label_block' => true,
|
||||
'toggle' => false,
|
||||
'image_choose'=> true,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_is_gradient_background',
|
||||
[
|
||||
'label' => __('Use Gradient Background', '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',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_background',
|
||||
[
|
||||
'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-item' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_testimonial_is_gradient_background' => ''
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Background::get_type(),
|
||||
[
|
||||
'name' => 'eael_testimonial_gradient_background',
|
||||
'label' => __('Gradient Background', 'essential-addons-for-elementor-lite'),
|
||||
'types' => ['classic', 'gradient'],
|
||||
'selector' => '{{WRAPPER}} .eael-testimonial-item',
|
||||
'condition' => [
|
||||
'eael_testimonial_is_gradient_background' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_alignment',
|
||||
[
|
||||
'label' => esc_html__( 'Layout Alignment', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => true,
|
||||
'options' => [
|
||||
'default' => [
|
||||
'title' => __( 'Default', 'essential-addons-for-elementor-lite'),
|
||||
'icon' => 'eicon-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',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content' => 'text-align: {{VALUE}};',
|
||||
'{{WRAPPER}} .eael-testimonial-image' => 'text-align: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_user_display_block',
|
||||
[
|
||||
'label' => esc_html__( 'Display User & Company Block?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'yes',
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_testimonial_image_styles',
|
||||
[
|
||||
'label' => esc_html__( 'Testimonial Image Style', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'condition' => [
|
||||
'eael_testimonial_enable_avatar' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_testimonial_image_width',
|
||||
[
|
||||
'label' => esc_html__( 'Image Width', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 150,
|
||||
'unit' => 'px',
|
||||
],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
],
|
||||
],
|
||||
'size_units' => [ '%', 'px' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-image figure > img' => 'width:{{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_testimonial_max_image_width',
|
||||
[
|
||||
'label' => esc_html__( 'Image Max Width', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
'unit' => '%',
|
||||
],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'size_units' => [ '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-image' => 'max-width:{{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_testimonial_image_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-image img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_testimonial_image_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-image img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'eael_testimonial_image_border',
|
||||
'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'),
|
||||
'selector' => '{{WRAPPER}} .eael-testimonial-image img',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_image_rounded',
|
||||
[
|
||||
'label' => esc_html__( 'Rounded Avatar?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'testimonial-avatar-rounded',
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_image_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-image img' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_testimonial_image_rounded!' => 'testimonial-avatar-rounded',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// color, Typography & Spacing
|
||||
$this->start_controls_section(
|
||||
'eael_section_testimonial_typography',
|
||||
[
|
||||
'label' => esc_html__( 'Color, Typography & Spacing', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_name_heading',
|
||||
[
|
||||
'label' => __( 'User Name', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_name_color',
|
||||
[
|
||||
'label' => esc_html__( 'User Name Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#272727',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .eael-testimonial-user' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_testimonial_name_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-testimonial-content .eael-testimonial-user',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_name_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .eael-testimonial-user' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_company_heading',
|
||||
[
|
||||
'label' => __( 'Company Name', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_company_color',
|
||||
[
|
||||
'label' => esc_html__( 'Company Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#272727',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .eael-testimonial-user-company' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_testimonial_position_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-testimonial-content .eael-testimonial-user-company',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_company_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .eael-testimonial-user-company' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_description_heading',
|
||||
[
|
||||
'label' => __( 'Testimonial Text', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_description_color',
|
||||
[
|
||||
'label' => esc_html__( 'Testimonial Text Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#292929',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .eael-testimonial-text' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_testimonial_description_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-testimonial-content .eael-testimonial-text',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_description_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .eael-testimonial-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_rating_heading',
|
||||
[
|
||||
'label' => __( 'Rating', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_rating_item_color',
|
||||
[
|
||||
'label' => esc_html__( 'Rating Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f2b01e',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .rating-five .testimonial-star-rating li i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .rating-one .testimonial-star-rating li:first-child i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .rating-two .testimonial-star-rating li:nth-child(1) i, {{WRAPPER}} .rating-two .testimonial-star-rating li:nth-child(2) i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .rating-three .testimonial-star-rating li:nth-child(1) i, {{WRAPPER}} .rating-three .testimonial-star-rating li:nth-child(2) i, {{WRAPPER}} .rating-three .testimonial-star-rating li:nth-child(3) i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .rating-four .testimonial-star-rating li:nth-child(1) i, {{WRAPPER}} .rating-four .testimonial-star-rating li:nth-child(2) i, {{WRAPPER}} .rating-four .testimonial-star-rating li:nth-child(3) i, {{WRAPPER}} .rating-four .testimonial-star-rating li:nth-child(4) i' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_rating_item_size',
|
||||
[
|
||||
'label' => esc_html__( 'Rating Size', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .testimonial-star-rating li i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_rating_item_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Distance Between Rating Item', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .testimonial-star-rating li' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_rating_margin',
|
||||
[
|
||||
'label' => esc_html__( 'Margin', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%', 'em' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-content .testimonial-star-rating' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'eael_section_testimonial_quotation_typography',
|
||||
[
|
||||
'label' => esc_html__( 'Quotation Style', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_STYLE
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'eael_testimonial_quotation_color',
|
||||
[
|
||||
'label' => esc_html__( 'Quotation Mark Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => 'rgba(0,0,0,0.15)',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eael-testimonial-quote' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'eael_testimonial_quotation_typography',
|
||||
'selector' => '{{WRAPPER}} .eael-testimonial-quote',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_testimonial_quotation_top',
|
||||
[
|
||||
'label' => esc_html__( 'Quotation Postion From Top', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 5,
|
||||
'unit' => '%',
|
||||
],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
]
|
||||
],
|
||||
'size_units' => [ '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} span.eael-testimonial-quote' => 'top:{{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'eael_testimonial_quotation_right',
|
||||
[
|
||||
'label' => esc_html__( 'Quotation Postion From Right', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 5,
|
||||
'unit' => '%',
|
||||
],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
]
|
||||
],
|
||||
'size_units' => [ '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} span.eael-testimonial-quote' => 'right:{{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
protected function render_testimonial_image() {
|
||||
$settings = $this->get_settings();
|
||||
$image = Group_Control_Image_Size::get_attachment_image_html( $settings );
|
||||
if( ! empty($image) && ! empty($settings['eael_testimonial_enable_avatar']) ) {
|
||||
ob_start();
|
||||
?>
|
||||
<div class="eael-testimonial-image">
|
||||
<?php if( 'yes' == $settings['eael_testimonial_enable_avatar'] ) : ?>
|
||||
<figure><?php echo Group_Control_Image_Size::get_attachment_image_html( $settings ); ?></figure>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
echo ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
protected function render_testimonial_rating() {
|
||||
$settings = $this->get_settings_for_display('eael_testimonial_enable_rating');
|
||||
|
||||
if ( $settings == 'yes' ) :
|
||||
ob_start();
|
||||
?>
|
||||
<ul class="testimonial-star-rating">
|
||||
<li><i class="fas fa-star" aria-hidden="true"></i></li>
|
||||
<li><i class="fas fa-star" aria-hidden="true"></i></li>
|
||||
<li><i class="fas fa-star" aria-hidden="true"></i></li>
|
||||
<li><i class="fas fa-star" aria-hidden="true"></i></li>
|
||||
<li><i class="fas fa-star" aria-hidden="true"></i></li>
|
||||
</ul>
|
||||
<?php
|
||||
echo ob_get_clean();
|
||||
endif;
|
||||
}
|
||||
|
||||
protected function render_user_name_and_company() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
if( ! empty($settings['eael_testimonial_name']) ) : ?><p <?php echo $this->get_render_attribute_string('eael_testimonial_user'); ?>><?php echo HelperClass::eael_wp_kses($settings['eael_testimonial_name']); ?></p><?php endif;
|
||||
if( ! empty($settings['eael_testimonial_company_title']) ) : ?><p class="eael-testimonial-user-company"><?php echo HelperClass::eael_wp_kses($settings['eael_testimonial_company_title']); ?></p><?php endif;
|
||||
}
|
||||
|
||||
protected function testimonial_quote() {
|
||||
echo '<span class="eael-testimonial-quote"></span>';
|
||||
}
|
||||
|
||||
protected function testimonial_desc() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
echo '<div class="eael-testimonial-text">'.wpautop($settings['eael_testimonial_description']).'</div>';
|
||||
}
|
||||
|
||||
|
||||
protected function render() {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
$rating = $this->get_settings_for_display('eael_testimonial_enable_rating');
|
||||
|
||||
$this->add_render_attribute(
|
||||
'eael_testimonial_wrap',
|
||||
[
|
||||
'id' => 'eael-testimonial-'.esc_attr($this->get_id()),
|
||||
'class' => [
|
||||
'eael-testimonial-item',
|
||||
'clearfix',
|
||||
$this->get_settings('eael_testimonial_image_rounded'),
|
||||
esc_attr($settings['eael_testimonial_style']),
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
if ( $rating == 'yes' )
|
||||
$this->add_render_attribute('eael_testimonial_wrap', 'class', $this->get_settings('eael_testimonial_rating_number'));
|
||||
|
||||
$this->add_render_attribute('eael_testimonial_user', 'class', 'eael-testimonial-user');
|
||||
if ( ! empty( $settings['eael_testimonial_user_display_block'] ) )
|
||||
$this->add_render_attribute('eael_testimonial_user', 'style', 'display: block; float: none;');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div <?php echo $this->get_render_attribute_string('eael_testimonial_wrap'); ?>>
|
||||
|
||||
<?php if('classic-style' == $settings['eael_testimonial_style']) { ?>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php
|
||||
// $this->testimonial_quote();
|
||||
$this->testimonial_desc();
|
||||
?>
|
||||
<div class="clearfix">
|
||||
<?php $this->render_user_name_and_company(); ?>
|
||||
</div>
|
||||
<?php $this->render_testimonial_rating( $settings ); ?>
|
||||
</div>
|
||||
<?php $this->render_testimonial_image(); ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if('middle-style' == $settings['eael_testimonial_style']) { ?>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php
|
||||
// $this->testimonial_quote();
|
||||
$this->testimonial_desc();
|
||||
?>
|
||||
<?php $this->render_testimonial_image(); ?>
|
||||
<div class="clearfix">
|
||||
<?php $this->render_user_name_and_company(); ?>
|
||||
</div>
|
||||
<?php $this->render_testimonial_rating( $settings ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if('default-style' == $settings['eael_testimonial_style']) { ?>
|
||||
<?php $this->render_testimonial_image(); ?>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php
|
||||
// $this->testimonial_quote();
|
||||
$this->testimonial_desc();
|
||||
$this->render_testimonial_rating( $settings );
|
||||
$this->render_user_name_and_company();
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if('icon-img-left-content' == $settings['eael_testimonial_style']) { ?>
|
||||
<?php
|
||||
// $this->testimonial_quote();
|
||||
$this->render_testimonial_image();
|
||||
?>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php
|
||||
$this->testimonial_desc();
|
||||
$this->render_testimonial_rating( $settings );
|
||||
?>
|
||||
<div class="bio-text clearfix">
|
||||
<?php $this->render_user_name_and_company(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if('icon-img-right-content' == $settings['eael_testimonial_style']) { ?>
|
||||
<?php
|
||||
// $this->testimonial_quote();
|
||||
$this->render_testimonial_image();
|
||||
?>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php
|
||||
$this->testimonial_desc();
|
||||
$this->render_testimonial_rating( $settings );
|
||||
?>
|
||||
<div class="bio-text-right"><?php $this->render_user_name_and_company(); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if('content-top-icon-title-inline' == $settings['eael_testimonial_style']) { ?>
|
||||
<div class="eael-testimonial-content eael-testimonial-inline-bio">
|
||||
<?php $this->render_testimonial_image(); ?>
|
||||
<div class="bio-text"><?php $this->render_user_name_and_company(); ?></div>
|
||||
<?php $this->render_testimonial_rating( $settings ); ?>
|
||||
</div>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php $this->testimonial_desc(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if('content-bottom-icon-title-inline' == $settings['eael_testimonial_style']) { ?>
|
||||
<div class="eael-testimonial-content">
|
||||
<?php $this->testimonial_desc(); ?>
|
||||
</div>
|
||||
<div class="eael-testimonial-content eael-testimonial-inline-bio">
|
||||
<?php $this->render_testimonial_image(); ?>
|
||||
<div class="bio-text"><?php $this->render_user_name_and_company(); ?></div>
|
||||
<?php $this->render_testimonial_rating( $settings ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php $this->testimonial_quote(); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
|
||||
protected function content_template() {}
|
||||
}
|
||||
@@ -0,0 +1,752 @@
|
||||
<?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'
|
||||
];
|
||||
}
|
||||
|
||||
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'] );
|
||||
?>
|
||||
<div class="eael-tooltip">
|
||||
<?php if( $settings['eael_tooltip_type'] === 'text' ) : ?>
|
||||
<<?php echo esc_attr( 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_attr( 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 __( $settings['eael_tooltip_hover_content'] ); ?></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 __( $settings['eael_tooltip_hover_content'] ); ?></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 __( $settings['eael_tooltip_hover_content'] ); ?></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 __( $settings['eael_tooltip_hover_content'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function content_template() {}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,372 @@
|
||||
<?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\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 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="'.htmlspecialchars(json_encode($data), ENT_QUOTES,
|
||||
'UTF-8').'" '.$this->get_render_attribute_string('eael_typeform_wrapper').'></div>';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,803 @@
|
||||
<?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 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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Elements;
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Widget_Base;
|
||||
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 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' ) );
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Extensions;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Post_Duplicator {
|
||||
public function __construct() {
|
||||
|
||||
add_filter( 'admin_action_eae_duplicate', array( $this, 'duplicate' ) );
|
||||
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 10000 );
|
||||
add_filter( 'post_row_actions', array( $this, 'row_actions' ), 10, 2 );
|
||||
add_filter( 'page_row_actions', array( $this, 'row_actions' ), 10, 2 );
|
||||
|
||||
}
|
||||
|
||||
public function admin_bar_menu( $wp_admin_bar ) {
|
||||
|
||||
global $pagenow;
|
||||
global $post;
|
||||
|
||||
$enabled_on = get_option( 'eael_save_post_duplicator_post_type', 'all' );
|
||||
|
||||
if ( ! is_admin() || $pagenow !== 'post.php' || ( $enabled_on != 'all' || $post->post_type != $enabled_on ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$duplicate_url = admin_url( 'admin.php?action=eae_duplicate&post=' . $post->ID );
|
||||
$duplicate_url = wp_nonce_url( $duplicate_url, 'ea_duplicator' );
|
||||
$wp_admin_bar->add_menu(
|
||||
array(
|
||||
'id' => 'eae-duplicator',
|
||||
'title' => __( 'EA Duplicator', 'essential-addons-for-elementor-lite' ),
|
||||
'href' => $duplicate_url
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* EA Duplicator Button added in table row
|
||||
*
|
||||
* @param array $actions
|
||||
* @param WP_Post $post
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function row_actions( $actions, $post ) {
|
||||
|
||||
$enabled_on = get_option( 'eael_save_post_duplicator_post_type', 'all' );
|
||||
|
||||
if ( current_user_can( 'edit_posts' ) && ( $enabled_on == 'all' || $post->post_type == $enabled_on ) ) {
|
||||
$duplicate_url = admin_url( 'admin.php?action=eae_duplicate&post=' . $post->ID );
|
||||
$duplicate_url = wp_nonce_url( $duplicate_url, 'ea_duplicator' );
|
||||
$actions['eae_duplicate'] = sprintf( '<a href="%s" title="%s">%s</a>', $duplicate_url, __( 'Duplicate ' . esc_attr( $post->post_title ), 'essential-addons-for-elementor-lite' ), __( 'EA Duplicator', 'essential-addons-for-elementor-lite' ) );
|
||||
}
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate a post
|
||||
* @return void
|
||||
*/
|
||||
public function duplicate() {
|
||||
|
||||
$nonce = isset( $_REQUEST['_wpnonce'] ) && ! empty( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : null;
|
||||
$post_id = isset( $_REQUEST['post'] ) && ! empty( $_REQUEST['post'] ) ? intval( $_REQUEST['post'] ) : null;
|
||||
$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? trim( sanitize_text_field( $_REQUEST['action'] ) ) : null;
|
||||
|
||||
if ( is_null( $nonce ) || is_null( $post_id ) || $action !== 'eae_duplicate' ) {
|
||||
return; // Return if action is not eae_duplicate
|
||||
}
|
||||
|
||||
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ea_duplicator' ) ) {
|
||||
return; // Return if nonce is not valid
|
||||
}
|
||||
|
||||
$post = sanitize_post( get_post( $post_id ), 'db' );
|
||||
|
||||
if ( is_null( $post ) ) {
|
||||
return; // Return if post is not there.
|
||||
}
|
||||
|
||||
$current_user = wp_get_current_user();
|
||||
$allowed_roles = array('editor', 'administrator', 'author');
|
||||
$redirect_url = admin_url( 'edit.php?post_type=' . $post->post_type );
|
||||
|
||||
if ( ! array_intersect( $allowed_roles, $current_user->roles ) ) {
|
||||
switch ( $post->post_type ) {
|
||||
case 'post':
|
||||
$can_edit_others_posts = current_user_can('edit_others_posts');
|
||||
break;
|
||||
case 'page':
|
||||
$can_edit_others_posts = current_user_can('edit_others_pages');
|
||||
break;
|
||||
default :
|
||||
$can_edit_others_posts = current_user_can('edit_others_posts');
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $current_user->ID !== $post->post_author && ! $can_edit_others_posts ){
|
||||
wp_safe_redirect( $redirect_url );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$duplicate_post_args = array(
|
||||
'post_author' => $current_user->ID,
|
||||
'post_title' => $post->post_title . ' - Copy',
|
||||
'post_content' => $post->post_content,
|
||||
'post_excerpt' => $post->post_excerpt,
|
||||
'post_parent' => $post->post_parent,
|
||||
'post_status' => 'draft',
|
||||
'ping_status' => $post->ping_status,
|
||||
'comment_status' => $post->comment_status,
|
||||
'post_password' => $post->post_password,
|
||||
'post_type' => $post->post_type,
|
||||
'to_ping' => $post->to_ping,
|
||||
'menu_order' => $post->menu_order,
|
||||
);
|
||||
$duplicated_id = wp_insert_post( $duplicate_post_args );
|
||||
|
||||
if ( ! is_wp_error( $duplicated_id ) ) {
|
||||
$taxonomies = get_object_taxonomies( $post->post_type );
|
||||
if ( ! empty( $taxonomies ) && is_array( $taxonomies ) ) {
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
$post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
|
||||
wp_set_object_terms( $duplicated_id, $post_terms, $taxonomy, false );
|
||||
}
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$post_meta = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $post_id ) );
|
||||
|
||||
if ( ! empty( $post_meta ) && is_array( $post_meta ) ) {
|
||||
|
||||
$duplicate_insert_query = "INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value ) VALUES ";
|
||||
$insert = '';
|
||||
|
||||
foreach ( $post_meta as $meta_info ) {
|
||||
|
||||
$meta_key = sanitize_text_field( $meta_info->meta_key );
|
||||
$meta_value = $meta_info->meta_value;
|
||||
|
||||
$exclude_meta_keys = [ '_wc_average_rating', '_wc_review_count', '_wc_rating_count' ];
|
||||
|
||||
if( in_array($meta_key, $exclude_meta_keys) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $meta_key === '_elementor_template_type' ) {
|
||||
delete_post_meta( $duplicated_id, '_elementor_template_type' );
|
||||
}
|
||||
|
||||
if ( ! empty( $insert ) ) {
|
||||
$insert .= ', ';
|
||||
}
|
||||
|
||||
$insert .= $wpdb->prepare( '(%d, %s, %s)', $duplicated_id, $meta_key, $meta_value );
|
||||
}
|
||||
|
||||
$wpdb->query( $duplicate_insert_query . $insert );
|
||||
}
|
||||
}
|
||||
|
||||
wp_safe_redirect( $redirect_url );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
namespace Essential_Addons_Elementor\Extensions;
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
class Promotion
|
||||
{
|
||||
public function __construct() {
|
||||
if ( ! apply_filters( 'eael/pro_enabled', false ) ) {
|
||||
add_action( 'elementor/element/section/section_layout/after_section_end', [ $this, 'section_parallax' ], 10 );
|
||||
add_action( 'elementor/element/section/section_layout/after_section_end', [ $this, 'section_particles' ], 10 );
|
||||
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'content_protection' ], 10 );
|
||||
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'section_tooltip' ], 10 );
|
||||
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'conditional_display' ] );
|
||||
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'conditional_display' ] );
|
||||
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'conditional_display' ] );
|
||||
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'smooth_animation' ] );
|
||||
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'smooth_animation' ] );
|
||||
}
|
||||
}
|
||||
|
||||
public function teaser_template($texts)
|
||||
{
|
||||
$html = '<div class="ea-nerd-box">
|
||||
<div class="ea-nerd-box-icon">
|
||||
<img src="' . EAEL_PLUGIN_URL . 'assets/admin/images/icon-ea-new-logo.svg' . '">
|
||||
</div>
|
||||
<div class="ea-nerd-box-title">' . $texts['title'] . '</div>
|
||||
<div class="ea-nerd-box-message">' . $texts['messages'] . '</div>
|
||||
<a class="ea-nerd-box-link elementor-button elementor-button-default" href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">
|
||||
' . __('Upgrade Essential Addons', 'essential-addons-for-elementor-lite') . '
|
||||
</a>
|
||||
</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function section_parallax($element)
|
||||
{
|
||||
$element->start_controls_section(
|
||||
'eael_ext_section_parallax_section',
|
||||
[
|
||||
'label' => __('<i class="eaicon-logo"></i> Parallax', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_LAYOUT,
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_section_parallax_pro_required',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => $this->teaser_template([
|
||||
'title' => __('Meet EA Parallax', 'essential-addons-for-elementor-lite'),
|
||||
'messages' => __('Create stunning Parallax effects on your site and blow everyone away.', 'essential-addons-for-elementor-lite'),
|
||||
]),
|
||||
]
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
public function section_particles($element)
|
||||
{
|
||||
$element->start_controls_section(
|
||||
'eael_ext_section_particles_section',
|
||||
[
|
||||
'label' => __('<i class="eaicon-logo"></i> Particles', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_LAYOUT,
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_section_particles_pro_required',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => $this->teaser_template([
|
||||
'title' => __('Meet EA Particles', 'essential-addons-for-elementor-lite'),
|
||||
'messages' => __('Create stunning Particles effects on your site and blow everyone away.', 'essential-addons-for-elementor-lite'),
|
||||
]),
|
||||
]
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
public function content_protection($element)
|
||||
{
|
||||
$element->start_controls_section(
|
||||
'eael_ext_content_protection_section',
|
||||
[
|
||||
'label' => __('<i class="eaicon-logo"></i> Content Protection', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_ADVANCED,
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_content_protection_pro_required',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => $this->teaser_template([
|
||||
'title' => __('Meet EA Content Protection', 'essential-addons-for-elementor-lite'),
|
||||
'messages' => __('Put a restriction on any of your content and protect your privacy.', 'essential-addons-for-elementor-lite'),
|
||||
]),
|
||||
]
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
public function section_tooltip($element)
|
||||
{
|
||||
$element->start_controls_section(
|
||||
'eael_ext_section_tooltip_section',
|
||||
[
|
||||
'label' => __('<i class="eaicon-logo"></i> Advanced Tooltip', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_ADVANCED,
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_section_tooltip_pro_required',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => $this->teaser_template([
|
||||
'title' => __('Meet EA Advanced Tooltip', 'essential-addons-for-elementor-lite'),
|
||||
'messages' => __('Highlight any Elementor widgets with a key message when they are hovered.', 'essential-addons-for-elementor-lite'),
|
||||
]),
|
||||
]
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
public function conditional_display( $element ) {
|
||||
$element->start_controls_section(
|
||||
'eael_conditional_display_section',
|
||||
[
|
||||
'label' => __( '<i class="eaicon-logo"></i> Conditional Display', 'essential-addons-for-elementor-lite' ),
|
||||
'tab' => Controls_Manager::TAB_ADVANCED
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_conditional_display_section_pro_required',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => $this->teaser_template( [
|
||||
'title' => __( 'Meet EA Conditional Display', 'essential-addons-for-elementor-lite' ),
|
||||
'messages' => __( "Control any section, column, container or 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,443 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Extensions;
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use \Elementor\Controls_Manager;
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
class Scroll_to_Top
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
add_action('elementor/documents/register_controls', [$this, 'register_controls'], 10);
|
||||
}
|
||||
|
||||
public function register_controls($element)
|
||||
{
|
||||
if (Helper::prevent_extension_loading(get_the_ID())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$global_settings = get_option('eael_global_settings');
|
||||
|
||||
$element->start_controls_section(
|
||||
'eael_ext_scroll_to_top_section',
|
||||
[
|
||||
'label' => __('<i class="eaicon-logo"></i> Scroll to Top', 'essential-addons-for-elementor-lite'),
|
||||
'tab' => Controls_Manager::TAB_SETTINGS,
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top',
|
||||
[
|
||||
'label' => __('Enable Scroll to Top', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'no',
|
||||
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
|
||||
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
|
||||
'return_value' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_has_global',
|
||||
[
|
||||
'label' => __('Enabled Globally?', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::HIDDEN,
|
||||
'default' => (isset($global_settings['eael_ext_scroll_to_top']['enabled']) ? $global_settings['eael_ext_scroll_to_top']['enabled'] : false),
|
||||
]
|
||||
);
|
||||
|
||||
if (isset($global_settings['eael_ext_scroll_to_top']['enabled']) && ($global_settings['eael_ext_scroll_to_top']['enabled'] == true) && get_the_ID() != $global_settings['eael_ext_scroll_to_top']['post_id'] && get_post_status($global_settings['eael_ext_scroll_to_top']['post_id']) == 'publish') {
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_global_warning_text',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => __('You can modify the Global Scroll to Top by <strong><a href="' . get_bloginfo('url') . '/wp-admin/post.php?post=' . $global_settings['eael_ext_scroll_to_top']['post_id'] . '&action=elementor">Clicking Here</a></strong>', 'essential-addons-for-elementor-lite'),
|
||||
'content_classes' => 'eael-warning',
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_global',
|
||||
[
|
||||
'label' => __('Enable Scroll to Top Globally', 'essential-addons-for-elementor-lite'),
|
||||
'description' => __('Enabling this option will effect on entire site.', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'no',
|
||||
'label_on' => __('Yes', 'essential-addons-for-elementor-lite'),
|
||||
'label_off' => __('No', 'essential-addons-for-elementor-lite'),
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_global_display_condition',
|
||||
[
|
||||
'label' => __('Display On', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'all',
|
||||
'options' => [
|
||||
'posts' => __('All Posts', 'essential-addons-for-elementor-lite'),
|
||||
'pages' => __('All Pages', 'essential-addons-for-elementor-lite'),
|
||||
'all' => __('All Posts & Pages', 'essential-addons-for-elementor-lite'),
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
'eael_ext_scroll_to_top_global' => 'yes',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_position_text',
|
||||
[
|
||||
'label' => esc_html__('Position', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'bottom-right',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'bottom-left' => esc_html__('Bottom Left', 'essential-addons-for-elementor-lite'),
|
||||
'bottom-right' => esc_html__('Bottom Right', 'essential-addons-for-elementor-lite'),
|
||||
],
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_position_bottom',
|
||||
[
|
||||
'label' => __('Bottom', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', 'em', '%'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 15,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'bottom: {{SIZE}}{{UNIT}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_position_left',
|
||||
[
|
||||
'label' => __('Left', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', 'em', '%'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 15,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'left: {{SIZE}}{{UNIT}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
'eael_ext_scroll_to_top_position_text' => 'bottom-left',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_position_right',
|
||||
[
|
||||
'label' => __('Right', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', 'em', '%'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 15,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'right: {{SIZE}}{{UNIT}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
'eael_ext_scroll_to_top_position_text' => 'bottom-right',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_width',
|
||||
[
|
||||
'label' => __('Width', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 50,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'width: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_height',
|
||||
[
|
||||
'label' => __('Height', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 50,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_z_index',
|
||||
[
|
||||
'label' => __('Z Index', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 9999,
|
||||
'step' => 10,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 9999,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'z-index: {{SIZE}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_opacity',
|
||||
[
|
||||
'label' => __('Opacity', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
'step' => 0.01,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 0.7,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'opacity: {{SIZE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_icon_image',
|
||||
[
|
||||
'label' => esc_html__('Icon', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'default' => [
|
||||
'value' => 'fas fa-chevron-up',
|
||||
'library' => 'fa-solid',
|
||||
],
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_icon_size',
|
||||
[
|
||||
'label' => __('Icon Size', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 16,
|
||||
'unit' => 'px',
|
||||
],
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_icon_color',
|
||||
[
|
||||
'label' => __('Icon Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button i' => 'color: {{VALUE}}',
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button svg' => 'fill: {{VALUE}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_bg_color',
|
||||
[
|
||||
'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#000000',
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_ext_scroll_to_top_button_border_radius',
|
||||
[
|
||||
'label' => __('Border Radius', 'essential-addons-for-elementor-lite'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 5,
|
||||
],
|
||||
'selectors' => [
|
||||
'.eael-ext-scroll-to-top-wrap .eael-ext-scroll-to-top-button' => 'border-radius: {{SIZE}}{{UNIT}}',
|
||||
],
|
||||
'condition' => [
|
||||
'eael_ext_scroll_to_top' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Extensions;
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Wrapper_Link {
|
||||
|
||||
/**
|
||||
* Initialize hooks
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'elementor/element/common/_section_style/after_section_end', [ $this, 'register_controls' ] );
|
||||
add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'register_controls' ] );
|
||||
add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'register_controls' ] );
|
||||
add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'register_controls' ] );
|
||||
add_action( 'elementor/frontend/before_render', [ $this, 'before_render' ], 1 );
|
||||
}
|
||||
|
||||
public function register_controls( $element ) {
|
||||
$element->start_controls_section(
|
||||
'eael_wrapper_link_section',
|
||||
[
|
||||
'label' => __( '<i class="eaicon-logo"></i> Wrapper Link', 'essential-addons-for-elementor-lite' ),
|
||||
'tab' => Controls_Manager::TAB_ADVANCED
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_wrapper_link_switch',
|
||||
[
|
||||
'label' => __( 'Enable Wrapper Link', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::SWITCHER
|
||||
]
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'eael_wrapper_link',
|
||||
[
|
||||
'label' => __( 'Link', 'essential-addons-for-elementor-lite' ),
|
||||
'type' => Controls_Manager::URL,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'condition' => [
|
||||
'eael_wrapper_link_switch!' => ''
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
public function before_render( $element ) {
|
||||
$wrapper_link_settings = $element->get_settings_for_display( 'eael_wrapper_link' );
|
||||
|
||||
if ( ! empty( $element->get_settings_for_display( 'eael_wrapper_link_switch' ) ) && ! empty( $wrapper_link_settings['url'] ) ) {
|
||||
$element->add_render_attribute( '_wrapper',
|
||||
'data-eael-wrapper-link',
|
||||
wp_json_encode( [
|
||||
'url' => esc_url( $wrapper_link_settings['url'] ),
|
||||
'is_external' => esc_attr( $wrapper_link_settings['is_external'] ),
|
||||
'nofollow' => esc_attr( $wrapper_link_settings['nofollow'] )
|
||||
] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?php // Silence is golden
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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', ['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">' . $cat_icon . '</div>';
|
||||
}
|
||||
|
||||
if ($settings['show_title']) {
|
||||
echo '<' . Helper::eael_validate_html_tag($settings['title_tag']) . ' class="eael-bd-cb-cat-title__layout-2"><span>' . $term->name . '</span></' . Helper::eael_validate_html_tag($settings['title_tag']) . '>';
|
||||
}
|
||||
|
||||
if ($settings['show_count']) {
|
||||
printf('<div class="eael-bd-cb-cat-count__layout-2"><span class="count-inner__layout-2">%s</span></div>', Helper::get_doc_post_count($term->count, $term->term_id));
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</a>';
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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">' . $cat_icon . '</div>';
|
||||
}
|
||||
|
||||
if ($settings['show_title']) {
|
||||
echo '<' . Helper::eael_validate_html_tag($settings['title_tag'] ). ' class="eael-bd-cb-cat-title">' . $term->name . '</' . Helper::eael_validate_html_tag($settings['title_tag']) . '>';
|
||||
}
|
||||
|
||||
if ($settings['show_count']) {
|
||||
printf('<div class="eael-bd-cb-cat-count"><span class="count-prefix">%s</span>%s<span class="count-suffix">%s</span></div>', Helper::eael_wp_kses($settings['count_prefix']) , Helper::get_doc_post_count($term->count, $term->term_id), Helper::eael_wp_kses($settings['count_suffix']));
|
||||
}
|
||||
|
||||
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="' . 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="' . Helper::get_doc_post_count($term->count, $term->term_id) . '"></div>';
|
||||
}
|
||||
if ($settings['show_title']) {
|
||||
echo '<' . Helper::eael_validate_html_tag($settings['title_tag']) . ' class="eael-docs-cat-title">' . $term->name . '</' . Helper::eael_validate_html_tag($settings['title_tag']) . '>';
|
||||
}
|
||||
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();
|
||||
$attr = ['href="' . get_the_permalink() . '"'];
|
||||
|
||||
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 ' . implode(' ', $attr) . '>' . 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="#">' . $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 = ['href="' . get_the_permalink() . '"'];
|
||||
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 ' . implode(' ', $sub_attr) . '>' . 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 Helper::eael_wp_kses($settings['button_text']);
|
||||
|
||||
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,223 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
/**
|
||||
* Template Name: Default
|
||||
*
|
||||
*/
|
||||
|
||||
echo '<article class="eael-better-docs-category-grid-post" data-id="' . 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', ['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">' . $cat_icon . '</div>';
|
||||
}
|
||||
if ($settings['show_title']) {
|
||||
echo '<' . Helper::eael_validate_html_tag($settings['title_tag']) . ' class="eael-docs-cat-title">' . $term->name . '</' . Helper::eael_validate_html_tag($settings['title_tag']) . '>';
|
||||
}
|
||||
if ($settings['show_count']) {
|
||||
echo '<div class="eael-docs-item-count">' . Helper::get_doc_post_count($term->count, $term->term_id) . '</div>';
|
||||
}
|
||||
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();
|
||||
$attr = ['href="' . get_the_permalink() . '"'];
|
||||
|
||||
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 ' . implode(' ', $attr) . '>' . 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="#">' . $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 = ['href="' . get_the_permalink() . '"'];
|
||||
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 ' . implode(' ', $sub_attr) . '>' . 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 Helper::eael_wp_kses($settings['button_text']);
|
||||
|
||||
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,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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 $content;
|
||||
|
||||
if (!empty($link['url'])) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>';
|
||||
} else {
|
||||
echo '<div class="swiper-slide">
|
||||
<div class="ticker-content">
|
||||
<a href="' . get_the_permalink() . '" class="ticker-content-link">' . get_the_title() . '</a>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Template\Content;
|
||||
|
||||
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() );
|
||||
if ( $settings['eael_product_grid_style_preset'] == 'eael-product-simple' || $settings['eael_product_grid_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 ( $settings['eael_product_grid_rating'] == 'yes' ) {
|
||||
echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ));
|
||||
}
|
||||
if ( ! $product->managing_stock() && ! $product->is_in_stock() ) {
|
||||
printf( '<span class="outofstock-badge">%s</span>', __( 'Stock <br/> Out', 'essential-addons-for-elementor-lite' ) );
|
||||
} elseif ( $product->is_on_sale() ) {
|
||||
printf( '<span class="onsale">%s</span>', __( '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_product_grid_style_preset'] == 'eael-product-overlay' ) {
|
||||
?>
|
||||
<li class="product">
|
||||
<div class="overlay">
|
||||
<?php 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 ($settings['eael_product_grid_rating'] === 'yes') {
|
||||
echo wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() );
|
||||
}
|
||||
if ($product->is_on_sale()){
|
||||
printf( '<span class="onsale">%s</span>', __( 'Sale!', 'essential-addons-for-elementor-lite' ));
|
||||
}
|
||||
?>
|
||||
<span class="price"> <?php 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>', __( 'No products found!', 'essential-addons-for-elementor-lite' ) );
|
||||
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Template\Content;
|
||||
|
||||
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 ( $settings['eael_woo_product_list_rating'] == 'yes' ) {
|
||||
echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ));
|
||||
}
|
||||
if ( ! $product->managing_stock() && ! $product->is_in_stock() ) {
|
||||
printf( '<span class="outofstock-badge">%s</span>', __( 'Stock <br/> Out', 'essential-addons-for-elementor-lite' ) );
|
||||
} elseif ( $product->is_on_sale() ) {
|
||||
printf( '<span class="onsale">%s</span>', __( '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 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 ($settings['eael_woo_product_list_rating'] === 'yes') {
|
||||
echo wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() );
|
||||
}
|
||||
if ($product->is_on_sale()){
|
||||
printf( '<span class="onsale">%s</span>', __( 'Sale!', 'essential-addons-for-elementor-lite' ));
|
||||
}
|
||||
?>
|
||||
<span class="price"> <?php 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>', __( 'No products found!', 'essential-addons-for-elementor-lite' ) );
|
||||
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,627 @@
|
||||
<?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'] : 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' ) );
|
||||
|
||||
if ( $grid_style_preset == 'eael-product-simple' || $grid_style_preset == 'eael-product-reveal' ) { ?>
|
||||
<li class="product <?php echo esc_attr( $product_wrapper_classes ); ?>">
|
||||
<?php
|
||||
do_action( 'eael_woocommerce_before_shop_loop_item' );
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_before_shop_loop_item' );
|
||||
}
|
||||
?>
|
||||
<div class="eael-product-wrap">
|
||||
<?php
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
|
||||
echo wp_kses_post( $product->get_image( $settings['eael_product_grid_image_size_size'], [ 'loading' => 'eager', 'class'=> 'attachment-woocommerce_thumbnail size-woocommerce_thumbnail wvs-archive-product-image' ] ) );
|
||||
|
||||
if ( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
// printf('<%1$s class="woocommerce-loop-product__title"><a href="%3$s" class="woocommerce-LoopProduct-link woocommerce-loop-product__link woocommerce-loop-product__title_link woocommerce-loop-product__title_link_simple woocommerce-loop-product__title_link_reveal">%2$s</a></%1$s>', $title_tag, $product->get_title(), $product->get_permalink());
|
||||
echo '<div class="eael-product-title">
|
||||
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
printf('<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>
|
||||
</div>';
|
||||
|
||||
if ( $should_print_rating ) {
|
||||
echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) );
|
||||
}
|
||||
if ( $is_show_badge ){
|
||||
if ( ! $product->is_in_stock() ) {
|
||||
printf( '<span class="outofstock-badge ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">%s</span>', $stock_out_badge_text );
|
||||
} elseif ( $product->is_on_sale() ) {
|
||||
printf( '<span class="onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">%s</span>', $sale_badge_text );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
woocommerce_template_loop_add_to_cart();
|
||||
if ( $should_print_compare_btn ) {
|
||||
Product_Grid::print_compare_button( $product->get_id() );
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ( ! empty( $should_print_wishlist_btn ) ) {
|
||||
echo '<div class="add-to-whishlist">';
|
||||
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_after_shop_loop_item' );
|
||||
}
|
||||
do_action( 'eael_woocommerce_after_shop_loop_item' );
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
} else if ( $grid_style_preset == 'eael-product-overlay' ) {
|
||||
?>
|
||||
<li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
|
||||
<?php
|
||||
do_action( 'eael_woocommerce_before_shop_loop_item' );
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_before_shop_loop_item' );
|
||||
}
|
||||
?>
|
||||
<div class="overlay">
|
||||
<?php
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo $product->get_image( $settings['eael_product_grid_image_size_size'], [ 'loading' => 'eager' ] );
|
||||
if ( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
<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 ( $should_print_compare_btn ) {
|
||||
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ( ! empty( $should_print_wishlist_btn ) ) {
|
||||
echo '<div class="add-to-whishlist">';
|
||||
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// printf('<%1$s class="woocommerce-loop-product__title"><a href="%3$s" class="woocommerce-LoopProduct-link woocommerce-loop-product__link woocommerce-loop-product__title_link woocommerce-loop-product__title_link_overlay">%2$s</a></%1$s>', $title_tag, $product->get_title(), $product->get_permalink());
|
||||
echo '<div class="eael-product-title">
|
||||
<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
printf('<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>
|
||||
</div>';
|
||||
|
||||
if ( $should_print_rating ) {
|
||||
echo wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() );
|
||||
}
|
||||
|
||||
if ( $is_show_badge ) {
|
||||
if ( ! $product->is_in_stock() ) {
|
||||
printf( '<span class="outofstock-badge ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">%s</span>', $stock_out_badge_text );
|
||||
} elseif ( $product->is_on_sale() ) {
|
||||
printf( '<span class="onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">%s</span>', $sale_badge_text );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_after_shop_loop_item' );
|
||||
}
|
||||
do_action( 'eael_woocommerce_after_shop_loop_item' );
|
||||
?>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
} else if (($grid_style_preset == 'eael-product-preset-5') || ($grid_style_preset == 'eael-product-preset-6') || ($grid_style_preset == 'eael-product-preset-7')) {
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
|
||||
<?php
|
||||
do_action( 'eael_woocommerce_before_shop_loop_item' );
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_before_shop_loop_item' );
|
||||
}
|
||||
?>
|
||||
<div class="eael-product-wrap">
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php
|
||||
if ( $is_show_badge ) {
|
||||
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>' : '' ) );
|
||||
}
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
|
||||
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 class="image-hover-wrap">
|
||||
<?php if($grid_style_preset == 'eael-product-preset-5'){ ?>
|
||||
<ul class="icons-wrap block-style">
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(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 } ?>
|
||||
<?php
|
||||
if ( $should_print_compare_btn ) {
|
||||
echo '<li class="add-to-compare">';
|
||||
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ( ! empty( $should_print_wishlist_btn ) ) {
|
||||
echo '<li class="add-to-whishlist">';
|
||||
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
<li class="view-details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
</ul>
|
||||
<?php } elseif ($grid_style_preset == 'eael-product-preset-7') { ?>
|
||||
<ul class="icons-wrap block-box-style">
|
||||
<li class="add-to-cart"><?php
|
||||
woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php
|
||||
if ( $should_print_compare_btn ) {
|
||||
echo '<li class="add-to-compare">';
|
||||
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
|
||||
echo '</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 uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(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 } ?>
|
||||
|
||||
<li class="view-details"><?php echo '<a href="' . $product->get_permalink
|
||||
() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
</ul>
|
||||
<?php } else { ?>
|
||||
<ul class="icons-wrap box-style">
|
||||
<li class="add-to-cart"><?php
|
||||
woocommerce_template_loop_add_to_cart();
|
||||
?></li>
|
||||
<?php
|
||||
if ( $should_print_compare_btn ) {
|
||||
echo '<li class="add-to-compare">';
|
||||
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
|
||||
echo '</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 uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(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 } ?>
|
||||
<li class="view-details" title="Details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
</ul>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-details-wrap">
|
||||
<?php
|
||||
if(($grid_style_preset == 'eael-product-preset-7') && $should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
|
||||
if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
?>
|
||||
<div class="eael-product-title">
|
||||
<?php
|
||||
echo '<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
printf('<%1$s>%2$s</%1$s>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>';
|
||||
?>
|
||||
<?php //printf('<%1$s><a href="%3$s" class="woocommerce-LoopProduct-link woocommerce-loop-product__link woocommerce-loop-product__title_link woocommerce-loop-product__title_link_simple woocommerce-loop-product__title_link_reveal">%2$s</a></%1$s>', $title_tag, $product->get_title(), $product->get_permalink()); ?>
|
||||
</div>
|
||||
<?php if(($grid_style_preset != 'eael-product-preset-7') && $should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_after_shop_loop_item' );
|
||||
}
|
||||
do_action( 'eael_woocommerce_after_shop_loop_item' );
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
} else if ($grid_style_preset == 'eael-product-preset-8') {
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
|
||||
<div class="eael-product-wrap">
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
|
||||
if ( $is_show_badge ) {
|
||||
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>' : '' ) );
|
||||
}
|
||||
|
||||
echo $product->get_image($settings['eael_product_grid_image_size_size'], ['loading' => 'eager']);
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="image-hover-wrap">
|
||||
<ul class="icons-wrap over-box-style">
|
||||
<li class="add-to-cart"><?php
|
||||
woocommerce_template_loop_add_to_cart(); ?>
|
||||
</li>
|
||||
<?php
|
||||
if ( $should_print_compare_btn ) {
|
||||
echo '<li class="add-to-compare">';
|
||||
Product_Grid::print_compare_button( $product->get_id(), 'icon' );
|
||||
echo '</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 uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-details-wrap">
|
||||
<?php
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
?>
|
||||
<div class="eael-product-title">
|
||||
<?php
|
||||
echo '<a href="' . esc_url( $product->get_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
printf('<%1$s>%2$s</%1$s>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
} else if(($list_style_preset == 'eael-product-list-preset-1') ||
|
||||
($list_style_preset == 'eael-product-list-preset-2') ||
|
||||
($list_style_preset == 'eael-product-list-preset-3') ||
|
||||
($list_style_preset == 'eael-product-list-preset-4')) {
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<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 ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
if ( $is_show_badge ) {
|
||||
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>' : '' ) );
|
||||
}
|
||||
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' );
|
||||
}
|
||||
|
||||
if ($list_style_preset == 'eael-product-list-preset-2') {
|
||||
echo '<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>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>
|
||||
</div>';
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
echo '<p>' . wp_trim_words(strip_shortcodes(get_the_excerpt()), $settings['eael_product_grid_excerpt_length'], $settings['eael_product_grid_excerpt_expanison_indicator']) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
|
||||
if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
|
||||
} elseif ($list_style_preset == 'eael-product-list-preset-3') {
|
||||
echo '<div class="price-wrap">';
|
||||
if ($should_print_price) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
if ($should_print_rating) {
|
||||
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>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>
|
||||
</div>';
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
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>';
|
||||
} elseif ($list_style_preset == 'eael-product-list-preset-4') {
|
||||
|
||||
if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
|
||||
echo '<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>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>
|
||||
</div>';
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
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>';
|
||||
}
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<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>', $title_tag, Helper::eael_wp_kses( $product->get_title() ));
|
||||
echo '</a>
|
||||
</div>';
|
||||
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
|
||||
if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
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>';
|
||||
};
|
||||
}
|
||||
?>
|
||||
|
||||
<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 uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(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>
|
||||
<?php
|
||||
}
|
||||
}else {
|
||||
|
||||
if($settings['eael_product_grid_rating']!='yes'){
|
||||
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 );
|
||||
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 $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,407 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
use \Elementor\Group_Control_Image_Size;
|
||||
/**
|
||||
* Template Name: Default
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
$thumbnail_html = '';
|
||||
if ( $settings['eael_show_image'] == 'yes' ) {
|
||||
$settings[ 'eael_image_size_customize' ] = [
|
||||
'id' => get_post_thumbnail_id(),
|
||||
];
|
||||
$settings['eael_image_size_customize_size'] = $settings['image_size'];
|
||||
$thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
|
||||
}
|
||||
global $authordata;
|
||||
$author_link = '';
|
||||
if ( is_object( $authordata ) ) {
|
||||
$author_name = $authordata->display_name;
|
||||
|
||||
if ( isset( $authordata->first_name ) ) {
|
||||
$author_name = $authordata->first_name;
|
||||
if ( isset( $authordata->last_name ) ) {
|
||||
$author_name .= ' ' . $authordata->last_name;
|
||||
}
|
||||
}
|
||||
|
||||
$author_link = sprintf(
|
||||
'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
|
||||
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
|
||||
/* translators: %s: Author's display name. */
|
||||
esc_attr( sprintf( __( 'Posts by %s' ), $author_name ) ),
|
||||
$author_name
|
||||
);
|
||||
}
|
||||
$enable_ratio = $settings['enable_postgrid_image_ratio'] == 'yes' ? 'eael-image-ratio':'';
|
||||
|
||||
$title_tag = isset($settings['title_tag']) ? Helper::eael_validate_html_tag($settings['title_tag']) : 'h2';
|
||||
|
||||
if ($settings['eael_post_grid_preset_style'] === 'two') {
|
||||
echo '<article class="eael-grid-post eael-post-grid-column" data-id="' . get_the_ID() . '">
|
||||
<div class="eael-grid-post-holder">
|
||||
<div class="eael-grid-post-holder-inner">';
|
||||
if ( $thumbnail_html && 'yes' === $settings['eael_show_image'] ) {
|
||||
echo '<div class="eael-entry-media">';
|
||||
if ( 'yes' === $settings['eael_show_post_terms'] && 'yes' === $settings['eael_post_terms_on_image_hover'] ) {
|
||||
echo Helper::get_terms_as_list($settings['eael_post_terms'], $settings['eael_post_terms_max_length']);
|
||||
}
|
||||
|
||||
echo '<div class="eael-entry-overlay ' . esc_attr( $settings['eael_post_grid_hover_animation'] ) . '">';
|
||||
if (isset($settings['eael_post_grid_bg_hover_icon_new']['url'])) {
|
||||
echo '<img src="' . esc_url($settings['eael_post_grid_bg_hover_icon_new']['url']) . '" alt="' . esc_attr(get_post_meta($settings['eael_post_grid_bg_hover_icon_new']['id'], '_wp_attachment_image_alt', true)) . '" />';
|
||||
} else {
|
||||
echo '<i class="' . esc_attr( $settings['eael_post_grid_bg_hover_icon_new']['value'] ) . '" aria-hidden="true"></i>';
|
||||
}
|
||||
|
||||
echo '<a href="' . get_the_permalink() . '"' . $link_settings['image_link_nofollow'] . '' . $link_settings['image_link_target_blank'] . '></a>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="eael-entry-thumbnail '.$enable_ratio.'">
|
||||
'.$thumbnail_html.'
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_title'] || $settings['eael_show_meta'] || $settings['eael_show_excerpt']) {
|
||||
echo '<div class="eael-entry-wrapper">';
|
||||
if ($settings['eael_show_title']) {
|
||||
echo '<header class="eael-entry-header"><' . $title_tag . ' class="eael-entry-title">';
|
||||
echo '<a
|
||||
class="eael-grid-post-link"
|
||||
href="' . get_the_permalink() . '"
|
||||
title="' . strip_tags( get_the_title() ) . '"' . $link_settings['title_link_nofollow'] . '' . $link_settings['title_link_target_blank'] . '>';
|
||||
|
||||
if (empty($settings['eael_title_length'])) {
|
||||
echo get_the_title();
|
||||
} else {
|
||||
echo implode(" ", array_slice(explode(" ", get_the_title()), 0, $settings['eael_title_length']));
|
||||
}
|
||||
echo '</a>';
|
||||
echo '</' . $title_tag . '></header>';
|
||||
}
|
||||
|
||||
if ($settings['meta_position'] == 'meta-entry-header') {
|
||||
echo '<div class="eael-entry-header-after style-two">';
|
||||
if ( isset( $settings['eael_show_avatar_two'] ) && 'yes' === $settings['eael_show_avatar_two'] ) {
|
||||
echo '<div class="eael-author-avatar"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_avatar(get_the_author_meta('ID'), 96, '', get_the_author_meta( 'display_name' ) ) . '</a></div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_meta']) {
|
||||
echo '<div class="eael-entry-meta">';
|
||||
if ( isset( $settings['eael_show_author_two'] ) && 'yes' === $settings['eael_show_author_two'] ) {
|
||||
echo '<span class="eael-posted-by">' . $author_link . '</span>';
|
||||
}
|
||||
if ($settings['eael_show_date'] === 'yes') {
|
||||
echo '<span class="eael-posted-on eael-meta-posted-on"><i class="far fa-clock"></i><time datetime="' . get_the_date() . '">' . get_the_date() . '</time></span>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_excerpt'] || $settings['eael_show_read_more_button']) {
|
||||
echo '<div class="eael-entry-content">
|
||||
<div class="eael-grid-post-excerpt">';
|
||||
if ($settings['eael_show_excerpt']) {
|
||||
if (empty($settings['eael_excerpt_length'])) {
|
||||
echo '<p>' . strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()) . '</p>';
|
||||
} else {
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()), $settings['eael_excerpt_length'], $settings['excerpt_expanison_indicator'] ) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eael_show_read_more_button']) {
|
||||
echo '<a
|
||||
href="' . get_the_permalink() . '"
|
||||
class="eael-post-elements-readmore-btn"' . $link_settings['read_more_link_nofollow'] . '' . $link_settings['read_more_link_target_blank'] . '>' . Helper::eael_wp_kses($settings['read_more_button_text']) . '</a>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if ($settings['meta_position'] == 'meta-entry-footer') {
|
||||
echo '<div class="eael-entry-header-after style-two">';
|
||||
if ( isset( $settings['eael_show_avatar_two'] ) && 'yes' === $settings['eael_show_avatar_two'] ) {
|
||||
echo '<div class="eael-author-avatar"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_avatar(get_the_author_meta('ID'), 96, '', get_the_author_meta( 'display_name' ) ) . '</a></div>';
|
||||
}
|
||||
|
||||
echo '<div class="eael-entry-meta">';
|
||||
if ( isset( $settings['eael_show_author_two'] ) && 'yes' === $settings['eael_show_author_two'] ) {
|
||||
echo '<span class="eael-posted-by style-two-footer">' . $author_link . '</span>';
|
||||
}
|
||||
if ( 'yes' === $settings['eael_show_date'] ) {
|
||||
echo '<span class="eael-meta-posted-on"><i class="far fa-clock"></i><time datetime="' . get_the_date() . '">' . get_the_date() . '</time></span>';
|
||||
}
|
||||
if ( 'yes' === $settings['eael_show_post_terms'] ) {
|
||||
if ($settings['eael_post_terms'] === 'category') {
|
||||
$terms = get_the_category();
|
||||
}
|
||||
if ($settings['eael_post_terms'] === 'tags') {
|
||||
$terms = get_the_tags();
|
||||
}
|
||||
|
||||
//For custom post type
|
||||
$get_custom_post_type = get_post_type( get_the_ID() ); //post
|
||||
if ( 'product' === $get_custom_post_type ) {
|
||||
$get_custom_taxonomy = $settings['eael_post_terms'] === 'category' ? 'product_cat' : ( $settings['eael_post_terms'] === 'tags' ? 'product_tag' : $settings['eael_post_terms'] );
|
||||
} else {
|
||||
$get_custom_taxonomy = $settings["eael_{$get_custom_post_type}_terms"]; //tags
|
||||
}
|
||||
|
||||
if( 'post' !== $get_custom_post_type && $settings[ 'eael_post_terms' ] === $get_custom_taxonomy ) {
|
||||
$terms = wp_get_post_terms( get_the_ID(), $get_custom_taxonomy );
|
||||
}
|
||||
|
||||
if (!empty($terms)) {
|
||||
$html = '<ul class="post-meta-categories">';
|
||||
$count = 0;
|
||||
|
||||
foreach ($terms as $term) {
|
||||
if ($count === intval($settings['eael_post_terms_max_length'])) {
|
||||
break;
|
||||
}
|
||||
if ($count === 0) {
|
||||
$html .= '<li class="meta-cat-icon"><i class="far fa-folder-open"></i></li>';
|
||||
}
|
||||
|
||||
$is_last_item = $count + 1 === intval($settings['eael_post_terms_max_length']) || $count + 1 === count( (array) $terms);
|
||||
|
||||
if ( ! empty( $term->name ) ) {
|
||||
$eael_post_terms_separator = ! empty( $settings['eael_post_terms_separator'] ) ? wp_strip_all_tags( $settings['eael_post_terms_separator'] ) : '';
|
||||
$eael_post_terms_separator = $is_last_item ? '' : $eael_post_terms_separator;
|
||||
}
|
||||
|
||||
$link = ($settings['eael_post_terms'] === 'category') ? get_category_link($term->term_id) : get_tag_link($term->term_id);
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="' . esc_url($link) . '">';
|
||||
$html .= $term->name . " " . esc_html( $eael_post_terms_separator );
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
$count++;
|
||||
}
|
||||
$html .= '</ul>';
|
||||
echo $html;
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>
|
||||
</article>';
|
||||
} else if ($settings['eael_post_grid_preset_style'] === 'three') {
|
||||
echo '<article class="eael-grid-post eael-post-grid-column" data-id="' . get_the_ID() . '">
|
||||
<div class="eael-grid-post-holder">
|
||||
<div class="eael-grid-post-holder-inner">';
|
||||
|
||||
if ( $thumbnail_html && 'yes' === $settings['eael_show_image'] ) {
|
||||
|
||||
echo '<div class="eael-entry-media">';
|
||||
if ( 'yes' === $settings['eael_post_terms_on_image_hover'] ) {
|
||||
echo Helper::get_terms_as_list($settings['eael_post_terms'], $settings['eael_post_terms_max_length']);
|
||||
}
|
||||
|
||||
echo '<div class="eael-entry-overlay ' . esc_attr( $settings['eael_post_grid_hover_animation'] ) . '">';
|
||||
|
||||
if (isset($settings['eael_post_grid_bg_hover_icon_new']['url'])) {
|
||||
echo '<img src="' . esc_url($settings['eael_post_grid_bg_hover_icon_new']['url']) . '" alt="' . esc_attr(get_post_meta($settings['eael_post_grid_bg_hover_icon_new']['id'], '_wp_attachment_image_alt', true)) . '" />';
|
||||
} else {
|
||||
echo '<i class="' . esc_attr( $settings['eael_post_grid_bg_hover_icon_new']['value'] ) . '" aria-hidden="true"></i>';
|
||||
}
|
||||
echo '<a href="' . get_the_permalink() . '"' . $link_settings['image_link_nofollow'] . '' . $link_settings['image_link_target_blank'] . '></a>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="eael-entry-thumbnail '.$enable_ratio.'">
|
||||
'.$thumbnail_html.'
|
||||
</div>
|
||||
</div>';
|
||||
if ($settings['meta_position'] == 'meta-entry-header' && $settings['eael_show_date'] === 'yes') {
|
||||
echo '<span class="eael-meta-posted-on"><time datetime="' . get_the_date() . '"><span>' . get_the_date('d') . '</span>' . get_the_date('F') . '</time></span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eael_show_title'] || $settings['eael_show_meta'] || $settings['eael_show_excerpt']) {
|
||||
echo '<div class="eael-entry-wrapper">';
|
||||
|
||||
if ($settings['eael_show_title']) {
|
||||
echo '<header class="eael-entry-header"><' . $title_tag . ' class="eael-entry-title">';
|
||||
echo '<a
|
||||
class="eael-grid-post-link"
|
||||
href="' . get_the_permalink() . '"
|
||||
title="' . strip_tags( get_the_title() ) . '"' . $link_settings['title_link_nofollow'] . '' . $link_settings['title_link_target_blank'] . '>';
|
||||
|
||||
if (empty($settings['eael_title_length'])) {
|
||||
echo get_the_title();
|
||||
} else {
|
||||
echo implode(" ", array_slice(explode(" ", get_the_title()), 0, $settings['eael_title_length']));
|
||||
}
|
||||
echo '</a>';
|
||||
/*
|
||||
* used Helper::eael_validate_html_tag() method to validate $title_tag
|
||||
*/
|
||||
echo '</' . $title_tag . '></header>';
|
||||
}
|
||||
|
||||
if ($settings['meta_position'] == 'meta-entry-footer') {
|
||||
if ($settings['eael_show_meta']) {
|
||||
echo '<div class="eael-entry-meta">';
|
||||
if ( isset( $settings['eael_show_author_three'] ) && 'yes' === $settings['eael_show_author_three'] ) {
|
||||
echo '<span class="eael-posted-by">' . $author_link . '</span>';
|
||||
}
|
||||
if ($settings['eael_show_date'] === 'yes') {
|
||||
echo '<span class="eael-posted-on"><time datetime="' . get_the_date() . '">' . get_the_date() . '</time></span>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eael_show_excerpt'] || $settings['eael_show_read_more_button']) {
|
||||
echo '<div class="eael-entry-content">
|
||||
<div class="eael-grid-post-excerpt">';
|
||||
if ($settings['eael_show_excerpt']) {
|
||||
if (empty($settings['eael_excerpt_length'])) {
|
||||
echo '<p>' . strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()) . '</p>';
|
||||
} else {
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()), $settings['eael_excerpt_length'], $settings['excerpt_expanison_indicator']) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eael_show_read_more_button']) {
|
||||
echo '<a
|
||||
href="' . get_the_permalink() . '"
|
||||
class="eael-post-elements-readmore-btn"' . $link_settings['read_more_link_nofollow'] . '' . $link_settings['read_more_link_target_blank'] . '>' . Helper::eael_wp_kses($settings['read_more_button_text']) . '</a>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>
|
||||
</article>';
|
||||
} else {
|
||||
echo '<article class="eael-grid-post eael-post-grid-column" data-id="' . esc_attr( get_the_ID() ) . '">
|
||||
<div class="eael-grid-post-holder">
|
||||
<div class="eael-grid-post-holder-inner">';
|
||||
|
||||
if ( $thumbnail_html && 'yes' === $settings['eael_show_image'] ) {
|
||||
|
||||
echo '<div class="eael-entry-media">';
|
||||
if ( 'yes' === $settings['eael_show_post_terms'] && 'yes' === $settings['eael_post_terms_on_image_hover'] ) {
|
||||
echo Helper::get_terms_as_list($settings['eael_post_terms'], $settings['eael_post_terms_max_length']);
|
||||
}
|
||||
|
||||
echo '<div class="eael-entry-overlay ' . esc_attr( $settings['eael_post_grid_hover_animation'] ) . '">';
|
||||
|
||||
if (isset($settings['eael_post_grid_bg_hover_icon_new']['url'])) {
|
||||
echo '<img src="' . esc_url($settings['eael_post_grid_bg_hover_icon_new']['url']) . '" alt="' . esc_attr(get_post_meta($settings['eael_post_grid_bg_hover_icon_new']['id'], '_wp_attachment_image_alt', true)) . '" />';
|
||||
} else {
|
||||
if (($settings['eael_post_grid_bg_hover_icon_new']['library']) == 'svg') {
|
||||
echo '<img src="' . esc_url($settings['eael_post_grid_bg_hover_icon_new']['value']['url']) . '" alt="' . esc_attr(get_post_meta($settings['eael_post_grid_bg_hover_icon_new']['value']['id'], '_wp_attachment_image_alt', true)) . '" />';
|
||||
} else {
|
||||
echo '<i class="' . esc_attr( $settings['eael_post_grid_bg_hover_icon_new']['value'] ) . '" aria-hidden="true"></i>';
|
||||
}
|
||||
}
|
||||
echo '<a href="' . get_the_permalink() . '"' . $link_settings['image_link_nofollow'] . '' . $link_settings['image_link_target_blank'] . '></a>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="eael-entry-thumbnail '.$enable_ratio.'">
|
||||
'.$thumbnail_html.'
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_title'] || $settings['eael_show_meta'] || $settings['eael_show_excerpt']) {
|
||||
echo '<div class="eael-entry-wrapper">';
|
||||
if ($settings['eael_show_title']) {
|
||||
echo '<header class="eael-entry-header"><' . $title_tag . ' class="eael-entry-title">';
|
||||
echo '<a
|
||||
class="eael-grid-post-link"
|
||||
href="' . get_the_permalink() . '"
|
||||
title="' . strip_tags( get_the_title() ) . '"' . $link_settings['title_link_nofollow'] . '' . $link_settings['title_link_target_blank'] . '>';
|
||||
|
||||
if (empty($settings['eael_title_length'])) {
|
||||
echo get_the_title();
|
||||
} else {
|
||||
echo implode(" ", array_slice(explode(" ", get_the_title()), 0, $settings['eael_title_length']));
|
||||
}
|
||||
echo '</a>';
|
||||
echo '</' . $title_tag . '></header>';
|
||||
}
|
||||
if ($settings['meta_position'] == 'meta-entry-header') {
|
||||
echo '<div class="eael-entry-header-after">';
|
||||
if ( isset( $settings['eael_show_avatar'] ) && 'yes' === $settings['eael_show_avatar'] ) {
|
||||
echo '<div class="eael-author-avatar"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_avatar(get_the_author_meta('ID'), 96, '', get_the_author_meta( 'display_name' ) ) . '</a></div>';
|
||||
|
||||
}
|
||||
|
||||
if ($settings['eael_show_meta']) {
|
||||
echo '<div class="eael-entry-meta">';
|
||||
if ( isset( $settings['eael_show_author'] ) && 'yes' === $settings['eael_show_author'] ) {
|
||||
echo '<span class="eael-posted-by">' . $author_link . '</span>';
|
||||
}
|
||||
if ($settings['eael_show_date'] === 'yes') {
|
||||
echo '<span class="eael-posted-on"><time datetime="' . get_the_date() . '">' . get_the_date() . '</time></span>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_excerpt'] || $settings['eael_show_read_more_button']) {
|
||||
echo '<div class="eael-entry-content">
|
||||
<div class="eael-grid-post-excerpt">';
|
||||
if ($settings['eael_show_excerpt']) {
|
||||
if (empty($settings['eael_excerpt_length'])) {
|
||||
echo '<p>' . strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()) . '</p>';
|
||||
} else {
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()), $settings['eael_excerpt_length'], $settings['excerpt_expanison_indicator']) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eael_show_read_more_button']) {
|
||||
echo '<a
|
||||
href="' . get_the_permalink() . '"
|
||||
class="eael-post-elements-readmore-btn"' . $link_settings['read_more_link_nofollow'] . '' . $link_settings['read_more_link_target_blank'] . '>' . Helper::eael_wp_kses($settings['read_more_button_text']) . '</a>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_meta'] && $settings['meta_position'] == 'meta-entry-footer') {
|
||||
echo '<div class="eael-entry-footer">';
|
||||
if ( isset( $settings['eael_show_avatar'] ) && 'yes' === $settings['eael_show_avatar'] ) {
|
||||
echo '<div class="eael-author-avatar"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_avatar(get_the_author_meta('ID'), 96, '', get_the_author_meta( 'display_name' ) ) . '</a></div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_meta']) {
|
||||
echo '<div class="eael-entry-meta">';
|
||||
if ( isset( $settings['eael_show_author'] ) && 'yes' === $settings['eael_show_author'] ) {
|
||||
echo '<span class="eael-posted-by">' . $author_link . '</span>';
|
||||
}
|
||||
if ($settings['eael_show_date'] === 'yes') {
|
||||
echo '<span class="eael-posted-on"><time datetime="' . get_the_date() . '">' . get_the_date() . '</time></span>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>
|
||||
</div>
|
||||
</article>';
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
/**
|
||||
* Template Name: Card
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
$image = '';
|
||||
if ($settings['eael_show_image'] == 'yes' && has_post_thumbnail()) {
|
||||
$image = '<div class="eael-timeline-post-image" style="background-image: url('. wp_get_attachment_image_url
|
||||
(get_post_thumbnail_id(),
|
||||
$settings['image_size']) .')"></div>';
|
||||
}
|
||||
|
||||
$title_tag = isset($settings['title_tag']) ? Helper::eael_validate_html_tag($settings['title_tag']) : 'h2';
|
||||
|
||||
echo '<article class="eael-timeline-post">
|
||||
<div class="eael-timeline-bullet"></div>
|
||||
<div class="eael-timeline-post-inner">
|
||||
<a class="eael-timeline-post-link" href="' . get_the_permalink() . '" title="' . esc_html(get_the_title()) . '"' . ($settings['timeline_link_nofollow'] ? 'rel="nofollow"' : '') .'' . ($settings['timeline_link_target_blank'] ? 'target="_blank"' : '') . '>
|
||||
<time datetime="' . get_the_date() . '">' . get_the_date() . '</time>
|
||||
'. $image;
|
||||
|
||||
if( $settings['eael_show_title'] || $settings['eael_show_excerpt'] ) {
|
||||
echo '<div class="eael-timeline-content">';
|
||||
|
||||
if ( $settings['eael_show_title'] ) {
|
||||
echo '<div class="eael-timeline-post-title">
|
||||
<' . $title_tag . ' class="' . esc_attr( 'eael-timeline-post-title-text-card' ) . '" >' . get_the_title() . '</'.$title_tag.'>
|
||||
</div>';
|
||||
}
|
||||
if ( $settings['eael_show_excerpt'] ) {
|
||||
echo '<div class="eael-timeline-post-excerpt">';
|
||||
if ( empty( $settings['eael_excerpt_length'] ) ) {
|
||||
echo '<p>' . strip_shortcodes( get_the_excerpt() ? get_the_excerpt() : get_the_content() ) . '</p>';
|
||||
} else {
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ? get_the_excerpt() : get_the_content() ), $settings['eael_excerpt_length'], $settings['expanison_indicator'] ) . '</p>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</a>
|
||||
</div>
|
||||
<div class="eael-timeline-clear"></div>
|
||||
</article>';
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
/**
|
||||
* Template Name: Default
|
||||
*/
|
||||
|
||||
use Elementor\Group_Control_Image_Size;
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
$post_timeline_image_url = Group_Control_Image_Size::get_attachment_image_src( get_post_thumbnail_id(),
|
||||
'image', $settings );
|
||||
|
||||
$image_size = sanitize_html_class( $settings['image_size'] );
|
||||
$image_class = " attachment-$image_size size-$image_size";
|
||||
$title_tag = isset($settings['title_tag']) ? Helper::eael_validate_html_tag($settings['title_tag']) : 'h2';
|
||||
|
||||
echo '<article class="eael-timeline-post eael-timeline-column">
|
||||
<div class="eael-timeline-bullet"></div>
|
||||
<div class="eael-timeline-post-inner">
|
||||
<a class="eael-timeline-post-link" href="' . get_the_permalink() . '" title="' . esc_attr(get_the_title()) . '"' . ($settings['timeline_link_nofollow'] ? 'rel="nofollow"' : '') .'' . ($settings['timeline_link_target_blank'] ? 'target="_blank"' : '') . '>
|
||||
<time datetime="' . get_the_date() . '">' . get_the_date() . '</time>
|
||||
<div class="eael-timeline-post-image'.$image_class.'" ' . ($settings['eael_show_image'] == 'yes' ? 'style="background-image: url('.esc_url( $post_timeline_image_url ).');"' : null) . '></div>';
|
||||
if ($settings['eael_show_excerpt']) {
|
||||
echo '<div class="eael-timeline-post-excerpt">';
|
||||
if(empty($settings['eael_excerpt_length'])) {
|
||||
echo '<p>'.strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()).'</p>';
|
||||
}else {
|
||||
echo '<p>' . wp_trim_words(strip_shortcodes(get_the_excerpt() ? get_the_excerpt() : get_the_content()), intval( $settings['eael_excerpt_length'] ), sanitize_text_field( $settings['expanison_indicator'] )) . '</p>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($settings['eael_show_title']) {
|
||||
echo '<div class="eael-timeline-post-title">
|
||||
<' . Helper::eael_validate_html_tag( $settings['title_tag'] ) . ' class="eael-timeline-post-title-text">' . get_the_title() . '</' . Helper::eael_validate_html_tag( $settings['title_tag'] ) . '>
|
||||
</div>';
|
||||
}
|
||||
echo '</a>
|
||||
</div>
|
||||
</article>';
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
/**
|
||||
* Template Name: Preset 1
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_carousel;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Improvement
|
||||
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? $settings['eael_product_sale_badge_alignment'] : '';
|
||||
$sale_badge_preset = isset($settings['eael_product_sale_badge_preset']) ? $settings['eael_product_sale_badge_preset'] : '';
|
||||
$sale_text = !empty($settings['eael_product_carousel_sale_text']) ? $settings['eael_product_carousel_sale_text'] : 'Sale!';
|
||||
$stockout_text = !empty($settings['eael_product_carousel_stockout_text']) ? $settings['eael_product_carousel_stockout_text'] : 'Stock Out';
|
||||
|
||||
// should print vars
|
||||
$should_print_rating = isset( $settings['eael_product_carousel_rating'] ) && 'yes' === $settings['eael_product_carousel_rating'];
|
||||
$should_print_quick_view = isset( $settings['eael_product_carousel_quick_view'] ) && 'yes' === $settings['eael_product_carousel_quick_view'];
|
||||
$should_print_image_clickable = isset( $settings['eael_product_carousel_image_clickable'] ) && 'yes' === $settings['eael_product_carousel_image_clickable'];
|
||||
$should_print_title_clickable = isset( $settings['eael_product_carousel_title_clickable'] ) && 'yes' === $settings['eael_product_carousel_title_clickable'];
|
||||
$should_print_price = isset( $settings['eael_product_carousel_price'] ) && 'yes' === $settings['eael_product_carousel_price'];
|
||||
$should_print_excerpt = isset( $settings['eael_product_carousel_excerpt'] ) && ('yes' === $settings['eael_product_carousel_excerpt'] && has_excerpt());
|
||||
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
|
||||
$quick_view_setting = [
|
||||
'widget_id' => $widget_id,
|
||||
'product_id' => $product->get_id(),
|
||||
'page_id' => $settings['eael_page_id'],
|
||||
];
|
||||
|
||||
$product_details_wrap_show = ! empty( $settings['eael_product_carousel_show_title'] ) || $should_print_price || $should_print_rating || $should_print_excerpt;
|
||||
$product_details_none_class = $product_details_wrap_show ? '' : 'product-details-none';
|
||||
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<li <?php post_class( ['product', 'swiper-slide'] ); ?>>
|
||||
<div class="eael-product-carousel <?php echo esc_attr( $product_details_none_class ); ?>">
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php
|
||||
echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $stockout_text ) . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $sale_text ) . '</span>' : '' ) );
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo $product->get_image($settings['eael_product_carousel_image_size_size'], ['loading' => 'eager']);
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="image-hover-wrap">
|
||||
<ul class="icons-wrap box-style">
|
||||
<?php if( $settings[ 'eael_product_carousel_show_add_to_cart' ] ) { ?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="view-details" title="Details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
</ul>
|
||||
<?php
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-details-wrap">
|
||||
<div class="product-details">
|
||||
<?php
|
||||
if ( $settings['eael_product_carousel_show_title'] ) {
|
||||
echo '<div class="eael-product-title">';
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo '<' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
if ( empty( $settings['eael_product_carousel_title_length'] ) ) {
|
||||
echo Helper::eael_wp_kses( $product->get_title() );
|
||||
} else {
|
||||
echo implode( " ", array_slice( explode( " ", Helper::eael_wp_kses($product->get_title()) ), 0, $settings['eael_product_carousel_title_length'] ) );
|
||||
}
|
||||
echo '</' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($should_print_rating) {
|
||||
echo wc_get_rating_html($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_carousel_excerpt_length'],
|
||||
esc_html( $settings['eael_product_carousel_excerpt_expanison_indicator'] ) ) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php if($should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
/**
|
||||
* Template Name: Preset 2
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_Carousel;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Improvement
|
||||
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? $settings['eael_product_sale_badge_alignment'] : '';
|
||||
$sale_badge_preset = isset($settings['eael_product_sale_badge_preset']) ? $settings['eael_product_sale_badge_preset'] : '';
|
||||
$sale_text = !empty($settings['eael_product_carousel_sale_text']) ? $settings['eael_product_carousel_sale_text'] : 'Sale!';
|
||||
$stockout_text = !empty($settings['eael_product_carousel_stockout_text']) ? $settings['eael_product_carousel_stockout_text'] : 'Stock Out';
|
||||
|
||||
// should print vars
|
||||
$should_print_rating = isset( $settings['eael_product_carousel_rating'] ) && 'yes' === $settings['eael_product_carousel_rating'];
|
||||
$should_print_quick_view = isset( $settings['eael_product_carousel_quick_view'] ) && 'yes' === $settings['eael_product_carousel_quick_view'];
|
||||
$should_print_image_clickable = isset( $settings['eael_product_carousel_image_clickable'] ) && 'yes' === $settings['eael_product_carousel_image_clickable'];
|
||||
$should_print_title_clickable = isset( $settings['eael_product_carousel_title_clickable'] ) && 'yes' === $settings['eael_product_carousel_title_clickable'];
|
||||
$should_print_price = isset( $settings['eael_product_carousel_price'] ) && 'yes' === $settings['eael_product_carousel_price'];
|
||||
$should_print_excerpt = isset( $settings['eael_product_carousel_excerpt'] ) && ('yes' === $settings['eael_product_carousel_excerpt'] && has_excerpt());
|
||||
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
|
||||
$quick_view_setting = [
|
||||
'widget_id' => $widget_id,
|
||||
'product_id' => $product->get_id(),
|
||||
'page_id' => $settings['eael_page_id'],
|
||||
];
|
||||
|
||||
$product_details_wrap_show = ! empty( $settings['eael_product_carousel_show_title'] ) || $should_print_price || $should_print_rating || $should_print_excerpt;
|
||||
$product_details_none_class = $product_details_wrap_show ? '' : 'product-details-none-overlay';
|
||||
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<li <?php post_class( ['product', 'swiper-slide'] ); ?>>
|
||||
<div class="eael-product-carousel <?php echo esc_attr( $product_details_none_class ); ?>">
|
||||
<div class="carousel-overlay <?php echo $should_print_image_clickable ? 'eael-img-clickable' : ''; ?>"></div>
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php
|
||||
echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $stockout_text ) . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $sale_text ) . '</span>' : '' ) );
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo $product->get_image($settings['eael_product_carousel_image_size_size'], ['loading' => 'eager']);
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="image-hover-wrap">
|
||||
<ul class="icons-wrap box-style-list">
|
||||
<?php if( $settings[ 'eael_product_carousel_show_add_to_cart' ] ) { ?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="view-details" title="Details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-overlay-content">
|
||||
<div class="product-details-wrap">
|
||||
<div class="eael-product-title-wrap">
|
||||
<?php
|
||||
if ( $settings['eael_product_carousel_show_title'] ) {
|
||||
echo '<div class="eael-product-title">';
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo '<' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
if ( empty( $settings['eael_product_carousel_title_length'] ) ) {
|
||||
echo Helper::eael_wp_kses( $product->get_title() );
|
||||
} else {
|
||||
echo implode( " ", array_slice( explode( " ", Helper::eael_wp_kses($product->get_title()) ), 0, $settings['eael_product_carousel_title_length'] ) );
|
||||
}
|
||||
echo '</' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
<?php if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
} ?>
|
||||
</div>
|
||||
<?php if($should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_carousel_excerpt_length'],
|
||||
esc_html( $settings['eael_product_carousel_excerpt_expanison_indicator'] ) ) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
/**
|
||||
* Template Name: Preset 3
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_carousel;
|
||||
|
||||
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;
|
||||
}
|
||||
// Improvement
|
||||
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? $settings['eael_product_sale_badge_alignment'] : '';
|
||||
$sale_badge_preset = isset($settings['eael_product_sale_badge_preset']) ? $settings['eael_product_sale_badge_preset'] : '';
|
||||
$sale_text = !empty($settings['eael_product_carousel_sale_text']) ? $settings['eael_product_carousel_sale_text'] : 'Sale!';
|
||||
$stockout_text = !empty($settings['eael_product_carousel_stockout_text']) ? $settings['eael_product_carousel_stockout_text'] : 'Stock Out';
|
||||
|
||||
// should print vars
|
||||
$should_print_rating = isset( $settings['eael_product_carousel_rating'] ) && 'yes' === $settings['eael_product_carousel_rating'];
|
||||
$should_print_quick_view = isset( $settings['eael_product_carousel_quick_view'] ) && 'yes' === $settings['eael_product_carousel_quick_view'];
|
||||
$should_print_image_clickable = isset( $settings['eael_product_carousel_image_clickable'] ) && 'yes' === $settings['eael_product_carousel_image_clickable'];
|
||||
$should_print_title_clickable = isset( $settings['eael_product_carousel_title_clickable'] ) && 'yes' === $settings['eael_product_carousel_title_clickable'];
|
||||
$should_print_price = isset( $settings['eael_product_carousel_price'] ) && 'yes' === $settings['eael_product_carousel_price'];
|
||||
$should_print_excerpt = isset( $settings['eael_product_carousel_excerpt'] ) && ('yes' === $settings['eael_product_carousel_excerpt'] && has_excerpt());
|
||||
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
|
||||
$quick_view_setting = [
|
||||
'widget_id' => $widget_id,
|
||||
'product_id' => $product->get_id(),
|
||||
'page_id' => $settings['eael_page_id'],
|
||||
];
|
||||
|
||||
$product_details_wrap_show = ! empty( $settings['eael_product_carousel_show_title'] ) || $should_print_price || $should_print_rating || $should_print_excerpt;
|
||||
$product_details_none_class = $product_details_wrap_show ? '' : 'product-details-none';
|
||||
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<li <?php post_class( ['product', 'swiper-slide'] ); ?>>
|
||||
<div class="eael-product-carousel <?php echo esc_attr( $product_details_none_class ); ?>">
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php
|
||||
echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $stockout_text ) . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $sale_text ) . '</span>' : '' ) );
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo $product->get_image($settings['eael_product_carousel_image_size_size'], ['loading' => 'eager']);
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="image-hover-wrap">
|
||||
<ul class="icons-wrap block-style">
|
||||
<?php if( $settings[ 'eael_product_carousel_show_add_to_cart' ] ) { ?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="view-details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
|
||||
</ul>
|
||||
<?php
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-details-wrap">
|
||||
<?php
|
||||
if ( $settings['eael_product_carousel_show_title'] ) {
|
||||
echo '<div class="eael-product-title">';
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo '<' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
if ( empty( $settings['eael_product_carousel_title_length'] ) ) {
|
||||
echo Helper::eael_wp_kses( $product->get_title() );
|
||||
} else {
|
||||
echo implode( " ", array_slice( explode( " ", Helper::eael_wp_kses($product->get_title()) ), 0, $settings['eael_product_carousel_title_length'] ) );
|
||||
}
|
||||
echo '</' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
<?php if($should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}?>
|
||||
<?php if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_carousel_excerpt_length'],
|
||||
esc_html( $settings['eael_product_carousel_excerpt_expanison_indicator'] ) ) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
/**
|
||||
* Template Name: Preset 4
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_carousel;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Improvement
|
||||
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? $settings['eael_product_sale_badge_alignment'] : '';
|
||||
$sale_badge_preset = isset($settings['eael_product_sale_badge_preset']) ? $settings['eael_product_sale_badge_preset'] : '';
|
||||
$sale_text = !empty($settings['eael_product_carousel_sale_text']) ? $settings['eael_product_carousel_sale_text'] : 'Sale!';
|
||||
$stockout_text = !empty($settings['eael_product_carousel_stockout_text']) ? $settings['eael_product_carousel_stockout_text'] : 'Stock Out';
|
||||
|
||||
// should print vars
|
||||
$should_print_rating = isset( $settings['eael_product_carousel_rating'] ) && 'yes' === $settings['eael_product_carousel_rating'];
|
||||
$should_print_quick_view = isset( $settings['eael_product_carousel_quick_view'] ) && 'yes' === $settings['eael_product_carousel_quick_view'];
|
||||
$should_print_image_clickable = isset( $settings['eael_product_carousel_image_clickable'] ) && 'yes' === $settings['eael_product_carousel_image_clickable'];
|
||||
$should_print_title_clickable = isset( $settings['eael_product_carousel_title_clickable'] ) && 'yes' === $settings['eael_product_carousel_title_clickable'];
|
||||
$should_print_price = isset( $settings['eael_product_carousel_price'] ) && 'yes' === $settings['eael_product_carousel_price'];
|
||||
$should_print_excerpt = isset( $settings['eael_product_carousel_excerpt'] ) && ('yes' === $settings['eael_product_carousel_excerpt'] && has_excerpt());
|
||||
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
|
||||
$quick_view_setting = [
|
||||
'widget_id' => $widget_id,
|
||||
'product_id' => $product->get_id(),
|
||||
'page_id' => $settings['eael_page_id'],
|
||||
];
|
||||
|
||||
$product_details_wrap_show = ! empty( $settings['eael_product_carousel_show_title'] ) || $should_print_price || $should_print_rating || $should_print_excerpt;
|
||||
$product_details_none_class = $product_details_wrap_show ? '' : 'product-details-none-overlay';
|
||||
|
||||
if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
?>
|
||||
<li <?php post_class( ['product', 'swiper-slide'] ); ?>>
|
||||
<div class="eael-product-carousel <?php echo esc_attr( $product_details_none_class ); ?>">
|
||||
<div class="carousel-overlay <?php echo $should_print_image_clickable ? 'eael-img-clickable' : ''; ?>"></div>
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php
|
||||
echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $stockout_text ) . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . esc_html( $sale_text ) . '</span>' : '' ) );
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo $product->get_image($settings['eael_product_carousel_image_size_size'], ['loading' => 'eager']);
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-overlay-content">
|
||||
<div class="product-details-wrap">
|
||||
<div class="product-details">
|
||||
<div class="eael-product-title-wrap">
|
||||
<?php
|
||||
if ( $settings['eael_product_carousel_show_title'] ) {
|
||||
echo '<div class="eael-product-title">';
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
echo '<' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
if ( empty( $settings['eael_product_carousel_title_length'] ) ) {
|
||||
echo Helper::eael_wp_kses( $product->get_title() );
|
||||
} else {
|
||||
echo implode( " ", array_slice( explode( " ", Helper::eael_wp_kses($product->get_title()) ), 0, $settings['eael_product_carousel_title_length'] ) );
|
||||
}
|
||||
echo '</' . Helper::eael_validate_html_tag( $settings['eael_product_carousel_title_tag'] ) . '>';
|
||||
|
||||
if( $should_print_title_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
<?php if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
} ?>
|
||||
</div>
|
||||
<?php if($should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<?php if ( $should_print_excerpt ) {
|
||||
echo '<div class="eael-product-excerpt">';
|
||||
echo '<p>' . wp_trim_words( strip_shortcodes( get_the_excerpt() ), $settings['eael_product_carousel_excerpt_length'],
|
||||
esc_html( $settings['eael_product_carousel_excerpt_expanison_indicator'] ) ) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="buttons-wrap">
|
||||
<ul class="icons-wrap box-style">
|
||||
<?php if( $settings[ 'eael_product_carousel_show_add_to_cart' ] ) { ?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="view-details" title="Details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Template Name: Default
|
||||
*/
|
||||
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_Gallery;
|
||||
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_gallery_image_size_size'];
|
||||
$thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
|
||||
}
|
||||
|
||||
$title_tag = isset( $settings['eael_product_gallery_title_html_tag'] ) ? Helper::eael_validate_html_tag($settings['eael_product_gallery_title_html_tag']) : 'h2';
|
||||
|
||||
// Improvement
|
||||
$gallery_style_preset = isset($settings['eael_product_gallery_style_preset']) ? $settings['eael_product_gallery_style_preset'] : '';
|
||||
$sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? $settings['eael_product_sale_badge_alignment'] : '';
|
||||
$sale_badge_preset = isset($settings['eael_product_sale_badge_preset']) ? $settings['eael_product_sale_badge_preset'] : '';
|
||||
// should print vars
|
||||
$sale_text = !empty($settings['eael_product_gallery_sale_text']) ? $settings['eael_product_gallery_sale_text'] : 'Sale!';
|
||||
$stockout_text = !empty($settings['eael_product_gallery_stockout_text']) ? $settings['eael_product_gallery_stockout_text'] : 'Stock <br/> Out';
|
||||
$should_print_rating = isset( $settings['eael_product_gallery_rating'] ) && 'yes' === $settings['eael_product_gallery_rating'];
|
||||
$should_print_quick_view = isset( $settings['eael_product_gallery_quick_view'] ) && 'yes' === $settings['eael_product_gallery_quick_view'];
|
||||
$should_print_addtocart = isset( $settings['eael_product_gallery_addtocart_show'] ) && 'yes' === $settings['eael_product_gallery_addtocart_show'];
|
||||
$should_print_link = isset( $settings['eael_product_gallery_link_show'] ) && 'yes' === $settings['eael_product_gallery_link_show'];
|
||||
$should_print_image_clickable = isset( $settings['eael_product_gallery_image_clickable'] ) && 'yes' === $settings['eael_product_gallery_image_clickable'];
|
||||
$should_print_price = isset( $settings['eael_product_gallery_price'] ) && 'yes' === $settings['eael_product_gallery_price'];
|
||||
$widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
|
||||
$quick_view_setting = [
|
||||
'widget_id' => $widget_id,
|
||||
'product_id' => $product->get_id(),
|
||||
'page_id' => $settings['eael_page_id'],
|
||||
];
|
||||
|
||||
$show_secondary_image = isset( $settings['eael_product_gallery_show_secondary_image'] ) && 'yes' === $settings['eael_product_gallery_show_secondary_image'];
|
||||
$image_sources = [
|
||||
'src' => '',
|
||||
'src_hover' => ''
|
||||
];
|
||||
//if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
|
||||
$product_wrapper_classes = implode( " ", apply_filters( 'eael_product_wrapper_class', [], $product->get_id(), 'eael-woo-product-gallery' ) );
|
||||
|
||||
if ( $gallery_style_preset == 'eael-product-preset-4' ) { ?>
|
||||
<li class="product <?php echo esc_attr( $product_wrapper_classes ) ?>">
|
||||
<?php
|
||||
if($show_secondary_image){
|
||||
$image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
|
||||
}
|
||||
|
||||
?>
|
||||
<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'] ) ?>" >
|
||||
<?php
|
||||
do_action( 'eael_woocommerce_before_shop_loop_item' );
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ){
|
||||
do_action( 'woocommerce_before_shop_loop_item' );
|
||||
}
|
||||
|
||||
echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">'. Helper::eael_wp_kses($stockout_text) .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">' . Helper::eael_wp_kses($sale_text) . '</span>' : '') );
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}?>
|
||||
<?php
|
||||
echo $product->get_image( $settings['eael_product_gallery_image_size_size'], ['loading' => 'eager', 'alt' => esc_attr( $product->get_title() ) ] );
|
||||
if ( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}
|
||||
printf('<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, Helper::eael_wp_kses($product->get_title()));
|
||||
if ( $should_print_rating ) {
|
||||
echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) );
|
||||
}
|
||||
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ( $should_print_addtocart ) {
|
||||
woocommerce_template_loop_add_to_cart();
|
||||
}
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ){
|
||||
do_action( 'woocommerce_after_shop_loop_item' );
|
||||
}
|
||||
do_action( 'eael_woocommerce_after_shop_loop_item' );
|
||||
?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
} else if (($gallery_style_preset == 'eael-product-preset-3') || ($gallery_style_preset == 'eael-product-preset-2')) {
|
||||
?>
|
||||
<li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
|
||||
<?php
|
||||
if( $show_secondary_image ){
|
||||
$image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
|
||||
}
|
||||
|
||||
?>
|
||||
<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'] ); ?>" >
|
||||
<?php
|
||||
do_action( 'eael_woocommerce_before_shop_loop_item' );
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_before_shop_loop_item' );
|
||||
}
|
||||
?>
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php if( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
|
||||
echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">'. Helper::eael_wp_kses( $stockout_text ) .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">' . Helper::eael_wp_kses($sale_text) . '</span>' : '') );
|
||||
|
||||
echo $product->get_image( $settings['eael_product_gallery_image_size_size'], ['loading' => 'eager', 'alt' => esc_attr( $product->get_title() ) ] );
|
||||
|
||||
if( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
}?>
|
||||
</div>
|
||||
<div class="image-hover-wrap">
|
||||
<?php if ($gallery_style_preset == 'eael-product-preset-2') { ?>
|
||||
<ul class="icons-wrap block-box-style">
|
||||
<?php if( $should_print_addtocart ){?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php } ?>
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="eael-product-gallery-open-popup open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if( $should_print_link ){?>
|
||||
<li class="view-details"><?php echo '<a href="' . $product->get_permalink() . '" aria-label="View Details about ' . esc_attr( $product->get_title() ) . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php } else { ?>
|
||||
<ul class="icons-wrap box-style">
|
||||
<?php if( $should_print_addtocart ){?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="eael-product-gallery-open-popup open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $should_print_link ){?>
|
||||
<li class="view-details" title="Details" aria-label="View Details about <?php echo esc_attr( $product->get_title() ); ?>"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-details-wrap">
|
||||
<?php
|
||||
if(($gallery_style_preset == 'eael-product-preset-2') && $should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}
|
||||
|
||||
if ($should_print_rating) {
|
||||
echo wc_get_rating_html
|
||||
($product->get_average_rating(), $product->get_rating_count());
|
||||
}
|
||||
?>
|
||||
<div class="eael-product-title">
|
||||
<?php printf('<%1$s>%2$s</%1$s>', $title_tag, Helper::eael_wp_kses( $product->get_title() ) ); ?>
|
||||
</div>
|
||||
<?php if(($gallery_style_preset != 'eael-product-preset-2') && $should_print_price ){
|
||||
echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
|
||||
}?>
|
||||
</div>
|
||||
<?php
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_after_shop_loop_item' );
|
||||
}
|
||||
do_action( 'eael_woocommerce_after_shop_loop_item' );
|
||||
?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
|
||||
} else if ($gallery_style_preset == 'eael-product-preset-1') {
|
||||
?>
|
||||
<li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
|
||||
<?php
|
||||
if( $show_secondary_image ){
|
||||
$image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
|
||||
}
|
||||
?>
|
||||
<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'] ); ?>" >
|
||||
<?php
|
||||
do_action( 'eael_woocommerce_before_shop_loop_item' );
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_before_shop_loop_item' );
|
||||
}
|
||||
?>
|
||||
<div class="product-image-wrap">
|
||||
<div class="image-wrap">
|
||||
<?php if ( $should_print_image_clickable ) {
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
}
|
||||
|
||||
echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . Helper::eael_wp_kses( $stockout_text ) . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . Helper::eael_wp_kses( $sale_text ) . '</span>' : '' ) );
|
||||
echo $product->get_image( $settings['eael_product_gallery_image_size_size'], ['loading' => 'eager', 'alt' => esc_attr( $product->get_title() )] );
|
||||
|
||||
if ( $should_print_image_clickable ) {
|
||||
echo '</a>';
|
||||
} ?>
|
||||
</div>
|
||||
<div class="image-hover-wrap">
|
||||
<ul class="icons-wrap over-box-style">
|
||||
<?php if( $should_print_addtocart ){?>
|
||||
<li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
|
||||
<?php } ?>
|
||||
<?php if( $should_print_quick_view ){?>
|
||||
<li class="eael-product-quick-view">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
|
||||
class="eael-product-gallery-open-popup open-popup-link">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if( $should_print_link ){?>
|
||||
<li class="view-details"><?php echo '<a href="' . $product->get_permalink() . '" aria-label="View Details about ' . esc_attr( $product->get_title() ) . '" ><i class="fas fa-link"></i></a>'; ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-details-wrap">
|
||||
<?php
|
||||
if ( $should_print_price ) {
|
||||
echo '<div class="eael-product-price">' . $product->get_price_html() . '</div>';
|
||||
}
|
||||
?>
|
||||
<div class="eael-product-title">
|
||||
<?php
|
||||
echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
|
||||
printf('<%1$s>%2$s</%1$s>', $title_tag, Helper::eael_wp_kses( $product->get_title() ) );
|
||||
echo '</a>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
|
||||
do_action( 'woocommerce_after_shop_loop_item' );
|
||||
}
|
||||
do_action( 'eael_woocommerce_after_shop_loop_item' );
|
||||
?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
//}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: Preset 1
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_List;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
if ( empty( $woo_product_list ) ) {
|
||||
$woo_product_list = Woo_Product_List::get_woo_product_list_settings( $settings );
|
||||
}
|
||||
|
||||
$product = wc_get_product( get_the_ID() );
|
||||
if ( ! $product ) {
|
||||
error_log( '$product not found in ' . __FILE__ );
|
||||
return;
|
||||
}
|
||||
|
||||
$woo_product_list_loop = Woo_Product_List::get_woo_product_list_loop_settings( $product, $settings, $woo_product_list ); // static method as the template is used by read more feature too
|
||||
?>
|
||||
<div <?php post_class( 'product' ); ?>>
|
||||
<div class="eael-product-list-item <?php echo esc_attr( $woo_product_list['image_alignment'] ); ?>">
|
||||
<?php if( 'badge-preset-2' === $woo_product_list['badge_preset'] ) : ?>
|
||||
<?php Woo_Product_List::eael_print_produt_badge_html( $woo_product_list, $product ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="eael-product-list-image-wrap">
|
||||
<?php if( 'badge-preset-2' !== $woo_product_list['badge_preset'] ) : ?>
|
||||
<?php Woo_Product_List::eael_print_produt_badge_html( $woo_product_list, $product ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['image_clickable'] ) : ?>
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link" >
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo wp_kses_post( $product->get_image( $woo_product_list['image_size'], ['loading' => 'eager'] ) ); ?>
|
||||
|
||||
<?php if ( $woo_product_list['image_clickable'] ) : ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['button_position_on_hover'] ) : ?>
|
||||
<ul class="eael-product-list-buttons-on-hover">
|
||||
<?php if ( $woo_product_list['add_to_cart_button_show'] ) : ?>
|
||||
<li class="eael-product-list-add-to-cart-button eael-m-0">
|
||||
<?php woocommerce_template_loop_add_to_cart(); ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['quick_view_button_show'] ) : ?>
|
||||
<li class="eael-product-list-quick-view-button eael-m-0">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars( json_encode( $woo_product_list_loop['quick_view_setting'] ), ENT_QUOTES ); ?>" class="open-popup-link"><i class="fas fa-eye"></i></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['link_button_show'] ) : ?>
|
||||
<li class="eael-product-list-link-button eael-m-0">
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>"><i class="fas fa-link"></i></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="eael-product-list-content-wrap">
|
||||
<?php
|
||||
if ( 'after-title' === $woo_product_list['content_header_position'] ) :
|
||||
Woo_Product_List::eael_print_product_title_html( $woo_product_list, $product );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="eael-product-list-content-header <?php echo esc_attr( $woo_product_list_loop['direction_rtl_class'] ) ?>" >
|
||||
<?php if ( $woo_product_list['rating_show'] ) : ?>
|
||||
<div class="eael-product-list-rating">
|
||||
<?php echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) ); ?>
|
||||
|
||||
<?php if ( $woo_product_list['review_count_show'] && $woo_product_list_loop['review_count'] > 0 ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ) ?>#reviews" class="woocommerce-review-link eael-product-list-review-count" rel="nofollow">(<?php printf( '%s', __( $woo_product_list_loop['review_count'], 'essential-addons-for-elementor-lite' ) ); ?>)</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="eael-product-list-notice eael-product-list-notice-shiping-free">
|
||||
<?php if ( $woo_product_list['category_show'] && $woo_product_list_loop['has_terms'] ) : ?>
|
||||
<p>
|
||||
<i class="fas fa-box"></i>
|
||||
<?php echo esc_html( Woo_Product_List::eael_get_product_category_name( $woo_product_list_loop['terms'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="eael-product-list-content-body">
|
||||
<?php
|
||||
if ( 'before-title' === $woo_product_list['content_header_position'] ) :
|
||||
Woo_Product_List::eael_print_product_title_html( $woo_product_list, $product );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ( $woo_product_list['excerpt_show'] ) : ?>
|
||||
<div class="eael-product-list-excerpt">
|
||||
<?php echo wp_trim_words( strip_shortcodes( get_the_excerpt() ), $woo_product_list['excerpt_words_count'], $woo_product_list['excerpt_expanison_indicator'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['price_show'] ) : ?>
|
||||
<h3 class="eael-product-list-price">
|
||||
<?php echo wp_kses_post( $product->get_price_html() ); ?>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="eael-product-list-content-footer">
|
||||
<?php if ( $woo_product_list['total_sold_show'] ) : ?>
|
||||
<div class="eael-product-list-progress">
|
||||
<div class="eael-product-list-progress-info">
|
||||
<h4 class="eael-product-list-progress-count"><?php esc_html_e( $woo_product_list['total_sold_text'], 'essential-addons-for-elementor-lite' ); ?> <span><?php echo esc_html( $woo_product_list_loop['total_sales_count'] ); ?></span></h4>
|
||||
<?php if( $product->managing_stock() && $woo_product_list['total_sold_remaining_show'] ) : ?>
|
||||
<h4 class="eael-product-list-progress-remaining"><?php esc_html_e( $woo_product_list['total_sold_remaining_text'], 'essential-addons-for-elementor-lite' ); ?> <span><?php echo esc_html( $woo_product_list_loop['stock_quantity_count'] ); ?></span></h4>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="eael-product-list-progress-bar-outer">
|
||||
<div style="width: <?php echo esc_attr( $woo_product_list_loop['total_sold_progress_percentage'] ); ?>%;" class="eael-product-list-progress-bar-inner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['button_position_static'] ) : ?>
|
||||
<div class="eael-product-list-buttons">
|
||||
<?php if ( $woo_product_list['add_to_cart_button_show'] ) : ?>
|
||||
<p class="eael-product-list-add-to-cart-button eael-m-0"><?php woocommerce_template_loop_add_to_cart(); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['quick_view_button_show'] ) : ?>
|
||||
<p class="eael-product-list-quick-view-button eael-m-0">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars( json_encode( $woo_product_list_loop['quick_view_setting'] ), ENT_QUOTES ); ?>" class="open-popup-link">
|
||||
<?php esc_html_e( $woo_product_list['quick_view_text'], 'essential-addons-for-elementor-lite' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: Preset 2
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_List;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
if ( empty( $woo_product_list ) ) {
|
||||
$woo_product_list = Woo_Product_List::get_woo_product_list_settings( $settings );
|
||||
}
|
||||
|
||||
$product = wc_get_product( get_the_ID() );
|
||||
if ( ! $product ) {
|
||||
error_log( '$product not found in ' . __FILE__ );
|
||||
return;
|
||||
}
|
||||
|
||||
$woo_product_list_loop = Woo_Product_List::get_woo_product_list_loop_settings( $product, $settings, $woo_product_list ); // static method as the template is used by read more feature too
|
||||
?>
|
||||
<div <?php post_class( 'product' ); ?>>
|
||||
<div class="eael-product-list-item <?php echo esc_attr( $woo_product_list['image_alignment'] ); ?>">
|
||||
<?php if( 'badge-preset-2' === $woo_product_list['badge_preset'] ) : ?>
|
||||
<?php Woo_Product_List::eael_print_produt_badge_html( $woo_product_list, $product ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="eael-product-list-image-wrap">
|
||||
<?php if( 'badge-preset-2' !== $woo_product_list['badge_preset'] ) : ?>
|
||||
<?php Woo_Product_List::eael_print_produt_badge_html( $woo_product_list, $product ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['image_clickable'] ) : ?>
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link" >
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo wp_kses_post( $product->get_image( $woo_product_list['image_size'], ['loading' => 'eager'] ) ); ?>
|
||||
|
||||
<?php if ( $woo_product_list['image_clickable'] ) : ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['button_position_on_hover'] ) : ?>
|
||||
<ul class="eael-product-list-buttons-on-hover">
|
||||
<?php if ( $woo_product_list['add_to_cart_button_show'] ) : ?>
|
||||
<li class="eael-product-list-add-to-cart-button eael-m-0">
|
||||
<?php woocommerce_template_loop_add_to_cart(); ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['quick_view_button_show'] ) : ?>
|
||||
<li class="eael-product-list-quick-view-button eael-m-0">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars( json_encode( $woo_product_list_loop['quick_view_setting'] ), ENT_QUOTES ); ?>" class="open-popup-link"><i class="fas fa-eye"></i></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['link_button_show'] ) : ?>
|
||||
<li class="eael-product-list-link-button eael-m-0">
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>"><i class="fas fa-link"></i></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="eael-product-list-content-wrap">
|
||||
<?php
|
||||
if ( 'after-title' === $woo_product_list['content_header_position'] ) :
|
||||
Woo_Product_List::eael_print_product_title_html( $woo_product_list, $product );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="eael-product-list-content-header <?php echo esc_attr( $woo_product_list_loop['direction_rtl_class'] ) ?>" >
|
||||
<?php if ( $woo_product_list['rating_show'] ) : ?>
|
||||
<div class="eael-product-list-rating">
|
||||
<?php echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) ); ?>
|
||||
|
||||
<?php if ( $woo_product_list['review_count_show'] && $woo_product_list_loop['review_count'] > 0 ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ) ?>#reviews" class="woocommerce-review-link eael-product-list-review-count" rel="nofollow">(<?php printf( '%s', __( $woo_product_list_loop['review_count'], 'essential-addons-for-elementor-lite' ) ); ?>)</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="eael-product-list-notice eael-product-list-notice-category">
|
||||
<?php if ( $woo_product_list['category_show'] && $woo_product_list_loop['has_terms'] ) : ?>
|
||||
<p>
|
||||
<i class="fas fa-box"></i>
|
||||
<?php echo esc_html( Woo_Product_List::eael_get_product_category_name( $woo_product_list_loop['terms'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="eael-product-list-content-body">
|
||||
<?php
|
||||
if ( 'before-title' === $woo_product_list['content_header_position'] ) :
|
||||
Woo_Product_List::eael_print_product_title_html( $woo_product_list, $product );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ( $woo_product_list['excerpt_show'] ) : ?>
|
||||
<div class="eael-product-list-excerpt">
|
||||
<?php echo wp_trim_words( strip_shortcodes( get_the_excerpt() ), $woo_product_list['excerpt_words_count'], $woo_product_list['excerpt_expanison_indicator'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['price_show'] ) : ?>
|
||||
<h3 class="eael-product-list-price">
|
||||
<?php echo wp_kses_post( $product->get_price_html() ); ?>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="eael-product-list-content-footer">
|
||||
<?php if ( $woo_product_list['total_sold_show'] ) : ?>
|
||||
<div class="eael-product-list-progress">
|
||||
<div class="eael-product-list-progress-info">
|
||||
<h4 class="eael-product-list-progress-count"><?php esc_html_e( $woo_product_list['total_sold_text'], 'essential-addons-for-elementor-lite' ); ?> <span><?php echo esc_html( $woo_product_list_loop['total_sales_count'] ); ?></span></h4>
|
||||
|
||||
<?php if( $product->managing_stock() && $woo_product_list['total_sold_remaining_show'] ) : ?>
|
||||
<h4 class="eael-product-list-progress-remaining"><?php esc_html_e( $woo_product_list['total_sold_remaining_text'], 'essential-addons-for-elementor-lite' ); ?> <span><?php echo esc_html( $woo_product_list_loop['stock_quantity_count'] ); ?></span></h4>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="eael-product-list-progress-bar-outer">
|
||||
<div style="width: <?php echo esc_attr( $woo_product_list_loop['total_sold_progress_percentage'] ); ?>%;" class="eael-product-list-progress-bar-inner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['button_position_static'] ) : ?>
|
||||
<div class="eael-product-list-buttons">
|
||||
<?php if ( $woo_product_list['add_to_cart_button_show'] ) : ?>
|
||||
<p class="eael-product-list-add-to-cart-button eael-m-0"><?php woocommerce_template_loop_add_to_cart(); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['quick_view_button_show'] ) : ?>
|
||||
<p class="eael-product-list-quick-view-button eael-m-0">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars( json_encode( $woo_product_list_loop['quick_view_setting'] ), ENT_QUOTES ); ?>" class="open-popup-link">
|
||||
<?php esc_html_e( $woo_product_list['quick_view_text'], 'essential-addons-for-elementor-lite' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: Preset 3
|
||||
*/
|
||||
|
||||
use Essential_Addons_Elementor\Elements\Woo_Product_List;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
if ( empty( $woo_product_list ) ) {
|
||||
$woo_product_list = Woo_Product_List::get_woo_product_list_settings( $settings );
|
||||
}
|
||||
|
||||
$product = wc_get_product( get_the_ID() );
|
||||
if ( ! $product ) {
|
||||
error_log( '$product not found in ' . __FILE__ );
|
||||
return;
|
||||
}
|
||||
|
||||
$woo_product_list_loop = Woo_Product_List::get_woo_product_list_loop_settings( $product, $settings, $woo_product_list ); // static method as the template is used by read more feature too
|
||||
?>
|
||||
<div <?php post_class( 'product' ); ?>>
|
||||
<div class="eael-product-list-item <?php echo esc_attr( $woo_product_list['image_alignment'] ); ?>">
|
||||
<?php if( 'badge-preset-2' === $woo_product_list['badge_preset'] ) : ?>
|
||||
<?php Woo_Product_List::eael_print_produt_badge_html( $woo_product_list, $product ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="eael-product-list-image-wrap">
|
||||
<?php if( 'badge-preset-2' !== $woo_product_list['badge_preset'] ) : ?>
|
||||
<?php Woo_Product_List::eael_print_produt_badge_html( $woo_product_list, $product ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['image_clickable'] ) : ?>
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link" >
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo wp_kses_post( $product->get_image( $woo_product_list['image_size'], ['loading' => 'eager'] ) ); ?>
|
||||
|
||||
<?php if ( $woo_product_list['image_clickable'] ) : ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['button_position_on_hover'] ) : ?>
|
||||
<ul class="eael-product-list-buttons-on-hover">
|
||||
<?php if ( $woo_product_list['add_to_cart_button_show'] ) : ?>
|
||||
<li class="eael-product-list-add-to-cart-button eael-m-0">
|
||||
<?php woocommerce_template_loop_add_to_cart(); ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['quick_view_button_show'] ) : ?>
|
||||
<li class="eael-product-list-quick-view-button eael-m-0">
|
||||
<a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars( json_encode( $woo_product_list_loop['quick_view_setting'] ), ENT_QUOTES ); ?>" class="open-popup-link"><i class="fas fa-eye"></i></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['link_button_show'] ) : ?>
|
||||
<li class="eael-product-list-link-button eael-m-0">
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>"><i class="fas fa-link"></i></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="eael-product-list-content-wrap">
|
||||
<?php
|
||||
if ( 'after-title' === $woo_product_list['content_header_position'] ) :
|
||||
Woo_Product_List::eael_print_product_title_html( $woo_product_list, $product );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="eael-product-list-content-header <?php echo esc_attr( $woo_product_list_loop['direction_rtl_class'] ) ?>" >
|
||||
<?php if ( $woo_product_list['rating_show'] ) : ?>
|
||||
<div class="eael-product-list-rating">
|
||||
<?php echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) ); ?>
|
||||
|
||||
<?php if ( $woo_product_list['review_count_show'] && $woo_product_list_loop['review_count'] > 0 ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ) ?>#reviews" class="woocommerce-review-link eael-product-list-review-count" rel="nofollow">(<?php printf( '%s', __( $woo_product_list_loop['review_count'], 'essential-addons-for-elementor-lite' ) ); ?>)</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="eael-product-list-content-body">
|
||||
<?php
|
||||
if ( 'before-title' === $woo_product_list['content_header_position'] ) :
|
||||
Woo_Product_List::eael_print_product_title_html( $woo_product_list, $product );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ( $woo_product_list['excerpt_show'] ) : ?>
|
||||
<div class="eael-product-list-excerpt">
|
||||
<?php echo wp_trim_words( strip_shortcodes( get_the_excerpt() ), $woo_product_list['excerpt_words_count'], $woo_product_list['excerpt_expanison_indicator'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['price_show'] ) : ?>
|
||||
<h3 class="eael-product-list-price">
|
||||
<?php echo wp_kses_post( $product->get_price_html() ); ?>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="eael-product-list-content-footer">
|
||||
<?php if ( $woo_product_list['button_position_static'] ) : ?>
|
||||
<div class="eael-product-list-buttons">
|
||||
<?php if ( $woo_product_list['add_to_cart_button_show'] ) : ?>
|
||||
<p class="eael-product-list-add-to-cart-button eael-m-0"><?php woocommerce_template_loop_add_to_cart(); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $woo_product_list['total_sold_show'] ) : ?>
|
||||
<div class="eael-product-list-progress">
|
||||
<div class="eael-product-list-progress-info">
|
||||
<h4 class="eael-product-list-progress-count"><?php esc_html_e( $woo_product_list['total_sold_text'], 'essential-addons-for-elementor-lite' ); ?> <span><?php echo esc_html( $woo_product_list_loop['total_sales_count'] ); ?></span> <?php _e('Item', 'essential-addons-for-elementor-lite'); ?></h4>
|
||||
</div>
|
||||
<div class="eael-product-list-progress-bar-outer">
|
||||
<div style="width: <?php echo esc_attr( $woo_product_list_loop['total_sold_progress_percentage'] ); ?>%;" class="eael-product-list-progress-bar-inner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="eael-product-list-notice eael-product-list-notice-shiping-free">
|
||||
<?php if ( $woo_product_list['category_show'] && $woo_product_list_loop['has_terms'] ) : ?>
|
||||
<p>
|
||||
<i class="fas fa-box"></i>
|
||||
<?php echo esc_html( Woo_Product_List::eael_get_product_category_name( $woo_product_list_loop['terms'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,712 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Template\Woocommerce\Cart;
|
||||
|
||||
use Elementor\Icons_Manager;
|
||||
use \Essential_Addons_Elementor\Classes\Helper;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
trait Woo_Cart_Helper {
|
||||
|
||||
public static $setting_data = [];
|
||||
|
||||
public static function ea_get_woo_cart_settings() {
|
||||
return self::$setting_data;
|
||||
}
|
||||
|
||||
public static function ea_set_woo_cart_settings( $settings ) {
|
||||
self::$setting_data = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added all actions
|
||||
*/
|
||||
public function ea_woo_cart_add_actions( $settings ) {
|
||||
// set ea cart controller settings
|
||||
self::ea_set_woo_cart_settings( $settings );
|
||||
}
|
||||
|
||||
public function ea_cart_render() {
|
||||
$settings = self::ea_get_woo_cart_settings();
|
||||
Woo_Cart_Shortcode::output( [], $settings );
|
||||
}
|
||||
|
||||
public static function woo_cart_style_one( $settings ) { ?>
|
||||
<form class="woocommerce-cart-form eael-woo-cart-form woocommerce" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
<?php do_action( 'woocommerce_before_cart_table' ); ?>
|
||||
|
||||
<div class="eael-cart-clear-btn mt10">
|
||||
<?php if ( ! empty( $settings['eael_woo_cart_components_cart_clear_button'] ) && $settings['eael_woo_cart_components_cart_clear_button'] === 'yes' ) {
|
||||
$clear_text = apply_filters( 'eael_woo_cart_clear_button_text', $settings['eael_woo_cart_components_cart_clear_button_text'] );
|
||||
echo '<a href="' . esc_url( add_query_arg( 'empty_cart', 'yes' ) ) . '" class="button" title="' . esc_attr( $clear_text ) . '">' . esc_html( $clear_text ) . '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="eael-woo-cart-table-warp">
|
||||
<table class="shop_table cart woocommerce-cart-form__contents eael-woo-cart-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
if ( ! empty( $settings['table_items'] ) && is_array( $settings['table_items'] ) ) {
|
||||
foreach ( $settings['table_items'] as $column_data ) {
|
||||
$item_class = "elementor-repeater-item-{$column_data['_id']}";
|
||||
?>
|
||||
<th class="<?php echo esc_attr( "product-{$column_data['column_type']} {$item_class}" ); ?>">
|
||||
<?php
|
||||
$title = apply_filters( "eael_woo_cart_table_{$column_data['column_type']}_title", $column_data['column_heading_title'] );
|
||||
echo esc_html( $title );
|
||||
?>
|
||||
</th>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
do_action( 'woocommerce_before_cart_contents' );
|
||||
|
||||
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
||||
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
||||
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
|
||||
|
||||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0
|
||||
&& apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key )
|
||||
) {
|
||||
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink',
|
||||
$_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item,
|
||||
$cart_item_key );
|
||||
?>
|
||||
<tr class="woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class',
|
||||
'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
<?php
|
||||
if ( ! empty( $settings['table_items'] ) && is_array( $settings['table_items'] ) ) {
|
||||
foreach ( $settings['table_items'] as $column_data ) {
|
||||
$item_class = "elementor-repeater-item-{$column_data['_id']}";
|
||||
|
||||
switch ( $column_data['column_type'] ) {
|
||||
case 'remove': ?>
|
||||
<td class="product-remove <?php echo esc_attr( $item_class ); ?>">
|
||||
<?php
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'woocommerce_cart_item_remove_link',
|
||||
sprintf(
|
||||
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">%s</a>',
|
||||
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
|
||||
esc_html__( 'Remove this item', 'essential-addons-for-elementor-lite' ),
|
||||
esc_attr( $product_id ),
|
||||
esc_attr( $_product->get_sku() ),
|
||||
Helper::get_render_icon( $column_data['item_remove_icon'], [ 'aria-hidden' => 'true' ] )
|
||||
),
|
||||
$cart_item_key
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'thumbnail': ?>
|
||||
<td class="product-thumbnail <?php echo esc_attr( $item_class ); ?>">
|
||||
<?php
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
|
||||
if ( ! $product_permalink ) {
|
||||
echo $thumbnail; // PHPCS: XSS ok.
|
||||
} else {
|
||||
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ),
|
||||
$thumbnail ); // PHPCS: XSS ok.
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'name': ?>
|
||||
<td class="product-name <?php echo esc_attr( $item_class ); ?>">
|
||||
<?php
|
||||
if ( ! $product_permalink ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name',
|
||||
$_product->get_name(), $cart_item, $cart_item_key )
|
||||
. ' ' );
|
||||
} else {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name',
|
||||
sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ),
|
||||
$_product->get_name() ), $cart_item, $cart_item_key ) );
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
|
||||
|
||||
// Meta data.
|
||||
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
|
||||
|
||||
// Backorder notification.
|
||||
if ( $_product->backorders_require_notification()
|
||||
&& $_product->is_on_backorder( $cart_item['quantity'] )
|
||||
) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification',
|
||||
'<p class="backorder_notification">'
|
||||
. esc_html__( 'Available on backorder', 'essential-addons-for-elementor-lite' )
|
||||
. '</p>', $product_id ) );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'price': ?>
|
||||
<td class="product-price <?php echo esc_attr( $item_class ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_price',
|
||||
WC()->cart->get_product_price( $_product ), $cart_item,
|
||||
$cart_item_key ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'quantity': ?>
|
||||
<td class="product-quantity <?php echo esc_attr( $item_class ); ?>">
|
||||
<?php
|
||||
if ( $_product->is_sold_individually() ) {
|
||||
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
||||
} else {
|
||||
$product_quantity = woocommerce_quantity_input(
|
||||
[
|
||||
'input_name' => "cart[{$cart_item_key}][qty]",
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $_product->get_max_purchase_quantity(),
|
||||
'min_value' => '0',
|
||||
'product_name' => $_product->get_name(),
|
||||
],
|
||||
$_product,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity,
|
||||
$cart_item_key, $cart_item ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'subtotal': ?>
|
||||
<td class="product-subtotal <?php echo esc_attr( $item_class ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_subtotal',
|
||||
WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ),
|
||||
$cart_item,
|
||||
$cart_item_key ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_cart_contents' );
|
||||
do_action( 'woocommerce_after_cart_contents' ); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
do_action( 'woocommerce_after_cart_table' );
|
||||
self::woo_cart_collaterals( $settings );
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function eael_woo_cart_totals( $settings ) {
|
||||
if ( ! empty( $settings['ea_woo_cart_layout'] ) ) {
|
||||
?>
|
||||
<div class="cart_totals <?php echo ( WC()->customer->has_calculated_shipping() ) ? 'calculated_shipping' : ''; ?>">
|
||||
<?php
|
||||
do_action( 'woocommerce_before_cart_totals' );
|
||||
|
||||
if ( $settings['eael_woo_cart_components_cart_totals_subtotal'] === 'yes' || $settings['eael_woo_cart_components_cart_totals_coupon'] === 'yes' ||
|
||||
$settings['eael_woo_cart_components_cart_totals_shipping'] === 'yes' ||
|
||||
( ! empty( WC()->cart->get_fees() ) && $settings['eael_woo_cart_components_cart_totals_fees'] === 'yes' ) ||
|
||||
$settings['eael_woo_cart_components_cart_totals_tax'] === 'yes' || $settings['eael_woo_cart_components_cart_totals_total'] === 'yes' ) {
|
||||
?>
|
||||
<table class="shop_table shop_table_responsive">
|
||||
|
||||
<?php if ( $settings['eael_woo_cart_components_cart_totals_subtotal'] === 'yes' ) {
|
||||
$subtotal_label = apply_filters( 'eael_woo_cart_totals_subtotal_label', esc_html__( 'Subtotal', 'essential-addons-for-elementor-lite' ) );
|
||||
?>
|
||||
<tr class="cart-subtotal">
|
||||
<th><?php echo esc_html( $subtotal_label ); ?></th>
|
||||
<td data-title="<?php echo esc_attr( $subtotal_label ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if ( $settings['eael_woo_cart_components_cart_totals_coupon'] === 'yes' ) {
|
||||
foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
|
||||
<tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td data-title="<?php echo esc_attr( wc_cart_totals_coupon_label( $coupon, false ) ); ?>"><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( $settings['eael_woo_cart_components_cart_totals_shipping'] === 'yes' ) {
|
||||
if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_totals_before_shipping' ); ?>
|
||||
|
||||
<?php wc_cart_totals_shipping_html(); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_totals_after_shipping' ); ?>
|
||||
|
||||
<?php elseif ( WC()->cart->needs_shipping() && 'yes' === get_option( 'woocommerce_enable_shipping_calc' ) ) :
|
||||
$shipping_label = apply_filters( 'eael_woo_cart_totals_shipping_label', esc_html__( 'Shipping', 'essential-addons-for-elementor-lite' ) );
|
||||
?>
|
||||
|
||||
<tr class="shipping">
|
||||
<th><?php echo esc_html( $shipping_label ); ?></th>
|
||||
<td data-title="<?php echo esc_attr( $shipping_label ); ?>"><?php woocommerce_shipping_calculator(); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
} ?>
|
||||
|
||||
<?php
|
||||
if ( $settings['eael_woo_cart_components_cart_totals_fees'] === 'yes' ) {
|
||||
foreach ( WC()->cart->get_fees() as $fee ) : ?>
|
||||
<tr class="fee">
|
||||
<th><?php echo esc_html( $fee->name ); ?></th>
|
||||
<td data-title="<?php echo esc_attr( $fee->name ); ?>"><?php wc_cart_totals_fee_html( $fee ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
} ?>
|
||||
|
||||
<?php
|
||||
if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() && $settings['eael_woo_cart_components_cart_totals_tax'] === 'yes' ) {
|
||||
$taxable_address = WC()->customer->get_taxable_address();
|
||||
$estimated_text = '';
|
||||
|
||||
if ( WC()->customer->is_customer_outside_base() && ! WC()->customer->has_calculated_shipping() ) {
|
||||
/* translators: %s location. */
|
||||
$estimated_text = sprintf( ' <small>' . esc_html__( '(estimated for %s)', 'essential-addons-for-elementor-lite' ) . '</small>', WC()->countries->estimated_for_prefix( $taxable_address[0] ) . WC()->countries->countries[ $taxable_address[0] ] );
|
||||
}
|
||||
|
||||
if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) {
|
||||
foreach ( WC()->cart->get_tax_totals() as $code => $tax ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
?>
|
||||
<tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
|
||||
<th><?php echo esc_html( $tax->label ) . $estimated_text; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th>
|
||||
<td data-title="<?php echo esc_attr( $tax->label ); ?>"><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<tr class="tax-total">
|
||||
<th><?php echo esc_html( WC()->countries->tax_or_vat() ) . $estimated_text; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th>
|
||||
<td data-title="<?php echo esc_attr( WC()->countries->tax_or_vat() ); ?>"><?php wc_cart_totals_taxes_total_html(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
do_action( 'woocommerce_cart_totals_before_order_total' );
|
||||
|
||||
if ( $settings['eael_woo_cart_components_cart_totals_total'] === 'yes' ) {
|
||||
$total_label = apply_filters( 'eael_woo_cart_totals_total_label', esc_html__( 'Total', 'essential-addons-for-elementor-lite' ) );
|
||||
?>
|
||||
<tr class="order-total">
|
||||
<th><?php echo esc_html( $total_label ); ?></th>
|
||||
<td data-title="<?php echo esc_attr( $total_label ); ?>"><?php wc_cart_totals_order_total_html(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_cart_totals_after_order_total' );
|
||||
?>
|
||||
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wc-proceed-to-checkout">
|
||||
<?php do_action( 'woocommerce_proceed_to_checkout', $settings ); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
do_action( 'woocommerce_after_cart_totals' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
woocommerce_cart_totals();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove_woocommerce_cross_sell_display( $settings ) {
|
||||
// Remove default 'woocommerce_cross_sell_display' callback from 'woocommerce_cart_collaterals'
|
||||
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
|
||||
}
|
||||
|
||||
public static function eael_cart_button_proceed_to_checkout( $settings ) {
|
||||
if ( ! empty( $settings['ea_woo_cart_layout'] ) ) {
|
||||
$button_text = apply_filters( 'eael_woo_cart_checkout_button_text', $settings['eael_woo_cart_components_cart_checkout_button_text'] );
|
||||
?>
|
||||
<a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="checkout-button button alt wc-forward">
|
||||
<?php echo esc_html( $button_text ); ?>
|
||||
</a>
|
||||
<?php
|
||||
} else {
|
||||
woocommerce_button_proceed_to_checkout();
|
||||
}
|
||||
}
|
||||
|
||||
public static function woo_cart_style_two( $settings ) { ?>
|
||||
<form class="woocommerce-cart-form eael-woo-cart-form woocommerce" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
<?php do_action( 'woocommerce_before_cart_table' ); ?>
|
||||
|
||||
<div class="eael-cart-clear-btn mt10">
|
||||
<?php if ( ! empty( $settings['eael_woo_cart_components_cart_clear_button'] ) && $settings['eael_woo_cart_components_cart_clear_button'] === 'yes' ) {
|
||||
$clear_text = apply_filters( 'eael_woo_cart_clear_button_text', $settings['eael_woo_cart_components_cart_clear_button_text'] );
|
||||
echo '<a href="' . esc_url( add_query_arg( 'empty_cart', 'yes' ) ) . '" class="button" title="' . esc_attr( $clear_text ) . '">' . esc_html( $clear_text ) . '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="shop_table cart woocommerce-cart-form__contents eael-woo-cart-table">
|
||||
<?php
|
||||
$has_table_left_components = $settings['eael_woo_cart_table_components_thumbnail'] === 'yes' ? true : false;
|
||||
$has_table_right_components = in_array( 'yes', [
|
||||
$settings['eael_woo_cart_table_components_price'],
|
||||
$settings['eael_woo_cart_table_components_qty'],
|
||||
$settings['eael_woo_cart_table_components_subtotal'],
|
||||
$settings['eael_woo_cart_table_components_remove']
|
||||
] ) ? true : false;
|
||||
|
||||
if ( $has_table_left_components || $has_table_right_components ) {
|
||||
?>
|
||||
<div class="eael-woo-cart-thead">
|
||||
<div class="eael-woo-cart-tr">
|
||||
<?php if ( $has_table_left_components ) { ?>
|
||||
<div class="eael-woo-cart-tr-left">
|
||||
<div class="eael-woo-cart-td product-thumbnail">
|
||||
<?php
|
||||
$title = apply_filters( "eael_woo_cart_table_thumbnail_title", $settings['eael_woo_cart_table_components_thumbnail_title'] );
|
||||
echo esc_html( $title );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $has_table_right_components ) { ?>
|
||||
<div class="eael-woo-cart-tr-right">
|
||||
<?php if ( $settings['eael_woo_cart_table_components_price'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-price">
|
||||
<?php
|
||||
$title = apply_filters( "eael_woo_cart_table_price_title", $settings['eael_woo_cart_table_components_price_title'] );
|
||||
echo esc_html( $title );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_qty'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-quantity">
|
||||
<?php
|
||||
$title = apply_filters( "eael_woo_cart_table_quantity_title", $settings['eael_woo_cart_table_components_qty_title'] );
|
||||
echo esc_html( $title );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_subtotal'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-subtotal">
|
||||
<?php
|
||||
$title = apply_filters( "eael_woo_cart_table_subtotal_title", $settings['eael_woo_cart_table_components_subtotal_title'] );
|
||||
echo esc_html( $title );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_remove'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-remove"></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="eael-woo-cart-tbody">
|
||||
<?php
|
||||
do_action( 'woocommerce_before_cart_contents' );
|
||||
|
||||
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
||||
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
||||
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
|
||||
|
||||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0
|
||||
&& apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key )
|
||||
) {
|
||||
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink',
|
||||
$_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item,
|
||||
$cart_item_key );
|
||||
?>
|
||||
<div class="eael-woo-cart-tr woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class',
|
||||
'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
<?php if ( $has_table_left_components ) { ?>
|
||||
<div class="eael-woo-cart-tr-left">
|
||||
<div class="eael-woo-cart-td product-thumbnail">
|
||||
<?php
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
|
||||
if ( ! $product_permalink ) {
|
||||
echo $thumbnail; // PHPCS: XSS ok.
|
||||
} else {
|
||||
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); // PHPCS: XSS ok.
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_remove'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-product-remove">
|
||||
<?php
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'woocommerce_cart_item_remove_link',
|
||||
sprintf(
|
||||
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">%s</a>',
|
||||
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
|
||||
esc_html__( 'Remove this item', 'essential-addons-for-elementor-lite' ),
|
||||
esc_attr( $product_id ),
|
||||
esc_attr( $_product->get_sku() ),
|
||||
Helper::get_render_icon( $settings['eael_woo_cart_table_components_remove_icon'], [ 'aria-hidden' => 'true' ] )
|
||||
),
|
||||
$cart_item_key
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
<?php if ( $settings['eael_woo_cart_table_components_name'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-name">
|
||||
<?php
|
||||
if ( ! $product_permalink ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ' );
|
||||
} else {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ),
|
||||
$_product->get_name() ), $cart_item, $cart_item_key ) );
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
|
||||
|
||||
// Product SKU
|
||||
if ( $settings['eael_woo_cart_table_components_sku'] === 'yes' && ! empty( $_product->get_sku() ) ) {
|
||||
printf( '<p class="eael-woo-cart-sku">#%s</p>', $_product->get_sku() );
|
||||
}
|
||||
|
||||
// Meta data.
|
||||
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
|
||||
|
||||
// Backorder notification.
|
||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification',
|
||||
'<p class="backorder_notification">'
|
||||
. esc_html__( 'Available on backorder', 'essential-addons-for-elementor-lite' )
|
||||
. '</p>', $product_id ) );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $has_table_right_components ) { ?>
|
||||
<div class="eael-woo-cart-tr-right">
|
||||
<?php if ( $settings['eael_woo_cart_table_components_price'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-price">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_price',
|
||||
WC()->cart->get_product_price( $_product ), $cart_item,
|
||||
$cart_item_key ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_qty'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-quantity">
|
||||
<?php
|
||||
if ( $_product->is_sold_individually() ) {
|
||||
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
||||
} else {
|
||||
$product_quantity = woocommerce_quantity_input(
|
||||
[
|
||||
'input_name' => "cart[{$cart_item_key}][qty]",
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $_product->get_max_purchase_quantity(),
|
||||
'min_value' => '0',
|
||||
'product_name' => $_product->get_name(),
|
||||
],
|
||||
$_product,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity,
|
||||
$cart_item_key, $cart_item ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_subtotal'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-subtotal" data-title="<?php echo esc_html( $title ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_subtotal',
|
||||
WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ),
|
||||
$cart_item,
|
||||
$cart_item_key ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_table_components_remove'] === 'yes' ) { ?>
|
||||
<div class="eael-woo-cart-td product-remove">
|
||||
<?php
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'woocommerce_cart_item_remove_link',
|
||||
sprintf(
|
||||
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">%s</a>',
|
||||
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
|
||||
esc_html__( 'Remove this item', 'essential-addons-for-elementor-lite' ),
|
||||
esc_attr( $product_id ),
|
||||
esc_attr( $_product->get_sku() ),
|
||||
Helper::get_render_icon( $settings['eael_woo_cart_table_components_remove_icon'], [ 'aria-hidden' => 'true' ] )
|
||||
),
|
||||
$cart_item_key
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_cart_contents' );
|
||||
do_action( 'woocommerce_after_cart_contents' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
do_action( 'woocommerce_after_cart_table' );
|
||||
self::woo_cart_collaterals( $settings );
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function woo_cart_collaterals( $settings ) { ?>
|
||||
<div class="eael-cart-coupon-and-collaterals">
|
||||
<div class="eael-cart-coupon-wrapper">
|
||||
<?php if ( wc_coupons_enabled() && $settings['eael_woo_cart_components_cart_coupon'] === 'yes' ) {
|
||||
$button_text = apply_filters( 'eael_woo_cart_coupon_button_text', $settings['eael_woo_cart_components_cart_coupon_button_text'] );
|
||||
$placeholder = apply_filters( 'eael_woo_cart_coupon_placeholder', $settings['eael_woo_cart_components_cart_coupon_placeholder'] );
|
||||
$coupon_label = apply_filters( 'eael_woo_cart_coupon_label_text', esc_html__( 'Coupon:', 'essential-addons-for-elementor-lite' ) );
|
||||
?>
|
||||
<div class="coupon">
|
||||
<label for="coupon_code" class="sr-only"><?php echo esc_html( $coupon_label ); ?></label>
|
||||
<input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php echo esc_attr( $placeholder ); ?>"/>
|
||||
<button type="submit" class="button" name="apply_coupon"
|
||||
value="<?php echo esc_attr( $button_text ); ?>"><?php echo esc_html( $button_text ); ?></button>
|
||||
<?php do_action( 'woocommerce_cart_coupon' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $settings['eael_woo_cart_components_continue_shopping'] === 'yes' ) {
|
||||
$continue_shopping_text = apply_filters( 'eael_woo_cart_continue_shopping_text', $settings['eael_woo_cart_components_continue_shopping_text'] );
|
||||
printf( '<a class="eael-woo-cart-back-to-shop" href="%s">%s %s</a>',
|
||||
get_permalink( wc_get_page_id( 'shop' ) ),
|
||||
Helper::get_render_icon( $settings['eael_woo_cart_components_continue_shopping_icon'], [ 'aria-hidden' => 'true' ] ),
|
||||
esc_html( $continue_shopping_text )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_before_cart_collaterals' ); ?>
|
||||
|
||||
<div class="cart-collaterals">
|
||||
<div class="eael-cart-update-btn">
|
||||
<?php if ( $settings['eael_woo_cart_components_cart_update_button'] === 'yes' ) {
|
||||
$update_text = apply_filters( 'eael_woo_cart_update_button_text', $settings['eael_woo_cart_components_cart_update_button_text'] );
|
||||
?>
|
||||
<button type="submit" class="button" name="update_cart" value="<?php echo esc_attr( $update_text ); ?>"><?php echo esc_html( $update_text ); ?></button>
|
||||
<?php
|
||||
}
|
||||
else if ( ! $settings['eael_woo_cart_components_cart_update_button'] && $settings['eael_woo_cart_auto_cart_update'] === 'yes' ){
|
||||
echo '<button type="submit" class="button" name="update_cart" style="display:none;"></button>';
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_cart_actions' );
|
||||
wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Cart collaterals hook.
|
||||
*
|
||||
* @hooked woocommerce_cross_sell_display
|
||||
* @hooked woocommerce_cart_totals - 10
|
||||
*/
|
||||
|
||||
do_action( 'eael_woocommerce_before_cart_collaterals', $settings );
|
||||
|
||||
if ( $settings['eael_woo_cart_components_cart_totals'] === 'yes' ) {
|
||||
do_action( 'woocommerce_cart_collaterals', $settings );
|
||||
} else {
|
||||
?>
|
||||
<div class="cart_totals">
|
||||
<div class="wc-proceed-to-checkout">
|
||||
<?php do_action( 'woocommerce_proceed_to_checkout', $settings ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function wc_empty_cart_message( $message ) {
|
||||
$settings = self::ea_get_woo_cart_settings();
|
||||
$empty_text = $settings['eael_woo_cart_components_empty_cart_text'];
|
||||
|
||||
return empty( $empty_text ) ? $message : esc_html( $empty_text );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Essential_Addons_Elementor\Template\Woocommerce\Cart;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
if ( class_exists( '\WC_Shortcode_Cart' ) ) {
|
||||
class Woo_Cart_Shortcode extends \WC_Shortcode_Cart {
|
||||
|
||||
use Woo_Cart_Helper;
|
||||
|
||||
/**
|
||||
* Output the cart shortcode.
|
||||
*
|
||||
* @param array $atts Shortcode attributes.
|
||||
*/
|
||||
public static function output( $atts, $settings = [] ) {
|
||||
if ( ! apply_filters( 'woocommerce_output_cart_shortcode_content', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Constants.
|
||||
wc_maybe_define_constant( 'WOOCOMMERCE_CART', true );
|
||||
|
||||
$atts = shortcode_atts( [], $atts, 'woocommerce_cart' );
|
||||
$nonce_value = wc_get_var( $_REQUEST['woocommerce-shipping-calculator-nonce'],
|
||||
wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// Update Shipping. Nonce check uses new value and old value (woocommerce-cart). @todo remove in 4.0.
|
||||
if ( ! empty( $_POST['calc_shipping'] )
|
||||
&& ( wp_verify_nonce( $nonce_value, 'woocommerce-shipping-calculator' )
|
||||
|| wp_verify_nonce( $nonce_value, 'woocommerce-cart' ) )
|
||||
) { // WPCS: input var ok.
|
||||
self::calculate_shipping();
|
||||
|
||||
// Also calc totals before we check items so subtotals etc are up to date.
|
||||
WC()->cart->calculate_totals();
|
||||
}
|
||||
|
||||
// Check cart items are valid.
|
||||
do_action( 'woocommerce_check_cart_items' );
|
||||
|
||||
// Calc totals.
|
||||
WC()->cart->calculate_totals();
|
||||
$auto_update = $settings['eael_woo_cart_auto_cart_update'] === 'yes' ? 'eael-auto-update' : '';
|
||||
if ( WC()->cart->is_empty() ) { ?>
|
||||
<div class="eael-woo-cart-wrapper eael-woo-cart-empty <?php echo esc_attr( printf( '%s %s', "eael-woo-{$settings['ea_woo_cart_layout']}", $auto_update ) ); ?>">
|
||||
<?php wc_get_template( 'cart/cart-empty.php' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
$style_two_wrapper_class = '';
|
||||
if ( $settings['ea_woo_cart_layout'] === 'style-2' ) {
|
||||
if ( $settings['eael_woo_cart_table_components_thumbnail'] === 'yes' ) {
|
||||
$style_two_wrapper_class .= ' has-table-left-content';
|
||||
}
|
||||
|
||||
if ( in_array( 'yes', [
|
||||
$settings['eael_woo_cart_table_components_price'],
|
||||
$settings['eael_woo_cart_table_components_qty'],
|
||||
$settings['eael_woo_cart_table_components_subtotal'],
|
||||
$settings['eael_woo_cart_table_components_remove']
|
||||
] ) ) {
|
||||
$style_two_wrapper_class .= ' has-table-right-content';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="eael-woo-cart-wrapper <?php echo esc_attr( sprintf( '%s %s %s', "eael-woo-{$settings['ea_woo_cart_layout']}", $auto_update, $style_two_wrapper_class ) ); ?>">
|
||||
<?php
|
||||
do_action( 'woocommerce_before_cart' );
|
||||
|
||||
switch ( $settings['ea_woo_cart_layout'] ) {
|
||||
case 'default':
|
||||
self::woo_cart_style_one( $settings );
|
||||
break;
|
||||
case 'style-2':
|
||||
self::woo_cart_style_two( $settings );
|
||||
break;
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_after_cart' );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user