Changeset 3020
- Timestamp:
- 04/27/2016 08:08:11 AM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php
r2994 r3020 13 13 static function load_routes() { 14 14 new Routes\Internal_Stats(); 15 new Routes\Plugin(); 15 16 } 16 17 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3011 r3020 386 386 */ 387 387 public function filter_post_content_to_correct_page( $content ) { 388 if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { 389 return $content; 390 } 388 391 if ( 'plugin' === get_post()->post_type ) { 389 392 $page = get_query_var( 'content_page' ); … … 504 507 return $post; 505 508 } 509 510 // TODO: Add caching here. 506 511 507 512 // get_post_by_slug(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r3009 r3020 67 67 * @return array 68 68 */ 69 static function get_plugin_sections( ) {70 $plugin = get_post( );69 static function get_plugin_sections( $post = null ) { 70 $plugin = get_post( $post ); 71 71 $plugin_slug = $plugin->post_name; 72 72 … … 173 173 $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true ); 174 174 175 $icon = $icon_2x = $ vector= $generated = false;175 $icon = $icon_2x = $svg = $generated = false; 176 176 foreach ( $raw_icons as $file => $info ) { 177 177 switch ( $info['resolution'] ) { … … 184 184 break; 185 185 186 /* false = the resolution of the icon, this is NOT disabled */ 186 187 case false && 'icon.svg' == $file: 187 $icon = self::get_asset_url( $plugin_slug, $info ); 188 $vector = true; 189 break; 190 } 188 $svg = self::get_asset_url( $plugin_slug, $info ); 189 break; 190 } 191 } 192 193 if ( ! $icon && $svg ) { 194 $icon = $svg; 191 195 } 192 196 … … 223 227 case 'raw': 224 228 default: 225 return compact( ' icon', 'icon_2x', 'vector', 'generated' );229 return compact( 'svg', 'icon', 'icon_2x', 'generated' ); 226 230 } 227 231 } … … 333 337 return $output; 334 338 } 335 339 340 /** 341 * Generate a Download link for a given plugin & version. 342 * 343 * @param \WP_Post $post The Plugin Post. 344 * @param string $version The version to link to. Optional. Default: latest. 345 * @return string The Download URL. 346 */ 347 static function download_link( $post = null, $version = 'latest' ) { 348 $post = get_post( $post ); 349 350 if ( 'latest' == $version || 'latest-stable' == $version ) { 351 $version = get_post_meta( $post->ID, 'stable_tag', true ); 352 } 353 354 if ( 'trunk' != $version ) { 355 return sprintf( "https://downloads.wordpress.org/plugin/%s.%s.zip", $post->post_name, $version ); 356 } else { 357 return sprintf( "https://downloads.wordpress.org/plugin/%s.zip", $post->post_name ); 358 } 359 } 336 360 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-ratings.php
r3012 r3020 89 89 var $rating = $( '.user-rating div' ), 90 90 $stars = $rating.find( '.dashicons' ), 91 current_rating = $rating.data( 'rating'),91 current_rating = $rating.data( 'rating' ), 92 92 rating_clear_timer = 0; 93 93 … … 99 99 100 100 if ( rating_clear_timer ) { 101 rating_clear_timer = clearTimeout( rating_clear_timer ); 101 clearTimeout( rating_clear_timer ); 102 rating_clear_timer = 0; 102 103 } 103 104 … … 115 116 $rating.mouseout( function() { 116 117 var clear_callback = function() { 117 var rating = $rating.data( 'rating');118 var rating = $rating.data( 'rating' ); 118 119 if ( rating == current_rating ) { 119 120 return;
Note: See TracChangeset
for help on using the changeset viewer.