Changeset 9804
- Timestamp:
- 05/01/2020 06:09:06 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
r9671 r9804 8 8 namespace WordPressdotorg\Plugin_Directory\Admin\Metabox; 9 9 10 use WordPressdotorg\Plugin_Directory\Template; 10 11 use WordPressdotorg\Plugin_Directory\Tools; 11 12 … … 111 112 ] ); 112 113 113 $zip_files = array();114 foreach ( get_attached_media( 'application/zip', $post ) as $zip_file ) {115 $zip_files[ $zip_file->post_date ] = array( wp_get_attachment_url( $zip_file->ID ), $zip_file );116 }117 uksort( $zip_files, function ( $a, $b ) {118 return strtotime( $a ) < strtotime( $b );119 } );120 121 $zip_url = get_post_meta( $post->ID, '_submitted_zip', true );122 if ( $zip_url ) {123 // Back-compat only.124 $zip_files['User provided URL'] = array( $zip_url, null );125 }126 127 echo '<p><strong>Zip files:</strong></p>';128 echo '<ul class="plugin-zip-files">';129 foreach ( $zip_files as $zip_date => $zip ) {130 list( $zip_url, $zip_file ) = $zip;131 $zip_size = is_object( $zip_file ) ? size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 ) : 'unknown size';132 133 printf( '<li>%s <a href="%s">%s</a> (%s)</li>', esc_html( $zip_date ), esc_url( $zip_url ), esc_html( $zip_url ), esc_html( $zip_size ) );134 }135 echo '</ul>';136 137 114 if ( in_array( $post->post_status, [ 'draft', 'pending', 'new' ], true ) ) { 115 116 $zip_files = array(); 117 foreach ( get_attached_media( 'application/zip', $post ) as $zip_file ) { 118 $zip_files[ $zip_file->post_date ] = array( wp_get_attachment_url( $zip_file->ID ), $zip_file ); 119 } 120 uksort( $zip_files, function ( $a, $b ) { 121 return strtotime( $a ) < strtotime( $b ); 122 } ); 123 124 $zip_url = get_post_meta( $post->ID, '_submitted_zip', true ); 125 if ( $zip_url ) { 126 // Back-compat only. 127 $zip_files['User provided URL'] = array( $zip_url, null ); 128 } 129 130 echo '<p><strong>Zip files:</strong></p>'; 131 echo '<ul class="plugin-zip-files">'; 132 foreach ( $zip_files as $zip_date => $zip ) { 133 list( $zip_url, $zip_file ) = $zip; 134 $zip_size = is_object( $zip_file ) ? size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 ) : 'unknown size'; 135 136 printf( '<li>%s <a href="%s">%s</a> (%s)</li>', esc_html( $zip_date ), esc_url( $zip_url ), esc_html( $zip_url ), esc_html( $zip_size ) ); 137 } 138 echo '</ul>'; 139 138 140 $slug_restricted = []; 139 141 $slug_reserved = []; … … 179 181 // Check Active_Installs, prior to sync? 180 182 if ( function_exists( 'wporg_stats_get_plugin_name_install_count' ) ) { 181 183 182 184 $title_matches = wporg_stats_get_plugin_name_install_count( $post->post_title ); 183 185 184 186 if ( $post->post_name == sanitize_title( $post->post_title ) ) { 185 187 $slug_matches = false; … … 188 190 $slug_matches = wporg_stats_get_plugin_name_install_count( $slug ); 189 191 } 190 192 191 193 if ( $title_matches ) { 192 194 array_push( self::$flagged['high'], sprintf( … … 275 277 <li><a href='https://plugins.svn.wordpress.org/<?php echo esc_attr( $post->post_name ); ?>/'>Subversion Repository</a></li> 276 278 <li><a href='https://plugins.trac.wordpress.org/browser/<?php echo esc_attr( $post->post_name ); ?>/'>Browse in Trac</a></li> 279 <li><a href='<?php echo esc_url( Template::download_link() ); ?>'>Download Current Version</a></li> 277 280 </ul> 278 281 <?php
Note: See TracChangeset
for help on using the changeset viewer.