PluginProbe
Booking Calendar / 11.8
Booking Calendar v11.8
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 10.11.3 10.11.4 All 201 releases
booking / core / wpbc.php

wpbc.php in Booking Calendar 11.8, at core/wpbc.php

553 lines 22.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 Core
6 * @category Bookings
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2014.07.29
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
17 global $wp_version;
18 $wpbc_min_wp_version = version_compare( WP_BK_MIN_WP_VERSION, $wp_version, '<=' ); // FixIn: 7.0.1.6.
19 if ( ( ! class_exists( 'Booking_Calendar' ) ) && ( $wpbc_min_wp_version ) ) :
20
21
22 // General Init Class
23 final class Booking_Calendar {
24
25 static private $instance = NULL;
26
27 public $cron;
28 public $notice;
29 public $booking_obj;
30
31 public $admin_menu;
32 public $js;
33 public $css;
34
35 private $is_wp_inited = false;
36
37 /** Get Single Instance of this Class and Init Plugin */
38 public static function init() {
39
40 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Booking_Calendar ) ) {
41
42 self::$instance = new Booking_Calendar;
43 self::$instance->includes();
44 if ( defined( 'WPBC_BOOKING_MODES_ACTIVE_ENGINE' ) && 'none' === WPBC_BOOKING_MODES_ACTIVE_ENGINE ) {
45 return self::$instance;
46 }
47 self::$instance->define_version();
48
49 add_action( 'init', array( self::$instance, 'wp_inited' ) );
50
51 if ( class_exists( 'WPBC_BookingInstall' ) ) { // Check if we need to run Install / Uninstal process.
52 new WPBC_BookingInstall();
53 }
54
55 /**
56 * Make Ajax, Response, in this case $is_continue_at_frontend = false
57 * or
58 * define Booking Class for front-end side, then $is_continue_at_frontend = true
59 */
60 $is_continue_at_frontend = self::$instance->start();
61
62 make_bk_action('wpbc_booking_calendar_started');
63
64 if ( $is_continue_at_frontend ) { // Possible Load Admin or Front-End page
65
66 self::$instance->js = new WPBC_JS;
67 self::$instance->css = new WPBC_CSS;
68
69 if( is_admin() ) {
70
71 // Define Menu
72 add_action( '_admin_menu', array( self::$instance, 'define_admin_menu') ); // _admin_menu - Fires before the administration menu loads in the admin.
73
74 add_action( 'admin_footer', 'wpbc_print_js', 50 ); // Load my Queued JavaScript Code at the footer of the Admin Panel page. Executed in ALL Admin Menu Pages
75
76 } else {
77
78 if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
79
80 add_action( 'wp_enqueue_scripts', array(self::$instance->css, 'load'), 1000000001 ); // Load CSS at front-end side // Enqueue Scripts to All Client pages
81 add_action( 'wp_enqueue_scripts', array(self::$instance->js, 'load'), 1000000001 ); // Load JavaScript files and define JS varibales at forn-end side
82 add_action( 'wp_footer', 'wpbc_print_js', 50 ); // Load my Queued JavaScript Code at the footer of the page, if executed "wp_footer" hook at the Theme.
83 }
84 }
85
86 }
87 return self::$instance;
88 }
89
90 /**
91 * Set WordPress was inited
92 *
93 * @return void
94 */
95 public function wp_inited(){
96 self::$instance->is_wp_inited = true;
97 }
98
99 /**
100 * Check if WP was inited
101 * @return mixed
102 */
103 public function is_wp_inited(){
104 return self::$instance->is_wp_inited;
105 }
106
107 /** Define Admin Menu items */
108 public function define_admin_menu(){
109
110 $update_count = wpbc_db_get_number_new_bookings();
111 // FixIn: 9.1.3.3.
112 $title = 'WPBC ';//__('Booking', 'booking'); //'&#223;<span style="font-size:0.75em;">&#920;&#920;</span>&kgreen;&imath;&eng;'; // __('Booking', 'booking')
113 $is_user_activated = apply_bk_filter('multiuser_is_current_user_active', true ); // FixIn: 6.0.1.17.
114
115 if ( ( $update_count > 0 ) && ( $is_user_activated ) ) {
116 $update_count_title = "<span class='update-plugins count-$update_count' title=''><span class='update-count bk-update-count'>" . number_format_i18n($update_count) . "</span></span>" ;
117 $title .= $update_count_title;
118 }
119
120 $title = '<div class="name_container" style="display: flex;flex-flow: row nowrap;justify-content: flex-start;align-items: center;min-height: 16px;">'
121 . ' <div class="name_item" style="font-size: 6px;font-weight: 600;margin-left: -4px;margin-top: 12px;margin-right: 0px;word-wrap: normal;white-space: nowrap;position: absolute;">WP</div>'
122 . ' <div class="name_item" style="font-size: 11px;margin-left: -5px;margin-top: -7px;white-space: nowrap;margin-right: 4px;">Booking Calendar</div>';
123 if ( ( $update_count > 0 ) && ( $is_user_activated ) ) {
124 $badge_style= '';
125 } else {
126 $badge_style = 'display:none;';
127 }
128
129 $title .= '<span style="margin-top:-2px;'.$badge_style.'" class="wpbc_badge_count name_item update-plugins count-'.$update_count.'" title=""><span class="update-count bk-update-count" style="white-space: nowrap;word-wrap: normal;">' . number_format_i18n( $update_count ) . '</span></span>';
130 $title .= '</div>';
131
132
133 $booking_menu_position = get_bk_option( 'booking_menu_position' );
134 switch ( $booking_menu_position ) {
135 case 'top':
136 $booking_menu_position = '3.3'; // FixIn: 8.7.7.16.
137 break;
138 case 'middle':
139 global $_wp_last_object_menu; // The index of the last top-level menu in the object menu group
140 $_wp_last_object_menu++;
141 $booking_menu_position = $_wp_last_object_menu; // 58.9;
142 break;
143 case 'bottom':
144 $booking_menu_position = '99.999';
145 break;
146 default:
147 /**
148 * 3.3 - top //( 58.9 ) // - middle
149 (Optional). Positions for Core Menu Items
150 2 Dashboard
151 4 Separator
152 5 Posts
153 10 Media
154 15 Links
155 20 Pages
156 25 Comments
157 59 Separator
158 60 Appearance
159 65 Plugins
160 70 Users
161 75 Tools
162 80 Settings
163 99 Separator
164 */
165 $booking_menu_position = '3.3';
166 break;
167 }
168
169 /**
170 // //FixIn: 9.0.1.7 //scale image by this params: viewBox="-2 -1 20 20"
171 // if( 0 ) {
172 // // calendar4-range https://icons.getbootstrap.com/icons/calendar4-range/
173 // $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="" viewBox="-2 -1 20 20">'
174 // . '<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1H2zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5z"/>'
175 // . '<path d="M9 7.5a.5.5 0 0 1 .5-.5H15v2H9.5a.5.5 0 0 1-.5-.5v-1zm-2 3v1a.5.5 0 0 1-.5.5H1v-2h5.5a.5.5 0 0 1 .5.5z"/>'
176 // . '</svg>';
177 //
178 // //calendar-range https://icons.getbootstrap.com/icons/calendar-range/
179 // $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar-range" viewBox="-2 -1 20 20">'
180 // . '<path d="M9 7a1 1 0 0 1 1-1h5v2h-5a1 1 0 0 1-1-1zM1 9h4a1 1 0 0 1 0 2H1V9z"/>'
181 // . '<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/>'
182 // . '</svg>';
183 //
184 // //calendar2-range https://icons.getbootstrap.com/icons/calendar2-range/
185 // $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar2-range" viewBox="-2 -1 20 20">'
186 // . '<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H2z"/>'
187 // . '<path d="M2.5 4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V4zM9 8a1 1 0 0 1 1-1h5v2h-5a1 1 0 0 1-1-1zm-8 2h4a1 1 0 1 1 0 2H1v-2z"/>'
188 // . '</svg>';
189 // }
190 // // calendar3-range https://icons.getbootstrap.com/icons/calendar3-range/
191 // $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar3-range" viewBox="-2 -1 20 20">'
192 // . '<path d="M14 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM1 3.857C1 3.384 1.448 3 2 3h12c.552 0 1 .384 1 .857v10.286c0 .473-.448.857-1 .857H2c-.552 0-1-.384-1-.857V3.857z"/>'
193 // . '<path d="M7 10a1 1 0 0 0 0-2H1v2h6zm2-3h6V5H9a1 1 0 0 0 0 2z"/>'
194 // . '</svg>';
195 */
196
197 $svg_icon_integarted = wpbc_get_svg_logo( '#aaa', '#aaa', '0.4' ); // '#aaa', '#aaa', '0.2' .
198
199 self::$instance->admin_menu['master'] = new WPBC_Admin_Menus( 'wpbc', array(
200 'in_menu' => 'root',
201 'mune_icon_url' => $svg_icon_integarted,
202 'menu_title' => $title,
203 'menu_title_second' => __( 'Bookings', 'booking' ),
204 'page_header' => __( 'Bookings Listing', 'booking' ),
205 'browser_header' => __( 'Bookings Listing', 'booking' ) . ' - ' . __( 'Booking Calendar', 'booking' ),
206 'user_role' => get_bk_option( 'booking_user_role_booking' ),
207 'position' => $booking_menu_position,
208 ) );
209
210 self::$instance->admin_menu['new'] = new WPBC_Admin_Menus( 'wpbc-new', array(
211 'in_menu' => 'wpbc',
212 'menu_title' => '+ ' . ucwords( __( 'Add booking', 'booking' ) ),
213 'page_header' => ucwords( __( 'Add booking', 'booking' ) ),
214 'browser_header' => ucwords( __( 'Add booking', 'booking' ) ) . ' - ' . __( 'Booking Calendar', 'booking' ),
215 'user_role' => get_bk_option( 'booking_user_role_addbooking' ),
216 ) );
217
218 self::$instance->admin_menu['resources'] = new WPBC_Admin_Menus( 'wpbc-resources', array(
219 'in_menu' => 'wpbc',
220 'menu_title' => __( 'Resources', 'booking' ),
221 'page_header' => ucwords( __( 'Booking resources', 'booking' ) ),
222 'browser_header' => __( 'Resources', 'booking' ) . ' - ' . __( 'Booking Calendar', 'booking' ),
223 'user_role' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? get_bk_option( 'booking_user_role_resources' )
224 : get_bk_option( 'booking_user_role_settings' ) ),
225 ) );
226
227 self::$instance->admin_menu['availability'] = new WPBC_Admin_Menus( // FixIn: 9.3.0.1.
228 'wpbc-availability', array(
229 'in_menu' => 'wpbc',
230 'menu_title' => ucwords( __( 'Availability', 'booking' ) ),
231 'page_header' => ucwords( __( 'Availability', 'booking' ) ),
232 'browser_header' => ucwords( __( 'Availability', 'booking' ) ) . ' - ' . __( 'Booking Calendar', 'booking' ),
233 'user_role' => get_bk_option( 'booking_user_role_availability' ),
234 ) );
235
236 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
237 self::$instance->admin_menu['prices'] = new WPBC_Admin_Menus( 'wpbc-prices', array(
238 'in_menu' => 'wpbc',
239 'menu_title' => __( 'Prices', 'booking' ),
240 'page_header' => ucwords( __( 'Booking Prices', 'booking' ) ),
241 'browser_header' => __( 'Prices', 'booking' ) . ' - ' . __( 'Booking Calendar', 'booking' ),
242 'user_role' => get_bk_option( 'booking_user_role_prices' ), //FixIn: 9.8.15.2.6
243 ) );
244 }
245
246 self::$instance->admin_menu['services'] = new WPBC_Admin_Menus( 'wpbc-services', array(
247 'in_menu' => 'wpbc',
248 'menu_title' => __( 'Services', 'booking' ),
249 'page_header' => __( 'Services', 'booking' ),
250 'browser_header' => __( 'Services', 'booking' ) . ' - ' . __( 'Booking Calendar', 'booking' ),
251 'user_role' => get_bk_option( 'booking_user_role_settings' ),
252 ) );
253
254 self::$instance->admin_menu['settings'] = new WPBC_Admin_Menus( 'wpbc-settings', array(
255 'in_menu' => 'wpbc',
256 'menu_title' => __( 'Settings', 'booking' ),
257 'page_header' => __( 'General Settings', 'booking' ),
258 'browser_header' => __( 'Settings', 'booking' ) . ' - ' . __( 'Booking Calendar', 'booking' ),
259 'user_role' => get_bk_option( 'booking_user_role_settings' ),
260 ) );
261
262 if ( ( wpbc_is_user_can_access_wizard_page() ) && ( ! wpbc_setup_wizard_page__is_all_steps_completed() ) ) {
263
264 $setup_steps = new WPBC_SETUP_WIZARD_STEPS();
265
266 self::$instance->admin_menu['setup'] = new WPBC_Admin_Menus( 'wpbc-setup', array(
267 'in_menu' => 'wpbc',
268 'menu_title' => $setup_steps->get_plugin_menu_title__setup_progress(),
269 'page_header' => ucwords( __( 'Setup', 'booking' ) ),
270 'browser_header' => ucwords( __( 'Setup', 'booking' ) ) . ' - ' . __( 'Booking Calendar', 'booking' ),
271 'user_role' => get_bk_option( 'booking_user_role_settings' ),
272 ) );
273 }
274
275
276 $simulate_user_id = wpbc_mu__is_simulated_login_as_user();
277 if ( ! empty( $simulate_user_id ) ) {
278
279 $custom_user = get_userdata( $simulate_user_id );
280
281 self::$instance->admin_menu['log_off'] = new WPBC_Admin_Menus( 'wpbc-log-off', array(
282 'in_menu' => 'wpbc',
283 'menu_title' => '<span style="color:#fffcdf;font-size: 11px;font-weight: 400;" title="' . esc_attr( __( 'Log out as regular user and login as super booking admin user', 'booking' ) ) . '">' . __( 'Back to Super Admin', 'booking' ) . '<span>',
284 'page_header' => ucwords( sprintf( __( 'Need even more functionality? Check %1$s higher versions %2$s', 'booking' ), '', '' ) ), /* translators: 1: ... */
285 'browser_header' => 'Log In as Super Admin',
286 'user_role' => get_bk_option( 'booking_user_role_booking' ),
287 ) );
288 }
289
290 }
291
292
293
294 /**
295 * Get Menu Object
296 *
297 * @param type - menu type
298 * @return boolean
299 */
300 public function get_menu_object( $type ) {
301
302 if ( isset( self::$instance->admin_menu[ $type ] ) )
303 return self::$instance->admin_menu[ $type ];
304 else
305 return false;
306 }
307
308
309 // Include Files
310 private function includes() {
311 require_once WPBC_PLUGIN_DIR . '/includes/wpbc-include.php' ;
312 }
313
314
315 private function define_version() {
316
317 // GET VERSION NUMBER
318 $plugin_data = wpbc_file__read_header_info( WPBC_FILE, array(
319 'Name' => 'Plugin Name',
320 'PluginURI' => 'Plugin URI',
321 'Version' => 'Version',
322 'Description' => 'Description',
323 'Author' => 'Author',
324 'AuthorURI' => 'Author URI',
325 'TextDomain' => 'Text Domain',
326 'DomainPath' => 'Domain Path',
327 ), 'plugin' );
328 if ( ! defined( 'WPDEV_BK_VERSION' ) ) {
329 define( 'WPDEV_BK_VERSION', $plugin_data['Version'] );
330 }
331 }
332
333
334 // Cloning instances of the class is forbidden
335 public function __clone() {
336
337 _doing_it_wrong( __FUNCTION__, esc_html__( 'Action is not allowed!', 'booking' ), '1.0' );
338 }
339
340
341 // Unserializing instances of the class is forbidden
342 public function __wakeup() {
343
344 _doing_it_wrong( __FUNCTION__, esc_html__( 'Action is not allowed!', 'booking' ), '1.0' );
345 }
346
347
348 // Initialization
349 private function start(){
350
351 if ( ( defined( 'DOING_AJAX' ) ) && ( DOING_AJAX ) ){ // New A J A X R e s p o n d e r
352
353 if ( 1 ) {
354 $wpdev_booking_obj_in_ajax = new wpdev_booking(); // GO
355 } else {
356 if ( class_exists( 'wpdev_bk_personal' ) ) {
357 $wpdev_bk_personal_in_ajax = new wpdev_bk_personal();
358 }
359 }
360
361 require_once WPBC_PLUGIN_DIR . '/core/lib/wpbc-ajax.php'; // Ajax
362
363 return false;
364 } else { // Usual Loading of plugin
365
366 // We are having Response, its executed in other file: wpbc-response.php
367 if ( WP_BK_RESPONSE )
368 return false;
369
370 if( is_admin() ) {
371 // Define Notices System
372 self::$instance->notice = new WPBC_Notices();
373 }
374
375 // Normal Start
376 self::$instance->booking_obj = new wpdev_booking(); // GO
377
378 // Cron Jobs ..... /////////////////////////////////////////////////
379 self::$instance->cron = new WPBC_Cron();
380 ////////////////////////////////////////////////////////////////////
381 }
382 return true;
383 }
384
385 }
386
387 else: // Its seems that some instance of Booking Calendar still activted!!!
388
389 // FixIn: 7.0.1.6.
390 global $wp_version;
391 $wpbc_min_wp_version = version_compare( WP_BK_MIN_WP_VERSION, $wp_version, '<=' );
392
393 // FixIn: 7.0.1.6.
394 function wpbc_show_min_wp_version_error() {
395
396 $message_type = 'error';
397 $title = __( 'Error' , 'booking') . '!';
398
399
400 $message = 'Booking Calendar ';
401
402 $booking_version_num = get_option( 'booking_version_num');
403 if ( ! empty( $booking_version_num ) )
404 $message .= '<strong>' . $booking_version_num . '</strong> ';
405
406
407 global $wp_version;
408
409 $message .= sprintf( 'require minimum %s . You are using %s. '
410 , ' <strong>' . 'WordPress ' . WP_BK_MIN_WP_VERSION . '</strong>'
411 , ' <strong>' . 'WordPress ' . $wp_version . '</strong>' );
412 if ( current_user_can( 'update_core' ) ){
413 $message .= ' <a href="' . esc_url( self_admin_url( 'update-core.php' ) ) . '">' . 'Return to Dashboard &rarr; Updates' . '</a>';
414 }
415
416
417 $message_content = '';
418
419 $message_content .= '<div class="clear"></div>';
420
421 $message_content .= '<div class="updated wpbc-settings-notice notice-' . $message_type . ' ' . $message_type . '" style="text-align:left;padding:10px;">';
422
423 if ( ! empty( $title ) )
424 $message_content .= '<strong>' . esc_js( $title ) . '</strong> ';
425
426 $message_content .= html_entity_decode( esc_js( $message ) ,ENT_QUOTES) ;
427
428 $message_content .= '</div>';
429
430 $message_content .= '<div class="clear"></div>';
431
432 echo wp_kses_post( $message_content );
433 }
434
435 function wpbc_show_activation_error() {
436
437 $message_type = 'error';
438 $title = __( 'Error' , 'booking') . '!';
439 $message = 'Please deactivate previous old version of' . ' ' . 'Booking Calendar';
440
441 $booking_version_num = get_option( 'booking_version_num');
442 if ( ! empty( $booking_version_num ) )
443 $message .= ' <strong>' . $booking_version_num . '</strong>';
444
445
446 $is_delete_if_deactive = get_bk_option( 'booking_is_delete_if_deactive' ); // check
447
448 if ( $is_delete_if_deactive == 'On' ) {
449
450 $message .= '<br/><br/> <strong>Warning!</strong> ' . 'All plugin data will be deleted when plugin had deactivated.' . ' '
451 . sprintf( 'If you want to save your plugin data, please uncheck the %s"Delete plugin data"%s at the', '<strong>', '</strong>') . ' ' . __( 'Settings' , 'booking' ) . '.';
452 }
453
454 $message_content = '';
455
456 $message_content .= '<div class="clear"></div>';
457
458 $message_content .= '<div class="updated wpbc-settings-notice notice-' . $message_type . ' ' . $message_type . '" style="text-align:left;padding:10px;">';
459
460 if ( ! empty( $title ) )
461 $message_content .= '<strong>' . esc_js( $title ) . '</strong> ';
462
463 $message_content .= html_entity_decode( esc_js( $message ) ,ENT_QUOTES) ;
464
465 $message_content .= '</div>';
466
467 $message_content .= '<div class="clear"></div>';
468
469 echo wp_kses_post( $message_content );
470 }
471
472
473 if ( ! $wpbc_min_wp_version ) // FixIn: 7.0.1.6.
474 add_action('admin_notices', 'wpbc_show_min_wp_version_error');
475 else
476 add_action('admin_notices', 'wpbc_show_activation_error');
477
478 return; // Exit
479
480 endif;
481
482
483 /**
484 * The main function responsible for returning the one true Instance to functions everywhere.
485 *
486 * Example: <?php $wpbc = WPBC(); ?>
487 */
488 function WPBC() {
489 return Booking_Calendar::init();
490 }
491
492
493
494 // Start
495 WPBC();
496
497
498
499 //if ( ! defined( 'SAVEQUERIES') ) define('SAVEQUERIES', true);
500
501 //add_action( 'admin_footer', 'wpbc_show_debug_info', 130 );
502 function wpbc_show_debug_info() {
503
504 $server_request_uri = ( ( isset( $_SERVER['REQUEST_URI'] ) ) ? sanitize_text_field( $_SERVER['REQUEST_URI'] ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash */ /* FixIn: sanitize_unslash */
505 $request_uri = $server_request_uri; //FixIn:5.4.1
506 if ( strpos( $request_uri, 'page=wpbc') === false ) {
507 return;
508 }
509 echo '<div style="width:800px;margin:10px auto;"><style type="text/css"> a:link{background: inherit !important; } pre { white-space: pre-wrap; }</style>';
510 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_phpinfo
511 phpinfo(); echo '</div>'; return;
512
513 ?><div style="width:auto;margin:0 0 0 215px;font-size:11px; "><?php
514
515 // SYSTEM INFO SHOWING ////////////////////////////////////////////////////////
516
517 //Note firstly need to define this in functions.php file: define('SAVEQUERIES', true);
518 global $wpdb;
519 echo '<div class="clear"></div>START SYSTEM<pre>';
520 $qq_kk = 0;
521 $total_time = 0;
522 $total_num = 0;
523 foreach ( $wpdb->queries as $qq_k => $qq ) {
524 if (
525 ( strpos( $qq[0], 'booking') !== false )
526
527 ) {
528 if ( $qq[1] > 0.002 ) { echo '<div style="color:#A77;font-weight:bold;">'; }
529 debuge($qq_kk++, $qq);
530 $total_time += $qq[1];
531 $total_num++;
532 if ( $qq[1] > 0.002 ) { echo '</div>'; }
533 }
534 }
535
536 echo '<div><pre class="prettyprint linenums" style="font-size:18px;">[' . esc_html( $total_num . '/' . $total_time ) . '] WPBC Requests TOTAL TIME</pre></div>';
537
538 echo '<div class="clear"></div>';
539
540 echo '<div><pre class="prettyprint linenums" style="font-size:18px;">' . esc_html( get_num_queries() . '/' . timer_stop( 0, 3 ) ) . 'qps</pre></div>';
541
542 echo '<div class="clear"></div>';
543
544 echo "</pre>";
545 ?><br/><br/><br/><br/><br/><br/><?php
546 echo '<div class="clear"></div>';
547
548 ////////////////////////////////////////////////////////////////////////////////
549 ?></div><?php
550
551 echo '</div>';
552 }
553