| 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;">65%</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 � |
| 194 |
� |
| 195 |
� |
| 196 |
� |
| 197 |
� |
| 198 |
', 'easy-elements' ) . '</a>'; |
| 199 |
return $meta; |
| 200 |
} |
| 201 |
|
| 202 |
public function easyel_admin_promo_notice_dismiss_handler() { |
| 203 |
|
| 204 |
if ( ! is_admin() ) { |
| 205 |
return; |
| 206 |
} |
| 207 |
|
| 208 |
if ( empty( $_GET['easyel_promo_notice_dismiss'] ) ) { |
| 209 |
return; |
| 210 |
} |
| 211 |
|
| 212 |
$nonce = isset( $_GET['_wpnonce'] ) |
| 213 |
? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) |
| 214 |
: ''; |
| 215 |
|
| 216 |
if ( ! wp_verify_nonce( $nonce, 'easyel_promo_notice_dismiss_nonce' ) ) { |
| 217 |
return; |
| 218 |
} |
| 219 |
|
| 220 |
update_option( 'easyel_admin_promo_notice_dismissed2', 1 ); |
| 221 |
|
| 222 |
wp_safe_redirect( |
| 223 |
remove_query_arg( [ 'easyel_promo_notice_dismiss', '_wpnonce' ] ) |
| 224 |
); |
| 225 |
exit; |
| 226 |
} |
| 227 |
|
| 228 |
public function init() { |
| 229 |
// Safety checks |
| 230 |
|
| 231 |
add_filter( 'body_class', [ $this, "easy_add_extra_body_class" ] ); |
| 232 |
add_action( 'easy_header', [ $this, 'easyel_before_content_container_hfe'], 20 ); |
| 233 |
add_action( 'easy_footer', [ $this, 'easyel_after_content_container_hfe' ], 5 ); |
| 234 |
|
| 235 |
add_action( 'admin_notices', [ $this, 'easyelements_admin_notice_missing_elementor' ] ); |
| 236 |
} |
| 237 |
|
| 238 |
public function easyel_plugin_loaded () { |
| 239 |
|
| 240 |
\Easyel\EasyElements\Utils\Enqueue::get_instance(); |
| 241 |
\Easyel\EasyElements\Utils\QueryHelper::get_instance(); |
| 242 |
|
| 243 |
if( is_admin() ) { |
| 244 |
\Easyel\EasyElements\Admin\Admin_Settings::get_instance(); |
| 245 |
} |
| 246 |
|
| 247 |
if ( did_action( 'elementor/loaded' ) ) { |
| 248 |
\Easyel\EasyElements\Template_Library\Easyel_Templates_Library::get_instance(); |
| 249 |
\Easyel\EasyElements\Starter_Template\Easyel_Starter_Template::get_instance(); |
| 250 |
\Easyel\EasyElements\Header_Footer_Builder\Classes\Easy_Header_Footer_Elementor::get_instance(); |
| 251 |
} |
| 252 |
|
| 253 |
\Easyel\EasyElements\Theme_Builder\Easyel_Theme_Builder_CPT::get_instance(); |
| 254 |
|
| 255 |
\Easyel\EasyElements\Theme_Builder\Easyel_Theme_Builder_Front::get_instance(); |
| 256 |
|
| 257 |
\Easyel\EasyElements\PostType\OffcanvasPostType::get_instance(); |
| 258 |
\Easyel\EasyElements\CustomCode\Easyel_Custom_Code::get_instance(); |
| 259 |
\Easyel\EasyElements\Popup_Builder\Easyel_Popup_Builder::get_instance(); |
| 260 |
\Easyel\EasyElements\Extensions\ExtensionHook\ExtensionModule::get_instance(); |
| 261 |
\Easyel\EasyElements\Extensions\CustomCss\EasyelCustomCss::get_instance()->init(); |
| 262 |
\Easyel\EasyElements\Extensions\Duplicator\EasyelDuplicator::get_instance(); |
| 263 |
\Easyel\EasyElements\Extensions\SettingExport\EasyelExport::get_instance(); |
| 264 |
\Easyel\EasyElements\Extensions\LiveCopy\CopyPaste::get_instance(); |
| 265 |
\Easyel\EasyElements\Extensions\VisibilityControl\VisibilityModule::get_instance(); |
| 266 |
\Easyel\EasyElements\Extensions\Jarallax\JaralaxControl::get_instance()->init(); |
| 267 |
\Easyel\EasyElements\Extensions\Jarallax\GlobalJarallax::get_instance(); |
| 268 |
\Easyel\EasyElements\Extensions\ProgressBar\ReadingProgressBar::get_instance(); |
| 269 |
\Easyel\EasyElements\Extensions\ScrollTop\ScrollTop::get_instance(); |
| 270 |
|
| 271 |
|
| 272 |
if ( ! class_exists( '\Appsero\Client' ) ) { |
| 273 |
return; |
| 274 |
} |
| 275 |
|
| 276 |
\Easyel\EasyElements\Tracking\Appsero_Tracker::instance(); |
| 277 |
} |
| 278 |
|
| 279 |
public function easyelements_admin_notice_missing_elementor() { |
| 280 |
|
| 281 |
$elementor = 'elementor/elementor.php'; |
| 282 |
|
| 283 |
if ( current_user_can( 'activate_plugins' ) && isset( $_GET['activate'], $_GET['_wpnonce'] ) ) { |
| 284 |
|
| 285 |
$nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : ''; |
| 286 |
|
| 287 |
if ( wp_verify_nonce( $nonce, 'activate-plugin_' . $elementor ) ) { |
| 288 |
unset( $_GET['activate'] ); |
| 289 |
} |
| 290 |
} |
| 291 |
|
| 292 |
if ( ! current_user_can( 'install_plugins' ) ) { |
| 293 |
return; |
| 294 |
} |
| 295 |
|
| 296 |
$elementor = 'elementor/elementor.php'; |
| 297 |
$elementor_path = WP_PLUGIN_DIR . '/' . $elementor; |
| 298 |
|
| 299 |
$is_installed = file_exists( $elementor_path ); |
| 300 |
$is_active = function_exists( 'is_plugin_active' ) && is_plugin_active( $elementor ); |
| 301 |
|
| 302 |
if ( $is_active ) { |
| 303 |
return; |
| 304 |
} |
| 305 |
|
| 306 |
if ( $is_installed ) { |
| 307 |
$action_url = wp_nonce_url( |
| 308 |
self_admin_url( 'plugins.php?action=activate&plugin=' . $elementor ), |
| 309 |
'activate-plugin_' . $elementor |
| 310 |
); |
| 311 |
|
| 312 |
$button_label = esc_html__( 'Activate Elementor', 'easy-elements' ); |
| 313 |
$notice_text = esc_html__( 'Easy Elements is not working because the Elementor plugin is inactive.', 'easy-elements' ); |
| 314 |
|
| 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 |
|
| 321 |
$button_label = esc_html__( 'Install Elementor', 'easy-elements' ); |
| 322 |
$notice_text = esc_html__( 'Easy Elements requires the Elementor plugin to be installed.', 'easy-elements' ); |
| 323 |
} |
| 324 |
|
| 325 |
$message = '<p>' . $notice_text . '</p>'; |
| 326 |
$message .= '<p><a href="' . esc_url( $action_url ) . '" class="button-primary">' . $button_label . '</a></p>'; |
| 327 |
|
| 328 |
printf( |
| 329 |
'<div class="notice notice-error is-dismissible">%s</div>', |
| 330 |
wp_kses_post( $message ) |
| 331 |
); |
| 332 |
} |
| 333 |
|
| 334 |
// Container Full site |
| 335 |
public function easyel_before_content_container_hfe() { |
| 336 |
if ( is_admin() ) return; |
| 337 |
if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) { |
| 338 |
return; |
| 339 |
} |
| 340 |
echo '<div class="easyel-content-container">'; |
| 341 |
} |
| 342 |
|
| 343 |
/** |
| 344 |
* Close container before HFE Footer |
| 345 |
*/ |
| 346 |
function easyel_after_content_container_hfe() { |
| 347 |
if ( is_admin() ) return; |
| 348 |
if ( function_exists( 'elementor_theme_do_location' ) && \Elementor\Plugin::$instance->preview->is_preview() ) { |
| 349 |
return; |
| 350 |
} |
| 351 |
echo '</div>'; |
| 352 |
} |
| 353 |
|
| 354 |
public function easy_add_extra_body_class( $classes ) { |
| 355 |
if ( is_plugin_active( 'easy-elements/easy-elements.php' ) ) { |
| 356 |
$classes[] = 'eel-easy-elements'; |
| 357 |
} |
| 358 |
|
| 359 |
return $classes; |
| 360 |
} |
| 361 |
|
| 362 |
public function add_elementor_categories( $elements_manager ) { |
| 363 |
|
| 364 |
$new_categories = [ |
| 365 |
'easyelements_category' => [ |
| 366 |
'title' => __( 'Easy Elements', 'easy-elements' ), |
| 367 |
'icon' => 'fa fa-plug', |
| 368 |
], |
| 369 |
'easyelements_post_category' => [ |
| 370 |
'title' => __( 'Easy Post Type Elements', 'easy-elements' ), |
| 371 |
'icon' => 'fa fa-file-alt', |
| 372 |
], |
| 373 |
'easyelements_header_footer_category' => [ |
| 374 |
'title' => __( 'Easy Header Footer Elements', 'easy-elements' ), |
| 375 |
'icon' => 'fa fa-header', |
| 376 |
], |
| 377 |
'easyelements_category_form' => [ |
| 378 |
'title' => __( 'Easy Elements Form', 'easy-elements' ), |
| 379 |
'icon' => 'fa fa-plug', |
| 380 |
], |
| 381 |
'easyelements_category_pro' => [ |
| 382 |
'title' => __( 'Easy Elements Pro', 'easy-elements' ), |
| 383 |
'icon' => 'fa fa-plug', |
| 384 |
], |
| 385 |
]; |
| 386 |
|
| 387 |
$existing = $elements_manager->get_categories(); |
| 388 |
$final_list = []; |
| 389 |
|
| 390 |
foreach ( $existing as $key => $cat ) { |
| 391 |
$final_list[ $key ] = $cat; |
| 392 |
|
| 393 |
if ( $key === 'layout' ) { |
| 394 |
foreach ( $new_categories as $new_key => $new_cat ) { |
| 395 |
$final_list[ $new_key ] = $new_cat; |
| 396 |
} |
| 397 |
} |
| 398 |
} |
| 399 |
|
| 400 |
$apply_categories = function( $cats ) { |
| 401 |
$this->categories = $cats; |
| 402 |
}; |
| 403 |
|
| 404 |
$apply_categories->call( $elements_manager, $final_list ); |
| 405 |
} |
| 406 |
|
| 407 |
public function init_widgets() { |
| 408 |
$widgets_manager = \Elementor\Plugin::instance()->widgets_manager; |
| 409 |
|
| 410 |
$widgets = [ |
| 411 |
'site_logo' => [ |
| 412 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Site_Logo_Widget', |
| 413 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/site-logo/site-logo.php', |
| 414 |
'tab' => 'widget' |
| 415 |
], |
| 416 |
'heading' => [ |
| 417 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Heading_Widget', |
| 418 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/heading/heading.php', |
| 419 |
'tab' => 'widget' |
| 420 |
], |
| 421 |
'clients_logo' => [ |
| 422 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Clients_Logo__Widget', |
| 423 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/clients-logo-grid/logo.php', |
| 424 |
'tab' => 'widget' |
| 425 |
], |
| 426 |
'icon_box' => [ |
| 427 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Icon_Box__Widget', |
| 428 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/icon-box/icon.php', |
| 429 |
'tab' => 'widget' |
| 430 |
], |
| 431 |
'simple_tab' => [ |
| 432 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Tab_Widget', |
| 433 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/tab/tab.php', |
| 434 |
'tab' => 'widget' |
| 435 |
], |
| 436 |
'testimonials' => [ |
| 437 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Testimonials__Widget', |
| 438 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/testimonials-grid/testimonials.php', |
| 439 |
'tab' => 'widget' |
| 440 |
], |
| 441 |
'team_grid' => [ |
| 442 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Team_Grid__Widget', |
| 443 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/team-grid/team-grid.php', |
| 444 |
'tab' => 'widget' |
| 445 |
], |
| 446 |
'search' => [ |
| 447 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Search_Widget', |
| 448 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/search/search.php', |
| 449 |
'tab' => 'widget' |
| 450 |
], |
| 451 |
'contact_box' => [ |
| 452 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Contact_Box__Widget', |
| 453 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/contact-box/contact.php', |
| 454 |
'tab' => 'widget' |
| 455 |
], |
| 456 |
'faq' => [ |
| 457 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_FAQ_Accordion_Widget', |
| 458 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/faq/faq.php', |
| 459 |
'tab' => 'widget' |
| 460 |
], |
| 461 |
'blog_grid' => [ |
| 462 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Blog_Grid__Widget', |
| 463 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/blog-grid/blog-grid.php', |
| 464 |
'tab' => 'widget' |
| 465 |
], |
| 466 |
'video' => [ |
| 467 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Video_Popup_Widget', |
| 468 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/video/video.php', |
| 469 |
'tab' => 'widget' |
| 470 |
], |
| 471 |
'pricing_table' => [ |
| 472 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Pricing_Table_Widget', |
| 473 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/pricing-table/pricing.php', |
| 474 |
'tab' => 'widget' |
| 475 |
], |
| 476 |
'service_list' => [ |
| 477 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Service_List_Widget', |
| 478 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/service-list/service-list.php', |
| 479 |
'tab' => 'widget' |
| 480 |
], |
| 481 |
'navigation_menu' => [ |
| 482 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Navigation_Menu_Widget', |
| 483 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/navigation-menu/navigation-menu.php', |
| 484 |
'tab' => 'widget' |
| 485 |
], |
| 486 |
'page_title' => [ |
| 487 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Page_Title_Widget', |
| 488 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/page-title/page-title.php', |
| 489 |
'tab' => 'widget' |
| 490 |
], |
| 491 |
'button' => [ |
| 492 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Button_Widget', |
| 493 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/button/button.php', |
| 494 |
'tab' => 'widget' |
| 495 |
], |
| 496 |
'process_grid' => [ |
| 497 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Process_Grid_Widget', |
| 498 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/process-grid/process-grid.php', |
| 499 |
'tab' => 'widget' |
| 500 |
], |
| 501 |
'process_list' => [ |
| 502 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Process_lists_Widget', |
| 503 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/process-list/process-list.php', |
| 504 |
'tab' => 'widget' |
| 505 |
], |
| 506 |
'social_share' => [ |
| 507 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Social_Share_Widget', |
| 508 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/social-share/social-share.php', |
| 509 |
'tab' => 'widget' |
| 510 |
], |
| 511 |
'social_icon' => [ |
| 512 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Social_Icon_Widget', |
| 513 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/social-icon/social.php', |
| 514 |
'tab' => 'widget' |
| 515 |
], |
| 516 |
'breadcrumb' => [ |
| 517 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Breadcrumb_Widget', |
| 518 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/breadcrumb/breadcrumb.php', |
| 519 |
'tab' => 'widget' |
| 520 |
], |
| 521 |
'domain_search' => [ |
| 522 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Domain_Search_Widget', |
| 523 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/domain-search/domain-search.php', |
| 524 |
'tab' => 'widget' |
| 525 |
], |
| 526 |
'image_comparison' => [ |
| 527 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Before_After_Widget', |
| 528 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/image-comparison/img-before-after.php', |
| 529 |
'tab' => 'widget' |
| 530 |
], |
| 531 |
'easy_offcanvas' => [ |
| 532 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Offcanvas_Widget', |
| 533 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/offcanvas/offcanvas.php', |
| 534 |
'tab' => 'widget' |
| 535 |
], |
| 536 |
'easy_table' => [ |
| 537 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Table_Elementor_Widget', |
| 538 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/table/table-normal.php', |
| 539 |
'tab' => 'widget' |
| 540 |
], |
| 541 |
'easy_scroll_to_top' => [ |
| 542 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Scroll_To_Top_Widget', |
| 543 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/scroll-to-top/scroll.php', |
| 544 |
'tab' => 'widget' |
| 545 |
], |
| 546 |
'easy_cf7' => [ |
| 547 |
'class' => '\Easyel\EasyElements\Widgets\easyel__CF7_Widget', |
| 548 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/cf7/contact-cf7.php', |
| 549 |
'tab' => 'widget' |
| 550 |
], |
| 551 |
'easy_gallery' => [ |
| 552 |
'class' => '\Easyel\EasyElements\Widgets\Easyel__Gallery_Widget', |
| 553 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/gallery/gallery.php', |
| 554 |
'tab' => 'widget' |
| 555 |
], |
| 556 |
'easy_progress' => [ |
| 557 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Progress_Widget', |
| 558 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/progress/progress.php', |
| 559 |
'tab' => 'widget' |
| 560 |
], |
| 561 |
'counter' => [ |
| 562 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Counter_Widget', |
| 563 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/counter/counter.php', |
| 564 |
'tab' => 'widget' |
| 565 |
], |
| 566 |
'countdown' => [ |
| 567 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Count_Down_Widget', |
| 568 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/countdown/countdown.php', |
| 569 |
'tab' => 'widget' |
| 570 |
], |
| 571 |
'excerpt' => [ |
| 572 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Excerpt_Widget', |
| 573 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/excerpt/excerpt.php', |
| 574 |
'tab' => 'widget' |
| 575 |
], |
| 576 |
'post_title' => [ |
| 577 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Title_Widget', |
| 578 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-title/post-title.php', |
| 579 |
'tab' => 'widget' |
| 580 |
], |
| 581 |
'post_content' => [ |
| 582 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_content_Widget', |
| 583 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-content/post-content.php', |
| 584 |
'tab' => 'widget' |
| 585 |
], |
| 586 |
'featured_image' => [ |
| 587 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_free_Featured_Image_Widget', |
| 588 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/featured-image/featured-image.php', |
| 589 |
'tab' => 'widget' |
| 590 |
], |
| 591 |
'post_meta' => [ |
| 592 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Meta_Widget', |
| 593 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-meta/post-meta.php', |
| 594 |
'tab' => 'widget' |
| 595 |
], |
| 596 |
'post_pagination' => [ |
| 597 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Pagination_Widget', |
| 598 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-pagination/post-pagination.php', |
| 599 |
'tab' => 'widget' |
| 600 |
], |
| 601 |
'post_comments' => [ |
| 602 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Comments_Widget', |
| 603 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-comments/post-comments.php', |
| 604 |
'tab' => 'widget' |
| 605 |
], |
| 606 |
'post_tags' => [ |
| 607 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Tags_Widget', |
| 608 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-tag/post-tag.php', |
| 609 |
'tab' => 'widget' |
| 610 |
], |
| 611 |
'post_author' => [ |
| 612 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Post_Author_Info_Widget', |
| 613 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/post-author/post-author.php', |
| 614 |
'tab' => 'widget' |
| 615 |
], |
| 616 |
'archive_post' => [ |
| 617 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Free_Archive_Post__Widget', |
| 618 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/archive-post/archive-post.php', |
| 619 |
'tab' => 'widget', |
| 620 |
], |
| 621 |
'login_register' => [ |
| 622 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Login_Register_Widget', |
| 623 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/login-register/login-register.php', |
| 624 |
'tab' => 'widget', |
| 625 |
], |
| 626 |
'feature_list' => [ |
| 627 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Feature_List__Widget', |
| 628 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/feature-list/feature-list.php', |
| 629 |
'tab' => 'widget', |
| 630 |
], |
| 631 |
'single_navigation_menu' => [ |
| 632 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_Single_Nav_Widget', |
| 633 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/single-nav/single-nav.php', |
| 634 |
'tab' => 'widget', |
| 635 |
], |
| 636 |
'vertical_navigation_menu' => [ |
| 637 |
'class' => '\Easyel\EasyElements\Widgets\Easyel_vertical_Menu_Widget', |
| 638 |
'file' => EASYELEMENTS_DIR_PATH . '/widgets/vertical-menu/vertical-menu-widget.php', |
| 639 |
'tab' => 'widget', |
| 640 |
] |
| 641 |
]; |
| 642 |
|
| 643 |
foreach ( $widgets as $key => $data ) { |
| 644 |
$option_name = 'easy_element_' . $data['tab'] . '_' . $key; |
| 645 |
$enabled = get_option( $option_name, '1' ); |
| 646 |
|
| 647 |
if ( 1 !== ( int ) $enabled ) { |
| 648 |
continue; // Skip disabled widgets |
| 649 |
} |
| 650 |
|
| 651 |
if ( file_exists( $data['file'] ) ) { |
| 652 |
require_once $data['file']; |
| 653 |
|
| 654 |
if ( class_exists( $data['class'] ) ) { |
| 655 |
$widgets_manager->register( new $data['class']() ); |
| 656 |
} |
| 657 |
} |
| 658 |
} |
| 659 |
} |
| 660 |
|
| 661 |
public function easyel_setting_page_link( $links ) { |
| 662 |
$action_link = sprintf("<a href='%s'>%s</a>",admin_url('admin.php?page=easy-elements-dashboard'),__('Settings','easy-elements')); |
| 663 |
array_push( $links,$action_link ); |
| 664 |
return $links; |
| 665 |
} |
| 666 |
|
| 667 |
} |
| 668 |
|
| 669 |
Easyel_Elements_Elementor_Extension::instance(); |