Changeset 10100
- Timestamp:
- 07/27/2020 06:14:28 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
-
api/routes/class-plugin.php (modified) (1 diff)
-
standalone/class-plugins-info-api-request.php (modified) (1 diff)
-
standalone/class-plugins-info-api.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r10098 r10100 245 245 ]; 246 246 }, $result['language_packs'] ); 247 } 248 249 // Include json translation data directly for block plugins, so it's immediately available on insert 250 if ( !empty( $result['language_pack'] ) && !empty( $result['block_assets'] ) ) { 251 foreach ( $result['block_assets'] as $file ) { 252 if ( 'js' === pathinfo( $file, PATHINFO_EXTENSION ) ) { 253 // Look inside language pack zip files for a correctly names .json 254 foreach ( $result['language_pack'] as $lp ) { 255 $version_path = 'trunk' === $result['stable_tag'] ? 'trunk' : 'tags/' . $result['stable_tag']; 256 $_file = str_replace( "/{$version_path}/", '', $file ); 257 $zip_path = '/nfs/rosetta/builds/plugins/' . $result['slug'] . '/' . $result['version'] . '/' . $lp['language'] . '.zip'; 258 $json_file = $result['slug'] . '-' . $lp['language'] . '-' . md5( $_file ) . '.json'; 259 if ( $fp = fopen( "zip://$zip_path#$json_file", 'r' ) ) { 260 $json = fread( $fp, 100 * KB_IN_BYTES ); // max 100kb 261 if ( $json && feof($fp) ) { 262 // Note that we're intentionally not decoding the json here, as we don't want to alter it by converting to and from PHP data types. 263 $result['block_translations'][ $lp['language'] ][ $file ] = $json; 264 } 265 fclose( $fp ); 266 } 267 } 268 } 269 } 247 270 } 248 271 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php
r10098 r10100 106 106 'blocks' => true, 107 107 'block_assets' => true, 108 'block_translations' => true, 108 109 'author_block_count' => true, 109 110 'author_block_rating' => true, -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php
r10098 r10100 178 178 } 179 179 } 180 } 181 182 // Only include block translation data for the selected locale. 183 if ( ! empty( $response['block_translations'] ) ) { 184 $response['block_translations'] = !empty( $response['block_translations'][ $request->locale ] ) ? $response['block_translations'][ $request->locale ] : []; 180 185 } 181 186
Note: See TracChangeset
for help on using the changeset viewer.