Changeset 29040 for trunk/src/wp-admin/includes/plugin-install.php
- Timestamp:
- 07/09/2014 05:27:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin-install.php
r28749 r29040 312 312 global $tab; 313 313 314 $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl() ) );314 $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl(), 'fields' => array( 'banners' => true, 'reviews' => true ) ) ); 315 315 316 316 if ( is_wp_error( $api ) ) … … 332 332 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 333 333 'changelog' => _x('Changelog', 'Plugin installer section title'), 334 'reviews' => _x('Reviews', 'Plugin installer section title'), 334 335 'other_notes' => _x('Other Notes', 'Plugin installer section title') 335 336 ); … … 355 356 iframe_header( __('Plugin Install') ); 356 357 357 echo "<div id='{$_tab}-title'>{$api->name}</div>"; 358 echo "<div id='{$_tab}-tabs'>\n"; 358 $_with_banner = ''; 359 360 if ( !empty( $api->banners ) && ( !empty( $api->banners['low'] ) || !empty( $api->banners['high'] ) ) ) { 361 $_with_banner = 'with-banner'; 362 $low = ( !empty( $api->banners['low'] ) ) ? $api->banners['low'] : $api->banners['high']; 363 $high = ( !empty( $api->banners['high'] ) ) ? $api->banners['high'] : $api->banners['low']; 364 ?> 365 <style type="text/css"> 366 #plugin-information-title.with-banner { 367 background-image: url(<?php echo $low ?>); 368 } 369 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) { 370 #plugin-information-title.with-banner { 371 background-image: url(<?php echo $high ?>}); 372 } 373 } 374 </style> 375 <?php 376 } 377 378 echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>"; 379 echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n"; 359 380 360 381 foreach ( (array)$api->sections as $section_name => $content ) { 382 if ( 'reviews' == $section_name && ( empty( $api->ratings ) || 0 == array_sum( (array) $api->ratings ) ) ) 383 continue; 361 384 362 385 if ( isset( $plugins_section_titles[ $section_name ] ) ) … … 375 398 376 399 ?> 377 <div id="<?php echo $_tab; ?>-content" >400 <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'> 378 401 <div class="fyi"> 379 402 <ul> … … 395 418 <?php endif; if ( ! empty( $api->homepage ) ) : ?> 396 419 <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage »') ?></a></li> 420 <?php endif;if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) : ?> 421 <li><a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e('Donate to this plugin »') ?></a></li> 397 422 <?php endif; ?> 398 423 </ul> … … 401 426 <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?> 402 427 <small><?php printf( _n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings) ); ?></small> 428 <?php endif; ?> 429 <?php 430 if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) { 431 foreach( $api->ratings as $key=>$ratecount ) { 432 // avoid div-by-zero 433 $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0; 434 ?> 435 <div class="counter-container"> 436 <a href="./plugin-install.php?tab=plugin-information&plugin=<?php echo $api->slug; ?>§ion=reviews" 437 title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key ), $key ) ); ?>" --> 438 <span class="counter-label" style="float:left; margin-right:5px;"><?php echo $key; ?> stars</span> 439 <span class="counter-back" style="height:17px;width:92px;background-color:#ececec;float:left;"> 440 <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;height:17px;background-color:#fddb5a;float:left;"></span> 441 </span> 442 </a> 443 <span class="counter-count" style="margin-left:5px;"><?php echo $ratecount; ?></span> 444 </div> 445 <?php 446 } 447 } 448 if ( ! empty( $api->contributors ) ) : ?> 449 <h3><?php _e('Contributors') ?></h3> 450 <ul class="contributors"> 451 <?php 452 foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) { 453 if ( empty( $contrib_username ) && empty( $contrib_profile ) ) 454 continue; 455 if ( empty( $contrib_username ) ) 456 $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile ); 457 $contrib_username = sanitize_user( $contrib_username ); 458 if ( empty( $contrib_profile ) ) 459 echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>"; 460 else 461 echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>"; 462 } 463 ?> 464 </ul> 465 <?php if ( ! empty( $api->donate_link ) ) : ?> 466 <a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e('Donate to this plugin »') ?></a> 467 <?php endif; ?> 403 468 <?php endif; ?> 404 469 </div>
Note: See TracChangeset
for help on using the changeset viewer.