Changeset 6343
- Timestamp:
- 01/10/2018 07:43:34 PM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php
r6284 r6343 239 239 return $message; 240 240 } 241 242 /** 243 * Displays a select element with links to previous plugin version to download. 244 * 245 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 246 */ 247 function the_previous_version_download( $post = null ) { 248 $post = get_post( $post ); 249 250 if ( 'publish' !== $post->post_status ) { 251 return; 252 } 253 254 $tags = (array) get_post_meta( $post->ID, 'tagged_versions', true ); 255 // Sort the versions by version. 256 usort( $tags, 'version_compare' ); 257 // We'll want to add a Development Version if it exists. 258 $tags[] = 'trunk'; 259 // Remove the current version, this may be trunk. 260 $tags = array_diff( $tags, array( get_post_meta( $post->ID, 'stable_tag', true ) ) ); 261 262 if ( empty( $tags ) ) { 263 return; 264 } 265 266 // List Trunk, followed by the most recent non-stable release. 267 $tags = array_reverse( $tags ); 268 269 echo '<h5>' . esc_html__( 'Previous Versions', 'wporg-plugins' ) . '</h5>'; 270 echo '<div class="plugin-notice notice notice-info notice-alt"><p>' . esc_html__( 'Previous versions of this plugin may not be secure or stable and are available for testing purposes only.', 'wporg-plugins' ) . '</p></div>'; 271 272 echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">'; 273 foreach ( $tags as $version ) { 274 $text = ( 'trunk' === $version ? esc_html__( 'Development Version', 'wporg-plugins' ) : $version ); 275 printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) ); 276 } 277 echo '</select> '; 278 279 printf( 280 '<a href="%s" id="download-previous-link" class="button">%s</a>', 281 esc_url( Template::download_link( $post, reset( $tags ) ) ), 282 esc_html__( 'Download', 'wporg-plugins' ) 283 ); 284 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php
r6284 r6343 34 34 </table> 35 35 36 <?php 37 if ( 'publish' === $post->post_status ) { 38 $tags = (array) get_post_meta( $post->ID, 'tagged_versions', true ); 39 // Sort the versions by version. 40 usort( $tags, 'version_compare' ); 41 // We'll want to add a Development Version if it exists. 42 $tags[] = 'trunk'; 43 44 // Remove the current version, this may be trunk. 45 $tags = array_diff( $tags, array( get_post_meta( $post->ID, 'stable_tag', true ) ) ); 46 47 // List Trunk, followed by the most recent non-stable release. 48 $tags = array_reverse( $tags ); 49 50 echo '<h5>' . esc_html__( 'Previous Versions', 'wporg-plugins' ) . '</h5>'; 51 echo '<div class="plugin-notice notice notice-info notice-alt"><p>' . esc_html__( 'Previous versions of this plugin may not be secure or stable and are available for testing purposes only.', 'wporg-plugins' ) . '</p></div>'; 52 53 echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">'; 54 foreach ( $tags as $version ) { 55 $text = ( 'trunk' === $version ? esc_html__( 'Development Version', 'wporg-plugins' ) : $version ); 56 printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) ); 57 } 58 echo '</select> '; 59 60 printf( 61 '<a href="%s" id="download-previous-link" class="button">%s</a>', 62 esc_url( Template::download_link( $post, reset( $tags ) ) ), 63 esc_html__( 'Download', 'wporg-plugins' ) 64 ); 65 } 66 ?> 36 <?php the_previous_version_download(); ?> 67 37 </div>
Note: See TracChangeset
for help on using the changeset viewer.