PluginProbe
Booking Calendar / 10.11
Booking Calendar v10.11
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / _functions / news_version.php

news_version.php in Booking Calendar 10.11, at includes/_functions/news_version.php

172 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar
5 * @subpackage Check News, Version
6 * @category Functions
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2024-09-03
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
17
18 // =====================================================================================================================
19 // == Check News, Version ==
20 // =====================================================================================================================
21
22 define ('OBC_CHECK_URL', 'https://wpbookingcalendar.com/');
23
24
25 function wpdev_ajax_check_bk_news( $sub_url = '' ){
26
27 $v=array();
28 if (class_exists('wpdev_bk_personal')) $v[] = 'wpdev_bk_personal';
29 if (class_exists('wpdev_bk_biz_s')) $v[] = 'wpdev_bk_biz_s';
30 if (class_exists('wpdev_bk_biz_m')) $v[] = 'wpdev_bk_biz_m';
31 if (class_exists('wpdev_bk_biz_l')) $v[] = 'wpdev_bk_biz_l';
32 if (class_exists('wpdev_bk_multiuser')) $v[] = 'wpdev_bk_multiuser';
33
34 $obc_settings = array();
35 $ver = get_bk_option('bk_version_data');
36 if ( $ver !== false ) { $obc_settings = array( 'subscription_key'=>wp_json_encode($ver) ); }
37
38 $params = array(
39 'action' => 'get_news',
40 'subscription_email' => isset($obc_settings['subscription_email'])?$obc_settings['subscription_email']:false,
41 'subscription_key' => isset($obc_settings['subscription_key'])?$obc_settings['subscription_key']:false,
42 'bk' => array('bk_ver'=>WPDEV_BK_VERSION, 'bk_url'=>WPBC_PLUGIN_URL,'bk_dir'=>WPBC_PLUGIN_DIR, 'bk_clss'=>$v),
43 'siteurl' => get_option('siteurl'),
44 'siteip' => wpbc_get_server_ip(), // FixIn: 9.8.14.3.
45 'admin_email' => get_option('admin_email')
46 );
47
48 $request = new WP_Http();
49 if (empty($sub_url)) $sub_url = 'info/';
50 $result = $request->request( OBC_CHECK_URL . $sub_url, array(
51 'method' => 'POST',
52 'timeout' => 15,
53 'body' => $params
54 ));
55
56 if (!is_wp_error($result) && ($result['response']['code']=='200') && (true) ) {
57
58 $string = ($result['body']); //$string = str_replace( "'", '&#039;', $string );
59 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
60 echo $string;
61 echo ' <script type="text/javascript"> ';
62 echo ' jQuery("#ajax_bk_respond").after( jQuery("#ajax_bk_respond #bk_news_loaded") );';
63 echo ' jQuery("#bk_news_loaded").slideUp(1).slideDown(1500);';
64 echo ' </script> ';
65
66 } else /**/
67 { // Some error appear
68 echo '<div id="bk_errror_loading">';
69 if ( is_wp_error( $result ) ) {
70 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
71 echo $result->get_error_message();
72 } else {
73 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
74 echo $result['response']['message'];
75 }
76 echo '</div>';
77 echo ' <script type="text/javascript"> ';
78 echo ' document.getElementById("bk_news").style.display="none";';
79 echo ' jQuery("#ajax_bk_respond").after( jQuery("#ajax_bk_respond #bk_errror_loading") );';
80 echo ' jQuery("#bk_errror_loading").slideUp(1).slideDown(1500);';
81 echo ' jQuery("#bk_news_section").animate({opacity:1},3000).slideUp(1500);';
82 echo ' </script> ';
83 }
84
85 }
86
87
88 /**
89 * Check if user defined to not show up_news section.
90 *
91 */
92 function wpbc_is_show_up_news(){ // FixIn: 8.1.3.9.
93
94 $wpdev_copyright_adminpanel = get_bk_option( 'booking_wpdev_copyright_adminpanel' ); // check
95 if ( ( $wpdev_copyright_adminpanel === 'Off' )
96 && ( ! wpbc_is_this_demo() )
97 && ( class_exists('wpdev_bk_personal') )
98 ) {
99 return false;
100 } else {
101 return true;
102 }
103 }
104
105
106 function wpdev_ajax_check_bk_version(){
107 $v=array();
108 if (class_exists('wpdev_bk_personal')) $v[] = 'wpdev_bk_personal';
109 if (class_exists('wpdev_bk_biz_s')) $v[] = 'wpdev_bk_biz_s';
110 if (class_exists('wpdev_bk_biz_m')) $v[] = 'wpdev_bk_biz_m';
111 if (class_exists('wpdev_bk_biz_l')) $v[] = 'wpdev_bk_biz_l';
112 if (class_exists('wpdev_bk_multiuser')) $v[] = 'wpdev_bk_multiuser';
113
114 $obc_settings = array();
115 $params = array(
116 'action' => 'set_register',
117 'order_number' => isset( $_POST['order_num'] ) ? sanitize_text_field( wp_unslash( $_POST['order_num'] ) ) : false, // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
118 'bk' => array( 'bk_ver' => WPDEV_BK_VERSION,
119 'bk_url' => WPBC_PLUGIN_URL,
120 'bk_dir' => WPBC_PLUGIN_DIR,
121 'bk_clss' => $v,
122 ),
123 'siteurl' => get_option( 'siteurl' ),
124 'siteip' => wpbc_get_server_ip(), // FixIn: 9.8.14.3.
125 'admin_email' => get_option( 'admin_email' ),
126 );
127
128 update_bk_option( 'bk_version_data', serialize( $params ) );
129
130 $request = new WP_Http();
131 $result = $request->request( OBC_CHECK_URL . 'register/', array(
132 'method' => 'POST',
133 'timeout' => 15,
134 'body' => $params
135 ));
136
137 if ( ! is_wp_error($result)
138 && ( $result['response']['code']=='200' )
139 && ( true ) ) {
140
141 $string = ($result['body']); //$string = str_replace( "'", '&#039;', $string );
142 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
143 echo $string;
144 echo ' <script type="text/javascript"> ';
145 echo ' jQuery("#ajax_message").append( jQuery("#ajax_respond #bk_registration_info") );';
146 echo ' jQuery("#ajax_message").append( "<div id=\'bk_registration_info_reload\'>If page will not reload automatically, please refresh page after 60 seconds...</div>" );';
147 echo ' </script> ';
148
149 } else { // Some error appear
150 echo '<div id="bk_errror_loading" class="warning_message" >';
151 echo '<div class="info_message">'; esc_html_e('Warning! Some error occur, during sending registration request.' ,'booking'); echo '</div>';
152
153 if ( is_wp_error( $result ) ) {
154 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
155 echo $result->get_error_message();
156 } else {
157 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
158 echo $result['response']['message'];
159 }
160 echo '<br /><br />';
161 esc_html_e('Please refresh this page and if the same error appear again contact support by email (with info about order number and website) for finishing the registrations' ,'booking'); echo ' <a href="mailto:activate@wpbookingcalendar.com">activate@wpbookingcalendar.com</a>';
162 echo '</strong></div>';
163 echo ' <script type="text/javascript"> ';
164 echo ' jQuery( "#ajax_message" ).html( "" );';
165
166 echo ' jQuery("#ajax_message").append( jQuery("#ajax_respond #bk_errror_loading") );';
167 echo ' jQuery("#bk_errror_loading").slideUp(1).slideDown(1500);';
168
169 echo ' jQuery("#recheck_version").animate({opacity:1},3000).slideUp(1500);';
170 echo ' </script> ';
171 }
172 }