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
notificationx / includes / FrontEnd / Preview.php

Preview.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.3.3, at includes/FrontEnd/Preview.php

532 lines 25.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Admin Class File.
5 *
6 * @package NotificationX\Admin
7 */
8
9 namespace NotificationX\FrontEnd;
10
11 use NotificationX\Core\Helper;
12 use NotificationX\Core\Rules;
13 use NotificationX\GetInstance;
14
15 /**
16 * Preview Class, this class is responsible for all Preview Actions
17 * @method static Preview get_instance($args = null)
18 */
19 class Preview {
20 /**
21 * Instance of Preview
22 *
23 * @var Preview
24 */
25 use GetInstance;
26
27 protected $notificationXArr = [];
28
29 public function __construct() {
30 add_action('wp_head', [$this, 'header_scripts']);
31 add_action('wp_print_footer_scripts', [$this, 'footer_scripts']);
32
33 add_filter('nx_before_enqueue_scripts', [$this, 'enqueue_scripts']);
34 add_filter('nx_inline_notifications_data', [$this, 'inline_notifications_data'], 10, 4);
35 add_filter('nx_metabox_config', [$this, 'content_heading']);
36
37 if ($this->is_preview()) {
38 show_admin_bar(false);
39 }
40
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
45 ini_set('display_errors', 'Off');
46 // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Discouraged
47 ini_set('error_reporting', E_ALL);
48 $qm = \QueryMonitor::init();
49 remove_action('plugins_loaded', [$qm, 'action_plugins_loaded']);
50 }
51 }
52
53
54 /**
55 * This method is responsible for enqueueing scripts for public use.
56 *
57 * @return void
58 */
59 public function enqueue_scripts($return) {
60 if ($this->is_preview()) {
61 $args = [
62 'total' => 1,
63 'nxPreview' => true,
64 'pressbar' => [],
65 'active' => [],
66 'gdpr' => [],
67 'popup' => [],
68 'exit_intent' => [],
69 ];
70
71 $settings = $this->preview_settings();
72 if (empty($settings['source']) || empty($settings['type']))
73 return;
74 if ('inline' === $settings['type'] || 'woocommerce_sales_inline' == $settings['source'] ){
75 $args['total'] = 0;
76 return $args;
77 }
78
79 $source = $settings['source'];
80 $type = $settings['type'];
81 if ($type === 'exit_intent') {
82 $args['exit_intent'] = [
83 $source => [
84 'entries' => [
85 $this->preview_entry($settings),
86 ],
87 'post' => $settings,
88 ]
89 ];
90 } else if ($source === 'press_bar') {
91 $args['pressbar'] = [
92 $source => [
93 'content' => FrontEnd::get_instance()->get_bar_content($settings, true),
94 'post' => $settings,
95 ]
96 ];
97 } else if($source === 'gdpr_notification') {
98 $args['gdpr'] = [
99 $source => [
100 'entries' => [
101 $this->preview_entry($settings),
102 ],
103 'post' => $settings,
104 ]
105 ];
106 } else if($source === 'popup_notification') {
107 $args['popup'] = [
108 $source => [
109 'entries' => [
110 $this->preview_entry($settings),
111 ],
112 'post' => $settings,
113 ]
114 ];
115 } else {
116 $args['active'] = [
117 $source => [
118 'entries' => [
119 $this->preview_entry($settings),
120 ],
121 'post' => $settings,
122 ]
123 ];
124 }
125
126 $args['settings'] = FrontEnd::get_instance()->get_settings();
127
128 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
129 $this->notificationXArr = apply_filters('get_notifications_ids', $args);
130 wp_enqueue_style('notificationx-public');
131 FrontEnd::get_instance()->enqueue_external_styles();
132 wp_enqueue_style('notificationx-gdpr-modal');
133 wp_enqueue_script('notificationx-public');
134 do_action('notificationx_scripts', $this->notificationXArr);
135
136 add_filter('show_admin_bar', '__return_false');
137
138 return $this->notificationXArr;
139 }
140 return $return;
141 }
142
143 public function header_scripts() {
144 if ($this->is_preview()) {
145 ?>
146 <style>
147 .notificationx-woo-shortcode-inline-wrapper > * {
148 display: inline-block;
149 /* background: rgb(255 255 0 / 20%);
150 color: red; */
151 font-weight: 600;
152 }
153 .notificationx-woo-shortcode-inline-wrapper > div.woo_inline_conv-theme-seven span:first-child,
154 .notificationx-woo-shortcode-inline-wrapper > div.edd_inline_conv-theme-seven span:first-child,
155 .notificationx-woo-shortcode-inline-wrapper > div.woocommerce_sales_inline_conv-theme-seven span:first-child {
156 color: #61BD6D;
157 }
158 .notificationx-woo-shortcode-inline-wrapper > div.woo_inline_conv-theme-seven span:last-child,
159 .notificationx-woo-shortcode-inline-wrapper > div.woocommerce_sales_inline_conv-theme-seven span:last-child,
160 .notificationx-woo-shortcode-inline-wrapper > div.edd_inline_conv-theme-seven span:last-child,
161 .notificationx-woo-shortcode-inline-wrapper > div.tutor_inline_conv-theme-seven span:last-child,
162 .notificationx-woo-shortcode-inline-wrapper > div.learndash_inline_conv-theme-seven span:last-child{
163 color: #E25042;
164 }
165
166 .notificationx-woo-shortcode-inline-wrapper > div.woo_inline_stock-theme-one span,
167 .notificationx-woo-shortcode-inline-wrapper > div.woocommerce_sales_inline_stock-theme-one span {
168 color: #E25042;
169 }
170 </style>
171 <?php
172 }
173 }
174
175 public function footer_scripts() {
176 if ($this->is_preview()) {
177 ?>
178 <script data-no-optimize="1">
179 (function() {
180 document.addEventListener("click", function(event) {
181 // if (event.target.tagName === "A") {
182 event.preventDefault();
183 event.stopPropagation();
184 event.stopImmediatePropagation();
185 // }
186 });
187 document.addEventListener("submit", function(event) {
188 event.preventDefault();
189 });
190 })();
191 </script>
192 <?php
193 }
194 }
195
196
197 public function preview_entry($settings) {
198 $source = !empty($settings['source']) ? $settings['source'] : '';
199 $type = !empty($settings['type']) ? $settings['type'] : '';
200 $nx_id = !empty($settings['nx_id']) ? $settings['nx_id'] : '';
201 $defaults = [
202 'nx_id' => $nx_id,
203 'active_installs' => wp_rand(50, 70),
204 'active_installs_text' => 'Try It Out',
205 'all_time' => wp_rand(50, 70),
206 'all_time_text' => 'Why Don\'t You?',
207 'anonymous_title' => 'Anonymous Title',
208 'author' => '<a href="https://wpdeveloper.com/">WPDeveloper</a>',
209 'author_profile' => 'https://profiles.wordpress.org/wpdevteam/',
210 'amount' => wp_rand(50, 70),
211 'avatar' => [
212 'src' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
213 ],
214 'picture' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
215 'city' => 'Dhaka',
216 'city_country' => 'Dhaka, Bangladesh',
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.',
218 'count' => wp_rand(50, 70),
219 'country' => 'Bangladesh',
220 'course_title' => 'PHP Beginners – Become a PHP Master',
221 'created_at' => wp_date('Y-m-d H:i:s', strtotime('2 days ago')),
222 'day' => 'days',
223 'downloaded' => wp_rand(50, 70),
224 'email' => '[email protected]',
225 'entry_id' => wp_rand(1000, 9999),
226 'entry_key' => 'ChIJ0cpDbNvBVTcRGX9JNhhpC8I',
227 'first_name' => 'John',
228 '_first_name' => 'John',
229 'formatted_address' => 'House 592, Road 8 Avenue 5, Dhaka 1216, Bangladesh',
230 'ga_title' => 'NotificationX',
231 'icon' => 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png',
232 'icons' => array(
233 '1x' => "https://ps.w.org/notificationx/assets/icon-128x128.gif?rev=2783824",
234 '2x' => "https://ps.w.org/notificationx/assets/icon-256x256.gif?rev=2783824",
235 ),
236 'id' => 5,
237 'image_data' => array(
238 'url' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
239 'alt' => '',
240 'classes' => 'greview_icon',
241 ),
242 'ip' => '103.108.146.88',
243 'key' => '7368a455f5c113afbfd3d8c3ea89a5ed-5719',
244 'last_name' => 'Doe',
245 '_last_name' => 'Doe',
246 'last_updated' => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
247 'last_week' => wp_rand(50, 70),
248 'last_week_text' => 'Get Started for Free.',
249 'lat' => 23.8371427,
250 'link' => '#',
251 'lon' => 90.3704629,
252 'month' => 'months',
253 'name' => 'John Doe',
254 'names' => 'John Doe',
255 'none' => '',
256 'num_ratings' => 2974,
257 'nx_id' => '60',
258 'order_id' => 5815,
259 'place_id' => 'ChIJ0cpDbNvBVTcRGX9JNhhpC8I',
260 'place_name' => 'WPDeveloper',
261 'plugin_name' => 'NotificationX',
262 'plugin_name_text' => 'try it out',
263 'plugin_review' => 'Lorem Ipsum is simply dummy text...',
264 'place_review' => 'Lorem Ipsum is simply dummy text...',
265 'plugin_theme_name' => 'NotificationX',
266 'post_link' => '#',
267 'product_id' => 168,
268 'product_title' => 'Assorted Coffee',
269 'rated' => wp_rand(50, 70),
270 'rating' => 4.4,
271 'ratings' => array(
272 0 => 48,
273 1 => 13,
274 2 => 21,
275 3 => 66,
276 4 => 2826,
277 ),
278 'realtime_siteview' => wp_rand(50, 70),
279 'siteview' => wp_rand(50, 70),
280 'slug' => 'notificafionx',
281 'sometime' => 'Some time ago',
282 'source' => 'google_reviews',
283 'status' => 'wc-processing',
284 'this_page' => 'this page',
285 'timestamp' => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
286 'title' => 'Hoodie with Logo',
287 'today' => wp_rand(50, 70),
288 'today_text' => 'Try It Out',
289 'type' => 'realtime_siteview',
290 'updated_at' => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
291 'url' => '#',
292 'user_id' => '1',
293 'username' => 'johndoe',
294 'version' => '5.5.2',
295 'views' => wp_rand(50, 70),
296 'website' => 'https://wpdeveloper.com/',
297 'year' => 'years',
298 'yesterday' => wp_rand(50, 70),
299 'your-email' => '[email protected]',
300 'your-message' => 'Lorem Ipsum is simply dummy text.',
301 'your-name' => 'John Doe',
302 'your-subject' => 'Lorem Ipsum',
303 'post_title' => 'Hello World',
304 'sales_count' => wp_rand(50, 70),
305 'donation_count' => wp_rand(50, 70),
306 '1day' => __('In last 1 day', 'notificationx'),
307 '7days' => __('In last 7 days', 'notificationx'),
308 '30days' => __('In last 30 days', 'notificationx'),
309 'post_comment' => 'Lorem Ipsum is simply dummy text...',
310 // 'select_a_tag' => 'Jhon',
311
312 ];
313
314 if (!empty($settings['custom_contents']) && is_array($settings['custom_contents']) && count($settings['custom_contents'])) {
315 $custom = !empty($settings['custom_contents'][0]) ? $settings['custom_contents'][0] : [];
316 if (isset($custom['first_name'], $custom['last_name'])) {
317 $custom['name'] = Helper::name($custom['first_name'], $custom['last_name']);
318 }
319 $defaults = array_merge($defaults, $custom);
320 }
321
322 $settings['freemius_plugins'] = '';
323
324 $defaults['image_data'] = FrontEnd::get_instance()->apply_defaults((array) FrontEnd::get_instance()->get_image_url($defaults, $settings), $defaults['image_data']);
325
326 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
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.
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.
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.
333 $_defaults = apply_filters('nx_fallback_data', $_defaults, $_defaults, $settings);
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.
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.
338 $defaults = apply_filters("nx_filtered_entry_$source", $defaults, $settings);
339 // $defaults = $this->link_url($defaults, $settings);
340 if (strpos($settings['theme'], 'maps_theme') !== false && 'maps_image' === $settings['show_notification_image']) {
341 $defaults['image_data'] = array(
342 'url' => NOTIFICATIONX_ASSETS . 'admin/images/map.jpg',
343 'alt' => '',
344 'classes' => 'greview_icon',
345 );
346 }
347 if ('gravatar' === $settings['show_notification_image']) {
348 $defaults['image_data'] = array(
349 'url' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
350 'alt' => '',
351 'classes' => 'greview_icon',
352 );
353 }
354 if ('none' === $settings['show_notification_image'] && !$settings['show_default_image']) {
355 $defaults['image_data'] = false;
356 }
357 return $defaults;
358 }
359
360 public function get_settings() {
361 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reviewed for the NotificationX codebase: acceptable in this context.
362 if ( empty($_POST['nx-preview']) ) {
363 return array();
364 }
365
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 );
368 $settings = json_decode( $settings, true );
369
370 if ( ! is_array($settings) ) {
371 return array();
372 }
373
374 // Simple sanitization
375 array_walk_recursive( $settings, function ( &$value ) {
376 if ( is_string( $value ) ) {
377 $value = wp_strip_all_tags( $value );
378 }
379 });
380
381 return $settings;
382 }
383
384 public function preview_settings($settings = []) {
385 $settings = !empty($settings) ? $settings : $this->get_settings();
386
387 if (empty($settings['source'])){
388 return [];
389 }
390
391 if ($settings['global_queue']) {
392 $settings['global_queue'] = false;
393 $settings['_global_queue'] = true;
394 }
395 $settings['nx_id'] = wp_rand();
396 $settings['is_preview'] = true;
397 if (empty($settings['theme']) && !empty($settings['themes'])) {
398 $settings['theme'] = $settings['themes'];
399 }
400 if ('form' === $settings['type']) {
401 $settings['notification-template']['first_param'] = 'tag_first_name';
402 }
403 if( !empty( $settings['notification-template'] ) ) {
404 $settings['notification-template'] = array_map( 'esc_html', $settings['notification-template'] );
405 }
406
407 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
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.
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.
412 $settings = apply_filters('nx_get_post', $settings);
413 return $settings;
414 }
415
416 public function content_heading($tabs) {
417 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
418 $urls = apply_filters('nx_preview_url', [
419 'default' => trailingslashit(home_url()),
420 ]);
421
422 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
423 $tabs['config']['content_heading']['talk_to_support'] = apply_filters('talk_to_support', [
424 'text' => __('Talk to Support', 'notificationx'),
425 'classes' => 'nx-talk-to-support',
426 'type' => 'button',
427 'name' => 'talk_to_support',
428 'target' => '_blank',
429 'href' => esc_url('https://notificationx.com/support/?support=chat'),
430 ]);
431 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
432 $tabs['config']['content_heading']['preview'] = apply_filters('nx_content_heading_preview', [
433 'label' => __('Preview', 'notificationx'),
434 'type' => 'preview-modal',
435 'name' => 'preview',
436 'urls' => $urls,
437 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
438 'errors' => apply_filters('nx_content_heading_preview_errors', []),
439 'rules' => Rules::logicalRule([
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),
441 Rules::is('type', 'notification_bar', true),
442 ]),
443 ]);
444 return $tabs;
445 }
446
447 public function inline_notifications_data($return, $source, $id, $settings = []) {
448 if ($this->is_preview() && !empty($id)) {
449 $settings = $this->preview_settings($settings);
450 $settings['is_preview'] = true;
451
452 if ( ( empty($settings['source']) || empty($settings['type']) || 'inline' !== $settings['type']) && ('woocommerce_sales_inline' !== $settings['source']) ){
453 return;
454 }
455
456 remove_filter('nx_inline_notifications_data', [$this, 'inline_notifications_data'], 10);
457
458 $source = !empty($settings['source']) ? $settings['source'] : '';
459 $type = !empty($settings['type']) ? $settings['type'] : '';
460 $settings['inline_location'] = is_array($settings['inline_location']) ? $settings['inline_location'] : [];
461 $settings['inline_location'][] = 'woocommerce_before_add_to_cart_form';
462
463 $defaults = [
464 "nx_id" => wp_rand(),
465 "entry_id" => 78,
466 "order_id" => 96,
467 "product_id" => $id,
468 "id" => $id,
469 // "status" => "wc-pending",
470 "title" => get_the_title($id),
471 "product_title" => get_the_title($id),
472 "link" => "#",
473 "timestamp" => gmdate('Y-m-d H:i:s', strtotime('2 days ago')),
474 // "first_name" => "John",
475 // "last_name" => "Doe",
476 // "name" => "John Doe",
477 "email" => "[email protected]",
478 "source" => $source,
479 "entry_key" => "96-7",
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')),
482 "none" => "",
483 // "anonymous_title" => "Anonymous Product",
484 // "sometime" => "Some time ago",
485 "sales_count" => wp_rand(50, 70),
486 "donation_count" => wp_rand(50, 70),
487 // "30days" => "in last 30 days",
488 // "day:30" => "30 days",
489 // "1day" => "in last 1 day",
490 // "7days" => "in last 7 days",
491 ];
492
493
494 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
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.
497 $_defaults = apply_filters('nx_fallback_data', $_defaults, $_defaults, $settings);
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.
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.
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.
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.
506 $defaults = apply_filters("nx_filtered_entry_$source", $defaults, $settings);
507
508 return [
509 'shortcode' => [
510 [
511 "entries" => [$defaults],
512 "post" => $settings,
513 ],
514 ],
515 ];
516 }
517
518 return $return;
519 }
520
521 public function is_preview() {
522 $is_preview = false;
523 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reviewed for the NotificationX codebase: acceptable in this context.
524 if (!empty($_POST['nx-preview'])) {
525 $is_preview = true;
526 }
527 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
528 $is_preview = apply_filters('nx_is_preview',$is_preview);
529 return $is_preview;
530 }
531 }
532