PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.2.7
Easy Elements for Elementor – Addons & Website Templates v1.2.7
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / includes / Extensions / LiveCopy / CopyPaste.php

CopyPaste.php in Easy Elements for Elementor – Addons & Website Templates 1.2.7, at includes/Extensions/LiveCopy/CopyPaste.php

97 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Extensions\LiveCopy;
3 use Easyel\EasyElements\Extensions\ExtensionHook\HookControl;
4 if ( ! defined( 'ABSPATH' ) ) exit;
5 class CopyPaste {
6
7 /**
8 * Singleton instance
9 * @var CopyPaste|null
10 */
11 protected static $instance = null;
12
13 /**
14 * Constructor
15 */
16 private function __construct() {
17
18 add_action( 'init', [ $this, 'easy_init' ] );
19 }
20
21 /**
22 * Get instance
23 */
24 public static function get_instance() {
25 if ( null === self::$instance ) {
26 self::$instance = new self();
27 }
28 return self::$instance;
29 }
30
31 /**
32 * Initialize actions
33 */
34 public function easy_init() {
35
36 add_action('elementor/element/common/_section_style/after_section_end', [ $this, 'easy_live_copy_register_section'] );
37 add_action('elementor/element/section/section_advanced/after_section_end', [ $this, 'easy_live_copy_register_section'] );
38
39 add_action('elementor/element/common/easy_live_copy_section/before_section_end', [ $this, 'easy_live_copy_register_controls'], 10, 2 );
40 add_action('elementor/element/section/easy_live_copy_section/before_section_end', [ $this, 'easy_live_copy_register_controls'], 10, 2 );
41
42 add_action('elementor/element/container/section_layout/after_section_end', [ $this, 'easy_live_copy_register_section'] );
43
44 add_action('elementor/element/container/easy_live_copy_section/before_section_end', [ $this, 'easy_live_copy_register_controls'], 10, 2 );
45
46 }
47
48 public function easy_live_copy_register_section( $element ) {
49
50 $enable_live_copy = get_option( 'easy_live_copy_btn_enable', true );
51
52 if( ( int ) $enable_live_copy !== 1 && class_exists( 'Easy_Elements_Pro' ) ) {
53 return;
54 }
55
56 if ( function_exists( 'easy_element_is_enabled' ) && easy_element_is_enabled( 'enable_live_copy_paste' ) || ! class_exists( 'Easy_Elements_Pro' ) ) {
57
58 $element->start_controls_section(
59 'easy_live_copy_section',
60 [
61 'label' => EASY_EXTENSION_BADGE . __( 'Live Copy Paste', 'easy-elements' ),
62 'tab' => \Elementor\Controls_Manager::TAB_ADVANCED,
63 ]
64 );
65
66 $element->end_controls_section();
67 }
68 }
69
70 /**
71 * Register visibility controls in Elementor panel
72 */
73 public function easy_live_copy_register_controls( $element, $args ) {
74 if( ! class_exists( 'Easy_Elements_Pro' ) ) {
75
76 HookControl::register_controls( $element, "live_copy_promo_key" );
77 } else {
78
79 $pro_version = easyel_get_pro_clean_version();
80
81 if (
82 $pro_version &&
83 version_compare( $pro_version, '1.0.8', '>=' )
84 ) {
85 if ( did_action( 'plugins_loaded' ) && function_exists( 'easy_element_is_enabled' ) && easy_element_is_enabled( 'enable_live_copy_paste' ) && class_exists( '\EasyElements_Elementor\Pro\Extension\CopyPaste\LiveCopyPro' ) ) {
86 $instance = \EasyElements_Elementor\Pro\Extension\CopyPaste\LiveCopyPro::get_instance();
87 $instance->easy_live_copy_register_controls_pro( $element, $args );
88 }
89 } else {
90 if ( did_action( 'plugins_loaded' ) && function_exists( 'easy_element_is_enabled' ) && easy_element_is_enabled( 'enable_live_copy_paste' ) && class_exists( 'Easy_Live_Copy_Paste_Pro' ) ) {
91 \Easy_Live_Copy_Paste_Pro::easy_live_copy_register_controls_pro( $element, $args );
92 }
93 }
94
95 }
96 }
97 }