Elementor Essential Addons - Version 2.9.2

Version Description

  • Few minor bugfix and improvements
Download this release

Release Info

Developer re_enter_rupok
Plugin Icon 128x128 Elementor Essential Addons
Version 2.9.2
Comparing to
See all releases

Code changes from version 2.9.1 to 2.9.2

admin/assets/css/admin.css CHANGED
@@ -601,4 +601,7 @@ textarea.eael-form-control {
601
  }
602
  #eael_plugins_versions {
603
  height: 36px;
 
 
 
604
  }
601
  }
602
  #eael_plugins_versions {
603
  height: 36px;
604
+ }
605
+ .eael-notice-text {
606
+ padding-left: 10px;
607
  }
admin/assets/css/eael-notice.css CHANGED
@@ -74,6 +74,9 @@
74
  top: -2px;
75
  }
76
 
 
 
 
77
  .wpdeveloper-upsale-notice .wpdeveloper-notice-message {
78
  display: flex;
79
  align-items: center;
74
  top: -2px;
75
  }
76
 
77
+ .wpdeveloper-notice-message {
78
+ padding: 10px 0;
79
+ }
80
  .wpdeveloper-upsale-notice .wpdeveloper-notice-message {
81
  display: flex;
82
  align-items: center;
admin/partials/version-control.php CHANGED
@@ -44,7 +44,7 @@
44
  </g>
45
  </svg>
46
  </div>
47
- <h5 class="eael-admin-title">Warning: Please backup your database before making the rollback.</h5>
48
  </div>
49
  </div>
50
  </div>
44
  </g>
45
  </svg>
46
  </div>
47
+ <p class="eael-notice-text">Usually you should not loose any data on the rollback process. But it's always good to have a backup of your database.</p>
48
  </div>
49
  </div>
50
  </div>
admin/settings.php CHANGED
File without changes
assets/css/essential-addons-elementor.css CHANGED
@@ -7444,6 +7444,3 @@ a.eael-gallery-load-more, a.eael-gallery-load-more:hover {
7444
  transform: none;
7445
  }
7446
  }
7447
- .elementor-section .elementor-container {
7448
- z-index: 99;
7449
- }
7444
  transform: none;
7445
  }
7446
  }
 
 
 
assets/js/eael-scripts.js CHANGED
File without changes
assets/sass/_progress-bar.scss CHANGED
File without changes
assets/sass/_woo-products.scss CHANGED
File without changes
assets/sass/essential-addons-elementor.scss CHANGED
File without changes
elements/filterable-gallery/filterable-gallery.php CHANGED
File without changes
elements/product-grid/product-grid.php CHANGED
File without changes
essential_adons_elementor.php CHANGED
@@ -4,7 +4,7 @@
4
  * Description: The ultimate elements library for Elementor page builder plugin for WordPress.
5
  * Plugin URI: https://essential-addons.com/elementor/
6
  * Author: WPDeveloper
7
- * Version: 2.9.1
8
  * Author URI: https://wpdeveloper.net/
9
  *
10
  * Text Domain: essential-addons-elementor
@@ -16,8 +16,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
  define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) );
17
  define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) );
18
  define( 'ESSENTIAL_ADDONS_EL_ROOT', __FILE__ );
19
- define( 'ESSENTIAL_ADDONS_VERSION', '2.9.0' );
20
- define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.0' );
21
  define( 'ESSENTIAL_ADDONS_BASENAME', plugin_basename( __FILE__ ) );
22
 
23
 
@@ -369,4 +369,5 @@ function eael_init() {
369
  add_action( 'admin_notices', 'eael_is_failed_to_load' );
370
  }
371
  }
372
- add_action( 'plugins_loaded', 'eael_init' );
 
4
  * Description: The ultimate elements library for Elementor page builder plugin for WordPress.
5
  * Plugin URI: https://essential-addons.com/elementor/
6
  * Author: WPDeveloper
7
+ * Version: 2.9.2
8
  * Author URI: https://wpdeveloper.net/
9
  *
10
  * Text Domain: essential-addons-elementor
16
  define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) );
17
  define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) );
18
  define( 'ESSENTIAL_ADDONS_EL_ROOT', __FILE__ );
19
+ define( 'ESSENTIAL_ADDONS_VERSION', '2.9.1' );
20
+ define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.1' );
21
  define( 'ESSENTIAL_ADDONS_BASENAME', plugin_basename( __FILE__ ) );
22
 
23
 
369
  add_action( 'admin_notices', 'eael_is_failed_to_load' );
370
  }
371
  }
372
+ add_action( 'plugins_loaded', 'eael_init' );
373
+ require_once dirname( __FILE__ ) . '/includes/class-wpdev-notices.php';
includes/class-plugin-usage-tracker.php CHANGED
@@ -85,7 +85,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
85
  // add_action( 'admin_init', array( $this, 'do_tracking' ) );
86
 
87
  // Display the admin notice on activation
88
- // add_action( 'wpdeveloper_optin_notice', array( $this, 'optin_notice' ) );
89
  add_action( 'admin_notices', array( $this, 'marketing_notice' ) );
90
 
91
  // Deactivation
@@ -622,10 +622,9 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
622
  $notice_text = __( 'Want to help make <strong>Essential Addons for Elementor</strong> even more awesome? You can get a <strong>25% discount coupon</strong> for Pro upgrade if you allow. <a class="insights-data-we-collect" href="#">What we collect.</a>', 'plugin-usage-tracker' );
623
  }
624
  // And we allow you to filter the text anyway
625
- // ob_start();
626
  $notice_text = apply_filters( 'wisdom_notice_text_' . esc_attr( $this->plugin_name ), $notice_text ); ?>
627
 
628
- <!-- <div class="notice notice-info updated put-dismiss-notice"> -->
629
  <p><?php echo __( $notice_text ); ?></p>
630
  <div class="eael-insights-data" style="display: none;">
631
  <p><?php echo __( 'We collect non-sensitive diagnostic data and plugin usage information. Your site URL, WordPress & PHP version, plugins & themes and email address to send you the discount coupon. This data lets us make sure this plugin always stays compatible with the most popular plugins and themes. No spam, I promise.' ); ?></p>
@@ -639,13 +638,10 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
639
  jQuery('.eael-insights-data').slideToggle('fast');
640
  });
641
  </script>";?>
642
- <!-- </div> -->
643
  <?php
644
- // echo ob_get_clean();
645
  }
646
-
647
  }
648
-
649
  /**
650
  * Display the marketing notice to users if enabled
651
  * Only displays after the user has opted in to tracking
85
  // add_action( 'admin_init', array( $this, 'do_tracking' ) );
86
 
87
  // Display the admin notice on activation
88
+ add_action( 'wpdeveloper_notices', array( $this, 'optin_notice' ) );
89
  add_action( 'admin_notices', array( $this, 'marketing_notice' ) );
90
 
91
  // Deactivation
622
  $notice_text = __( 'Want to help make <strong>Essential Addons for Elementor</strong> even more awesome? You can get a <strong>25% discount coupon</strong> for Pro upgrade if you allow. <a class="insights-data-we-collect" href="#">What we collect.</a>', 'plugin-usage-tracker' );
623
  }
624
  // And we allow you to filter the text anyway
 
625
  $notice_text = apply_filters( 'wisdom_notice_text_' . esc_attr( $this->plugin_name ), $notice_text ); ?>
626
 
627
+ <div class="notice notice-info updated put-dismiss-notice">
628
  <p><?php echo __( $notice_text ); ?></p>
629
  <div class="eael-insights-data" style="display: none;">
630
  <p><?php echo __( 'We collect non-sensitive diagnostic data and plugin usage information. Your site URL, WordPress & PHP version, plugins & themes and email address to send you the discount coupon. This data lets us make sure this plugin always stays compatible with the most popular plugins and themes. No spam, I promise.' ); ?></p>
638
  jQuery('.eael-insights-data').slideToggle('fast');
639
  });
640
  </script>";?>
641
+ </div>
642
  <?php
 
643
  }
 
644
  }
 
645
  /**
646
  * Display the marketing notice to users if enabled
647
  * Only displays after the user has opted in to tracking
includes/class-wpdev-core-install.php CHANGED
@@ -23,14 +23,6 @@ if ( ! class_exists( 'WPDeveloper_Core_Installer' ) ) :
23
  }
24
  add_action( 'wp_ajax_wpdeveloper_upsale_core_install', array( $this, 'core_install' ) );
25
  }
26
- /**
27
- * Show the plugin installation notice
28
- *
29
- * @return void
30
- */
31
-
32
-
33
-
34
  /**
35
  * Fail if plugin installtion/activation fails
36
  *
@@ -45,7 +37,7 @@ if ( ! class_exists( 'WPDeveloper_Core_Installer' ) ) :
45
  }
46
 
47
  /**
48
- * Install WPSP
49
  *
50
  * @return void
51
  */
@@ -68,7 +60,6 @@ if ( ! class_exists( 'WPDeveloper_Core_Installer' ) ) :
68
 
69
  wp_send_json_success();
70
  }
71
-
72
  /**
73
  * Install and activate a plugin
74
  *
23
  }
24
  add_action( 'wp_ajax_wpdeveloper_upsale_core_install', array( $this, 'core_install' ) );
25
  }
 
 
 
 
 
 
 
 
26
  /**
27
  * Fail if plugin installtion/activation fails
28
  *
37
  }
38
 
39
  /**
40
+ * Install Upsale Plugin
41
  *
42
  * @return void
43
  */
60
 
61
  wp_send_json_success();
62
  }
 
63
  /**
64
  * Install and activate a plugin
65
  *
includes/class-wpdev-notices.php CHANGED
@@ -6,10 +6,9 @@ class WPDeveloper_Notice {
6
  * @var array
7
  */
8
  const ADMIN_UPDATE_NOTICE_KEY = 'wpdeveloper_notices_seen';
9
- public $redirect_url = '/wp-admin';
10
  /**
11
  * All Data
12
- *
13
  * @var array
14
  */
15
  private $data = array();
@@ -26,29 +25,23 @@ class WPDeveloper_Notice {
26
  */
27
  public $cne_time = '2 day';
28
  public $maybe_later_time = '7 day';
29
- /**
30
- * Is the notice is dismissible?
31
- *
32
- * @var boolean
33
- */
34
- private $is_dismissible = true;
35
  /**
36
  * Plugin Name
37
  *
38
  * @var string
39
  */
40
  private $plugin_name;
 
 
 
 
 
41
  /**
42
  * First Install Version Of The Plugin
43
  *
44
  * @var string
45
  */
46
  private $version;
47
- /**
48
- * URL Data Args
49
- * @var array
50
- */
51
- private $data_args;
52
  /**
53
  * Saved Data in DB
54
  * @var array
@@ -66,7 +59,6 @@ class WPDeveloper_Notice {
66
  */
67
  public $options_args = array(
68
  // 'first_install' => true,
69
- // 'next_notice_time' => '',
70
  // 'notice_seen' => [
71
  // 'opt_in' => false,
72
  // 'first_install' => false,
@@ -98,26 +90,31 @@ class WPDeveloper_Notice {
98
  * @param string $plugin_name
99
  * @param string $version
100
  */
101
- public function __construct( $plugin_name = '', $version = '' ) {
102
- $this->plugin_name = $plugin_name;
 
103
  $this->version = $version;
104
  $this->timestamp = current_time( 'timestamp' );
105
  $this->notice_id = 'wpdeveloper_notice_' . str_replace( '.', '_', $this->version );
106
 
107
- require dirname( __FILE__ ) . '/class-wpdev-core-install.php';
108
-
109
- if ( ! function_exists( 'get_plugins' ) ) {
110
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
111
- }
112
- if( ! function_exists( 'wp_get_current_user' ) ) {
113
- require_once ABSPATH . 'wp-includes/pluggable.php';
114
  }
115
  }
116
-
 
 
 
117
  public function init(){
118
- add_action( 'activate_' . $this->plugin_name, array( $this, 'first_install_track' ) );
119
- add_action( 'upgrader_process_complete', array( $this, 'upgrade_completed' ), 10, 2);
120
  add_action( 'deactivate_' . $this->plugin_name, array( $this, 'first_install_end' ) );
 
 
 
 
 
 
 
121
  add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss', array( $this, 'upsale_notice_dissmiss' ) );
122
  add_action( 'wpdeveloper_before_notice', array( $this, 'before' ) );
123
  add_action( 'wpdeveloper_after_notice', array( $this, 'after' ) );
@@ -125,10 +122,18 @@ class WPDeveloper_Notice {
125
  add_action( 'wpdeveloper_after_upsale_notice', array( $this, 'after' ) );
126
  add_action( 'wpdeveloper_notices', array( $this, 'content' ) );
127
  if( current_user_can( 'install_plugins' ) ) {
128
- $this->clicked();
 
 
 
 
 
 
129
  $current_notice = $this->next_notice();
 
130
  $deserve_notice = $this->deserve_notice( $current_notice );
131
  $options_data = $this->get_options_data();
 
132
 
133
  $notice_time = isset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] )
134
  ? $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] : $this->timestamp;
@@ -167,16 +172,26 @@ class WPDeveloper_Notice {
167
  }
168
  }
169
  }
170
-
171
  }
172
-
173
  }
174
-
 
 
 
 
 
175
  public function makeTime( $current, $time ) {
176
  return strtotime( date('Y-m-d H:i:s', $current) . " +$time" );
177
  }
178
-
 
 
 
 
179
  private function maybe_later( $notice ){
 
 
 
180
  $options_data = $this->get_options_data();
181
  $options_data[ $this->plugin_name ]['notice_will_show'][ $notice ] = $this->makeTime( $this->timestamp, $this->maybe_later_time );
182
  $this->update_options_data( $options_data[ $this->plugin_name ] );
@@ -186,19 +201,23 @@ class WPDeveloper_Notice {
186
  * @return void
187
  */
188
  public function clicked(){
189
- if( ! isset( $_GET['notice_action'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wpdeveloper-nonce' ) ) {
190
- return;
191
- }
192
- if( isset( $_GET['notice_action'] ) && $_GET['notice_action'] === $this->plugin_name ) {
193
  $options_data = $this->get_options_data();
194
  $clicked_from = $this->next_notice();
195
  extract($_GET);
196
 
197
  $later_time = '';
198
 
 
 
 
199
  switch( $clicked_from ) {
200
 
201
  case 'opt_in' :
 
202
  $later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
203
  break;
204
 
@@ -217,7 +236,6 @@ class WPDeveloper_Notice {
217
  case 'upsale' :
218
  $later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
219
  break;
220
-
221
  }
222
 
223
  if( isset( $later ) && $later == true ) {
@@ -229,13 +247,34 @@ class WPDeveloper_Notice {
229
  $user_notices = [];
230
  }
231
  $user_notices[ $this->notice_id ][ $this->plugin_name ][] = $clicked_from;
232
-
233
  update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
234
  }
235
  $this->update_options_data( $options_data[ $this->plugin_name ] );
236
- wp_safe_redirect( $this->redirect_url );
237
  }
238
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  /**
240
  * Before Notice
241
  * @return void
@@ -273,8 +312,6 @@ class WPDeveloper_Notice {
273
  switch( $notice ) {
274
  case 'opt_in' :
275
  do_action('wpdeveloper_optin_notice');
276
- $this->get_thumbnail( 'opt_in' );
277
- $this->get_message( 'opt_in' );
278
  break;
279
  case 'first_install' :
280
  if( $options_data[ $this->plugin_name ]['first_install'] !== 'deactivated' ) {
@@ -306,6 +343,9 @@ class WPDeveloper_Notice {
306
  }
307
  echo '<div class="error notice is-dismissible wpdeveloper-upsale-notice '. $classes .'">';
308
  }
 
 
 
309
  public function upsale_notice(){
310
  do_action( 'wpdeveloper_before_upsale_notice' );
311
  do_action('wpdeveloper_upsale_notice');
@@ -314,19 +354,23 @@ class WPDeveloper_Notice {
314
  do_action( 'wpdeveloper_after_upsale_notice' );
315
  $this->upsale_button_script();
316
  }
317
-
 
 
 
318
  private function get_upsale_args(){
319
- return $this->upsale_args;
320
  }
321
-
 
 
322
  private function upsale_button(){
323
  $upsale_args = $this->get_upsale_args();
324
  $plugin_slug = ( isset( $upsale_args['slug'] )) ? $upsale_args['slug'] : '' ;
325
  if( empty( $plugin_slug ) ) {
326
  return;
327
  }
328
-
329
- echo '<button data-slug="'. $plugin_slug .'" id="plugin-install-core" class="button button-primary">'. __( 'Install Now!' ) .'</button>';
330
  }
331
  /**
332
  * This methods is responsible for get notice image.
@@ -358,7 +402,6 @@ class WPDeveloper_Notice {
358
  }
359
  return false;
360
  }
361
-
362
  /**
363
  * This method is responsible for get messages.
364
  *
@@ -388,7 +431,6 @@ class WPDeveloper_Notice {
388
  } else {
389
  $return_notice = $options_data[ $this->plugin_name ]['notice_will_show'];
390
  }
391
-
392
  $deserve_notice_timestamp = INF;
393
  $deserve_notice = '';
394
  foreach( $return_notice as $notice => $timestamp ) {
@@ -399,7 +441,11 @@ class WPDeveloper_Notice {
399
  }
400
  return $deserve_notice;
401
  }
402
-
 
 
 
 
403
  private function deserve_notice( $notice ) {
404
  $notices = $this->get_user_notices();
405
  if( empty( $notices ) ) {
@@ -408,18 +454,25 @@ class WPDeveloper_Notice {
408
  if( isset( $notices[ $this->notice_id ] ) && isset( $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
409
  if( in_array( $notice, $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
410
  return false;
 
 
411
  }
412
  } else {
413
  return true;
414
  }
415
  }
416
  }
417
-
418
  /**
419
  * This is the main methods for generate the notice.
420
  * @return void
421
  */
422
  public function admin_notices(){
 
 
 
 
 
 
423
  do_action( 'wpdeveloper_before_notice' );
424
  do_action( 'wpdeveloper_notices' );
425
  do_action( 'wpdeveloper_after_notice' );
@@ -447,7 +500,7 @@ class WPDeveloper_Notice {
447
  foreach( $link_value['data_args'] as $key => $args_value ) {
448
  $data_args[ $key ] = $args_value;
449
  }
450
- $data_args[ 'notice_action' ] = $this->plugin_name;
451
  $normal_link = add_query_arg( $data_args, $link );
452
  $link = wp_nonce_url( $normal_link, 'wpdeveloper-nonce' );
453
  }
@@ -476,19 +529,22 @@ class WPDeveloper_Notice {
476
  }
477
  /**
478
  * First Installation Track
479
- *
480
  * @return void
481
  */
482
  public function first_install_track( $args = array() ){
 
 
 
483
  if( empty( $args ) ) {
484
  $args = array(
485
  'time' => $this->timestamp,
 
486
  );
487
  }
488
  $options_data = $this->get_options_data();
489
  $args = wp_parse_args( $args, $this->get_args() );
490
-
491
- if( ! isset( $options_data[ $this->plugin_name ] ) ) {
492
  $this->update_options_data( $args );
493
  }
494
  }
@@ -558,7 +614,11 @@ class WPDeveloper_Notice {
558
  $this->data[ $name ][ $values[0] ] = $values[1];
559
  }
560
  }
561
-
 
 
 
 
562
  private function get_args( $key = '' ){
563
  if( empty( $key ) ) {
564
  return $this->options_args;
@@ -570,18 +630,37 @@ class WPDeveloper_Notice {
570
 
571
  return false;
572
  }
573
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
  public function upgrade_completed( $upgrader_object, $options ) {
575
  // If an update has taken place and the updated type is plugins and the plugins element exists
576
- if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
577
- // Iterate through the plugins being updated and check if ours is there
578
- foreach( $options['plugins'] as $plugin ) {
579
- if( $plugin == $this->plugin_name ) {
580
- $this->first_install_track( array(
581
- 'update_time' => $this->timestamp
582
- ) );
583
  }
584
  }
 
 
 
 
585
  }
586
  }
587
  /**
@@ -591,25 +670,32 @@ class WPDeveloper_Notice {
591
  private function get_user_notices() {
592
  return get_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, true );
593
  }
594
-
 
 
 
595
  public function upsale_notice_dissmiss(){
596
- $dismiss = isset( $_POST['dismiss'] ) ? $_POST['dismiss'] : false;
597
-
598
  if( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'wpdeveloper_upsale_notice_dissmiss' ) ) {
599
  return;
600
  }
601
-
602
  if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_upsale_notice_dissmiss' ) ) {
603
  return;
604
  }
605
 
 
606
  if( $dismiss ) {
607
  $user_notices = $this->get_user_notices();
608
  if( ! $user_notices ) {
609
  $user_notices = [];
610
  }
611
  $user_notices[ $this->notice_id ][ $this->plugin_name ][] = 'upsale';
612
-
 
 
 
 
613
  update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
614
  echo 'success';
615
  } else {
@@ -617,7 +703,12 @@ class WPDeveloper_Notice {
617
  }
618
  die();
619
  }
620
-
 
 
 
 
 
621
  public function upsale_button_script(){
622
  $upsale_args = $this->get_upsale_args();
623
 
@@ -752,10 +843,9 @@ $notice->thumbnail( 'review', plugins_url( 'admin/assets/images/ea-logo.svg', ES
752
 
753
  /**
754
  * Current Notice End Time.
755
- * Notice will dismiss in 1 days if user does nothing.
756
  */
757
  $notice->cne_time = '3 Day';
758
- $notice->redirect_url = admin_url( 'admin.php?page=eael-settings' );
759
  /**
760
  * Current Notice Maybe Later Time.
761
  * Notice will show again in 7 days
@@ -768,12 +858,16 @@ $notice->upsale_args = array(
768
  'file' => 'wp-scheduled-posts.php'
769
  );
770
 
 
 
771
  $notice->options_args = array(
772
  'notice_seen' => [
773
  'review' => false,
774
  'upsale' => false,
 
775
  ],
776
  'notice_will_show' => [
 
777
  'review' => $notice->makeTime( $notice->timestamp, '4 Day' ), // after 4 days
778
  'upsale' => $notice->makeTime( $notice->timestamp, '2 Hour' ), // will be after 2 hours
779
  ]
6
  * @var array
7
  */
8
  const ADMIN_UPDATE_NOTICE_KEY = 'wpdeveloper_notices_seen';
9
+ public $text_domain = 'wpdeveloper-notice-text-domain';
10
  /**
11
  * All Data
 
12
  * @var array
13
  */
14
  private $data = array();
25
  */
26
  public $cne_time = '2 day';
27
  public $maybe_later_time = '7 day';
 
 
 
 
 
 
28
  /**
29
  * Plugin Name
30
  *
31
  * @var string
32
  */
33
  private $plugin_name;
34
+ /**
35
+ * Plugin File Name
36
+ * @var string
37
+ */
38
+ private $plugin_file;
39
  /**
40
  * First Install Version Of The Plugin
41
  *
42
  * @var string
43
  */
44
  private $version;
 
 
 
 
 
45
  /**
46
  * Saved Data in DB
47
  * @var array
59
  */
60
  public $options_args = array(
61
  // 'first_install' => true,
 
62
  // 'notice_seen' => [
63
  // 'opt_in' => false,
64
  // 'first_install' => false,
90
  * @param string $plugin_name
91
  * @param string $version
92
  */
93
+ public function __construct( $plugin_file = '', $version = '' ) {
94
+ $this->plugin_file = $plugin_file;
95
+ $this->plugin_name = basename( $plugin_file, '.php' );
96
  $this->version = $version;
97
  $this->timestamp = current_time( 'timestamp' );
98
  $this->notice_id = 'wpdeveloper_notice_' . str_replace( '.', '_', $this->version );
99
 
100
+ if( ! class_exists( 'WPDeveloper_Core_Installer' ) ) {
101
+ require_once dirname( __FILE__ ) . '/class-wpdev-core-install.php';
 
 
 
 
 
102
  }
103
  }
104
+ /**
105
+ * Initiate The Plugin
106
+ * @return void
107
+ */
108
  public function init(){
109
+ add_action( 'init', array( $this, 'first_install_track') );
 
110
  add_action( 'deactivate_' . $this->plugin_name, array( $this, 'first_install_end' ) );
111
+ add_action( 'init', array( $this, 'hooks' ) );
112
+ }
113
+ /**
114
+ * All Hooks
115
+ * @return void
116
+ */
117
+ public function hooks(){
118
  add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss', array( $this, 'upsale_notice_dissmiss' ) );
119
  add_action( 'wpdeveloper_before_notice', array( $this, 'before' ) );
120
  add_action( 'wpdeveloper_after_notice', array( $this, 'after' ) );
122
  add_action( 'wpdeveloper_after_upsale_notice', array( $this, 'after' ) );
123
  add_action( 'wpdeveloper_notices', array( $this, 'content' ) );
124
  if( current_user_can( 'install_plugins' ) ) {
125
+ add_action( 'wpdeveloper_notice_clicked', array( $this, 'clicked' ) );
126
+ if( isset( $_GET['plugin'] ) ) {
127
+ /**
128
+ * Redirect User To the Current URL, but without set query arguments.
129
+ */
130
+ wp_safe_redirect( $this->redirect_to() );
131
+ }
132
  $current_notice = $this->next_notice();
133
+
134
  $deserve_notice = $this->deserve_notice( $current_notice );
135
  $options_data = $this->get_options_data();
136
+ $user_notices = $this->get_user_notices();
137
 
138
  $notice_time = isset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] )
139
  ? $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] : $this->timestamp;
172
  }
173
  }
174
  }
 
175
  }
 
176
  }
177
+ /**
178
+ * Make time using timestamp and a string like 2 Hour, 2 Day, 30 Minutes, 1 Week, 1 year
179
+ * @param integer $current
180
+ * @param string $time
181
+ * @return integer
182
+ */
183
  public function makeTime( $current, $time ) {
184
  return strtotime( date('Y-m-d H:i:s', $current) . " +$time" );
185
  }
186
+ /**
187
+ * Automatice Maybe Later.
188
+ * @param string $notice
189
+ * @return void
190
+ */
191
  private function maybe_later( $notice ){
192
+ if( empty( $notice ) ) {
193
+ return;
194
+ }
195
  $options_data = $this->get_options_data();
196
  $options_data[ $this->plugin_name ]['notice_will_show'][ $notice ] = $this->makeTime( $this->timestamp, $this->maybe_later_time );
197
  $this->update_options_data( $options_data[ $this->plugin_name ] );
201
  * @return void
202
  */
203
  public function clicked(){
204
+ // if( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wpdeveloper-nonce' ) ) {
205
+ // return;
206
+ // }
207
+ if( isset( $_GET['plugin'] ) && $_GET['plugin'] === $this->plugin_name ) {
208
  $options_data = $this->get_options_data();
209
  $clicked_from = $this->next_notice();
210
  extract($_GET);
211
 
212
  $later_time = '';
213
 
214
+ // dump( $_GET );
215
+ // die;
216
+
217
  switch( $clicked_from ) {
218
 
219
  case 'opt_in' :
220
+ $dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
221
  $later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
222
  break;
223
 
236
  case 'upsale' :
237
  $later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
238
  break;
 
239
  }
240
 
241
  if( isset( $later ) && $later == true ) {
247
  $user_notices = [];
248
  }
249
  $user_notices[ $this->notice_id ][ $this->plugin_name ][] = $clicked_from;
250
+ unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $clicked_from ] );
251
  update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
252
  }
253
  $this->update_options_data( $options_data[ $this->plugin_name ] );
 
254
  }
255
  }
256
+ /**
257
+ * For Redirecting Current Page without Arguments!
258
+ *
259
+ * @return void
260
+ */
261
+ private function redirect_to(){
262
+ $request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
263
+ $query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
264
+ parse_str( $query_string, $current_url );
265
+
266
+ $unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later', 'plugin_action' );
267
+
268
+ foreach( $unset_array as $value ) {
269
+ if( isset( $current_url[ $value ] ) ) {
270
+ unset( $current_url[ $value ] );
271
+ }
272
+ }
273
+
274
+ $current_url = http_build_query($current_url);
275
+ $redirect_url = $request_uri . '?' . $current_url;
276
+ return $redirect_url;
277
+ }
278
  /**
279
  * Before Notice
280
  * @return void
312
  switch( $notice ) {
313
  case 'opt_in' :
314
  do_action('wpdeveloper_optin_notice');
 
 
315
  break;
316
  case 'first_install' :
317
  if( $options_data[ $this->plugin_name ]['first_install'] !== 'deactivated' ) {
343
  }
344
  echo '<div class="error notice is-dismissible wpdeveloper-upsale-notice '. $classes .'">';
345
  }
346
+ /**
347
+ * Upsale Notice
348
+ */
349
  public function upsale_notice(){
350
  do_action( 'wpdeveloper_before_upsale_notice' );
351
  do_action('wpdeveloper_upsale_notice');
354
  do_action( 'wpdeveloper_after_upsale_notice' );
355
  $this->upsale_button_script();
356
  }
357
+ /**
358
+ * Get upsale arguments.
359
+ * @return void
360
+ */
361
  private function get_upsale_args(){
362
+ return ( empty( $this->upsale_args ) ) ? array() : $this->upsale_args;
363
  }
364
+ /**
365
+ * This function is responsible for making the button visible to the upsale notice.
366
+ */
367
  private function upsale_button(){
368
  $upsale_args = $this->get_upsale_args();
369
  $plugin_slug = ( isset( $upsale_args['slug'] )) ? $upsale_args['slug'] : '' ;
370
  if( empty( $plugin_slug ) ) {
371
  return;
372
  }
373
+ echo '<button data-slug="'. $plugin_slug .'" id="plugin-install-core" class="button button-primary">'. __( 'Install Now!', $this->text_domain ) .'</button>';
 
374
  }
375
  /**
376
  * This methods is responsible for get notice image.
402
  }
403
  return false;
404
  }
 
405
  /**
406
  * This method is responsible for get messages.
407
  *
431
  } else {
432
  $return_notice = $options_data[ $this->plugin_name ]['notice_will_show'];
433
  }
 
434
  $deserve_notice_timestamp = INF;
435
  $deserve_notice = '';
436
  foreach( $return_notice as $notice => $timestamp ) {
441
  }
442
  return $deserve_notice;
443
  }
444
+ /**
445
+ * Which notice is deserve to show in next slot.
446
+ * @param string $notice
447
+ * @return boolean
448
+ */
449
  private function deserve_notice( $notice ) {
450
  $notices = $this->get_user_notices();
451
  if( empty( $notices ) ) {
454
  if( isset( $notices[ $this->notice_id ] ) && isset( $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
455
  if( in_array( $notice, $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
456
  return false;
457
+ } else {
458
+ return true;
459
  }
460
  } else {
461
  return true;
462
  }
463
  }
464
  }
 
465
  /**
466
  * This is the main methods for generate the notice.
467
  * @return void
468
  */
469
  public function admin_notices(){
470
+ $current_notice = $this->next_notice();
471
+ do_action( 'wpdeveloper_notice_clicked' );
472
+ if( $current_notice == 'opt_in' ) {
473
+ do_action( 'wpdeveloper_notices' );
474
+ return;
475
+ }
476
  do_action( 'wpdeveloper_before_notice' );
477
  do_action( 'wpdeveloper_notices' );
478
  do_action( 'wpdeveloper_after_notice' );
500
  foreach( $link_value['data_args'] as $key => $args_value ) {
501
  $data_args[ $key ] = $args_value;
502
  }
503
+ $data_args[ 'plugin' ] = $this->plugin_name;
504
  $normal_link = add_query_arg( $data_args, $link );
505
  $link = wp_nonce_url( $normal_link, 'wpdeveloper-nonce' );
506
  }
529
  }
530
  /**
531
  * First Installation Track
 
532
  * @return void
533
  */
534
  public function first_install_track( $args = array() ){
535
+ if( ! current_user_can( 'manage_options' ) ) {
536
+ return;
537
+ }
538
  if( empty( $args ) ) {
539
  $args = array(
540
  'time' => $this->timestamp,
541
+ 'version' => $this->version,
542
  );
543
  }
544
  $options_data = $this->get_options_data();
545
  $args = wp_parse_args( $args, $this->get_args() );
546
+ if( ! isset( $options_data[ $this->plugin_name ] )
547
+ || ( isset( $options_data[ $this->plugin_name ]['version'] ) && version_compare( $options_data[ $this->plugin_name ]['version'], $this->version, '!=' ) ) ) {
548
  $this->update_options_data( $args );
549
  }
550
  }
614
  $this->data[ $name ][ $values[0] ] = $values[1];
615
  }
616
  }
617
+ /**
618
+ * Get all option arguments.
619
+ * @param string $key
620
+ * @return array
621
+ */
622
  private function get_args( $key = '' ){
623
  if( empty( $key ) ) {
624
  return $this->options_args;
630
 
631
  return false;
632
  }
633
+ /**
634
+ * Resetting data on update.
635
+ * @return void
636
+ */
637
+ private function set_args_on_update(){
638
+ $args = $this->get_args();
639
+ $options_data = $this->get_options_data();
640
+ $set_data = $options_data[ $this->plugin_name ];
641
+ $args = wp_parse_args( $set_data, $args );
642
+ $this->update_options_data( $args );
643
+ }
644
+ /**
645
+ * When upgrade is complete. it will fired.
646
+ * @param WP_Upgrader $upgrader_object
647
+ * @param array $options
648
+ * @return void
649
+ */
650
  public function upgrade_completed( $upgrader_object, $options ) {
651
  // If an update has taken place and the updated type is plugins and the plugins element exists
652
+ if( isset( $options['action'] ) && $options['action'] == 'update' && $options['type'] == 'plugin' ) {
653
+ if( ! isset( $options['plugin'] ) && isset( $options['plugins'] ) ) {
654
+ foreach( $options['plugins'] as $plugin ) {
655
+ if( $plugin == $this->plugin_name ) {
656
+ $this->set_args_on_update();
657
+ }
 
658
  }
659
  }
660
+
661
+ if( isset( $options['plugin'] ) && $options['plugin'] == $this->plugin_name ) {
662
+ $this->set_args_on_update();
663
+ }
664
  }
665
  }
666
  /**
670
  private function get_user_notices() {
671
  return get_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, true );
672
  }
673
+ /**
674
+ * This function is responsible for do action when
675
+ * the dismiss button clicked in upsale notice.
676
+ */
677
  public function upsale_notice_dissmiss(){
678
+
 
679
  if( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'wpdeveloper_upsale_notice_dissmiss' ) ) {
680
  return;
681
  }
682
+
683
  if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_upsale_notice_dissmiss' ) ) {
684
  return;
685
  }
686
 
687
+ $dismiss = isset( $_POST['dismiss'] ) ? $_POST['dismiss'] : false;
688
  if( $dismiss ) {
689
  $user_notices = $this->get_user_notices();
690
  if( ! $user_notices ) {
691
  $user_notices = [];
692
  }
693
  $user_notices[ $this->notice_id ][ $this->plugin_name ][] = 'upsale';
694
+ // Remove the upsale from notice_will_show field in options DB.
695
+ $options_data = $this->get_options_data();
696
+ unset( $options_data[ $this->plugin_name ]['notice_will_show'][ 'upsale' ] );
697
+ $this->update_options_data( $options_data[ $this->plugin_name ] );
698
+ // Set users meta, not to show again current_version notice.
699
  update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
700
  echo 'success';
701
  } else {
703
  }
704
  die();
705
  }
706
+ /**
707
+ * Upsale Button Script.
708
+ * When install button is clicked, it will do its own things.
709
+ * also for dismiss button JS.
710
+ * @return void
711
+ */
712
  public function upsale_button_script(){
713
  $upsale_args = $this->get_upsale_args();
714
 
843
 
844
  /**
845
  * Current Notice End Time.
846
+ * Notice will dismiss in 3 days if user does nothing.
847
  */
848
  $notice->cne_time = '3 Day';
 
849
  /**
850
  * Current Notice Maybe Later Time.
851
  * Notice will show again in 7 days
858
  'file' => 'wp-scheduled-posts.php'
859
  );
860
 
861
+ $notice->text_domain = 'essential-addons-elementor';
862
+
863
  $notice->options_args = array(
864
  'notice_seen' => [
865
  'review' => false,
866
  'upsale' => false,
867
+ 'opt_in' => false,
868
  ],
869
  'notice_will_show' => [
870
+ 'opt_in' => $notice->timestamp,
871
  'review' => $notice->makeTime( $notice->timestamp, '4 Day' ), // after 4 days
872
  'upsale' => $notice->makeTime( $notice->timestamp, '2 Hour' ), // will be after 2 hours
873
  ]
includes/eael-rollback.php CHANGED
@@ -40,6 +40,9 @@ if( ! class_exists('EAEL_Rollback') ) {
40
  * @var array
41
  */
42
  public $versions = [
 
 
 
43
  '2.8.6',
44
  '2.8.5',
45
  '2.8.4',
40
  * @var array
41
  */
42
  public $versions = [
43
+ '2.9.1',
44
+ '2.9.0',
45
+ '2.8.7',
46
  '2.8.6',
47
  '2.8.5',
48
  '2.8.4',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: elementor, elements, addons, elementor addon, elementor widget, page build
4
  Requires at least: 4.0
5
  Tested up to: 5.0.3
6
  Requires PHP: 5.4
7
- Stable tag: 2.9.1
8
  License: GPLv3
9
  License URI: https://opensource.org/licenses/GPL-3.0
10
 
@@ -169,6 +169,10 @@ Your existing elements/content will work with premium version. So you won't lose
169
 
170
  == Changelog ==
171
 
 
 
 
 
172
  = 2.9.1 =
173
 
174
  - Fixed: Conflict with wp_mail function
4
  Requires at least: 4.0
5
  Tested up to: 5.0.3
6
  Requires PHP: 5.4
7
+ Stable tag: 2.9.2
8
  License: GPLv3
9
  License URI: https://opensource.org/licenses/GPL-3.0
10
 
169
 
170
  == Changelog ==
171
 
172
+ = 2.9.2 =
173
+
174
+ - Few minor bugfix and improvements
175
+
176
  = 2.9.1 =
177
 
178
  - Fixed: Conflict with wp_mail function