WordPress.org

Making WordPress.org

Changeset 10796


Ignore:
Timestamp:
03/09/2021 12:38:15 AM (7 months ago)
Author:
dd32
Message:

Plugin Directory: Readme Validator: Allow passing the readme URL through a GET parameter to make linking to readme examples easier.

See #2538.

File:
1 edited

Legend:

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

    r10004 r10796  
    1414        <div class="wrap">
    1515            <?php
    16             if ( $_POST ) {
     16            if ( $_REQUEST ) {
    1717                self::validate_readme();
    1818            }
    1919
    20             $readme_url      = $_POST['readme_url'] ?? '';
     20            $readme_url      = $_REQUEST['readme'] ?? '';
    2121            $readme_contents = $_POST['readme_contents'] ?? '';
    2222            $readme_contents = base64_decode( wp_unslash( $readme_contents ) );
    2323            ?>
    2424
    25             <form method="post" action="">
     25            <form method="get" action="">
    2626                <p>
    27                     <input type="text" name="readme_url" size="70" placeholder="https://" value="<?php echo esc_attr( $readme_url ); ?>" />
     27                    <input type="text" name="readme" size="70" placeholder="https://" value="<?php echo esc_attr( $readme_url ); ?>" />
    2828                    <input type="submit" class="button button-secondary" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" />
    2929                </p>
     
    3333                <textarea rows="20" cols="100" name="readme_visible" placeholder="=== Plugin Name ==="><?php echo esc_textarea( $readme_contents ); ?></textarea>
    3434                <form id="readme-data" method="post" action="">
     35                    <input type="hidden" name="readme" value="" />
    3536                    <textarea class="screen-reader-text" rows="20" cols="100" name="readme_contents"><?php echo esc_textarea( $readme_contents ); ?></textarea>
    3637                <p><input type="submit" class="button button-secondary" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" /></p>
     
    5859     */
    5960    protected static function validate_readme() {
    60         if ( ! empty( $_POST['readme_url'] ) ) {
    61             $errors = Validator::instance()->validate_url( wp_unslash( $_POST['readme_url'] ) );
     61        if ( ! empty( $_REQUEST['readme'] ) ) {
     62            $errors = Validator::instance()->validate_url( wp_unslash( $_REQUEST['readme'] ) );
    6263
    6364        } elseif ( ! empty( $_POST['readme_contents'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.