PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.2
Timetics – Appointment Booking Calendar & Scheduling v1.0.2
1.0.62 1.0.63 1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 All 64 releases
timetics / core / admin / menu.php

menu.php in Timetics – Appointment Booking Calendar & Scheduling 1.0.2, at core/admin/menu.php

146 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Admin meni class
5 *
6 * @package Timetics
7 */
8
9 namespace Timetics\Core\Admin;
10
11 /**
12 * Class Menu
13 */
14 class Menu
15 {
16
17 use \Timetics\Utils\Singleton;
18
19 /**
20 * Initialize
21 *
22 * @return void
23 */
24 public function init()
25 {
26 add_action('admin_menu', array($this, 'register_admin_menu'));
27
28 // go pro link
29 if (!class_exists('TimeticsPro')) {
30 add_action('admin_menu', array($this, 'add_pro_admin_menu'));
31 }
32 }
33
34
35 /**
36 * Register admin menu
37 *
38 * @return void
39 */
40
41 public function register_admin_menu()
42 {
43 global $submenu;
44 $capability = 'manage_timetics';
45 $slug = 'timetics';
46 $url = 'admin.php?page=' . $slug . '#';
47 $menu_items = array(
48 [
49 'title' => __('Overview', 'timetics'),
50 'link' => '/',
51 'capability' => $capability,
52 'position' => 1,
53 ],
54 [
55 'title' => __('Meetings', 'timetics'),
56 'link' => '/meetings',
57 'capability' => 'read_booking',
58 'position' => 2,
59 ],
60 [
61 'title' => __('Staffs', 'timetics'),
62 'link' => '/staff',
63 'capability' => 'edit_staff',
64 'position' => 3,
65 ],
66
67 [
68 'title' => __('Bookings', 'timetics'),
69 'link' => '/bookings',
70 'capability' => 'read_booking',
71 'position' => 4,
72 ],
73 [
74 'title' => __('Customers', 'timetics'),
75 'link' => '/customers',
76 'capability' => 'manage_options',
77 'position' => 5,
78 ],
79 [
80 'title' => __('Settings', 'timetics'),
81 'link' => '/settings',
82 'capability' => 'manage_options',
83 'position' => 6,
84 ],
85 [
86 'title' => __('My Profile', 'timetics'),
87 'link' => '/my-profile',
88 'capability' => 'edit_profile',
89 'position' => 7,
90 ],
91 [
92 'title' => __('Shortcodes', 'timetics'),
93 'link' => '/shortcodes',
94 'capability' => 'edit_profile',
95 'position' => 8,
96 ],
97 );
98
99 add_menu_page(
100 __('Timetics', 'timetics'),
101 __('Timetics', 'timetics'),
102 $capability,
103 $slug,
104 array($this, 'timetics_dashboard_view'),
105 'dashicons-store',
106 10
107 );
108
109 $menu_items = apply_filters('timetics_menu', $menu_items);
110 $position = array_column($menu_items, 'position');
111
112 array_multisort($position, SORT_ASC, $menu_items);
113
114 foreach ($menu_items as $item) {
115 $submenu[$slug][] = [$item['title'], $item['capability'], $url . $item['link']]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
116 }
117 }
118
119 /**
120 * Admin dashboard view
121 *
122 * @return void
123 */
124 public function timetics_dashboard_view()
125 {
126 ?>
127 <div class="wrap" id="time_tics_dashboard">
128 </div>
129 <?php
130 }
131
132 // Add submenu page under "Settings"
133 public function add_pro_admin_menu()
134 {
135 add_submenu_page(
136 'timetics',
137 'Go Pro',
138 'Go Pro',
139 'manage_options',
140 'https://arraytics.com/timetics',
141 '',
142 9,
143 );
144 }
145 }
146