Changeset 42632
- Timestamp:
- 02/01/2018 05:18:54 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r42614 r42632 3219 3219 3220 3220 $theme->name = wp_kses( $theme->name, $themes_allowedtags ); 3221 $theme->author = wp_kses( $theme->author , $themes_allowedtags );3221 $theme->author = wp_kses( $theme->author['display_name'], $themes_allowedtags ); 3222 3222 $theme->version = wp_kses( $theme->version, $themes_allowedtags ); 3223 3223 $theme->description = wp_kses( $theme->description, $themes_allowedtags ); -
trunk/src/wp-admin/includes/theme.php
r42343 r42632 422 422 */ 423 423 function themes_api( $action, $args = array() ) { 424 // include an unmodified $wp_version 425 include( ABSPATH . WPINC . '/version.php' ); 424 426 425 427 if ( is_array( $args ) ) { … … 427 429 } 428 430 429 if ( ! isset( $args->per_page ) ) { 430 $args->per_page = 24; 431 if ( 'query_themes' == $action ) { 432 if ( ! isset( $args->per_page ) ) { 433 $args->per_page = 24; 434 } 431 435 } 432 436 433 437 if ( ! isset( $args->locale ) ) { 434 438 $args->locale = get_user_locale(); 439 } 440 441 if ( ! isset( $args->wp_version ) ) { 442 $args->wp_version = substr( $wp_version, 0, 3 ); // X.y 435 443 } 436 444 … … 466 474 467 475 if ( ! $res ) { 468 // include an unmodified $wp_version 469 include( ABSPATH . WPINC . '/version.php' ); 470 471 $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/'; 476 $url = 'http://api.wordpress.org/themes/info/1.2/'; 477 $url = add_query_arg( 478 array( 479 'action' => $action, 480 'request' => $args, 481 ), 482 $url 483 ); 484 485 $http_url = $url; 472 486 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { 473 487 $url = set_url_scheme( $url, 'https' ); … … 476 490 $http_args = array( 477 491 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), 478 'body' => array(479 'action' => $action,480 'request' => serialize( $args ),481 ),482 492 ); 483 $request = wp_remote_ post( $url, $http_args );493 $request = wp_remote_get( $url, $http_args ); 484 494 485 495 if ( $ssl && is_wp_error( $request ) ) { … … 494 504 ); 495 505 } 496 $request = wp_remote_ post( $http_url, $http_args );506 $request = wp_remote_get( $http_url, $http_args ); 497 507 } 498 508 … … 508 518 ); 509 519 } else { 510 $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); 511 if ( ! is_object( $res ) && ! is_array( $res ) ) { 520 $res = json_decode( wp_remote_retrieve_body( $request ), true ); 521 if ( is_array( $res ) ) { 522 // Object casting is required in order to match the info/1.0 format. 523 $res = (object) $res; 524 } elseif ( null === $res ) { 512 525 $res = new WP_Error( 513 526 'themes_api_failed', … … 520 533 ); 521 534 } 535 536 if ( isset( $res->error ) ) { 537 $res = new WP_Error( 'themes_api_failed', $res->error ); 538 } 539 } 540 541 // Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects. 542 if ( 'query_themes' == $action ) { 543 foreach ( $res->themes as $i => $theme ) { 544 $res->themes[ $i ] = (object) $theme; 545 } 546 } 547 // Back-compat for info/1.2 API, downgrade the feature_list result back to an array. 548 if ( 'feature_list' == $action ) { 549 $res = (array) $res; 522 550 } 523 551 } -
trunk/src/wp-admin/js/theme.js
r42222 r42632 335 335 // Request data 336 336 request: _.extend({ 337 per_page: 100, 338 fields: { 339 description: true, 340 tested: true, 341 requires: true, 342 rating: true, 343 downloaded: true, 344 downloadLink: true, 345 last_updated: true, 346 homepage: true, 347 num_ratings: true 348 } 337 per_page: 100 349 338 }, request) 350 339 }, -
trunk/src/wp-includes/class-wp-customize-manager.php
r42615 r42632 5620 5620 $wporg_args = array( 5621 5621 'per_page' => 100, 5622 'fields' => array(5623 'screenshot_url' => true,5624 'description' => true,5625 'rating' => true,5626 'downloaded' => true,5627 'downloadlink' => true,5628 'last_updated' => true,5629 'homepage' => true,5630 'num_ratings' => true,5631 'tags' => true,5632 'parent' => true,5633 // 'extended_author' => true, @todo: WordPress.org throws a 500 server error when this is here.5634 ),5635 5622 ); 5636 5623 … … 5675 5662 5676 5663 $theme->name = wp_kses( $theme->name, $themes_allowedtags ); 5677 $theme->author = wp_kses( $theme->author, $themes_allowedtags );5678 5664 $theme->version = wp_kses( $theme->version, $themes_allowedtags ); 5679 5665 $theme->description = wp_kses( $theme->description, $themes_allowedtags ); 5680 $theme->tags = implode( ', ', $theme->tags );5681 5666 $theme->stars = wp_star_rating( 5682 5667 array( … … 5703 5688 $theme->id = $theme->slug; 5704 5689 $theme->screenshot = array( $theme->screenshot_url ); 5705 $theme->authorAndUri = $theme->author;5706 // The .org API can return the full parent theme details if passed the 'parent' arg, or if passed the 'template' option it'll return that in the event it's a child theme. 5690 $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags ); 5691 5707 5692 if ( isset( $theme->parent ) ) { 5708 5693 $theme->parent = $theme->parent['slug'];
Note: See TracChangeset
for help on using the changeset viewer.