| 1 |
<?php |
| 2 |
\load_template( |
| 3 |
__DIR__ . '/admin-header.php', |
| 4 |
true, |
| 5 |
array( |
| 6 |
'settings' => 'active', |
| 7 |
'welcome' => '', |
| 8 |
'followers' => '', |
| 9 |
) |
| 10 |
); |
| 11 |
?> |
| 12 |
|
| 13 |
<div class="activitypub-settings activitypub-settings-page hide-if-no-js"> |
| 14 |
<form method="post" action="options.php"> |
| 15 |
<?php \settings_fields( 'activitypub' ); ?> |
| 16 |
|
| 17 |
<div class="box"> |
| 18 |
<h3><?php \esc_html_e( 'Profiles', 'activitypub' ); ?></h3> |
| 19 |
<table class="form-table"> |
| 20 |
<tbody> |
| 21 |
<tr> |
| 22 |
<th scope="row"> |
| 23 |
<?php \esc_html_e( 'Enable profiles by type', 'activitypub' ); ?> |
| 24 |
</th> |
| 25 |
<td> |
| 26 |
<p> |
| 27 |
<label> |
| 28 |
<input type="checkbox" name="activitypub_enable_users" id="activitypub_enable_users" value="1" <?php echo \checked( '1', \get_option( 'activitypub_enable_users', '1' ) ); ?> /> |
| 29 |
<?php \esc_html_e( 'Enable authors', 'activitypub' ); ?> |
| 30 |
</label> |
| 31 |
</p> |
| 32 |
<p class="description"> |
| 33 |
<?php echo \wp_kses( \__( 'Every author on this blog (with the <code>publish_posts</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?> |
| 34 |
</p> |
| 35 |
<p> |
| 36 |
<label> |
| 37 |
<input type="checkbox" name="activitypub_enable_blog_user" id="activitypub_enable_blog_user" value="1" <?php echo \checked( '1', \get_option( 'activitypub_enable_blog_user', '0' ) ); ?> /> |
| 38 |
<?php \esc_html_e( 'Enable blog', 'activitypub' ); ?> |
| 39 |
</label> |
| 40 |
</p> |
| 41 |
<p class="description"> |
| 42 |
<?php \esc_html_e( 'Your blog becomes an ActivityPub profile.', 'activitypub' ); ?> |
| 43 |
</p> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
<tr> |
| 47 |
<th scope="row"> |
| 48 |
<?php \esc_html_e( 'Change blog profile ID', 'activitypub' ); ?> |
| 49 |
</th> |
| 50 |
<td> |
| 51 |
<label for="activitypub_blog_user_identifier"> |
| 52 |
<input class="blog-user-identifier" name="activitypub_blog_user_identifier" id="activitypub_blog_user_identifier" type="text" value="<?php echo esc_attr( \get_option( 'activitypub_blog_user_identifier', \Activitypub\Model\Blog_User::get_default_username() ) ); ?>" /> |
| 53 |
@<?php echo esc_html( \wp_parse_url( \home_url(), PHP_URL_HOST ) ); ?> |
| 54 |
</label> |
| 55 |
<p class="description"> |
| 56 |
<?php \esc_html_e( 'This profile name will federate all posts written on your blog, regardless of the author who posted it.', 'activitypub' ); ?> |
| 57 |
</p> |
| 58 |
<p> |
| 59 |
<strong> |
| 60 |
<?php \esc_html_e( 'Please avoid using an existing author’s name as the blog profile ID. Fediverse platforms might use caching and this could break the functionality completely.', 'activitypub' ); ?> |
| 61 |
</strong> |
| 62 |
</p> |
| 63 |
</td> |
| 64 |
</tr> |
| 65 |
</tbody> |
| 66 |
</table> |
| 67 |
|
| 68 |
<?php \do_settings_fields( 'activitypub', 'user' ); ?> |
| 69 |
</div> |
| 70 |
|
| 71 |
<div class="box"> |
| 72 |
<h3><?php \esc_html_e( 'Activities', 'activitypub' ); ?></h3> |
| 73 |
<table class="form-table"> |
| 74 |
<tbody> |
| 75 |
<tr> |
| 76 |
<th scope="row"> |
| 77 |
<?php \esc_html_e( 'Post content', 'activitypub' ); ?> |
| 78 |
</th> |
| 79 |
<td> |
| 80 |
<p> |
| 81 |
<label for="activitypub_post_content_type_title_link"> |
| 82 |
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_title_link" value="title" <?php echo \checked( 'title', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> /> |
| 83 |
<?php \esc_html_e( 'Title and link', 'activitypub' ); ?> |
| 84 |
- |
| 85 |
<span class="description"> |
| 86 |
<?php \esc_html_e( 'Only the title and a link.', 'activitypub' ); ?> |
| 87 |
</span> |
| 88 |
</label> |
| 89 |
</p> |
| 90 |
<p> |
| 91 |
<label for="activitypub_post_content_type_excerpt"> |
| 92 |
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_excerpt" value="excerpt" <?php echo \checked( 'excerpt', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> /> |
| 93 |
<?php \esc_html_e( 'Excerpt', 'activitypub' ); ?> |
| 94 |
- |
| 95 |
<span class="description"> |
| 96 |
<?php \esc_html_e( 'A content summary, shortened to 400 characters and without markup.', 'activitypub' ); ?> |
| 97 |
</span> |
| 98 |
</label> |
| 99 |
</p> |
| 100 |
<p> |
| 101 |
<label for="activitypub_post_content_type_content"> |
| 102 |
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_content" value="content" <?php echo \checked( 'content', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> /> |
| 103 |
<?php \esc_html_e( 'Content (default)', 'activitypub' ); ?> |
| 104 |
- |
| 105 |
<span class="description"> |
| 106 |
<?php \esc_html_e( 'The full content.', 'activitypub' ); ?> |
| 107 |
</span> |
| 108 |
</label> |
| 109 |
</p> |
| 110 |
<p> |
| 111 |
<label for="activitypub_post_content_type_custom"> |
| 112 |
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_custom" value="custom" <?php echo \checked( 'custom', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> /> |
| 113 |
<?php \esc_html_e( 'Custom', 'activitypub' ); ?> |
| 114 |
- |
| 115 |
<span class="description"> |
| 116 |
<?php \esc_html_e( 'Use the text area below, to customize your activities.', 'activitypub' ); ?> |
| 117 |
</span> |
| 118 |
</label> |
| 119 |
</p> |
| 120 |
<p> |
| 121 |
<textarea name="activitypub_custom_post_content" id="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo wp_kses( ACTIVITYPUB_CUSTOM_POST_CONTENT, 'post' ); ?>"><?php echo wp_kses( \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ), 'post' ); ?></textarea> |
| 122 |
<details> |
| 123 |
<summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary> |
| 124 |
<div class="description"> |
| 125 |
<ul> |
| 126 |
<li><code>[ap_title]</code> - <?php \esc_html_e( 'The post\'s title.', 'activitypub' ); ?></li> |
| 127 |
<li><code>[ap_content]</code> - <?php \esc_html_e( 'The post\'s content.', 'activitypub' ); ?></li> |
| 128 |
<li><code>[ap_excerpt]</code> - <?php \esc_html_e( 'The post\'s excerpt (default 400 chars).', 'activitypub' ); ?></li> |
| 129 |
<li><code>[ap_permalink]</code> - <?php \esc_html_e( 'The post\'s permalink.', 'activitypub' ); ?></li> |
| 130 |
<li><code>[ap_shortlink]</code> - <?php echo \wp_kses( \__( 'The post\'s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>.', 'activitypub' ), 'default' ); ?></li> |
| 131 |
<li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post\'s tags as hashtags.', 'activitypub' ); ?></li> |
| 132 |
</ul> |
| 133 |
<p><?php \esc_html_e( 'You can find the full list with all possible attributes in the help section on the top-right of the screen.', 'activitypub' ); ?></p> |
| 134 |
</div> |
| 135 |
</details> |
| 136 |
</p> |
| 137 |
</td> |
| 138 |
</tr> |
| 139 |
<tr> |
| 140 |
<th scope="row"> |
| 141 |
<?php \esc_html_e( 'Media attachments', 'activitypub' ); ?> |
| 142 |
</th> |
| 143 |
<td> |
| 144 |
<input value="<?php echo esc_attr( \get_option( 'activitypub_max_image_attachments', ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) ); ?>" name="activitypub_max_image_attachments" id="activitypub_max_image_attachments" type="number" min="0" /> |
| 145 |
<p class="description"> |
| 146 |
<?php |
| 147 |
echo \wp_kses( |
| 148 |
\sprintf( |
| 149 |
// translators: |
| 150 |
\__( 'The number of media (images, audio, video) to attach to posts. Default: <code>%s</code>', 'activitypub' ), |
| 151 |
\esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) |
| 152 |
), |
| 153 |
'default' |
| 154 |
); |
| 155 |
?> |
| 156 |
</p> |
| 157 |
<p class="description"> |
| 158 |
<em> |
| 159 |
<?php |
| 160 |
esc_html_e( 'Note: audio and video attachments are only supported from Block Editor.', 'activitypub' ); |
| 161 |
?> |
| 162 |
</em> |
| 163 |
</p> |
| 164 |
</td> |
| 165 |
</tr> |
| 166 |
<tr> |
| 167 |
<th scope="row"> |
| 168 |
<?php \esc_html_e( 'Activity-Object-Type', 'activitypub' ); ?> |
| 169 |
</th> |
| 170 |
<td> |
| 171 |
<p> |
| 172 |
<label for="activitypub_object_type_note"> |
| 173 |
<input type="radio" name="activitypub_object_type" id="activitypub_object_type_note" value="note" <?php echo \checked( 'note', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> |
| 174 |
<?php \esc_html_e( 'Note (default)', 'activitypub' ); ?> |
| 175 |
- |
| 176 |
<span class="description"> |
| 177 |
<?php \esc_html_e( 'Should work with most platforms.', 'activitypub' ); ?> |
| 178 |
</span> |
| 179 |
</label> |
| 180 |
</p> |
| 181 |
<p><strong><?php \esc_html_e( 'Please note that the following "Activity-Object-Type" options may cause your texts to be displayed differently on each platform and/or parts may be completely ignored. Mastodon, for example, displays all content that is not of the "Note" type as links only.', 'activitypub' ); ?></strong></p> |
| 182 |
<p> |
| 183 |
<label for="activitypub_object_type_article"> |
| 184 |
<input type="radio" name="activitypub_object_type" id="activitypub_object_type_article" value="article" <?php echo \checked( 'article', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> |
| 185 |
<?php \esc_html_e( 'Article', 'activitypub' ); ?> |
| 186 |
- |
| 187 |
<span class="description"> |
| 188 |
<?php \esc_html_e( 'The presentation of the "Article" might change on different platforms.', 'activitypub' ); ?> |
| 189 |
</span> |
| 190 |
</label> |
| 191 |
</p> |
| 192 |
<p> |
| 193 |
<label> |
| 194 |
<input type="radio" name="activitypub_object_type" id="activitypub_object_type" value="wordpress-post-format" <?php echo \checked( 'wordpress-post-format', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> |
| 195 |
<?php \esc_html_e( 'WordPress Post-Format', 'activitypub' ); ?> |
| 196 |
- |
| 197 |
<span class="description"> |
| 198 |
<?php \esc_html_e( 'Maps the WordPress Post-Format to the ActivityPub Object Type.', 'activitypub' ); ?> |
| 199 |
</span> |
| 200 |
</label> |
| 201 |
</p> |
| 202 |
</td> |
| 203 |
</tr> |
| 204 |
<tr> |
| 205 |
<th scope="row"><?php \esc_html_e( 'Supported post types', 'activitypub' ); ?></th> |
| 206 |
<td> |
| 207 |
<fieldset> |
| 208 |
<?php \esc_html_e( 'Enable ActivityPub support for the following post types:', 'activitypub' ); ?> |
| 209 |
|
| 210 |
<?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?> |
| 211 |
<?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array(); ?> |
| 212 |
<ul> |
| 213 |
<?php // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> |
| 214 |
<?php foreach ( $post_types as $post_type ) { ?> |
| 215 |
<li> |
| 216 |
<input type="checkbox" id="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>" name="activitypub_support_post_types[]" value="<?php echo \esc_attr( $post_type->name ); ?>" <?php echo \checked( \in_array( $post_type->name, $support_post_types, true ) ); ?> /> |
| 217 |
<label for="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>"><?php echo \esc_html( $post_type->label ); ?></label> |
| 218 |
</li> |
| 219 |
<?php } ?> |
| 220 |
</ul> |
| 221 |
</fieldset> |
| 222 |
</td> |
| 223 |
</tr> |
| 224 |
<tr> |
| 225 |
<th scope="row"> |
| 226 |
<?php \esc_html_e( 'Hashtags (beta)', 'activitypub' ); ?> |
| 227 |
</th> |
| 228 |
<td> |
| 229 |
<p> |
| 230 |
<label><input type="checkbox" name="activitypub_use_hashtags" id="activitypub_use_hashtags" value="1" <?php echo \checked( '1', \get_option( 'activitypub_use_hashtags', '1' ) ); ?> /> <?php echo wp_kses( \__( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag link. <strong>This feature is experimental! Please disable it, if you find any HTML or CSS errors.</strong>', 'activitypub' ), 'default' ); ?></label> |
| 231 |
</p> |
| 232 |
</td> |
| 233 |
</tr> |
| 234 |
</tbody> |
| 235 |
</table> |
| 236 |
|
| 237 |
<?php \do_settings_fields( 'activitypub', 'activity' ); ?> |
| 238 |
</div> |
| 239 |
|
| 240 |
<div class="box"> |
| 241 |
<h3><?php \esc_html_e( 'Server', 'activitypub' ); ?></h3> |
| 242 |
<table class="form-table"> |
| 243 |
<tbody> |
| 244 |
<tr> |
| 245 |
<th scope="row"> |
| 246 |
<?php \esc_html_e( 'Blocklist', 'activitypub' ); ?> |
| 247 |
</th> |
| 248 |
<td> |
| 249 |
<p class="description"> |
| 250 |
<?php |
| 251 |
echo \wp_kses( |
| 252 |
\sprintf( |
| 253 |
// translators: %s is a URL. |
| 254 |
\__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ), |
| 255 |
\esc_attr( \admin_url( 'options-discussion.php#disallowed_keys' ) ) |
| 256 |
), |
| 257 |
'default' |
| 258 |
); |
| 259 |
?> |
| 260 |
</p> |
| 261 |
</td> |
| 262 |
</tr> |
| 263 |
</tbody> |
| 264 |
</table> |
| 265 |
|
| 266 |
<?php \do_settings_fields( 'activitypub', 'server' ); ?> |
| 267 |
</div> |
| 268 |
<?php \do_settings_sections( 'activitypub' ); ?> |
| 269 |
|
| 270 |
<?php \submit_button(); ?> |
| 271 |
</form> |
| 272 |
</div> |
| 273 |
|