PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Admin / Page.php
shop-press / Admin Last commit date
API 1 week ago DefaultOptions 2 years ago PagesFields 4 months ago SettingsFields 4 months ago Announcement.php 1 week ago Assets.php 1 week ago Main.php 1 year ago Page.php 1 week ago PostType.php 2 years ago
Page.php
67 lines
1 <?php
2 /**
3 * Admin page.
4 *
5 * @package ShopPress
6 */
7
8 namespace ShopPress\Admin;
9
10 defined( 'ABSPATH' ) || exit;
11
12 class Page {
13 /**
14 * Hooks.
15 *
16 * @since 1.2.0
17 */
18 public static function init() {
19 add_action( 'admin_menu', array( __CLASS__, 'add_admin_menu' ) );
20 add_action( 'admin_notices', array( __CLASS__, 'remove_header_actions' ), 1 );
21 }
22
23 /**
24 * Remove actions from the header.
25 *
26 * @since 1.1.1
27 */
28 public static function remove_header_actions() {
29 $screen = get_current_screen();
30 if ( $screen && 'toplevel_page_shoppress' === $screen->id ) {
31 remove_all_actions( 'admin_notices' );
32 }
33 }
34
35 /**
36 * Menu.
37 *
38 * @since 1.0.0
39 */
40 public static function add_admin_menu() {
41 add_menu_page(
42 __( 'ShopPress', 'shop-press' ),
43 __( 'ShopPress', 'shop-press' ),
44 'manage_options',
45 'shoppress',
46 array( __CLASS__, 'admin_view' ),
47 SHOPPRESS_URL . 'public/images/logo/logo.svg',
48 2
49 );
50 }
51
52 /**
53 * React div.
54 *
55 * @since 1.0.0
56 */
57 public static function admin_view() {
58 do_action( 'shoppress/admin/before_dashboard' );
59
60 ?>
61 <div id="shoppress"></div>
62 <?php
63
64 do_action( 'shoppress/admin/after_dashboard' );
65 }
66 }
67