Changeset 11271 for sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
- Timestamp:
- 10/11/2021 04:35:48 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
r11176 r11271 30 30 function wporg_themes_render_upload_shortcode() { 31 31 if ( ! is_user_logged_in() ) { 32 33 $log_in_text = sprintf( 34 __( 'Before you can upload a new theme, <a href="%s">please log in</a>.', 'wporg-themes' ), 32 return sprintf( 33 '<p>' . __( 'Before you can upload a new theme, <a href="%s">please log in</a>.', 'wporg-themes' ) . '</p>', 35 34 add_query_arg( 36 35 'redirect_to', … … 39 38 ) 40 39 ); 41 42 return '<p>' . $log_in_text . '</p>';43 40 } 44 41 45 $notice = ''; 42 $notice = ''; 43 $terms_notice = ''; 46 44 47 45 if ( … … 53 51 54 52 $notice_content = ''; 53 $code = ''; 55 54 56 55 if ( is_wp_error( $messages ) ) { … … 63 62 } 64 63 65 $notice = "<div class='notice notice-warning notice-large'><ul>{$notice_content}</ul></div>"; 64 if ( 'pre_upload_terms' === $code ) { 65 $terms_notice = "<div class='notice notice-error notice-large'><ul>{$notice_content}</ul></div>"; 66 } else { 67 $notice = "<div class='notice notice-warning notice-large'><ul>{$notice_content}</ul></div>"; 68 } 66 69 } 67 70 68 $form ='<h2>' . __( 'Select your zipped theme file', 'wporg-themes' ) . '</h2>71 return $notice . '<h2>' . __( 'Select your zipped theme file', 'wporg-themes' ) . '</h2> 69 72 <form enctype="multipart/form-data" id="upload_form" method="POST" action="" onsubmit="jQuery(\'#upload_button\').attr(\'disabled\',\'disabled\'); return true;"> 70 73 ' . wp_nonce_field( 'wporg-themes-upload', '_wpnonce', true, false ) . ' 71 74 <input type="hidden" name="action" value="upload"/> 72 75 <input type="file" id="zip_file" name="zip_file" size="25"/> 73 <button id="upload_button" class="button" type="submit" value="' . esc_attr__( 'Upload', 'wporg-themes' ) . '">' . esc_html__( 'Upload', 'wporg-themes' ) . '</button>74 76 <p> 75 77 <small>' . sprintf( __( 'Maximum allowed file size: %s', 'wporg-themes' ), esc_html( size_format( wp_max_upload_size() ) ) ) . '</small> 76 78 </p> 79 80 ' . $terms_notice . ' 81 82 <p> 83 <label><input type="checkbox" required="required" name="required_terms[permission]"> ' . __( 'I have permission to upload this theme to WordPress.org for others to use and share.', 'wporg-themes' ) . '</label><br> 84 <label><input type="checkbox" required="required" name="required_terms[guidelines]"> ' . sprintf( __( 'The theme complies with all <a href="%s">Theme Guidelines</a>.', 'wporg-themes' ), 'https://make.wordpress.org/themes/handbook/review/required/' ) . '</label><br> 85 <label><input type="checkbox" required="required" name="required_terms[gpl]"> ' . sprintf( __( 'The theme, and all included assets, <a href="%s">are licenced as GPL or are under a GPL compatible license</a>.', 'wporg-themes' ), 'https://make.wordpress.org/themes/handbook/review/required/#1-licensing-copyright' ) . '</label><br> 86 </p> 87 88 <button id="upload_button" class="button" type="submit" value="' . esc_attr__( 'Upload', 'wporg-themes' ) . '">' . esc_html__( 'Upload', 'wporg-themes' ) . '</button> 77 89 </form>'; 78 79 return $notice . $form;80 90 } 81 91 … … 100 110 } 101 111 112 if ( empty( $_POST['required_terms'] ) || count( $_POST['required_terms'] ) !== 3 ) { 113 return new WP_Error( 114 'pre_upload_terms', 115 __( 'Please agree to terms below.', 'wporg-themes' ) 116 ); 117 } 118 102 119 if ( ! class_exists( 'WPORG_Themes_Upload' ) ) { 103 120 include_once __DIR__ . '/class-wporg-themes-upload.php';
Note: See TracChangeset
for help on using the changeset viewer.