Changeset 6287 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-readme-validator.php
- Timestamp:
- 12/19/2017 04:22:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-readme-validator.php
r5333 r6287 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory\Shortcodes; 3 3 4 use WordPressdotorg\Plugin_Directory\Readme\Validator; 4 5 … … 21 22 <form method="post" action=""> 22 23 <p> 23 <input type="text" name="readme_url" size="70" placeholder="https://" value="<?php if ( isset( $_POST['readme_url'] ) ) { echo esc_attr( $_POST['readme_url'] ); } ?>" /> 24 <input type="submit" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" /> 24 <input type="text" name="readme_url" size="70" placeholder="https://" value=" 25 <?php 26 if ( isset( $_POST['readme_url'] ) ) { 27 echo esc_attr( $_POST['readme_url'] ); 28 } 29 ?> 30 " /> 31 <input type="submit" class="button button-secondary" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" /> 25 32 </p> 26 33 </form> … … 28 35 <p><?php _e( '... or paste your <code>readme.txt</code> here:', 'wporg-plugins' ); ?></p> 29 36 <form method="post" action=""> 30 <textarea rows="20" cols="100" name="readme_contents" placeholder="=== Plugin Name ==="><?php 37 <textarea rows="20" cols="100" name="readme_contents" placeholder="=== Plugin Name ==="> 38 <?php 31 39 if ( isset( $_POST['readme_contents'] ) ) { 32 40 echo esc_textarea( wp_unslash( $_POST['readme_contents'] ) ); 33 41 } 34 ?></textarea> 35 <p><input type="submit" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" /></p> 42 ?> 43 </textarea> 44 <p><input type="submit" class="button button-secondary" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" /></p> 36 45 </form> 37 46 </div> … … 43 52 */ 44 53 protected static function validate_readme() { 45 if ( !empty( $_POST['readme_url'] ) ) {54 if ( ! empty( $_POST['readme_url'] ) ) { 46 55 $errors = Validator::instance()->validate_url( wp_unslash( $_POST['readme_url'] ) ); 47 56 48 } elseif ( ! empty( $_POST['readme_contents'] ) ) {57 } elseif ( ! empty( $_POST['readme_contents'] ) ) { 49 58 $errors = Validator::instance()->validate_content( wp_unslash( $_REQUEST['readme_contents'] ) ); 50 59 … … 58 67 'errors' => __( 'Fatal Errors:', 'wporg-plugins' ), 59 68 'warnings' => __( 'Warnings:', 'wporg-plugins' ), 60 'notes' => __( 'Notes:', 'wporg-plugins' ) 69 'notes' => __( 'Notes:', 'wporg-plugins' ), 61 70 ); 62 71 foreach ( $error_types as $field => $warning_label ) { 63 if ( ! empty( $errors[ $field ] ) ) {72 if ( ! empty( $errors[ $field ] ) ) { 64 73 $output .= "{$warning_label}\n<ul class='{$field} error'>\n"; 65 74 foreach ( $errors[ $field ] as $notice ) { … … 72 81 if ( empty( $output ) ) { 73 82 $output .= '<div class="notice notice-success notice-alt">'; 74 $output .= '<p>' . __( 'Congratulations! No errors found.', 'wporg-plugins' ) . '</p>';83 $output .= '<p>' . __( 'Congratulations! No errors found.', 'wporg-plugins' ) . '</p>'; 75 84 $output .= '</div>'; 76 85 }
Note: See TracChangeset
for help on using the changeset viewer.