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