PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 1.9.1
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v1.9.1
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / admin / menu.php

menu.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 1.9.1, at includes/admin/menu.php

141 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 namespace StoreEngine\Admin;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 class Menu {
10
11 public static function init() {
12 $self = new self();
13 add_action( 'admin_menu', [ $self, 'admin_menu' ] );
14 }
15
16 public static function get_menu_lists() {
17 $menu_items = [
18 STOREENGINE_PLUGIN_SLUG => [
19 'title' => __( 'Dashboard', 'storeengine' ),
20 'capability' => 'manage_options',
21 'priority' => 0,
22 ],
23 STOREENGINE_PLUGIN_SLUG . '-products' => [
24 'title' => __( 'Products', 'storeengine' ),
25 'capability' => 'manage_options',
26 'sub_items' => [
27 [
28 'slug' => '',
29 'title' => __( 'All Products', 'storeengine' ),
30 ],
31 [
32 'slug' => 'category',
33 'title' => __( 'Category', 'storeengine' ),
34 ],
35 [
36 'slug' => 'tags',
37 'title' => __( 'Tags', 'storeengine' ),
38 ],
39 [
40 'slug' => 'attributes',
41 'title' => __( 'Attributes', 'storeengine' ),
42 ],
43 ],
44 'priority' => 10,
45 ],
46 STOREENGINE_PLUGIN_SLUG . '-orders' => [
47 'title' => __( 'Orders', 'storeengine' ),
48 'capability' => 'manage_options',
49 'priority' => 20,
50 ],
51 STOREENGINE_PLUGIN_SLUG . '-coupons' => [
52 'title' => __( 'Coupons', 'storeengine' ),
53 'capability' => 'manage_options',
54 'priority' => 30,
55 ],
56 STOREENGINE_PLUGIN_SLUG . '-customers' => [
57 'title' => __( 'Customers', 'storeengine' ),
58 'capability' => 'manage_options',
59 'priority' => 40,
60 ],
61 STOREENGINE_PLUGIN_SLUG . '-payments' => [
62 'title' => __( 'Payments', 'storeengine' ),
63 'capability' => 'manage_options',
64 'priority' => 50,
65 ],
66 STOREENGINE_PLUGIN_SLUG . '-addons' => [
67 'title' => __( 'Add-ons', 'storeengine' ),
68 'capability' => 'manage_options',
69 'priority' => 90,
70 ],
71 STOREENGINE_PLUGIN_SLUG . '-tools' => [
72 'title' => __( 'Tools', 'storeengine' ),
73 'capability' => 'manage_options',
74 'priority' => 90,
75 ],
76 STOREENGINE_PLUGIN_SLUG . '-logs' => [
77 'title' => __( 'Logs', 'storeengine' ),
78 'capability' => 'manage_options',
79 'priority' => 80,
80 ],
81 STOREENGINE_PLUGIN_SLUG . '-settings' => [
82 'title' => __( 'Settings', 'storeengine' ),
83 'capability' => 'manage_options',
84 'priority' => 99,
85 ],
86 ];
87
88 $menu = apply_filters( 'storeengine/admin_menu_list', $menu_items );
89
90 if ( ! defined( 'STOREENGINE_PRO_VERSION' ) ) {
91 $menu[ STOREENGINE_PLUGIN_SLUG . '-get-pro' ] = [
92 'title' => '<span class="dashicons dashicons-awards storeengine-blue-color"></span> ' . __( 'Get Pro', 'storeengine' ),
93 'capability' => 'manage_options',
94 'priority' => 100,
95 ];
96 }
97
98 uasort( $menu, function ( $a, $b ) {
99 return ( $a['priority'] ?? 0 ) <=> ( $b['priority'] ?? 0 );
100 } );
101
102 return $menu;
103 }
104
105 /**
106 * Add admin menu page
107 *
108 * @return void
109 */
110 public function admin_menu() {
111 add_menu_page(
112 __( 'StoreEngine', 'storeengine' ),
113 __( 'StoreEngine', 'storeengine' ),
114 'manage_options',
115 STOREENGINE_PLUGIN_SLUG,
116 [ $this, 'load_main_template' ],
117 $this->get_menu_icon(),
118 55
119 );
120
121 foreach ( self::get_menu_lists() as $item_key => $item ) {
122 add_submenu_page(
123 STOREENGINE_PLUGIN_SLUG,
124 $item['title'],
125 $item['title'],
126 $item['capability'],
127 $item_key,
128 [ $this, 'load_main_template' ]
129 );
130 }
131 }
132
133 protected function get_menu_icon() {
134 return apply_filters( 'storeengine/admin/toplevel_inactive_menu_icon', STOREENGINE_ASSETS_URI . 'images/logo.svg' );
135 }
136
137 public function load_main_template() {
138 echo '<div id="storeengine-admin" class="storeengine-admin"></div>';
139 }
140 }
141