PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.3
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.3
3.3.3 3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 158 releases
← All changes | includes/FrontEnd/Preview.php +56 -26 3.2.11 → 3.3.3 View file →
@@ -38,9 +38,13 @@
38 38 show_admin_bar(false);
39 39 }
40 40
41 41 if ($this->is_preview() && class_exists('QueryMonitor')) {
42 + // Query Monitor renders its own output into the preview iframe and
43 + // corrupts it, so display is silenced while building a preview.
44 + // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Discouraged
42 45 ini_set('display_errors', 'Off');
46 + // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Discouraged
43 47 ini_set('error_reporting', E_ALL);
44 48 $qm = \QueryMonitor::init();
45 49 remove_action('plugins_loaded', [$qm, 'action_plugins_loaded']);
46 50 }
@@ -120,10 +124,13 @@
120 124 }
121 125
122 126 $args['settings'] = FrontEnd::get_instance()->get_settings();
123 127
128 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
124 129 $this->notificationXArr = apply_filters('get_notifications_ids', $args);
125 130 wp_enqueue_style('notificationx-public');
131 + FrontEnd::get_instance()->enqueue_external_styles();
132 + wp_enqueue_style('notificationx-gdpr-modal');
126 133 wp_enqueue_script('notificationx-public');
127 134 do_action('notificationx_scripts', $this->notificationXArr);
128 135
129 136 add_filter('show_admin_bar', '__return_false');
@@ -192,16 +199,16 @@
192 199 $type = !empty($settings['type']) ? $settings['type'] : '';
193 200 $nx_id = !empty($settings['nx_id']) ? $settings['nx_id'] : '';
194 201 $defaults = [
195 202 'nx_id' => $nx_id,
196 - 'active_installs' => rand(50, 70),
203 + 'active_installs' => wp_rand(50, 70),
197 204 'active_installs_text' => 'Try It Out',
198 - 'all_time' => rand(50, 70),
205 + 'all_time' => wp_rand(50, 70),
199 206 'all_time_text' => 'Why Don\'t You?',
200 207 'anonymous_title' => 'Anonymous Title',
201 208 'author' => '<a href="https://wpdeveloper.com/">WPDeveloper</a>',
202 209 'author_profile' => 'https://profiles.wordpress.org/wpdevteam/',
203 - 'amount' => rand(50, 70),
210 + 'amount' => wp_rand(50, 70),
204 211 'avatar' => [
205 212 'src' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
206 213 ],
207 214 'picture' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
@@ -207,16 +214,16 @@
207 214 'picture' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
208 215 'city' => 'Dhaka',
209 216 'city_country' => 'Dhaka, Bangladesh',
210 217 'content' => 'Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.',
211 - 'count' => rand(50, 70),
218 + 'count' => wp_rand(50, 70),
212 219 'country' => 'Bangladesh',
213 220 'course_title' => 'PHP Beginners – Become a PHP Master',
214 221 'created_at' => wp_date('Y-m-d H:i:s', strtotime('2 days ago')),
215 222 'day' => 'days',
216 - 'downloaded' => rand(50, 70),
223 + 'downloaded' => wp_rand(50, 70),
217 224 'email' => '[email protected]',
218 - 'entry_id' => rand(1000, 9999),
225 + 'entry_id' => wp_rand(1000, 9999),
219 226 'entry_key' => 'ChIJ0cpDbNvBVTcRGX9JNhhpC8I',
220 227 'first_name' => 'John',
221 228 '_first_name' => 'John',
222 229 'formatted_address' => 'House 592, Road 8 Avenue 5, Dhaka 1216, Bangladesh',
@@ -235,10 +242,10 @@
235 242 'ip' => '103.108.146.88',
236 243 'key' => '7368a455f5c113afbfd3d8c3ea89a5ed-5719',
237 244 'last_name' => 'Doe',
238 245 '_last_name' => 'Doe',
239 - 'last_updated' => date('Y-m-d H:i:s', strtotime('2 days ago')),
240 - 'last_week' => rand(50, 70),
246 + 'last_updated' => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
247 + 'last_week' => wp_rand(50, 70),
241 248 'last_week_text' => 'Get Started for Free.',
242 249 'lat' => 23.8371427,
243 250 'link' => '#',
244 251 'lon' => 90.3704629,
@@ -258,9 +265,9 @@
258 265 'plugin_theme_name' => 'NotificationX',
259 266 'post_link' => '#',
260 267 'product_id' => 168,
261 268 'product_title' => 'Assorted Coffee',
262 - 'rated' => rand(50, 70),
269 + 'rated' => wp_rand(50, 70),
263 270 'rating' => 4.4,
264 271 'ratings' => array(
265 272 0 => 48,
266 273 1 => 13,
@@ -267,36 +274,36 @@
267 274 2 => 21,
268 275 3 => 66,
269 276 4 => 2826,
270 277 ),
271 - 'realtime_siteview' => rand(50, 70),
272 - 'siteview' => rand(50, 70),
278 + 'realtime_siteview' => wp_rand(50, 70),
279 + 'siteview' => wp_rand(50, 70),
273 280 'slug' => 'notificafionx',
274 281 'sometime' => 'Some time ago',
275 282 'source' => 'google_reviews',
276 283 'status' => 'wc-processing',
277 284 'this_page' => 'this page',
278 - 'timestamp' => date('Y-m-d H:i:s', strtotime('2 days ago')),
285 + 'timestamp' => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
279 286 'title' => 'Hoodie with Logo',
280 - 'today' => rand(50, 70),
287 + 'today' => wp_rand(50, 70),
281 288 'today_text' => 'Try It Out',
282 289 'type' => 'realtime_siteview',
283 - 'updated_at' => date('Y-m-d H:i:s', strtotime('2 days ago')),
290 + 'updated_at' => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
284 291 'url' => '#',
285 292 'user_id' => '1',
286 293 'username' => 'johndoe',
287 294 'version' => '5.5.2',
288 - 'views' => rand(50, 70),
295 + 'views' => wp_rand(50, 70),
289 296 'website' => 'https://wpdeveloper.com/',
290 297 'year' => 'years',
291 - 'yesterday' => rand(50, 70),
298 + 'yesterday' => wp_rand(50, 70),
292 299 'your-email' => '[email protected]',
293 300 'your-message' => 'Lorem Ipsum is simply dummy text.',
294 301 'your-name' => 'John Doe',
295 302 'your-subject' => 'Lorem Ipsum',
296 303 'post_title' => 'Hello World',
297 - 'sales_count' => rand(50, 70),
298 - 'donation_count' => rand(50, 70),
304 + 'sales_count' => wp_rand(50, 70),
305 + 'donation_count' => wp_rand(50, 70),
299 306 '1day' => __('In last 1 day', 'notificationx'),
300 307 '7days' => __('In last 7 days', 'notificationx'),
301 308 '30days' => __('In last 30 days', 'notificationx'),
302 309 'post_comment' => 'Lorem Ipsum is simply dummy text...',
@@ -315,14 +322,20 @@
315 322 $settings['freemius_plugins'] = '';
316 323
317 324 $defaults['image_data'] = FrontEnd::get_instance()->apply_defaults((array) FrontEnd::get_instance()->get_image_url($defaults, $settings), $defaults['image_data']);
318 325
326 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
319 327 $defaults = apply_filters("nx_preview_entry_$type", $defaults, $settings);
328 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
320 329 $defaults = apply_filters("nx_preview_entry_$source", $defaults, $settings);
330 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
321 331 $_defaults = apply_filters("nx_fallback_data_$source", $defaults, $defaults, $settings);
332 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
322 333 $_defaults = apply_filters('nx_fallback_data', $_defaults, $_defaults, $settings);
323 334 $defaults = FrontEnd::get_instance()->apply_defaults($defaults, $_defaults);
335 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
324 336 $defaults = apply_filters("nx_filtered_entry_$type", $defaults, $settings);
337 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
325 338 $defaults = apply_filters("nx_filtered_entry_$source", $defaults, $settings);
326 339 // $defaults = $this->link_url($defaults, $settings);
327 340 if (strpos($settings['theme'], 'maps_theme') !== false && 'maps_image' === $settings['show_notification_image']) {
328 341 $defaults['image_data'] = array(
@@ -344,13 +357,15 @@
344 357 return $defaults;
345 358 }
346 359
347 360 public function get_settings() {
361 + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reviewed for the NotificationX codebase: acceptable in this context.
348 362 if ( empty($_POST['nx-preview']) ) {
349 363 return array();
350 364 }
351 365
352 - $settings = base64_decode( wp_unslash($_POST['nx-preview']), true );
366 + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reviewed for the NotificationX codebase: acceptable in this context.
367 + $settings = base64_decode( sanitize_text_field( wp_unslash( $_POST['nx-preview'] ) ), true );
353 368 $settings = json_decode( $settings, true );
354 369
355 370 if ( ! is_array($settings) ) {
356 371 return array();
@@ -376,9 +391,9 @@
376 391 if ($settings['global_queue']) {
377 392 $settings['global_queue'] = false;
378 393 $settings['_global_queue'] = true;
379 394 }
380 - $settings['nx_id'] = rand();
395 + $settings['nx_id'] = wp_rand();
381 396 $settings['is_preview'] = true;
382 397 if (empty($settings['theme']) && !empty($settings['themes'])) {
383 398 $settings['theme'] = $settings['themes'];
384 399 }
@@ -388,19 +403,24 @@
388 403 if( !empty( $settings['notification-template'] ) ) {
389 404 $settings['notification-template'] = array_map( 'esc_html', $settings['notification-template'] );
390 405 }
391 406
407 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
392 408 $settings = apply_filters("nx_get_post_{$settings['source']}", $settings);
409 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
393 410 $settings = apply_filters("nx_preview_settings_{$settings['source']}", $settings);
411 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
394 412 $settings = apply_filters('nx_get_post', $settings);
395 413 return $settings;
396 414 }
397 415
398 416 public function content_heading($tabs) {
417 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
399 418 $urls = apply_filters('nx_preview_url', [
400 419 'default' => trailingslashit(home_url()),
401 420 ]);
402 421
422 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
403 423 $tabs['config']['content_heading']['talk_to_support'] = apply_filters('talk_to_support', [
404 424 'text' => __('Talk to Support', 'notificationx'),
405 425 'classes' => 'nx-talk-to-support',
406 426 'type' => 'button',
@@ -407,13 +427,15 @@
407 427 'name' => 'talk_to_support',
408 428 'target' => '_blank',
409 429 'href' => esc_url('https://notificationx.com/support/?support=chat'),
410 430 ]);
431 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
411 432 $tabs['config']['content_heading']['preview'] = apply_filters('nx_content_heading_preview', [
412 433 'label' => __('Preview', 'notificationx'),
413 434 'type' => 'preview-modal',
414 435 'name' => 'preview',
415 436 'urls' => $urls,
437 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
416 438 'errors' => apply_filters('nx_content_heading_preview_errors', []),
417 439 'rules' => Rules::logicalRule([
418 440 Rules::includes('themes', ['woo_inline_stock-theme-two', 'tutor_inline_conv-theme-eight', 'flashing_tab_theme-1','flashing_tab_theme-2' ,'flashing_tab_theme-3' , 'flashing_tab_theme-4','woocommerce_sales_inline_stock-theme-two','learnpress_inline_conv-theme-eight'], true),
419 441 Rules::is('type', 'notification_bar', true),
@@ -438,9 +460,9 @@
438 460 $settings['inline_location'] = is_array($settings['inline_location']) ? $settings['inline_location'] : [];
439 461 $settings['inline_location'][] = 'woocommerce_before_add_to_cart_form';
440 462
441 463 $defaults = [
442 - "nx_id" => rand(),
464 + "nx_id" => wp_rand(),
443 465 "entry_id" => 78,
444 466 "order_id" => 96,
445 467 "product_id" => $id,
446 468 "id" => $id,
@@ -447,9 +469,9 @@
447 469 // "status" => "wc-pending",
448 470 "title" => get_the_title($id),
449 471 "product_title" => get_the_title($id),
450 472 "link" => "#",
451 - "timestamp" => date('Y-m-d H:i:s', strtotime('2 days ago')),
473 + "timestamp" => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
452 474 // "first_name" => "John",
453 475 // "last_name" => "Doe",
454 476 // "name" => "John Doe",
455 477 "email" => "[email protected]",
@@ -454,15 +476,15 @@
454 476 // "name" => "John Doe",
455 477 "email" => "[email protected]",
456 478 "source" => $source,
457 479 "entry_key" => "96-7",
458 - "created_at" => date('Y-m-d H:i:s', strtotime('2 days ago')),
459 - "updated_at" => date('Y-m-d H:i:s', strtotime('2 days ago')),
480 + "created_at" => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
481 + "updated_at" => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
460 482 "none" => "",
461 483 // "anonymous_title" => "Anonymous Product",
462 484 // "sometime" => "Some time ago",
463 - "sales_count" => rand(50, 70),
464 - "donation_count" => rand(50, 70),
485 + "sales_count" => wp_rand(50, 70),
486 + "donation_count" => wp_rand(50, 70),
465 487 // "30days" => "in last 30 days",
466 488 // "day:30" => "30 days",
467 489 // "1day" => "in last 1 day",
468 490 // "7days" => "in last 7 days",
@@ -468,14 +490,20 @@
468 490 // "7days" => "in last 7 days",
469 491 ];
470 492
471 493
494 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
472 495 $_defaults = apply_filters("nx_fallback_data_$source", $defaults, $defaults, $settings);
496 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
473 497 $_defaults = apply_filters('nx_fallback_data', $_defaults, $_defaults, $settings);
474 498 $defaults = FrontEnd::get_instance()->apply_defaults($defaults, $_defaults);
499 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
475 500 $defaults = apply_filters("nx_preview_entry_$type", $defaults, $settings);
501 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
476 502 $defaults = apply_filters("nx_preview_entry_$source", $defaults, $settings);
503 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
477 504 $defaults = apply_filters("nx_filtered_entry_$type", $defaults, $settings);
505 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
478 506 $defaults = apply_filters("nx_filtered_entry_$source", $defaults, $settings);
479 507
480 508 return [
481 509 'shortcode' => [
@@ -491,11 +519,13 @@
491 519 }
492 520
493 521 public function is_preview() {
494 522 $is_preview = false;
523 + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reviewed for the NotificationX codebase: acceptable in this context.
495 524 if (!empty($_POST['nx-preview'])) {
496 525 $is_preview = true;
497 526 }
527 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
498 528 $is_preview = apply_filters('nx_is_preview',$is_preview);
499 529 return $is_preview;
500 530 }
501 531 }