| @@ -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 | |
| @@ -140,14 +143,31 @@ | ||
| 140 | 143 | case 'bottom': |
| 141 | 144 | $booking_menu_position = '99.999'; |
| 142 | 145 | break; |
| 143 | 146 | default: |
| 144 | - $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'; | |
| 145 | 166 | break; |
| 146 | 167 | } |
| 147 | 168 | |
| 148 | - // FixIn: 10.11.3.3. | |
| 149 | - | |
| 169 | +/** | |
| 150 | 170 | // //FixIn: 9.0.1.7 //scale image by this params: viewBox="-2 -1 20 20" |
| 151 | 171 | // if( 0 ) { |
| 152 | 172 | // // calendar4-range https://icons.getbootstrap.com/icons/calendar4-range/ |
| 153 | 173 | // $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="" viewBox="-2 -1 20 20">' |
| @@ -171,167 +191,105 @@ | ||
| 171 | 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">' |
| 172 | 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"/>' |
| 173 | 193 | // . '<path d="M7 10a1 1 0 0 0 0-2H1v2h6zm2-3h6V5H9a1 1 0 0 0 0 2z"/>' |
| 174 | 194 | // . '</svg>'; |
| 195 | +*/ | |
| 175 | 196 | |
| 176 | 197 | $svg_icon_integarted = wpbc_get_svg_logo( '#aaa', '#aaa', '0.4' ); // '#aaa', '#aaa', '0.2' . |
| 177 | 198 | |
| 178 | - self::$instance->admin_menu['master'] = new WPBC_Admin_Menus( | |
| 179 | - 'wpbc' , array ( | |
| 180 | - 'in_menu' => 'root' | |
| 181 | - //, 'mune_icon_url' => '/assets/img/icon-16x16.png' | |
| 182 | - , 'mune_icon_url' => $svg_icon_integarted // FixIn: 9.0.1.7. | |
| 183 | - , 'menu_title' => $title | |
| 184 | - , 'menu_title_second' => __('Bookings', 'booking') | |
| 185 | - , 'page_header' => __('Bookings Listing','booking') | |
| 186 | - , 'browser_header' => __('Bookings Listing', 'booking') . ' - ' . __('Booking Calendar', 'booking') | |
| 187 | - , 'user_role' => get_bk_option( 'booking_user_role_booking' ) | |
| 188 | - , 'position' => $booking_menu_position // 3.3 - top //( 58.9 ) // - middle | |
| 189 | - /* | |
| 190 | - (Optional). Positions for Core Menu Items | |
| 191 | - 2 Dashboard | |
| 192 | - 4 Separator | |
| 193 | - 5 Posts | |
| 194 | - 10 Media | |
| 195 | - 15 Links | |
| 196 | - 20 Pages | |
| 197 | - 25 Comments | |
| 198 | - 59 Separator | |
| 199 | - 60 Appearance | |
| 200 | - 65 Plugins | |
| 201 | - 70 Users | |
| 202 | - 75 Tools | |
| 203 | - 80 Settings | |
| 204 | - 99 Separator | |
| 205 | - */ | |
| 206 | - ) | |
| 207 | - ); | |
| 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 | + ) ); | |
| 208 | 209 | |
| 209 | - self::$instance->admin_menu['new'] = new WPBC_Admin_Menus( | |
| 210 | - 'wpbc-new', | |
| 211 | - array( | |
| 210 | + self::$instance->admin_menu['new'] = new WPBC_Admin_Menus( 'wpbc-new', array( | |
| 212 | 211 | 'in_menu' => 'wpbc', |
| 213 | - 'menu_title' => '+ ' . ucwords( __( 'Add booking', 'booking' ) ), // FixIn: 10.9.3.1. | |
| 212 | + 'menu_title' => '+ ' . ucwords( __( 'Add booking', 'booking' ) ), | |
| 214 | 213 | 'page_header' => ucwords( __( 'Add booking', 'booking' ) ), |
| 215 | 214 | 'browser_header' => ucwords( __( 'Add booking', 'booking' ) ) . ' - ' . __( 'Booking Calendar', 'booking' ), |
| 216 | 215 | 'user_role' => get_bk_option( 'booking_user_role_addbooking' ), |
| 217 | - ) | |
| 218 | - ); | |
| 216 | + ) ); | |
| 219 | 217 | |
| 220 | - self::$instance->admin_menu['availability'] = new WPBC_Admin_Menus( // FixIn: 9.3.0.1. | |
| 221 | - 'wpbc-availability' , array ( | |
| 222 | - 'in_menu' => 'wpbc' | |
| 223 | - , 'menu_title' => ucwords( __('Availability', 'booking') ) | |
| 224 | - , 'page_header' => ucwords( __('Availability','booking') ) | |
| 225 | - , 'browser_header'=> ucwords( __('Availability', 'booking') ) . ' - ' . __('Booking Calendar', 'booking') | |
| 226 | - , 'user_role' => get_bk_option( 'booking_user_role_availability' ) // FixIn: 9.5.2.2. | |
| 227 | - ) | |
| 228 | - ); | |
| 229 | - //FixIn: 9.8.15.2.4 | |
| 230 | - if ( class_exists( 'wpdev_bk_biz_m' ) ) | |
| 231 | - self::$instance->admin_menu['prices'] = new WPBC_Admin_Menus( | |
| 232 | - 'wpbc-prices' , array ( | |
| 233 | - 'in_menu' => 'wpbc' | |
| 234 | - , 'menu_title' => __('Prices', 'booking') | |
| 235 | - , 'page_header' => ucwords( __('Booking Prices','booking') ) | |
| 236 | - , 'browser_header'=> __('Prices', 'booking') . ' - ' . __('Booking Calendar', 'booking') | |
| 237 | - , 'user_role' => get_bk_option( 'booking_user_role_prices' ) //FixIn: 9.8.15.2.6 | |
| 238 | - ) | |
| 239 | - ); | |
| 240 | - if ( class_exists( 'wpdev_bk_personal' ) ) { | |
| 241 | - self::$instance->admin_menu['resources'] = new WPBC_Admin_Menus( | |
| 242 | - 'wpbc-resources' , array ( | |
| 243 | - 'in_menu' => 'wpbc' | |
| 244 | - , 'menu_title' => __('Resources', 'booking') | |
| 245 | - , 'page_header' => ucwords( __('Booking resources','booking') ) | |
| 246 | - , 'browser_header'=> __('Resources', 'booking') . ' - ' . __('Booking Calendar', 'booking') | |
| 247 | - , 'user_role' => get_bk_option( 'booking_user_role_resources' ) | |
| 248 | - ) | |
| 249 | - ); | |
| 250 | - } | |
| 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 | + ) ); | |
| 251 | 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 | + ) ); | |
| 252 | 235 | |
| 253 | - if ( ! class_exists( 'wpdev_bk_personal' ) ) { // FixIn: 10.1.3.1. | |
| 254 | - // FixIn: 9.8.15.7. | |
| 255 | - self::$instance->admin_menu['resources'] = new WPBC_Admin_Menus( | |
| 256 | - 'wpbc-resources' , array ( | |
| 257 | - 'in_menu' => 'wpbc' | |
| 258 | - , 'menu_title' => __('Publish', 'booking') // __('Resource', 'booking') | |
| 259 | - , 'page_header' => ucwords( __('Booking resource','booking') ) | |
| 260 | - , 'browser_header'=> __('Resource', 'booking') . ' - ' . __('Booking Calendar', 'booking') | |
| 261 | - , 'user_role' => get_bk_option( 'booking_user_role_settings' ) | |
| 262 | - ) | |
| 263 | - ); | |
| 264 | - } | |
| 265 | - | |
| 266 | - if ( function_exists( 'wpbc_is_11_5_features_enabled' ) && wpbc_is_11_5_features_enabled() ) { | |
| 267 | - self::$instance->admin_menu['services'] = new WPBC_Admin_Menus( | |
| 268 | - 'wpbc-services', | |
| 269 | - array( | |
| 236 | + if ( class_exists( 'wpdev_bk_biz_m' ) ) { | |
| 237 | + self::$instance->admin_menu['prices'] = new WPBC_Admin_Menus( 'wpbc-prices', array( | |
| 270 | 238 | 'in_menu' => 'wpbc', |
| 271 | - 'menu_title' => __( 'Services', 'booking' ), | |
| 272 | - 'page_header' => __( 'Services', 'booking' ), | |
| 273 | - 'browser_header' => __( 'Services', 'booking' ) . ' - ' . __( 'Booking Calendar', 'booking' ), | |
| 274 | - 'user_role' => get_bk_option( 'booking_user_role_settings' ), | |
| 275 | - ) | |
| 276 | - ); | |
| 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 | + ) ); | |
| 277 | 244 | } |
| 278 | 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 | + ) ); | |
| 279 | 253 | |
| 280 | - self::$instance->admin_menu['settings'] = new WPBC_Admin_Menus( | |
| 281 | - 'wpbc-settings' , array ( | |
| 282 | - 'in_menu' => 'wpbc' | |
| 283 | - , 'menu_title' => __('Settings', 'booking') | |
| 284 | - , 'page_header' => __('General Settings','booking') | |
| 285 | - , 'browser_header'=> __('Settings', 'booking') . ' - ' . __('Booking Calendar', 'booking') | |
| 286 | - , 'user_role' => get_bk_option( 'booking_user_role_settings' ) | |
| 287 | - ) | |
| 288 | - ); | |
| 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 | + ) ); | |
| 289 | 261 | |
| 262 | + if ( wpbc_is_user_can_access_wizard_page() ) { | |
| 290 | 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(); | |
| 291 | 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 | + } | |
| 292 | 276 | |
| 293 | - if ( | |
| 294 | - ( wpbc_is_user_can_access_wizard_page() ) && | |
| 295 | - ( ! wpbc_setup_wizard_page__is_all_steps_completed() ) | |
| 296 | - ){ | |
| 297 | 277 | |
| 298 | - $setup_steps = new WPBC_SETUP_WIZARD_STEPS(); | |
| 299 | - | |
| 300 | - self::$instance->admin_menu['setup'] = new WPBC_Admin_Menus( | |
| 301 | - 'wpbc-setup' , array ( | |
| 302 | - 'in_menu' => 'wpbc' | |
| 303 | - , 'menu_title' => $setup_steps->get_plugin_menu_title__setup_progress() | |
| 304 | - , 'page_header' => ucwords( __('Setup','booking') ) | |
| 305 | - , 'browser_header' => ucwords( __('Setup', 'booking') ) . ' - ' . __('Booking Calendar', 'booking') | |
| 306 | - , 'user_role' => get_bk_option( 'booking_user_role_settings' ) //FixIn: 9.8.15.2.6 | |
| 307 | - ) | |
| 308 | - ); | |
| 309 | - } | |
| 310 | - | |
| 311 | - | |
| 312 | - | |
| 313 | 278 | $simulate_user_id = wpbc_mu__is_simulated_login_as_user(); |
| 314 | 279 | if ( ! empty( $simulate_user_id ) ) { |
| 315 | 280 | |
| 316 | 281 | $custom_user = get_userdata( $simulate_user_id ); |
| 317 | 282 | |
| 318 | - self::$instance->admin_menu['log_off'] = new WPBC_Admin_Menus( | |
| 319 | - 'wpbc-log-off' , array ( | |
| 320 | - 'in_menu' => 'wpbc' | |
| 321 | - //, 'menu_title' => __( 'Log Out Simulated Login as', 'booking' ) . ' "' . $custom_user->display_name . '"' | |
| 322 | - , 'menu_title' => '<span style="color:#fffcdf;font-size: 11px;font-weight: 400;" title="' | |
| 323 | - . esc_attr( __( 'Log out as regular user and login as super booking admin user', 'booking' ) ) | |
| 324 | - .'">' | |
| 325 | - .__( 'Back to Super Admin', 'booking' ) | |
| 326 | - .'<span>' | |
| 327 | - /* translators: 1: ... */ | |
| 328 | - , 'page_header' => ucwords( sprintf( __( 'Need even more functionality? Check %1$s higher versions %2$s', 'booking' ), '', '' ) ) | |
| 329 | - , 'browser_header'=> 'Log In as Super Admin' | |
| 330 | - , 'user_role' => get_bk_option( 'booking_user_role_booking' ) | |
| 331 | - ) | |
| 332 | - ); | |
| 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 | + ) ); | |
| 333 | 290 | } |
| 291 | + | |
| 334 | 292 | } |
| 335 | 293 | |
| 336 | 294 | |
| 337 | 295 | |