| 1 |
<?php |
| 2 |
/** |
| 3 |
* Menu file. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Activitypub\WP_Admin; |
| 9 |
|
| 10 |
use function Activitypub\is_user_disabled; |
| 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 |
'Welcome', |
| 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 |
|
| 31 |
// User has to be able to publish posts. |
| 32 |
if ( ! is_user_disabled( get_current_user_id() ) ) { |
| 33 |
$followers_list_page = \add_users_page( |
| 34 |
\__( 'Followers ⁂', 'activitypub' ), |
| 35 |
\__( 'Followers ⁂', 'activitypub' ), |
| 36 |
'activitypub', |
| 37 |
'activitypub-followers-list', |
| 38 |
array( Admin::class, 'followers_list_page' ) |
| 39 |
); |
| 40 |
|
| 41 |
\add_action( 'load-' . $followers_list_page, array( Admin::class, 'add_followers_list_help_tab' ) ); |
| 42 |
|
| 43 |
\add_users_page( |
| 44 |
\__( 'Extra Fields ⁂', 'activitypub' ), |
| 45 |
\__( 'Extra Fields ⁂', 'activitypub' ), |
| 46 |
'activitypub', |
| 47 |
\esc_url( \admin_url( '/edit.php?post_type=ap_extrafield' ) ) |
| 48 |
); |
| 49 |
} |
| 50 |
} |
| 51 |
} |
| 52 |
|