Changeset 11535 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php
- Timestamp:
- 02/10/2022 12:41:19 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php
r11219 r11535 155 155 * @param string $method The requested method, used to determine the default fields to include. 156 156 * 157 * @return array The $resonse with the extra fields removed. 158 */ 159 protected function remove_unexpected_fields( $response, $request, $method = '' ) { 160 $fields = $request->get_expected_fields( $method ); 157 * @return array The $response with the extra fields removed. 158 */ 159 protected function remove_unexpected_fields( $full_response, $request, $method = '' ) { 160 $response = $full_response; 161 $fields = $request->get_expected_fields( $method ); 161 162 foreach ( $fields as $field => $include ) { 162 163 if ( ! $include ) { … … 168 169 } 169 170 171 // Support requesting reviews without sections. 172 if ( ! empty( $fields['reviews'] ) && empty( $fields['sections'] ) ) { 173 $response['sections'] = array( 174 'reviews' => $full_response['sections']['reviews'] 175 ); 176 } 177 170 178 // Back-compatible routines. 171 179 // WordPress 4.9 and older need a "bare" contributor map [ user => profile ] 172 180 if ( ! empty( $fields['bare_contributors'] ) ) { 173 $contrib s= $response['contributors'] ?? [];181 $contributors = $response['contributors'] ?? []; 174 182 $response['contributors'] = array(); 175 if ( $contribs ) { 176 foreach ( $contribs as $user => $data ) { 177 $response['contributors'][ $user ] = $data['profile']; 178 } 183 foreach ( $contributors as $user => $data ) { 184 $response['contributors'][ $user ] = $data['profile']; 179 185 } 180 186 } … … 182 188 // Only include block translation data for the selected locale. 183 189 if ( ! empty( $response['block_translations'] ) ) { 184 $response['block_translations'] = !empty( $response['block_translations'][ $request->locale ] ) ? $response['block_translations'][ $request->locale ] :[];190 $response['block_translations'] = $response['block_translations'][ $request->locale ] ?? []; 185 191 } 186 192
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)