PluginProbe
ActivityPub / 0.7.3
ActivityPub v0.7.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-admin.php

class-admin.php in ActivityPub 0.7.3, at includes/class-admin.php

119 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Activitypub;
3
4 /**
5 * ActivityPub Admin Class
6 *
7 * @author Matthias Pfefferle
8 */
9 class Admin {
10 /**
11 * Initialize the class, registering WordPress hooks
12 */
13 public static function init() {
14 add_action( 'admin_menu', array( '\Activitypub\Admin', 'admin_menu' ) );
15 add_action( 'admin_init', array( '\Activitypub\Admin', 'register_settings' ) );
16 add_action( 'show_user_profile', array( '\Activitypub\Admin', 'add_fediverse_profile' ) );
17 }
18
19 /**
20 * Add admin menu entry
21 */
22 public static function admin_menu() {
23 $settings_page = add_options_page(
24 'ActivityPub',
25 'ActivityPub',
26 'manage_options',
27 'activitypub',
28 array( '\Activitypub\Admin', 'settings_page' )
29 );
30
31 add_action( 'load-' . $settings_page, array( '\Activitypub\Admin', 'add_help_tab' ) );
32 }
33
34 /**
35 * Load settings page
36 */
37 public static function settings_page() {
38 load_template( dirname( __FILE__ ) . '/../templates/settings-page.php' );
39 }
40
41 /**
42 * Register PubSubHubbub settings
43 */
44 public static function register_settings() {
45 register_setting(
46 'activitypub', 'activitypub_post_content_type', array(
47 'type' => 'string',
48 'description' => __( 'Use summary or full content', 'activitypub' ),
49 'show_in_rest' => array(
50 'schema' => array(
51 'enum' => array( 'excerpt', 'content' ),
52 ),
53 ),
54 'default' => 'content',
55 )
56 );
57 register_setting(
58 'activitypub', 'activitypub_object_type', array(
59 'type' => 'string',
60 'description' => __( 'The Activity-Object-Type', 'activitypub' ),
61 'show_in_rest' => array(
62 'schema' => array(
63 'enum' => array( 'note', 'article', 'wordpress-post-format' ),
64 ),
65 ),
66 'default' => 'note',
67 )
68 );
69 register_setting(
70 'activitypub', 'activitypub_use_shortlink', array(
71 'type' => 'boolean',
72 'description' => __( 'Use the Shortlink instead of the permalink', 'activitypub' ),
73 'default' => 0,
74 )
75 );
76 register_setting(
77 'activitypub', 'activitypub_use_hashtags', array(
78 'type' => 'boolean',
79 'description' => __( 'Add hashtags in the content as native tags and replace the #tag with the tag-link', 'activitypub' ),
80 'default' => 0,
81 )
82 );
83 register_setting(
84 'activitypub', 'activitypub_add_tags_as_hashtags', array(
85 'type' => 'boolean',
86 'description' => __( 'Add all tags as hashtags at the end of each activity', 'activitypub' ),
87 'default' => 0,
88 )
89 );
90 }
91
92 public static function add_help_tab() {
93 get_current_screen()->add_help_tab(
94 array(
95 'id' => 'overview',
96 'title' => __( 'Overview', 'activitypub' ),
97 'content' =>
98 '<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>',
99 )
100 );
101
102 get_current_screen()->set_help_sidebar(
103 '<p><strong>' . __( 'For more information:', 'activitypub' ) . '</strong></p>' .
104 '<p>' . __( '<a href="https://activitypub.rocks/">Test Suite</a>', 'activitypub' ) . '</p>' .
105 '<p>' . __( '<a href="https://www.w3.org/TR/activitypub/">W3C Spec</a>', 'activitypub' ) . '</p>' .
106 '<p>' . __( '<a href="https://github.com/pfefferle/wordpress-activitypub/issues">Give us feedback</a>', 'activitypub' ) . '</p>' .
107 '<hr />' .
108 '<p>' . __( '<a href="https://notiz.blog/donate">Donate</a>', 'activitypub' ) . '</p>'
109 );
110 }
111
112 public static function add_fediverse_profile( $user ) {
113 ?>
114 <h2><?php esc_html_e( 'Fediverse', 'activitypub' ); ?></h2>
115 <?php
116 \Activitypub\get_identifier_settings( $user->ID );
117 }
118 }
119