| 1 |
<?php |
| 2 |
namespace admin; |
| 3 |
|
| 4 |
class Menu { |
| 5 |
function __construct() { |
| 6 |
add_action( 'admin_menu', [ $this, 'forumax_admin_menu' ] ); |
| 7 |
} |
| 8 |
|
| 9 |
/** |
| 10 |
* Create Admin menu |
| 11 |
* |
| 12 |
* @return void |
| 13 |
*/ |
| 14 |
public function forumax_admin_menu() { |
| 15 |
$capability = 'manage_options'; |
| 16 |
|
| 17 |
add_menu_page( __( 'Forumax', 'forumax' ), __( 'Forumax', 'forumax' ), $capability, 'forumax', [ $this, 'forumax_plugin_page' ], FORUMAX_IMG . 'admin/favicon.png', 20 ); |
| 18 |
add_submenu_page( 'forumax', __( 'Forum Builder', 'forumax' ), __( 'Forum Builder', 'forumax' ), $capability, 'forumax' ); |
| 19 |
// add_submenu_page( 'forumax', __( 'Forumax Dashboard', 'forumax' ), __( 'Dashboard', 'forumax' ), $capability, 'admin.php?page=forumax-dashboard', [ $this, 'forumax_statistics_dashboard' ] ); |
| 20 |
|
| 21 |
// Remove menu items. |
| 22 |
if ( !forumax_get_opt( 'is_bbp_post_types_hidden' ) ) { |
| 23 |
remove_menu_page( 'edit.php?post_type=forum' ); |
| 24 |
remove_menu_page( 'edit.php?post_type=topic' ); |
| 25 |
remove_menu_page( 'edit.php?post_type=reply' ); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Plugin page callback function. |
| 31 |
* |
| 32 |
* @return void |
| 33 |
*/ |
| 34 |
public function forumax_plugin_page() { |
| 35 |
include plugin_dir_path( __FILE__ ) . '/menu/admin_ui.php'; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Dashboard Statistics. |
| 40 |
* |
| 41 |
* @return void |
| 42 |
*/ |
| 43 |
public function forumax_statistics_dashboard() { |
| 44 |
include plugin_dir_path( __FILE__ ) . '/menu/statistics.php'; |
| 45 |
} |
| 46 |
} |
| 47 |
|