PluginProbe
Friends / 4.3.2
Friends v4.3.2
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
← All changes | includes/class-admin.php +34 -9 4.1.04.3.2 View file →
@@ -263,12 +263,12 @@
263 263 __( 'Welcome to the Friends Settings! You can configure the Friends plugin here to your liking.', 'friends' ) .
264 264 '</p>' .
265 265 '<p>' .
266 266 sprintf(
267 - // translators: %1$s is a URL, %2$s is the name of a wp-admin screen.
268 - __( 'There are more settings available for each friend or subscription individually. To get there, click on the user on the <a href=%1$s>%2$s</a> screen.', 'friends' ),
269 - '"' . esc_attr( self_admin_url( self::get_users_url() ) ) . '"',
270 - __( 'Friends &amp; Requests', 'friends' )
267 + // translators: %1$s is a URL, %2$s is the name of a page.
268 + __( 'There are more settings available for each friend or subscription individually. To get there, click on the user on the <a href=%1$s>%2$s</a> page.', 'friends' ),
269 + '"' . esc_attr( self::get_users_url() ) . '"',
270 + __( 'Following', 'friends' )
271 271 ) .
272 272 '</p>',
273 273 )
274 274 );
@@ -489,9 +489,9 @@
489 489 return;
490 490 }
491 491
492 492 $this->check_admin_settings();
493 - foreach ( array( 'disable_auto_tagging' ) as $checkbox ) {
493 + foreach ( array( 'disable_auto_tagging', 'disable_link_previews' ) as $checkbox ) {
494 494 if ( isset( $_POST[ $checkbox ] ) && boolval( $_POST[ $checkbox ] ) ) {
495 495 update_option( 'friends_' . $checkbox, true );
496 496 } else {
497 497 delete_option( 'friends_' . $checkbox );
@@ -498,8 +498,15 @@
498 498 }
499 499 }
500 500
501 501 if ( current_user_can( 'manage_options' ) ) {
502 + if ( isset( $_POST['main_user_id'] ) ) {
503 + $main_user_id = absint( $_POST['main_user_id'] );
504 + if ( $main_user_id && user_can( $main_user_id, Friends::REQUIRED_ROLE ) ) {
505 + update_option( 'friends_main_user_id', $main_user_id );
506 + }
507 + }
508 +
502 509 foreach ( array( 'force_enable_post_formats', 'expose_post_format_feeds', 'exclude_compose_format_from_feed' ) as $checkbox ) {
503 510 if ( isset( $_POST[ $checkbox ] ) && boolval( $_POST[ $checkbox ] ) ) {
504 511 update_option( 'friends_' . $checkbox, true );
505 512 } else {
@@ -606,8 +613,18 @@
606 613 return apply_filters(
607 614 'friends_news_entries',
608 615 array(
609 616 array(
617 + 'version' => '4.3',
618 + 'title' => __( '4.3: Link Previews', 'friends' ),
619 + 'template' => 'admin/news-4-3',
620 + ),
621 + array(
622 + 'version' => '4.2',
623 + 'title' => __( '4.2: Direct Messages', 'friends' ),
624 + 'template' => 'admin/news-4-2',
625 + ),
626 + array(
610 627 'version' => '4.1',
611 628 'title' => __( '4.1: Add Friend Frontend, Twitter Theme & Browser Extension', 'friends' ),
612 629 'template' => 'admin/news-4-1',
613 630 ),
@@ -1287,9 +1304,12 @@
1287 1304 'limit_homepage_post_format' => get_option( 'friends_limit_homepage_post_format', false ),
1288 1305 'expose_post_format_feeds' => get_option( 'friends_expose_post_format_feeds' ),
1289 1306 'compose_post_format' => get_option( 'friends_compose_post_format', 'status' ),
1290 1307 'exclude_compose_format_from_feed' => get_option( 'friends_exclude_compose_format_from_feed' ),
1308 + 'main_user_id' => Friends::get_main_friend_user_id(),
1309 + 'potential_main_users' => User_Query::all_admin_users(),
1291 1310 'disable_auto_tagging' => get_option( 'friends_disable_auto_tagging' ),
1311 + 'disable_link_previews' => get_option( 'friends_disable_link_previews' ),
1292 1312 'retention_days' => Friends::get_retention_days(),
1293 1313 'retention_number' => Friends::get_retention_number(),
1294 1314 'retention_days_enabled' => get_option( 'friends_enable_retention_days' ),
1295 1315 'retention_number_enabled' => get_option( 'friends_enable_retention_number' ),
@@ -1692,10 +1712,15 @@
1692 1712 if ( ! Friends::has_required_privileges() ) {
1693 1713 wp_send_json_error( __( 'You do not have permission to do this.', 'friends' ) );
1694 1714 }
1695 1715
1696 - $url = $this->normalize_frontend_subscription_url( wp_unslash( $_POST['url'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1716 + $incoming_url = trim( wp_unslash( $_POST['url'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1717 + if ( ! class_exists( '\Activitypub\Activitypub' ) && preg_match( '/^@?[A-Za-z0-9_.-]+@(?:[A-Za-z0-9_-]+\.)+[A-Za-z]+$/i', $incoming_url ) ) {
1718 + wp_send_json_error( __( 'The ActivityPub plugin is required to follow Mastodon handles. Please install and activate it first.', 'friends' ) );
1719 + }
1697 1720
1721 + $url = $this->normalize_frontend_subscription_url( $incoming_url );
1722 +
1698 1723 if ( '' === $url ) {
1699 1724 wp_send_json_error( __( 'No URL provided.', 'friends' ) );
1700 1725 }
1701 1726
@@ -2337,9 +2362,9 @@
2337 2362
2338 2363 if ( isset( $_GET['_wp_http_referer'] ) ) {
2339 2364 wp_safe_redirect( wp_get_referer() );
2340 2365 } else {
2341 - wp_safe_redirect( add_query_arg( $arg, $arg_value, self_admin_url( 'admin.php?page=friends-list' ) ) );
2366 + wp_safe_redirect( add_query_arg( $arg, $arg_value, home_url( '/friends/following/' ) ) );
2342 2367 }
2343 2368 exit;
2344 2369 }
2345 2370
@@ -2862,9 +2887,9 @@
2862 2887 return $friend_roles;
2863 2888 }
2864 2889
2865 2890 public static function get_users_url() {
2866 - return 'admin.php?page=friends-list';
2891 + return home_url( '/friends/following/' );
2867 2892 }
2868 2893
2869 2894 /**
2870 2895 * Override the post title for specific post formats.
@@ -2956,9 +2981,9 @@
2956 2981 array(
2957 2982 'id' => 'friends',
2958 2983 'parent' => 'friends-menu',
2959 2984 'title' => esc_html__( 'Settings' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
2960 - 'href' => $my_admin_url . '/wp-admin/admin.php?page=friends-settings',
2985 + 'href' => home_url( '/friends/settings/' ),
2961 2986 )
2962 2987 );
2963 2988 }
2964 2989