| 1 |
<?php |
| 2 |
/** |
| 3 |
* Block confirmation template. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
use Activitypub\Collection\Actors; |
| 9 |
use Activitypub\Collection\Remote_Actors; |
| 10 |
|
| 11 |
/* @var array $args Template arguments. */ |
| 12 |
$args = wp_parse_args( $args ?? array() ); |
| 13 |
|
| 14 |
$actor_id = $args['actor_id']; |
| 15 |
|
| 16 |
// Get actor and validate. |
| 17 |
$actor = Remote_Actors::get_actor( $actor_id ); |
| 18 |
if ( is_wp_error( $actor ) ) { |
| 19 |
wp_die( \esc_html__( 'Invalid account.', 'activitypub' ), '', array( 'back_link' => true ) ); |
| 20 |
} |
| 21 |
|
| 22 |
// Prepare form URL. |
| 23 |
$base_url = add_query_arg( |
| 24 |
array( |
| 25 |
'action' => 'block', |
| 26 |
'follower' => $actor_id, |
| 27 |
'confirm' => 'true', |
| 28 |
) |
| 29 |
); |
| 30 |
|
| 31 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
| 32 |
?> |
| 33 |
<div class="wrap"> |
| 34 |
<h1><?php esc_html_e( 'Block Account', 'activitypub' ); ?></h1> |
| 35 |
|
| 36 |
<p> |
| 37 |
<?php |
| 38 |
printf( |
| 39 |
/* translators: %s: username */ |
| 40 |
esc_html__( 'You are about to block “%s”.', 'activitypub' ), |
| 41 |
'<strong>' . esc_html( $actor->get_preferred_username() ) . '</strong>' |
| 42 |
); |
| 43 |
?> |
| 44 |
</p> |
| 45 |
<p><?php esc_html_e( 'This will:', 'activitypub' ); ?></p> |
| 46 |
<ul class="ul-disc"> |
| 47 |
<li><?php esc_html_e( 'Block incoming requests from this account for you.', 'activitypub' ); ?></li> |
| 48 |
<li><?php esc_html_e( 'Remove them from your followers and following lists.', 'activitypub' ); ?></li> |
| 49 |
</ul> |
| 50 |
|
| 51 |
<form method="post" action="<?php echo esc_url( $base_url ); ?>"> |
| 52 |
<?php wp_nonce_field( 'block-follower_' . $actor_id ); ?> |
| 53 |
|
| 54 |
<p><?php esc_html_e( 'You can unblock this account later from your Blocked Actors list.', 'activitypub' ); ?></p> |
| 55 |
|
| 56 |
<?php if ( current_user_can( 'manage_options' ) && get_current_screen()->id !== 'settings_page_activitypub' ) : ?> |
| 57 |
<p> |
| 58 |
<label> |
| 59 |
<input type="checkbox" name="site_wide" value="1" /> |
| 60 |
<?php esc_html_e( 'Also block this account site-wide (affects all users and the blog actor).', 'activitypub' ); ?> |
| 61 |
</label> |
| 62 |
</p> |
| 63 |
<?php endif; ?> |
| 64 |
|
| 65 |
<p class="submit"> |
| 66 |
<?php submit_button( __( 'Confirm', 'activitypub' ), 'primary', 'submit', false ); ?> |
| 67 |
<a href="<?php echo esc_url( wp_get_referer() ); ?>" class="button"><?php esc_html_e( 'Cancel', 'activitypub' ); ?></a> |
| 68 |
</p> |
| 69 |
</form> |
| 70 |
</div> |
| 71 |
<?php |
| 72 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
| 73 |
|