| @@ -6,13 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Activitypub\WP_Admin; |
| 9 | 9 | |
| 10 | -use Activitypub\Blocklist_Subscriptions; | |
| 11 | -use Activitypub\Moderation; | |
| 12 | - | |
| 13 | -use function Activitypub\home_host; | |
| 14 | - | |
| 15 | 10 | /** |
| 16 | 11 | * Class Settings_Fields. |
| 17 | 12 | */ |
| 18 | 13 | class Settings_Fields { |
| @@ -42,8 +37,15 @@ | ||
| 42 | 37 | 'activitypub_settings' |
| 43 | 38 | ); |
| 44 | 39 | |
| 45 | 40 | add_settings_section( |
| 41 | + 'activitypub_notifications', | |
| 42 | + __( 'Notifications', 'activitypub' ), | |
| 43 | + array( self::class, 'render_notifications_section' ), | |
| 44 | + 'activitypub_settings' | |
| 45 | + ); | |
| 46 | + | |
| 47 | + add_settings_section( | |
| 46 | 48 | 'activitypub_general', |
| 47 | 49 | __( 'General', 'activitypub' ), |
| 48 | 50 | '__return_empty_string', |
| 49 | 51 | 'activitypub_settings' |
| @@ -55,19 +57,8 @@ | ||
| 55 | 57 | '__return_empty_string', |
| 56 | 58 | 'activitypub_settings' |
| 57 | 59 | ); |
| 58 | 60 | |
| 59 | - add_settings_section( | |
| 60 | - 'activitypub_moderation', | |
| 61 | - \esc_html__( 'Moderation', 'activitypub' ), | |
| 62 | - array( self::class, 'render_moderation_section_description' ), | |
| 63 | - 'activitypub_settings', | |
| 64 | - array( | |
| 65 | - 'before_section' => '<div id="moderation">', | |
| 66 | - 'after_section' => '</div>', | |
| 67 | - ) | |
| 68 | - ); | |
| 69 | - | |
| 70 | 61 | // Add settings fields. |
| 71 | 62 | add_settings_field( |
| 72 | 63 | 'activitypub_actor_mode', |
| 73 | 64 | __( 'Enable profiles by type', 'activitypub' ), |
| @@ -75,8 +66,16 @@ | ||
| 75 | 66 | 'activitypub_settings', |
| 76 | 67 | 'activitypub_profiles' |
| 77 | 68 | ); |
| 78 | 69 | |
| 70 | + add_settings_field( | |
| 71 | + 'activitypub_object_type', | |
| 72 | + __( 'Activity-Object-Type', 'activitypub' ), | |
| 73 | + array( self::class, 'render_object_type_field' ), | |
| 74 | + 'activitypub_settings', | |
| 75 | + 'activitypub_activities' | |
| 76 | + ); | |
| 77 | + | |
| 79 | 78 | $object_type = \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ); |
| 80 | 79 | if ( 'note' === $object_type ) { |
| 81 | 80 | add_settings_field( |
| 82 | 81 | 'activitypub_custom_post_content', |
| @@ -113,17 +112,8 @@ | ||
| 113 | 112 | 'activitypub_activities' |
| 114 | 113 | ); |
| 115 | 114 | |
| 116 | 115 | add_settings_field( |
| 117 | - 'activitypub_default_quote_policy', | |
| 118 | - __( 'Default quote policy', 'activitypub' ), | |
| 119 | - array( self::class, 'render_default_quote_policy_field' ), | |
| 120 | - 'activitypub_settings', | |
| 121 | - 'activitypub_activities', | |
| 122 | - array( 'label_for' => 'activitypub_default_quote_policy' ) | |
| 123 | - ); | |
| 124 | - | |
| 125 | - add_settings_field( | |
| 126 | 116 | 'activitypub_use_hashtags', |
| 127 | 117 | __( 'Hashtags', 'activitypub' ), |
| 128 | 118 | array( self::class, 'render_use_hashtags_field' ), |
| 129 | 119 | 'activitypub_settings', |
| @@ -149,8 +139,16 @@ | ||
| 149 | 139 | array( 'label_for' => 'activitypub_attribution_domains' ) |
| 150 | 140 | ); |
| 151 | 141 | |
| 152 | 142 | add_settings_field( |
| 143 | + 'activitypub_blocklist', | |
| 144 | + __( 'Blocklist', 'activitypub' ), | |
| 145 | + array( self::class, 'render_blocklist_field' ), | |
| 146 | + 'activitypub_settings', | |
| 147 | + 'activitypub_server' | |
| 148 | + ); | |
| 149 | + | |
| 150 | + add_settings_field( | |
| 153 | 151 | 'activitypub_relays', |
| 154 | 152 | __( 'Relays', 'activitypub' ), |
| 155 | 153 | array( self::class, 'render_relays_field' ), |
| 156 | 154 | 'activitypub_settings', |
| @@ -156,32 +154,51 @@ | ||
| 156 | 154 | 'activitypub_settings', |
| 157 | 155 | 'activitypub_server', |
| 158 | 156 | array( 'label_for' => 'activitypub_relays' ) |
| 159 | 157 | ); |
| 158 | + } | |
| 160 | 159 | |
| 161 | - add_settings_field( | |
| 162 | - 'activitypub_site_blocked_domains', | |
| 163 | - \esc_html__( 'Blocked Domains', 'activitypub' ), | |
| 164 | - array( self::class, 'render_site_blocked_domains_field' ), | |
| 165 | - 'activitypub_settings', | |
| 166 | - 'activitypub_moderation' | |
| 167 | - ); | |
| 168 | - | |
| 169 | - add_settings_field( | |
| 170 | - 'activitypub_site_blocked_keywords', | |
| 171 | - \esc_html__( 'Blocked Keywords', 'activitypub' ), | |
| 172 | - array( self::class, 'render_site_blocked_keywords_field' ), | |
| 173 | - 'activitypub_settings', | |
| 174 | - 'activitypub_moderation' | |
| 175 | - ); | |
| 176 | - | |
| 177 | - add_settings_field( | |
| 178 | - 'activitypub_blocklist_subscriptions', | |
| 179 | - \esc_html__( 'Blocklist Subscriptions', 'activitypub' ), | |
| 180 | - array( self::class, 'render_blocklist_subscriptions_field' ), | |
| 181 | - 'activitypub_settings', | |
| 182 | - 'activitypub_moderation' | |
| 183 | - ); | |
| 160 | + /** | |
| 161 | + * Render notifications section. | |
| 162 | + */ | |
| 163 | + public static function render_notifications_section() { | |
| 164 | + ?> | |
| 165 | + <p> | |
| 166 | + <?php \esc_html_e( 'Choose which notifications you want to receive. The plugin currently only supports e-mail notifications, but we will add more options in the future.', 'activitypub' ); ?> | |
| 167 | + </p> | |
| 168 | + <table class="form-table"> | |
| 169 | + <tbody> | |
| 170 | + <tr> | |
| 171 | + <th scope="col"> | |
| 172 | + <?php \esc_html_e( 'Type', 'activitypub' ); ?> | |
| 173 | + </th> | |
| 174 | + <th scope="col"> | |
| 175 | + <?php \esc_html_e( 'E-Mail', 'activitypub' ); ?> | |
| 176 | + </th> | |
| 177 | + </tr> | |
| 178 | + <tr> | |
| 179 | + <td> | |
| 180 | + <?php \esc_html_e( 'New followers', 'activitypub' ); ?> | |
| 181 | + </td> | |
| 182 | + <td> | |
| 183 | + <label> | |
| 184 | + <input type="checkbox" name="activitypub_mailer_new_follower" id="activitypub_mailer_new_follower" value="1" <?php \checked( '1', \get_option( 'activitypub_mailer_new_follower', '0' ) ); ?> /> | |
| 185 | + </label> | |
| 186 | + </td> | |
| 187 | + </tr> | |
| 188 | + <tr> | |
| 189 | + <td> | |
| 190 | + <?php \esc_html_e( 'Direct Messages', 'activitypub' ); ?> | |
| 191 | + </td> | |
| 192 | + <td> | |
| 193 | + <label> | |
| 194 | + <input type="checkbox" name="activitypub_mailer_new_dm" id="activitypub_mailer_new_dm" value="1" <?php \checked( '1', \get_option( 'activitypub_mailer_new_dm', '0' ) ); ?> /> | |
| 195 | + </label> | |
| 196 | + </td> | |
| 197 | + </tr> | |
| 198 | + </tbody> | |
| 199 | + </table> | |
| 200 | + <?php | |
| 184 | 201 | } |
| 185 | 202 | |
| 186 | 203 | /** |
| 187 | 204 | * Render actor mode field. |
| @@ -247,34 +264,43 @@ | ||
| 247 | 264 | <?php |
| 248 | 265 | } |
| 249 | 266 | |
| 250 | 267 | /** |
| 251 | - * Render custom post content field. | |
| 268 | + * Render object type field. | |
| 252 | 269 | */ |
| 253 | - public static function render_custom_post_content_field() { | |
| 254 | - $switch_url = \wp_nonce_url( | |
| 255 | - \add_query_arg( | |
| 256 | - array( | |
| 257 | - 'page' => 'activitypub', | |
| 258 | - 'tab' => 'settings', | |
| 259 | - 'activitypub_update_object_type' => '1', | |
| 260 | - ), | |
| 261 | - \admin_url( 'options-general.php' ) | |
| 262 | - ), | |
| 263 | - 'activitypub_switch_object_type' | |
| 264 | - ); | |
| 270 | + public static function render_object_type_field() { | |
| 271 | + $value = get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ); | |
| 265 | 272 | ?> |
| 266 | - <p class="description"> | |
| 267 | - <?php \esc_html_e( 'âš You are using the legacy template system to format your posts for the fediverse. We recommend switching to automatic mode, which intelligently chooses the best format for each post. Switching will remove this template field from the settings.', 'activitypub' ); ?> | |
| 273 | + <p> | |
| 274 | + <label> | |
| 275 | + <input type="radio" name="activitypub_object_type" value="wordpress-post-format" <?php checked( 'wordpress-post-format', $value ); ?> /> | |
| 276 | + <?php esc_html_e( 'Automatic (default)', 'activitypub' ); ?> | |
| 277 | + - | |
| 278 | + <span class="description"> | |
| 279 | + <?php esc_html_e( 'Let the plugin choose the best possible format for you.', 'activitypub' ); ?> | |
| 280 | + </span> | |
| 281 | + </label> | |
| 268 | 282 | </p> |
| 269 | 283 | <p> |
| 270 | - <a href="<?php echo \esc_url( $switch_url ); ?>" class="button"> | |
| 271 | - <?php \esc_html_e( 'Switch to Automatic Mode', 'activitypub' ); ?> | |
| 272 | - </a> | |
| 284 | + <label> | |
| 285 | + <input type="radio" name="activitypub_object_type" value="note" <?php checked( 'note', $value ); ?> /> | |
| 286 | + <?php esc_html_e( 'Note', 'activitypub' ); ?> | |
| 287 | + - | |
| 288 | + <span class="description"> | |
| 289 | + <?php esc_html_e( 'Should work with most platforms.', 'activitypub' ); ?> | |
| 290 | + </span> | |
| 291 | + </label> | |
| 273 | 292 | </p> |
| 274 | 293 | <?php |
| 294 | + } | |
| 295 | + | |
| 296 | + /** | |
| 297 | + * Render custom post content field. | |
| 298 | + */ | |
| 299 | + public static function render_custom_post_content_field() { | |
| 275 | 300 | $value = get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); |
| 276 | 301 | ?> |
| 302 | + <p><strong><?php esc_html_e( 'These settings only apply if you use the "Note" Object-Type setting above.', 'activitypub' ); ?></strong></p> | |
| 277 | 303 | <p> |
| 278 | 304 | <textarea id="activitypub_custom_post_content" name="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo esc_attr( ACTIVITYPUB_CUSTOM_POST_CONTENT ); ?>"><?php echo esc_textarea( wp_kses( $value, 'post' ) ); ?></textarea> |
| 279 | 305 | <details> |
| 280 | 306 | <summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary> |
| @@ -299,9 +325,9 @@ | ||
| 299 | 325 | */ |
| 300 | 326 | public static function render_max_image_attachments_field() { |
| 301 | 327 | $value = get_option( 'activitypub_max_image_attachments', ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ); |
| 302 | 328 | ?> |
| 303 | - <input id="activitypub_max_image_attachments" value="<?php echo esc_attr( $value ); ?>" name="activitypub_max_image_attachments" type="number" min="0" max="10" class="small-text" /> | |
| 329 | + <input id="activitypub_max_image_attachments" value="<?php echo esc_attr( $value ); ?>" name="activitypub_max_image_attachments" type="number" min="0" class="small-text" /> | |
| 304 | 330 | <p class="description"> |
| 305 | 331 | <?php |
| 306 | 332 | echo wp_kses( |
| 307 | 333 | sprintf( |
| @@ -324,10 +350,10 @@ | ||
| 324 | 350 | /** |
| 325 | 351 | * Render support post types field. |
| 326 | 352 | */ |
| 327 | 353 | public static function render_support_post_types_field() { |
| 328 | - $post_types = \get_post_types( array( 'public' => true ), 'objects' ); | |
| 329 | - $supported_post_types = \get_option( 'activitypub_support_post_types', array( 'post' ) ); | |
| 354 | + $post_types = get_post_types( array( 'public' => true ), 'objects' ); | |
| 355 | + $supported_post_types = (array) get_option( 'activitypub_support_post_types', array( 'post' ) ); | |
| 330 | 356 | ?> |
| 331 | 357 | <fieldset> |
| 332 | 358 | <?php esc_html_e( 'Automatically publish items of the selected post types to the fediverse:', 'activitypub' ); ?> |
| 333 | 359 | <ul> |
| @@ -355,9 +381,8 @@ | ||
| 355 | 381 | } |
| 356 | 382 | |
| 357 | 383 | $allow_likes = get_option( 'activitypub_allow_likes', '1' ); |
| 358 | 384 | $allow_reposts = get_option( 'activitypub_allow_reposts', '1' ); |
| 359 | - $auto_approve = get_option( 'activitypub_auto_approve_reactions', '0' ); | |
| 360 | 385 | ?> |
| 361 | 386 | <fieldset> |
| 362 | 387 | <p> |
| 363 | 388 | <label> |
| @@ -366,45 +391,22 @@ | ||
| 366 | 391 | </label> |
| 367 | 392 | </p> |
| 368 | 393 | <p> |
| 369 | 394 | <label> |
| 370 | - <input type="checkbox" name="activitypub_allow_reposts" value="1" <?php checked( '1', $allow_reposts ); ?> /> | |
| 395 | + <input type="checkbox" name="activitypub_allow_announces" value="1" <?php checked( '1', $allow_reposts ); ?> /> | |
| 371 | 396 | <?php esc_html_e( 'Receive reblogs (boosts)', 'activitypub' ); ?> |
| 372 | 397 | </label> |
| 373 | 398 | </p> |
| 374 | - <p class="interactions description"><?php esc_html_e( 'Types of interactions from the Fediverse your blog should accept.', 'activitypub' ); ?></p> | |
| 375 | - <p> | |
| 376 | - <label> | |
| 377 | - <input type="checkbox" name="activitypub_auto_approve_reactions" value="1" <?php checked( '1', $auto_approve ); ?> /> | |
| 378 | - <?php esc_html_e( 'Auto approve reactions', 'activitypub' ); ?> | |
| 379 | - </label> | |
| 380 | - </p> | |
| 399 | + <p class="description"><?php esc_html_e( 'Types of interactions from the Fediverse your blog should accept.', 'activitypub' ); ?></p> | |
| 381 | 400 | </fieldset> |
| 382 | 401 | <?php |
| 383 | 402 | } |
| 384 | 403 | |
| 385 | 404 | /** |
| 386 | - * Render default quote policy field. | |
| 387 | - */ | |
| 388 | - public static function render_default_quote_policy_field() { | |
| 389 | - $value = get_option( 'activitypub_default_quote_policy', ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); | |
| 390 | - ?> | |
| 391 | - <select id="activitypub_default_quote_policy" name="activitypub_default_quote_policy" class="regular-text"> | |
| 392 | - <option value="<?php echo esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>" <?php selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>><?php esc_html_e( 'Anyone', 'activitypub' ); ?></option> | |
| 393 | - <option value="<?php echo esc_attr( ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>" <?php selected( $value, ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>><?php esc_html_e( 'Followers only', 'activitypub' ); ?></option> | |
| 394 | - <option value="<?php echo esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>" <?php selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>><?php esc_html_e( 'Just me', 'activitypub' ); ?></option> | |
| 395 | - </select> | |
| 396 | - <p class="description"> | |
| 397 | - <?php esc_html_e( 'Default setting for who can quote new posts. This can be overridden per post.', 'activitypub' ); ?> | |
| 398 | - </p> | |
| 399 | - <?php | |
| 400 | - } | |
| 401 | - | |
| 402 | - /** | |
| 403 | 405 | * Render use hashtags field. |
| 404 | 406 | */ |
| 405 | 407 | public static function render_use_hashtags_field() { |
| 406 | - $value = get_option( 'activitypub_use_hashtags', '0' ); | |
| 408 | + $value = get_option( 'activitypub_use_hashtags', '1' ); | |
| 407 | 409 | ?> |
| 408 | 410 | <p> |
| 409 | 411 | <label> |
| 410 | 412 | <input type="checkbox" id="activitypub_use_hashtags" name="activitypub_use_hashtags" value="1" <?php checked( '1', $value ); ?> /> |
| @@ -432,9 +434,9 @@ | ||
| 432 | 434 | /** |
| 433 | 435 | * Render attribution domains field. |
| 434 | 436 | */ |
| 435 | 437 | public static function render_attribution_domains_field() { |
| 436 | - $value = get_option( 'activitypub_attribution_domains', home_host() ); | |
| 438 | + $value = get_option( 'activitypub_attribution_domains', \Activitypub\home_host() ); | |
| 437 | 439 | ?> |
| 438 | 440 | <textarea |
| 439 | 441 | id="activitypub_attribution_domains" |
| 440 | 442 | name="activitypub_attribution_domains" |
| @@ -439,9 +441,9 @@ | ||
| 439 | 441 | id="activitypub_attribution_domains" |
| 440 | 442 | name="activitypub_attribution_domains" |
| 441 | 443 | class="large-text" |
| 442 | 444 | cols="50" rows="5" |
| 443 | - placeholder="<?php echo esc_attr( home_host() ); ?>" | |
| 445 | + placeholder="<?php echo esc_attr( \Activitypub\home_host() ); ?>" | |
| 444 | 446 | ><?php echo esc_textarea( $value ); ?></textarea> |
| 445 | 447 | <p class="description"><?php esc_html_e( 'Websites allowed to credit you, one per line. Protects from false attributions.', 'activitypub' ); ?></p> |
| 446 | 448 | <?php |
| 447 | 449 | } |
| @@ -477,179 +479,23 @@ | ||
| 477 | 479 | <?php |
| 478 | 480 | } |
| 479 | 481 | |
| 480 | 482 | /** |
| 481 | - * Render moderation section description. | |
| 483 | + * Render blocklist field. | |
| 482 | 484 | */ |
| 483 | - public static function render_moderation_section_description() { | |
| 484 | - echo '<p>' . \esc_html__( 'Configure site-wide moderation settings. These blocks will affect all users and ActivityPub content on your site.', 'activitypub' ) . '</p>'; | |
| 485 | - } | |
| 486 | - | |
| 487 | - /** | |
| 488 | - * Render site blocked domains field. | |
| 489 | - */ | |
| 490 | - public static function render_site_blocked_domains_field() { | |
| 491 | - $blocked_domains = Moderation::get_site_blocks()['domains']; | |
| 492 | - $count = \count( $blocked_domains ); | |
| 485 | + public static function render_blocklist_field() { | |
| 493 | 486 | ?> |
| 494 | - <p class="description"><?php \esc_html_e( 'Block entire ActivityPub instances by domain name.', 'activitypub' ); ?></p> | |
| 495 | - | |
| 496 | - <div class="activitypub-site-block-list"> | |
| 497 | - <details class="activitypub-site-block-details" data-type="domain"<?php echo empty( $blocked_domains ) ? ' open' : ''; ?>> | |
| 498 | - <summary> | |
| 499 | - <?php if ( $count > 0 ) : ?> | |
| 500 | - <?php | |
| 501 | - echo \esc_html( | |
| 502 | - \sprintf( | |
| 503 | - /* translators: %s: Number of blocked domains */ | |
| 504 | - \_n( '%s blocked domain', '%s blocked domains', $count, 'activitypub' ), | |
| 505 | - \number_format_i18n( $count ) | |
| 506 | - ) | |
| 507 | - ); | |
| 508 | - ?> | |
| 509 | - <?php else : ?> | |
| 510 | - <?php \esc_html_e( 'No blocked domains', 'activitypub' ); ?> | |
| 511 | - <?php endif; ?> | |
| 512 | - </summary> | |
| 513 | - <?php if ( ! empty( $blocked_domains ) ) : ?> | |
| 514 | - <table class="widefat striped activitypub-site-blocked-domain" role="presentation"> | |
| 515 | - <tbody> | |
| 516 | - <?php foreach ( $blocked_domains as $domain ) : ?> | |
| 517 | - <tr> | |
| 518 | - <td><?php echo \esc_html( $domain ); ?></td> | |
| 519 | - <td> | |
| 520 | - <button type="button" class="button button-small remove-site-block-btn" data-type="domain" data-value="<?php echo \esc_attr( $domain ); ?>"> | |
| 521 | - <?php \esc_html_e( 'Remove', 'activitypub' ); ?> | |
| 522 | - </button> | |
| 523 | - </td> | |
| 524 | - </tr> | |
| 525 | - <?php endforeach; ?> | |
| 526 | - </tbody> | |
| 527 | - </table> | |
| 528 | - <?php endif; ?> | |
| 529 | - </details> | |
| 530 | - | |
| 531 | - <div class="add-site-block-form" style="display: flex; max-width: 500px; gap: 8px;"> | |
| 532 | - <input type="text" class="regular-text" id="new_site_domain" placeholder="<?php \esc_attr_e( 'example.com', 'activitypub' ); ?>" style="flex: 1; min-width: 0;" /> | |
| 533 | - <button type="button" class="button add-site-block-btn" data-type="domain" style="flex-shrink: 0; white-space: nowrap;"> | |
| 534 | - <?php \esc_html_e( 'Add Block', 'activitypub' ); ?> | |
| 535 | - </button> | |
| 536 | - </div> | |
| 537 | - </div> | |
| 538 | - <?php | |
| 539 | - } | |
| 540 | - | |
| 541 | - /** | |
| 542 | - * Render site blocked keywords field. | |
| 543 | - */ | |
| 544 | - public static function render_site_blocked_keywords_field() { | |
| 545 | - $blocked_keywords = Moderation::get_site_blocks()['keywords']; | |
| 546 | - $count = \count( $blocked_keywords ); | |
| 547 | - ?> | |
| 548 | - <p class="description"><?php \esc_html_e( 'Block ActivityPub content containing specific keywords.', 'activitypub' ); ?></p> | |
| 549 | - | |
| 550 | - <div class="activitypub-site-block-list"> | |
| 551 | - <details class="activitypub-site-block-details" data-type="keyword"<?php echo empty( $blocked_keywords ) ? ' open' : ''; ?>> | |
| 552 | - <summary> | |
| 553 | - <?php if ( $count > 0 ) : ?> | |
| 554 | - <?php | |
| 555 | - echo \esc_html( | |
| 556 | - \sprintf( | |
| 557 | - /* translators: %s: Number of blocked keywords */ | |
| 558 | - \_n( '%s blocked keyword', '%s blocked keywords', $count, 'activitypub' ), | |
| 559 | - \number_format_i18n( $count ) | |
| 560 | - ) | |
| 561 | - ); | |
| 562 | - ?> | |
| 563 | - <?php else : ?> | |
| 564 | - <?php \esc_html_e( 'No blocked keywords', 'activitypub' ); ?> | |
| 565 | - <?php endif; ?> | |
| 566 | - </summary> | |
| 567 | - <?php if ( ! empty( $blocked_keywords ) ) : ?> | |
| 568 | - <table class="widefat striped activitypub-site-blocked-keyword" role="presentation"> | |
| 569 | - <tbody> | |
| 570 | - <?php foreach ( $blocked_keywords as $keyword ) : ?> | |
| 571 | - <tr> | |
| 572 | - <td><?php echo \esc_html( $keyword ); ?></td> | |
| 573 | - <td> | |
| 574 | - <button type="button" class="button button-small remove-site-block-btn" data-type="keyword" data-value="<?php echo \esc_attr( $keyword ); ?>"> | |
| 575 | - <?php \esc_html_e( 'Remove', 'activitypub' ); ?> | |
| 576 | - </button> | |
| 577 | - </td> | |
| 578 | - </tr> | |
| 579 | - <?php endforeach; ?> | |
| 580 | - </tbody> | |
| 581 | - </table> | |
| 582 | - <?php endif; ?> | |
| 583 | - </details> | |
| 584 | - | |
| 585 | - <div class="add-site-block-form" style="display: flex; max-width: 500px; gap: 8px;"> | |
| 586 | - <input type="text" class="regular-text" id="new_site_keyword" placeholder="<?php \esc_attr_e( 'spam keyword', 'activitypub' ); ?>" style="flex: 1; min-width: 0;" /> | |
| 587 | - <button type="button" class="button add-site-block-btn" data-type="keyword" style="flex-shrink: 0; white-space: nowrap;"> | |
| 588 | - <?php \esc_html_e( 'Add Block', 'activitypub' ); ?> | |
| 589 | - </button> | |
| 590 | - </div> | |
| 591 | - </div> | |
| 592 | - <?php | |
| 593 | - } | |
| 594 | - | |
| 595 | - /** | |
| 596 | - * Render blocklist subscriptions field. | |
| 597 | - */ | |
| 598 | - public static function render_blocklist_subscriptions_field() { | |
| 599 | - $subscriptions = Blocklist_Subscriptions::get_all(); | |
| 600 | - ?> | |
| 601 | - <p class="description"><?php \esc_html_e( 'Subscribe to remote blocklists that sync automatically every week.', 'activitypub' ); ?></p> | |
| 602 | - | |
| 603 | - <div class="activitypub-blocklist-subscriptions"> | |
| 604 | - <?php if ( ! empty( $subscriptions ) ) : ?> | |
| 605 | - <table class="widefat striped" role="presentation" style="max-width: 500px; margin: 15px 0;"> | |
| 606 | - <thead> | |
| 607 | - <tr> | |
| 608 | - <th style="padding: 10px;"><?php \esc_html_e( 'URL', 'activitypub' ); ?></th> | |
| 609 | - <th style="padding: 10px;"><?php \esc_html_e( 'Last Synced', 'activitypub' ); ?></th> | |
| 610 | - <th style="width: 80px;"></th> | |
| 611 | - </tr> | |
| 612 | - </thead> | |
| 613 | - <tbody> | |
| 614 | - <?php foreach ( $subscriptions as $url => $timestamp ) : ?> | |
| 615 | - <tr> | |
| 616 | - <td> | |
| 617 | - <abbr title="<?php echo \esc_attr( $url ); ?>"><?php echo \esc_html( \wp_parse_url( $url, PHP_URL_HOST ) ); ?></abbr> | |
| 618 | - </td> | |
| 619 | - <td> | |
| 620 | - <?php if ( $timestamp > 0 ) : ?> | |
| 621 | - <?php echo \esc_html( \human_time_diff( $timestamp, \time() ) . ' ' . \__( 'ago', 'activitypub' ) ); ?> | |
| 622 | - <?php else : ?> | |
| 623 | - <em><?php \esc_html_e( 'Never', 'activitypub' ); ?></em> | |
| 624 | - <?php endif; ?> | |
| 625 | - </td> | |
| 626 | - <td> | |
| 627 | - <button type="button" class="button button-small remove-blocklist-subscription-btn" data-url="<?php echo \esc_attr( $url ); ?>"> | |
| 628 | - <?php \esc_html_e( 'Remove', 'activitypub' ); ?> | |
| 629 | - </button> | |
| 630 | - </td> | |
| 631 | - </tr> | |
| 632 | - <?php endforeach; ?> | |
| 633 | - </tbody> | |
| 634 | - </table> | |
| 635 | - <?php endif; ?> | |
| 636 | - | |
| 637 | - <div class="add-blocklist-subscription-form" style="display: flex; max-width: 500px; gap: 8px;"> | |
| 638 | - <input type="url" class="regular-text" id="new_blocklist_subscription_url" placeholder="<?php \esc_attr_e( 'https://example.com/blocklist.csv', 'activitypub' ); ?>" style="flex: 1; min-width: 0;" /> | |
| 639 | - <button type="button" class="button add-blocklist-subscription-btn" style="flex-shrink: 0; white-space: nowrap;"> | |
| 640 | - <?php \esc_html_e( 'Subscribe', 'activitypub' ); ?> | |
| 641 | - </button> | |
| 642 | - </div> | |
| 643 | - | |
| 644 | - <?php if ( ! isset( $subscriptions[ Blocklist_Subscriptions::IFTAS_DNI_URL ] ) ) : ?> | |
| 645 | - <p class="description" style="margin-top: 10px;"> | |
| 646 | - <button type="button" class="button add-blocklist-subscription-btn" data-url="<?php echo \esc_attr( Blocklist_Subscriptions::IFTAS_DNI_URL ); ?>"> | |
| 647 | - <?php \esc_html_e( 'Subscribe to IFTAS DNI List', 'activitypub' ); ?> | |
| 648 | - </button> | |
| 649 | - <?php echo \wp_kses_post( \__( 'Domains <a href="https://about.iftas.org/" target="_blank" rel="noopener">IFTAS</a> recommends not federating with.', 'activitypub' ) ); ?> | |
| 650 | - </p> | |
| 651 | - <?php endif; ?> | |
| 652 | - </div> | |
| 487 | + <p> | |
| 488 | + <?php | |
| 489 | + echo \wp_kses( | |
| 490 | + \sprintf( | |
| 491 | + // translators: %s is a URL. | |
| 492 | + \__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ), | |
| 493 | + \esc_url( \admin_url( 'options-discussion.php#disallowed_keys' ) ) | |
| 494 | + ), | |
| 495 | + 'default' | |
| 496 | + ); | |
| 497 | + ?> | |
| 498 | + </p> | |
| 653 | 499 | <?php |
| 654 | 500 | } |
| 655 | 501 | } |