PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.5
Easy Elements for Elementor – Addons & Website Templates v1.3.5
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 / CustomCss / EasyelCustomCss.php

EasyelCustomCss.php in Easy Elements for Elementor – Addons & Website Templates 1.3.5, at includes/Extensions/CustomCss/EasyelCustomCss.php

115 lines 3.9 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\CustomCss;
3 use Elementor\Controls_Manager;
4 use Elementor\Controls_Stack;
5 use Elementor\Element_Base;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit;
9 }
10
11 class EasyelCustomCss {
12
13
14 private static $instance = null;
15
16 private $prefix = 'easy_';
17
18 public static function get_instance() {
19 if ( self::$instance === null ) {
20 self::$instance = new self();
21 }
22 return self::$instance;
23 }
24
25 public static function init() {
26
27 $tab_slug = 'extensions';
28 $extensions_settings = get_option('easy_element_' . $tab_slug, [] );
29
30 $enable_easy_custom_css = isset( $extensions_settings['enable_easy_custom_css'] ) ? $extensions_settings['enable_easy_custom_css'] : 0;
31
32 add_action( 'elementor/element/after_section_end', [ __CLASS__, 'register_controls' ], 10, 2 );
33 add_action( 'elementor/editor/after_enqueue_styles', [ __CLASS__,"easy_custom_css" ] );
34 }
35
36 public static function easy_custom_css() {
37 wp_enqueue_style(
38 'easy-elements-pro-badge',
39 EASYELEMENTS_DIR_URL . 'includes/Extensions/CustomCss/css/badge.css',
40 [],
41 EASYELEMENTS_VER
42 );
43 }
44
45 public static function register_controls( Controls_Stack $element, $section_id ) {
46 if ( 'section_custom_css_pro' !== $section_id ) {
47 return;
48 }
49
50 if ( ! class_exists( 'Easy_Elements_Pro' ) ) {
51 self::easy_add_free_promo_section( $element );
52 } else {
53 if ( did_action( 'plugins_loaded' ) && function_exists( 'easy_element_is_enabled' ) && easy_element_is_enabled( 'enable_easy_custom_css' ) ) {
54
55 $pro_version = easyel_get_pro_clean_version();
56
57 if (
58 $pro_version &&
59 version_compare( $pro_version, '1.0.8', '>=' )
60 ) {
61
62 if( class_exists( '\EasyElements_Elementor\Pro\Extension\CustomCss\CustomCssPro' ) ) {
63 \EasyElements_Elementor\Pro\Extension\CustomCss\CustomCssPro::get_instance()->easy_add_custom_css_section( $element );
64 }
65
66 } else {
67 \Easy_Elements_Custom_CSS_Module_Pro::easy_add_custom_css_section( $element );
68 }
69
70 }
71
72 }
73 }
74
75 public static function easy_add_free_promo_section( Controls_Stack $element ) {
76 $element->start_controls_section(
77 'section_easy_custom_css_free',
78 [
79 'label' => EASY_EXTENSION_BADGE . __( 'Custom CSS', 'easy-elements' ),
80 'tab' => Controls_Manager::TAB_ADVANCED,
81 ]
82 );
83
84 $promo_html = sprintf(
85 '<div class="easy-elements-pro-badge">
86 <div class="easy-elements-pro-icon">
87 <!-- SVG Lock Icon -->
88 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
89 <rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
90 <path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
91 </svg>
92 </div>
93 <p class="easy-elements-pro-text">
94 Unlock <strong>Custom CSS</strong> and style your content instantly
95 </p>
96 <a href="%s" target="_blank" class="easy-elements-pro-btn">%s</a>
97 </div>',
98 esc_url( 'https://wpeasyelements.com' ),
99 esc_html__( 'Upgrade Easy Elements', 'easy-elements' )
100 );
101
102 $element->add_control(
103 'easy_custom_css_promo',
104 [
105 'type' => Controls_Manager::RAW_HTML,
106 'raw' => $promo_html,
107 ]
108 );
109
110 $element->end_controls_section();
111 }
112
113 }
114
115