PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | modules/google-fonts/current/load-google-fonts.php +4 -52 16.3 → 16.3-a.1 View file →
@@ -121,53 +121,8 @@
121 121 return $available_google_fonts_map;
122 122 }
123 123
124 124 /**
125 - * Whether the request URL is a REST route.
126 - *
127 - * Theme JSON can resolve before REST_REQUEST is defined, and the Accept header also matches front-end requests.
128 - *
129 - * @since 16.3
130 - *
131 - * @return bool
132 - */
133 -function jetpack_google_fonts_is_rest_url() {
134 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only used to classify the request.
135 - if ( isset( $_GET['rest_route'] ) ) {
136 - return true;
137 - }
138 - $path = (string) wp_parse_url( isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '', PHP_URL_PATH ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Parsed for path comparison only.
139 - return str_contains( $path, '/' . rest_get_url_prefix() . '/' );
140 -}
141 -
142 -/**
143 - * Whether catalogue faces are needed in theme JSON for an editor or API request.
144 - *
145 - * @since 16.3
146 - *
147 - * @return bool
148 - */
149 -function jetpack_google_fonts_load_font_faces() {
150 - $load_font_faces = is_admin()
151 - || ( defined( 'REST_REQUEST' ) && REST_REQUEST )
152 - || jetpack_google_fonts_is_rest_url()
153 - || ( defined( 'WP_CLI' ) && WP_CLI );
154 -
155 - /**
156 - * Filters whether catalogue font faces are loaded into theme JSON.
157 - *
158 - * When true, the catalogue's files reach theme JSON and the native font printer prints all of them.
159 - *
160 - * @module google-fonts
161 - *
162 - * @since 16.3
163 - *
164 - * @param bool $load_font_faces Whether to load catalogue font faces. Default true for editor, API and CLI requests.
165 - */
166 - return (bool) apply_filters( 'jetpack_google_fonts_load_font_faces', $load_font_faces );
167 -}
168 -
169 -/**
170 125 * Register google fonts to the theme json data
171 126 *
172 127 * @param WP_Theme_JSON_Data $theme_json The theme json data of core.
173 128 * @return WP_Theme_JSON_Data The theme json data with registered google fonts.
@@ -194,13 +149,9 @@
194 149 if ( empty( $raw_data['settings']['typography']['fontFamilies'][ $origin ] ) ) {
195 150 $raw_data['settings']['typography']['fontFamilies'][ $origin ] = array();
196 151 }
197 152
198 - $load_font_faces = jetpack_google_fonts_load_font_faces();
199 153 foreach ( $google_fonts_families as $font_family ) {
200 - if ( ! $load_font_faces ) {
201 - unset( $font_family['fontFace'] );
202 - }
203 154 $raw_data['settings']['typography']['fontFamilies'][ $origin ][] = $font_family;
204 155 }
205 156
206 157 $theme_json_class = get_class( $theme_json );
@@ -211,10 +162,10 @@
211 162
212 163 /**
213 164 * Filter out the deprecated font families that are from the jetpack-google-fonts provider.
214 165 *
215 - * @param array[] $font_families The font families.
216 - * @return array[] The filtered font families.
166 + * @param object[] $font_families The font families.
167 + * @return object[] The filtered font families.
217 168 */
218 169 function jetpack_google_fonts_filter_out_deprecated_font_data( $font_families ) {
219 170 return array_values(
220 171 array_filter(
@@ -295,6 +246,7 @@
295 246 wp_update_post( wp_slash( (array) $changes ), true );
296 247 }
297 248 add_action( 'jetpack_deactivate_module_google-fonts', 'jetpack_unregister_google_fonts' );
298 249
299 -// Print legacy catalogue faces separately from native theme and user fonts.
250 +// Initialize Jetpack Google Font Face to avoid printing **ALL** google fonts provided by this module.
251 +// See p1700040028362329-slack-C4GAQ900P and p7DVsv-jib-p2
300 252 new Jetpack_Google_Font_Face();