Changeset 6023 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
- Timestamp:
- 10/13/2017 11:59:21 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
r5511 r6023 30 30 if ( is_user_logged_in() ) : 31 31 include_once ABSPATH . 'wp-admin/includes/template.php'; 32 33 $submitted_plugins = self::get_submitted_plugins(); 34 $submitted_counts = (object) array_fill_keys( array( 'new', 'pending' ), 0 ); 35 36 $submitted_counts->total = count( $submitted_plugins ); 37 38 foreach ( $submitted_plugins as $key => $plugin ) { 39 if ( 'new' === $plugin->post_status ) { 40 $submitted_plugins[ $key ]->status = __( 'Awaiting Review', 'wporg-plugins' ); 41 $submitted_counts->new++; 42 } elseif ( 'pending' === $plugin->post_status ) { 43 $submitted_plugins[ $key ]->status = __( 'Being Reviewed', 'wporg-plugins' ); 44 $submitted_counts->pending++; 45 } 46 } 32 47 33 48 if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) && 'upload' === $_POST['action'] ) : … … 66 81 </div> 67 82 68 <?php 69 $submitted_plugins = self::get_submitted_plugins(); 70 $submitted_counts = (object) array_fill_keys( array( 'new', 'pending' ), 0 ); 71 72 foreach ( $submitted_plugins as $key => $plugin ) { 73 if ( 'new' === $plugin->post_status ) { 74 $submitted_plugins[ $key ]->status = __( 'Awaiting Review', 'wporg-plugins' ); 75 $submitted_counts->new++; 76 } elseif ( 'pending' === $plugin->post_status ) { 77 $submitted_plugins[ $key ]->status = __( 'Being Reviewed', 'wporg-plugins' ); 78 $submitted_counts->pending++; 79 } 80 } 81 ?> 82 83 <?php if ( $submitted_counts->new + $submitted_counts->pending ) : ?> 83 <?php if ( $submitted_counts->total ) : ?> 84 84 85 85 <div class="plugin-queue-message notice notice-warning notice-alt"> 86 86 <p><?php 87 if ( 1 === ( $submitted_counts->new + $submitted_counts->pending )) {88 _e( 'You have 1 plugin in the review queue. ', 'wporg-plugins' );87 if ( 1 === $submitted_counts->total ) { 88 _e( 'You have 1 plugin in the review queue. Please wait for it to be approved before submitting any more.', 'wporg-plugins' ); 89 89 } else { 90 90 printf( 91 91 _n( 92 'You have %1$s plugins in the review queue, %2$s is being actively reviewed. ',93 'You have %1$s plugins in the review queue, %2$s are being actively reviewed. ',92 'You have %1$s plugins in the review queue, %2$s is being actively reviewed. Please wait for them to be approved before submitting any more.', 93 'You have %1$s plugins in the review queue, %2$s are being actively reviewed. Please wait for them to be approved before submitting any more.', 94 94 $submitted_counts->pending, 95 95 'wporg-plugins' 96 96 ), 97 '<strong>' . ( $submitted_counts->new + $submitted_counts->pending ). '</strong>',97 '<strong>' . $submitted_counts->total . '</strong>', 98 98 '<strong>' . $submitted_counts->pending . '</strong>' 99 99 ); … … 115 115 </div> 116 116 117 <?php endif; ?>117 <?php endif; // $submitted_counts->total ?> 118 118 119 <?php endif; ?>119 <?php endif; // wp_verify_nonce() && 'upload' === $_POST['action'] ?> 120 120 121 <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action=""> 122 <?php wp_nonce_field( 'wporg-plugins-upload' ); ?> 123 <input type="hidden" name="action" value="upload"/> 124 <?php /* <fieldset> 125 <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend> 126 <ul class="category-checklist"> 127 <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?> 128 </ul> 129 </fieldset> */ ?> 121 <?php if ( ! $submitted_counts->total ) : ?> 130 122 131 <input type="file" id="zip_file" class="plugin-file" name="zip_file" size="25" accept=".zip"/> 132 <label class="button button-secondary" for="zip_file"><?php _e( 'Select File', 'wporg-plugins' ); ?></label> 123 <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action=""> 124 <?php wp_nonce_field( 'wporg-plugins-upload' ); ?> 125 <input type="hidden" name="action" value="upload"/> 126 <?php /* <fieldset> 127 <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend> 128 <ul class="category-checklist"> 129 <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?> 130 </ul> 131 </fieldset> */ ?> 133 132 134 <input id="upload_button" class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/> 133 <input type="file" id="zip_file" class="plugin-file" name="zip_file" size="25" accept=".zip"/> 134 <label class="button button-secondary" for="zip_file"><?php _e( 'Select File', 'wporg-plugins' ); ?></label> 135 135 136 <p> 137 <small><?php printf( __( 'Maximum allowed file size: %s', 'wporg-plugins' ), esc_html( self::get_max_allowed_file_size() ) ); ?></small> 138 </p> 139 </form> 140 <script> 141 ( function ( $ ) { 142 var $label = $( 'label.button' ), 143 labelText = $label.text(); 136 <input id="upload_button" class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/> 144 137 145 $( '#zip_file' ) 146 .on( 'change', function( event ) { 147 var fileName = event.target.value.split( '\\' ).pop(); 138 <p> 139 <small><?php printf( __( 'Maximum allowed file size: %s', 'wporg-plugins' ), esc_html( self::get_max_allowed_file_size() ) ); ?></small> 140 </p> 141 </form> 142 <script> 143 ( function ( $ ) { 144 var $label = $( 'label.button' ), 145 labelText = $label.text(); 148 146 149 fileName ? $label.text( fileName ) : $label.text( labelText ); 150 } ) 151 .on( 'focus', function() { $label.addClass( 'focus' ); } ) 152 .on( 'blur', function() { $label.removeClass( 'focus' ); } ); 153 } ( window.jQuery ) ); 154 </script> 147 $( '#zip_file' ) 148 .on( 'change', function( event ) { 149 var fileName = event.target.value.split( '\\' ).pop(); 150 151 fileName ? $label.text( fileName ) : $label.text( labelText ); 152 } ) 153 .on( 'focus', function() { $label.addClass( 'focus' ); } ) 154 .on( 'blur', function() { $label.removeClass( 'focus' ); } ); 155 } ( window.jQuery ) ); 156 </script> 157 158 <?php endif; // ! $submitted_counts->total ?> 155 159 156 160 <?php else : ?> … … 158 162 <p><?php printf( __( 'Before you can upload a new plugin, <a href="%s">please log in</a>.', 'wporg-plugins' ), esc_url( 'https://login.wordpress.org/' ) ); ?></p> 159 163 160 <?php endif; 164 <?php endif; // is_user_logged_in() 161 165 162 166 return ob_get_clean();
Note: See TracChangeset
for help on using the changeset viewer.