PluginProbe
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar / trunk
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar vtrunk
2.1.21 2.1.20 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 trunk 1.1 2.0 2.0.1 2.0.10.2 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.17 2.0.18 2.0.2 2.0.20 2.0.21 2.0.22 All 55 releases
booking-manager / core / admin / page-root-ics.php

page-root-ics.php in Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar trunk, at core/admin/page-root-ics.php

523 lines 24.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @package Booking Manager
4 * @category Content of item Listing page
5 * @author wpdevelop
6 *
7 * @web-site https://oplugins.com/
8 * @email info@oplugins.com
9 *
10 * @modified 2015-11-13
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 /** Show Content
17 * Update Content
18 * Define Slug
19 * Define where to show
20 */
21 class WPBM_Page_Single extends WPBM_Page_Structure {
22
23
24 public function in_page() {
25 return 'oplugins';
26 }
27
28
29 public function tabs() {
30
31 $tabs = array();
32 $tabs[ 'wpbm' ] = array(
33 'title' => __( 'Manage .ics', 'booking-manager' ) // Title of TAB
34 , 'hint' => __( 'Upload .ics File', 'booking-manager' ) // Hint
35 , 'page_title' => __( 'Booking Manager', 'booking-manager' ) // Title of Page
36 , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
37 , 'position' => '' // 'left' || 'right' || ''
38 , 'css_classes' => '' // CSS class(es)
39 , 'icon' => '' // Icon - link to the real PNG img
40 , 'font_icon' => 'glyphicon glyphicon-tasks' // CSS definition of forn Icon
41 , 'default' => true // Is this tab activated by default or not: true || false.
42 , 'disabled' => false // Is this tab disbaled: true || false.
43 , 'hided' => ! true // Is this tab hided: true || false.
44 , 'subtabs' => array()
45
46 );
47 $subtabs = array();
48 // $tabs[ 'items' ][ 'subtabs' ] = $subtabs;
49 // $subtabs['manage'] = array(
50 // 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
51 // , 'title' => __( 'Manage .ics', 'booking-manager' ) // Title of TAB
52 // , 'hint' => __( 'Upload .ics File', 'booking-manager' ) // Hint
53 // , 'page_title' => __( 'Booking Manager', 'booking-manager' ) // Title of Page
54 // , 'link' => '' // link
55 // , 'position' => '' // 'left' || 'right' || ''
56 // , 'css_classes' => '' // CSS class(es)
57 // //, 'icon' => 'http://.../icon.png' // Icon - link to the real PNG img
58 // //, 'font_icon' => 'glyphicon glyphicon-envelope' // CSS definition of Font Icon
59 // , 'default' => true // Is this sub tab activated by default or not: true || false.
60 // , 'disabled' => false // Is this sub tab deactivated: true || false.
61 // , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' ) //, 'checkbox' => array( 'checked' => $is_checked, 'name' => 'enabled_active_status' )
62 // , 'content' => 'content' // Function to load as conten of this TAB
63 // , 'hided' => true // Is this tab hided: true || false.
64 // );
65
66 $tabs[ 'wpbm' ]['subtabs'] = $subtabs;
67 return $tabs;
68
69 }
70
71
72 public function content() {
73
74 // Checking ////////////////////////////////////////////////////////////
75
76 do_action( 'wpbm_hook_settings_page_header', array( 'page' => $this->in_page() ) ); // Define Notices Section and show some static messages, if needed.
77
78 // $this->settings_api(); // Init Settings API & Get Data from DB
79
80 // Submit /////////////////////////////////////////////////////////////
81
82 $submit_form_name = 'wpbm_ics_files_form'; // Define form name
83
84
85 if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) {
86
87 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
88 $nonce_gen_time = check_admin_referer( 'wpbm_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page
89
90 // Save Changes
91 $data_after_update = $this->update();
92 }
93
94 // $wpbm_user_role_master = get_wpbm_option( 'wpbm_user_role_master' ); // O L D W A Y: Get Fields Data
95 ?><div class="wpbm-replace-container" style="display:none;"><?php
96
97 ?><span class="wpbm_help_upgrade"><?php
98 wpbm_bs_dropdown_menu( array(
99 'title' => __( 'Help', 'booking-manager' )
100 , 'font_icon' => 'glyphicon glyphicon-info-sign'
101 , 'position' => 'right'
102 , 'items' => array(
103 array( 'type' => 'link', 'title' => __('Shortcode configuration', 'booking-manager')
104 , 'url' => 'https://oplugins.com/plugins/wp-booking-manager/booking-manager-help/' //esc_url( admin_url( add_query_arg( array( 'page' => 'oplugins', 'tab' => 'wpbm', 'subtab' => 'help_shortcodes' ), 'admin.php' ) ) )
105 )
106 , array( 'type' => 'divider' )
107 , array( 'type' => 'link', 'title' => __('Help', 'booking-manager'), 'url' => 'https://oplugins.com/plugins/booking-manager/#faq' )
108 //, array( 'type' => 'link', 'title' => __('FAQ', 'booking-manager'), 'url' => 'https://oplugins.com/plugins/booking-manager/#faq' )
109 , array( 'type' => 'link', 'title' => __('Technical Support', 'booking-manager'), 'url' => 'mailto:support@oplugins.com?subject=booking-manager' )
110 , array( 'type' => 'divider' )
111 , array( 'type' => 'link', 'title' => __('Upgrade Now', 'booking-manager'), 'url' => wpbm_up_link()
112 , 'attr' => array(
113 'target' => '_blank'
114 , 'style' => 'font-weight: 600;font-size: 1em;'
115 )
116 )
117 )
118 ) );
119 ?></span><?php
120
121 ?></div><?php
122 ?><script type="text/javascript">
123 jQuery(document).ready(function(){
124 jQuery( '.wpbm_help_upgrade' ).insertAfter( '.wpdevelop.wpdvlp-nav-tabs-container .wpdvlp-top-tabs .nav-tabs a:last' );
125 //jQuery( '.wpdvlp-sub-tabs' ).hide();
126 });
127 </script><?php
128
129
130 ?><span class="wpdevelop"><?php
131
132 wpbm_js_for_items_page(); // JavaScript: - Tooltips, Popover, Datepick (js & css)
133
134 // wpbm_items_toolbar(); // T o o l b a r s - BS UI CSS Class
135
136 ?></span><?php
137 ?><div class="clear" style="height:0px;"></div><?php
138 // Content ////////////////////////////////////////////////////////////
139 ?>
140 <div class="clear" style="margin-bottom:10px;"></div>
141 <span class="metabox-holder">
142 <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post" >
143 <?php
144 // N o n c e field, and key for checking S u b m i t
145 wp_nonce_field( 'wpbm_settings_page_' . $submit_form_name );
146 ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" />
147
148 <div class="clear" style="margin-bottom:0px;"></div>
149
150 <?php
151 wpbm_open_meta_box_section( 'wpbm_settings_ics_upload_section', __( 'Upload .ics file and show events', 'booking-manager' ) );
152
153 $this->show_toolbar_upload();
154
155 wpbm_close_meta_box_section();
156
157
158
159 ///////////////////////////////////////////////////////////
160 $notice_id = 'wpbm_system_notice_ics_description';
161 ///////////////////////////////////////////////////////////
162 if ( ( ! wpbm_section_is_dismissed( $notice_id ) )
163 // || true
164 ) {
165
166 ?><div id="<?php echo $notice_id; ?>"
167 class="wpbm_system_notice wpbm_is_dismissible wpbm_is_hideable wpbm-settings-notice notice-info""
168 data-nonce="<?php echo wp_create_nonce( $nonce_name = $notice_id . '_wpbmnonce' ); ?>"
169 data-user-id="<?php echo get_current_user_id(); ?>"
170 style="margin: 20px 0 !important;line-height: 2em;padding: 10px 20px;"
171 ><?php
172
173 wpbm_x_dismiss_button();
174
175 //echo '<strong>' . __( 'Note!', 'booking-manager' ) . '</strong> ';
176
177 $message_ics = sprintf(
178 __( '.ics - is a file format of iCalendar standard for exchanging calendar and scheduling information between different sources %s Using a common calendar format (.ics), you can keep all your calendars updated and synchronized.', 'booking-manager' )
179 ,
180 '<br/><em>(<strong><a href="https://www.airbnb.com/help/article/99/how-do-i-sync-my-airbnb-calendar-with-another-calendar" target="_blank">Airbnb</a></strong>, '
181 . '<strong><a href="https://partnersupport.booking.com/hc/en-us/articles/213424709-How-do-I-export-my-calendar-" target="_blank">Booking.com</a></strong>, '
182 . '<strong><a href="https://help.homeaway.com/articles/How-do-I-export-my-calendar-data-to-a-Google-calendar" target="_blank">HomeAway</a></strong>, '
183 . '<strong><a href="https://rentalsupport.tripadvisor.com/articles/FAQ/noc-How-does-calendar-sync-work" target="_blank">TripAdvisor</a></strong>, '
184 . '<strong><a href="https://help.vrbo.com/articles/How-do-I-export-my-calendar-data-to-a-Google-calendar" target="_blank">VRBO</a></strong>, '
185 . '<strong><a href="https://helpcenter.flipkey.com/articles/FAQ/noc-How-does-calendar-sync-work" target="_blank">FlipKey</a></strong> '
186 . str_replace( array( '.ics', 'iCalendar' ), array( '<strong>.ics</strong>', '<strong>iCalendar</strong>' ),
187 __( 'and any other calendar that uses .ics format', 'booking-manager' )
188 )
189 . ')</em>.<br/>'
190 );
191 $message_ics = str_replace( array( '.ics', 'iCalendar' ), array( '<strong>.ics</strong>', '<strong>iCalendar</strong>' ), $message_ics );
192 echo $message_ics;
193
194
195 ?></div><?php
196 }
197 ///////////////////////////////////////////////////////////
198
199
200
201
202
203 wpbm_open_meta_box_section( 'wpbm_settings_ics_listing_log', __( 'Log', 'booking-manager' ) );
204 ?><div class="wpbm_system_info_log"></div><?php
205 wpbm_close_meta_box_section();
206 /* ?>
207 <input type="button" value="<?php _e('Send', 'booking-manager'); ?>" class="button button-primary wpbm_send_button" />
208 <input type="submit" value="<?php _e('Submit', 'booking-manager'); ?>" class="button button-primary wpbm_submit_button" />
209 <?php /**/
210 ?>
211 </form>
212 <?php
213
214 ?>
215 </span>
216 <?php
217
218 wpbm_show_wpbm_footer(); // Rating
219
220 wpbm_ics_listing_ajax_js();
221
222 $this->css();
223
224 do_action( 'wpbm_hook_settings_page_footer', 'ics_files' );
225 }
226
227 /** Currently is not being used */
228 public function update() {
229
230 return false;
231
232 $post_action_key = 'wpbm_action';
233 if ( isset( $_POST[ $post_action_key ] ) && ( $_POST[ $post_action_key ] == 'go_send' ) ) {
234
235 // Get Validated post
236 $validated = array();
237
238 // Email
239 $validated[ 'wpbm_textdata' ] = WPBM_Settings_API::validate_textarea_post_static( 'wpbm_textdata' );
240 //debuge( $validated );
241
242 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
243
244 wpbm_show_fixed_message ( __('Done', 'booking-manager'), 3 ); //, 'updated warning' ); // Show Message
245
246 return array ( 'validated_data' => $validated ); // Exit, for do not parse
247 }
248
249 /** Buld data saving to DB from POST
250 //$validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request.
251 //$validated_fields = apply_filters( 'wpbm_settings_validate_fields_before_saving', $validated_fields ); // Hook for validated fields.
252
253 // unset($validated_fields['wpbm_start_day_weeek']); // Skip saving specific option, for example in Demo mode.
254 //$this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB
255 //wpbm_show_changes_saved_message();
256 //wpbm_show_fixed_message ( __('Done', 'booking-manager'), 0 ); // Show Message
257 */
258
259 /** O L D W A Y: Saving Fields Data
260 // update_wpbm_option( 'wpbm_is_delete_if_deactive'
261 // , WPBM_Settings_API::validate_checkbox_post('wpbm_is_delete_if_deactive') );
262 // ( (isset( $_POST['wpbm_is_delete_if_deactive'] ))?'On':'Off') );
263 */
264
265 return false;
266 }
267
268
269 /** Show Toolbar with Upload / List fields */
270 function show_toolbar_upload() {
271
272 // Parameters for Ajax:
273
274 ?><div class="wpbm_listing_ics_bar" id="wpbm_listing_ics_bar"
275 data-nonce="<?php echo wp_create_nonce( $nonce_name = 'wpbm_listing_ics_nonce_actn' ); ?>"
276 data-user-id="<?php echo get_current_user_id(); ?>"
277 ><?php
278 ?>
279 <div class="wpbm_listing_div">
280 <input type="text"
281 class="wpbm_listing_url" name="wpbm_listing_url" id="wpbm_listing_url"
282 placeholder="<?php _e( 'URL to .ics feed', 'booking-manager' ) ?>"
283 value="" wrap="off"
284 />
285 <?php if ( function_exists( 'wpbm_upload' ) ) { ?>
286 <a href="javascript:void(0)" class="button button-secondary wpbm_upload_btn"
287 data-modal_title="<?php echo esc_attr( __( 'Choose file', 'booking-manager' ) ); ?>"
288 data-btn_title="<?php echo esc_attr( __( 'Insert file URL', 'booking-manager' ) ); ?>"
289 ><?php _e('Upload / Select ', 'booking-manager' ); ?> <strong>(.ics)</strong></a>
290 <?php } ?>
291 <a class="button button-primary wpbm_listing_btn" href="javascript:void(0)"><?php _e('Show Events (.ics)', 'booking-manager'); ?></a>
292 </div>
293 <?php
294 if ( function_exists( 'wpbm_upload' ) ) { // Get WPBM_Upload obj. instance
295
296 $wpbm_upload = wpbm_upload();
297
298 $wpbm_upload->set_upload_button( '.wpbm_upload_btn' );
299
300 $wpbm_upload->set_element_insert_url( '.wpbm_listing_url' );
301 }
302 ?>
303 <div class="clear"></div>
304 <div class="wpbm_system_info_log0"></div>
305 <div class="clear"></div>
306 </div>
307 <?php
308 }
309
310
311
312 // <editor-fold defaultstate="collapsed" desc=" C S S " >
313 public function css() {
314 ?>
315 <style type="text/css">
316 .wpbm_listing_ics_bar .wpbm_listing_btn,
317 .wpbm_listing_ics_bar .wpbm_upload_btn{
318 float:left;
319 margin:9px 5px 10px 1px;
320
321 }
322 .wpbm_listing_ics_bar .wpbm_listing_div {
323 float:left;
324 width:100%;
325 display: flex;
326 flex-flow: row wrap;
327 gap: 10px;
328 justify-content: flex-start;
329 align-items: center;
330 }
331 .wpbm_listing_ics_bar .wpbm_listing_br_selection,
332 .wpbm_listing_ics_bar .wpbm_listing_url {
333
334
335
336
337
338
339
340
341 }
342 .wpbm_listing_ics_bar .wpbm_listing_url {
343 flex: 1 1 auto;
344 height: 40px;
345 max-width: Min( 500px, 100% );
346 margin-right: 20px;
347 }
348 .wpbm_system_info_log {
349 font-size: 11px;
350 line-height: 1.5em;
351 /* border: 2px dashed #e85; */
352 padding: 5px 20px;
353 margin-top:10px;
354 }
355
356 #wpbm_textdata {
357 width: 100%;
358 font-size: 1.4em;
359 font-weight: 600;
360 }
361 /* iPad mini and all iPhones and other Mobile Devices */
362 @media (max-width: 782px) {
363 .wpbm_listing_ics_bar .wpbm_listing_url {
364 width:100%;
365 }
366 .wpbm_page .wpbm_send_button {
367 padding: 2px;
368 margin-top: 1px;
369 }
370 }
371 </style>
372 <?php
373 }
374 // </editor-fold>
375 }
376 add_action('wpbm_menu_created', array( new WPBM_Page_Single() , '__construct') ); // Executed after creation of Menu
377
378
379 // <editor-fold defaultstate="collapsed" desc=" A J A X R e q u e s t " >
380 ////////////////////////////////////////////////////////////////////////////////
381 // AJAX Request
382 ////////////////////////////////////////////////////////////////////////////////
383
384 /** JavaScript for Ajax */
385 function wpbm_ics_listing_ajax_js() {
386
387 $ajx_el_id = 'wpbm_listing_ics_bar';
388
389 // In "wpbm-ajax.php" having this: , 'WPBM_LISTING_ICS_URL' => 'admin'
390
391 ?>
392 <script type="text/javascript">
393 // Ajax Request
394 jQuery( function ( $ ) { // Shortcut to jQuery(document).ready(function(){ ... });
395
396 jQuery( '.wpbm_listing_ics_bar' ).on( 'click', '.wpbm_listing_btn', function ( event ) { // This delegated event, can be run, when DOM element added after page loaded
397
398 wpbm_admin_show_message_processing( '' );
399
400 var jq_el = jQuery( this ).closest( '.wpbm_listing_ics_bar' );
401
402 var params_obj = {};
403 params_obj.id = jq_el.attr( 'id' );
404 params_obj.nonce = jq_el.attr( 'data-nonce' );
405 params_obj.user_id = jq_el.attr( 'data-user-id' );
406
407 params_obj.wpbm_listing_url = jQuery( '#wpbm_listing_url' ).val();
408 // params_obj.wpbm_listing_br_selection = 1;
409 // if ( jQuery( '#wpbm_listing_br_selection option' ).length > 0 )
410 // params_obj.wpbm_listing_br_selection = jQuery( '#wpbm_listing_br_selection option' ).filter( ':selected' ).val();
411
412 // console.log(params_obj);
413
414 jQuery.post( wpbm_ajaxurl, {
415 action: 'WPBM_LISTING_ICS_URL',
416 user_id: params_obj.user_id ,
417 nonce: params_obj.nonce,
418 params: params_obj
419 },
420 function ( response_data, textStatus, jqXHR ) { // success
421
422 var my_message = '<?php echo html_entity_decode( esc_js( __('Done' ,'booking-manager') ),ENT_QUOTES) ; ?>';
423 wpbm_admin_show_message( my_message, 'info', 10000 , false );
424
425 //console.log( response_data ); console.log( textStatus); console.log( jqXHR ); // Debug
426 //jQuery( '.wpbm_system_info_log' ).show(); //Show Debug info
427 response_data = response_data.replace( '{"response":"success"}', '' );
428 jQuery( '.wpbm_system_info_log' ).html( response_data ); // For ability to show response, add such DIV element to page
429 wpbm_scroll_to('#wpbm_settings_ics_listing_log_metabox' );
430 }
431 ).fail( function ( jqXHR, textStatus, errorThrown ) {
432 wpbm_admin_show_message( '<strong style="text-transform: uppercase;">' + textStatus + '</strong> ~ ' + errorThrown , 'error', 5000 );
433 if ( window.console && window.console.log ){ console.log( 'Ajax_Error', jqXHR, textStatus, errorThrown ); }
434 })
435 // .done( function ( data, textStatus, jqXHR ) { if ( window.console && window.console.log ){ console.log( 'second success', data, textStatus, jqXHR ); } })
436 // .always( function ( data_jqXHR, textStatus, jqXHR_errorThrown ) { if ( window.console && window.console.log ){ console.log( 'always finished', data_jqXHR, textStatus, jqXHR_errorThrown ); } })
437 ;
438
439 });
440
441 });
442 </script>
443 <?php
444 }
445
446
447 /** Ajax Response */
448 function wpbm_ajax_WPBM_LISTING_ICS_URL() {
449
450 if ( ! isset( $_POST['params'] ) || empty( $_POST['params'] ) ) {
451 exit;
452 }
453
454 // Check Security
455 $action_nonce_name = 'wpbm_listing_ics_nonce_actn';
456 $nonce_post_key = 'nonce';
457 $result = check_ajax_referer( $action_nonce_name, $nonce_post_key ); // Check Security
458
459 $is_show_debug_info = false;
460 if ( function_exists( 'get_bk_option' ) )
461 $is_show_debug_info = ( ( get_bk_option( 'booking_is_show_system_debug_log' ) == 'On' ) ? true : false ); // Based on "Booking Calendar" - "show_system_debug_log" option !!!
462
463 if ( $is_show_debug_info )
464 add_action( 'wpbm_show_debug', 'wpbm_start_showing_debug', 10, 1 );
465
466 do_action( 'wpbm_show_debug', array( 'Import Parameters' , $_POST ) ); // S_Y_S_T_E_M L_O_G
467
468 if ( empty( $_POST[ 'params' ][ 'wpbm_listing_url'] ) ) {
469 do_action( 'wpbm_admin_show_top_notice', __( 'No ics url feed', 'booking-manager' ), 'error', 5000 ); // N_O_T_I_C_E in H_E_A_D_E_R
470 return false;
471 }
472
473 $params = array(
474 'url' => esc_url_raw( $_POST[ 'params' ][ 'wpbm_listing_url'] ) //FixIn: 2.0.14.3
475 , 'from' => 'any' //'today' // '00:00 today'
476 , 'from_offset' => ''
477 , 'until' => 'any' //'year-end' // '00:00 today'
478 , 'until_offset' => ''
479 , 'max' => ''
480 , 'is_all_dates_in' => true
481 );
482 $listing_echo = wpbm_ics_get_listing( $params );
483
484 if ( $is_show_debug_info )
485 do_action( 'wpbm_show_debug', array( '$listing_echo', $is_show_debug_info, $listing_echo ) ); // S_Y_S_T_E_M L_O_G
486
487 ///////////////////////////////////////////////////////////////////////////////////////
488 // Get Listing Shortcode
489 ///////////////////////////////////////////////////////////////////////////////////////
490 ob_start();
491 ?>
492 <div class="wpbm-settings-notice notice-info"
493 style="text-align:left;border-top:1px solid #f0f0f0;border-right:1px solid #f0f0f0;line-height: 2em;font-size: 13px;margin:10px 0 20px;">
494 <?php echo ( esc_js( __( 'Insert this shortcode into page for showing these events at front-end side of your website.', 'booking-manager' ) ) ); ?>
495 <br>
496 <code>[booking-manager-listing url='<?php echo esc_url( $_POST[ 'params' ][ 'wpbm_listing_url'] ); ?>' from='any' until='any']</code>
497 </div>
498 <div class="clear" style="border-top: 2px dashed #e85;height:20px;"></div>
499 <?php
500 $echo_results = ob_get_contents();
501
502 ob_end_clean();
503 ///////////////////////////////////////////////////////////////////////////////////////
504
505 echo $echo_results. $listing_echo;
506
507 if ( $is_show_debug_info )
508 remove_action( 'wpbm_show_debug', 'wpbm_start_showing_debug', 10 );
509
510 /*
511 if ( $is_show_debug_info ) {
512 // Showingdebug log section
513 ?><script type="text/javascript"> jQuery( '.wpbm_system_info_log' ).show(); </script><?php
514 }
515 */
516
517 // send JSON
518 // FixIn: 2.0.2.1 //Fix: We need to comment this line, because previously its possible that we already sent some messages, and its does not correct json format in this case.
519 //Fix: of showing "parsererror ~ SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"
520 //wp_send_json( array( 'response' => 'success' ) ); // Return JS OBJ: response_data = { response: "success" }
521 wp_die( '', '', array( 'response' => null ) );
522 }
523 // </editor-fold>