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