Ticket #5179: 5179.diff
File 5179.diff, 3.9 KB (added by , 5 years ago) |
---|
-
trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
7 7 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 12 13 /** … … 110 111 'suppress_filters' => false, 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 } ); 114 if ( in_array( $post->post_status, [ 'draft', 'pending', 'new' ], true ) ) { 120 115 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 } 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 } ); 126 123 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';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 } 132 129 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>'; 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'; 136 135 137 if ( in_array( $post->post_status, [ 'draft', 'pending', 'new' ], true ) ) { 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 = []; 140 142 … … 178 180 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; 186 188 } else { … … 187 189 $slug = str_replace( '-', ' ', $post->post_name ); 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( 193 195 'As of %s, %s had %s+ active installs.', … … 274 276 <li><a href='https://plugins.trac.wordpress.org/log/<?php echo esc_attr( $post->post_name ); ?>/'>Development Log</a></li> 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 279 282 }