| 1 |
<?php |
| 2 |
\load_template( |
| 3 |
__DIR__ . '/admin-header.php', |
| 4 |
true, |
| 5 |
array( |
| 6 |
'settings' => 'active', |
| 7 |
'welcome' => '', |
| 8 |
'followers' => '', |
| 9 |
'blog-profile' => '', |
| 10 |
) |
| 11 |
); |
| 12 |
?> |
| 13 |
|
| 14 |
<div class="activitypub-settings activitypub-settings-page hide-if-no-js"> |
| 15 |
<form method="post" action="options.php"> |
| 16 |
<?php \settings_fields( 'activitypub' ); ?> |
| 17 |
|
| 18 |
<div class="box"> |
| 19 |
<h3><?php \esc_html_e( 'Profiles', 'activitypub' ); ?></h3> |
| 20 |
<table class="form-table"> |
| 21 |
<tbody> |
| 22 |
<tr> |
| 23 |
<th scope="row"> |
| 24 |
<?php \esc_html_e( 'Enable profiles by type', 'activitypub' ); ?> |
| 25 |
</th> |
| 26 |
<td> |
| 27 |
<p> |
| 28 |
<label> |
| 29 |
<input type="checkbox" name="activitypub_enable_users" id="activitypub_enable_users" value="1" <?php echo \checked( '1', \get_option( 'activitypub_enable_users', '1' ) ); ?> /> |
| 30 |
<?php \esc_html_e( 'Enable Author-Profiles', 'activitypub' ); ?> |
| 31 |
</label> |
| 32 |
</p> |
| 33 |
<p class="description"> |
| 34 |
<?php echo \wp_kses( \__( 'Every author on this blog (with the <code>activitypub</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?> |
| 35 |
<?php // translators: %s is a URL. ?> |
| 36 |
<strong><?php echo \wp_kses( sprintf( \__( 'You can add/remove the capability in the <a href="%s">user settings.</a>', 'activitypub' ), admin_url( '/users.php' ) ), array( 'a' => array( 'href' => array() ) ) ); ?></strong> |
| 37 |
<?php echo \wp_kses( \__( 'Select all the users you want to update, choose the method from the drop-down list and click on the "Apply" button.', 'activitypub' ), array( 'code' => array() ) ); ?> |
| 38 |
</p> |
| 39 |
<p> |
| 40 |
<label> |
| 41 |
<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' ) ); ?> /> |
| 42 |
<?php \esc_html_e( 'Enable Blog-Profile', 'activitypub' ); ?> |
| 43 |
</label> |
| 44 |
</p> |
| 45 |
<p class="description"> |
| 46 |
<?php \esc_html_e( 'Your blog becomes an ActivityPub profile.', 'activitypub' ); ?> |
| 47 |
</p> |
| 48 |
</td> |
| 49 |
</tr> |
| 50 |
</tbody> |
| 51 |
</table> |
| 52 |
|
| 53 |
<?php \do_settings_fields( 'activitypub', 'user' ); ?> |
| 54 |
</div> |
| 55 |
|
| 56 |
<div class="box"> |
| 57 |
<h3><?php \esc_html_e( 'Activities', 'activitypub' ); ?></h3> |
| 58 |
<table class="form-table"> |
| 59 |
<tbody> |
| 60 |
<tr> |
| 61 |
<th scope="row"> |
| 62 |
<?php \esc_html_e( 'Activity-Object-Type', 'activitypub' ); ?> |
| 63 |
</th> |
| 64 |
<td> |
| 65 |
<p> |
| 66 |
<label for="activitypub_object_type_note"> |
| 67 |
<input type="radio" name="activitypub_object_type" id="activitypub_object_type_note" value="note" <?php echo \checked( 'note', \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ); ?> /> |
| 68 |
<?php \esc_html_e( 'Note (default)', 'activitypub' ); ?> |
| 69 |
- |
| 70 |
<span class="description"> |
| 71 |
<?php \esc_html_e( 'Should work with most platforms.', 'activitypub' ); ?> |
| 72 |
</span> |
| 73 |
</label> |
| 74 |
</p> |
| 75 |
<p> |
| 76 |
<label> |
| 77 |
<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', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ); ?> /> |
| 78 |
<?php \esc_html_e( 'WordPress Post-Format', 'activitypub' ); ?> |
| 79 |
- |
| 80 |
<span class="description"> |
| 81 |
<?php \esc_html_e( 'Maps the WordPress Post-Format to the ActivityPub Object Type.', 'activitypub' ); ?> |
| 82 |
</span> |
| 83 |
</label> |
| 84 |
</p> |
| 85 |
|
| 86 |
</td> |
| 87 |
</tr> |
| 88 |
<?php // phpcs:ignore Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace ?> |
| 89 |
<tr <?php if ( 'wordpress-post-format' === \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ) { echo 'style="display: none"'; } ?>> |
| 90 |
<th scope="row"> |
| 91 |
<?php \esc_html_e( 'Post content', 'activitypub' ); ?> |
| 92 |
</th> |
| 93 |
<td> |
| 94 |
<p><strong><?php \esc_html_e( 'These settings only apply if you use the "Note" Object-Type setting above.', 'activitypub' ); ?></strong></p> |
| 95 |
<p> |
| 96 |
<label for="activitypub_post_content_type_title_link"> |
| 97 |
<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' ) ); ?> /> |
| 98 |
<?php \esc_html_e( 'Title and link', 'activitypub' ); ?> |
| 99 |
- |
| 100 |
<span class="description"> |
| 101 |
<?php \esc_html_e( 'Only the title and a link.', 'activitypub' ); ?> |
| 102 |
</span> |
| 103 |
</label> |
| 104 |
</p> |
| 105 |
<p> |
| 106 |
<label for="activitypub_post_content_type_excerpt"> |
| 107 |
<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' ) ); ?> /> |
| 108 |
<?php \esc_html_e( 'Excerpt', 'activitypub' ); ?> |
| 109 |
- |
| 110 |
<span class="description"> |
| 111 |
<?php \esc_html_e( 'A content summary without markup (truncated if no excerpt is provided).', 'activitypub' ); ?> |
| 112 |
</span> |
| 113 |
</label> |
| 114 |
</p> |
| 115 |
<p> |
| 116 |
<label for="activitypub_post_content_type_content"> |
| 117 |
<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' ) ); ?> /> |
| 118 |
<?php \esc_html_e( 'Content (default)', 'activitypub' ); ?> |
| 119 |
- |
| 120 |
<span class="description"> |
| 121 |
<?php \esc_html_e( 'The full content.', 'activitypub' ); ?> |
| 122 |
</span> |
| 123 |
</label> |
| 124 |
</p> |
| 125 |
<p> |
| 126 |
<label for="activitypub_post_content_type_custom"> |
| 127 |
<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' ) ); ?> /> |
| 128 |
<?php \esc_html_e( 'Custom', 'activitypub' ); ?> |
| 129 |
- |
| 130 |
<span class="description"> |
| 131 |
<?php \esc_html_e( 'Use the text area below, to customize your activities.', 'activitypub' ); ?> |
| 132 |
</span> |
| 133 |
</label> |
| 134 |
</p> |
| 135 |
<p> |
| 136 |
<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 esc_textarea( wp_kses( \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ), 'post' ) ); ?></textarea> |
| 137 |
<details> |
| 138 |
<summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary> |
| 139 |
<div class="description"> |
| 140 |
<ul> |
| 141 |
<li><code>[ap_title]</code> - <?php \esc_html_e( 'The post\'s title.', 'activitypub' ); ?></li> |
| 142 |
<li><code>[ap_content]</code> - <?php \esc_html_e( 'The post\'s content.', 'activitypub' ); ?></li> |
| 143 |
<li><code>[ap_excerpt]</code> - <?php \esc_html_e( 'The post\'s excerpt (may be truncated).', 'activitypub' ); ?></li> |
| 144 |
<li><code>[ap_permalink]</code> - <?php \esc_html_e( 'The post\'s permalink.', 'activitypub' ); ?></li> |
| 145 |
<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> |
| 146 |
<li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post\'s tags as hashtags.', 'activitypub' ); ?></li> |
| 147 |
</ul> |
| 148 |
<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> |
| 149 |
</div> |
| 150 |
</details> |
| 151 |
</p> |
| 152 |
</td> |
| 153 |
</tr> |
| 154 |
<tr> |
| 155 |
<th scope="row"> |
| 156 |
<?php \esc_html_e( 'Media attachments', 'activitypub' ); ?> |
| 157 |
</th> |
| 158 |
<td> |
| 159 |
<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" /> |
| 160 |
<p class="description"> |
| 161 |
<?php |
| 162 |
echo \wp_kses( |
| 163 |
\sprintf( |
| 164 |
// translators: |
| 165 |
\__( 'The number of media (images, audio, video) to attach to posts. Default: <code>%s</code>', 'activitypub' ), |
| 166 |
\esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) |
| 167 |
), |
| 168 |
'default' |
| 169 |
); |
| 170 |
?> |
| 171 |
</p> |
| 172 |
<p class="description"> |
| 173 |
<em> |
| 174 |
<?php |
| 175 |
esc_html_e( 'Note: audio and video attachments are only supported from Block Editor.', 'activitypub' ); |
| 176 |
?> |
| 177 |
</em> |
| 178 |
</p> |
| 179 |
</td> |
| 180 |
</tr> |
| 181 |
<tr> |
| 182 |
<th scope="row"><?php \esc_html_e( 'Supported post types', 'activitypub' ); ?></th> |
| 183 |
<td> |
| 184 |
<fieldset> |
| 185 |
<?php \esc_html_e( 'Automatically publish items of the selected post types to the fediverse:', 'activitypub' ); ?> |
| 186 |
|
| 187 |
<?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?> |
| 188 |
<?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post' ) ) : array(); ?> |
| 189 |
<ul> |
| 190 |
<?php // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> |
| 191 |
<?php foreach ( $post_types as $post_type ) { ?> |
| 192 |
<li> |
| 193 |
<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 ) ); ?> /> |
| 194 |
<label for="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>"><?php echo \esc_html( $post_type->label ); ?></label> |
| 195 |
<span class="description"> |
| 196 |
<?php echo \esc_html( \Activitypub\get_post_type_description( $post_type ) ); ?> |
| 197 |
</span> |
| 198 |
</li> |
| 199 |
<?php } ?> |
| 200 |
</ul> |
| 201 |
</fieldset> |
| 202 |
</td> |
| 203 |
</tr> |
| 204 |
<tr> |
| 205 |
<th scope="row"> |
| 206 |
<?php \esc_html_e( 'Hashtags', 'activitypub' ); ?> |
| 207 |
</th> |
| 208 |
<td> |
| 209 |
<p> |
| 210 |
<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.', 'activitypub' ), 'default' ); ?></label> |
| 211 |
</p> |
| 212 |
</td> |
| 213 |
</tr> |
| 214 |
</tbody> |
| 215 |
</table> |
| 216 |
|
| 217 |
<?php \do_settings_fields( 'activitypub', 'activity' ); ?> |
| 218 |
</div> |
| 219 |
|
| 220 |
<div class="box"> |
| 221 |
<h3><?php \esc_html_e( 'General', 'activitypub' ); ?></h3> |
| 222 |
<table class="form-table"> |
| 223 |
<tbody> |
| 224 |
<tr> |
| 225 |
<th scope="row"> |
| 226 |
<?php \esc_html_e( 'OpenGraph', 'activitypub' ); ?> |
| 227 |
</th> |
| 228 |
<td> |
| 229 |
<p> |
| 230 |
<label><input type="checkbox" name="activitypub_use_opengraph" id="activitypub_use_opengraph" value="1" <?php echo \checked( '1', \get_option( 'activitypub_use_opengraph', '1' ) ); ?> /> <?php echo wp_kses( \__( 'Automatically add <code><meta name="fediverse:creator" /></code> tags for Authors and the Blog-User. You can read more about the feature on the <a href="https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/" target="_blank">Mastodon Blog</a>.', 'activitypub' ), 'post' ); ?></label> |
| 231 |
</p> |
| 232 |
</td> |
| 233 |
</tr> |
| 234 |
<tr> |
| 235 |
<th scope="row"> |
| 236 |
<?php \esc_html_e( 'Blocklist', 'activitypub' ); ?> |
| 237 |
</th> |
| 238 |
<td> |
| 239 |
<p> |
| 240 |
<?php |
| 241 |
echo \wp_kses( |
| 242 |
\sprintf( |
| 243 |
// translators: %s is a URL. |
| 244 |
\__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ), |
| 245 |
\esc_attr( \admin_url( 'options-discussion.php#disallowed_keys' ) ) |
| 246 |
), |
| 247 |
'default' |
| 248 |
); |
| 249 |
?> |
| 250 |
</p> |
| 251 |
</td> |
| 252 |
</tr> |
| 253 |
</tbody> |
| 254 |
</table> |
| 255 |
<?php \do_settings_fields( 'activitypub', 'general' ); ?> |
| 256 |
<?php \do_settings_fields( 'activitypub', 'server' ); ?> |
| 257 |
</div> |
| 258 |
<?php \do_settings_sections( 'activitypub' ); ?> |
| 259 |
|
| 260 |
<?php \submit_button(); ?> |
| 261 |
</form> |
| 262 |
</div> |
| 263 |
|