Changeset 10091
- Timestamp:
- 07/23/2020 04:01:51 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r9827 r10091 224 224 // Fun fact: ratings are stored as 1-5 in postmeta, but returned as percentages by the API 225 225 $result['author_block_rating'] = get_post_meta( $post_id, 'author_block_rating', true ) ? 20 * get_post_meta( $post_id, 'author_block_rating', true ) : $result['rating']; 226 227 // Translations. 228 $result['language_pack'] = []; 229 if ( defined ( 'API_WPORGPATH' ) && file_exists( API_WPORGPATH . '/translations/lib.php' ) ) { 230 require API_WPORGPATH . '/translations/lib.php'; 231 232 $result['language_pack'] = find_all_translations_for_type_and_domain( 233 'plugin', 234 $result['slug'], 235 $result['version'] 236 ); 237 $result['language_pack'] = array_map( function( $item ) use ( $result ) { 238 return [ 239 'type' => 'plugin', 240 'slug' => $result['slug'], 241 'language' => $item->language, 242 'version' => $item->version, 243 'updated' => $item->updated, 244 'package' => $item->package, 245 ]; 246 }, $result['language_pack'] ); 247 } 226 248 227 249 // That's all folks! -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php
r9118 r10091 35 35 'blocks' => false, 36 36 'block_assets' => false, 37 'language_pack' => false, 37 38 ); 38 39 … … 54 55 'tags' => true, 55 56 'tested' => true, 57 'language_pack' => false, 56 58 'blocks' => false, 57 59 'block_assets' => false, -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php
r9768 r10091 178 178 } 179 179 } 180 } 181 182 // Only include language packs for the requested locale. 183 if ( ! empty( $fields['language_pack'] ) ) { 184 $response['language_pack'] = array_values( array_filter( $response['language_pack'], function( $item ) use ( $request ) { 185 return ( $request->locale === $item['language'] ); 186 } ) ); 180 187 } 181 188
Note: See TracChangeset
for help on using the changeset viewer.