PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / includes / admin / Menu.php

Menu.php in Forumax – AI Powered Advanced Community Forum Plugin 2.2.0, at includes/admin/Menu.php

105 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace admin;
3
4 /**
5 * Menu class for Forumax admin pages.
6 *
7 * Handles the registration and rendering of all admin menu pages.
8 *
9 * @package Forumax
10 * @since 1.0.0
11 */
12 class Menu {
13
14 /**
15 * Constructor.
16 *
17 * Initializes the menu hooks.
18 */
19 public function __construct() {
20 add_action( 'admin_menu', [ $this, 'forumax_admin_menu' ] );
21 }
22
23 /**
24 * Create Admin menu and submenu pages.
25 *
26 * Registers the main Forumax menu and all submenu pages.
27 * The main menu opens the Dashboard page.
28 *
29 * @return void
30 */
31 public function forumax_admin_menu() {
32 $capability = 'manage_options';
33
34 // Main menu page - opens Dashboard.
35 add_menu_page(
36 __( 'Forumax', 'forumax' ),
37 __( 'Forumax', 'forumax' ),
38 $capability,
39 'forumax',
40 [ $this, 'forumax_dashboard_page' ],
41 FORUMAX_IMG . 'admin/favicon.png',
42 20
43 );
44
45 // Dashboard submenu (matches parent slug so it doesn't duplicate).
46 add_submenu_page(
47 'forumax',
48 __( 'Dashboard', 'forumax' ),
49 __( 'Dashboard', 'forumax' ),
50 $capability,
51 'forumax',
52 [ $this, 'forumax_dashboard_page' ]
53 );
54
55 // Forum Builder submenu.
56 add_submenu_page(
57 'forumax',
58 __( 'Forum Builder', 'forumax' ),
59 __( 'Forum Builder', 'forumax' ),
60 $capability,
61 'forumax-builder',
62 [ $this, 'forumax_plugin_page' ]
63 );
64
65 // Remove default bbPress menu items if setting is disabled.
66 if ( ! forumax_get_opt( 'is_bbp_post_types_hidden' ) ) {
67 remove_menu_page( 'edit.php?post_type=forum' );
68 remove_menu_page( 'edit.php?post_type=topic' );
69 remove_menu_page( 'edit.php?post_type=reply' );
70 }
71 }
72
73 /**
74 * Forum Builder page callback function.
75 *
76 * Renders the main forum builder admin UI.
77 *
78 * @return void
79 */
80 public function forumax_plugin_page() {
81 include plugin_dir_path( __FILE__ ) . '/menu/admin_ui.php';
82 }
83
84 /**
85 * Dashboard page callback function.
86 *
87 * Renders the comprehensive dashboard with statistics and activity.
88 *
89 * @return void
90 */
91 public function forumax_dashboard_page() {
92 include plugin_dir_path( __FILE__ ) . '/menu/dashboard.php';
93 }
94
95 /**
96 * Legacy Dashboard Statistics.
97 *
98 * @deprecated 2.1.0 Use forumax_dashboard_page() instead.
99 * @return void
100 */
101 public function forumax_statistics_dashboard() {
102 include plugin_dir_path( __FILE__ ) . '/menu/statistics.php';
103 }
104 }
105