Making WordPress.org

Changeset 6251


Ignore:
Timestamp:
12/08/2017 05:37:23 PM (7 years ago)
Author:
obenland
Message:

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 #3310.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r4223 r6251  
    1010namespace WordPressdotorg\Plugin_Directory\Theme;
    1111use WordPressdotorg\Plugin_Directory\Template;
     12use WordPressdotorg\Plugin_Directory\Tools;
    1213
    1314// Returns an absolute url to the current url, no matter what that actually is.
     
    7273    }
    7374}
     75
     76
     77/**
     78 * Displays a plugin banner.
     79 *
     80 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     81 */
     82function the_plugin_banner( $post = null ) {
     83    echo Template::get_plugin_banner( $post, 'html' );
     84}
     85
     86/**
     87 * Displays a button to favorite or unfavorite a plugin.
     88 *
     89 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     90 */
     91function the_plugin_favorite_button( $post = null ) {
     92    if ( ! is_user_logged_in() ) {
     93        return;
     94    }
     95
     96    $is_favorited = Tools::favorited_plugin( get_post( $post ) );
     97?>
     98<div class="plugin-favorite">
     99    <a href="<?php echo esc_url( Template::get_favorite_link() ); ?>" class="plugin-favorite-heart<?php echo $is_favorited ? ' favorited' : ''; ?>">
     100        <span class="screen-reader-text">
     101            <?php
     102            if ( $is_favorited ) {
     103                /* translators: %s: plugin name */
     104                printf( __( 'Unfavorite %s', 'wporg-plugins' ), get_the_title() );
     105            } else {
     106                /* translators: %s: plugin name */
     107                printf( __( 'Favorite %s', 'wporg-plugins' ), get_the_title() );
     108            }
     109            ?>
     110        </span>
     111    </a>
     112    <script>
     113        jQuery( '.plugin-favorite-heart' )
     114            .on( 'click touchstart animationend', function() {
     115                jQuery( this ).toggleClass( 'is-animating' );
     116            } )
     117            .on( 'click', function() {
     118                jQuery( this ).toggleClass( 'favorited' );
     119            } );
     120    </script>
     121</div>
     122<?php
     123}
     124
     125/**
     126 * Displays the byline for a plugin author.
     127 *
     128 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     129 */
     130function the_author_byline( $post = null ) {
     131    $post = get_post( $post );
     132
     133    $url    = get_post_meta( $post->ID, 'header_author_uri', true );
     134    $author = strip_tags( get_post_meta( $post->ID, 'header_author', true ) ) ?: get_the_author();
     135    $author = esc_html( Template::encode( $author ) );
     136    $author = $url ? '<a class="url fn n" rel="nofollow" href="' . esc_url( $url ) . '">' . $author . '</a>' : $author;
     137
     138    printf( _x( 'By %s', 'post author', 'wporg-plugins' ), '<span class="author vcard">' . $author . '</span>' );
     139}
     140
     141/**
     142 * Displays a descriptive status notice for active plugins.
     143 *
     144 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     145 */
     146function the_active_plugin_notice( $post = null ) {
     147    if ( ! in_array( get_post_status( $post ), ['rejected', 'closed'], true ) ) {
     148        echo get_plugin_status_notice( $post );
     149    };
     150}
     151
     152/**
     153 * Displays a descriptive status notice for inactive plugins.
     154 *
     155 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     156 */
     157function the_closed_plugin_notice( $post = null ) {
     158    echo get_closed_plugin_notice( $post );
     159}
     160
     161/**
     162 * Returns a descriptive status notice for inactive plugins.
     163 *
     164 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     165 * @return string Message markup.
     166 */
     167function get_closed_plugin_notice( $post = null ) {
     168    $post   = get_post( $post );
     169    $notice = '';
     170
     171    if ( in_array( get_post_status( $post ), ['rejected', 'closed'], true ) ) {
     172        $notice = get_plugin_status_notice( $post );
     173
     174        if ( get_current_user_id() == $post->post_author ) {
     175            $info_notice = '<div class="plugin-notice notice notice-info notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
     176            $message     = sprintf(
     177            /* translators: 1: plugins@wordpress.org */
     178                __( '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' ),
     179                'plugins@wordpress.org'
     180            );
     181
     182            $notice .= sprintf( $info_notice, $message );
     183        }
     184    };
     185
     186    return $notice;
     187}
     188
     189/**
     190 * Return a descriptive status notice based on the plugin's current post_status.
     191 *
     192 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     193 * @return string Message markup.
     194 */
     195function get_plugin_status_notice( $post = null ) {
     196    $post_status    = get_post_status( $post );
     197    $info_notice    = '<div class="plugin-notice notice notice-info notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
     198    $error_notice   = '<div class="plugin-notice notice notice-error notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
     199    $warning_notice = '<div class="plugin-notice notice notice-warning notice-alt"><p>%s</p></div><!-- .plugin-notice -->';
     200
     201    $message = '';
     202
     203    switch ( $post_status ) {
     204        case 'publish':
     205            if ( time() - get_post_modified_time() > 2 * YEAR_IN_SECONDS ) {
     206                $message = sprintf(
     207                    $warning_notice,
     208                    __( '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' )
     209                );
     210            }
     211            break;
     212
     213        case 'draft':
     214        case 'pending':
     215            $message = sprintf(
     216                $info_notice,
     217                __( 'This plugin is requested and not visible to the public yet. Please be patient as your plugin gets reviewed.', 'wporg-plugins' )
     218            );
     219            break;
     220
     221        case 'approved':
     222            $message = sprintf(
     223                $info_notice,
     224                __( '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' )
     225            );
     226            break;
     227
     228        case 'rejected':
     229            $message = sprintf(
     230                $error_notice,
     231                __( 'This plugin has been rejected and is not visible to the public.', 'wporg-plugins' )
     232            );
     233            break;
     234
     235        case 'disabled':
     236            $message = current_user_can( 'plugin_approve' )
     237                ? __( 'This plugin is disabled (closed, but actively serving updates).', 'wporg-plugins' )
     238                : __( 'This plugin has been closed for new installs.', 'wporg-plugins' );
     239
     240            $message = sprintf( $error_notice, $message );
     241            break;
     242
     243        case 'closed':
     244            $closed_date = get_post_meta( get_the_ID(), 'plugin_closed_date', true );
     245            if ( ! empty( $closed_date ) ) {
     246                $message = sprintf( __( 'This plugin was closed on %s and is no longer available for download.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
     247            } else {
     248                $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' );
     249            }
     250
     251            $message = sprintf( $error_notice, $message );
     252            break;
     253
     254        // Fall through.
     255        default:
     256            $message = sprintf(
     257                $error_notice,
     258                __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' )
     259            );
     260            break;
     261    }
     262
     263    return $message;
     264}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r6232 r6251  
    1111use WordPressdotorg\Plugin_Directory\Plugin_Directory;
    1212use WordPressdotorg\Plugin_Directory\Template;
    13 use WordPressdotorg\Plugin_Directory\Tools;
    14 global $section, $section_slug, $section_content, $section_read_more;
    1513
    16 $content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
    17 $status  = get_post_status();
     14global $section, $section_slug, $section_content, $section_read_more, $post;
    1815
    19 ?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    20     <?php
    21     // Don't show the plugin banner for closed plugins
    22     if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
    23         echo Template::get_plugin_banner( get_post(), 'html' );
    24     }
    25     ?>
     16$content   = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
     17$is_closed = in_array( get_post_status(), ['closed', 'disabled'], true );
     18?>
     19
     20<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     21    <?php the_plugin_banner(); ?>
    2622
    2723    <header class="plugin-header">
    28         <?php if ( time() - get_post_modified_time() > 2 * YEAR_IN_SECONDS ) : ?>
    29             <div class="plugin-notice notice notice-warning notice-alt">
    30                 <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>
    31             </div>
    32         <?php endif; ?>
    33         <?php if ( 'publish' !== $status ) :
    34                 $notice_type = 'notice-error';
    35                 switch ( $status ) {
    36                     case 'draft':
    37                     case 'pending':
    38                         $message = __( 'This plugin is requested and not visible to the public yet. Please be patient as your plugin gets reviewed.', 'wporg-plugins' );
    39                         $notice_type = 'notice-info';
    40                         break;
    41 
    42                     case 'approved':
    43                         $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' );
    44                         $notice_type = 'notice-info';
    45                         break;
    46 
    47                     case 'rejected':
    48                         $message = __( 'This plugin has been rejected and is not visible to the public.', 'wporg-plugins' );
    49                         break;
    50 
    51                     case 'disabled':
    52                         if ( current_user_can( 'plugin_approve' ) ) {
    53                             $message = __( 'This plugin is disabled (closed, but actively serving updates).', 'wporg-plugins' );
    54                             break;
    55                         } else {
    56                             $message = __( 'This plugin has been closed for new installs.', 'wporg-plugins' );
    57                             break;
    58                         }
    59                         // fall through
    60                     default:
    61                     case 'closed':
    62                         $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' );
    63                         break;
    64                 }
    65 
    66             if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
    67                 $closed_date    = get_post_meta( get_the_ID(), 'plugin_closed_date', true );
    68                 if ( ! empty( $closed_date ) ) {
    69                     $message .= '<br/>';
    70                     $message .= sprintf( __( 'This plugin was closed on %s.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
    71                 }
    72             }
    73 
    74         if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
    75                     // the notice for closed and disabled is shown below the Description header, because we don't output the readme there
    76             ?>
    77             <!-- .plugin-notice -->
    78             <div class="plugin-notice notice <?php echo esc_attr( $notice_type ); ?> notice-alt">
    79                 <p><?php echo $message; ?></p>
    80             </div>
    81             <!-- .plugin-notice -->
    82         <?php } ?>
    83         <?php endif; ?>
     24        <?php the_active_plugin_notice(); ?>
    8425
    8526        <div class="entry-thumbnail">
    86             <?php echo Template::get_plugin_icon( get_post(), 'html' ); ?>
     27            <?php echo Template::get_plugin_icon( $post, 'html' ); ?>
    8728        </div>
    8829
    8930        <div class="plugin-actions">
    90             <?php
    91             if ( is_user_logged_in() ) :
    92                 $url = Template::get_favorite_link();
    93                 $is_favorited = Tools::favorited_plugin( $post );
    94                 ?>
    95                 <div class="plugin-favorite">
    96                     <a href="<?php echo esc_url( $url ); ?>" class="plugin-favorite-heart<?php echo $is_favorited ? ' favorited' : ''; ?>">
    97                         <span class="screen-reader-text">
    98                             <?php
    99                                 if ( $is_favorited ) {
    100                                     /* translators: %s: plugin name */
    101                                     printf( __( 'Unfavorite %s', 'wporg-plugins' ), get_the_title() );
    102                                 } else {
    103                                     /* translators: %s: plugin name */
    104                                     printf( __( 'Favorite %s', 'wporg-plugins' ), get_the_title() );
    105                                 }
    106                             ?>
    107                         </span>
    108                     </a>
    109                     <script>
    110                         jQuery( '.plugin-favorite-heart' )
    111                             .on( 'click touchstart animationend', function() {
    112                                 jQuery( this ).toggleClass( 'is-animating' );
    113                             } )
    114                             .on( 'click', function() {
    115                                 jQuery( this ).toggleClass( 'favorited' );
    116                             } );
    117                     </script>
    118                 </div>
    119             <?php endif; ?>
     31            <?php the_plugin_favorite_button(); ?>
    12032
    121             <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', get_post() ) ) : ?>
     33            <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', $post ) ) : ?>
    12234                <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
    12335            <?php endif; ?>
    12436        </div>
    125    
    126         <?php
    127         if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
    128             $plugin_title = $post->post_name;
    129         } else {
    130             $plugin_title = get_the_title();
    131         }
    132         ?>
     37
     38        <?php $plugin_title = $is_closed ? $post->post_name : get_the_title(); ?>
    13339        <h1 class="plugin-title"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $plugin_title; ?></a></h1>
    13440
    135         <span class="byline"><?php
    136             $url = get_post_meta( get_the_ID(), 'header_author_uri', true );
    137             $author = strip_tags( get_post_meta( get_the_ID(), 'header_author', true ) ) ?: get_the_author();
    138 
    139             printf(
    140                 _x( 'By %s', 'post author', 'wporg-plugins' ),
    141                 '<span class="author vcard">' .
    142                 ( $url ? '<a class="url fn n" rel="nofollow" href="' . esc_url( $url ) . '">' : '' ) .
    143                 esc_html( Template::encode( $author ) ) .
    144                 ( $url ? '</a>' : '' ) .
    145                 '</span>'
    146             );
    147         ?></span>
     41        <span class="byline"><?php the_author_byline(); ?></span>
    14842    </header><!-- .entry-header -->
    14943
    150 <?php if ( ! get_query_var( 'plugin_advanced' ) ) { ?>
    151     <span id="description"></span>
    152     <span id="reviews"></span>
    153     <span id="installation"></span>
    154     <span id="developers"></span>
    155     <ul class="tabs clear">
    156         <li id="tablink-description"><a href='#description'><?php _e( 'Details', 'wporg-plugins' ); ?></a></li>
    157         <li id="tablink-reviews"><a href='#reviews'><?php _e( 'Reviews', 'wporg-plugins' ); ?></a></li>
    158 <?php if ( isset( $content[ 'installation' ] ) && ! in_array( $status, array( 'closed', 'disabled' ) ) ) { ?>
    159         <li id="tablink-installation"><a href='#installation'><?php _e( 'Installation', 'wporg-plugins' ); ?></a></li>
    160 <?php } ?>
    161         <li id="tablink-support"><a href='<?php echo Template::get_support_url(); ?>'><?php _e( 'Support', 'wporg-plugins' ); ?></a></li>
    162         <li id="tablink-developers"><a href='#developers'><?php _e( 'Development', 'wporg-plugins' ); ?></a></li>
    163     </ul>
    164 <?php } ?>
     44    <?php if ( ! get_query_var( 'plugin_advanced' ) ) : ?>
     45        <span id="description"></span>
     46        <span id="reviews"></span>
     47        <span id="installation"></span>
     48        <span id="developers"></span>
     49        <ul class="tabs clear">
     50            <li id="tablink-description"><a href="#description"><?php _e( 'Details', 'wporg-plugins' ); ?></a></li>
     51            <li id="tablink-reviews"><a href="#reviews"><?php _e( 'Reviews', 'wporg-plugins' ); ?></a></li>
     52            <?php if ( isset( $content['installation'] ) && ! $is_closed ) : ?>
     53                <li id="tablink-installation">
     54                    <a href="#installation"><?php _e( 'Installation', 'wporg-plugins' ); ?></a>
     55                </li>
     56            <?php endif; ?>
     57            <li id="tablink-support">
     58                <a href="<?php echo esc_url( Template::get_support_url() ); ?>"><?php _e( 'Support', 'wporg-plugins' ); ?></a>
     59            </li>
     60            <li id="tablink-developers"><a href="#developers"><?php _e( 'Development', 'wporg-plugins' ); ?></a></li>
     61        </ul>
     62    <?php endif; ?>
     63
    16564    <div class="entry-content">
    16665        <?php
    16766        if ( get_query_var( 'plugin_advanced' ) ) :
    16867            get_template_part( 'template-parts/section-advanced' );
    169         else:
     68        else :
    17069            $plugin_sections = Template::get_plugin_sections();
    171 
    17270            foreach ( array( 'description', 'screenshots', 'installation', 'faq', 'reviews', 'developers', 'changelog' ) as $section_slug ) :
    17371                if ( ! isset( $content[ $section_slug ] ) ) {
     
    17573                }
    17674
    177                 if ( 'description' === $section_slug && in_array( $status, array( 'closed', 'disabled' ) ) ) {
    178                     // Don't show the description for closed plugins
    179                     $section_content = '<div class="plugin-notice notice notice-error notice-alt"><p>' . $message . '</p></div>';
    180                     if ( get_current_user_id() == get_post()->post_author ) {
    181                         $section_content .= '<div class="plugin-notice notice notice-info notice-alt"><p>' .
    182                                             sprintf(
    183                                             /* translators: 1: plugins@wordpress.org */
    184                                                 __( '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' ),
    185                                                 'plugins@wordpress.org'
    186                                             ) . '</p></div><!-- .plugin-notice -->';
    187                     }
    188                 }
    189                 else if ( in_array( $section_slug, array( 'screenshots', 'installation', 'faq', 'changelog' ) ) && in_array( $status, array( 'closed', 'disabled' ) ) ) {
    190                     $section_content = '';
    191                 }
    192                 else {
     75                $section_content = '';
     76
     77                if ( 'description' === $section_slug && $is_closed ) {
     78                    // Don't show the description for closed plugins.
     79                    $section_content = get_closed_plugin_notice();
     80
     81                } else if ( ! in_array( $section_slug, ['screenshots', 'installation', 'faq', 'changelog'], true ) || ! $is_closed ) {
    19382                    $section_content = trim( apply_filters( 'the_content', $content[ $section_slug ], $section_slug ) );
    19483                }
     
    20291
    20392                $section_no_read_mores = array( 'description', 'screenshots', 'installation', 'faq', 'reviews' );
    204                 // If the FAQ section is the newer `<dl>` form, no need to do read-more for it.
     93                // If the FAQ section is the newer `<dl>` form, no need to do readmore for it.
    20594                if ( false !== stripos( $section_content, '<dl>' ) ) {
    20695                    $section_no_read_mores[] = 'faq';
     
    216105
    217106    <div class="entry-meta">
    218         <?php
    219         get_template_part( 'template-parts/plugin-sidebar', ( get_query_var( 'plugin_advanced' ) ? 'advanced' : '' ) );
    220         ?>
     107        <?php get_template_part( 'template-parts/plugin-sidebar', get_query_var( 'plugin_advanced' ) ? 'advanced' : '' ); ?>
    221108    </div><!-- .entry-meta -->
    222109</article><!-- #post-## -->
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php

    r6249 r6251  
    99
    1010namespace WordPressdotorg\Plugin_Directory\Theme;
    11 use WordPressdotorg\Plugin_Directory\Plugin_Directory;
    1211use WordPressdotorg\Plugin_Directory\Template;
     12
     13global $post;
    1314?>
    1415
    1516<div id="admin" class="section">
    16     <?php
    17     $status  = get_post_status();
    18     if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
    19         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>';
    20         if ( get_current_user_id() == get_post()->post_author ) {
    21             echo '<div class="plugin-notice notice notice-info notice-alt"><p>' .
    22                                 sprintf(
    23                                 /* translators: 1: plugins@wordpress.org */
    24                                     __( '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' ),
    25                                     'plugins@wordpress.org'
    26                                 ) . '</p></div><!-- .plugin-notice -->';
    27         }
    28     }
     17    <?php the_closed_plugin_notice(); ?>
    2918
    30     ?>
    3119    <h2><?php _e( 'Plugin Stats', 'wporg-plugins' ); ?></h2>
    3220
     
    4634
    4735    <?php
    48 
     36    if ( 'publish' === $post->post_status ) {
    4937        $tags = (array) get_post_meta( $post->ID, 'tagged_versions', true );
    50         // Sort the versions by version
     38        // Sort the versions by version.
    5139        usort( $tags, 'version_compare' );
    52         // We'll want to add a Development Version if it exists
     40        // We'll want to add a Development Version if it exists.
    5341        $tags[] = 'trunk';
    5442
     
    5947        $tags = array_reverse( $tags );
    6048
    61         if ( $tags && 'publish' === get_post_status() ) {
    62             echo '<h5>' . __( 'Previous Versions', 'wporg-plugins' ) . '</h5>';
     49        echo '<h5>' . __( 'Previous Versions', 'wporg-plugins' ) . '</h5>';
     50        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>';
    6351
    64             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>';
     52        echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">';
     53        foreach ( $tags as $version ) {
     54            $text = ( 'trunk' == $version ? __( 'Development Version', 'wporg-plugins' ) : $version );
     55            printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) );
     56        }
     57        echo '</select> ';
    6558
    66             echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">';
    67             foreach ( $tags as $version ) {
    68                 $text = ( 'trunk' == $version ? __( 'Development Version', 'wporg-plugins' ) : $version );
    69                 printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) );
    70             }
    71             echo '</select> ';
    72 
    73             printf(
    74                 '<a href="%s" id="download-previous-link" class="button">%s</a>',
    75                 esc_url( Template::download_link( $post, reset( $tags ) ) ),
    76                 __( 'Download', 'wporg-plugins' )
    77             );
    78         }
    79 
     59        printf(
     60            '<a href="%s" id="download-previous-link" class="button">%s</a>',
     61            esc_url( Template::download_link( $post, reset( $tags ) ) ),
     62            __( 'Download', 'wporg-plugins' )
     63        );
     64    }
    8065    ?>
    8166</div>
Note: See TracChangeset for help on using the changeset viewer.