Changeset 3289
- Timestamp:
- 06/02/2016 06:55:49 AM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 6 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php
r3020 r3289 14 14 new Routes\Internal_Stats(); 15 15 new Routes\Plugin(); 16 new Routes\Popular_Categories(); 17 new Routes\Query_Plugins(); 16 18 } 17 19 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r3228 r3289 4 4 use WordPressdotorg\Plugin_Directory\Template; 5 5 use WordPressdotorg\Plugin_Directory\API\Base; 6 use WP_REST_Server; 6 7 7 8 /** … … 14 15 function __construct() { 15 16 register_rest_route( 'plugins/v1', '/plugin/(?P<plugin_slug>[^/]+)/?', array( 16 'methods' => \WP_REST_Server::READABLE,17 'methods' => WP_REST_Server::READABLE, 17 18 'callback' => array( $this, 'plugin_info' ), 18 19 'args' => array( … … 31 32 */ 32 33 function plugin_info( $request ) { 33 /*34 * NOTE: Don't try to implement things such as the `fields` support in this endpoint.35 * It's highly unlikely we'll expose the REST API via api.wordpress.org as it is,36 * it'll probably have something in front of it.37 *38 * NOTE: Don't use any data from the client, such as the user_agent, just stick to what is presented in the GET payload.39 * It can't be cached if it's using data from other sources.40 */41 34 $plugin_slug = $request['plugin_slug']; 42 35 … … 76 69 $result['contributors'] = array(); 77 70 78 foreach ( (array)get_post_meta( $post_id, 'contributors', true ) as $contributor ) { 79 $user = get_user_by( 'slug', $contributor ); 71 $contributors = get_post_meta( $post_id, 'contributors', true ) ?: array( (int) $post->post_author ); 72 foreach ( $contributors as $contributor ) { 73 $user = is_int( $contributor ) ? get_user_by( 'id', $contributor ) : get_user_by( 'slug', $contributor ); 80 74 if ( ! $user ) { 81 75 continue; 82 76 } 83 77 84 $result['contributors'][ $ contributor] = array(78 $result['contributors'][ $user->user_nicename ] = array( 85 79 'profile' => $this->get_user_profile_link( $user ), 86 80 'avatar' => get_avatar_url( $user, array( 'default' => 'monsterid', 'rating' => 'g' ) ), -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3226 r3289 373 373 } 374 374 if ( 'plugin_built_for' == $term->taxonomy ) { 375 return $this->package_link( false, $this->get_plugin_post( $term->slug ) ); 375 // Term slug = Post Slug = /%postname%/ 376 return trailingslashit( home_url( $term->slug ) ); 376 377 } 377 378 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/downloads.php
r3288 r3289 12 12 */ 13 13 14 include __DIR__ . '/class-autoloader.php'; 15 Autoloader\register_class_path( __NAMESPACE__, __DIR__ ); 16 14 include dirname( __DIR__ ) . '/class-autoloader.php'; 15 Autoloader\register_class_path( __NAMESPACE__, dirname( __DIR__ ) ); 17 16 $serve = new Zip\Serve();
Note: See TracChangeset
for help on using the changeset viewer.