Improvements to the plugin information modal:
* Whitespace/braces cleanup for [29040]. * Reduce width of modal to 792px, which is the default banner size. * Reduce banner height when screen height is smaller than 500px. * Remove inline CSS. * Re-use tab var in JS. * Encode ampersands in links. props avryl, michalzuber, ocean90. see #27440. Built from https://develop.svn.wordpress.org/trunk@29125 git-svn-id: http://core.svn.wordpress.org/trunk@28910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5940d4527c
commit
8cbada97be
|
@ -1835,13 +1835,6 @@ div.action-links {
|
|||
background-size: 100% auto;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-title.with-banner {
|
||||
height: 100px;
|
||||
bottom: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-title h2 {
|
||||
font-family: "Helvetica Neue", sans-serif;
|
||||
padding:0;
|
||||
|
@ -1868,14 +1861,6 @@ div.action-links {
|
|||
border-radius: 8px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-title.with-banner h2 {
|
||||
top: 12px;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-title div.vignette {
|
||||
display: none;
|
||||
}
|
||||
|
@ -1891,14 +1876,6 @@ div.action-links {
|
|||
box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 );
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-title.with-banner div.vignette {
|
||||
height: 65px;
|
||||
bottom: 65px;
|
||||
width: 800%;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-tabs {
|
||||
padding: 0 16px;
|
||||
position: absolute;
|
||||
|
@ -1910,20 +1887,14 @@ div.action-links {
|
|||
}
|
||||
|
||||
#plugin-information-tabs.with-banner {
|
||||
top: 215px;
|
||||
top: 214px;
|
||||
background: rgba( 255, 255, 255, 0.85 );
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-tabs.with-banner {
|
||||
top: 65px;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-tabs a {
|
||||
position: relative;
|
||||
float: right;
|
||||
padding: 8px 10px 9px;
|
||||
padding: 9px 10px;
|
||||
margin: 0;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
|
@ -1934,13 +1905,19 @@ div.action-links {
|
|||
}
|
||||
|
||||
#plugin-information-tabs a.current {
|
||||
margin: -1px -1px 0;
|
||||
margin: 0 -1px 0;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom: none;
|
||||
padding-top: 8px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#plugin-information-tabs.with-banner a.current {
|
||||
border-top: none;
|
||||
padding-top: 9px;
|
||||
}
|
||||
|
||||
#plugin-information-tabs a:active,
|
||||
#plugin-information-tabs a:focus {
|
||||
outline: none;
|
||||
|
@ -1951,20 +1928,16 @@ div.action-links {
|
|||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
position: absolute;
|
||||
top: 90px;
|
||||
top: 91px;
|
||||
left: 0;
|
||||
bottom: 58px;
|
||||
right: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#plugin-information-content.with-banner {
|
||||
top:249px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-content.with-banner {
|
||||
top:99px;
|
||||
}
|
||||
border-top: none;
|
||||
top: 250px;
|
||||
}
|
||||
|
||||
#section-holder {
|
||||
|
@ -2024,6 +1997,10 @@ div.action-links {
|
|||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
#plugin-information .counter-container {
|
||||
margin: 3px 0;
|
||||
}
|
||||
|
||||
#plugin-information .counter-label {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
|
@ -2118,10 +2095,36 @@ div.action-links {
|
|||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 782px ) {
|
||||
#plugin-information-content {
|
||||
overflow: auto;
|
||||
bottom: 58px;
|
||||
@media screen and ( max-width: 771px ), screen and ( max-height: 500px ) {
|
||||
#plugin-information-title.with-banner {
|
||||
height: 100px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
#plugin-information-title.with-banner h2 {
|
||||
top: 12px;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
#plugin-information-title.with-banner div.vignette {
|
||||
height: 65px;
|
||||
bottom: 65px;
|
||||
width: 800%;
|
||||
}
|
||||
|
||||
#plugin-information-tabs.with-banner {
|
||||
top: 63px;
|
||||
}
|
||||
|
||||
#plugin-information-content.with-banner {
|
||||
top: 99px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 771px ) {
|
||||
#plugin-information-tabs {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#plugin-information .fyi {
|
||||
|
|
|
@ -1835,13 +1835,6 @@ div.action-links {
|
|||
background-size: 100% auto;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-title.with-banner {
|
||||
height: 100px;
|
||||
bottom: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-title h2 {
|
||||
font-family: "Helvetica Neue", sans-serif;
|
||||
padding:0;
|
||||
|
@ -1868,14 +1861,6 @@ div.action-links {
|
|||
border-radius: 8px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-title.with-banner h2 {
|
||||
top: 12px;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-title div.vignette {
|
||||
display: none;
|
||||
}
|
||||
|
@ -1891,14 +1876,6 @@ div.action-links {
|
|||
box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 );
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-title.with-banner div.vignette {
|
||||
height: 65px;
|
||||
bottom: 65px;
|
||||
width: 800%;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-tabs {
|
||||
padding: 0 16px;
|
||||
position: absolute;
|
||||
|
@ -1910,20 +1887,14 @@ div.action-links {
|
|||
}
|
||||
|
||||
#plugin-information-tabs.with-banner {
|
||||
top: 215px;
|
||||
top: 214px;
|
||||
background: rgba( 255, 255, 255, 0.85 );
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-tabs.with-banner {
|
||||
top: 65px;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-information-tabs a {
|
||||
position: relative;
|
||||
float: left;
|
||||
padding: 8px 10px 9px;
|
||||
padding: 9px 10px;
|
||||
margin: 0;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
|
@ -1934,13 +1905,19 @@ div.action-links {
|
|||
}
|
||||
|
||||
#plugin-information-tabs a.current {
|
||||
margin: -1px -1px 0;
|
||||
margin: 0 -1px 0;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom: none;
|
||||
padding-top: 8px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#plugin-information-tabs.with-banner a.current {
|
||||
border-top: none;
|
||||
padding-top: 9px;
|
||||
}
|
||||
|
||||
#plugin-information-tabs a:active,
|
||||
#plugin-information-tabs a:focus {
|
||||
outline: none;
|
||||
|
@ -1951,20 +1928,16 @@ div.action-links {
|
|||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
position: absolute;
|
||||
top: 90px;
|
||||
top: 91px;
|
||||
right: 0;
|
||||
bottom: 58px;
|
||||
left: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#plugin-information-content.with-banner {
|
||||
top:249px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
#plugin-information-content.with-banner {
|
||||
top:99px;
|
||||
}
|
||||
border-top: none;
|
||||
top: 250px;
|
||||
}
|
||||
|
||||
#section-holder {
|
||||
|
@ -2024,6 +1997,10 @@ div.action-links {
|
|||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
#plugin-information .counter-container {
|
||||
margin: 3px 0;
|
||||
}
|
||||
|
||||
#plugin-information .counter-label {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
|
@ -2118,10 +2095,36 @@ div.action-links {
|
|||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 782px ) {
|
||||
#plugin-information-content {
|
||||
overflow: auto;
|
||||
bottom: 58px;
|
||||
@media screen and ( max-width: 771px ), screen and ( max-height: 500px ) {
|
||||
#plugin-information-title.with-banner {
|
||||
height: 100px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
#plugin-information-title.with-banner h2 {
|
||||
top: 12px;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
#plugin-information-title.with-banner div.vignette {
|
||||
height: 65px;
|
||||
bottom: 65px;
|
||||
width: 800%;
|
||||
}
|
||||
|
||||
#plugin-information-tabs.with-banner {
|
||||
top: 63px;
|
||||
}
|
||||
|
||||
#plugin-information-content.with-banner {
|
||||
top: 99px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 771px ) {
|
||||
#plugin-information-tabs {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#plugin-information .fyi {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -311,10 +311,15 @@ function install_plugin_install_status($api, $loop = false) {
|
|||
function install_plugin_information() {
|
||||
global $tab;
|
||||
|
||||
$api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl(), 'fields' => array( 'banners' => true, 'reviews' => true ) ) );
|
||||
$api = plugins_api( 'plugin_information', array(
|
||||
'slug' => wp_unslash( $_REQUEST['plugin'] ),
|
||||
'is_ssl' => is_ssl(),
|
||||
'fields' => array( 'banners' => true, 'reviews' => true )
|
||||
) );
|
||||
|
||||
if ( is_wp_error( $api ) )
|
||||
if ( is_wp_error( $api ) ) {
|
||||
wp_die( $api );
|
||||
}
|
||||
|
||||
$plugins_allowedtags = array(
|
||||
'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
|
||||
|
@ -326,49 +331,50 @@ function install_plugin_information() {
|
|||
);
|
||||
|
||||
$plugins_section_titles = array(
|
||||
'description' => _x('Description', 'Plugin installer section title'),
|
||||
'installation' => _x('Installation', 'Plugin installer section title'),
|
||||
'faq' => _x('FAQ', 'Plugin installer section title'),
|
||||
'screenshots' => _x('Screenshots', 'Plugin installer section title'),
|
||||
'changelog' => _x('Changelog', 'Plugin installer section title'),
|
||||
'reviews' => _x('Reviews', 'Plugin installer section title'),
|
||||
'other_notes' => _x('Other Notes', 'Plugin installer section title')
|
||||
'description' => _x( 'Description', 'Plugin installer section title' ),
|
||||
'installation' => _x( 'Installation', 'Plugin installer section title' ),
|
||||
'faq' => _x( 'FAQ', 'Plugin installer section title' ),
|
||||
'screenshots' => _x( 'Screenshots', 'Plugin installer section title' ),
|
||||
'changelog' => _x( 'Changelog', 'Plugin installer section title' ),
|
||||
'reviews' => _x( 'Reviews', 'Plugin installer section title' ),
|
||||
'other_notes' => _x( 'Other Notes', 'Plugin installer section title' )
|
||||
);
|
||||
|
||||
//Sanitize HTML
|
||||
foreach ( (array)$api->sections as $section_name => $content ) {
|
||||
$api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
|
||||
// Sanitize HTML
|
||||
foreach ( (array) $api->sections as $section_name => $content ) {
|
||||
$api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
|
||||
}
|
||||
|
||||
foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
|
||||
if ( isset( $api->$key ) )
|
||||
if ( isset( $api->$key ) ) {
|
||||
$api->$key = wp_kses( $api->$key, $plugins_allowedtags );
|
||||
}
|
||||
}
|
||||
|
||||
$_tab = esc_attr( $tab );
|
||||
|
||||
$section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
|
||||
$section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
|
||||
if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
|
||||
$section_titles = array_keys( (array) $api->sections );
|
||||
$section = array_shift( $section_titles );
|
||||
}
|
||||
|
||||
iframe_header( __('Plugin Install') );
|
||||
iframe_header( __( 'Plugin Install' ) );
|
||||
|
||||
$_with_banner = '';
|
||||
|
||||
if ( !empty( $api->banners ) && ( !empty( $api->banners['low'] ) || !empty( $api->banners['high'] ) ) ) {
|
||||
if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
|
||||
$_with_banner = 'with-banner';
|
||||
$low = ( !empty( $api->banners['low'] ) ) ? $api->banners['low'] : $api->banners['high'];
|
||||
$high = ( !empty( $api->banners['high'] ) ) ? $api->banners['high'] : $api->banners['low'];
|
||||
$low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
|
||||
$high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
|
||||
?>
|
||||
<style type="text/css">
|
||||
#plugin-information-title.with-banner {
|
||||
background-image: url(<?php echo $low ?>);
|
||||
background-image: url( <?php echo esc_url( $low ); ?> );
|
||||
}
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
|
||||
@media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) {
|
||||
#plugin-information-title.with-banner {
|
||||
background-image: url(<?php echo $high ?>});
|
||||
background-image: url( <?php echo esc_url( $high ); ?> );
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -378,16 +384,18 @@ function install_plugin_information() {
|
|||
echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
|
||||
echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
|
||||
|
||||
foreach ( (array)$api->sections as $section_name => $content ) {
|
||||
if ( 'reviews' == $section_name && ( empty( $api->ratings ) || 0 == array_sum( (array) $api->ratings ) ) )
|
||||
foreach ( (array) $api->sections as $section_name => $content ) {
|
||||
if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $plugins_section_titles[ $section_name ] ) )
|
||||
if ( isset( $plugins_section_titles[ $section_name ] ) ) {
|
||||
$title = $plugins_section_titles[ $section_name ];
|
||||
else
|
||||
} else {
|
||||
$title = ucwords( str_replace( '_', ' ', $section_name ) );
|
||||
}
|
||||
|
||||
$class = ( $section_name == $section ) ? ' class="current"' : '';
|
||||
$class = ( $section_name === $section ) ? ' class="current"' : '';
|
||||
$href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
|
||||
$href = esc_url( $href );
|
||||
$san_section = esc_attr( $section_name );
|
||||
|
@ -400,89 +408,92 @@ function install_plugin_information() {
|
|||
<div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
|
||||
<div class="fyi">
|
||||
<ul>
|
||||
<?php if ( ! empty( $api->version ) ) : ?>
|
||||
<li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>
|
||||
<?php endif; if ( ! empty( $api->author ) ) : ?>
|
||||
<li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li>
|
||||
<?php endif; if ( ! empty( $api->last_updated ) ) : ?>
|
||||
<li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
|
||||
printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
|
||||
<?php endif; if ( ! empty( $api->requires ) ) : ?>
|
||||
<li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li>
|
||||
<?php endif; if ( ! empty( $api->tested ) ) : ?>
|
||||
<li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>
|
||||
<?php endif; if ( ! empty( $api->downloaded ) ) : ?>
|
||||
<li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
|
||||
<?php endif; if ( ! empty( $api->slug ) && empty( $api->external ) ) : ?>
|
||||
<li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page »') ?></a></li>
|
||||
<?php endif; if ( ! empty( $api->homepage ) ) : ?>
|
||||
<li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage »') ?></a></li>
|
||||
<?php endif;if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) : ?>
|
||||
<li><a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e('Donate to this plugin »') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $api->version ) ) { ?>
|
||||
<li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li>
|
||||
<?php } if ( ! empty( $api->author ) ) { ?>
|
||||
<li><strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?></li>
|
||||
<?php } if ( ! empty( $api->last_updated ) ) { ?>
|
||||
<li><strong><?php _e( 'Last Updated:' ); ?></strong> <span title="<?php echo $api->last_updated; ?>">
|
||||
<?php printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) ); ?>
|
||||
</span></li>
|
||||
<?php } if ( ! empty( $api->requires ) ) { ?>
|
||||
<li><strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?></li>
|
||||
<?php } if ( ! empty( $api->tested ) ) { ?>
|
||||
<li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?></li>
|
||||
<?php } if ( ! empty( $api->downloaded ) ) { ?>
|
||||
<li><strong><?php _e( 'Downloaded:' ); ?></strong> <?php printf( _n( '%s time', '%s times', $api->downloaded ), number_format_i18n( $api->downloaded ) ); ?></li>
|
||||
<?php } if ( ! empty( $api->slug ) && empty( $api->external ) ) { ?>
|
||||
<li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page »' ); ?></a></li>
|
||||
<?php } if ( ! empty( $api->homepage ) ) { ?>
|
||||
<li><a target="_blank" href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage »' ); ?></a></li>
|
||||
<?php } if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) { ?>
|
||||
<li><a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e( 'Donate to this plugin »' ); ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php if ( ! empty( $api->rating ) ) : ?>
|
||||
<h3><?php _e('Average Rating') ?></h3>
|
||||
<?php if ( ! empty( $api->rating ) ) { ?>
|
||||
<h3><?php _e( 'Average Rating' ); ?></h3>
|
||||
<?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
|
||||
<small><?php printf( _n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings) ); ?></small>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
<small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
|
||||
<?php }
|
||||
|
||||
if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
|
||||
foreach( $api->ratings as $key=>$ratecount ) {
|
||||
foreach( $api->ratings as $key => $ratecount ) {
|
||||
// avoid div-by-zero
|
||||
$_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
|
||||
?>
|
||||
<div class="counter-container">
|
||||
<a href="./plugin-install.php?tab=plugin-information&plugin=<?php echo $api->slug; ?>§ion=reviews"
|
||||
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 ) ); ?>" -->
|
||||
<span class="counter-label" style="float:left; margin-right:5px;"><?php echo $key; ?> stars</span>
|
||||
<span class="counter-back" style="height:17px;width:92px;background-color:#ececec;float:left;">
|
||||
<span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;height:17px;background-color:#fddb5a;float:left;"></span>
|
||||
<a href="<?php echo esc_url( self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $api->slug . '&section=reviews' ) ); ?>"
|
||||
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 ) ); ?>">
|
||||
<span class="counter-label"><?php echo $key; ?> stars</span>
|
||||
<span class="counter-back">
|
||||
<span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
|
||||
</span>
|
||||
</a>
|
||||
<span class="counter-count" style="margin-left:5px;"><?php echo $ratecount; ?></span>
|
||||
<span class="counter-count"><?php echo $ratecount; ?></span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
if ( ! empty( $api->contributors ) ) : ?>
|
||||
<h3><?php _e('Contributors') ?></h3>
|
||||
if ( ! empty( $api->contributors ) ) { ?>
|
||||
<h3><?php _e( 'Contributors' ); ?></h3>
|
||||
<ul class="contributors">
|
||||
<?php
|
||||
foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
|
||||
if ( empty( $contrib_username ) && empty( $contrib_profile ) )
|
||||
if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
|
||||
continue;
|
||||
if ( empty( $contrib_username ) )
|
||||
}
|
||||
if ( empty( $contrib_username ) ) {
|
||||
$contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
|
||||
}
|
||||
$contrib_username = sanitize_user( $contrib_username );
|
||||
if ( empty( $contrib_profile ) )
|
||||
echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>";
|
||||
else
|
||||
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>";
|
||||
if ( empty( $contrib_profile ) ) {
|
||||
echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>";
|
||||
} else {
|
||||
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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php if ( ! empty( $api->donate_link ) ) : ?>
|
||||
<a target="_blank" href="<?php echo $api->donate_link ?>"><?php _e('Donate to this plugin »') ?></a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $api->donate_link ) ) { ?>
|
||||
<a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin »' ); ?></a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div id="section-holder" class="wrap">
|
||||
<?php
|
||||
if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) )
|
||||
if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
|
||||
echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
|
||||
|
||||
else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) )
|
||||
} else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
|
||||
echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
|
||||
}
|
||||
|
||||
foreach ( (array)$api->sections as $section_name => $content ) {
|
||||
|
||||
foreach ( (array) $api->sections as $section_name => $content ) {
|
||||
$content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
|
||||
$content = links_add_target( $content, '_blank' );
|
||||
|
||||
$san_section = esc_attr( $section_name );
|
||||
|
||||
$display = ( $section_name == $section ) ? 'block' : 'none';
|
||||
$display = ( $section_name === $section ) ? 'block' : 'none';
|
||||
|
||||
echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
|
||||
echo $content;
|
||||
|
@ -491,22 +502,24 @@ function install_plugin_information() {
|
|||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
echo "<div id='$tab-footer'>\n";
|
||||
if ( ! empty( $api->download_link ) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) {
|
||||
$status = install_plugin_install_status($api);
|
||||
if ( ! empty( $api->download_link ) && ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
|
||||
$status = install_plugin_install_status( $api );
|
||||
switch ( $status['status'] ) {
|
||||
case 'install':
|
||||
if ( $status['url'] )
|
||||
echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
|
||||
if ( $status['url'] ) {
|
||||
echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
|
||||
}
|
||||
break;
|
||||
case 'update_available':
|
||||
if ( $status['url'] )
|
||||
echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
|
||||
if ( $status['url'] ) {
|
||||
echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';
|
||||
}
|
||||
break;
|
||||
case 'newer_installed':
|
||||
echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
|
||||
echo '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed'), $status['version'] ) . '</a>';
|
||||
break;
|
||||
case 'latest_installed':
|
||||
echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>';
|
||||
echo '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ jQuery( document ).ready( function( $ ) {
|
|||
tb_position = function() {
|
||||
var tbWindow = $( '#TB_window' ),
|
||||
width = $( window ).width(),
|
||||
H = $( window ).height() - ( ( 850 < width ) ? 60 : 20 ),
|
||||
W = ( 850 < width ) ? 830 : width - 20;
|
||||
H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ),
|
||||
W = ( 792 < width ) ? 772 : width - 20;
|
||||
|
||||
if ( tbWindow.size() ) {
|
||||
tbWindow.width( W ).height( H );
|
||||
|
@ -17,7 +17,7 @@ jQuery( document ).ready( function( $ ) {
|
|||
});
|
||||
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
|
||||
tbWindow.css({
|
||||
'top': ( ( 850 < width ) ? 30 : 10 ) + 'px',
|
||||
'top': ( ( 792 < width ) ? 30 : 10 ) + 'px',
|
||||
'margin-top': '0'
|
||||
});
|
||||
}
|
||||
|
@ -46,20 +46,24 @@ jQuery( document ).ready( function( $ ) {
|
|||
return false;
|
||||
});
|
||||
|
||||
/* Plugin install related JS*/
|
||||
/* Plugin install related JS */
|
||||
$( '#plugin-information-tabs a' ).click( function( event ) {
|
||||
var tab = $( this ).attr( 'name' );
|
||||
event.preventDefault();
|
||||
//Flip the tab
|
||||
|
||||
// Flip the tab
|
||||
$( '#plugin-information-tabs a.current' ).removeClass( 'current' );
|
||||
$( this ).addClass( 'current' );
|
||||
//Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
|
||||
if ( 'description' != $( this ).attr( 'name' ) && $( 'body').width() < 830 )
|
||||
$( '#plugin-information-content div.fyi' ).hide();
|
||||
else
|
||||
$( '#plugin-information-content div.fyi' ).show();
|
||||
//Flip the content.
|
||||
$( '#section-holder div.section' ).hide(); //Hide 'em all
|
||||
|
||||
// Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
|
||||
if ( 'description' !== tab && $( window ).width() < 772 ) {
|
||||
$( '#plugin-information-content' ).find( '.fyi' ).hide();
|
||||
} else {
|
||||
$( '#plugin-information-content' ).find( '.fyi' ).show();
|
||||
}
|
||||
|
||||
// Flip the content.
|
||||
$( '#section-holder div.section' ).hide(); // Hide 'em all.
|
||||
$( '#section-' + tab ).show();
|
||||
});
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height()-(c>850?60:20),e=c>850?830:c-20;return b.size()&&(b.width(e).height(d),a("#TB_iframeContent").width(e).height(d),b.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:(c>850?30:10)+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+e+"&height="+d))})},a(window).resize(function(){tb_position()}),a(".plugins").on("click","a.thickbox",function(){return tb_click.call(this),a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"}),a("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong> "+a(this).attr("title")),!1}),a("#plugin-information-tabs a").click(function(b){var c=a(this).attr("name");b.preventDefault(),a("#plugin-information-tabs a.current").removeClass("current"),a(this).addClass("current"),"description"!=a(this).attr("name")&&a("body").width()<830?a("#plugin-information-content div.fyi").hide():a("#plugin-information-content div.fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()}),a("a.install-now").click(function(){return confirm(plugininstallL10n.ays)})});
|
||||
var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height()-(c>792?60:20),e=c>792?772:c-20;return b.size()&&(b.width(e).height(d),a("#TB_iframeContent").width(e).height(d),b.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:(c>792?30:10)+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+e+"&height="+d))})},a(window).resize(function(){tb_position()}),a(".plugins").on("click","a.thickbox",function(){return tb_click.call(this),a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"}),a("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong> "+a(this).attr("title")),!1}),a("#plugin-information-tabs a").click(function(b){var c=a(this).attr("name");b.preventDefault(),a("#plugin-information-tabs a.current").removeClass("current"),a(this).addClass("current"),"description"!==c&&a(window).width()<772?a("#plugin-information-content").find(".fyi").hide():a("#plugin-information-content").find(".fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()}),a("a.install-now").click(function(){return confirm(plugininstallL10n.ays)})});
|
Loading…
Reference in New Issue