Changeset 6465
- Timestamp:
- 01/30/2018 05:54:05 AM (7 years ago)
- Location:
- sites/trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/themes/info/1.0/index.php
r6462 r6465 5 5 6 6 require dirname( dirname( dirname( __DIR__ ) ) ) . '/wp-init.php'; 7 8 if ( ! defined( 'THEMES_API_SUPPORTS_ERRORS' ) ) { 9 define( 'THEMES_API_SUPPORTS_ERRORS', false ); 10 } 7 11 8 12 // Set up action and request information. -
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.