Make WordPress Core


Ignore:
Timestamp:
09/11/2015 09:07:45 PM (9 years ago)
Author:
wonderboymusic
Message:

Introduce wp_validate_action( $action = '' ), a helper function that checks $_REQUEST for action and returns it, or empty string if not present. If $action is passed, it checks to make sure they match before returning it, or an empty string. Strings are always returned to avoid returning multiple types.

Implementing this removes 27 uses of direct superglobal access in the admin.

For more reading:
https://codeclimate.com/github/WordPress/WordPress/wp-admin/edit-comments.php

See #33837.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin-post.php

    r30649 r34059  
    2929do_action( 'admin_init' );
    3030
    31 $action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action'];
     31$action = wp_validate_action();
    3232
    3333if ( ! wp_validate_auth_cookie() ) {
Note: See TracChangeset for help on using the changeset viewer.