# easy-elements/1.2.1/base.php

Easy Elements for Elementor – Addons &amp; Website Templates, version 1.2.1. 453 lines.

- Page: https://pluginprobe.com/plugins/easy-elements/1.2.1/code/base.php
- Raw: https://pluginprobe.com/plugins/easy-elements/1.2.1/raw/base.php
- Modified: 2025-12-02T11:10:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-elements/1.2.1/code/base.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

final class Easyel_Elements_Elementor_Extension {

	const VERSION = EASYELEMENTS_VER;

	private static $_instance = null;

	public static function instance() {
		if ( is_null( self::$_instance ) ) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}

	public function __construct() {

		add_action( 'init', [ $this, 'init' ] );
		add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] );
		add_action( 'elementor/elements/categories_registered', [ $this, 'add_elementor_categories' ] );

		add_action( 'admin_notices', [ $this, 'easyel_admin_promo_notice' ] , 0 );
		add_action( 'admin_init', [ $this, 'easyel_admin_promo_notice_dismiss_handler' ] );

	}

	function easyel_admin_promo_notice() {

		// Check if dismissed
		if ( get_option( 'easyel_admin_promo_notice_dismissed1' ) ) {
			return;
		}

		$dismiss_url = wp_nonce_url(
			add_query_arg( 'easyel_promo_notice_dismiss1', '1' ),
			'easyel_promo_notice_dismiss_nonce'
		);
		?>

		<div class="notice easyel-promo-notice is-dismissible">
			<div class="easyel-promo-content">
				<div class="easyel-promo-left">
					<span class="orange">Easy Elements Black Friday Sale</span> • <span>Early Bird Sale</span> Discount Up To 
					<span style="color:#ff7dcb;">65%</span> OFF
					<a class="easyel-promo-btn" href="https://wpeasyelements.com/pricing/" target="_blank">
						Grab the Deal →
					</a>
				</div>
			</div>
		</div>

		<?php
	}

	function easyel_admin_promo_notice_dismiss_handler() {
		if ( isset( $_GET['easyel_promo_notice_dismiss1'] ) ) {

			// Safely get the nonce
			$nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';

			// Verify nonce
			if ( ! wp_verify_nonce( $nonce, 'easyel_promo_notice_dismiss_nonce' ) ) {
				return;
			}

			update_option( 'easyel_admin_promo_notice_dismissed1', 1 );

			wp_redirect( remove_query_arg( [ 'easyel_promo_notice_dismiss1', '_wpnonce' ] ) );
			exit;
		}
	}



	public function init() {
		// Safety checks

		add_filter( 'body_class', [ $this, "easy_add_extra_body_class" ] );
		add_action( 'easy_header', [ $this, 'easyel_before_content_container_hfe'], 20 );
		add_action( 'easy_footer', [ $this, 'easyel_after_content_container_hfe' ], 5 );

		add_action( 'admin_notices', [ $this, 'easyelements_admin_notice_missing_elementor' ] );

	}

	public function easyelements_admin_notice_missing_elementor() {

		$elementor = 'elementor/elementor.php';

		if ( current_user_can( 'activate_plugins' ) && isset( $_GET['activate'], $_GET['_wpnonce'] ) ) {

			$nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';

			if ( wp_verify_nonce( $nonce, 'activate-plugin_' . $elementor ) ) {
				unset( $_GET['activate'] );
			}
		}

		if ( ! current_user_can( 'install_plugins' ) ) {
			return;
		}

		$elementor = 'elementor/elementor.php';
		$elementor_path = WP_PLUGIN_DIR . '/' . $elementor;

		$is_installed = file_exists( $elementor_path );
		$is_active    = function_exists( 'is_plugin_active' ) && is_plugin_active( $elementor );

		if ( $is_active ) {
			return;
		}

		if ( $is_installed ) {
			$action_url = wp_nonce_url(
				self_admin_url( 'plugins.php?action=activate&plugin=' . $elementor ),
				'activate-plugin_' . $elementor
			);

			$button_label = esc_html__( 'Activate Elementor', 'easy-elements' );
			$notice_text  = esc_html__( 'Easy Elements is not working because the Elementor plugin is inactive.', 'easy-elements' );

		} else {
			$action_url = wp_nonce_url(
				self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ),
				'install-plugin_elementor'
			);

			$button_label = esc_html__( 'Install Elementor', 'easy-elements' );
			$notice_text  = esc_html__( 'Easy Elements requires the Elementor plugin to be installed.', 'easy-elements' );
		}

		$message  = '<p>' . $notice_text . '</p>';
		$message .= '<p><a href="' . esc_url( $action_url ) . '" class="button-primary">' . $button_label . '</a></p>';

		printf(
			'<div class="notice notice-error is-dismissible">%s</div>',
			wp_kses_post( $message )
		);
	}

	// Container Full site
	public function easyel_before_content_container_hfe() {
		if ( is_admin() ) return;
		if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) {
			return;
		}
		echo '<div class="easyel-content-container">';
	}

	/**
	 * Close container before HFE Footer
	 */
	function easyel_after_content_container_hfe() {
		if ( is_admin() ) return;
		if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) {
			return;
		}
		echo '</div>';
	}

	public function easy_add_extra_body_class( $classes ) {
		if ( is_plugin_active( 'easy-elements/easy-elements.php' ) ) {
			$classes[] = 'eel-easy-elements';
		}

		return $classes;
	}

	public function add_elementor_categories( $elements_manager ) {

		$new_categories = [
			'easyelements_category' => [
				'title' => __( 'Easy Elements', 'easy-elements' ),
				'icon'  => 'fa fa-plug',
			],
			'easyelements_post_category' => [
				'title' => __( 'Easy Post Type Elements', 'easy-elements' ),
				'icon'  => 'fa fa-file-alt',
			],
			'easyelements_header_footer_category' => [
				'title' => __( 'Easy Header Footer Elements', 'easy-elements' ),
				'icon'  => 'fa fa-header',
			],
			'easyelements_category_form' => [
				'title' => __( 'Easy Elements Form', 'easy-elements' ),
				'icon'  => 'fa fa-plug',
			],
			'easyelements_category_pro' => [
				'title' => __( 'Easy Elements Pro', 'easy-elements' ),
				'icon'  => 'fa fa-plug',
			],
		];

		$existing = $elements_manager->get_categories();
		$final_list = [];

		foreach ( $existing as $key => $cat ) {
			$final_list[ $key ] = $cat;

			if ( $key === 'layout' ) {
				foreach ( $new_categories as $new_key => $new_cat ) {
					$final_list[ $new_key ] = $new_cat;
				}
			}
		}

		$apply_categories = function( $cats ) {
			$this->categories = $cats;
		};

		$apply_categories->call( $elements_manager, $final_list );
	}

	public function init_widgets() {
		$widgets_manager = \Elementor\Plugin::instance()->widgets_manager;

		$widgets = [
			'site_logo' => [
				'class' => '\Easyel_Site_Logo_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/site-logo/site-logo.php',
				'tab'   => 'widget'
			],
			'heading' => [
				'class' => '\Easyel_Heading_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/heading/heading.php',
				'tab'   => 'widget'
			],
			'clients_logo' => [
				'class' => '\Easyel_Clients_Logo__Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/clients-logo-grid/logo.php',
				'tab'   => 'widget'
			],
			'icon_box' => [
				'class' => '\Easyel_Icon_Box__Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/icon-box/icon.php',
				'tab'   => 'widget'
			],
			'simple_tab' => [
				'class' => '\Easyel_Tab_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/tab/tab.php',
				'tab'   => 'widget'
			],
			'testimonials' => [
				'class' => '\Easyel_Testimonials__Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/testimonials-grid/testimonials.php',
				'tab'   => 'widget'
			],
			'team_grid' => [
				'class' => '\Easyel_Team_Grid__Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/team-grid/team-grid.php',
				'tab'   => 'widget'
			],
			'search' => [
				'class' => '\Easyel_Search_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/search/search.php',
				'tab'   => 'widget'
			],
			'contact_box' => [
				'class' => '\Easyel_Contact_Box__Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/contact-box/contact.php',
				'tab'   => 'widget'
			],
			'faq' => [
				'class' => '\Easyel_FAQ_Accordion_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/faq/faq.php',
				'tab'   => 'widget'
			],
			'blog_grid' => [
				'class' => '\Easyel_Blog_Grid__Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/blog-grid/blog-grid.php',
				'tab'   => 'widget'
			],
			'video' => [
				'class' => '\Easyel_Video_Popup_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/video/video.php',
				'tab'   => 'widget'
			],
			'pricing_table' => [
				'class' => '\Easyel_Pricing_Table_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/pricing-table/pricing.php',
				'tab'   => 'widget'
			],
			'service_list' => [
				'class' => '\Easyel_Service_List_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/service-list/service-list.php',
				'tab'   => 'widget'
			],
			'navigation_menu' => [
				'class' => '\Easyel_Navigation_Menu_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/navigation-menu/navigation-menu.php',
				'tab'   => 'widget'
			],
			'page_title' => [
				'class' => '\Easyel_Page_Title_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/page-title/page-title.php',
				'tab'   => 'widget'
			],
			'button' => [
				'class' => '\Easyel_Button_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/button/button.php',
				'tab'   => 'widget'
			],
			'process_grid' => [
				'class' => '\Easyel_Process_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/process-grid/process-grid.php',
				'tab'   => 'widget'
			],
			'process_list' => [
				'class' => '\Easyel_Process_list_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/process-list/process-list.php',
				'tab'   => 'widget'
			],
			'social_share' => [
				'class' => '\Easyel_Social_Share_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/social-share/social-share.php',
				'tab'   => 'widget'
			],
			'social_icon' => [
				'class' => '\Easyel_Social_Icon_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/social-icon/social.php',
				'tab'   => 'widget'
			],
			'breadcrumb' => [
				'class' => '\Easyel_Breadcrumb_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/breadcrumb/breadcrumb.php',
				'tab'   => 'widget'
			],
			'domain_search' => [
				'class' => '\Easyel_Domain_Search_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/domain-search/domain-search.php',
				'tab'   => 'widget'
			],
			'easy_offcanvas' => [
				'class' => '\Easyel_Offcanvas_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/offcanvas/offcanvas.php',
				'tab'   => 'widget'
			],
			'easy_table' => [
				'class' => '\Easyel_Table_Elementor_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/table/table-normal.php',
				'tab'   => 'widget'
			],
			'easy_scroll_to_top' => [
				'class' => '\Easyel_Scroll_To_Top_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/scroll-to-top/scroll.php',
				'tab'   => 'widget'
			],
			'easy_cf7' => [
				'class' => '\easyel__CF7_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/cf7/contact-cf7.php',
				'tab'   => 'widget'
			],
			'easy_gallery' => [
				'class' => '\Easyel__Gallery_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/gallery/gallery.php',
				'tab'   => 'widget'
			],
			'easy_progress' => [
				'class' => '\Easyel_Progress_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/progress/progress.php',
				'tab'   => 'widget'
			],			
			'counter' => [
				'class' => '\Easyel_Counter_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/counter/counter.php',
				'tab'   => 'widget'
			],
			'countdown' => [
				'class' => '\Easyel_Count_Down_Widget',
				'file'  => EASYELEMENTS_DIR_PATH . '/widgets/countdown/countdown.php',
				'tab'   => 'widget'
			],
			'excerpt' => [
                'class' => '\Easyel_Free_Excerpt_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/excerpt/excerpt.php',
                'tab'   => 'widget'
            ],
            'post_title' => [
                'class' => '\Easyel_Free_Post_Title_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-title/post-title.php',
                'tab'   => 'widget'
            ],
            'post_content' => [
                'class' => '\Easyel_Free_Post_content_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-content/post-content.php',
                'tab'   => 'widget'
            ],
            'featured_image' => [
                'class' => '\Easyel_free_Featured_Image_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/featured-image/featured-image.php',
                'tab'   => 'widget'
            ],		
            'post_meta' => [
                'class' => '\Easyel_Free_Post_Meta_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-meta/post-meta.php',
                'tab'   => 'widget'
            ],
            'post_pagination' => [
                'class' => '\Easyel_Free_Post_Pagination_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-pagination/post-pagination.php',
                'tab'   => 'widget'
            ],
            'post_comments' => [
                'class' => '\Easyel_Free_Post_Comments_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-comments/post-comments.php',
                'tab'   => 'widget'
            ],
			'post_tags' => [
                'class' => '\Easyel_Free_Post_Tags_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-tag/post-tag.php',
                'tab'   => 'widget'
            ],
            'post_author' => [
                'class' => '\Easyel_Free_Post_Author_Info_Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/post-author/post-author.php',
                'tab'   => 'widget'
            ],
			'archive_post' => [
                'class' => '\Easyel_Free_Archive_Post__Widget',
                'file'  => EASYELEMENTS_DIR_PATH . '/widgets/archive-post/archive-post.php',
                'tab'   => 'widget',
            ],
			'login_register' => [
				'class' => '\Easyel_Login_Register_Widget',
				'file'  => __DIR__ . '/widgets/login-register/login-register.php',
				'tab'   => 'widget',
			],
		];

		foreach ( $widgets as $key => $data ) {
			$option_name = 'easy_element_' . $data['tab'] . '_' . $key;
			$enabled = get_option( $option_name, '1' );

			if ( 1 !== ( int ) $enabled ) {
				continue; // Skip disabled widgets
			}

			if ( file_exists( $data['file'] ) ) {
				require_once $data['file'];

				if ( class_exists( $data['class'] ) ) {
					$widgets_manager->register( new $data['class']() );
				}
			}
		}
	}

}

Easyel_Elements_Elementor_Extension::instance();
```
