| @@ -7,10 +7,8 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | namespace Timetics\Core\Admin; |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; | |
| 12 | - | |
| 13 | 11 | /** |
| 14 | 12 | * Class Menu |
| 15 | 13 | */ |
| 16 | 14 | class Menu |
| @@ -42,29 +40,32 @@ | ||
| 42 | 40 | global $submenu; |
| 43 | 41 | $capability = 'manage_timetics'; |
| 44 | 42 | $slug = 'timetics'; |
| 45 | 43 | $url = 'admin.php?page=' . $slug . '#'; |
| 44 | + $timetics_menu_position = 'timetics_menu_position_'; | |
| 45 | + $timetics_menu_permission = 'timetics_menu_permission_'; | |
| 46 | + | |
| 46 | 47 | $menu_items = array( |
| 47 | 48 | [ |
| 48 | 49 | 'id' => 'overview', |
| 49 | 50 | 'title' => esc_html__('Overview', 'timetics'), |
| 50 | 51 | 'link' => '/', |
| 51 | - 'capability' => apply_filters('timetics_menu_permission_overview', $capability), | |
| 52 | - 'position' => apply_filters('timetics_menu_position_overview', 1), | |
| 52 | + 'capability' => apply_filters($timetics_menu_permission . 'overview', $capability), | |
| 53 | + 'position' => apply_filters($timetics_menu_position . 'overview', 1), | |
| 53 | 54 | ], |
| 54 | 55 | [ |
| 55 | 56 | 'id' => 'meeting', |
| 56 | 57 | 'title' => esc_html__('Meetings', 'timetics'), |
| 57 | 58 | 'link' => '/meetings', |
| 58 | - 'capability' => apply_filters('timetics_menu_permission_meeting', 'read_booking'), | |
| 59 | - 'position' => apply_filters('timetics_menu_position_meeting', 2), | |
| 59 | + 'capability' => apply_filters($timetics_menu_permission . 'meeting', 'read_booking'), | |
| 60 | + 'position' => apply_filters($timetics_menu_position . 'meeting', 2), | |
| 60 | 61 | ], |
| 61 | 62 | [ |
| 62 | 63 | 'id' => 'staff', |
| 63 | 64 | 'title' => esc_html__('Team Members', 'timetics'), |
| 64 | 65 | 'link' => '/staff', |
| 65 | - 'capability' => apply_filters('timetics_menu_permission_staff', 'edit_staff'), | |
| 66 | - 'position' => apply_filters('timetics_menu_position_staff', 3), | |
| 66 | + 'capability' => apply_filters($timetics_menu_permission . 'staff', 'edit_staff'), | |
| 67 | + 'position' => apply_filters($timetics_menu_position . 'staff', 3), | |
| 67 | 68 | ], |
| 68 | 69 | |
| 69 | 70 | [ |
| 70 | 71 | 'id' => 'booking', |
| @@ -69,52 +70,45 @@ | ||
| 69 | 70 | [ |
| 70 | 71 | 'id' => 'booking', |
| 71 | 72 | 'title' => esc_html__('Calendar', 'timetics'), |
| 72 | 73 | 'link' => '/bookings', |
| 73 | - 'capability' => apply_filters('timetics_menu_permission_booking', 'read_booking'), | |
| 74 | - 'position' => apply_filters('timetics_menu_position_booking', 1.5), | |
| 74 | + 'capability' => apply_filters($timetics_menu_permission . 'booking', 'read_booking'), | |
| 75 | + 'position' => apply_filters($timetics_menu_position . 'booking', 1.5), | |
| 75 | 76 | ], |
| 76 | 77 | [ |
| 77 | 78 | 'id' => 'customer', |
| 78 | 79 | 'title' => esc_html__('Customers', 'timetics'), |
| 79 | 80 | 'link' => '/customers', |
| 80 | - 'capability' => apply_filters('timetics_menu_permission_customer', 'manage_options'), | |
| 81 | - 'position' => apply_filters('timetics_menu_position_customer', 5), | |
| 81 | + 'capability' => apply_filters($timetics_menu_permission . 'customer', 'manage_options'), | |
| 82 | + 'position' => apply_filters($timetics_menu_position . 'customer', 5), | |
| 82 | 83 | ], |
| 83 | 84 | [ |
| 84 | 85 | 'id' => 'settings', |
| 85 | 86 | 'title' => esc_html__('Settings', 'timetics'), |
| 86 | 87 | 'link' => '/settings', |
| 87 | - 'capability' => apply_filters('timetics_menu_permission_settings', 'manage_options'), | |
| 88 | - 'position' => apply_filters('timetics_menu_position_settings', 6), | |
| 88 | + 'capability' => apply_filters($timetics_menu_permission . 'settings', 'manage_options'), | |
| 89 | + 'position' => apply_filters($timetics_menu_position . 'settings', 6), | |
| 89 | 90 | ], |
| 90 | 91 | [ |
| 91 | 92 | 'id' => 'my-profile', |
| 92 | 93 | 'title' => esc_html__('My Profile', 'timetics'), |
| 93 | 94 | 'link' => '/my-profile', |
| 94 | - 'capability' => apply_filters('timetics_menu_permission_my_profile', 'edit_profile'), | |
| 95 | - 'position' => apply_filters('timetics_menu_position_my_profile', 7), | |
| 95 | + 'capability' => apply_filters($timetics_menu_permission . 'my-profile', 'edit_profile'), | |
| 96 | + 'position' => apply_filters($timetics_menu_position . 'my-profile', 7), | |
| 96 | 97 | ], |
| 97 | 98 | [ |
| 98 | 99 | 'id' => 'shortcode', |
| 99 | 100 | 'title' => esc_html__('Shortcodes', 'timetics'), |
| 100 | 101 | 'link' => '/shortcodes', |
| 101 | - 'capability' => apply_filters('timetics_menu_permission_shortcode', 'manage_options'), | |
| 102 | - 'position' => apply_filters('timetics_menu_position_shortcode', 8), | |
| 102 | + 'capability' => apply_filters($timetics_menu_permission . 'shortcode', 'manage_options'), | |
| 103 | + 'position' => apply_filters($timetics_menu_position . 'shortcode', 8), | |
| 103 | 104 | ], |
| 104 | 105 | [ |
| 105 | 106 | 'id' => 'onboard', |
| 106 | 107 | 'title' => esc_html__('Setup Wizard', 'timetics'), |
| 107 | 108 | 'link' => '/onboard', |
| 108 | - 'capability' => apply_filters('timetics_menu_permission_onboard', 'manage_options'), | |
| 109 | - 'position' => apply_filters('timetics_menu_position_onboard', 9), | |
| 110 | - ], | |
| 111 | - [ | |
| 112 | - 'id' => 'about-us', | |
| 113 | - 'title' => esc_html__('About Us', 'timetics'), | |
| 114 | - 'link' => '/about-us', | |
| 115 | - 'capability' => apply_filters('timetics_menu_permission_about_us', 'manage_options'), | |
| 116 | - 'position' => apply_filters('timetics_menu_position_about_us', 10), | |
| 109 | + 'capability' => apply_filters($timetics_menu_permission . 'onboard', 'manage_options'), | |
| 110 | + 'position' => apply_filters($timetics_menu_position . 'onboard', 9), | |
| 117 | 111 | ], |
| 118 | 112 | ); |
| 119 | 113 | |
| 120 | 114 | add_menu_page( |