PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.84
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.84
4.11.84 4.11.83 4.11.82 4.11.80 4.11.81 4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / admin / includes / admin-notices.php
premium-addons-for-elementor / admin / includes Last commit date
setup-wizard 1 day ago templates 1 day ago admin-bar.php 2 months ago admin-helper.php 1 day ago admin-notices.php 1 day ago beta-testers.php 2 months ago duplicator.php 1 month ago elements.php 3 weeks ago feedback.php 1 month ago keys.php 3 weeks ago pa-rollback.php 2 months ago
admin-notices.php
711 lines
1 <?php
2 /**
3 * PA Admin Notices.
4 */
5
6 namespace PremiumAddons\Admin\Includes;
7
8 use PremiumAddons\Includes\Helper_Functions;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit();
12 }
13
14 /**
15 * Class Admin_Notices
16 */
17 class Admin_Notices {
18
19 /**
20 * Premium Addons Stories
21 *
22 * @var stories
23 */
24 private $stories = array();
25
26 /**
27 * Class object
28 *
29 * @var instance
30 */
31 private static $instance = null;
32
33 /**
34 * Elementor slug
35 *
36 * @var elementor
37 */
38 private static $elementor = 'elementor';
39
40 /**
41 * PAPRO Slug
42 *
43 * @var papro
44 */
45 private static $papro = 'premium-addons-pro';
46
47 /**
48 * Notices Keys
49 *
50 * @var notices
51 */
52 private static $notices = null;
53
54 /**
55 * Constructor for the class
56 */
57 public function __construct() {
58
59 add_action( 'admin_init', array( $this, 'init' ) );
60
61 add_action( 'admin_notices', array( $this, 'admin_notices' ) );
62
63 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
64
65 add_action( 'wp_ajax_pa_reset_admin_notice', array( $this, 'reset_admin_notice' ) );
66
67 add_action( 'wp_ajax_pa_dismiss_admin_notice', array( $this, 'dismiss_admin_notice' ) );
68
69 self::$notices = array(
70 'pa-review',
71 'content-toggle-not',
72 );
73
74 if ( Helper_Functions::check_hide_notifications() ) {
75 return;
76 }
77
78 add_action( 'wp_dashboard_setup', array( $this, 'show_story_widget' ), 111 );
79 }
80
81 /**
82 * Init
83 *
84 * Init required functions
85 *
86 * The redirection happens on the first admin page after activation ( the plugins page ).
87 *
88 * @since 1.0.0
89 * @access public
90 */
91 public function init() {
92
93 $this->handle_review_notice();
94
95 if ( Helper_Functions::check_elementor_version() && get_transient( 'pa_activation_redirect' ) ) {
96
97 delete_transient( 'pa_activation_redirect' );
98
99 $redirect = add_query_arg(
100 array(
101 'page' => 'pa-setup-wizard', // this mean it should've been added first.
102 ),
103 admin_url( 'admin.php' )
104 );
105
106 wp_safe_redirect( $redirect );
107
108 exit;
109 }
110 }
111
112 /**
113 * Init notices check functions.
114 */
115 public function admin_notices() {
116
117 // Skip rendering notices during AJAX requests.
118 if ( wp_doing_ajax() ) {
119 return;
120 }
121
122 $this->required_plugins_check();
123
124 // Make sure "Already did" was not clicked before.
125 $show_review = get_option( 'pa_review_notice' );
126 if ( '1' !== $show_review ) {
127
128 $cache_key = 'pa_review_notice';
129
130 $response = get_transient( $cache_key );
131
132 if ( false === $response ) {
133 $this->show_review_notice();
134 }
135 }
136
137 if ( Helper_Functions::check_hide_notifications() ) {
138 return;
139 }
140
141 $this->get_content_toggle_notice();
142 }
143
144 /**
145 * Handle Review Notice
146 *
147 * Checks if review message is dismissed.
148 *
149 * @access public
150 * @return void
151 */
152 public function handle_review_notice() {
153
154 if ( ! isset( $_GET['pa_review'] ) ) {
155 return;
156 }
157
158 $pa_review = sanitize_text_field( wp_unslash( $_GET['pa_review'] ) );
159
160 if ( 'opt_out' === $pa_review ) {
161 check_admin_referer( 'opt_out' );
162
163 update_option( 'pa_review_notice', '1' );
164 }
165
166 wp_safe_redirect( remove_query_arg( 'pa_review' ) );
167
168 exit;
169 }
170
171 /**
172 * Required plugin check
173 *
174 * Shows an admin notice when Elementor is missing.
175 *
176 * @since 1.0.0
177 * @access public
178 */
179 public function required_plugins_check() {
180
181 // Early return if Elementor is already active.
182 if ( Helper_Functions::check_elementor_version() ) {
183 return;
184 }
185
186 $elementor_path = sprintf( '%1$s/%1$s.php', self::$elementor );
187
188 $message = '';
189
190 if ( ! Helper_Functions::is_plugin_installed( $elementor_path ) ) {
191
192 if ( ! Admin_Helper::check_user_can( 'install_plugins' ) ) {
193 return;
194 }
195
196 $install_url = wp_nonce_url( self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', self::$elementor ) ), 'install-plugin_elementor' );
197
198 $message = sprintf( '<p>%s</p>', __( 'Premium Addons for Elementor is not working because you need to Install Elementor plugin.', 'premium-addons-for-elementor' ) );
199
200 $message .= sprintf( '<p><a href="%s" class="button-primary">%s</a></p>', $install_url, __( 'Install Now', 'premium-addons-for-elementor' ) );
201
202 } elseif ( Admin_Helper::check_user_can( 'activate_plugins' ) ) {
203
204 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $elementor_path . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $elementor_path );
205
206 $message = '<p>' . __( 'Premium Addons for Elementor is not working because you need to activate Elementor plugin.', 'premium-addons-for-elementor' ) . '</p>';
207
208 $message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, __( 'Activate Now', 'premium-addons-for-elementor' ) ) . '</p>';
209 } else {
210 return;
211 }
212
213 if ( ! empty( $message ) ) {
214 $this->render_admin_notices( $message );
215 }
216 }
217
218 /**
219 * Get Review Text
220 *
221 * Gets admin review notice HTML.
222 *
223 * @since 2.8.4
224 * @access public
225 *
226 * @param string $review_url plugin page.
227 * @param string $optout_url redirect url.
228 */
229 public function get_review_text( $review_url, $optout_url ) {
230
231 $notice = sprintf(
232 '<p>' . __( 'Could we take just 2 minutes of your time? We\'d be incredibly grateful if you could give ', 'premium-addons-for-elementor' ) .
233 '<b>' . __( 'Premium Addons for Elementor', 'premium-addons-for-elementor' ) . '</b> a 5 Stars Rating on WordPress.org. Your support helps us continue creating even more amazing free features in the future!</p>
234 <div>
235 <a class="button pa-review-btn button-primary" href="%s" target="_blank"><span>' . __( 'Sure, leave a Review', 'premium-addons-for-elementor' ) . '</span></a>
236 <a class="button" href="%2$s"><span>' . __( 'I Already Did', 'premium-addons-for-elementor' ) . '</span></a>
237 <a class="button button-secondary pa-notice-reset"><span>' . __( 'Maybe Later', 'premium-addons-for-elementor' ) . '</span></a>
238 </div>',
239 $review_url,
240 $optout_url
241 );
242
243 return $notice;
244 }
245
246 /**
247 * Checks if review admin notice is dismissed
248 *
249 * @since 2.6.8
250 * @return void
251 */
252 public function show_review_notice() {
253
254 $review_url = 'https://wordpress.org/support/plugin/premium-addons-for-elementor/reviews/#new-post';
255
256 $optout_url = wp_nonce_url( add_query_arg( 'pa_review', 'opt_out' ), 'opt_out' );
257 ?>
258
259 <div class="error pa-notice-wrap pa-review-notice" data-notice="pa-review">
260 <div class="pa-img-wrap">
261 <img src="<?php echo esc_url( PREMIUM_ADDONS_URL . 'admin/images/pa-logo-symbol.png' ); ?>">
262 </div>
263 <div class="pa-text-wrap">
264 <?php echo wp_kses_post( $this->get_review_text( $review_url, $optout_url ) ); ?>
265 </div>
266 <div class="pa-notice-close">
267 <a href="<?php echo esc_url( $optout_url ); ?>"><span class="dashicons dashicons-dismiss"></span></a>
268 </div>
269 </div>
270
271 <?php
272 }
273
274 public function get_content_toggle_notice() {
275
276 $option = get_option( 'content-toggle-not' );
277
278 if ( '1' === $option ) {
279 return;
280 }
281
282 $link = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-content-toggle-widget/', 'content-toggle-notification', 'wp-dash', 'content-toggle' );
283
284 ?>
285
286 <div class="error pa-notice-wrap pa-new-feature-notice">
287 <div class="pa-img-wrap">
288 <img src="<?php echo PREMIUM_ADDONS_URL . 'admin/images/pa-logo-symbol.png'; ?>">
289 </div>
290 <div class="pa-text-wrap">
291 <p>
292 <strong><?php echo __( 'Elementor Content Toggle Widget', 'premium-addons-for-elementor' ); ?></strong>
293 <?php printf( __( 'has been rebuilt. <a href="%s" target="_blank">Check it out now!</a>', 'premium-addons-for-elementor' ), $link ); ?>
294 </p>
295 </div>
296 <div class="pa-notice-close" data-notice="content-toggle-not">
297 <span class="dashicons dashicons-dismiss"></span>
298 </div>
299 </div>
300
301 <?php
302 }
303
304 /**
305 * Get Promotion Message
306 *
307 * @since 4.11.43
308 * @access private
309 *
310 * @param string $type promotion type.
311 * @return array
312 */
313 private function get_promotion_message( $type = 'new' ) {
314
315 if ( 'upgrade' === $type ) {
316 return array(
317 'message' => __( 'Get a <b>FLAT 30% OFF</b> when you upgrade to <b>Premium Addons Pro Lifetime</b>. Use code <b>BFUL2025</b> at checkout – <b>expires soon!</b>', 'premium-addons-for-elementor' ),
318 'cta' => __( 'Upgrade Now', 'premium-addons-for-elementor' ),
319 );
320
321 }
322
323 return array(
324 'message' => __( '<b>Cyber Monday – Save Up To 30% on Premium Addons Pro</b>.', 'premium-addons-for-elementor' ),
325 'cta' => __( 'Catch The Deal', 'premium-addons-for-elementor' ),
326 );
327 }
328
329 /**
330 * Renders an admin notice error message
331 *
332 * @since 1.0.0
333 * @access private
334 *
335 * @param string $message notice text.
336 * @param string $class notice class.
337 * @param string $handle notice handle.
338 *
339 * @return void
340 */
341 private function render_admin_notices( $message, $class = '', $handle = '' ) {
342 ?>
343 <div class="error pa-new-feature-notice <?php echo esc_attr( $class ); ?>" data-notice="<?php echo esc_attr( $handle ); ?>">
344 <?php echo wp_kses_post( $message ); ?>
345 </div>
346 <?php
347 }
348
349
350
351 /**
352 * Register admin scripts
353 *
354 * @since 3.2.8
355 * @access public
356 */
357 public function admin_enqueue_scripts() {
358
359 // Skip loading scripts during AJAX or REST requests.
360 if ( wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
361 return;
362 }
363
364 wp_enqueue_script(
365 'pa-dashboard',
366 PREMIUM_ADDONS_URL . 'admin/assets/js/pa-dashboard.js',
367 array( 'jquery' ),
368 PREMIUM_ADDONS_VERSION,
369 true
370 );
371
372 wp_localize_script(
373 'pa-dashboard',
374 'PaNoticeSettings',
375 array(
376 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
377 'nonce' => wp_create_nonce( 'pa-notice-nonce' ),
378 'feedback_nonce' => wp_create_nonce( 'pa-feedback-nonce' ),
379 )
380 );
381 }
382
383 /**
384 * Set transient for admin notice
385 *
386 * @since 3.2.8
387 * @access public
388 *
389 * @return void
390 */
391 public function reset_admin_notice() {
392
393 check_ajax_referer( 'pa-notice-nonce', 'nonce' );
394
395 if ( ! Admin_Helper::check_user_can( 'manage_options' ) ) {
396 wp_send_json_error();
397 }
398
399 $key = isset( $_POST['notice'] ) ? sanitize_text_field( wp_unslash( $_POST['notice'] ) ) : '';
400
401 if ( ! empty( $key ) && in_array( $key, self::$notices, true ) ) {
402
403 $cache_key = 'pa_review_notice';
404
405 set_transient( $cache_key, true, WEEK_IN_SECONDS );
406
407 wp_send_json_success();
408
409 } else {
410
411 wp_send_json_error();
412
413 }
414 }
415
416 /**
417 * Dismiss admin notice
418 *
419 * @since 3.11.7
420 * @access public
421 *
422 * @return void
423 */
424 public function dismiss_admin_notice() {
425
426 check_ajax_referer( 'pa-notice-nonce', 'nonce' );
427
428 if ( ! current_user_can( 'manage_options' ) ) {
429 wp_send_json_error();
430 }
431
432 $key = isset( $_POST['notice'] ) ? sanitize_text_field( wp_unslash( $_POST['notice'] ) ) : '';
433
434 if ( ! empty( $key ) && in_array( $key, self::$notices, true ) ) {
435
436 // Make sure new features notices will not appear again.
437 if ( false !== strpos( $key, 'not' ) ) {
438 update_option( $key, '1' );
439 } else {
440 set_transient( $key, true, 20 * DAY_IN_SECONDS );
441
442 }
443
444 wp_send_json_success();
445
446 } else {
447
448 wp_send_json_error();
449
450 }
451 }
452
453 /**
454 * Check Status
455 *
456 * @since 4.10.15
457 * @access public
458 */
459 public function check_status( $key ) {
460
461 $status = false;
462
463 $api_params = array(
464 'edd_action' => 'check_license',
465 'license' => $key,
466 'item_id' => 361,
467 );
468
469 $response = wp_remote_get(
470 'https://my.leap13.com',
471 array(
472 'timeout' => 15,
473 'sslverify' => false,
474 'body' => $api_params,
475 )
476 );
477
478 if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
479 return false;
480 }
481
482 $body = wp_remote_retrieve_body( $response );
483
484 $body = json_decode( $body, true );
485
486 if ( isset( $body['license'] ) && 'valid' === $body['license'] ) {
487 $status = true;
488 }
489
490 return $status;
491 }
492
493 /**
494 * Get PA Stories
495 *
496 * Gets a list of the latest three blog posts
497 *
498 * @since 4.10.64
499 *
500 * @access public
501 */
502 public function get_pa_stories() {
503
504 $stories = get_transient( 'pa_stories_' . PREMIUM_ADDONS_VERSION );
505
506 if ( ! $stories ) {
507
508 $api_url = 'https://premiumaddons.com/wp-json/stories/v2/get';
509
510 $response = wp_remote_get(
511 $api_url,
512 array(
513 'timeout' => 15,
514 'sslverify' => true,
515 )
516 );
517
518 if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
519 set_transient( 'pa_stories_' . PREMIUM_ADDONS_VERSION, true, WEEK_IN_SECONDS );
520 return false;
521 }
522
523 $body = wp_remote_retrieve_body( $response );
524 $stories = json_decode( $body, true );
525
526 set_transient( 'pa_stories_' . PREMIUM_ADDONS_VERSION, $stories, WEEK_IN_SECONDS );
527
528 }
529
530 $this->stories = $stories;
531
532 return $stories;
533 }
534
535 public function show_story_widget() {
536
537 $stories = $this->get_pa_stories();
538
539 if ( ! is_array( $stories ) || empty( $stories ) ) {
540 return;
541 }
542
543 wp_add_dashboard_widget(
544 'pa-stories',
545 __( 'Premium Addons News', 'premium-addons-for-elementor' ),
546 array( $this, 'show' ),
547 null,
548 null,
549 'column3',
550 'core'
551 );
552 }
553
554
555 public function show() {
556
557 $stories = $this->stories;
558
559 $time = time();
560
561 $papro_path = 'premium-addons-pro/premium-addons-pro-for-elementor.php';
562
563 $license_data = get_transient( 'pa_license_info' );
564 $highlight = false;
565
566 if ( isset( $license_data['status'] ) && 'valid' === $license_data['status'] ) {
567
568 if ( isset( $license_data['id'] ) && '4' !== $license_data['id'] ) {
569
570 $highlight = true;
571 array_unshift(
572 $stories['posts'],
573 array(
574 'title' => 'Switch to Premium Addons Pro Lifetime, Pay the Difference & Save 30% Today!',
575 'link' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/upgrade-premium-addons-license/', 'wp-dash', 'summer26-dash-widget', 'summer26' ),
576 )
577 );
578
579 }
580 }
581
582 ?>
583 <style>
584 .pa-banners-grid {
585 margin-bottom: 10px;
586 }
587
588 .pa-stories-banner {
589 position: relative;
590 }
591
592 .pa-stories-banner a {
593 position: absolute;
594 inset: 0;
595 }
596
597 .pa-story-img-container img {
598 width: 100%;
599 display: block;
600 }
601
602 .pa-news-post {
603 margin-bottom: 5px;
604 }
605
606 .pa-news-post a {
607 font-weight: 500;
608 color: #0073aa;
609 text-decoration: none;
610 padding-bottom: 5px;
611 display: inline-block;
612 }
613
614 .pa-dashboard-widget-block {
615 width: 100%;
616 }
617
618 .pa-footer-bar {
619 border-top: 1px solid #eee;
620 padding-top: 1rem;
621 display: flex;
622 justify-content: space-between;
623 }
624
625 .pa-dashboard-widget-block a {
626 text-decoration: none;
627 font-size: 13px;
628 color: #007cba;
629 }
630
631 .pa-dashboard-widget-block .dashicons {
632 vertical-align: middle;
633 font-size: 17px;
634 }
635 </style>
636
637
638 <div class="pa-banners-grid">
639
640 <?php foreach ( $stories['banners'] as $index => $banner ) : ?>
641
642 <?php if ( isset( $banner['end'] ) && $time < $banner['end'] ) : ?>
643
644 <div class="pa-stories-banner">
645 <div class="pa-story-img-container">
646 <img src="<?php echo esc_url( $banner['image'] ); ?>" alt="<?php echo esc_attr( $banner['description'] ); ?>">
647 </div>
648 <a href="<?php echo esc_url( Helper_Functions::get_campaign_link( $banner['link'], 'wp-dash', 'dash-widget', 'summer26' ) ); ?>" target="_blank" title="<?php echo esc_attr( $banner['description'] ); ?>"></a>
649 </div>
650
651 <?php endif; ?>
652
653 <?php endforeach; ?>
654
655 </div>
656
657
658 <div class="pa-posts-grid">
659
660 <?php foreach ( $stories['posts'] as $index => $post ) : ?>
661
662 <div class="pa-news-post">
663 <a style="<?php echo 0 === $index && $highlight ? 'color: #93003f' : ''; ?>" target="_blank" href="<?php echo esc_url( $post['link'] ); ?>">
664 <?php echo wp_kses_post( $post['title'] ); ?>
665 </a>
666 </div>
667
668 <?php endforeach; ?>
669
670 </div>
671
672 <div class="pa-dashboard-widget-block">
673 <div class="pa-footer-bar">
674 <a href="https://wordpress.org/support/plugin/premium-addons-for-elementor/" target="_blank" style="color: #27ae60">
675 Need Help?
676 <span aria-hidden="true" class="dashicons dashicons-external"></span>
677 </a>
678 <a href="https://www.youtube.com/leap13" target="_blank" style="color: #e1002d">
679 YouTube Channel
680 <span aria-hidden="true" class="dashicons dashicons-youtube"></span>
681 </a>
682 <a href="https://www.facebook.com/groups/PremiumAddons" target="_blank" style="color: #1877F2;">
683 Facebook Community
684 <span aria-hidden="true" class="dashicons dashicons-facebook-alt"></span>
685 </a>
686 </div>
687 </div>
688
689 <?php
690 }
691
692 /**
693 * Creates and returns an instance of the class
694 *
695 * @since 2.8.4
696 * @access public
697 *
698 * @return object
699 */
700 public static function get_instance() {
701
702 if ( ! isset( self::$instance ) ) {
703
704 self::$instance = new self();
705
706 }
707
708 return self::$instance;
709 }
710 }
711