@@ -429,23 +429,35 @@ public static function render_moderation_section_description() {
429429 */
430430 public static function render_site_blocked_domains_field () {
431431 $ blocked_domains = Moderation::get_site_blocks ()['domains ' ];
432+ $ count = \count ( $ blocked_domains );
432433 ?>
433434 <p class="description"><?php \esc_html_e ( 'Block entire ActivityPub instances by domain name. ' , 'activitypub ' ); ?> </p>
434435
435436 <div class="activitypub-site-block-list">
436437 <?php if ( ! empty ( $ blocked_domains ) ) : ?>
437- <table class="widefat striped activitypub-site-blocked-domain" role="presentation" style="max-width: 500px; margin: 15px 0;">
438- <?php foreach ( $ blocked_domains as $ domain ) : ?>
439- <tr>
440- <td><?php echo \esc_html ( $ domain ); ?> </td>
441- <td style="width: 80px;">
442- <button type="button" class="button button-small remove-site-block-btn" data-type="domain" data-value="<?php echo \esc_attr ( $ domain ); ?> ">
443- <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
444- </button>
445- </td>
446- </tr>
447- <?php endforeach ; ?>
448- </table>
438+ <details style="margin: 10px 0;">
439+ <summary style="cursor: pointer; padding: 8px 0; color: inherit;">
440+ <?php
441+ \printf (
442+ /* translators: %s: Number of blocked domains */
443+ \esc_html ( \_n ( '%s blocked domain ' , '%s blocked domains ' , $ count , 'activitypub ' ) ),
444+ \number_format_i18n ( $ count )
445+ );
446+ ?>
447+ </summary>
448+ <table class="widefat striped activitypub-site-blocked-domain" role="presentation" style="max-width: 500px; margin-top: 10px;">
449+ <?php foreach ( $ blocked_domains as $ domain ) : ?>
450+ <tr>
451+ <td><?php echo \esc_html ( $ domain ); ?> </td>
452+ <td style="width: 80px;">
453+ <button type="button" class="button button-small remove-site-block-btn" data-type="domain" data-value="<?php echo \esc_attr ( $ domain ); ?> ">
454+ <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
455+ </button>
456+ </td>
457+ </tr>
458+ <?php endforeach ; ?>
459+ </table>
460+ </details>
449461 <?php endif ; ?>
450462
451463 <div class="add-site-block-form" style="display: flex; max-width: 500px; gap: 8px;">
@@ -463,23 +475,35 @@ public static function render_site_blocked_domains_field() {
463475 */
464476 public static function render_site_blocked_keywords_field () {
465477 $ blocked_keywords = Moderation::get_site_blocks ()['keywords ' ];
478+ $ count = \count ( $ blocked_keywords );
466479 ?>
467480 <p class="description"><?php \esc_html_e ( 'Block ActivityPub content containing specific keywords. ' , 'activitypub ' ); ?> </p>
468481
469482 <div class="activitypub-site-block-list">
470483 <?php if ( ! empty ( $ blocked_keywords ) ) : ?>
471- <table class="widefat striped activitypub-site-blocked-keyword" role="presentation" style="max-width: 500px; margin: 15px 0;">
472- <?php foreach ( $ blocked_keywords as $ keyword ) : ?>
473- <tr>
474- <td><?php echo \esc_html ( $ keyword ); ?> </td>
475- <td style="width: 80px;">
476- <button type="button" class="button button-small remove-site-block-btn" data-type="keyword" data-value="<?php echo \esc_attr ( $ keyword ); ?> ">
477- <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
478- </button>
479- </td>
480- </tr>
481- <?php endforeach ; ?>
482- </table>
484+ <details style="margin: 10px 0;">
485+ <summary style="cursor: pointer; padding: 8px 0; color: inherit;">
486+ <?php
487+ \printf (
488+ /* translators: %s: Number of blocked keywords */
489+ \esc_html ( \_n ( '%s blocked keyword ' , '%s blocked keywords ' , $ count , 'activitypub ' ) ),
490+ \number_format_i18n ( $ count )
491+ );
492+ ?>
493+ </summary>
494+ <table class="widefat striped activitypub-site-blocked-keyword" role="presentation" style="max-width: 500px; margin-top: 10px;">
495+ <?php foreach ( $ blocked_keywords as $ keyword ) : ?>
496+ <tr>
497+ <td><?php echo \esc_html ( $ keyword ); ?> </td>
498+ <td style="width: 80px;">
499+ <button type="button" class="button button-small remove-site-block-btn" data-type="keyword" data-value="<?php echo \esc_attr ( $ keyword ); ?> ">
500+ <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
501+ </button>
502+ </td>
503+ </tr>
504+ <?php endforeach ; ?>
505+ </table>
506+ </details>
483507 <?php endif ; ?>
484508
485509 <div class="add-site-block-form" style="display: flex; max-width: 500px; gap: 8px;">
0 commit comments