| @@ -9,11 +9,8 @@ | ||
| 9 | 9 | |
| 10 | 10 | use Activitypub\Collection\Actors; |
| 11 | 11 | use Activitypub\Collection\Extra_Fields; |
| 12 | 12 | use Activitypub\Moderation; |
| 13 | -use Activitypub\OAuth\Client; | |
| 14 | -use Activitypub\OAuth\Scope; | |
| 15 | -use Activitypub\OAuth\Token; | |
| 16 | 13 | |
| 17 | 14 | /** |
| 18 | 15 | * Class to handle all user settings fields and callbacks. |
| 19 | 16 | */ |
| @@ -252,26 +249,8 @@ | ||
| 252 | 249 | <input type="checkbox" name="activitypub_mailer_new_mention" id="activitypub_mailer_new_mention" value="1" <?php \checked( 1, \get_user_option( 'activitypub_mailer_new_mention' ) ); ?> /> |
| 253 | 250 | <?php \esc_html_e( 'New Mentions', 'activitypub' ); ?> |
| 254 | 251 | </label> |
| 255 | 252 | </p> |
| 256 | - <p> | |
| 257 | - <label> | |
| 258 | - <input type="checkbox" name="activitypub_mailer_new_reaction" id="activitypub_mailer_new_reaction" value="1" <?php \checked( 1, \get_user_option( 'activitypub_mailer_new_reaction' ) ); ?> /> | |
| 259 | - <?php \esc_html_e( 'Likes, Reposts and Quotes', 'activitypub' ); ?> | |
| 260 | - </label> | |
| 261 | - </p> | |
| 262 | - <p> | |
| 263 | - <label> | |
| 264 | - <input type="checkbox" name="activitypub_mailer_annual_report" id="activitypub_mailer_annual_report" value="1" <?php \checked( 1, \get_user_option( 'activitypub_mailer_annual_report' ) ); ?> /> | |
| 265 | - <?php \esc_html_e( 'Annual Report', 'activitypub' ); ?> | |
| 266 | - </label> | |
| 267 | - </p> | |
| 268 | - <p> | |
| 269 | - <label> | |
| 270 | - <input type="checkbox" name="activitypub_mailer_monthly_report" id="activitypub_mailer_monthly_report" value="1" <?php \checked( 1, \get_user_option( 'activitypub_mailer_monthly_report' ) ); ?> /> | |
| 271 | - <?php \esc_html_e( 'Monthly Report', 'activitypub' ); ?> | |
| 272 | - </label> | |
| 273 | - </p> | |
| 274 | 253 | </fieldset> |
| 275 | 254 | <?php |
| 276 | 255 | } |
| 277 | 256 | |
| @@ -322,9 +301,9 @@ | ||
| 322 | 301 | class="large-text" |
| 323 | 302 | name="activitypub_also_known_as" |
| 324 | 303 | id="activitypub_also_known_as" |
| 325 | 304 | rows="5" |
| 326 | - ><?php echo \esc_textarea( \implode( PHP_EOL, (array) $also_known_as ) ); ?></textarea> | |
| 305 | + ><?php echo \esc_textarea( implode( PHP_EOL, (array) $also_known_as ) ); ?></textarea> | |
| 327 | 306 | <p class="description"> |
| 328 | 307 | <?php \esc_html_e( 'If you’re moving from another account to this one, you’ll need to create an alias here first before transferring your followers. This step is safe, reversible, and doesn’t affect anything on its own. The migration itself is initiated from your old account.', 'activitypub' ); ?> |
| 329 | 308 | </p> |
| 330 | 309 | <p class="description"> |
| @@ -410,158 +389,8 @@ | ||
| 410 | 389 | <?php |
| 411 | 390 | } |
| 412 | 391 | |
| 413 | 392 | /** |
| 414 | - * Render the Connected Applications section on the profile page. | |
| 415 | - * | |
| 416 | - * Rendered as a standalone section (like core's Application Passwords), | |
| 417 | - * not through the Settings API. | |
| 418 | - * | |
| 419 | - * @since 8.1.0 | |
| 420 | - */ | |
| 421 | - public static function connected_apps_section() { | |
| 422 | - $tokens = Token::get_all_for_user( \get_current_user_id() ); | |
| 423 | - $clients = Client::get_manually_registered(); | |
| 424 | - | |
| 425 | - ?> | |
| 426 | - <div class="activitypub-connected-apps hide-if-no-js" id="activitypub-connected-apps-section"> | |
| 427 | - <h2><?php \esc_html_e( 'OAuth Applications', 'activitypub' ); ?></h2> | |
| 428 | - <p><?php \esc_html_e( 'Register OAuth applications to connect third-party clients to your account, or revoke access for existing ones.', 'activitypub' ); ?></p> | |
| 429 | - | |
| 430 | - <div class="create-application-password form-wrap" id="activitypub-new-application"> | |
| 431 | - <div class="form-field"> | |
| 432 | - <label for="activitypub-new-app-name"><?php \esc_html_e( 'New Application Name', 'activitypub' ); ?></label> | |
| 433 | - <input type="text" size="30" id="activitypub-new-app-name" class="input" aria-required="true" spellcheck="false" /> | |
| 434 | - </div> | |
| 435 | - <div class="form-field"> | |
| 436 | - <label for="activitypub-new-app-redirect-uri"><?php \esc_html_e( 'Redirect URI', 'activitypub' ); ?></label> | |
| 437 | - <input type="url" size="30" id="activitypub-new-app-redirect-uri" class="input" aria-required="true" spellcheck="false" /> | |
| 438 | - </div> | |
| 439 | - <button type="button" class="button button-secondary" id="activitypub-register-app"> | |
| 440 | - <?php \esc_html_e( 'Register Application', 'activitypub' ); ?> | |
| 441 | - </button> | |
| 442 | - </div> | |
| 443 | - | |
| 444 | - <div class="activitypub-registered-apps-wrapper" id="activitypub-registered-apps-wrapper" <?php echo empty( $clients ) ? 'style="display: none;"' : ''; ?>> | |
| 445 | - <h3><?php \esc_html_e( 'Registered Applications', 'activitypub' ); ?></h3> | |
| 446 | - <table class="wp-list-table widefat fixed striped table-view-list"> | |
| 447 | - <thead> | |
| 448 | - <tr> | |
| 449 | - <th scope="col"><?php \esc_html_e( 'Name', 'activitypub' ); ?></th> | |
| 450 | - <th scope="col"><?php \esc_html_e( 'Redirect URI', 'activitypub' ); ?></th> | |
| 451 | - <th scope="col"><?php \esc_html_e( 'Created', 'activitypub' ); ?></th> | |
| 452 | - <th scope="col"><?php \esc_html_e( 'Delete', 'activitypub' ); ?></th> | |
| 453 | - </tr> | |
| 454 | - </thead> | |
| 455 | - <tbody id="activitypub-registered-apps-tbody"> | |
| 456 | - <?php foreach ( $clients as $client ) : ?> | |
| 457 | - <?php | |
| 458 | - $redirect_uris = $client->get_redirect_uris(); | |
| 459 | - $redirect_uri = ! empty( $redirect_uris ) ? $redirect_uris[0] : '—'; | |
| 460 | - $post = \get_post( $client->get_post_id() ); | |
| 461 | - $created = $post ? \date_i18n( \get_option( 'date_format' ), \strtotime( $post->post_date ) ) : '—'; | |
| 462 | - ?> | |
| 463 | - <tr data-client-id="<?php echo \esc_attr( $client->get_client_id() ); ?>"> | |
| 464 | - <td><?php echo \esc_html( $client->get_name() ); ?></td> | |
| 465 | - <td><?php echo \esc_html( $redirect_uri ); ?></td> | |
| 466 | - <td><?php echo \esc_html( $created ); ?></td> | |
| 467 | - <td> | |
| 468 | - <?php | |
| 469 | - \printf( | |
| 470 | - '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>', | |
| 471 | - /* translators: %s: the application name */ | |
| 472 | - \esc_attr( \sprintf( \__( 'Delete "%s"', 'activitypub' ), $client->get_name() ) ), | |
| 473 | - \esc_html__( 'Delete', 'activitypub' ) | |
| 474 | - ); | |
| 475 | - ?> | |
| 476 | - </td> | |
| 477 | - </tr> | |
| 478 | - <?php endforeach; ?> | |
| 479 | - </tbody> | |
| 480 | - <tfoot> | |
| 481 | - <tr> | |
| 482 | - <th scope="col"><?php \esc_html_e( 'Name', 'activitypub' ); ?></th> | |
| 483 | - <th scope="col"><?php \esc_html_e( 'Redirect URI', 'activitypub' ); ?></th> | |
| 484 | - <th scope="col"><?php \esc_html_e( 'Created', 'activitypub' ); ?></th> | |
| 485 | - <th scope="col"><?php \esc_html_e( 'Delete', 'activitypub' ); ?></th> | |
| 486 | - </tr> | |
| 487 | - </tfoot> | |
| 488 | - </table> | |
| 489 | - <div class="tablenav bottom"> | |
| 490 | - <div class="alignright"> | |
| 491 | - <button type="button" class="button delete" id="activitypub-delete-all-clients"> | |
| 492 | - <?php \esc_html_e( 'Delete all registered applications', 'activitypub' ); ?> | |
| 493 | - </button> | |
| 494 | - </div> | |
| 495 | - </div> | |
| 496 | - </div> | |
| 497 | - | |
| 498 | - <?php if ( ! empty( $tokens ) ) : ?> | |
| 499 | - <div class="activitypub-connected-apps-list-table-wrapper"> | |
| 500 | - <h3><?php \esc_html_e( 'Active Tokens', 'activitypub' ); ?></h3> | |
| 501 | - <table class="wp-list-table widefat fixed striped table-view-list"> | |
| 502 | - <thead> | |
| 503 | - <tr> | |
| 504 | - <th scope="col"><?php \esc_html_e( 'Name', 'activitypub' ); ?></th> | |
| 505 | - <th scope="col"><?php \esc_html_e( 'Scopes', 'activitypub' ); ?></th> | |
| 506 | - <th scope="col"><?php \esc_html_e( 'Created', 'activitypub' ); ?></th> | |
| 507 | - <th scope="col"><?php \esc_html_e( 'Last Used', 'activitypub' ); ?></th> | |
| 508 | - <th scope="col"><?php \esc_html_e( 'Revoke', 'activitypub' ); ?></th> | |
| 509 | - </tr> | |
| 510 | - </thead> | |
| 511 | - <tbody id="activitypub-connected-apps-tbody"> | |
| 512 | - <?php foreach ( $tokens as $token ) : ?> | |
| 513 | - <?php | |
| 514 | - $client_id = $token['client_id'] ?? ''; | |
| 515 | - $client = Client::get( $client_id ); | |
| 516 | - $client_name = ! \is_wp_error( $client ) ? $client->get_name() : $client_id; | |
| 517 | - $scopes = isset( $token['scopes'] ) ? Scope::to_string( $token['scopes'] ) : ''; | |
| 518 | - $created = ! empty( $token['created_at'] ) ? \date_i18n( \get_option( 'date_format' ), $token['created_at'] ) : '—'; | |
| 519 | - $last_used = ! empty( $token['last_used_at'] ) ? \date_i18n( \get_option( 'date_format' ), $token['last_used_at'] ) : '—'; | |
| 520 | - $meta_key = $token['meta_key'] ?? ''; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Not a DB query, just array key. | |
| 521 | - ?> | |
| 522 | - <tr data-meta-key="<?php echo \esc_attr( $meta_key ); ?>"> | |
| 523 | - <td><?php echo \esc_html( $client_name ); ?></td> | |
| 524 | - <td><?php echo \esc_html( $scopes ); ?></td> | |
| 525 | - <td><?php echo \esc_html( $created ); ?></td> | |
| 526 | - <td><?php echo $last_used; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Contains only escaped date or — entity. ?></td> | |
| 527 | - <td> | |
| 528 | - <?php | |
| 529 | - \printf( | |
| 530 | - '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>', | |
| 531 | - /* translators: %s: the application name */ | |
| 532 | - \esc_attr( \sprintf( \__( 'Revoke "%s"', 'activitypub' ), $client_name ) ), | |
| 533 | - \esc_html__( 'Revoke', 'activitypub' ) | |
| 534 | - ); | |
| 535 | - ?> | |
| 536 | - </td> | |
| 537 | - </tr> | |
| 538 | - <?php endforeach; ?> | |
| 539 | - </tbody> | |
| 540 | - <tfoot> | |
| 541 | - <tr> | |
| 542 | - <th scope="col"><?php \esc_html_e( 'Name', 'activitypub' ); ?></th> | |
| 543 | - <th scope="col"><?php \esc_html_e( 'Scopes', 'activitypub' ); ?></th> | |
| 544 | - <th scope="col"><?php \esc_html_e( 'Created', 'activitypub' ); ?></th> | |
| 545 | - <th scope="col"><?php \esc_html_e( 'Last Used', 'activitypub' ); ?></th> | |
| 546 | - <th scope="col"><?php \esc_html_e( 'Revoke', 'activitypub' ); ?></th> | |
| 547 | - </tr> | |
| 548 | - </tfoot> | |
| 549 | - </table> | |
| 550 | - <div class="tablenav bottom"> | |
| 551 | - <div class="alignright"> | |
| 552 | - <button type="button" class="button delete" id="activitypub-revoke-all-tokens"> | |
| 553 | - <?php \esc_html_e( 'Revoke all connected applications', 'activitypub' ); ?> | |
| 554 | - </button> | |
| 555 | - </div> | |
| 556 | - </div> | |
| 557 | - </div> | |
| 558 | - <?php endif; ?> | |
| 559 | - </div> | |
| 560 | - <?php | |
| 561 | - } | |
| 562 | - | |
| 563 | - /** | |
| 564 | 393 | * Hide Social Graph field callback. |
| 565 | 394 | */ |
| 566 | 395 | public static function hide_followers_callback() { |
| 567 | 396 | $hide_followers = \get_user_option( 'activitypub_hide_social_graph', \get_current_user_id() ); |
| @@ -570,9 +399,9 @@ | ||
| 570 | 399 | <input type="checkbox" name="activitypub_hide_social_graph" id="activitypub_hide_social_graph" value="1" <?php \checked( '1', $hide_followers ); ?> /> |
| 571 | 400 | <?php \esc_html_e( 'Hide Followers and Following on Profile', 'activitypub' ); ?> |
| 572 | 401 | </label> |
| 573 | 402 | <p class="description"> |
| 574 | - <?php \esc_html_e( 'People you follow will still see that you follow them.', 'activitypub' ); ?> | |
| 403 | + <?php esc_html_e( 'People you follow will still see that you follow them.', 'activitypub' ); ?> | |
| 575 | 404 | </p> |
| 576 | 405 | <?php |
| 577 | 406 | } |
| 578 | 407 | } |