diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css
index 6d97b0991..645830416 100755
--- a/admin/assets/css/admin.css
+++ b/admin/assets/css/admin.css
@@ -601,4 +601,7 @@ textarea.eael-form-control {
}
#eael_plugins_versions {
height: 36px;
+}
+.eael-notice-text {
+ padding-left: 10px;
}
\ No newline at end of file
diff --git a/admin/assets/css/eael-notice.css b/admin/assets/css/eael-notice.css
index 4c6b2b0d8..2ec4f6391 100755
--- a/admin/assets/css/eael-notice.css
+++ b/admin/assets/css/eael-notice.css
@@ -74,6 +74,9 @@
top: -2px;
}
+.wpdeveloper-notice-message {
+ padding: 10px 0;
+}
.wpdeveloper-upsale-notice .wpdeveloper-notice-message {
display: flex;
align-items: center;
diff --git a/admin/partials/version-control.php b/admin/partials/version-control.php
index e58cbb771..c676a7e58 100755
--- a/admin/partials/version-control.php
+++ b/admin/partials/version-control.php
@@ -44,7 +44,7 @@
-
Usually you should not loose any data on the rollback process. But it's always good to have a backup of your database.
diff --git a/essential_adons_elementor.php b/essential_adons_elementor.php
index 8fbf4cc9a..fd68858d9 100755
--- a/essential_adons_elementor.php
+++ b/essential_adons_elementor.php
@@ -4,7 +4,7 @@
* Description: The ultimate elements library for Elementor page builder plugin for WordPress.
* Plugin URI: https://essential-addons.com/elementor/
* Author: WPDeveloper
- * Version: 2.9.0
+ * Version: 2.9.2
* Author URI: https://wpdeveloper.net/
*
* Text Domain: essential-addons-elementor
@@ -16,8 +16,8 @@
define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) );
define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) );
define( 'ESSENTIAL_ADDONS_EL_ROOT', __FILE__ );
-define( 'ESSENTIAL_ADDONS_VERSION', '2.9.0' );
-define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.0' );
+define( 'ESSENTIAL_ADDONS_VERSION', '2.9.1' );
+define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.1' );
define( 'ESSENTIAL_ADDONS_BASENAME', plugin_basename( __FILE__ ) );
diff --git a/includes/class-plugin-usage-tracker.php b/includes/class-plugin-usage-tracker.php
index 003acd572..723051a97 100755
--- a/includes/class-plugin-usage-tracker.php
+++ b/includes/class-plugin-usage-tracker.php
@@ -85,7 +85,7 @@ public function init() {
// add_action( 'admin_init', array( $this, 'do_tracking' ) );
// Display the admin notice on activation
- // add_action( 'wpdeveloper_optin_notice', array( $this, 'optin_notice' ) );
+ add_action( 'wpdeveloper_notices', array( $this, 'optin_notice' ) );
add_action( 'admin_notices', array( $this, 'marketing_notice' ) );
// Deactivation
@@ -622,10 +622,9 @@ public function optin_notice() {
$notice_text = __( 'Want to help make
@@ -639,13 +638,10 @@ public function optin_notice() {
jQuery('.eael-insights-data').slideToggle('fast');
});
";?>
-
+
true,
- // 'next_notice_time' => '',
// 'notice_seen' => [
// 'opt_in' => false,
// 'first_install' => false,
@@ -98,26 +90,31 @@ class WPDeveloper_Notice {
* @param string $plugin_name
* @param string $version
*/
- public function __construct( $plugin_name = '', $version = '' ) {
- $this->plugin_name = $plugin_name;
+ public function __construct( $plugin_file = '', $version = '' ) {
+ $this->plugin_file = $plugin_file;
+ $this->plugin_name = basename( $plugin_file, '.php' );
$this->version = $version;
$this->timestamp = current_time( 'timestamp' );
$this->notice_id = 'wpdeveloper_notice_' . str_replace( '.', '_', $this->version );
- require dirname( __FILE__ ) . '/class-wpdev-core-install.php';
-
- if ( ! function_exists( 'get_plugins' ) ) {
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
- }
- if( ! function_exists( 'wp_get_current_user' ) ) {
- require_once ABSPATH . 'wp-includes/pluggable.php';
+ if( ! class_exists( 'WPDeveloper_Core_Installer' ) ) {
+ require_once dirname( __FILE__ ) . '/class-wpdev-core-install.php';
}
}
-
+ /**
+ * Initiate The Plugin
+ * @return void
+ */
public function init(){
- add_action( 'activate_' . $this->plugin_name, array( $this, 'first_install_track' ) );
- add_action( 'upgrader_process_complete', array( $this, 'upgrade_completed' ), 10, 2);
+ add_action( 'init', array( $this, 'first_install_track') );
add_action( 'deactivate_' . $this->plugin_name, array( $this, 'first_install_end' ) );
+ add_action( 'init', array( $this, 'hooks' ) );
+ }
+ /**
+ * All Hooks
+ * @return void
+ */
+ public function hooks(){
add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss', array( $this, 'upsale_notice_dissmiss' ) );
add_action( 'wpdeveloper_before_notice', array( $this, 'before' ) );
add_action( 'wpdeveloper_after_notice', array( $this, 'after' ) );
@@ -125,10 +122,18 @@ public function init(){
add_action( 'wpdeveloper_after_upsale_notice', array( $this, 'after' ) );
add_action( 'wpdeveloper_notices', array( $this, 'content' ) );
if( current_user_can( 'install_plugins' ) ) {
- $this->clicked();
+ add_action( 'wpdeveloper_notice_clicked', array( $this, 'clicked' ) );
+ if( isset( $_GET['plugin'] ) ) {
+ /**
+ * Redirect User To the Current URL, but without set query arguments.
+ */
+ wp_safe_redirect( $this->redirect_to() );
+ }
$current_notice = $this->next_notice();
+
$deserve_notice = $this->deserve_notice( $current_notice );
$options_data = $this->get_options_data();
+ $user_notices = $this->get_user_notices();
$notice_time = isset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] )
? $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] : $this->timestamp;
@@ -167,16 +172,26 @@ public function init(){
}
}
}
-
}
-
}
-
+ /**
+ * Make time using timestamp and a string like 2 Hour, 2 Day, 30 Minutes, 1 Week, 1 year
+ * @param integer $current
+ * @param string $time
+ * @return integer
+ */
public function makeTime( $current, $time ) {
return strtotime( date('Y-m-d H:i:s', $current) . " +$time" );
}
-
+ /**
+ * Automatice Maybe Later.
+ * @param string $notice
+ * @return void
+ */
private function maybe_later( $notice ){
+ if( empty( $notice ) ) {
+ return;
+ }
$options_data = $this->get_options_data();
$options_data[ $this->plugin_name ]['notice_will_show'][ $notice ] = $this->makeTime( $this->timestamp, $this->maybe_later_time );
$this->update_options_data( $options_data[ $this->plugin_name ] );
@@ -186,19 +201,23 @@ private function maybe_later( $notice ){
* @return void
*/
public function clicked(){
- if( ! isset( $_GET['notice_action'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wpdeveloper-nonce' ) ) {
- return;
- }
- if( isset( $_GET['notice_action'] ) && $_GET['notice_action'] === $this->plugin_name ) {
+ // if( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wpdeveloper-nonce' ) ) {
+ // return;
+ // }
+ if( isset( $_GET['plugin'] ) && $_GET['plugin'] === $this->plugin_name ) {
$options_data = $this->get_options_data();
$clicked_from = $this->next_notice();
extract($_GET);
$later_time = '';
+ // dump( $_GET );
+ // die;
+
switch( $clicked_from ) {
case 'opt_in' :
+ $dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
@@ -217,7 +236,6 @@ public function clicked(){
case 'upsale' :
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
break;
-
}
if( isset( $later ) && $later == true ) {
@@ -229,13 +247,34 @@ public function clicked(){
$user_notices = [];
}
$user_notices[ $this->notice_id ][ $this->plugin_name ][] = $clicked_from;
-
+ unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $clicked_from ] );
update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
}
$this->update_options_data( $options_data[ $this->plugin_name ] );
- wp_safe_redirect( $this->redirect_url );
}
}
+ /**
+ * For Redirecting Current Page without Arguments!
+ *
+ * @return void
+ */
+ private function redirect_to(){
+ $request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
+ $query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
+ parse_str( $query_string, $current_url );
+
+ $unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later', 'plugin_action' );
+
+ foreach( $unset_array as $value ) {
+ if( isset( $current_url[ $value ] ) ) {
+ unset( $current_url[ $value ] );
+ }
+ }
+
+ $current_url = http_build_query($current_url);
+ $redirect_url = $request_uri . '?' . $current_url;
+ return $redirect_url;
+ }
/**
* Before Notice
* @return void
@@ -273,8 +312,6 @@ public function content(){
switch( $notice ) {
case 'opt_in' :
do_action('wpdeveloper_optin_notice');
- $this->get_thumbnail( 'opt_in' );
- $this->get_message( 'opt_in' );
break;
case 'first_install' :
if( $options_data[ $this->plugin_name ]['first_install'] !== 'deactivated' ) {
@@ -306,6 +343,9 @@ public function before_upsale(){
}
echo '
';
}
+ /**
+ * Upsale Notice
+ */
public function upsale_notice(){
do_action( 'wpdeveloper_before_upsale_notice' );
do_action('wpdeveloper_upsale_notice');
@@ -314,19 +354,23 @@ public function upsale_notice(){
do_action( 'wpdeveloper_after_upsale_notice' );
$this->upsale_button_script();
}
-
+ /**
+ * Get upsale arguments.
+ * @return void
+ */
private function get_upsale_args(){
- return $this->upsale_args;
+ return ( empty( $this->upsale_args ) ) ? array() : $this->upsale_args;
}
-
+ /**
+ * This function is responsible for making the button visible to the upsale notice.
+ */
private function upsale_button(){
$upsale_args = $this->get_upsale_args();
$plugin_slug = ( isset( $upsale_args['slug'] )) ? $upsale_args['slug'] : '' ;
if( empty( $plugin_slug ) ) {
return;
}
-
- echo '';
+ echo '';
}
/**
* This methods is responsible for get notice image.
@@ -358,7 +402,6 @@ protected function has_thumbnail( $msg_for = '' ){
}
return false;
}
-
/**
* This method is responsible for get messages.
*
@@ -388,7 +431,6 @@ protected function next_notice(){
} else {
$return_notice = $options_data[ $this->plugin_name ]['notice_will_show'];
}
-
$deserve_notice_timestamp = INF;
$deserve_notice = '';
foreach( $return_notice as $notice => $timestamp ) {
@@ -399,7 +441,11 @@ protected function next_notice(){
}
return $deserve_notice;
}
-
+ /**
+ * Which notice is deserve to show in next slot.
+ * @param string $notice
+ * @return boolean
+ */
private function deserve_notice( $notice ) {
$notices = $this->get_user_notices();
if( empty( $notices ) ) {
@@ -408,18 +454,25 @@ private function deserve_notice( $notice ) {
if( isset( $notices[ $this->notice_id ] ) && isset( $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
if( in_array( $notice, $notices[ $this->notice_id ][ $this->plugin_name ] ) ) {
return false;
+ } else {
+ return true;
}
} else {
return true;
}
}
}
-
/**
* This is the main methods for generate the notice.
* @return void
*/
public function admin_notices(){
+ $current_notice = $this->next_notice();
+ do_action( 'wpdeveloper_notice_clicked' );
+ if( $current_notice == 'opt_in' ) {
+ do_action( 'wpdeveloper_notices' );
+ return;
+ }
do_action( 'wpdeveloper_before_notice' );
do_action( 'wpdeveloper_notices' );
do_action( 'wpdeveloper_after_notice' );
@@ -447,7 +500,7 @@ public function dismissible_notice( $links_for = '' ){
foreach( $link_value['data_args'] as $key => $args_value ) {
$data_args[ $key ] = $args_value;
}
- $data_args[ 'notice_action' ] = $this->plugin_name;
+ $data_args[ 'plugin' ] = $this->plugin_name;
$normal_link = add_query_arg( $data_args, $link );
$link = wp_nonce_url( $normal_link, 'wpdeveloper-nonce' );
}
@@ -476,19 +529,22 @@ public function dismissible_notice( $links_for = '' ){
}
/**
* First Installation Track
- *
* @return void
*/
public function first_install_track( $args = array() ){
+ if( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
if( empty( $args ) ) {
$args = array(
'time' => $this->timestamp,
+ 'version' => $this->version,
);
}
$options_data = $this->get_options_data();
$args = wp_parse_args( $args, $this->get_args() );
-
- if( ! isset( $options_data[ $this->plugin_name ] ) ) {
+ if( ! isset( $options_data[ $this->plugin_name ] )
+ || ( isset( $options_data[ $this->plugin_name ]['version'] ) && version_compare( $options_data[ $this->plugin_name ]['version'], $this->version, '!=' ) ) ) {
$this->update_options_data( $args );
}
}
@@ -558,7 +614,11 @@ public function __call( $name, $values ){
$this->data[ $name ][ $values[0] ] = $values[1];
}
}
-
+ /**
+ * Get all option arguments.
+ * @param string $key
+ * @return array
+ */
private function get_args( $key = '' ){
if( empty( $key ) ) {
return $this->options_args;
@@ -570,18 +630,37 @@ private function get_args( $key = '' ){
return false;
}
-
+ /**
+ * Resetting data on update.
+ * @return void
+ */
+ private function set_args_on_update(){
+ $args = $this->get_args();
+ $options_data = $this->get_options_data();
+ $set_data = $options_data[ $this->plugin_name ];
+ $args = wp_parse_args( $set_data, $args );
+ $this->update_options_data( $args );
+ }
+ /**
+ * When upgrade is complete. it will fired.
+ * @param WP_Upgrader $upgrader_object
+ * @param array $options
+ * @return void
+ */
public function upgrade_completed( $upgrader_object, $options ) {
// If an update has taken place and the updated type is plugins and the plugins element exists
- if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
- // Iterate through the plugins being updated and check if ours is there
- foreach( $options['plugins'] as $plugin ) {
- if( $plugin == $this->plugin_name ) {
- $this->first_install_track( array(
- 'update_time' => $this->timestamp
- ) );
+ if( isset( $options['action'] ) && $options['action'] == 'update' && $options['type'] == 'plugin' ) {
+ if( ! isset( $options['plugin'] ) && isset( $options['plugins'] ) ) {
+ foreach( $options['plugins'] as $plugin ) {
+ if( $plugin == $this->plugin_name ) {
+ $this->set_args_on_update();
+ }
}
}
+
+ if( isset( $options['plugin'] ) && $options['plugin'] == $this->plugin_name ) {
+ $this->set_args_on_update();
+ }
}
}
/**
@@ -591,25 +670,32 @@ public function upgrade_completed( $upgrader_object, $options ) {
private function get_user_notices() {
return get_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, true );
}
-
+ /**
+ * This function is responsible for do action when
+ * the dismiss button clicked in upsale notice.
+ */
public function upsale_notice_dissmiss(){
- $dismiss = isset( $_POST['dismiss'] ) ? $_POST['dismiss'] : false;
-
+
if( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'wpdeveloper_upsale_notice_dissmiss' ) ) {
return;
}
-
+
if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_upsale_notice_dissmiss' ) ) {
return;
}
+ $dismiss = isset( $_POST['dismiss'] ) ? $_POST['dismiss'] : false;
if( $dismiss ) {
$user_notices = $this->get_user_notices();
if( ! $user_notices ) {
$user_notices = [];
}
$user_notices[ $this->notice_id ][ $this->plugin_name ][] = 'upsale';
-
+ // Remove the upsale from notice_will_show field in options DB.
+ $options_data = $this->get_options_data();
+ unset( $options_data[ $this->plugin_name ]['notice_will_show'][ 'upsale' ] );
+ $this->update_options_data( $options_data[ $this->plugin_name ] );
+ // Set users meta, not to show again current_version notice.
update_user_meta( get_current_user_id(), self::ADMIN_UPDATE_NOTICE_KEY, $user_notices);
echo 'success';
} else {
@@ -617,7 +703,12 @@ public function upsale_notice_dissmiss(){
}
die();
}
-
+ /**
+ * Upsale Button Script.
+ * When install button is clicked, it will do its own things.
+ * also for dismiss button JS.
+ * @return void
+ */
public function upsale_button_script(){
$upsale_args = $this->get_upsale_args();
@@ -752,10 +843,9 @@ public function upsale_button_script(){
/**
* Current Notice End Time.
- * Notice will dismiss in 1 days if user does nothing.
+ * Notice will dismiss in 3 days if user does nothing.
*/
$notice->cne_time = '3 Day';
-$notice->redirect_url = admin_url( 'admin.php?page=eael-settings' );
/**
* Current Notice Maybe Later Time.
* Notice will show again in 7 days
@@ -768,12 +858,16 @@ public function upsale_button_script(){
'file' => 'wp-scheduled-posts.php'
);
+$notice->text_domain = 'essential-addons-elementor';
+
$notice->options_args = array(
'notice_seen' => [
'review' => false,
'upsale' => false,
+ 'opt_in' => false,
],
'notice_will_show' => [
+ 'opt_in' => $notice->timestamp,
'review' => $notice->makeTime( $notice->timestamp, '4 Day' ), // after 4 days
'upsale' => $notice->makeTime( $notice->timestamp, '2 Hour' ), // will be after 2 hours
]
diff --git a/includes/eael-rollback.php b/includes/eael-rollback.php
index da52e3076..d1a7ba491 100755
--- a/includes/eael-rollback.php
+++ b/includes/eael-rollback.php
@@ -40,6 +40,9 @@ final class EAEL_Rollback {
* @var array
*/
public $versions = [
+ '2.9.1',
+ '2.9.0',
+ '2.8.7',
'2.8.6',
'2.8.5',
'2.8.4',
diff --git a/readme.txt b/readme.txt
index 66479cad5..a865907c8 100755
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: elementor, elements, addons, elementor addon, elementor widget, page build
Requires at least: 4.0
Tested up to: 5.0.3
Requires PHP: 5.4
-Stable tag: 2.9.0
+Stable tag: 2.9.2
License: GPLv3
License URI: https://opensource.org/licenses/GPL-3.0
@@ -169,6 +169,14 @@ Your existing elements/content will work with premium version. So you won't lose
== Changelog ==
+= 2.9.2 =
+
+- Few minor bugfix and improvements
+
+= 2.9.1 =
+
+- Fixed: Conflict with wp_mail function
+
= 2.9.0 =
- Added : Section Particles effect