PluginProbe
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar / 2.1.7
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar v2.1.7
2.1.22 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 All 56 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 2.1.7, at core/admin/page-root-ics.php

518 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 [email protected]
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:[email protected]?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 }
326 .wpbm_listing_ics_bar .wpbm_listing_br_selection,
327 .wpbm_listing_ics_bar .wpbm_listing_url {
328 float:left;
329 width:28%;
330 height: 2em;
331 padding: 2px;
332 border-radius: 0;
333 margin:10px 5px 10px 1px;
334 /* FixIn: 2.0.13.1 */
335 min-height: 28px;
336 height: 28px;
337 margin: 9px 5px 10px 1px;
338 }
339 .wpbm_listing_ics_bar .wpbm_listing_url {
340 width:50%;
341 padding: 2px 5px;
342 }
343 .wpbm_system_info_log {
344 font-size: 11px;
345 line-height: 1.5em;
346 /* border: 2px dashed #e85; */
347 padding: 5px 20px;
348 margin-top:10px;
349 }
350
351 #wpbm_textdata {
352 width: 100%;
353 font-size: 1.4em;
354 font-weight: 600;
355 }
356 /* iPad mini and all iPhones and other Mobile Devices */
357 @media (max-width: 782px) {
358 .wpbm_listing_ics_bar .wpbm_listing_url {
359 width:100%;
360 }
361 .wpbm_page .wpbm_send_button {
362 padding: 2px;
363 margin-top: 1px;
364 }
365 }
366 </style>
367 <?php
368 }
369 // </editor-fold>
370 }
371 add_action('wpbm_menu_created', array( new WPBM_Page_Single() , '__construct') ); // Executed after creation of Menu
372
373
374 // <editor-fold defaultstate="collapsed" desc=" A J A X R e q u e s t " >
375 ////////////////////////////////////////////////////////////////////////////////
376 // AJAX Request
377 ////////////////////////////////////////////////////////////////////////////////
378
379 /** JavaScript for Ajax */
380 function wpbm_ics_listing_ajax_js() {
381
382 $ajx_el_id = 'wpbm_listing_ics_bar';
383
384 // In "wpbm-ajax.php" having this: , 'WPBM_LISTING_ICS_URL' => 'admin'
385
386 ?>
387 <script type="text/javascript">
388 // Ajax Request
389 jQuery( function ( $ ) { // Shortcut to jQuery(document).ready(function(){ ... });
390
391 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
392
393 wpbm_admin_show_message_processing( '' );
394
395 var jq_el = jQuery( this ).closest( '.wpbm_listing_ics_bar' );
396
397 var params_obj = {};
398 params_obj.id = jq_el.attr( 'id' );
399 params_obj.nonce = jq_el.attr( 'data-nonce' );
400 params_obj.user_id = jq_el.attr( 'data-user-id' );
401
402 params_obj.wpbm_listing_url = jQuery( '#wpbm_listing_url' ).val();
403 // params_obj.wpbm_listing_br_selection = 1;
404 // if ( jQuery( '#wpbm_listing_br_selection option' ).length > 0 )
405 // params_obj.wpbm_listing_br_selection = jQuery( '#wpbm_listing_br_selection option' ).filter( ':selected' ).val();
406
407 // console.log(params_obj);
408
409 jQuery.post( wpbm_ajaxurl, {
410 action: 'WPBM_LISTING_ICS_URL',
411 user_id: params_obj.user_id ,
412 nonce: params_obj.nonce,
413 params: params_obj
414 },
415 function ( response_data, textStatus, jqXHR ) { // success
416
417 var my_message = '<?php echo html_entity_decode( esc_js( __('Done' ,'booking-manager') ),ENT_QUOTES) ; ?>';
418 wpbm_admin_show_message( my_message, 'info', 10000 , false );
419
420 //console.log( response_data ); console.log( textStatus); console.log( jqXHR ); // Debug
421 //jQuery( '.wpbm_system_info_log' ).show(); //Show Debug info
422 response_data = response_data.replace( '{"response":"success"}', '' );
423 jQuery( '.wpbm_system_info_log' ).html( response_data ); // For ability to show response, add such DIV element to page
424 wpbm_scroll_to('#wpbm_settings_ics_listing_log_metabox' );
425 }
426 ).fail( function ( jqXHR, textStatus, errorThrown ) {
427 wpbm_admin_show_message( '<strong style="text-transform: uppercase;">' + textStatus + '</strong> ~ ' + errorThrown , 'error', 5000 );
428 if ( window.console && window.console.log ){ console.log( 'Ajax_Error', jqXHR, textStatus, errorThrown ); }
429 })
430 // .done( function ( data, textStatus, jqXHR ) { if ( window.console && window.console.log ){ console.log( 'second success', data, textStatus, jqXHR ); } })
431 // .always( function ( data_jqXHR, textStatus, jqXHR_errorThrown ) { if ( window.console && window.console.log ){ console.log( 'always finished', data_jqXHR, textStatus, jqXHR_errorThrown ); } })
432 ;
433
434 });
435
436 });
437 </script>
438 <?php
439 }
440
441
442 /** Ajax Response */
443 function wpbm_ajax_WPBM_LISTING_ICS_URL() {
444
445 if ( ! isset( $_POST['params'] ) || empty( $_POST['params'] ) ) {
446 exit;
447 }
448
449 // Check Security
450 $action_nonce_name = 'wpbm_listing_ics_nonce_actn';
451 $nonce_post_key = 'nonce';
452 $result = check_ajax_referer( $action_nonce_name, $nonce_post_key ); // Check Security
453
454 $is_show_debug_info = false;
455 if ( function_exists( 'get_bk_option' ) )
456 $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 !!!
457
458 if ( $is_show_debug_info )
459 add_action( 'wpbm_show_debug', 'wpbm_start_showing_debug', 10, 1 );
460
461 do_action( 'wpbm_show_debug', array( 'Import Parameters' , $_POST ) ); // S_Y_S_T_E_M L_O_G
462
463 if ( empty( $_POST[ 'params' ][ 'wpbm_listing_url'] ) ) {
464 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
465 return false;
466 }
467
468 $params = array(
469 'url' => esc_url_raw( $_POST[ 'params' ][ 'wpbm_listing_url'] ) //FixIn: 2.0.14.3
470 , 'from' => 'any' //'today' // '00:00 today'
471 , 'from_offset' => ''
472 , 'until' => 'any' //'year-end' // '00:00 today'
473 , 'until_offset' => ''
474 , 'max' => ''
475 , 'is_all_dates_in' => true
476 );
477 $listing_echo = wpbm_ics_get_listing( $params );
478
479 if ( $is_show_debug_info )
480 do_action( 'wpbm_show_debug', array( '$listing_echo', $is_show_debug_info, $listing_echo ) ); // S_Y_S_T_E_M L_O_G
481
482 ///////////////////////////////////////////////////////////////////////////////////////
483 // Get Listing Shortcode
484 ///////////////////////////////////////////////////////////////////////////////////////
485 ob_start();
486 ?>
487 <div class="wpbm-settings-notice notice-info"
488 style="text-align:left;border-top:1px solid #f0f0f0;border-right:1px solid #f0f0f0;line-height: 2em;font-size: 13px;margin:10px 0 20px;">
489 <?php echo ( esc_js( __( 'Insert this shortcode into page for showing these events at front-end side of your website.', 'booking-manager' ) ) ); ?>
490 <br>
491 <code>[booking-manager-listing url='<?php echo esc_url( $_POST[ 'params' ][ 'wpbm_listing_url'] ); ?>' from='any' until='any']</code>
492 </div>
493 <div class="clear" style="border-top: 2px dashed #e85;height:20px;"></div>
494 <?php
495 $echo_results = ob_get_contents();
496
497 ob_end_clean();
498 ///////////////////////////////////////////////////////////////////////////////////////
499
500 echo $echo_results. $listing_echo;
501
502 if ( $is_show_debug_info )
503 remove_action( 'wpbm_show_debug', 'wpbm_start_showing_debug', 10 );
504
505 /*
506 if ( $is_show_debug_info ) {
507 // Showingdebug log section
508 ?><script type="text/javascript"> jQuery( '.wpbm_system_info_log' ).show(); </script><?php
509 }
510 */
511
512 // send JSON
513 // 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.
514 //Fix: of showing "parsererror ~ SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"
515 //wp_send_json( array( 'response' => 'success' ) ); // Return JS OBJ: response_data = { response: "success" }
516 wp_die( '', '', array( 'response' => null ) );
517 }
518 // </editor-fold>