PluginProbe ʕ •ᴥ•ʔ
Essential Addons for Elementor – Popular Elementor Templates & Widgets / 2.7.8
Essential Addons for Elementor – Popular Elementor Templates & Widgets v2.7.8
6.6.5 6.6.4 6.6.3 5.7.3 5.7.4 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.15 5.8.16 5.8.18 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.10 5.9.11 5.9.12 5.9.13 5.9.14 5.9.15 5.9.16 5.9.17 5.9.18 5.9.19 5.9.2 5.9.20 5.9.21 5.9.22 5.9.23 5.9.24 5.9.25 5.9.26 5.9.27 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.14 6.0.15 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.0 6.1.1 6.1.10 6.1.11 trunk 6.1.12 1.0.0 6.1.13 1.0.1 6.1.14 1.1.0 6.1.15 2.0 6.1.17 2.1 6.1.18 2.10.0 6.1.19 2.10.1 6.1.2 2.10.2 6.1.20 2.10.3 6.1.3 2.10.4 6.1.4 2.10.5 6.1.5 2.2.0 6.1.6 2.2.1 6.1.7 2.2.2 6.1.8 2.2.3 6.1.9 2.2.4 6.2.0 2.2.5 6.2.1 2.3.0 6.2.2 2.3.1 6.2.3 2.4.0 6.2.4 2.4.1 6.3.0 2.4.2 6.3.1 2.4.3 6.3.2 2.5.0 6.3.3 2.6.0 6.4.0 2.7.0 6.5.0 2.7.1 6.5.1 2.7.10 6.5.10 2.7.11 6.5.11 2.7.2 6.5.12 2.7.3 6.5.13 2.7.4 6.5.2 2.7.5 6.5.3 2.7.6 6.5.4 2.7.7 6.5.5 2.7.8 6.5.6 2.7.9 6.5.7 2.8.0 6.5.8 2.8.1 6.5.9 2.8.2 6.6.0 2.8.3 6.6.1 2.8.4 6.6.2 2.8.5 2.8.6 2.8.7 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.4.1 3.1.5 3.2.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 5.0.0 5.0.1 5.0.10 5.0.11 5.0.12 5.0.13 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.4.6 5.5.5 5.6.5 5.7.2
essential-addons-for-elementor-lite / essential_adons_elementor.php
essential-addons-for-elementor-lite Last commit date
admin 7 years ago assets 7 years ago elements 7 years ago includes 7 years ago essential_adons_elementor.php 7 years ago readme.txt 7 years ago
essential_adons_elementor.php
503 lines
1 <?php
2 /**
3 * Plugin Name: Essential Addons for Elementor
4 * Description: The ultimate elements library for Elementor page builder plugin for WordPress.
5 * Plugin URI: https://essential-addons.com/elementor/
6 * Author: Codetic
7 * Version: 2.7.8
8 * Author URI: https://www.codetic.net
9 *
10 * Text Domain: essential-addons-elementor
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15 define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) );
16 define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) );
17
18
19 require_once ESSENTIAL_ADDONS_EL_PATH.'includes/elementor-helper.php';
20 require_once ESSENTIAL_ADDONS_EL_PATH.'includes/queries.php';
21 require_once ESSENTIAL_ADDONS_EL_PATH.'includes/class-plugin-usage-tracker.php';
22 require_once ESSENTIAL_ADDONS_EL_PATH.'admin/settings.php';
23
24 /**
25 * This function will return true for all activated modules
26 *
27 * @since v2.4.1
28 */
29 function eael_activated_modules() {
30
31 $eael_default_keys = [ 'contact-form-7', 'count-down', 'creative-btn', 'fancy-text', 'img-comparison', 'instagram-gallery', 'interactive-promo', 'lightbox', 'post-block', 'post-grid', 'post-timeline', 'product-grid', 'team-members', 'testimonial-slider', 'testimonials', 'testimonials', 'weforms', 'static-product', 'call-to-action', 'flip-box', 'info-box', 'dual-header', 'price-table', 'flip-carousel', 'interactive-cards', 'ninja-form', 'gravity-form', 'caldera-form', 'wisdom_registered_setting', 'twitter-feed', 'facebook-feed', 'data-table', 'filter-gallery', 'image-accordion','content-ticker', 'tooltip', 'adv-accordion', 'adv-tabs' ];
32
33 $eael_default_settings = array_fill_keys( $eael_default_keys, true );
34 $eael_get_settings = get_option( 'eael_save_settings', $eael_default_settings );
35 $eael_new_settings = array_diff_key( $eael_default_settings, $eael_get_settings );
36
37 if( ! empty( $eael_new_settings ) ) {
38 $eael_updated_settings = array_merge( $eael_get_settings, $eael_new_settings );
39 update_option( 'eael_save_settings', $eael_updated_settings );
40 }
41
42 return $eael_get_settings = get_option( 'eael_save_settings', $eael_default_settings );
43
44 }
45
46 /**
47 * Acivate or Deactivate Modules
48 *
49 * @since v1.0.0
50 */
51 function add_eael_elements() {
52
53 $is_component_active = eael_activated_modules();
54
55 // load elements
56 if( $is_component_active['post-grid'] ) {
57 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/post-grid/post-grid.php';
58 }
59 if( $is_component_active['post-timeline'] ) {
60 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/post-timeline/post-timeline.php';
61 }
62 if( $is_component_active['fancy-text'] ) {
63 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/fancy-text/fancy-text.php';
64 }
65 if( $is_component_active['creative-btn'] ) {
66 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/creative-button/creative-button.php';
67 }
68 if( $is_component_active['count-down'] ) {
69 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/countdown/countdown.php';
70 }
71 if( $is_component_active['team-members'] ) {
72 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/team-members/team-members.php';
73 }
74 if( $is_component_active['testimonials'] ) {
75 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/testimonials/testimonials.php';
76 }
77
78 if ( function_exists( 'WC' ) && $is_component_active['product-grid'] ) {
79 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/product-grid/product-grid.php';
80 }
81
82 if ( function_exists( 'wpcf7' ) && $is_component_active['contact-form-7'] ) {
83 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/contact-form-7/contact-form-7.php';
84 }
85
86 if ( function_exists( 'WeForms' ) && $is_component_active['weforms'] ) {
87 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/weforms/weforms.php';
88 }
89
90 if( $is_component_active['info-box'] ) {
91 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/infobox/infobox.php';
92 }
93
94 if( $is_component_active['flip-box'] ) {
95 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/flipbox/flipbox.php';
96 }
97
98 if( $is_component_active['call-to-action'] ) {
99 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/call-to-action/call-to-action.php';
100 }
101
102 if( $is_component_active['dual-header'] ) {
103 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/dual-color-header/dual-color-header.php';
104 }
105 if( $is_component_active['price-table'] ) {
106 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/pricing-table/pricing-table.php';
107 }
108 if( function_exists( 'Ninja_Forms' ) && $is_component_active['ninja-form'] ) {
109 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/ninja-form/ninja-form.php';
110 }
111 if( class_exists( 'GFForms' ) && $is_component_active['gravity-form'] ) {
112 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/gravity-form/gravity-form.php';
113 }
114 if( class_exists( 'Caldera_Forms' ) && $is_component_active['caldera-form'] ) {
115 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/caldera-forms/caldera-forms.php';
116 }
117 if( class_exists( 'WPForms' ) && $is_component_active['wpforms'] ) {
118 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/wpforms/wpforms.php';
119 }
120 if( $is_component_active['twitter-feed'] ) {
121 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/twitter-feed/twitter-feed.php';
122 }
123 if( $is_component_active['facebook-feed'] ) {
124 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/facebook-feed/facebook-feed.php';
125 }
126 if( $is_component_active['data-table'] ) {
127 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/data-table/data-table.php';
128 }
129 if( $is_component_active['filter-gallery'] ) {
130 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/filterable-gallery/filterable-gallery.php';
131 }
132 if( $is_component_active['image-accordion'] ) {
133 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/image-accordion/image-accordion.php';
134 }
135 if( $is_component_active['content-ticker'] ) {
136 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/content-ticker/content-ticker.php';
137 }
138 if( $is_component_active['tooltip'] ) {
139 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/tooltip/tooltip.php';
140 }
141 if( $is_component_active['adv-accordion'] ) {
142 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/advance-accordion/advance-accordion.php';
143 }
144 if( $is_component_active['adv-tabs'] ) {
145 require_once ESSENTIAL_ADDONS_EL_PATH.'elements/advance-tabs/advance-tabs.php';
146 }
147 }
148 add_action('elementor/widgets/widgets_registered','add_eael_elements');
149
150 /**
151 * Registering a Group Control for All Posts Element
152 */
153 function eae_posts_register_control( $controls_manager ){
154 include_once ESSENTIAL_ADDONS_EL_PATH . 'includes/eae-posts-group-control.php';
155 $controls_manager->add_group_control( 'eaeposts', new Elementor\EAE_Posts_Group_Control() );
156 }
157
158 add_action( 'elementor/controls/controls_registered', 'eae_posts_register_control' );
159
160 /**
161 * Load module's scripts and styles if any module is active.
162 *
163 * @since v1.0.0
164 */
165 function essential_addons_el_enqueue(){
166 $is_component_active = eael_activated_modules();
167 wp_enqueue_style('essential_addons_elementor-css',ESSENTIAL_ADDONS_EL_URL.'assets/css/essential-addons-elementor.css');
168 wp_enqueue_script('eael-scripts',ESSENTIAL_ADDONS_EL_URL.'assets/js/eael-scripts.js', array('jquery'),'1.0', true);
169 if ( class_exists( 'GFCommon' ) ) {
170 foreach( eael_select_gravity_form() as $form_id => $form_name ){
171 if ( $form_id != '0' ) {
172 gravity_form_enqueue_scripts( $form_id );
173 }
174 };
175 }
176 if ( function_exists( 'wpforms' ) ) {
177 wpforms()->frontend->assets_css();
178 }
179 if( $is_component_active['fancy-text'] ) {
180 wp_enqueue_script('essential_addons_elementor-fancy-text-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/fancy-text.js', array('jquery'),'1.0', true);
181 }
182 if( $is_component_active['count-down'] ) {
183 wp_enqueue_script('essential_addons_elementor-countdown-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/countdown.min.js', array('jquery'),'1.0', true);
184 }
185 if( $is_component_active['post-grid'] || $is_component_active['twitter-feed'] || $is_component_active['facebook-feed'] ) {
186 wp_enqueue_script('essential_addons_elementor-masonry-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/masonry.min.js', array('jquery'),'1.0', true);
187 }
188 if( $is_component_active['post-grid'] || $is_component_active['post-timeline'] ) {
189 wp_enqueue_script('essential_addons_elementor-load-more-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/load-more.js', array('jquery'),'1.0', true);
190 $eael_js_settings = array(
191 'ajaxurl' => admin_url( 'admin-ajax.php' ),
192 );
193 wp_localize_script( 'essential_addons_elementor-load-more-js', 'eaelPostGrid', $eael_js_settings );
194 }
195 if( $is_component_active['twitter-feed']) {
196 wp_enqueue_script('essential_addons_elementor-codebird-js',ESSENTIAL_ADDONS_EL_URL.'assets/social-feeds/codebird.js', array('jquery'),'1.0', true);
197 }
198 if( $is_component_active['twitter-feed'] || $is_component_active['facebook-feed'] ) {
199 wp_enqueue_script('essential_addons_elementor-doT-js',ESSENTIAL_ADDONS_EL_URL.'assets/social-feeds/doT.min.js', array('jquery'),'1.0', true);
200 wp_enqueue_script('essential_addons_elementor-moment-js',ESSENTIAL_ADDONS_EL_URL.'assets/social-feeds/moment.js', array('jquery'),'1.0', true);
201 wp_enqueue_script('essential_addons_elementor-socialfeed-js',ESSENTIAL_ADDONS_EL_URL.'assets/social-feeds/jquery.socialfeed.js', array('jquery'),'1.0', true);
202 }
203
204 if( $is_component_active['filter-gallery'] ) {
205 wp_enqueue_script('essential_addons_mixitup-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/mixitup.min.js', array('jquery'),'1.0', true);
206 wp_enqueue_script('essential_addons_magnific-popup-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/jquery.magnific-popup.min.js', array('jquery'),'1.0', true);
207 }
208
209 if( $is_component_active['price-table'] ) {
210 wp_enqueue_style('essential_addons_elementor-tooltipster',ESSENTIAL_ADDONS_EL_URL.'assets/css/tooltipster.bundle.min.css');
211 wp_enqueue_script('essential_addons_elementor-tooltipster-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/tooltipster.bundle.min.js', array('jquery'),'1.0', true);
212 }
213
214 }
215 add_action( 'wp_enqueue_scripts', 'essential_addons_el_enqueue' );
216
217 /**
218 * Editor Css
219 */
220 add_action( 'elementor/editor/before_enqueue_scripts', function() {
221 wp_register_style( 'essential_addons_elementor_editor-css', ESSENTIAL_ADDONS_EL_URL.'assets/css/essential-addons-editor.css');
222 wp_enqueue_style( 'essential_addons_elementor_editor-css' );
223 } );
224
225 /**
226 * Creates an Action Menu
227 */
228 function eael_add_settings_link( $links ) {
229 $settings_link = sprintf( '<a href="admin.php?page=eael-settings">' . __( 'Settings' ) . '</a>' );
230 $go_pro_link = sprintf( '<a href="https://wpdeveloper.net/in/upgrade-essential-addons-elementor" target="_blank" style="color: #39b54a; font-weight: bold;">' . __( 'Go Pro' ) . '</a>' );
231 array_push( $links, $settings_link, $go_pro_link );
232 return $links;
233 }
234 $plugin = plugin_basename( __FILE__ );
235 add_filter( "plugin_action_links_$plugin", 'eael_add_settings_link' );
236
237 /**
238 * Activation redirects
239 *
240 * @since v1.0.0
241 */
242 function eael_activate() {
243 add_option('eael_do_activation_redirect', true);
244 }
245 register_activation_hook(__FILE__, 'eael_activate');
246
247 /**
248 * Redirect to options page
249 *
250 * @since v1.0.0
251 */
252 function eael_redirect() {
253 if (get_option('eael_do_activation_redirect', false)) {
254 delete_option('eael_do_activation_redirect');
255 if(!isset($_GET['activate-multi']))
256 {
257 wp_redirect("admin.php?page=eael-settings");
258 }
259 }
260 }
261 add_action('admin_init', 'eael_redirect');
262
263 /**
264 * Optional usage tracker
265 *
266 * @since v1.0.0
267 */
268 if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
269 require_once dirname( __FILE__ ) . '/includes/class-plugin-usage-tracker.php';
270 }
271 if( ! function_exists( 'essential_addons_elementor_lite_start_plugin_tracking' ) ) {
272 function essential_addons_elementor_lite_start_plugin_tracking() {
273 $wisdom = new Eael_Plugin_Usage_Tracker(
274 __FILE__,
275 'https://wpdeveloper.net',
276 array(),
277 true,
278 true,
279 1
280 );
281 }
282 essential_addons_elementor_lite_start_plugin_tracking();
283 }
284
285
286 function eael_init() {
287 if ( class_exists( 'Caldera_Forms' ) ) {
288 add_filter( 'caldera_forms_force_enqueue_styles_early', '__return_true' );
289 }
290 /**
291 * Check if Elementor is Installed or not
292 */
293 if( ! function_exists( 'eael_is_elementor_active' ) ) :
294 function eael_is_elementor_active() {
295 $file_path = 'elementor/elementor.php';
296 $installed_plugins = get_plugins();
297 return isset( $installed_plugins[$file_path] );
298 }
299 endif;
300
301 /**
302 * This notice will appear if Elementor is not installed or activated or both
303 */
304 function eael_is_failed_to_load() {
305 $elementor = 'elementor/elementor.php';
306 if( eael_is_elementor_active() ) {
307 if( ! current_user_can( 'activate_plugins' ) ) {
308 return;
309 }
310 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $elementor . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $elementor );
311 $message = __( '<strong>Essential Addons for Elementor</strong> requires <strong>Elementor</strong> plugin to be active. Please activate Elementor to continue.', 'essential-addons-elementor' );
312 $button_text = __( 'Activate Elementor', 'essential-addons-elementor' );
313 } else {
314 if( ! current_user_can( 'activate_plugins' ) ) {
315 return;
316 }
317 $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
318 $message = sprintf( __( '<strong>Essential Addons for Elementor</strong> requires <strong>Elementor</strong> plugin to be installed and activated. Please install Elementor to continue.', 'essential-addons-elementor' ), '<strong>', '</strong>' );
319 $button_text = __( 'Install Elementor', 'essential-addons-elementor' );
320 }
321 $button = '<p><a href="' . $activation_url . '" class="button-primary">' . $button_text . '</a></p>';
322 printf( '<div class="error"><p>%1$s</p>%2$s</div>', __( $message ), $button );
323 }
324
325 if( ! did_action( 'elementor/loaded' ) ) {
326 add_action( 'admin_notices', 'eael_is_failed_to_load' );
327 }
328 }
329 add_action( 'plugins_loaded', 'eael_init' );
330
331 /**
332 * Admin Notice
333 *
334 * @since v1.0.0
335 */
336 function eael_admin_notice() {
337 if ( current_user_can( 'install_plugins' ) ) {
338 global $current_user ;
339 $user_id = $current_user->ID;
340 /* Check that the user hasn't already clicked to ignore the message */
341 if ( ! get_user_meta($user_id, 'eael_ignore_notice275') ) {
342 echo '<div class="eael-admin-notice updated" style="display: flex; align-items: center; padding-left: 0; border-left-color: #EF4B53"><p style="width: 32px;">';
343 echo '<img style="width: 100%; display: block;" src="' . plugins_url( '/', __FILE__ ).'admin/assets/images/icon-bolt.svg'. '" ></p><p> ';
344 printf(__('<strong>Essential Addons for Elementor</strong> now powering <strong>50,000+</strong> websites. Use the coupon code <strong>CELEBRATE50K</strong> to redeem a <strong>25&#37; </strong> discount on Pro. <a href="https://wpdeveloper.net/in/eael-pricing" target="_blank" style="text-decoration: none;"><span class="dashicons dashicons-smiley" style="margin-left: 10px;"></span> Apply Coupon</a>
345 <a href="%1$s" style="text-decoration: none; margin-left: 10px;"><span class="dashicons dashicons-dismiss"></span> I\'m good with free version</a>'), admin_url( 'admin.php?page=eael-settings&eael_nag_ignore=0' ));
346 echo "</p></div>";
347 }
348 }
349 }
350 add_action('admin_notices', 'eael_admin_notice');
351
352
353 /**
354 * Nag Ignore
355 */
356 function eael_nag_ignore() {
357 global $current_user;
358 $user_id = $current_user->ID;
359 /* If user clicks to ignore the notice, add that to their user meta */
360 if ( isset($_GET['eael_nag_ignore']) && '0' == $_GET['eael_nag_ignore'] ) {
361 add_user_meta($user_id, 'eael_ignore_notice275', 'true', true);
362 }
363 }
364 add_action('admin_init', 'eael_nag_ignore');
365
366 /**
367 * @review_dismiss()
368 * @review_pending()
369 * @eael_review_notice_message()
370 * Make all the above functions working.
371 */
372 function eael_review_notice(){
373
374 review_dismiss();
375 review_pending();
376
377 $activation_time = get_site_option( 'eael_active_time' );
378 $review_dismissal = get_site_option( 'eael_review_dismiss' );
379 $maybe_later = get_site_option( 'eael_maybe_later' );
380
381 if ( 'yes' == $review_dismissal ) {
382 return;
383 }
384
385 if ( ! $activation_time ) {
386 add_site_option( 'eael_active_time', time() );
387 }
388
389 $daysinseconds = 259200; // 3 Days in seconds.
390 if( 'yes' == $maybe_later ) {
391 $daysinseconds = 604800 ; // 7 Days in seconds.
392 }
393
394 if ( time() - $activation_time > $daysinseconds ) {
395 add_action( 'admin_notices' , 'eael_review_notice_message' );
396 }
397
398 }
399 add_action( 'admin_init', 'eael_review_notice' );
400
401 /**
402 * For the notice preview.
403 */
404 function eael_review_notice_message(){
405 $scheme = (parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY )) ? '&' : '?';
406 $url = $_SERVER['REQUEST_URI'] . $scheme . 'eael_review_dismiss=yes';
407 $dismiss_url = wp_nonce_url( $url, 'eael-review-nonce' );
408
409 $_later_link = $_SERVER['REQUEST_URI'] . $scheme . 'eael_review_later=yes';
410 $later_url = wp_nonce_url( $_later_link, 'eael-review-nonce' );
411 ?>
412
413 <div class="eael-review-notice">
414 <div class="eael-review-thumbnail">
415 <img src="<?php echo plugins_url( 'admin/assets/images/ea-logo.svg', __FILE__ ) ?>" alt="">
416 </div>
417 <div class="eael-review-text">
418 <h3><?php _e( 'Leave A Review?', 'essential-addons-elementor' ) ?></h3>
419 <p><?php _e( 'We hope you\'ve enjoyed using Essential Addons for Elementor! Would you consider leaving us a review on WordPress.org?', 'essential-addons-elementor' ) ?></p>
420 <ul class="eael-review-ul">
421 <li>
422 <a href="https://wpdeveloper.net/review-essential-addons-elementor" target="_blank">
423 <span class="dashicons dashicons-external"></span>
424 <?php _e( 'Sure! I\'d love to!', 'essential-addons-elementor' ) ?>
425 </a>
426 </li>
427 <li>
428 <a href="<?php echo $dismiss_url ?>">
429 <span class="dashicons dashicons-smiley"></span>
430 <?php _e( 'I\'ve already left a review', 'essential-addons-elementor' ) ?>
431 </a>
432 </li>
433 <li>
434 <a href="<?php echo $later_url ?>">
435 <span class="dashicons dashicons-calendar-alt"></span>
436 <?php _e( 'Maybe Later', 'essential-addons-elementor' ) ?>
437 </a>
438 </li>
439 <li>
440 <a href="https://essential-addons.com/elementor/support/" target="_blank">
441 <span class="dashicons dashicons-sos"></span>
442 <?php _e( 'I need help!', 'essential-addons-elementor' ) ?>
443 </a>
444 </li>
445 <li>
446 <a href="<?php echo $dismiss_url ?>">
447 <span class="dashicons dashicons-dismiss"></span>
448 <?php _e( 'Never show again', 'essential-addons-elementor' ) ?>
449 </a>
450 </li>
451 </ul>
452 </div>
453 </div>
454
455 <?php
456 }
457
458 /**
459 * For Dismiss!
460 */
461 function review_dismiss(){
462
463 if ( ! is_admin() ||
464 ! current_user_can( 'manage_options' ) ||
465 ! isset( $_GET['_wpnonce'] ) ||
466 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'eael-review-nonce' ) ||
467 ! isset( $_GET['eael_review_dismiss'] ) ) {
468
469 return;
470 }
471
472 add_site_option( 'eael_review_dismiss', 'yes' );
473
474 }
475
476 /**
477 * For Maybe Later Update.
478 */
479 function review_pending() {
480
481 if ( ! is_admin() ||
482 ! current_user_can( 'manage_options' ) ||
483 ! isset( $_GET['_wpnonce'] ) ||
484 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'eael-review-nonce' ) ||
485 ! isset( $_GET['eael_review_later'] ) ) {
486
487 return;
488 }
489 // Reset Time to current time.
490 update_site_option( 'eael_active_time', time() );
491 update_site_option( 'eael_maybe_later', 'yes' );
492
493 }
494
495 /**
496 * Remove Reviews Metadata on plugin Deactivation.
497 */
498 function eael_deactivate() {
499 delete_option('eael_active_time');
500 delete_option('eael_maybe_later');
501 }
502 register_deactivation_hook(__FILE__, 'eael_deactivate');
503