Making WordPress.org

Ticket #4839: 4839.diff

File 4839.diff, 5.0 KB (added by dingo_d, 5 years ago)
  • wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php

    diff --git wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
    index 690827f77..b6c023892 100644
    add_action( 'init', 'wporg_themes_upload_shortcode' ); 
    1313 */
    1414function wporg_themes_render_upload_shortcode() {
    1515        if ( ! defined( 'THEME_TRACBOT_PASSWORD' ) || ! defined( 'THEME_DROPBOX_PASSWORD' ) ) {
    16                 printf( '<!-- %s -->', 'Please define SVN and Trac passwords.' );
    17                 return;
     16                return '<!-- Please define SVN and Trac passwords. -->';
    1817        }
    1918
    20         if ( is_user_logged_in() ) :
    21 
    22                 if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-themes-upload' ) && 'upload' === $_POST['action'] ) {
    23                         $message = wporg_themes_process_upload();
    24 
    25                         if ( ! empty( $message ) ) {
    26                                 echo "<div class='notice notice-warning'><p>{$message}</p></div>\n";
    27                         }
    28                 }
    29         ?>
    30                 <h4><?php _e( 'Select your zipped theme file', 'wporg-themes' ); ?></h4>
    31                 <form enctype="multipart/form-data" id="upload_form" method="POST" action="" onsubmit="jQuery('#upload_button').attr('disabled','disabled'); return true;">
    32                         <?php wp_nonce_field( 'wporg-themes-upload' ); ?>
    33                         <input type="hidden" name="action" value="upload"/>
    34                         <input type="file" id="zip_file" name="zip_file" size="25"/>
    35                         <input id="upload_button" class="button" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-themes' ); ?>"/>
     19        if ( ! is_user_logged_in() ) {
    3620
    37                         <p>
    38                                 <small><?php printf( __( 'Maximum allowed file size: %s', 'wporg-themes' ), esc_html( wporg_themes_get_max_allowed_file_size() ) ); ?></small>
    39                         </p>
    40                 </form>
    41         <?php else : ?>
    42                 <p><?php printf(
     21                $log_in_text = sprintf(
    4322                        __( 'Before you can upload a new theme, <a href="%s">please log in</a>.', 'wporg-themes' ),
    4423                        add_query_arg(
    4524                                'redirect_to',
    4625                                urlencode( 'https://wordpress.org/themes/upload/' ),
    4726                                'https://login.wordpress.org/'
    4827                        )
    49                 ); ?><p>
    50         <?php endif;
     28                );
     29
     30                return '<p>' . $log_in_text . '</p>';
     31        }
     32
     33        $notice = '';
     34
     35        if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-themes-upload' ) && 'upload' === $_POST['action'] ) {
     36                $message = wporg_themes_process_upload();
     37
     38                if ( ! empty( $message ) ) {
     39                        $notice = "<div class='notice notice-warning'><p>{$message}</p></div>";
     40                }
     41        }
     42
     43        $form = '<h4>' . __( 'Select your zipped theme file', 'wporg-themes' ) . '</h4>
     44                <form enctype="multipart/form-data" id="upload_form" method="POST" action="" onsubmit="jQuery(\'#upload_button\').attr(\'disabled\',\'disabled\'); return true;">
     45                        ' . wp_nonce_field( 'wporg-themes-upload', '_wpnonce', true, false ) . '
     46                        <input type="hidden" name="action" value="upload"/>
     47                        <input type="file" id="zip_file" name="zip_file" size="25"/>
     48                        <button id="upload_button" class="button" type="submit" value="' . esc_attr__( 'Upload', 'wporg-themes' ) . '">' . esc_html__( 'Upload', 'wporg-themes' ) . '</button>
     49                        <p>
     50                                <small>' . sprintf( __( 'Maximum allowed file size: %s', 'wporg-themes' ), esc_html( wporg_themes_get_max_allowed_file_size() ) ) . '</small>
     51                        </p>
     52                </form>';
     53
     54        return $notice . $form;
    5155}
    5256
    5357/**
  • wordpress.org/public_html/wp-content/themes/pub/wporg-themes/page-upload.php

    diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-themes/page-upload.php wordpress.org/public_html/wp-content/themes/pub/wporg-themes/page-upload.php
    index 19e207c1e..a693e489d 100644
    if ( have_posts() ) : 
    3737
    3838                        <div class="entry-content">
    3939                                <p><?php esc_html_e( 'Your theme will be submitted for review to be distributed on the official WordPress.org Theme Directory.', 'wporg-themes' ); ?></p>
    40                                 <?php the_content(); // do_shortcode( '[wporg-themes-upload]' ); ?>
     40                                <h3><?php esc_html_e( 'Read the requirements before updating a theme', 'wporg-themes' ); ?></h3>
     41                                <p><?php printf( __( 'In order to have your theme hosted on <a href="%1$s" target="_blank" rel="noopener noreferrer">WordPress.org</a>, your code is required to comply with all the <a href="%2$s" target="_blank" rel="noopener noreferrer">requirements on the Theme Review Teams handbook page</a>.'), esc_url( 'https://wordpress.org/' ), esc_url( 'https://make.wordpress.org/themes/handbook/review/required/' ) ) ?></p>
     42                                <div style="height: 20px;" aria-hidden="true" class="wp-block-spacer"></div>
     43                                <?php the_content(); ?>
     44                                <div style="height: 20px;" aria-hidden="true" class="wp-block-spacer"></div>
     45                                <h3><?php esc_html_e( 'How to upload a theme update', 'wporg-themes' ); ?></h3>
     46                                <p><?php esc_html_e( 'If you are uploading a theme update, simply increase the version inside of style.css and upload the themename.zip file again, just like you do with a new theme.', 'wporg-themes' ); ?></p>
    4147                        </div><!-- .entry-content -->
    4248
    4349                </article><!-- #post-## -->