Changeset 6465 for sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-themes-api.php
- Timestamp:
- 01/30/2018 05:54:05 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-themes-api.php
r6462 r6465 119 119 */ 120 120 public function get_result( $format = 'raw' ) { 121 $response = $this->response; 122 123 // Back-compat behaviour: 124 if ( defined( 'THEMES_API_SUPPORTS_ERRORS' ) && ! THEMES_API_SUPPORTS_ERRORS ) { 125 if ( isset( $this->response->error ) && 'Theme not found' == $this->response->error ) { 126 $response = false; 127 } 128 } 129 121 130 if ( 'json' === $format ) { 122 return wp_json_encode( $ this->response );131 return wp_json_encode( $response ); 123 132 } elseif ( 'php' === $format ) { 124 return serialize( $ this->response );133 return serialize( $response ); 125 134 } else { // 'raw' === $format, or anything else. 126 return $ this->response;135 return $response; 127 136 } 128 137 } … … 327 336 ) ); 328 337 329 if ( ! empty( $themes )) {338 if ( $themes ) { 330 339 $this->response = $this->fill_theme( $themes[0] ); 340 } else { 341 $this->response = (object) array( 'error' => 'Theme not found' ); // Check get_result() if changing this string. 331 342 } 332 343 }
Note: See TracChangeset
for help on using the changeset viewer.