Making WordPress.org


Ignore:
Timestamp:
05/24/2016 04:01:00 PM (8 years ago)
Author:
obenland
Message:

Plugins Directory: Add a banner to show plugin queue volume.

Also improves notices on the upload page in general.

Fixes #1727.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php

    r2640 r3230  
    88     */
    99    public static function display() {
     10        ob_start();
     11
    1012        if ( is_user_logged_in() ) :
    1113
    12             if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) && 'upload' === $_POST['action'] ) {
    13                 if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) {
     14            if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) && 'upload' === $_POST['action'] ) :
     15                if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) :
    1416                    $uploader = new Upload_Handler;
    1517                    $message  = $uploader->process_upload();
    16                 }  else {
     18                else :
    1719                    $message = __( 'Error in file upload.', 'wporg-plugins' );
    18                 }
     20                endif;
    1921
    20                 if ( ! empty( $message ) ) {
    21                     echo "<div class='notice notice-warning'><p>{$message}</p></div>\n";
    22                 }
    23             }
    24             ?>
     22                if ( ! empty( $message ) ) :
     23                    echo "<div class='notice notice-warning notice-alt'><p>{$message}</p></div>\n";
     24                endif;
     25
     26            else :
     27                $plugins = wp_count_posts( 'plugin', 'readable' );
     28                ?>
     29
     30                <div class="plugin-queue-message notice notice-info notice-alt">
     31                    <p>
     32                        <?php
     33                        printf( _n( 'Currently there is %1$s plugin in the review queue.', 'Currently there are %1$s plugins in the review queue, %2$s of which are awaiting their initial review.', ( $plugins->draft + $plugins->pending ), 'wporg-plugins' ),
     34                            '<strong>' . ( $plugins->draft + $plugins->pending ) . '</strong>',
     35                            '<strong>' . $plugins->draft . '</strong>'
     36                        );
     37                        ?>
     38                    </p>
     39                </div>
     40
     41            <?php endif; ?>
     42
    2543            <form enctype="multipart/form-data" id="upload_form" method="POST" action="">
    2644                <?php wp_nonce_field( 'wporg-plugins-upload' ); ?>
     
    3351                </p>
    3452            </form>
     53
    3554        <?php else : ?>
    36             <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/' ) ); ?>
    37             </p>
     55
     56            <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>
     57
    3858        <?php endif;
     59
     60        return ob_get_clean();
    3961    }
    4062
Note: See TracChangeset for help on using the changeset viewer.