PluginProbe
ActivityPub / 5.7.0
ActivityPub v5.7.0
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/wp-admin/class-menu.php +2 -91 9.2.05.7.0 View file →
@@ -14,21 +14,13 @@
14 14 */
15 15 class Menu {
16 16
17 17 /**
18 - * Initialize the Menu class.
19 - */
20 - public static function init() {
21 - \add_action( 'admin_menu', array( self::class, 'admin_menu' ) );
22 - \add_action( 'admin_bar_menu', array( self::class, 'admin_bar_menu' ), 100 );
23 - }
24 -
25 - /**
26 18 * Add admin menu entry.
27 19 */
28 20 public static function admin_menu() {
29 21 $settings_page = \add_options_page(
30 - \_x( 'Welcome', 'page title', 'activitypub' ),
22 + 'Welcome',
31 23 'ActivityPub',
32 24 'manage_options',
33 25 'activitypub',
34 26 array( Settings::class, 'settings_page' )
@@ -34,25 +26,9 @@
34 26 array( Settings::class, 'settings_page' )
35 27 );
36 28
37 29 \add_action( 'load-' . $settings_page, array( Settings::class, 'add_settings_help_tab' ) );
38 - \add_action( 'load-users.php', array( Settings::class, 'add_users_help_tab' ) );
39 - \add_action( 'load-' . $settings_page, array( Admin::class, 'add_settings_list_tables' ) );
40 - \add_action( 'load-' . $settings_page, array( Screen_Options::class, 'add_settings_list_options' ) );
41 30
42 - if ( \get_option( 'activitypub_reader_ui', '0' ) && App::is_supported() ) {
43 - $app_hook = \add_dashboard_page(
44 - \__( 'Social Web', 'activitypub' ),
45 - \__( 'Social Web', 'activitypub' ),
46 - ACTIVITYPUB_BLOG_MODE === \get_option( 'activitypub_actor_mode' ) ? 'manage_options' : 'activitypub',
47 - 'activitypub-social-web',
48 - array( App::class, 'render_page' )
49 - );
50 -
51 - \add_action( 'load-' . $app_hook, array( App::class, 'remove_admin_notices' ) );
52 - \add_action( 'admin_print_scripts-' . $app_hook, array( App::class, 'enqueue_scripts' ) );
53 - }
54 -
55 31 // User has to be able to publish posts.
56 32 if ( user_can_activitypub( \get_current_user_id() ) ) {
57 33 $followers_list_page = \add_users_page(
58 34 \__( 'Followers ⁂', 'activitypub' ),
@@ -61,37 +37,10 @@
61 37 'activitypub-followers-list',
62 38 array( Admin::class, 'followers_list_page' )
63 39 );
64 40
65 - \add_action( 'load-' . $followers_list_page, array( Admin::class, 'add_followers_list_table' ) );
66 - \add_action( 'load-' . $followers_list_page, array( Screen_Options::class, 'add_followers_list_options' ) );
41 + \add_action( 'load-' . $followers_list_page, array( Admin::class, 'add_followers_list_help_tab' ) );
67 42
68 - if ( '1' === \get_option( 'activitypub_following_ui', '0' ) ) {
69 - $following_list_page = \add_users_page(
70 - \__( 'Following ⁂', 'activitypub' ),
71 - \__( 'Following ⁂', 'activitypub' ),
72 - 'activitypub',
73 - 'activitypub-following-list',
74 - array( Admin::class, 'following_list_page' )
75 - );
76 -
77 - \add_action( 'load-' . $following_list_page, array( Admin::class, 'add_following_list_table' ) );
78 - \add_action( 'load-' . $following_list_page, array( Settings::class, 'add_following_help_tab' ) );
79 - \add_action( 'load-' . $following_list_page, array( Screen_Options::class, 'add_following_list_options' ) );
80 - }
81 -
82 - // Only show blocked actors page if user has blocked actors.
83 - $blocked_actors_list_page = \add_users_page(
84 - \__( 'Blocked Actors ⁂', 'activitypub' ),
85 - \__( 'Blocked Actors ⁂', 'activitypub' ),
86 - 'activitypub',
87 - 'activitypub-blocked-actors-list',
88 - array( Admin::class, 'blocked_actors_list_page' )
89 - );
90 -
91 - \add_action( 'load-' . $blocked_actors_list_page, array( Admin::class, 'add_blocked_actors_list_table' ) );
92 - \add_action( 'load-' . $blocked_actors_list_page, array( Screen_Options::class, 'add_blocked_actors_list_options' ) );
93 -
94 43 \add_users_page(
95 44 \__( 'Extra Fields ⁂', 'activitypub' ),
96 45 \__( 'Extra Fields ⁂', 'activitypub' ),
97 46 'activitypub',
@@ -97,44 +46,6 @@
97 46 'activitypub',
98 47 \esc_url( \admin_url( '/edit.php?post_type=ap_extrafield' ) )
99 48 );
100 49 }
101 - }
102 -
103 - /**
104 - * Add Social Web item to the admin bar.
105 - *
106 - * @param \WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
107 - */
108 - public static function admin_bar_menu( $wp_admin_bar ) {
109 - // Only show if reader UI is enabled and the WordPress app boot stack is available.
110 - if ( ! \get_option( 'activitypub_reader_ui', '0' ) || ! App::is_supported() ) {
111 - return;
112 - }
113 -
114 - // Check user capability based on actor mode.
115 - $capability = ACTIVITYPUB_BLOG_MODE === \get_option( 'activitypub_actor_mode' ) ? 'manage_options' : 'activitypub';
116 - if ( ! \current_user_can( $capability ) ) {
117 - return;
118 - }
119 -
120 - $wp_admin_bar->add_node(
121 - array(
122 - 'id' => 'activitypub-social-web',
123 - 'title' => \__( 'Social Web', 'activitypub' ),
124 - 'href' => \admin_url( 'admin.php?page=activitypub-social-web' ),
125 - 'meta' => array(
126 - 'class' => 'activitypub-admin-bar-social-web',
127 - 'title' => \__( 'View your Social Web feed', 'activitypub' ),
128 - ),
129 - )
130 - );
131 -
132 - // Enqueue styles for the admin bar icon.
133 - \wp_enqueue_style(
134 - 'activitypub-admin-bar-styles',
135 - \plugins_url( 'assets/css/activitypub-admin-bar.css', ACTIVITYPUB_PLUGIN_FILE ),
136 - array(),
137 - ACTIVITYPUB_PLUGIN_VERSION
138 - );
139 50 }
140 51 }