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