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