| @@ -1,715 +1,453 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; | |
| 4 | -} | |
| 5 | - | |
| 6 | -final class Easyel_Elements_Elementor_Extension { | |
| 7 | - | |
| 8 | - const VERSION = EASYELEMENTS_VER; | |
| 9 | - | |
| 10 | - private static $_instance = null; | |
| 11 | - | |
| 12 | - public static function instance() { | |
| 13 | - if ( is_null( self::$_instance ) ) { | |
| 14 | - self::$_instance = new self(); | |
| 15 | - } | |
| 16 | - return self::$_instance; | |
| 17 | - } | |
| 18 | - | |
| 19 | - public function __construct() { | |
| 20 | - | |
| 21 | - // Load AJAX handlers | |
| 22 | - require_once EASYELEMENTS_DIR_PATH . 'widgets/login-register/class.login-register.php'; | |
| 23 | - | |
| 24 | - add_action( 'init', [ $this, 'init' ] ); | |
| 25 | - add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] ); | |
| 26 | - add_action( 'elementor/elements/categories_registered', [ $this, 'add_elementor_categories' ] ); | |
| 27 | - | |
| 28 | - add_action( 'admin_notices', [ $this, 'easyel_admin_promo_notice' ] , 0 ); | |
| 29 | - add_action( 'admin_init', [ $this, 'easyel_admin_promo_notice_dismiss_handler' ] ); | |
| 30 | - | |
| 31 | - add_filter( 'plugin_row_meta', [ $this, 'easyel_plugin_row_meta' ], 10, 2 ); | |
| 32 | - | |
| 33 | - add_filter('plugin_action_links_'.EASYELEMENTS_PATH,[ $this,'easyel_setting_page_link' ] ); | |
| 34 | - | |
| 35 | - add_action( 'plugins_loaded', [ $this, "easyel_plugin_loaded" ] ); | |
| 36 | - | |
| 37 | - register_activation_hook( EASYELEMENTS_PATH, [ __CLASS__, 'easy_elements_activate' ] ); | |
| 38 | - | |
| 39 | - add_action( 'admin_init', [ __CLASS__, 'easyel_maybe_upgrade' ] ); | |
| 40 | - | |
| 41 | - add_action('elementor/controls/register', function( $controls_manager ) { | |
| 42 | - $controls_manager->register( | |
| 43 | - new \Easyel\EasyElements\Utils\SearchSelect2() | |
| 44 | - ); | |
| 45 | - }); | |
| 46 | - | |
| 47 | - \Easyel\EasyElements\Extensions\WrapperLink\EasyelWrapperLink::get_instance(); | |
| 48 | - | |
| 49 | - } | |
| 50 | - | |
| 51 | - public static function easyel_maybe_upgrade() { | |
| 52 | - | |
| 53 | - $stored_version = get_option( 'easyel_plugin_version', '0' ); | |
| 54 | - | |
| 55 | - if ( version_compare( $stored_version, '1.3.1', '<' ) ) { | |
| 56 | - | |
| 57 | - self::easyel_upgrade_130(); | |
| 58 | - | |
| 59 | - update_option( 'easyel_plugin_version', '1.3.1' ); | |
| 60 | - } | |
| 61 | - } | |
| 62 | - | |
| 63 | - private static function easyel_upgrade_130() { | |
| 64 | - | |
| 65 | - $option_key_extension = 'easy_element_extensions'; | |
| 66 | - $settings = get_option( $option_key_extension, [] ); | |
| 67 | - | |
| 68 | - $new_defaults = [ | |
| 69 | - 'enable_wrapper_link' => 1, | |
| 70 | - 'enable_post_duplicator' => 1, | |
| 71 | - 'enable_dynamic_content' => 1, | |
| 72 | - 'enable_megamenu_builder' => 1, | |
| 73 | - ]; | |
| 74 | - | |
| 75 | - foreach ( $new_defaults as $key => $default ) { | |
| 76 | - if ( ! isset( $settings[ $key ] ) ) { | |
| 77 | - $settings[ $key ] = $default; | |
| 78 | - } | |
| 79 | - } | |
| 80 | - | |
| 81 | - update_option( $option_key_extension, $settings ); | |
| 82 | - } | |
| 83 | - | |
| 84 | - public static function easy_elements_activate() { | |
| 85 | - | |
| 86 | - if ( class_exists( '\Easyel\EasyElements\Admin\Admin_Settings' ) ) { | |
| 87 | - | |
| 88 | - $option_key_extension = 'easy_element_extensions'; | |
| 89 | - $settings = get_option( $option_key_extension, [] ); | |
| 90 | - | |
| 91 | - $include_extension = array( | |
| 92 | - "enable_wrapper_link", | |
| 93 | - "enable_post_duplicator", | |
| 94 | - "enable_dynamic_content", | |
| 95 | - "enable_megamenu_builder", | |
| 96 | - ); | |
| 97 | - | |
| 98 | - $fields2 = []; | |
| 99 | - | |
| 100 | - if ( function_exists('easyel_get_extension_fields') ) { | |
| 101 | - $fields2 = easyel_get_extension_fields(); | |
| 102 | - } | |
| 103 | - | |
| 104 | - foreach ( $fields2 as $key => $data ) { | |
| 105 | - | |
| 106 | - if ( array_key_exists( $key, $settings ) ) { | |
| 107 | - continue; | |
| 108 | - } | |
| 109 | - | |
| 110 | - $settings[$key] = in_array( $key, $include_extension, true ) ? 1 : 0; | |
| 111 | - } | |
| 112 | - | |
| 113 | - update_option( $option_key_extension, $settings ); | |
| 114 | - | |
| 115 | - $include_widget = array( | |
| 116 | - "easy_table", | |
| 117 | - "bmi_calculator", | |
| 118 | - "single_navigation_menu", | |
| 119 | - ); | |
| 120 | - | |
| 121 | - $available_elements = \Easyel\EasyElements\Admin\Admin_Settings::get_instance()->easyel_elements_get_available_widgets(); | |
| 122 | - $tab = 'widget'; | |
| 123 | - | |
| 124 | - foreach ( $available_elements as $key => $widget ) { | |
| 125 | - | |
| 126 | - if ( isset( $widget['tab'] ) && $widget['tab'] === $tab ) { | |
| 127 | - | |
| 128 | - $option_name = 'easy_element_' . $tab . '_' . $key; | |
| 129 | - | |
| 130 | - $existing_value = get_option( $option_name, null ); | |
| 131 | - | |
| 132 | - if ( $existing_value !== null ) { | |
| 133 | - continue; | |
| 134 | - } | |
| 135 | - | |
| 136 | - if ( in_array( $key, $include_widget, true ) ) { | |
| 137 | - add_option( $option_name, '0' ); | |
| 138 | - } | |
| 139 | - } | |
| 140 | - } | |
| 141 | - } | |
| 142 | - | |
| 143 | - flush_rewrite_rules(); | |
| 144 | - } | |
| 145 | - | |
| 146 | - public function easyel_admin_promo_notice() { | |
| 147 | - | |
| 148 | - // Already dismissed | |
| 149 | - if ( get_option( 'easyel_admin_promo_notice_dismissed2' ) ) { | |
| 150 | - return; | |
| 151 | - } | |
| 152 | - | |
| 153 | - $dismiss_url = wp_nonce_url( | |
| 154 | - add_query_arg( | |
| 155 | - [ 'easyel_promo_notice_dismiss' => '1' ], | |
| 156 | - admin_url() | |
| 157 | - ), | |
| 158 | - 'easyel_promo_notice_dismiss_nonce' | |
| 159 | - ); | |
| 160 | - ?> | |
| 161 | - | |
| 162 | - <div class="notice notice-info easyel-promo-notice"> | |
| 163 | - <div class="easyel-promo-content"> | |
| 164 | - <div class="easyel-promo-left"> | |
| 165 | - <span class="orange">Exclusive Deals Available</span> • <span></span> Discount Up To | |
| 166 | - <span style="color:#ff7dcb;">60%</span> OFF | |
| 167 | - <a class="easyel-promo-btn" href="https://wpeasyelements.com/pricing/" target="_blank"> | |
| 168 | - Grab the Deal → | |
| 169 | - </a> | |
| 170 | - | |
| 171 | - </div> | |
| 172 | - <div class="easyel-promo-right"> | |
| 173 | - <a href="<?php echo esc_url( $dismiss_url ); ?>" style="text-decoration:none;"> | |
| 174 | - ✕ Dismiss | |
| 175 | - </a> | |
| 176 | - </div> | |
| 177 | - </div> | |
| 178 | - </div> | |
| 179 | - | |
| 180 | - <?php | |
| 181 | - } | |
| 182 | - | |
| 183 | - function easyel_plugin_row_meta( $meta, $plugin_file ) { | |
| 184 | - if ( basename( EASYELEMENTS_PATH) !== basename( $plugin_file ) ) { | |
| 185 | - return $meta; | |
| 186 | - } | |
| 187 | - | |
| 188 | - $meta[] = '<a href="https://wpeasyelements.com/docs/" target="_blank">' . esc_html__('Documentation', 'easy-elements' ) . '</a>'; | |
| 189 | - $meta[] = '<a href="https://themewant.com/support/" target="_blank">' . esc_html__('Support', 'easy-elements') . '</a>'; | |
| 190 | - if ( !file_exists( WP_PLUGIN_DIR . '/' . 'easy-elements-pro/easy-elements-pro.php' ) ) { | |
| 191 | - $meta[] = '<a href="https://wpeasyelements.com/" style="color:#ff7a00; font-weight: bold;" target="_blank">' . esc_html__('Upgrade to Pro', 'easy-elements') . '</a>'; | |
| 192 | - } | |
| 193 | - $meta[] = '<a href="https://wordpress.org/support/plugin/easy-elements/reviews/#new-post" target="_blank">' . esc_html__(' Rate the plugin ★★★★★', 'easy-elements' ) . '</a>'; | |
| 194 | - return $meta; | |
| 195 | - } | |
| 196 | - | |
| 197 | - public function easyel_admin_promo_notice_dismiss_handler() { | |
| 198 | - | |
| 199 | - if ( ! is_admin() ) { | |
| 200 | - return; | |
| 201 | - } | |
| 202 | - | |
| 203 | - if ( empty( $_GET['easyel_promo_notice_dismiss'] ) ) { | |
| 204 | - return; | |
| 205 | - } | |
| 206 | - | |
| 207 | - $nonce = isset( $_GET['_wpnonce'] ) | |
| 208 | - ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) | |
| 209 | - : ''; | |
| 210 | - | |
| 211 | - if ( ! wp_verify_nonce( $nonce, 'easyel_promo_notice_dismiss_nonce' ) ) { | |
| 212 | - return; | |
| 213 | - } | |
| 214 | - | |
| 215 | - update_option( 'easyel_admin_promo_notice_dismissed2', 1 ); | |
| 216 | - | |
| 217 | - wp_safe_redirect( | |
| 218 | - remove_query_arg( [ 'easyel_promo_notice_dismiss', '_wpnonce' ] ) | |
| 219 | - ); | |
| 220 | - exit; | |
| 221 | - } | |
| 222 | - | |
| 223 | - public function init() { | |
| 224 | - // Safety checks | |
| 225 | - | |
| 226 | - add_filter( 'body_class', [ $this, "easy_add_extra_body_class" ] ); | |
| 227 | - add_action( 'easy_header', [ $this, 'easyel_before_content_container_hfe'], 20 ); | |
| 228 | - add_action( 'easy_footer', [ $this, 'easyel_after_content_container_hfe' ], 5 ); | |
| 229 | - | |
| 230 | - add_action( 'admin_notices', [ $this, 'easyelements_admin_notice_missing_elementor' ] ); | |
| 231 | - } | |
| 232 | - | |
| 233 | - public function easyel_plugin_loaded () { | |
| 234 | - | |
| 235 | - \Easyel\EasyElements\Utils\Enqueue::get_instance(); | |
| 236 | - \Easyel\EasyElements\Utils\QueryHelper::get_instance(); | |
| 237 | - | |
| 238 | - if( is_admin() ) { | |
| 239 | - \Easyel\EasyElements\Admin\Admin_Settings::get_instance(); | |
| 240 | - \Easyel\EasyElements\NoticeDashboard\NoticeDashboard::get_instance(); | |
| 241 | - | |
| 242 | - } | |
| 243 | - | |
| 244 | - if ( did_action( 'elementor/loaded' ) ) { | |
| 245 | - \Easyel\EasyElements\Template_Library\Easyel_Templates_Library::get_instance(); | |
| 246 | - \Easyel\EasyElements\Header_Footer_Builder\Classes\Easy_Header_Footer_Elementor::get_instance(); | |
| 247 | - } | |
| 248 | - | |
| 249 | - \Easyel\EasyElements\Starter_Template\Easyel_Starter_Template::get_instance(); | |
| 250 | - | |
| 251 | - \Easyel\EasyElements\Theme_Builder\Easyel_Theme_Builder_CPT::get_instance(); | |
| 252 | - | |
| 253 | - \Easyel\EasyElements\Theme_Builder\Easyel_Theme_Builder_Front::get_instance(); | |
| 254 | - | |
| 255 | - \Easyel\EasyElements\PostType\OffcanvasPostType::get_instance(); | |
| 256 | - \Easyel\EasyElements\CustomCode\Easyel_Custom_Code::get_instance(); | |
| 257 | - \Easyel\EasyElements\Popup_Builder\Easyel_Popup_Builder::get_instance(); | |
| 258 | - \Easyel\EasyElements\Extensions\ExtensionHook\ExtensionModule::get_instance(); | |
| 259 | - \Easyel\EasyElements\Extensions\CustomCss\EasyelCustomCss::get_instance()->init(); | |
| 260 | - \Easyel\EasyElements\Extensions\Duplicator\EasyelDuplicator::get_instance(); | |
| 261 | - \Easyel\EasyElements\Extensions\SettingExport\EasyelExport::get_instance(); | |
| 262 | - \Easyel\EasyElements\Extensions\LiveCopy\CopyPaste::get_instance(); | |
| 263 | - \Easyel\EasyElements\Extensions\VisibilityControl\VisibilityModule::get_instance(); | |
| 264 | - \Easyel\EasyElements\Extensions\Jarallax\JaralaxControl::get_instance()->init(); | |
| 265 | - \Easyel\EasyElements\Extensions\Jarallax\GlobalJarallax::get_instance(); | |
| 266 | - \Easyel\EasyElements\Extensions\ProgressBar\ReadingProgressBar::get_instance(); | |
| 267 | - \Easyel\EasyElements\Extensions\ScrollTop\ScrollTop::get_instance(); | |
| 268 | - | |
| 269 | - if ( function_exists( 'easy_element_is_enabled' ) && easy_element_is_enabled( 'enable_preloader' ) ) { | |
| 270 | - require_once EASYELEMENTS_DIR_PATH . 'includes/Extensions/Preloader/preloader.php'; | |
| 271 | - \Easyel\EasyElements\Extensions\Preloader\EasyelPreloader::get_instance(); | |
| 272 | - } | |
| 273 | - | |
| 274 | - | |
| 275 | - if ( ! class_exists( '\Easyel\Vendor\Appsero\Client' ) ) { | |
| 276 | - return; | |
| 277 | - } | |
| 278 | - | |
| 279 | - \Easyel\EasyElements\Tracking\Appsero_Tracker::instance(); | |
| 280 | - } | |
| 281 | - | |
| 282 | - public function easyelements_admin_notice_missing_elementor() { | |
| 283 | - | |
| 284 | - $elementor = 'elementor/elementor.php'; | |
| 285 | - | |
| 286 | - if ( current_user_can( 'activate_plugins' ) && isset( $_GET['activate'], $_GET['_wpnonce'] ) ) { | |
| 287 | - | |
| 288 | - $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : ''; | |
| 289 | - | |
| 290 | - if ( wp_verify_nonce( $nonce, 'activate-plugin_' . $elementor ) ) { | |
| 291 | - unset( $_GET['activate'] ); | |
| 292 | - } | |
| 293 | - } | |
| 294 | - | |
| 295 | - if ( ! current_user_can( 'install_plugins' ) ) { | |
| 296 | - return; | |
| 297 | - } | |
| 298 | - | |
| 299 | - $elementor = 'elementor/elementor.php'; | |
| 300 | - $elementor_path = WP_PLUGIN_DIR . '/' . $elementor; | |
| 301 | - | |
| 302 | - $is_installed = file_exists( $elementor_path ); | |
| 303 | - $is_active = function_exists( 'is_plugin_active' ) && is_plugin_active( $elementor ); | |
| 304 | - | |
| 305 | - if ( $is_active ) { | |
| 306 | - return; | |
| 307 | - } | |
| 308 | - | |
| 309 | - if ( $is_installed ) { | |
| 310 | - $action_url = wp_nonce_url( | |
| 311 | - self_admin_url( 'plugins.php?action=activate&plugin=' . $elementor ), | |
| 312 | - 'activate-plugin_' . $elementor | |
| 313 | - ); | |
| 314 | - $button_label = esc_html__( 'Activate Elementor', 'easy-elements' ); | |
| 315 | - } else { | |
| 316 | - $action_url = wp_nonce_url( | |
| 317 | - self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), | |
| 318 | - 'install-plugin_elementor' | |
| 319 | - ); | |
| 320 | - $button_label = esc_html__( 'Install Elementor', 'easy-elements' ); | |
| 321 | - } | |
| 322 | - | |
| 323 | - wp_enqueue_style( | |
| 324 | - 'easyel-missing-elementor-notice', | |
| 325 | - EASYELEMENTS_DIR_URL . 'assets/css/admin/missing-elementor-notice.css', | |
| 326 | - [], | |
| 327 | - self::VERSION | |
| 328 | - ); | |
| 329 | - ?> | |
| 330 | - <div class="easyel-missing-elementor-notice" role="alert"> | |
| 331 | - <span class="easyel-missing-elementor-notice__icon" aria-hidden="true">!</span> | |
| 332 | - <div class="easyel-missing-elementor-notice__text"> | |
| 333 | - <?php | |
| 334 | - printf( | |
| 335 | - /* translators: 1: Plugin name (Easy Elements), 2: Required plugin name (Elementor) */ | |
| 336 | - esc_html__( '%1$s requires %2$s plugin to be installed and activated.', 'easy-elements' ), | |
| 337 | - '<strong>' . esc_html__( 'Easy Elements', 'easy-elements' ) . '</strong>', | |
| 338 | - '<strong>' . esc_html__( 'Elementor', 'easy-elements' ) . '</strong>' | |
| 339 | - ); | |
| 340 | - ?> | |
| 341 | - </div> | |
| 342 | - <a href="<?php echo esc_url( $action_url ); ?>" class="easyel-missing-elementor-notice__button"> | |
| 343 | - <span class="dashicons dashicons-admin-network" aria-hidden="true"></span> | |
| 344 | - <?php echo esc_html( $button_label ); ?> | |
| 345 | - </a> | |
| 346 | - </div> | |
| 347 | - <?php | |
| 348 | - } | |
| 349 | - | |
| 350 | - // Container Full site | |
| 351 | - public function easyel_before_content_container_hfe() { | |
| 352 | - if ( is_admin() ) return; | |
| 353 | - if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) { | |
| 354 | - return; | |
| 355 | - } | |
| 356 | - echo '<div class="easyel-content-container">'; | |
| 357 | - } | |
| 358 | - | |
| 359 | - /** | |
| 360 | - * Close container before HFE Footer | |
| 361 | - */ | |
| 362 | - function easyel_after_content_container_hfe() { | |
| 363 | - if ( is_admin() ) return; | |
| 364 | - if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) { | |
| 365 | - return; | |
| 366 | - } | |
| 367 | - echo '</div>'; | |
| 368 | - } | |
| 369 | - | |
| 370 | - public function easy_add_extra_body_class( $classes ) { | |
| 371 | - if ( is_plugin_active( 'easy-elements/easy-elements.php' ) ) { | |
| 372 | - $classes[] = 'eel-easy-elements'; | |
| 373 | - } | |
| 374 | - | |
| 375 | - return $classes; | |
| 376 | - } | |
| 377 | - | |
| 378 | - public function add_elementor_categories( $elements_manager ) { | |
| 379 | - | |
| 380 | - $new_categories = [ | |
| 381 | - 'easyelements_category' => [ | |
| 382 | - 'title' => __( 'Easy Elements', 'easy-elements' ), | |
| 383 | - 'icon' => 'fa fa-plug', | |
| 384 | - ], | |
| 385 | - 'easyelements_post_category' => [ | |
| 386 | - 'title' => __( 'Easy Post Type Elements', 'easy-elements' ), | |
| 387 | - 'icon' => 'fa fa-file-alt', | |
| 388 | - ], | |
| 389 | - 'easyelements_header_footer_category' => [ | |
| 390 | - 'title' => __( 'Easy Header Footer Elements', 'easy-elements' ), | |
| 391 | - 'icon' => 'fa fa-header', | |
| 392 | - ], | |
| 393 | - 'easyelements_category_form' => [ | |
| 394 | - 'title' => __( 'Easy Elements Form', 'easy-elements' ), | |
| 395 | - 'icon' => 'fa fa-plug', | |
| 396 | - ], | |
| 397 | - 'easyelements_category_pro' => [ | |
| 398 | - 'title' => __( 'Easy Elements Pro', 'easy-elements' ), | |
| 399 | - 'icon' => 'fa fa-plug', | |
| 400 | - ], | |
| 401 | - ]; | |
| 402 | - | |
| 403 | - $existing = $elements_manager->get_categories(); | |
| 404 | - $final_list = []; | |
| 405 | - | |
| 406 | - foreach ( $existing as $key => $cat ) { | |
| 407 | - $final_list[ $key ] = $cat; | |
| 408 | - | |
| 409 | - if ( $key === 'layout' ) { | |
| 410 | - foreach ( $new_categories as $new_key => $new_cat ) { | |
| 411 | - $final_list[ $new_key ] = $new_cat; | |
| 412 | - } | |
| 413 | - } | |
| 414 | - } | |
| 415 | - | |
| 416 | - $apply_categories = function( $cats ) { | |
| 417 | - $this->categories = $cats; | |
| 418 | - }; | |
| 419 | - | |
| 420 | - $apply_categories->call( $elements_manager, $final_list ); | |
| 421 | - } | |
| 422 | - | |
| 423 | - public function init_widgets() { | |
| 424 | - $widgets_manager = \Elementor\Plugin::instance()->widgets_manager; | |
| 425 | - | |
| 426 | - $widgets = [ | |
| 427 | - 'site_logo' => [ | |
| 428 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Site_Logo_Widget', | |
| 429 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/site-logo/site-logo.php', | |
| 430 | - 'tab' => 'widget' | |
| 431 | - ], | |
| 432 | - 'heading' => [ | |
| 433 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Heading_Widget', | |
| 434 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/heading/heading.php', | |
| 435 | - 'tab' => 'widget' | |
| 436 | - ], | |
| 437 | - 'clients_logo' => [ | |
| 438 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Clients_Logo__Widget', | |
| 439 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/clients-logo-grid/logo.php', | |
| 440 | - 'tab' => 'widget' | |
| 441 | - ], | |
| 442 | - 'icon_box' => [ | |
| 443 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Icon_Box__Widget', | |
| 444 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/icon-box/icon.php', | |
| 445 | - 'tab' => 'widget' | |
| 446 | - ], | |
| 447 | - 'simple_tab' => [ | |
| 448 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Tab_Widget', | |
| 449 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/tab/tab.php', | |
| 450 | - 'tab' => 'widget' | |
| 451 | - ], | |
| 452 | - 'testimonials' => [ | |
| 453 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Testimonials__Widget', | |
| 454 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/testimonials-grid/testimonials.php', | |
| 455 | - 'tab' => 'widget' | |
| 456 | - ], | |
| 457 | - 'team_grid' => [ | |
| 458 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Team_Grid__Widget', | |
| 459 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/team-grid/team-grid.php', | |
| 460 | - 'tab' => 'widget' | |
| 461 | - ], | |
| 462 | - 'search' => [ | |
| 463 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Search_Widget', | |
| 464 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/search/search.php', | |
| 465 | - 'tab' => 'widget' | |
| 466 | - ], | |
| 467 | - 'contact_box' => [ | |
| 468 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Contact_Box__Widget', | |
| 469 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/contact-box/contact.php', | |
| 470 | - 'tab' => 'widget' | |
| 471 | - ], | |
| 472 | - 'faq' => [ | |
| 473 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_FAQ_Accordion_Widget', | |
| 474 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/faq/faq.php', | |
| 475 | - 'tab' => 'widget' | |
| 476 | - ], | |
| 477 | - 'blog_grid' => [ | |
| 478 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Blog_Grid__Widget', | |
| 479 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/blog-grid/blog-grid.php', | |
| 480 | - 'tab' => 'widget' | |
| 481 | - ], | |
| 482 | - 'video' => [ | |
| 483 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Video_Popup_Widget', | |
| 484 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/video/video.php', | |
| 485 | - 'tab' => 'widget' | |
| 486 | - ], | |
| 487 | - 'pricing_table' => [ | |
| 488 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Pricing_Table_Widget', | |
| 489 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/pricing-table/pricing.php', | |
| 490 | - 'tab' => 'widget' | |
| 491 | - ], | |
| 492 | - 'service_list' => [ | |
| 493 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Service_List_Widget', | |
| 494 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/service-list/service-list.php', | |
| 495 | - 'tab' => 'widget' | |
| 496 | - ], | |
| 497 | - 'navigation_menu' => [ | |
| 498 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Navigation_Menu_Widget', | |
| 499 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/navigation-menu/navigation-menu.php', | |
| 500 | - 'tab' => 'widget' | |
| 501 | - ], | |
| 502 | - 'page_title' => [ | |
| 503 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Page_Title_Widget', | |
| 504 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/page-title/page-title.php', | |
| 505 | - 'tab' => 'widget' | |
| 506 | - ], | |
| 507 | - 'button' => [ | |
| 508 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Button_Widget', | |
| 509 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/button/button.php', | |
| 510 | - 'tab' => 'widget' | |
| 511 | - ], | |
| 512 | - 'copyright' => [ | |
| 513 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Copyright_Widget', | |
| 514 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/copyright/copyright.php', | |
| 515 | - 'tab' => 'widget' | |
| 516 | - ], | |
| 517 | - 'process_grid' => [ | |
| 518 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Process_Grid_Widget', | |
| 519 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/process-grid/process-grid.php', | |
| 520 | - 'tab' => 'widget' | |
| 521 | - ], | |
| 522 | - 'process_list' => [ | |
| 523 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Process_lists_Widget', | |
| 524 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/process-list/process-list.php', | |
| 525 | - 'tab' => 'widget' | |
| 526 | - ], | |
| 527 | - 'social_share' => [ | |
| 528 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Social_Share_Widget', | |
| 529 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/social-share/social-share.php', | |
| 530 | - 'tab' => 'widget' | |
| 531 | - ], | |
| 532 | - 'social_icon' => [ | |
| 533 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Social_Icon_Widget', | |
| 534 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/social-icon/social.php', | |
| 535 | - 'tab' => 'widget' | |
| 536 | - ], | |
| 537 | - 'breadcrumb' => [ | |
| 538 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Breadcrumb_Widget', | |
| 539 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/breadcrumb/breadcrumb.php', | |
| 540 | - 'tab' => 'widget' | |
| 541 | - ], | |
| 542 | - 'domain_search' => [ | |
| 543 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Domain_Search_Widget', | |
| 544 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/domain-search/domain-search.php', | |
| 545 | - 'tab' => 'widget' | |
| 546 | - ], | |
| 547 | - 'image_comparison' => [ | |
| 548 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Before_After_Widget', | |
| 549 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/image-comparison/img-before-after.php', | |
| 550 | - 'tab' => 'widget' | |
| 551 | - ], | |
| 552 | - 'easy_offcanvas' => [ | |
| 553 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Offcanvas_Widget', | |
| 554 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/offcanvas/offcanvas.php', | |
| 555 | - 'tab' => 'widget' | |
| 556 | - ], | |
| 557 | - 'easy_table' => [ | |
| 558 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Table_Elementor_Widget', | |
| 559 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/table/table-normal.php', | |
| 560 | - 'tab' => 'widget' | |
| 561 | - ], | |
| 562 | - 'easy_scroll_to_top' => [ | |
| 563 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Scroll_To_Top_Widget', | |
| 564 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/scroll-to-top/scroll.php', | |
| 565 | - 'tab' => 'widget' | |
| 566 | - ], | |
| 567 | - 'easy_cf7' => [ | |
| 568 | - 'class' => '\Easyel\EasyElements\Widgets\easyel__CF7_Widget', | |
| 569 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/cf7/contact-cf7.php', | |
| 570 | - 'tab' => 'widget' | |
| 571 | - ], | |
| 572 | - 'easy_gallery' => [ | |
| 573 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel__Gallery_Widget', | |
| 574 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/gallery/gallery.php', | |
| 575 | - 'tab' => 'widget' | |
| 576 | - ], | |
| 577 | - 'easy_progress' => [ | |
| 578 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Progress_Widget', | |
| 579 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/progress/progress.php', | |
| 580 | - 'tab' => 'widget' | |
| 581 | - ], | |
| 582 | - 'counter' => [ | |
| 583 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Counter_Widget', | |
| 584 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/counter/counter.php', | |
| 585 | - 'tab' => 'widget' | |
| 586 | - ], | |
| 587 | - 'countdown' => [ | |
| 588 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Count_Down_Widget', | |
| 589 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/countdown/countdown.php', | |
| 590 | - 'tab' => 'widget' | |
| 591 | - ], | |
| 592 | - 'excerpt' => [ | |
| 593 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Excerpt_Widget', | |
| 594 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/excerpt/excerpt.php', | |
| 595 | - 'tab' => 'widget' | |
| 596 | - ], | |
| 597 | - 'post_title' => [ | |
| 598 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Title_Widget', | |
| 599 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-title/post-title.php', | |
| 600 | - 'tab' => 'widget' | |
| 601 | - ], | |
| 602 | - 'post_content' => [ | |
| 603 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_content_Widget', | |
| 604 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-content/post-content.php', | |
| 605 | - 'tab' => 'widget' | |
| 606 | - ], | |
| 607 | - 'featured_image' => [ | |
| 608 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_free_Featured_Image_Widget', | |
| 609 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/featured-image/featured-image.php', | |
| 610 | - 'tab' => 'widget' | |
| 611 | - ], | |
| 612 | - 'post_meta' => [ | |
| 613 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Meta_Widget', | |
| 614 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-meta/post-meta.php', | |
| 615 | - 'tab' => 'widget' | |
| 616 | - ], | |
| 617 | - 'post_pagination' => [ | |
| 618 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Pagination_Widget', | |
| 619 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-pagination/post-pagination.php', | |
| 620 | - 'tab' => 'widget' | |
| 621 | - ], | |
| 622 | - 'post_comments' => [ | |
| 623 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Comments_Widget', | |
| 624 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-comments/post-comments.php', | |
| 625 | - 'tab' => 'widget' | |
| 626 | - ], | |
| 627 | - 'post_tags' => [ | |
| 628 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Tags_Widget', | |
| 629 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-tag/post-tag.php', | |
| 630 | - 'tab' => 'widget' | |
| 631 | - ], | |
| 632 | - 'post_author' => [ | |
| 633 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Author_Info_Widget', | |
| 634 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-author/post-author.php', | |
| 635 | - 'tab' => 'widget' | |
| 636 | - ], | |
| 637 | - 'archive_post' => [ | |
| 638 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Archive_Post__Widget', | |
| 639 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/archive-post/archive-post.php', | |
| 640 | - 'tab' => 'widget', | |
| 641 | - ], | |
| 642 | - 'login_register' => [ | |
| 643 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Login_Register_Widget', | |
| 644 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/login-register/login-register.php', | |
| 645 | - 'tab' => 'widget', | |
| 646 | - ], | |
| 647 | - 'feature_list' => [ | |
| 648 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Feature_List__Widget', | |
| 649 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/feature-list/feature-list.php', | |
| 650 | - 'tab' => 'widget', | |
| 651 | - ], | |
| 652 | - 'single_navigation_menu' => [ | |
| 653 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Single_Nav_Widget', | |
| 654 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/single-nav/single-nav.php', | |
| 655 | - 'tab' => 'widget', | |
| 656 | - ], | |
| 657 | - 'vertical_navigation_menu' => [ | |
| 658 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_vertical_Menu_Widget', | |
| 659 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/vertical-menu/vertical-menu-widget.php', | |
| 660 | - 'tab' => 'widget', | |
| 661 | - ] | |
| 662 | - ]; | |
| 663 | - | |
| 664 | - // WooCommerce-dependent widgets — only register when WooCommerce is active. | |
| 665 | - if ( class_exists( 'WooCommerce' ) ) { | |
| 666 | - $widgets['product_grid_lite'] = [ | |
| 667 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Product_Grid_Lite_Widget', | |
| 668 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/product-grid-lite/product-grid-lite.php', | |
| 669 | - 'tab' => 'widget', | |
| 670 | - ]; | |
| 671 | - | |
| 672 | - // Skip if an older version of Easy Elements Pro still bundles the Mini Cart widget. | |
| 673 | - $legacy_pro_mini_cart = defined( 'EASYELEMENTS_PRO_PATH' ) | |
| 674 | - && file_exists( rtrim( EASYELEMENTS_PRO_PATH, '/\\' ) . '/widgets/mini-cart/mini-cart.php' ); | |
| 675 | - | |
| 676 | - if ( ! $legacy_pro_mini_cart ) { | |
| 677 | - $widgets['mini_cart'] = [ | |
| 678 | - 'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Mini_Cart_Widget', | |
| 679 | - 'file' => EASYELEMENTS_DIR_PATH . '/widgets/mini-cart/mini-cart.php', | |
| 680 | - 'tab' => 'widget', | |
| 681 | - ]; | |
| 682 | - } | |
| 683 | - } | |
| 684 | - | |
| 685 | - foreach ( $widgets as $key => $data ) { | |
| 686 | - $option_name = 'easy_element_' . $data['tab'] . '_' . $key; | |
| 687 | - $enabled = get_option( $option_name, '1' ); | |
| 688 | - | |
| 689 | - if ( 1 !== ( int ) $enabled ) { | |
| 690 | - continue; // Skip disabled widgets | |
| 691 | - } | |
| 692 | - | |
| 693 | - if ( file_exists( $data['file'] ) ) { | |
| 694 | - require_once $data['file']; | |
| 695 | - | |
| 696 | - if ( class_exists( $data['class'] ) ) { | |
| 697 | - $widgets_manager->register( new $data['class']() ); | |
| 698 | - } | |
| 699 | - } | |
| 700 | - } | |
| 701 | - } | |
| 702 | - | |
| 703 | - public function easyel_setting_page_link( $links ) { | |
| 704 | - $action_link = sprintf( | |
| 705 | - '<a href="%s">%s</a>', | |
| 706 | - esc_url( admin_url( 'admin.php?page=easy-elements-dashboard' ) ), | |
| 707 | - esc_html__( 'Settings', 'easy-elements' ) | |
| 708 | - ); | |
| 709 | - array_push( $links, $action_link ); | |
| 710 | - return $links; | |
| 711 | - } | |
| 712 | - | |
| 713 | -} | |
| 714 | - | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | + | |
| 6 | +final class Easyel_Elements_Elementor_Extension { | |
| 7 | + | |
| 8 | + const VERSION = EASYELEMENTS_VER; | |
| 9 | + | |
| 10 | + private static $_instance = null; | |
| 11 | + | |
| 12 | + public static function instance() { | |
| 13 | + if ( is_null( self::$_instance ) ) { | |
| 14 | + self::$_instance = new self(); | |
| 15 | + } | |
| 16 | + return self::$_instance; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public function __construct() { | |
| 20 | + | |
| 21 | + add_action( 'init', [ $this, 'init' ] ); | |
| 22 | + add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] ); | |
| 23 | + add_action( 'elementor/elements/categories_registered', [ $this, 'add_elementor_categories' ] ); | |
| 24 | + | |
| 25 | + add_action( 'admin_notices', [ $this, 'easyel_admin_promo_notice' ] , 0 ); | |
| 26 | + add_action( 'admin_init', [ $this, 'easyel_admin_promo_notice_dismiss_handler' ] ); | |
| 27 | + | |
| 28 | + } | |
| 29 | + | |
| 30 | + function easyel_admin_promo_notice() { | |
| 31 | + | |
| 32 | + // Check if dismissed | |
| 33 | + if ( get_option( 'easyel_admin_promo_notice_dismissed1' ) ) { | |
| 34 | + return; | |
| 35 | + } | |
| 36 | + | |
| 37 | + $dismiss_url = wp_nonce_url( | |
| 38 | + add_query_arg( 'easyel_promo_notice_dismiss1', '1' ), | |
| 39 | + 'easyel_promo_notice_dismiss_nonce' | |
| 40 | + ); | |
| 41 | + ?> | |
| 42 | + | |
| 43 | + <div class="notice easyel-promo-notice is-dismissible"> | |
| 44 | + <div class="easyel-promo-content"> | |
| 45 | + <div class="easyel-promo-left"> | |
| 46 | + <span class="orange">Easy Elements Black Friday Sale</span> • <span>Early Bird Sale</span> Discount Up To | |
| 47 | + <span style="color:#ff7dcb;">65%</span> OFF | |
| 48 | + <a class="easyel-promo-btn" href="https://wpeasyelements.com/pricing/" target="_blank"> | |
| 49 | + Grab the Deal → | |
| 50 | + </a> | |
| 51 | + </div> | |
| 52 | + </div> | |
| 53 | + </div> | |
| 54 | + | |
| 55 | + <?php | |
| 56 | + } | |
| 57 | + | |
| 58 | + function easyel_admin_promo_notice_dismiss_handler() { | |
| 59 | + if ( isset( $_GET['easyel_promo_notice_dismiss1'] ) ) { | |
| 60 | + | |
| 61 | + // Safely get the nonce | |
| 62 | + $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : ''; | |
| 63 | + | |
| 64 | + // Verify nonce | |
| 65 | + if ( ! wp_verify_nonce( $nonce, 'easyel_promo_notice_dismiss_nonce' ) ) { | |
| 66 | + return; | |
| 67 | + } | |
| 68 | + | |
| 69 | + update_option( 'easyel_admin_promo_notice_dismissed1', 1 ); | |
| 70 | + | |
| 71 | + wp_redirect( remove_query_arg( [ 'easyel_promo_notice_dismiss1', '_wpnonce' ] ) ); | |
| 72 | + exit; | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + public function init() { | |
| 79 | + // Safety checks | |
| 80 | + | |
| 81 | + add_filter( 'body_class', [ $this, "easy_add_extra_body_class" ] ); | |
| 82 | + add_action( 'easy_header', [ $this, 'easyel_before_content_container_hfe'], 20 ); | |
| 83 | + add_action( 'easy_footer', [ $this, 'easyel_after_content_container_hfe' ], 5 ); | |
| 84 | + | |
| 85 | + add_action( 'admin_notices', [ $this, 'easyelements_admin_notice_missing_elementor' ] ); | |
| 86 | + | |
| 87 | + } | |
| 88 | + | |
| 89 | + public function easyelements_admin_notice_missing_elementor() { | |
| 90 | + | |
| 91 | + $elementor = 'elementor/elementor.php'; | |
| 92 | + | |
| 93 | + if ( current_user_can( 'activate_plugins' ) && isset( $_GET['activate'], $_GET['_wpnonce'] ) ) { | |
| 94 | + | |
| 95 | + $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : ''; | |
| 96 | + | |
| 97 | + if ( wp_verify_nonce( $nonce, 'activate-plugin_' . $elementor ) ) { | |
| 98 | + unset( $_GET['activate'] ); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + if ( ! current_user_can( 'install_plugins' ) ) { | |
| 103 | + return; | |
| 104 | + } | |
| 105 | + | |
| 106 | + $elementor = 'elementor/elementor.php'; | |
| 107 | + $elementor_path = WP_PLUGIN_DIR . '/' . $elementor; | |
| 108 | + | |
| 109 | + $is_installed = file_exists( $elementor_path ); | |
| 110 | + $is_active = function_exists( 'is_plugin_active' ) && is_plugin_active( $elementor ); | |
| 111 | + | |
| 112 | + if ( $is_active ) { | |
| 113 | + return; | |
| 114 | + } | |
| 115 | + | |
| 116 | + if ( $is_installed ) { | |
| 117 | + $action_url = wp_nonce_url( | |
| 118 | + self_admin_url( 'plugins.php?action=activate&plugin=' . $elementor ), | |
| 119 | + 'activate-plugin_' . $elementor | |
| 120 | + ); | |
| 121 | + | |
| 122 | + $button_label = esc_html__( 'Activate Elementor', 'easy-elements' ); | |
| 123 | + $notice_text = esc_html__( 'Easy Elements is not working because the Elementor plugin is inactive.', 'easy-elements' ); | |
| 124 | + | |
| 125 | + } else { | |
| 126 | + $action_url = wp_nonce_url( | |
| 127 | + self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), | |
| 128 | + 'install-plugin_elementor' | |
| 129 | + ); | |
| 130 | + | |
| 131 | + $button_label = esc_html__( 'Install Elementor', 'easy-elements' ); | |
| 132 | + $notice_text = esc_html__( 'Easy Elements requires the Elementor plugin to be installed.', 'easy-elements' ); | |
| 133 | + } | |
| 134 | + | |
| 135 | + $message = '<p>' . $notice_text . '</p>'; | |
| 136 | + $message .= '<p><a href="' . esc_url( $action_url ) . '" class="button-primary">' . $button_label . '</a></p>'; | |
| 137 | + | |
| 138 | + printf( | |
| 139 | + '<div class="notice notice-error is-dismissible">%s</div>', | |
| 140 | + wp_kses_post( $message ) | |
| 141 | + ); | |
| 142 | + } | |
| 143 | + | |
| 144 | + // Container Full site | |
| 145 | + public function easyel_before_content_container_hfe() { | |
| 146 | + if ( is_admin() ) return; | |
| 147 | + if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) { | |
| 148 | + return; | |
| 149 | + } | |
| 150 | + echo '<div class="easyel-content-container">'; | |
| 151 | + } | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * Close container before HFE Footer | |
| 155 | + */ | |
| 156 | + function easyel_after_content_container_hfe() { | |
| 157 | + if ( is_admin() ) return; | |
| 158 | + if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) { | |
| 159 | + return; | |
| 160 | + } | |
| 161 | + echo '</div>'; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public function easy_add_extra_body_class( $classes ) { | |
| 165 | + if ( is_plugin_active( 'easy-elements/easy-elements.php' ) ) { | |
| 166 | + $classes[] = 'eel-easy-elements'; | |
| 167 | + } | |
| 168 | + | |
| 169 | + return $classes; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public function add_elementor_categories( $elements_manager ) { | |
| 173 | + | |
| 174 | + $new_categories = [ | |
| 175 | + 'easyelements_category' => [ | |
| 176 | + 'title' => __( 'Easy Elements', 'easy-elements' ), | |
| 177 | + 'icon' => 'fa fa-plug', | |
| 178 | + ], | |
| 179 | + 'easyelements_post_category' => [ | |
| 180 | + 'title' => __( 'Easy Post Type Elements', 'easy-elements' ), | |
| 181 | + 'icon' => 'fa fa-file-alt', | |
| 182 | + ], | |
| 183 | + 'easyelements_header_footer_category' => [ | |
| 184 | + 'title' => __( 'Easy Header Footer Elements', 'easy-elements' ), | |
| 185 | + 'icon' => 'fa fa-header', | |
| 186 | + ], | |
| 187 | + 'easyelements_category_form' => [ | |
| 188 | + 'title' => __( 'Easy Elements Form', 'easy-elements' ), | |
| 189 | + 'icon' => 'fa fa-plug', | |
| 190 | + ], | |
| 191 | + 'easyelements_category_pro' => [ | |
| 192 | + 'title' => __( 'Easy Elements Pro', 'easy-elements' ), | |
| 193 | + 'icon' => 'fa fa-plug', | |
| 194 | + ], | |
| 195 | + ]; | |
| 196 | + | |
| 197 | + $existing = $elements_manager->get_categories(); | |
| 198 | + $final_list = []; | |
| 199 | + | |
| 200 | + foreach ( $existing as $key => $cat ) { | |
| 201 | + $final_list[ $key ] = $cat; | |
| 202 | + | |
| 203 | + if ( $key === 'layout' ) { | |
| 204 | + foreach ( $new_categories as $new_key => $new_cat ) { | |
| 205 | + $final_list[ $new_key ] = $new_cat; | |
| 206 | + } | |
| 207 | + } | |
| 208 | + } | |
| 209 | + | |
| 210 | + $apply_categories = function( $cats ) { | |
| 211 | + $this->categories = $cats; | |
| 212 | + }; | |
| 213 | + | |
| 214 | + $apply_categories->call( $elements_manager, $final_list ); | |
| 215 | + } | |
| 216 | + | |
| 217 | + public function init_widgets() { | |
| 218 | + $widgets_manager = \Elementor\Plugin::instance()->widgets_manager; | |
| 219 | + | |
| 220 | + $widgets = [ | |
| 221 | + 'site_logo' => [ | |
| 222 | + 'class' => '\Easyel_Site_Logo_Widget', | |
| 223 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/site-logo/site-logo.php', | |
| 224 | + 'tab' => 'widget' | |
| 225 | + ], | |
| 226 | + 'heading' => [ | |
| 227 | + 'class' => '\Easyel_Heading_Widget', | |
| 228 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/heading/heading.php', | |
| 229 | + 'tab' => 'widget' | |
| 230 | + ], | |
| 231 | + 'clients_logo' => [ | |
| 232 | + 'class' => '\Easyel_Clients_Logo__Widget', | |
| 233 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/clients-logo-grid/logo.php', | |
| 234 | + 'tab' => 'widget' | |
| 235 | + ], | |
| 236 | + 'icon_box' => [ | |
| 237 | + 'class' => '\Easyel_Icon_Box__Widget', | |
| 238 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/icon-box/icon.php', | |
| 239 | + 'tab' => 'widget' | |
| 240 | + ], | |
| 241 | + 'simple_tab' => [ | |
| 242 | + 'class' => '\Easyel_Tab_Widget', | |
| 243 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/tab/tab.php', | |
| 244 | + 'tab' => 'widget' | |
| 245 | + ], | |
| 246 | + 'testimonials' => [ | |
| 247 | + 'class' => '\Easyel_Testimonials__Widget', | |
| 248 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/testimonials-grid/testimonials.php', | |
| 249 | + 'tab' => 'widget' | |
| 250 | + ], | |
| 251 | + 'team_grid' => [ | |
| 252 | + 'class' => '\Easyel_Team_Grid__Widget', | |
| 253 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/team-grid/team-grid.php', | |
| 254 | + 'tab' => 'widget' | |
| 255 | + ], | |
| 256 | + 'search' => [ | |
| 257 | + 'class' => '\Easyel_Search_Widget', | |
| 258 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/search/search.php', | |
| 259 | + 'tab' => 'widget' | |
| 260 | + ], | |
| 261 | + 'contact_box' => [ | |
| 262 | + 'class' => '\Easyel_Contact_Box__Widget', | |
| 263 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/contact-box/contact.php', | |
| 264 | + 'tab' => 'widget' | |
| 265 | + ], | |
| 266 | + 'faq' => [ | |
| 267 | + 'class' => '\Easyel_FAQ_Accordion_Widget', | |
| 268 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/faq/faq.php', | |
| 269 | + 'tab' => 'widget' | |
| 270 | + ], | |
| 271 | + 'blog_grid' => [ | |
| 272 | + 'class' => '\Easyel_Blog_Grid__Widget', | |
| 273 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/blog-grid/blog-grid.php', | |
| 274 | + 'tab' => 'widget' | |
| 275 | + ], | |
| 276 | + 'video' => [ | |
| 277 | + 'class' => '\Easyel_Video_Popup_Widget', | |
| 278 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/video/video.php', | |
| 279 | + 'tab' => 'widget' | |
| 280 | + ], | |
| 281 | + 'pricing_table' => [ | |
| 282 | + 'class' => '\Easyel_Pricing_Table_Widget', | |
| 283 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/pricing-table/pricing.php', | |
| 284 | + 'tab' => 'widget' | |
| 285 | + ], | |
| 286 | + 'service_list' => [ | |
| 287 | + 'class' => '\Easyel_Service_List_Widget', | |
| 288 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/service-list/service-list.php', | |
| 289 | + 'tab' => 'widget' | |
| 290 | + ], | |
| 291 | + 'navigation_menu' => [ | |
| 292 | + 'class' => '\Easyel_Navigation_Menu_Widget', | |
| 293 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/navigation-menu/navigation-menu.php', | |
| 294 | + 'tab' => 'widget' | |
| 295 | + ], | |
| 296 | + 'page_title' => [ | |
| 297 | + 'class' => '\Easyel_Page_Title_Widget', | |
| 298 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/page-title/page-title.php', | |
| 299 | + 'tab' => 'widget' | |
| 300 | + ], | |
| 301 | + 'button' => [ | |
| 302 | + 'class' => '\Easyel_Button_Widget', | |
| 303 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/button/button.php', | |
| 304 | + 'tab' => 'widget' | |
| 305 | + ], | |
| 306 | + 'process_grid' => [ | |
| 307 | + 'class' => '\Easyel_Process_Widget', | |
| 308 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/process-grid/process-grid.php', | |
| 309 | + 'tab' => 'widget' | |
| 310 | + ], | |
| 311 | + 'process_list' => [ | |
| 312 | + 'class' => '\Easyel_Process_list_Widget', | |
| 313 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/process-list/process-list.php', | |
| 314 | + 'tab' => 'widget' | |
| 315 | + ], | |
| 316 | + 'social_share' => [ | |
| 317 | + 'class' => '\Easyel_Social_Share_Widget', | |
| 318 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/social-share/social-share.php', | |
| 319 | + 'tab' => 'widget' | |
| 320 | + ], | |
| 321 | + 'social_icon' => [ | |
| 322 | + 'class' => '\Easyel_Social_Icon_Widget', | |
| 323 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/social-icon/social.php', | |
| 324 | + 'tab' => 'widget' | |
| 325 | + ], | |
| 326 | + 'breadcrumb' => [ | |
| 327 | + 'class' => '\Easyel_Breadcrumb_Widget', | |
| 328 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/breadcrumb/breadcrumb.php', | |
| 329 | + 'tab' => 'widget' | |
| 330 | + ], | |
| 331 | + 'domain_search' => [ | |
| 332 | + 'class' => '\Easyel_Domain_Search_Widget', | |
| 333 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/domain-search/domain-search.php', | |
| 334 | + 'tab' => 'widget' | |
| 335 | + ], | |
| 336 | + 'easy_offcanvas' => [ | |
| 337 | + 'class' => '\Easyel_Offcanvas_Widget', | |
| 338 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/offcanvas/offcanvas.php', | |
| 339 | + 'tab' => 'widget' | |
| 340 | + ], | |
| 341 | + 'easy_table' => [ | |
| 342 | + 'class' => '\Easyel_Table_Elementor_Widget', | |
| 343 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/table/table-normal.php', | |
| 344 | + 'tab' => 'widget' | |
| 345 | + ], | |
| 346 | + 'easy_scroll_to_top' => [ | |
| 347 | + 'class' => '\Easyel_Scroll_To_Top_Widget', | |
| 348 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/scroll-to-top/scroll.php', | |
| 349 | + 'tab' => 'widget' | |
| 350 | + ], | |
| 351 | + 'easy_cf7' => [ | |
| 352 | + 'class' => '\easyel__CF7_Widget', | |
| 353 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/cf7/contact-cf7.php', | |
| 354 | + 'tab' => 'widget' | |
| 355 | + ], | |
| 356 | + 'easy_gallery' => [ | |
| 357 | + 'class' => '\Easyel__Gallery_Widget', | |
| 358 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/gallery/gallery.php', | |
| 359 | + 'tab' => 'widget' | |
| 360 | + ], | |
| 361 | + 'easy_progress' => [ | |
| 362 | + 'class' => '\Easyel_Progress_Widget', | |
| 363 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/progress/progress.php', | |
| 364 | + 'tab' => 'widget' | |
| 365 | + ], | |
| 366 | + 'counter' => [ | |
| 367 | + 'class' => '\Easyel_Counter_Widget', | |
| 368 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/counter/counter.php', | |
| 369 | + 'tab' => 'widget' | |
| 370 | + ], | |
| 371 | + 'countdown' => [ | |
| 372 | + 'class' => '\Easyel_Count_Down_Widget', | |
| 373 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/countdown/countdown.php', | |
| 374 | + 'tab' => 'widget' | |
| 375 | + ], | |
| 376 | + 'excerpt' => [ | |
| 377 | + 'class' => '\Easyel_Free_Excerpt_Widget', | |
| 378 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/excerpt/excerpt.php', | |
| 379 | + 'tab' => 'widget' | |
| 380 | + ], | |
| 381 | + 'post_title' => [ | |
| 382 | + 'class' => '\Easyel_Free_Post_Title_Widget', | |
| 383 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-title/post-title.php', | |
| 384 | + 'tab' => 'widget' | |
| 385 | + ], | |
| 386 | + 'post_content' => [ | |
| 387 | + 'class' => '\Easyel_Free_Post_content_Widget', | |
| 388 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-content/post-content.php', | |
| 389 | + 'tab' => 'widget' | |
| 390 | + ], | |
| 391 | + 'featured_image' => [ | |
| 392 | + 'class' => '\Easyel_free_Featured_Image_Widget', | |
| 393 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/featured-image/featured-image.php', | |
| 394 | + 'tab' => 'widget' | |
| 395 | + ], | |
| 396 | + 'post_meta' => [ | |
| 397 | + 'class' => '\Easyel_Free_Post_Meta_Widget', | |
| 398 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-meta/post-meta.php', | |
| 399 | + 'tab' => 'widget' | |
| 400 | + ], | |
| 401 | + 'post_pagination' => [ | |
| 402 | + 'class' => '\Easyel_Free_Post_Pagination_Widget', | |
| 403 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-pagination/post-pagination.php', | |
| 404 | + 'tab' => 'widget' | |
| 405 | + ], | |
| 406 | + 'post_comments' => [ | |
| 407 | + 'class' => '\Easyel_Free_Post_Comments_Widget', | |
| 408 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-comments/post-comments.php', | |
| 409 | + 'tab' => 'widget' | |
| 410 | + ], | |
| 411 | + 'post_tags' => [ | |
| 412 | + 'class' => '\Easyel_Free_Post_Tags_Widget', | |
| 413 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-tag/post-tag.php', | |
| 414 | + 'tab' => 'widget' | |
| 415 | + ], | |
| 416 | + 'post_author' => [ | |
| 417 | + 'class' => '\Easyel_Free_Post_Author_Info_Widget', | |
| 418 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-author/post-author.php', | |
| 419 | + 'tab' => 'widget' | |
| 420 | + ], | |
| 421 | + 'archive_post' => [ | |
| 422 | + 'class' => '\Easyel_Free_Archive_Post__Widget', | |
| 423 | + 'file' => EASYELEMENTS_DIR_PATH . '/widgets/archive-post/archive-post.php', | |
| 424 | + 'tab' => 'widget', | |
| 425 | + ], | |
| 426 | + 'login_register' => [ | |
| 427 | + 'class' => '\Easyel_Login_Register_Widget', | |
| 428 | + 'file' => __DIR__ . '/widgets/login-register/login-register.php', | |
| 429 | + 'tab' => 'widget', | |
| 430 | + ], | |
| 431 | + ]; | |
| 432 | + | |
| 433 | + foreach ( $widgets as $key => $data ) { | |
| 434 | + $option_name = 'easy_element_' . $data['tab'] . '_' . $key; | |
| 435 | + $enabled = get_option( $option_name, '1' ); | |
| 436 | + | |
| 437 | + if ( 1 !== ( int ) $enabled ) { | |
| 438 | + continue; // Skip disabled widgets | |
| 439 | + } | |
| 440 | + | |
| 441 | + if ( file_exists( $data['file'] ) ) { | |
| 442 | + require_once $data['file']; | |
| 443 | + | |
| 444 | + if ( class_exists( $data['class'] ) ) { | |
| 445 | + $widgets_manager->register( new $data['class']() ); | |
| 446 | + } | |
| 447 | + } | |
| 448 | + } | |
| 449 | + } | |
| 450 | + | |
| 451 | +} | |
| 452 | + | |
| 715 | 453 | Easyel_Elements_Elementor_Extension::instance(); |