Making WordPress.org

Changeset 10007


Ignore:
Timestamp:
07/03/2020 06:33:41 AM (4 years ago)
Author:
tellyworth
Message:

Plugin directory: make it easier to validate block plugins by name or URL.

This improves the input handler to accept either a plugin slug, or a URL like https://wordpress.org/plugins/the-slug/.

See #5303.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-block-plugin-checker.php

    r10003 r10007  
    5959        if ( preg_match( '#^\w+@github[.]com:(\w+/[^.]+)(?:\.git)?$#', $url, $matches ) ) {
    6060            $url = 'https://github.com/' . $matches[1];
     61        }
     62
     63        if ( preg_match( '#^(?:https://wordpress.org/plugins/)?([-\w]+)/?$#', $url, $matches ) ) {
     64            $url = 'https://plugins.svn.wordpress.org/' . $matches[1];
    6165        }
    6266
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php

    r10006 r10007  
    2121                </p>
    2222                <p>
    23                     <input type="text" id="plugin_url" name="plugin_url" size="70" placeholder="https://plugins.svn.wordpress.org/" value="<?php echo esc_url( $plugin_url ); ?>" />
     23                    <input type="text" id="plugin_url" name="plugin_url" size="70" placeholder="https://plugins.svn.wordpress.org/" value="<?php echo esc_attr( $plugin_url ); ?>" />
    2424                    <input type="submit" class="button button-secondary" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" />
    2525                    <?php wp_nonce_field( 'validate-block-plugin', 'block-nonce' ); ?>
Note: See TracChangeset for help on using the changeset viewer.