| @@ -1,265 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | -\load_template( | |
| 3 | - __DIR__ . '/admin-header.php', | |
| 4 | - true, | |
| 5 | - array( | |
| 6 | - 'settings' => 'active', | |
| 7 | - 'welcome' => '', | |
| 8 | - 'followers' => '', | |
| 9 | - ) | |
| 10 | -); | |
| 2 | +/** | |
| 3 | + * ActivityPub settings template. | |
| 4 | + * | |
| 5 | + * @package Activitypub | |
| 6 | + */ | |
| 7 | + | |
| 11 | 8 | ?> |
| 12 | 9 | |
| 10 | +<hr class="wp-header-end"> | |
| 11 | + | |
| 13 | 12 | <div class="activitypub-settings activitypub-settings-page hide-if-no-js"> |
| 14 | 13 | <form method="post" action="options.php"> |
| 15 | 14 | <?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( 'Number of images', '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 images to attach to posts. Default: <code>%s</code>', 'activitypub' ), | |
| 151 | - \esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) | |
| 152 | - ), | |
| 153 | - 'default' | |
| 154 | - ); | |
| 155 | - ?> | |
| 156 | - </p> | |
| 157 | - </td> | |
| 158 | - </tr> | |
| 159 | - <tr> | |
| 160 | - <th scope="row"> | |
| 161 | - <?php \esc_html_e( 'Activity-Object-Type', 'activitypub' ); ?> | |
| 162 | - </th> | |
| 163 | - <td> | |
| 164 | - <p> | |
| 165 | - <label for="activitypub_object_type_note"> | |
| 166 | - <input type="radio" name="activitypub_object_type" id="activitypub_object_type_note" value="note" <?php echo \checked( 'note', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> | |
| 167 | - <?php \esc_html_e( 'Note (default)', 'activitypub' ); ?> | |
| 168 | - - | |
| 169 | - <span class="description"> | |
| 170 | - <?php \esc_html_e( 'Should work with most platforms.', 'activitypub' ); ?> | |
| 171 | - </span> | |
| 172 | - </label> | |
| 173 | - </p> | |
| 174 | - <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> | |
| 175 | - <p> | |
| 176 | - <label for="activitypub_object_type_article"> | |
| 177 | - <input type="radio" name="activitypub_object_type" id="activitypub_object_type_article" value="article" <?php echo \checked( 'article', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> | |
| 178 | - <?php \esc_html_e( 'Article', 'activitypub' ); ?> | |
| 179 | - - | |
| 180 | - <span class="description"> | |
| 181 | - <?php \esc_html_e( 'The presentation of the "Article" might change on different platforms.', 'activitypub' ); ?> | |
| 182 | - </span> | |
| 183 | - </label> | |
| 184 | - </p> | |
| 185 | - <p> | |
| 186 | - <label> | |
| 187 | - <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' ) ); ?> /> | |
| 188 | - <?php \esc_html_e( 'WordPress Post-Format', 'activitypub' ); ?> | |
| 189 | - - | |
| 190 | - <span class="description"> | |
| 191 | - <?php \esc_html_e( 'Maps the WordPress Post-Format to the ActivityPub Object Type.', 'activitypub' ); ?> | |
| 192 | - </span> | |
| 193 | - </label> | |
| 194 | - </p> | |
| 195 | - </td> | |
| 196 | - </tr> | |
| 197 | - <tr> | |
| 198 | - <th scope="row"><?php \esc_html_e( 'Supported post types', 'activitypub' ); ?></th> | |
| 199 | - <td> | |
| 200 | - <fieldset> | |
| 201 | - <?php \esc_html_e( 'Enable ActivityPub support for the following post types:', 'activitypub' ); ?> | |
| 202 | - | |
| 203 | - <?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?> | |
| 204 | - <?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array(); ?> | |
| 205 | - <ul> | |
| 206 | - <?php // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> | |
| 207 | - <?php foreach ( $post_types as $post_type ) { ?> | |
| 208 | - <li> | |
| 209 | - <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 ) ); ?> /> | |
| 210 | - <label for="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>"><?php echo \esc_html( $post_type->label ); ?></label> | |
| 211 | - </li> | |
| 212 | - <?php } ?> | |
| 213 | - </ul> | |
| 214 | - </fieldset> | |
| 215 | - </td> | |
| 216 | - </tr> | |
| 217 | - <tr> | |
| 218 | - <th scope="row"> | |
| 219 | - <?php \esc_html_e( 'Hashtags (beta)', 'activitypub' ); ?> | |
| 220 | - </th> | |
| 221 | - <td> | |
| 222 | - <p> | |
| 223 | - <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> | |
| 224 | - </p> | |
| 225 | - </td> | |
| 226 | - </tr> | |
| 227 | - </tbody> | |
| 228 | - </table> | |
| 229 | - | |
| 230 | - <?php \do_settings_fields( 'activitypub', 'activity' ); ?> | |
| 231 | - </div> | |
| 232 | - | |
| 233 | - <div class="box"> | |
| 234 | - <h3><?php \esc_html_e( 'Server', 'activitypub' ); ?></h3> | |
| 235 | - <table class="form-table"> | |
| 236 | - <tbody> | |
| 237 | - <tr> | |
| 238 | - <th scope="row"> | |
| 239 | - <?php \esc_html_e( 'Blocklist', 'activitypub' ); ?> | |
| 240 | - </th> | |
| 241 | - <td> | |
| 242 | - <p class="description"> | |
| 243 | - <?php | |
| 244 | - echo \wp_kses( | |
| 245 | - \sprintf( | |
| 246 | - // translators: %s is a URL. | |
| 247 | - \__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ), | |
| 248 | - \esc_attr( \admin_url( 'options-discussion.php#disallowed_keys' ) ) | |
| 249 | - ), | |
| 250 | - 'default' | |
| 251 | - ); | |
| 252 | - ?> | |
| 253 | - </p> | |
| 254 | - </td> | |
| 255 | - </tr> | |
| 256 | - </tbody> | |
| 257 | - </table> | |
| 258 | - | |
| 259 | - <?php \do_settings_fields( 'activitypub', 'server' ); ?> | |
| 260 | - </div> | |
| 261 | - <?php \do_settings_sections( 'activitypub' ); ?> | |
| 262 | - | |
| 15 | + <?php \do_settings_sections( 'activitypub_settings' ); ?> | |
| 263 | 16 | <?php \submit_button(); ?> |
| 264 | 17 | </form> |
| 265 | 18 | </div> |