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
← All changes | includes/admin/Menu.php +104 -49 1.3.12.2.0 View file →
@@ -1,49 +1,104 @@
1 -<?php
2 -namespace admin;
3 -
4 -class Menu {
5 - function __construct() {
6 - add_action( 'admin_menu', [ $this, 'bbpc_admin_menu' ] );
7 - }
8 -
9 - /**
10 - * Create Admin menu
11 - *
12 - * @return void
13 - */
14 - public function bbpc_admin_menu() {
15 - $capability = 'manage_options';
16 -
17 - add_menu_page( __( 'BBP Core', 'bbp-core' ), __( 'BBP Core', 'bbp-core' ), $capability, 'bbp-core', [ $this, 'bbpc_plugin_page' ], 'dashicons-buddicons-bbpress-logo', 20 );
18 - add_submenu_page( 'bbp-core', __( 'Forum Builder', 'bbp-core' ), __( 'Forum Builder', 'bbp-core' ), $capability, 'bbp-core' );
19 - // add_submenu_page( 'bbp-core', __( 'BBP Core Dashboard', 'bbp-core' ), __( 'Dashboard', 'bbp-core' ), $capability, 'admin.php?page=bbp-core-dashboard', [ $this, 'bbpc_statistics_dashboard' ] );
20 -
21 - // Remove menu items.
22 - $opt = get_option( 'bbp_core_settings' );
23 -
24 - if ( isset($opt['is_bbp_post_types_hidden']) && ! $opt['is_bbp_post_types_hidden'] ) {
25 - remove_menu_page( 'edit.php?post_type=forum' );
26 - remove_menu_page( 'edit.php?post_type=topic' );
27 - remove_menu_page( 'edit.php?post_type=reply' );
28 - }
29 - }
30 -
31 - /**
32 - * Plugin page callback function.
33 - *
34 - * @return void
35 - */
36 - public function bbpc_plugin_page() {
37 - $opt = get_option( 'bbp_core_settings' );
38 - include plugin_dir_path( __FILE__ ) . '/menu/admin_ui.php';
39 - }
40 -
41 - /**
42 - * Dashboard Statistics.
43 - *
44 - * @return void
45 - */
46 - public function bbpc_statistics_dashboard() {
47 - include plugin_dir_path( __FILE__ ) . '/menu/statistics.php';
48 - }
49 -}
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 +}