PluginProbe
ActivityPub / 0.4.3
ActivityPub v0.4.3
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 / class-activitypub-admin.php

class-activitypub-admin.php in ActivityPub 0.4.3, at includes/class-activitypub-admin.php

99 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ActivityPub Admin Class
4 */
5 class Activitypub_Admin {
6 /**
7 * Add admin menu entry
8 */
9 public static function admin_menu() {
10 $settings_page = add_options_page(
11 'ActivityPub',
12 'ActivityPub',
13 'manage_options',
14 'activitypub',
15 array( 'Activitypub_Admin', 'settings_page' )
16 );
17
18 add_action( 'load-' . $settings_page, array( 'Activitypub_Admin', 'add_help_tab' ) );
19 }
20
21 /**
22 * Load settings page
23 */
24 public static function settings_page() {
25 load_template( dirname( __FILE__ ) . '/../templates/settings-page.php' );
26 }
27
28 /**
29 * Register PubSubHubbub settings
30 */
31 public static function register_settings() {
32 register_setting(
33 'activitypub', 'activitypub_post_content_type', array(
34 'type' => 'string',
35 'description' => __( 'Use summary or full content', 'activitypub' ),
36 'show_in_rest' => array(
37 'schema' => array(
38 'enum' => array( 'excerpt', 'content' ),
39 ),
40 ),
41 'default' => 'content',
42 )
43 );
44 register_setting(
45 'activitypub', 'activitypub_object_type', array(
46 'type' => 'string',
47 'description' => __( 'The Activity-Object-Type', 'activitypub' ),
48 'show_in_rest' => array(
49 'schema' => array(
50 'enum' => array( 'note', 'article', 'wordpress-post-format' ),
51 ),
52 ),
53 'default' => 'note',
54 )
55 );
56 register_setting(
57 'activitypub', 'activitypub_use_shortlink', array(
58 'type' => 'boolean',
59 'description' => __( 'Use the Shortlink instead of the permalink', 'activitypub' ),
60 'default' => 0,
61 )
62 );
63 register_setting(
64 'activitypub', 'activitypub_use_hashtags', array(
65 'type' => 'boolean',
66 'description' => __( 'Use the Shortlink instead of the permalink', 'activitypub' ),
67 'default' => 0,
68 )
69 );
70 }
71
72 public static function add_help_tab() {
73 get_current_screen()->add_help_tab(
74 array(
75 'id' => 'overview',
76 'title' => __( 'Overview', 'activitypub' ),
77 'content' =>
78 '<p>' . __( 'ActivityPub is a decentralized social networking protocol based on the ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended standard published by the W3C Social Web Working Group. It provides a client to server API for creating, updating and deleting content, as well as a federated server to server API for delivering notifications and subscribing to content.', 'activitypub' ) . '</p>',
79 )
80 );
81
82 get_current_screen()->set_help_sidebar(
83 '<p><strong>' . __( 'For more information:', 'activitypub' ) . '</strong></p>' .
84 '<p>' . __( '<a href="https://activitypub.rocks/">Test Suite</a>', 'activitypub' ) . '</p>' .
85 '<p>' . __( '<a href="https://www.w3.org/TR/activitypub/">W3C Spec</a>', 'activitypub' ) . '</p>' .
86 '<p>' . __( '<a href="https://github.com/pfefferle/wordpress-activitypub/issues">Give us feedback</a>', 'activitypub' ) . '</p>' .
87 '<hr />' .
88 '<p>' . __( '<a href="https://notiz.blog/donate">Donate</a>', 'activitypub' ) . '</p>'
89 );
90 }
91
92 public static function add_fediverse_profile( $user ) {
93 ?>
94 <h2><?php esc_html_e( 'Fediverse', 'activitypub' ); ?></h2>
95 <?php
96 activitypub_get_identifier_settings( $user->ID );
97 }
98 }
99