| @@ -1,18 +1,260 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * ActivityPub settings template. | |
| 4 | - * | |
| 5 | - * @package Activitypub | |
| 6 | - */ | |
| 7 | - | |
| 2 | +\load_template( | |
| 3 | + __DIR__ . '/admin-header.php', | |
| 4 | + true, | |
| 5 | + array( | |
| 6 | + 'settings' => 'active', | |
| 7 | + 'welcome' => '', | |
| 8 | + 'followers' => '', | |
| 9 | + ) | |
| 10 | +); | |
| 8 | 11 | ?> |
| 9 | 12 | |
| 10 | -<hr class="wp-header-end"> | |
| 11 | - | |
| 12 | 13 | <div class="activitypub-settings activitypub-settings-page hide-if-no-js"> |
| 13 | 14 | <form method="post" action="options.php"> |
| 14 | 15 | <?php \settings_fields( 'activitypub' ); ?> |
| 15 | - <?php \do_settings_sections( 'activitypub_settings' ); ?> | |
| 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 | + </td> | |
| 59 | + </tr> | |
| 60 | + </tbody> | |
| 61 | + </table> | |
| 62 | + | |
| 63 | + <?php \do_settings_fields( 'activitypub', 'user' ); ?> | |
| 64 | + </div> | |
| 65 | + | |
| 66 | + <div class="box"> | |
| 67 | + <h3><?php \esc_html_e( 'Activities', 'activitypub' ); ?></h3> | |
| 68 | + <table class="form-table"> | |
| 69 | + <tbody> | |
| 70 | + <tr> | |
| 71 | + <th scope="row"> | |
| 72 | + <?php \esc_html_e( 'Post content', 'activitypub' ); ?> | |
| 73 | + </th> | |
| 74 | + <td> | |
| 75 | + <p> | |
| 76 | + <label for="activitypub_post_content_type_title_link"> | |
| 77 | + <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' ) ); ?> /> | |
| 78 | + <?php \esc_html_e( 'Title and link', 'activitypub' ); ?> | |
| 79 | + - | |
| 80 | + <span class="description"> | |
| 81 | + <?php \esc_html_e( 'Only the title and a link.', 'activitypub' ); ?> | |
| 82 | + </span> | |
| 83 | + </label> | |
| 84 | + </p> | |
| 85 | + <p> | |
| 86 | + <label for="activitypub_post_content_type_excerpt"> | |
| 87 | + <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' ) ); ?> /> | |
| 88 | + <?php \esc_html_e( 'Excerpt', 'activitypub' ); ?> | |
| 89 | + - | |
| 90 | + <span class="description"> | |
| 91 | + <?php \esc_html_e( 'A content summary, shortened to 400 characters and without markup.', 'activitypub' ); ?> | |
| 92 | + </span> | |
| 93 | + </label> | |
| 94 | + </p> | |
| 95 | + <p> | |
| 96 | + <label for="activitypub_post_content_type_content"> | |
| 97 | + <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' ) ); ?> /> | |
| 98 | + <?php \esc_html_e( 'Content (default)', 'activitypub' ); ?> | |
| 99 | + - | |
| 100 | + <span class="description"> | |
| 101 | + <?php \esc_html_e( 'The full content.', 'activitypub' ); ?> | |
| 102 | + </span> | |
| 103 | + </label> | |
| 104 | + </p> | |
| 105 | + <p> | |
| 106 | + <label for="activitypub_post_content_type_custom"> | |
| 107 | + <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' ) ); ?> /> | |
| 108 | + <?php \esc_html_e( 'Custom', 'activitypub' ); ?> | |
| 109 | + - | |
| 110 | + <span class="description"> | |
| 111 | + <?php \esc_html_e( 'Use the text area below, to customize your activities.', 'activitypub' ); ?> | |
| 112 | + </span> | |
| 113 | + </label> | |
| 114 | + </p> | |
| 115 | + <p> | |
| 116 | + <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> | |
| 117 | + <details> | |
| 118 | + <summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary> | |
| 119 | + <div class="description"> | |
| 120 | + <ul> | |
| 121 | + <li><code>[ap_title]</code> - <?php \esc_html_e( 'The post\'s title.', 'activitypub' ); ?></li> | |
| 122 | + <li><code>[ap_content]</code> - <?php \esc_html_e( 'The post\'s content.', 'activitypub' ); ?></li> | |
| 123 | + <li><code>[ap_excerpt]</code> - <?php \esc_html_e( 'The post\'s excerpt (default 400 chars).', 'activitypub' ); ?></li> | |
| 124 | + <li><code>[ap_permalink]</code> - <?php \esc_html_e( 'The post\'s permalink.', 'activitypub' ); ?></li> | |
| 125 | + <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> | |
| 126 | + <li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post\'s tags as hashtags.', 'activitypub' ); ?></li> | |
| 127 | + </ul> | |
| 128 | + <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> | |
| 129 | + </div> | |
| 130 | + </details> | |
| 131 | + </p> | |
| 132 | + </td> | |
| 133 | + </tr> | |
| 134 | + <tr> | |
| 135 | + <th scope="row"> | |
| 136 | + <?php \esc_html_e( 'Number of images', 'activitypub' ); ?> | |
| 137 | + </th> | |
| 138 | + <td> | |
| 139 | + <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" /> | |
| 140 | + <p class="description"> | |
| 141 | + <?php | |
| 142 | + echo \wp_kses( | |
| 143 | + \sprintf( | |
| 144 | + // translators: | |
| 145 | + \__( 'The number of images to attach to posts. Default: <code>%s</code>', 'activitypub' ), | |
| 146 | + \esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) | |
| 147 | + ), | |
| 148 | + 'default' | |
| 149 | + ); | |
| 150 | + ?> | |
| 151 | + </p> | |
| 152 | + </td> | |
| 153 | + </tr> | |
| 154 | + <tr> | |
| 155 | + <th scope="row"> | |
| 156 | + <?php \esc_html_e( 'Activity-Object-Type', 'activitypub' ); ?> | |
| 157 | + </th> | |
| 158 | + <td> | |
| 159 | + <p> | |
| 160 | + <label for="activitypub_object_type_note"> | |
| 161 | + <input type="radio" name="activitypub_object_type" id="activitypub_object_type_note" value="note" <?php echo \checked( 'note', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> | |
| 162 | + <?php \esc_html_e( 'Note (default)', 'activitypub' ); ?> | |
| 163 | + - | |
| 164 | + <span class="description"> | |
| 165 | + <?php \esc_html_e( 'Should work with most platforms.', 'activitypub' ); ?> | |
| 166 | + </span> | |
| 167 | + </label> | |
| 168 | + </p> | |
| 169 | + <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> | |
| 170 | + <p> | |
| 171 | + <label for="activitypub_object_type_article"> | |
| 172 | + <input type="radio" name="activitypub_object_type" id="activitypub_object_type_article" value="article" <?php echo \checked( 'article', \get_option( 'activitypub_object_type', 'note' ) ); ?> /> | |
| 173 | + <?php \esc_html_e( 'Article', 'activitypub' ); ?> | |
| 174 | + - | |
| 175 | + <span class="description"> | |
| 176 | + <?php \esc_html_e( 'The presentation of the "Article" might change on different platforms.', 'activitypub' ); ?> | |
| 177 | + </span> | |
| 178 | + </label> | |
| 179 | + </p> | |
| 180 | + <p> | |
| 181 | + <label> | |
| 182 | + <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' ) ); ?> /> | |
| 183 | + <?php \esc_html_e( 'WordPress Post-Format', 'activitypub' ); ?> | |
| 184 | + - | |
| 185 | + <span class="description"> | |
| 186 | + <?php \esc_html_e( 'Maps the WordPress Post-Format to the ActivityPub Object Type.', 'activitypub' ); ?> | |
| 187 | + </span> | |
| 188 | + </label> | |
| 189 | + </p> | |
| 190 | + </td> | |
| 191 | + </tr> | |
| 192 | + <tr> | |
| 193 | + <th scope="row"><?php \esc_html_e( 'Supported post types', 'activitypub' ); ?></th> | |
| 194 | + <td> | |
| 195 | + <fieldset> | |
| 196 | + <?php \esc_html_e( 'Enable ActivityPub support for the following post types:', 'activitypub' ); ?> | |
| 197 | + | |
| 198 | + <?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?> | |
| 199 | + <?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array(); ?> | |
| 200 | + <ul> | |
| 201 | + <?php // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> | |
| 202 | + <?php foreach ( $post_types as $post_type ) { ?> | |
| 203 | + <li> | |
| 204 | + <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 ) ); ?> /> | |
| 205 | + <label for="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>"><?php echo \esc_html( $post_type->label ); ?></label> | |
| 206 | + </li> | |
| 207 | + <?php } ?> | |
| 208 | + </ul> | |
| 209 | + </fieldset> | |
| 210 | + </td> | |
| 211 | + </tr> | |
| 212 | + <tr> | |
| 213 | + <th scope="row"> | |
| 214 | + <?php \esc_html_e( 'Hashtags (beta)', 'activitypub' ); ?> | |
| 215 | + </th> | |
| 216 | + <td> | |
| 217 | + <p> | |
| 218 | + <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> | |
| 219 | + </p> | |
| 220 | + </td> | |
| 221 | + </tr> | |
| 222 | + </tbody> | |
| 223 | + </table> | |
| 224 | + | |
| 225 | + <?php \do_settings_fields( 'activitypub', 'activity' ); ?> | |
| 226 | + </div> | |
| 227 | + | |
| 228 | + <div class="box"> | |
| 229 | + <h3><?php \esc_html_e( 'Server', 'activitypub' ); ?></h3> | |
| 230 | + <table class="form-table"> | |
| 231 | + <tbody> | |
| 232 | + <tr> | |
| 233 | + <th scope="row"> | |
| 234 | + <?php \esc_html_e( 'Blocklist', 'activitypub' ); ?> | |
| 235 | + </th> | |
| 236 | + <td> | |
| 237 | + <p class="description"> | |
| 238 | + <?php | |
| 239 | + echo \wp_kses( | |
| 240 | + \sprintf( | |
| 241 | + // translators: %s is a URL. | |
| 242 | + \__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ), | |
| 243 | + \esc_attr( \admin_url( 'options-discussion.php#disallowed_keys' ) ) | |
| 244 | + ), | |
| 245 | + 'default' | |
| 246 | + ); | |
| 247 | + ?> | |
| 248 | + </p> | |
| 249 | + </td> | |
| 250 | + </tr> | |
| 251 | + </tbody> | |
| 252 | + </table> | |
| 253 | + | |
| 254 | + <?php \do_settings_fields( 'activitypub', 'server' ); ?> | |
| 255 | + </div> | |
| 256 | + <?php \do_settings_sections( 'activitypub' ); ?> | |
| 257 | + | |
| 16 | 258 | <?php \submit_button(); ?> |
| 17 | 259 | </form> |
| 18 | 260 | </div> |