Ticket #27440: 27440-return-and-display-banners.13-alt.diff
File 27440-return-and-display-banners.13-alt.diff, 13.2 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/plugin-install.php
311 311 function install_plugin_information() { 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 ) ) 317 317 wp_die( $api ); … … 331 331 'faq' => _x('FAQ', 'Plugin installer section title'), 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 ); 336 337 … … 354 355 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 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"; 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 ] ) ) 363 386 $title = $plugins_section_titles[ $section_name ]; … … 374 397 echo "</div>\n"; 375 398 376 399 ?> 377 <div id="<?php echo $_tab; ?>-content"> 378 <div class="fyi"> 379 <ul> 380 <?php if ( ! empty( $api->version ) ) : ?> 381 <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li> 382 <?php endif; if ( ! empty( $api->author ) ) : ?> 383 <li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li> 384 <?php endif; if ( ! empty( $api->last_updated ) ) : ?> 385 <li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php 386 printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li> 387 <?php endif; if ( ! empty( $api->requires ) ) : ?> 388 <li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li> 389 <?php endif; if ( ! empty( $api->tested ) ) : ?> 390 <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li> 391 <?php endif; if ( ! empty( $api->downloaded ) ) : ?> 392 <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li> 393 <?php endif; if ( ! empty( $api->slug ) && empty( $api->external ) ) : ?> 394 <li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page »') ?></a></li> 395 <?php endif; if ( ! empty( $api->homepage ) ) : ?> 396 <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage »') ?></a></li> 397 <?php endif; ?> 398 </ul> 399 <?php if ( ! empty( $api->rating ) ) : ?> 400 <h3><?php _e('Average Rating') ?></h3> 401 <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?> 402 <small><?php printf( _n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings) ); ?></small> 403 <?php endif; ?> 404 </div> 400 <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'> 405 401 <div id="section-holder" class="wrap"> 406 402 <?php 407 403 if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) … … 423 419 echo $content; 424 420 echo "\t</div>\n"; 425 421 } 422 ?> 423 </div> 424 <div class="fyi"> 425 <ul> 426 <?php if ( ! empty( $api->version ) ) : ?> 427 <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li> 428 <?php endif; if ( ! empty( $api->author ) ) : ?> 429 <li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li> 430 <?php endif; if ( ! empty( $api->last_updated ) ) : ?> 431 <li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php 432 printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li> 433 <?php endif; if ( ! empty( $api->requires ) ) : ?> 434 <li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li> 435 <?php endif; if ( ! empty( $api->tested ) ) : ?> 436 <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li> 437 <?php endif; if ( ! empty( $api->downloaded ) ) : ?> 438 <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li> 439 <?php endif; if ( ! empty( $api->slug ) && empty( $api->external ) ) : ?> 440 <li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page »') ?></a></li> 441 <?php endif; if ( ! empty( $api->homepage ) ) : ?> 442 <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage »') ?></a></li> 443 <?php endif;if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) : ?> 444 <li><a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e('Donate to this plugin »') ?></a></li> 445 <?php endif; ?> 446 </ul> 447 <?php if ( ! empty( $api->rating ) ) : ?> 448 <h3><?php _e('Average Rating') ?></h3> 449 <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?> 450 <small><?php printf( _n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings) ); ?></small> 451 <?php endif; ?> 452 <?php 453 if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) { 454 foreach( $api->ratings as $key=>$ratecount ) { 455 // avoid div-by-zero 456 $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0; 457 ?> 458 <div class="counter-container"> 459 <a href="./plugin-install.php?tab=plugin-information&plugin=<?php echo $api->slug; ?>§ion=reviews" 460 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 ) ); ?>" --> 461 <span class="counter-label" style="float:left; margin-right:5px;"><?php echo $key; ?> stars</span> 462 <span class="counter-back" style="height:17px;width:92px;background-color:#ececec;float:left;"> 463 <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;height:17px;background-color:#fddb5a;float:left;"></span> 464 </span> 465 </a> 466 <span class="counter-count" style="margin-left:5px;"><?php echo $ratecount; ?></span> 467 </div> 468 <?php 469 } 470 } 471 if ( ! empty( $api->contributors ) ) : ?> 472 <h3><?php _e('Contributors') ?></h3> 473 <ul class="contributors"> 474 <?php 475 foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) { 476 if ( empty( $contrib_username ) && empty( $contrib_profile ) ) 477 continue; 478 if ( empty( $contrib_username ) ) 479 $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile ); 480 $contrib_username = sanitize_user( $contrib_username ); 481 if ( empty( $contrib_profile ) ) 482 echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>"; 483 else 484 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>"; 485 } 486 ?> 487 </ul> 488 <?php if ( ! empty( $api->donate_link ) ) : ?> 489 <a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e('Donate to this plugin »') ?></a> 490 <?php endif; ?> 491 <?php endif; ?> 492 </div> 493 <?php 426 494 echo "</div>\n"; 427 echo "</div>\n";428 495 echo "<div id='$tab-footer'>\n"; 429 496 if ( ! empty( $api->download_link ) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) { 430 497 $status = install_plugin_install_status($api); -
wp-admin/css/common.css
1799 1799 } 1800 1800 1801 1801 /* Plugin install thickbox */ 1802 .plugin-install-php .tb-close-icon { 1803 color: #444; 1804 background: rgba(255,255,255,.3); 1805 } 1806 1807 .plugin-install-php .tb-close-icon:hover { 1808 color: #2ea2cc; 1809 background: rgba(255,255,255,.6); 1810 } 1811 1802 1812 #plugin-information { 1803 1813 background: #fcfcfc; 1804 1814 position: fixed; … … 1824 1834 white-space: nowrap; 1825 1835 } 1826 1836 1837 #plugin-information-title.with-banner { 1838 height: 250px; 1839 bottom: 250px; 1840 background-size: 100% auto; 1841 } 1842 1843 @media only screen and (max-width: 800px) { 1844 #plugin-information-title.with-banner { 1845 height: 100px; 1846 bottom: 100px; 1847 } 1848 } 1849 1850 #plugin-information-title h2 { 1851 font-family: "Helvetica Neue", sans-serif; 1852 padding:0; 1853 margin: 0; 1854 max-width: 760px; 1855 } 1856 1857 #plugin-information-title.with-banner h2 { 1858 font-size: 30px; 1859 line-height: 50px; 1860 font-weight: bold; 1861 max-width: 760px; 1862 position: absolute; 1863 left: 20px; 1864 top: 145px; 1865 padding: 0 15px; 1866 margin: 0; 1867 color: #fff; 1868 background: rgba( 30, 30, 30, 0.9 ); 1869 text-shadow: 0 1px 3px rgba( 0, 0, 0, 0.4 ); 1870 -webkit-box-shadow: 0 0 30px rgba( 255, 255, 255, 0.1 ); 1871 -moz-box-shadow: 0 0 30px rgba( 255, 255, 255, 0.1 ); 1872 box-shadow: 0 0 30px rgba( 255, 255, 255, 0.1 ); 1873 -webkit-border-radius: 8px; 1874 border-radius: 8px; 1875 } 1876 1877 @media only screen and (max-width: 800px) { 1878 #plugin-information-title.with-banner h2 { 1879 top: 12px; 1880 font-size: 20px; 1881 line-height: 40px; 1882 } 1883 } 1884 1885 #plugin-information-title div.vignette { 1886 display: none; 1887 } 1888 1889 #plugin-information-title.with-banner div.vignette { 1890 display: block; 1891 top: 0; 1892 height: 215px; 1893 width: 830px; 1894 margin: 0 -20px; 1895 background: transparent; 1896 -webkit-box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 ); 1897 -moz-box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 ); 1898 box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 ); 1899 } 1900 1901 @media only screen and (max-width: 800px) { 1902 #plugin-information-title.with-banner div.vignette { 1903 height: 65px; 1904 bottom: 65px; 1905 width: 800%; 1906 } 1907 } 1908 1827 1909 #plugin-information-tabs { 1828 1910 padding: 0 16px; 1829 1911 position: absolute; … … 1834 1916 z-index: 1; 1835 1917 } 1836 1918 1919 #plugin-information-tabs.with-banner { 1920 top: 215px; 1921 background: rgba( 255, 255, 255, 0.8 ); 1922 } 1923 1924 @media only screen and (max-width: 800px) { 1925 #plugin-information-tabs.with-banner { 1926 top:65px; 1927 background: rgba( 255, 255, 255, 0.8 ); 1928 } 1929 } 1930 1837 1931 #plugin-information-tabs a { 1838 1932 position: relative; 1839 1933 float: left; … … 1871 1965 left: 0; 1872 1966 } 1873 1967 1968 #plugin-information-content.with-banner { 1969 top:249px; 1970 } 1971 1972 @media only screen and (max-width: 800px) { 1973 #plugin-information-content.with-banner { 1974 top:99px; 1975 } 1976 } 1977 1874 1978 #section-holder { 1875 1979 margin: 0; 1876 1980 padding: 10px 26px; … … 1887 1991 } 1888 1992 1889 1993 #plugin-information .fyi { 1994 display: none; 1890 1995 background: #f3f3f3; 1891 1996 border-left: 1px solid #ddd; 1892 1997 color: #666; … … 1899 2004 overflow: auto; 1900 2005 } 1901 2006 2007 #plugin-information .fyi { 2008 display: block; 2009 } 2010 1902 2011 #plugin-information .fyi strong { 1903 2012 color: #464646; 1904 2013 } … … 1927 2036 margin: 0 0 10px; 1928 2037 } 1929 2038 2039 #plugin-information .counter-label { 2040 float: left; 2041 margin-right: 5px; 2042 } 2043 2044 #plugin-information .counter-back { 2045 height: 17px; 2046 width: 92px; 2047 background-color: #ececec; 2048 float: left; 2049 } 2050 2051 #plugin-information .counter-bar { 2052 height: 17px; 2053 background-color: #fddb5a; 2054 float: left; 2055 } 2056 2057 #plugin-information .counter-count { 2058 margin-left: 5px; 2059 } 2060 2061 #plugin-information .fyi ul.contributors { 2062 margin-top: 10px; 2063 } 2064 2065 #plugin-information .fyi ul.contributors li { 2066 display: inline-block; 2067 margin-right: 8px; 2068 vertical-align: middle; 2069 } 2070 2071 #plugin-information .fyi ul.contributors li { 2072 display: inline-block; 2073 margin-right: 8px; 2074 vertical-align: middle; 2075 } 2076 2077 #plugin-information .fyi ul.contributors li img { 2078 vertical-align: middle; 2079 margin-right: 4px; 2080 } 2081 1930 2082 #plugin-information-footer { 1931 2083 padding: 15px 16px; 1932 2084 position: absolute;