<!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>[6251] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins: Plugins: Simplify template logic.</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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/6251">6251</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/6251","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-12-08 17:37:23 +0000 (Fri, 08 Dec 2017)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Plugins: Simplify template logic.

Moves most of the logic into template tags to make the single-plugin template it bit easier to understand.

Props joostdevalk.
Fixes <a href="http://meta.trac.wordpress.org/ticket/3310">#3310</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginsinctemplatetagsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginstemplatepartspluginsinglephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginstemplatepartssectionadvancedphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginsinctemplatetagsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php   2017-12-08 17:33:42 UTC (rev 6250)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php     2017-12-08 17:37:23 UTC (rev 6251)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,6 +9,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Theme;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Template;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use WordPressdotorg\Plugin_Directory\Tools;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> // Returns an absolute url to the current url, no matter what that actually is.
</span><span class="cx" style="display: block; padding: 0 10px"> function wporg_plugins_self_link() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,3 +72,193 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return sprintf( '<cite> By: %s</cite>', implode(', ', $author_links ) );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+
+/**
+ * Displays a plugin banner.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ */
+function the_plugin_banner( $post = null ) {
+       echo Template::get_plugin_banner( $post, 'html' );
+}
+
+/**
+ * Displays a button to favorite or unfavorite a plugin.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ */
+function the_plugin_favorite_button( $post = null ) {
+       if ( ! is_user_logged_in() ) {
+               return;
+       }
+
+       $is_favorited = Tools::favorited_plugin( get_post( $post ) );
+?>
+<div class="plugin-favorite">
+       <a href="<?php echo esc_url( Template::get_favorite_link() ); ?>" class="plugin-favorite-heart<?php echo $is_favorited ? ' favorited' : ''; ?>">
+               <span class="screen-reader-text">
+                       <?php
+                       if ( $is_favorited ) {
+                               /* translators: %s: plugin name */
+                               printf( __( 'Unfavorite %s', 'wporg-plugins' ), get_the_title() );
+                       } else {
+                               /* translators: %s: plugin name */
+                               printf( __( 'Favorite %s', 'wporg-plugins' ), get_the_title() );
+                       }
+                       ?>
+               </span>
+       </a>
+       <script>
+               jQuery( '.plugin-favorite-heart' )
+                       .on( 'click touchstart animationend', function() {
+                               jQuery( this ).toggleClass( 'is-animating' );
+                       } )
+                       .on( 'click', function() {
+                               jQuery( this ).toggleClass( 'favorited' );
+                       } );
+       </script>
+</div>
+<?php
+}
+
+/**
+ * Displays the byline for a plugin author.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ */
+function the_author_byline( $post = null ) {
+       $post = get_post( $post );
+
+       $url    = get_post_meta( $post->ID, 'header_author_uri', true );
+       $author = strip_tags( get_post_meta( $post->ID, 'header_author', true ) ) ?: get_the_author();
+       $author = esc_html( Template::encode( $author ) );
+       $author = $url ? '<a class="url fn n" rel="nofollow" href="' . esc_url( $url ) . '">' . $author . '</a>' : $author;
+
+       printf( _x( 'By %s', 'post author', 'wporg-plugins' ), '<span class="author vcard">' . $author . '</span>' );
+}
+
+/**
+ * Displays a descriptive status notice for active plugins.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ */
+function the_active_plugin_notice( $post = null ) {
+       if ( ! in_array( get_post_status( $post ), ['rejected', 'closed'], true ) ) {
+               echo get_plugin_status_notice( $post );
+       };
+}
+
+/**
+ * Displays a descriptive status notice for inactive plugins.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ */
+function the_closed_plugin_notice( $post = null ) {
+       echo get_closed_plugin_notice( $post );
+}
+
+/**
+ * Returns a descriptive status notice for inactive plugins.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ * @return string Message markup.
+ */
+function get_closed_plugin_notice( $post = null ) {
+       $post   = get_post( $post );
+       $notice = '';
+
+       if ( in_array( get_post_status( $post ), ['rejected', 'closed'], true ) ) {
+               $notice = get_plugin_status_notice( $post );
+
+               if ( get_current_user_id() == $post->post_author ) {
+                       $info_notice = '<div class="plugin-notice notice notice-info notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
+                       $message     = sprintf(
+                       /* translators: 1: plugins@wordpress.org */
+                               __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporgplugins' ),
+                               'plugins@wordpress.org'
+                       );
+
+                       $notice .= sprintf( $info_notice, $message );
+               }
+       };
+
+       return $notice;
+}
+
+/**
+ * Return a descriptive status notice based on the plugin's current post_status.
+ *
+ * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
+ * @return string Message markup.
+ */
+function get_plugin_status_notice( $post = null ) {
+       $post_status    = get_post_status( $post );
+       $info_notice    = '<div class="plugin-notice notice notice-info notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
+       $error_notice   = '<div class="plugin-notice notice notice-error notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
+       $warning_notice = '<div class="plugin-notice notice notice-warning notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
+
+       $message = '';
+
+       switch ( $post_status ) {
+               case 'publish':
+                       if ( time() - get_post_modified_time() > 2 * YEAR_IN_SECONDS ) {
+                               $message = sprintf(
+                                       $warning_notice,
+                                       __( 'This plugin <strong>hasn&#146;t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-plugins' )
+                               );
+                       }
+                       break;
+
+               case 'draft':
+               case 'pending':
+                       $message = sprintf(
+                               $info_notice,
+                               __( 'This plugin is requested and not visible to the public yet. Please be patient as your plugin gets reviewed.', 'wporg-plugins' )
+                       );
+                       break;
+
+               case 'approved':
+                       $message = sprintf(
+                               $info_notice,
+                               __( 'This plugin is approved and awaiting data upload but not visible to the public yet. Once you make your first commit, the plugin will become public.', 'wporg-plugins' )
+                       );
+                       break;
+
+               case 'rejected':
+                       $message = sprintf(
+                               $error_notice,
+                               __( 'This plugin has been rejected and is not visible to the public.', 'wporg-plugins' )
+                       );
+                       break;
+
+               case 'disabled':
+                       $message = current_user_can( 'plugin_approve' )
+                               ? __( 'This plugin is disabled (closed, but actively serving updates).', 'wporg-plugins' )
+                               : __( 'This plugin has been closed for new installs.', 'wporg-plugins' );
+
+                       $message = sprintf( $error_notice, $message );
+                       break;
+
+               case 'closed':
+                       $closed_date = get_post_meta( get_the_ID(), 'plugin_closed_date', true );
+                       if ( ! empty( $closed_date ) ) {
+                               $message = sprintf( __( 'This plugin was closed on %s and is no longer available for download.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
+                       } else {
+                               $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' );
+                       }
+
+                       $message = sprintf( $error_notice, $message );
+                       break;
+
+               // Fall through.
+               default:
+                       $message = sprintf(
+                               $error_notice,
+                               __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' )
+                       );
+                       break;
+       }
+
+       return $message;
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginstemplatepartspluginsinglephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php        2017-12-08 17:33:42 UTC (rev 6250)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php  2017-12-08 17:37:23 UTC (rev 6251)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,186 +10,75 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Theme;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Plugin_Directory;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Template;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use WordPressdotorg\Plugin_Directory\Tools;
-global $section, $section_slug, $section_content, $section_read_more;
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
-$status  = get_post_status();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+global $section, $section_slug, $section_content, $section_read_more, $post;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
-    <?php
-    // Don't show the plugin banner for closed plugins
-    if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
-           echo Template::get_plugin_banner( get_post(), 'html' );
-    }
-    ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$content   = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
+$is_closed = in_array( get_post_status(), ['closed', 'disabled'], true );
+?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+       <?php the_plugin_banner(); ?>
+
</ins><span class="cx" style="display: block; padding: 0 10px">         <header class="plugin-header">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php if ( time() - get_post_modified_time() > 2 * YEAR_IN_SECONDS ) : ?>
-                       <div class="plugin-notice notice notice-warning notice-alt">
-                               <p><?php _e( 'This plugin <strong>hasn&#146;t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-plugins' ); ?></p>
-                       </div>
-               <?php endif; ?>
-               <?php if ( 'publish' !== $status ) :
-                               $notice_type = 'notice-error';
-                               switch ( $status ) {
-                                       case 'draft':
-                                       case 'pending':
-                                               $message = __( 'This plugin is requested and not visible to the public yet. Please be patient as your plugin gets reviewed.', 'wporg-plugins' );
-                                               $notice_type = 'notice-info';
-                                               break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <?php the_active_plugin_notice(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        case 'approved':
-                                               $message = __( 'This plugin is approved and awaiting data upload but not visible to the public yet. Once you make your first commit, the plugin will become public.', 'wporg-plugins' );
-                                               $notice_type = 'notice-info';
-                                               break;
-
-                                       case 'rejected':
-                                               $message = __( 'This plugin has been rejected and is not visible to the public.', 'wporg-plugins' );
-                                               break;
-
-                                       case 'disabled':
-                                               if ( current_user_can( 'plugin_approve' ) ) {
-                                                       $message = __( 'This plugin is disabled (closed, but actively serving updates).', 'wporg-plugins' );
-                                                       break;
-                                               } else {
-                                                       $message = __( 'This plugin has been closed for new installs.', 'wporg-plugins' );
-                                                       break;
-                                               }
-                                               // fall through
-                                       default:
-                                       case 'closed':
-                                               $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' );
-                                               break;
-                               }
-
-            if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
-                   $closed_date    = get_post_meta( get_the_ID(), 'plugin_closed_date', true );
-                   if ( ! empty( $closed_date ) ) {
-                           $message .= '<br/>';
-                                       $message .= sprintf( __( 'This plugin was closed on %s.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
-                               }
-            }
-
-               if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
-                                   // the notice for closed and disabled is shown below the Description header, because we don't output the readme there
-                       ?>
-            <!-- .plugin-notice -->
-                       <div class="plugin-notice notice <?php echo esc_attr( $notice_type ); ?> notice-alt">
-                               <p><?php echo $message; ?></p>
-                       </div>
-            <!-- .plugin-notice -->
-        <?php } ?>
-               <?php endif; ?>
-
</del><span class="cx" style="display: block; padding: 0 10px">                 <div class="entry-thumbnail">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <?php echo Template::get_plugin_icon( get_post(), 'html' ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <?php echo Template::get_plugin_icon( $post, 'html' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                 </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="plugin-actions">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <?php
-                       if ( is_user_logged_in() ) :
-                               $url = Template::get_favorite_link();
-                               $is_favorited = Tools::favorited_plugin( $post );
-                               ?>
-                               <div class="plugin-favorite">
-                                       <a href="<?php echo esc_url( $url ); ?>" class="plugin-favorite-heart<?php echo $is_favorited ? ' favorited' : ''; ?>">
-                                               <span class="screen-reader-text">
-                                                       <?php
-                                                               if ( $is_favorited ) {
-                                                                       /* translators: %s: plugin name */
-                                                                       printf( __( 'Unfavorite %s', 'wporg-plugins' ), get_the_title() );
-                                                               } else {
-                                                                       /* translators: %s: plugin name */
-                                                                       printf( __( 'Favorite %s', 'wporg-plugins' ), get_the_title() );
-                                                               }
-                                                       ?>
-                                               </span>
-                                       </a>
-                                       <script>
-                                               jQuery( '.plugin-favorite-heart' )
-                                                       .on( 'click touchstart animationend', function() {
-                                                               jQuery( this ).toggleClass( 'is-animating' );
-                                                       } )
-                                                       .on( 'click', function() {
-                                                               jQuery( this ).toggleClass( 'favorited' );
-                                                       } );
-                                       </script>
-                               </div>
-                       <?php endif; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <?php the_plugin_favorite_button(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', get_post() ) ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', $post ) ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-               <?php 
-               if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
-                       $plugin_title = $post->post_name;
-               } else {
-                       $plugin_title = get_the_title();
-               }
-               ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               <?php $plugin_title = $is_closed ? $post->post_name : get_the_title(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <h1 class="plugin-title"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $plugin_title; ?></a></h1>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <span class="byline"><?php
-                       $url = get_post_meta( get_the_ID(), 'header_author_uri', true );
-                       $author = strip_tags( get_post_meta( get_the_ID(), 'header_author', true ) ) ?: get_the_author();
-
-                       printf(
-                               _x( 'By %s', 'post author', 'wporg-plugins' ),
-                               '<span class="author vcard">' .
-                               ( $url ? '<a class="url fn n" rel="nofollow" href="' . esc_url( $url ) . '">' : '' ) .
-                               esc_html( Template::encode( $author ) ) .
-                               ( $url ? '</a>' : '' ) .
-                               '</span>'
-                       );
-               ?></span>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <span class="byline"><?php the_author_byline(); ?></span>
</ins><span class="cx" style="display: block; padding: 0 10px">         </header><!-- .entry-header -->
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php if ( ! get_query_var( 'plugin_advanced' ) ) { ?>
-       <span id="description"></span>
-       <span id="reviews"></span>
-       <span id="installation"></span>
-       <span id="developers"></span>
-       <ul class="tabs clear">
-               <li id="tablink-description"><a href='#description'><?php _e( 'Details', 'wporg-plugins' ); ?></a></li>
-               <li id="tablink-reviews"><a href='#reviews'><?php _e( 'Reviews', 'wporg-plugins' ); ?></a></li>
-<?php if ( isset( $content[ 'installation' ] ) && ! in_array( $status, array( 'closed', 'disabled' ) ) ) { ?>
-               <li id="tablink-installation"><a href='#installation'><?php _e( 'Installation', 'wporg-plugins' ); ?></a></li>
-<?php } ?>
-               <li id="tablink-support"><a href='<?php echo Template::get_support_url(); ?>'><?php _e( 'Support', 'wporg-plugins' ); ?></a></li>
-               <li id="tablink-developers"><a href='#developers'><?php _e( 'Development', 'wporg-plugins' ); ?></a></li>
-    </ul>
-<?php } ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( ! get_query_var( 'plugin_advanced' ) ) : ?>
+               <span id="description"></span>
+               <span id="reviews"></span>
+               <span id="installation"></span>
+               <span id="developers"></span>
+               <ul class="tabs clear">
+                       <li id="tablink-description"><a href="#description"><?php _e( 'Details', 'wporg-plugins' ); ?></a></li>
+                       <li id="tablink-reviews"><a href="#reviews"><?php _e( 'Reviews', 'wporg-plugins' ); ?></a></li>
+                       <?php if ( isset( $content['installation'] ) && ! $is_closed ) : ?>
+                               <li id="tablink-installation">
+                                       <a href="#installation"><?php _e( 'Installation', 'wporg-plugins' ); ?></a>
+                               </li>
+                       <?php endif; ?>
+                       <li id="tablink-support">
+                               <a href="<?php echo esc_url( Template::get_support_url() ); ?>"><?php _e( 'Support', 'wporg-plugins' ); ?></a>
+                       </li>
+                       <li id="tablink-developers"><a href="#developers"><?php _e( 'Development', 'wporg-plugins' ); ?></a></li>
+               </ul>
+       <?php endif; ?>
+
</ins><span class="cx" style="display: block; padding: 0 10px">         <div class="entry-content">
</span><span class="cx" style="display: block; padding: 0 10px">                <?php
</span><span class="cx" style="display: block; padding: 0 10px">                if ( get_query_var( 'plugin_advanced' ) ) :
</span><span class="cx" style="display: block; padding: 0 10px">                        get_template_part( 'template-parts/section-advanced' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                else:
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         else :
</ins><span class="cx" style="display: block; padding: 0 10px">                         $plugin_sections = Template::get_plugin_sections();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">                         foreach ( array( 'description', 'screenshots', 'installation', 'faq', 'reviews', 'developers', 'changelog' ) as $section_slug ) :
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( ! isset( $content[ $section_slug ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        continue;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( 'description' === $section_slug && in_array( $status, array( 'closed', 'disabled' ) ) ) {
-                               // Don't show the description for closed plugins
-                                       $section_content = '<div class="plugin-notice notice notice-error notice-alt"><p>' . $message . '</p></div>';
-                           if ( get_current_user_id() == get_post()->post_author ) {
-                                   $section_content .= '<div class="plugin-notice notice notice-info notice-alt"><p>' .
-                                                       sprintf(
-                                                       /* translators: 1: plugins@wordpress.org */
-                                                               __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporg-plugins' ),
-                                                               'plugins@wordpress.org'
-                                                       ) . '</p></div><!-- .plugin-notice -->';
-                           }
-                               }
-                               else if ( in_array( $section_slug, array( 'screenshots', 'installation', 'faq', 'changelog' ) ) && in_array( $status, array( 'closed', 'disabled' ) ) ) {
-                               $section_content = '';
-                               }
-                               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $section_content = '';
+
+                               if ( 'description' === $section_slug && $is_closed ) {
+                                       // Don't show the description for closed plugins.
+                                       $section_content = get_closed_plugin_notice();
+
+                               } else if ( ! in_array( $section_slug, ['screenshots', 'installation', 'faq', 'changelog'], true ) || ! $is_closed ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $section_content = trim( apply_filters( 'the_content', $content[ $section_slug ], $section_slug ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -201,7 +90,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $section = array_pop( $section );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $section_no_read_mores = array( 'description', 'screenshots', 'installation', 'faq', 'reviews' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                // If the FAQ section is the newer `<dl>` form, no need to do read-more for it.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         // If the FAQ section is the newer `<dl>` form, no need to do readmore for it.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( false !== stripos( $section_content, '<dl>' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $section_no_read_mores[] = 'faq';
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -215,8 +104,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </div><!-- .entry-content -->
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="entry-meta">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php
-               get_template_part( 'template-parts/plugin-sidebar', ( get_query_var( 'plugin_advanced' ) ? 'advanced' : '' ) );
-               ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <?php get_template_part( 'template-parts/plugin-sidebar', get_query_var( 'plugin_advanced' ) ? 'advanced' : '' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">         </div><!-- .entry-meta -->
</span><span class="cx" style="display: block; padding: 0 10px"> </article><!-- #post-## -->
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginstemplatepartssectionadvancedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php     2017-12-08 17:33:42 UTC (rev 6250)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php       2017-12-08 17:37:23 UTC (rev 6251)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,26 +8,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Theme;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use WordPressdotorg\Plugin_Directory\Plugin_Directory;
</del><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Template;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+global $post;
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="admin" class="section">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    <?php
-    $status  = get_post_status();
-    if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
-           echo '<div class="plugin-notice notice notice-error notice-alt"><p>' . __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' ) . '</p></div>';
-           if ( get_current_user_id() == get_post()->post_author ) {
-                   echo '<div class="plugin-notice notice notice-info notice-alt"><p>' .
-                                       sprintf(
-                                       /* translators: 1: plugins@wordpress.org */
-                                               __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporg-plugins' ),
-                                               'plugins@wordpress.org'
-                                       ) . '</p></div><!-- .plugin-notice -->';
-           }
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php the_closed_plugin_notice(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    ?>
</del><span class="cx" style="display: block; padding: 0 10px">         <h2><?php _e( 'Plugin Stats', 'wporg-plugins' ); ?></h2>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <h4><?php _e( 'Active versions', 'wporg-plugins' ); ?></h4>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,11 +33,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </table>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'publish' === $post->post_status ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $tags = (array) get_post_meta( $post->ID, 'tagged_versions', true );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Sort the versions by version
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Sort the versions by version.
</ins><span class="cx" style="display: block; padding: 0 10px">                 usort( $tags, 'version_compare' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // We'll want to add a Development Version if it exists
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // We'll want to add a Development Version if it exists.
</ins><span class="cx" style="display: block; padding: 0 10px">                 $tags[] = 'trunk';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Remove the current version, this may be trunk.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,24 +46,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // List Trunk, followed by the most recent non-stable release.
</span><span class="cx" style="display: block; padding: 0 10px">                $tags = array_reverse( $tags );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $tags && 'publish' === get_post_status() ) {
-                       echo '<h5>' . __( 'Previous Versions', 'wporg-plugins' ) . '</h5>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo '<h5>' . __( 'Previous Versions', 'wporg-plugins' ) . '</h5>';
+               echo '<div class="plugin-notice notice notice-info notice-alt"><p>' . __( 'Previous versions of this plugin may not be secure or stable and are available for testing purposes only.', 'wporg-plugins' ) . '</p></div>';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        echo '<div class="plugin-notice notice notice-info notice-alt"><p>' . __( 'Previous versions of this plugin may not be secure or stable and are available for testing purposes only.', 'wporg-plugins' ) . '</p></div>';
-
-                       echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">';
-                       foreach ( $tags as $version ) {
-                               $text = ( 'trunk' == $version ? __( 'Development Version', 'wporg-plugins' ) : $version );
-                               printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) );
-                       }
-                       echo '</select> ';
-
-                       printf(
-                               '<a href="%s" id="download-previous-link" class="button">%s</a>',
-                               esc_url( Template::download_link( $post, reset( $tags ) ) ),
-                               __( 'Download', 'wporg-plugins' )
-                       );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">';
+               foreach ( $tags as $version ) {
+                       $text = ( 'trunk' == $version ? __( 'Development Version', 'wporg-plugins' ) : $version );
+                       printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                echo '</select> ';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                printf(
+                       '<a href="%s" id="download-previous-link" class="button">%s</a>',
+                       esc_url( Template::download_link( $post, reset( $tags ) ) ),
+                       __( 'Download', 'wporg-plugins' )
+               );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px">         ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span></span></pre>
</div>
</div>

</body>
</html>