<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29125] trunk/src/wp-admin: Improvements to the plugin information modal:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29125">29125</a></dd>
<dt>Author</dt> <dd>ocean90</dd>
<dt>Date</dt> <dd>2014-07-12 22:07:16 +0000 (Sat, 12 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improvements to the plugin information modal:
* Whitespace/braces cleanup for <a href="http://core.trac.wordpress.org/changeset/29040">[29040]</a>.
* 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 <a href="http://core.trac.wordpress.org/ticket/27440">#27440</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsscommoncss">trunk/src/wp-admin/css/common.css</a></li>
<li><a href="#trunksrcwpadminincludesplugininstallphp">trunk/src/wp-admin/includes/plugin-install.php</a></li>
<li><a href="#trunksrcwpadminjsplugininstalljs">trunk/src/wp-admin/js/plugin-install.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsscommoncss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/common.css (29124 => 29125)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/common.css 2014-07-12 19:48:24 UTC (rev 29124)
+++ trunk/src/wp-admin/css/common.css 2014-07-12 22:07:16 UTC (rev 29125)
</span><span class="lines">@@ -1835,13 +1835,6 @@
</span><span class="cx"> background-size: 100% auto;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 800px) {
- #plugin-information-title.with-banner {
- height: 100px;
- bottom: 100px;
- }
-}
-
</del><span class="cx"> #plugin-information-title h2 {
</span><span class="cx"> font-family: "Helvetica Neue", sans-serif;
</span><span class="cx"> padding:0;
</span><span class="lines">@@ -1868,14 +1861,6 @@
</span><span class="cx"> border-radius: 8px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 800px) {
- #plugin-information-title.with-banner h2 {
- top: 12px;
- font-size: 20px;
- line-height: 40px;
- }
-}
-
</del><span class="cx"> #plugin-information-title div.vignette {
</span><span class="cx"> display: none;
</span><span class="cx"> }
</span><span class="lines">@@ -1891,14 +1876,6 @@
</span><span class="cx"> box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 800px) {
- #plugin-information-title.with-banner div.vignette {
- height: 65px;
- bottom: 65px;
- width: 800%;
- }
-}
-
</del><span class="cx"> #plugin-information-tabs {
</span><span class="cx"> padding: 0 16px;
</span><span class="cx"> position: absolute;
</span><span class="lines">@@ -1910,20 +1887,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #plugin-information-tabs.with-banner {
</span><del>- top: 215px;
</del><ins>+ top: 214px;
</ins><span class="cx"> background: rgba( 255, 255, 255, 0.85 );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 800px) {
- #plugin-information-tabs.with-banner {
- top: 65px;
- }
-}
-
</del><span class="cx"> #plugin-information-tabs a {
</span><span class="cx"> position: relative;
</span><span class="cx"> float: left;
</span><del>- padding: 8px 10px 9px;
</del><ins>+ padding: 9px 10px;
</ins><span class="cx"> margin: 0;
</span><span class="cx"> height: 18px;
</span><span class="cx"> line-height: 18px;
</span><span class="lines">@@ -1934,13 +1905,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #plugin-information-tabs a.current {
</span><del>- margin: -1px -1px 0;
</del><ins>+ margin: 0 -1px 0;
</ins><span class="cx"> background: #fff;
</span><span class="cx"> border: 1px solid #ddd;
</span><span class="cx"> border-bottom: none;
</span><ins>+ padding-top: 8px;
</ins><span class="cx"> color: #333;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#plugin-information-tabs.with-banner a.current {
+ border-top: none;
+ padding-top: 9px;
+}
+
</ins><span class="cx"> #plugin-information-tabs a:active,
</span><span class="cx"> #plugin-information-tabs a:focus {
</span><span class="cx"> outline: none;
</span><span class="lines">@@ -1951,22 +1928,18 @@
</span><span class="cx"> border-top: 1px solid #ddd;
</span><span class="cx"> border-bottom: 1px solid #ddd;
</span><span class="cx"> position: absolute;
</span><del>- top: 90px;
</del><ins>+ top: 91px;
</ins><span class="cx"> right: 0;
</span><span class="cx"> bottom: 58px;
</span><span class="cx"> left: 0;
</span><ins>+ overflow: auto;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #plugin-information-content.with-banner {
</span><del>- top:249px;
</del><ins>+ border-top: none;
+ top: 250px;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 800px) {
- #plugin-information-content.with-banner {
- top:99px;
- }
-}
-
</del><span class="cx"> #section-holder {
</span><span class="cx"> margin: 0;
</span><span class="cx"> padding: 10px 26px;
</span><span class="lines">@@ -2024,6 +1997,10 @@
</span><span class="cx"> margin: 0 0 10px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#plugin-information .counter-container {
+ margin: 3px 0;
+}
+
</ins><span class="cx"> #plugin-information .counter-label {
</span><span class="cx"> float: left;
</span><span class="cx"> margin-right: 5px;
</span><span class="lines">@@ -2118,12 +2095,38 @@
</span><span class="cx"> font-size: 13px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media screen and ( max-width: 782px ) {
- #plugin-information-content {
- overflow: auto;
- bottom: 58px;
</del><ins>+@media screen and ( max-width: 771px ), screen and ( max-height: 500px ) {
+ #plugin-information-title.with-banner {
+ height: 100px;
+ bottom: 100px;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ #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;
+ }
+
</ins><span class="cx"> #plugin-information .fyi {
</span><span class="cx"> border: 1px solid #ddd;
</span><span class="cx"> position: static;
</span></span></pre></div>
<a id="trunksrcwpadminincludesplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/plugin-install.php (29124 => 29125)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/plugin-install.php 2014-07-12 19:48:24 UTC (rev 29124)
+++ trunk/src/wp-admin/includes/plugin-install.php 2014-07-12 22:07:16 UTC (rev 29125)
</span><span class="lines">@@ -311,10 +311,15 @@
</span><span class="cx"> function install_plugin_information() {
</span><span class="cx"> global $tab;
</span><span class="cx">
</span><del>- $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl(), 'fields' => array( 'banners' => true, 'reviews' => true ) ) );
</del><ins>+ $api = plugins_api( 'plugin_information', array(
+ 'slug' => wp_unslash( $_REQUEST['plugin'] ),
+ 'is_ssl' => is_ssl(),
+ 'fields' => array( 'banners' => true, 'reviews' => true )
+ ) );
</ins><span class="cx">
</span><del>- if ( is_wp_error( $api ) )
</del><ins>+ if ( is_wp_error( $api ) ) {
</ins><span class="cx"> wp_die( $api );
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> $plugins_allowedtags = array(
</span><span class="cx"> 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
</span><span class="lines">@@ -326,49 +331,50 @@
</span><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> $plugins_section_titles = array(
</span><del>- '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')
</del><ins>+ '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' )
</ins><span class="cx"> );
</span><span class="cx">
</span><del>- //Sanitize HTML
- foreach ( (array)$api->sections as $section_name => $content ) {
- $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
</del><ins>+ // Sanitize HTML
+ foreach ( (array) $api->sections as $section_name => $content ) {
+ $api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
</span><del>- if ( isset( $api->$key ) )
</del><ins>+ if ( isset( $api->$key ) ) {
</ins><span class="cx"> $api->$key = wp_kses( $api->$key, $plugins_allowedtags );
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $_tab = esc_attr( $tab );
</span><span class="cx">
</span><del>- $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
</del><ins>+ $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
</ins><span class="cx"> if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
</span><span class="cx"> $section_titles = array_keys( (array) $api->sections );
</span><span class="cx"> $section = array_shift( $section_titles );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- iframe_header( __('Plugin Install') );
</del><ins>+ iframe_header( __( 'Plugin Install' ) );
</ins><span class="cx">
</span><span class="cx"> $_with_banner = '';
</span><span class="cx">
</span><del>- if ( !empty( $api->banners ) && ( !empty( $api->banners['low'] ) || !empty( $api->banners['high'] ) ) ) {
</del><ins>+ if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
</ins><span class="cx"> $_with_banner = 'with-banner';
</span><del>- $low = ( !empty( $api->banners['low'] ) ) ? $api->banners['low'] : $api->banners['high'];
- $high = ( !empty( $api->banners['high'] ) ) ? $api->banners['high'] : $api->banners['low'];
</del><ins>+ $low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
+ $high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
</ins><span class="cx"> ?>
</span><span class="cx"> <style type="text/css">
</span><span class="cx"> #plugin-information-title.with-banner {
</span><del>- background-image: url(<?php echo $low ?>);
</del><ins>+ background-image: url( <?php echo esc_url( $low ); ?> );
</ins><span class="cx"> }
</span><del>- @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
</del><ins>+ @media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) {
</ins><span class="cx"> #plugin-information-title.with-banner {
</span><del>- background-image: url(<?php echo $high ?>});
</del><ins>+ background-image: url( <?php echo esc_url( $high ); ?> );
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> </style>
</span><span class="lines">@@ -378,16 +384,18 @@
</span><span class="cx"> echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
</span><span class="cx"> echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
</span><span class="cx">
</span><del>- foreach ( (array)$api->sections as $section_name => $content ) {
- if ( 'reviews' == $section_name && ( empty( $api->ratings ) || 0 == array_sum( (array) $api->ratings ) ) )
</del><ins>+ foreach ( (array) $api->sections as $section_name => $content ) {
+ if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
</ins><span class="cx"> continue;
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( isset( $plugins_section_titles[ $section_name ] ) )
</del><ins>+ if ( isset( $plugins_section_titles[ $section_name ] ) ) {
</ins><span class="cx"> $title = $plugins_section_titles[ $section_name ];
</span><del>- else
</del><ins>+ } else {
</ins><span class="cx"> $title = ucwords( str_replace( '_', ' ', $section_name ) );
</span><ins>+ }
</ins><span class="cx">
</span><del>- $class = ( $section_name == $section ) ? ' class="current"' : '';
</del><ins>+ $class = ( $section_name === $section ) ? ' class="current"' : '';
</ins><span class="cx"> $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
</span><span class="cx"> $href = esc_url( $href );
</span><span class="cx"> $san_section = esc_attr( $section_name );
</span><span class="lines">@@ -400,89 +408,92 @@
</span><span class="cx"> <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
</span><span class="cx"> <div class="fyi">
</span><span class="cx"> <ul>
</span><del>-<?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; ?>
</del><ins>+ <?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 } ?>
</ins><span class="cx"> </ul>
</span><del>- <?php if ( ! empty( $api->rating ) ) : ?>
- <h3><?php _e('Average Rating') ?></h3>
</del><ins>+ <?php if ( ! empty( $api->rating ) ) { ?>
+ <h3><?php _e( 'Average Rating' ); ?></h3>
</ins><span class="cx"> <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
</span><del>- <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
</del><ins>+ <small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
+ <?php }
+
</ins><span class="cx"> if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
</span><del>- foreach( $api->ratings as $key=>$ratecount ) {
</del><ins>+ foreach( $api->ratings as $key => $ratecount ) {
</ins><span class="cx"> // avoid div-by-zero
</span><span class="cx"> $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
</span><span class="cx"> ?>
</span><span class="cx"> <div class="counter-container">
</span><del>- <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>
</del><ins>+ <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>
</ins><span class="cx"> </span>
</span><span class="cx"> </a>
</span><del>- <span class="counter-count" style="margin-left:5px;"><?php echo $ratecount; ?></span>
</del><ins>+ <span class="counter-count"><?php echo $ratecount; ?></span>
</ins><span class="cx"> </div>
</span><del>- <?php
</del><ins>+ <?php
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- if ( ! empty( $api->contributors ) ) : ?>
- <h3><?php _e('Contributors') ?></h3>
</del><ins>+ if ( ! empty( $api->contributors ) ) { ?>
+ <h3><?php _e( 'Contributors' ); ?></h3>
</ins><span class="cx"> <ul class="contributors">
</span><span class="cx"> <?php
</span><span class="cx"> foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
</span><del>- if ( empty( $contrib_username ) && empty( $contrib_profile ) )
</del><ins>+ if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
</ins><span class="cx"> continue;
</span><del>- if ( empty( $contrib_username ) )
</del><ins>+ }
+ if ( empty( $contrib_username ) ) {
</ins><span class="cx"> $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
</span><ins>+ }
</ins><span class="cx"> $contrib_username = sanitize_user( $contrib_username );
</span><del>- 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>";
</del><ins>+ 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>";
+ }
</ins><span class="cx"> }
</span><span class="cx"> ?>
</span><span class="cx"> </ul>
</span><del>- <?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; ?>
</del><ins>+ <?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 } ?>
</ins><span class="cx"> </div>
</span><span class="cx"> <div id="section-holder" class="wrap">
</span><span class="cx"> <?php
</span><del>- if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) )
</del><ins>+ if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
</ins><span class="cx"> echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
</span><del>-
- else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) )
</del><ins>+ } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
</ins><span class="cx"> 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>';
</span><ins>+ }
</ins><span class="cx">
</span><del>- foreach ( (array)$api->sections as $section_name => $content ) {
-
</del><ins>+ foreach ( (array) $api->sections as $section_name => $content ) {
</ins><span class="cx"> $content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
</span><span class="cx"> $content = links_add_target( $content, '_blank' );
</span><span class="cx">
</span><span class="cx"> $san_section = esc_attr( $section_name );
</span><span class="cx">
</span><del>- $display = ( $section_name == $section ) ? 'block' : 'none';
</del><ins>+ $display = ( $section_name === $section ) ? 'block' : 'none';
</ins><span class="cx">
</span><span class="cx"> echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
</span><span class="cx"> echo $content;
</span><span class="lines">@@ -491,22 +502,24 @@
</span><span class="cx"> echo "</div>\n";
</span><span class="cx"> echo "</div>\n";
</span><span class="cx"> echo "<div id='$tab-footer'>\n";
</span><del>- if ( ! empty( $api->download_link ) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) {
- $status = install_plugin_install_status($api);
</del><ins>+ if ( ! empty( $api->download_link ) && ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
+ $status = install_plugin_install_status( $api );
</ins><span class="cx"> switch ( $status['status'] ) {
</span><span class="cx"> case 'install':
</span><del>- if ( $status['url'] )
- echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
</del><ins>+ if ( $status['url'] ) {
+ echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
+ }
</ins><span class="cx"> break;
</span><span class="cx"> case 'update_available':
</span><del>- if ( $status['url'] )
- echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
</del><ins>+ if ( $status['url'] ) {
+ echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';
+ }
</ins><span class="cx"> break;
</span><span class="cx"> case 'newer_installed':
</span><del>- echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
</del><ins>+ echo '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed'), $status['version'] ) . '</a>';
</ins><span class="cx"> break;
</span><span class="cx"> case 'latest_installed':
</span><del>- echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>';
</del><ins>+ echo '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunksrcwpadminjsplugininstalljs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/plugin-install.js (29124 => 29125)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/plugin-install.js 2014-07-12 19:48:24 UTC (rev 29124)
+++ trunk/src/wp-admin/js/plugin-install.js 2014-07-12 22:07:16 UTC (rev 29125)
</span><span class="lines">@@ -6,8 +6,8 @@
</span><span class="cx"> tb_position = function() {
</span><span class="cx"> var tbWindow = $( '#TB_window' ),
</span><span class="cx"> width = $( window ).width(),
</span><del>- H = $( window ).height() - ( ( 850 < width ) ? 60 : 20 ),
- W = ( 850 < width ) ? 830 : width - 20;
</del><ins>+ H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ),
+ W = ( 792 < width ) ? 772 : width - 20;
</ins><span class="cx">
</span><span class="cx"> if ( tbWindow.size() ) {
</span><span class="cx"> tbWindow.width( W ).height( H );
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx"> });
</span><span class="cx"> if ( typeof document.body.style.maxWidth !== 'undefined' ) {
</span><span class="cx"> tbWindow.css({
</span><del>- 'top': ( ( 850 < width ) ? 30 : 10 ) + 'px',
</del><ins>+ 'top': ( ( 792 < width ) ? 30 : 10 ) + 'px',
</ins><span class="cx"> 'margin-top': '0'
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="lines">@@ -46,20 +46,24 @@
</span><span class="cx"> return false;
</span><span class="cx"> });
</span><span class="cx">
</span><del>- /* Plugin install related JS*/
</del><ins>+ /* Plugin install related JS */
</ins><span class="cx"> $( '#plugin-information-tabs a' ).click( function( event ) {
</span><span class="cx"> var tab = $( this ).attr( 'name' );
</span><span class="cx"> event.preventDefault();
</span><del>- //Flip the tab
</del><ins>+
+ // Flip the tab
</ins><span class="cx"> $( '#plugin-information-tabs a.current' ).removeClass( 'current' );
</span><span class="cx"> $( this ).addClass( 'current' );
</span><del>- //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
</del><ins>+
+ // 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.
</ins><span class="cx"> $( '#section-' + tab ).show();
</span><span class="cx"> });
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>