PluginProbe
ActivityPub / 7.7.0
ActivityPub v7.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
activitypub / includes / wp-admin / class-menu.php

class-menu.php in ActivityPub 7.7.0, at includes/wp-admin/class-menu.php

82 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Menu file.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub\WP_Admin;
9
10 use function Activitypub\user_can_activitypub;
11
12 /**
13 * ActivityPub Menu Class.
14 */
15 class Menu {
16
17 /**
18 * Add admin menu entry.
19 */
20 public static function admin_menu() {
21 $settings_page = \add_options_page(
22 \_x( 'Welcome', 'page title', 'activitypub' ),
23 'ActivityPub',
24 'manage_options',
25 'activitypub',
26 array( Settings::class, 'settings_page' )
27 );
28
29 \add_action( 'load-' . $settings_page, array( Settings::class, 'add_settings_help_tab' ) );
30 \add_action( 'load-users.php', array( Settings::class, 'add_users_help_tab' ) );
31 \add_action( 'load-' . $settings_page, array( Admin::class, 'add_settings_list_tables' ) );
32 \add_action( 'load-' . $settings_page, array( Screen_Options::class, 'add_settings_list_options' ) );
33
34 // User has to be able to publish posts.
35 if ( user_can_activitypub( \get_current_user_id() ) ) {
36 $followers_list_page = \add_users_page(
37 \__( 'Followers ⁂', 'activitypub' ),
38 \__( 'Followers ⁂', 'activitypub' ),
39 'activitypub',
40 'activitypub-followers-list',
41 array( Admin::class, 'followers_list_page' )
42 );
43
44 \add_action( 'load-' . $followers_list_page, array( Admin::class, 'add_followers_list_table' ) );
45 \add_action( 'load-' . $followers_list_page, array( Screen_Options::class, 'add_followers_list_options' ) );
46
47 if ( '1' === \get_option( 'activitypub_following_ui', '0' ) ) {
48 $following_list_page = \add_users_page(
49 \__( 'Following ⁂', 'activitypub' ),
50 \__( 'Following ⁂', 'activitypub' ),
51 'activitypub',
52 'activitypub-following-list',
53 array( Admin::class, 'following_list_page' )
54 );
55
56 \add_action( 'load-' . $following_list_page, array( Admin::class, 'add_following_list_table' ) );
57 \add_action( 'load-' . $following_list_page, array( Settings::class, 'add_following_help_tab' ) );
58 \add_action( 'load-' . $following_list_page, array( Screen_Options::class, 'add_following_list_options' ) );
59 }
60
61 // Only show blocked actors page if user has blocked actors.
62 $blocked_actors_list_page = \add_users_page(
63 \__( 'Blocked Actors ⁂', 'activitypub' ),
64 \__( 'Blocked Actors ⁂', 'activitypub' ),
65 'activitypub',
66 'activitypub-blocked-actors-list',
67 array( Admin::class, 'blocked_actors_list_page' )
68 );
69
70 \add_action( 'load-' . $blocked_actors_list_page, array( Admin::class, 'add_blocked_actors_list_table' ) );
71 \add_action( 'load-' . $blocked_actors_list_page, array( Screen_Options::class, 'add_blocked_actors_list_options' ) );
72
73 \add_users_page(
74 \__( 'Extra Fields ⁂', 'activitypub' ),
75 \__( 'Extra Fields ⁂', 'activitypub' ),
76 'activitypub',
77 \esc_url( \admin_url( '/edit.php?post_type=ap_extrafield' ) )
78 );
79 }
80 }
81 }
82