@@ -41,8 +41,7 @@ function bootstrap() {
4141 add_filter ( 'wp_list_table_class_name ' , __NAMESPACE__ . '\\maybe_override_list_table ' );
4242
4343 // Needed for pre WordPress 6.9 compatibility.
44- global $ wp_version ;
45- if ( version_compare ( $ wp_version , '6.9-beta1 ' , '< ' ) ) {
44+ if ( ! is_wp_version_compatible ( '6.9 ' ) ) {
4645 add_action ( 'install_plugins_featured ' , __NAMESPACE__ . '\\replace_featured_message ' );
4746 add_action ( 'admin_init ' , fn () => remove_action ( 'install_plugins_featured ' , 'install_dashboard ' ) );
4847 }
@@ -87,14 +86,18 @@ function replace_featured_message() {
8786 \display_plugins_table ();
8887 $ views = ob_get_clean ();
8988
90- echo wp_kses_post (
91- str_replace (
92- // phpcs:ignore WordPress.WP.I18n.MissingArgDomain -- Intentional use of Core's text domain.
93- [ __ ( 'https://wordpress.org/plugins/ ' ), __ ( 'WordPress Plugin Directory ' ) ],
94- [ esc_url ( 'https://fair.pm/packages/plugins/ ' ), __ ( 'FAIR Package Directory ' , 'fair ' ) ],
95- $ views
96- )
97- );
89+ preg_match ( '|<a href="(?<url>[^"]+)">(?<text>[^>]+)<\/a>| ' , $ views , $ matches );
90+ if ( ! empty ( $ matches ['text ' ] ) ) {
91+ $ text_with_fair = str_replace ( 'WordPress ' , 'FAIR ' , $ matches ['text ' ] );
92+ $ str = str_replace (
93+ [ $ matches ['url ' ], $ matches ['text ' ] ],
94+ [ __ ( 'https://fair.pm/packages/plugins/ ' , 'fair ' ), $ text_with_fair ],
95+ $ matches [0 ]
96+ );
97+ }
98+
99+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Replacements are escaped. The previous content is direct from Core.
100+ echo str_replace ( $ matches [0 ], $ str , $ views );
98101}
99102
100103/**
0 commit comments