Make WordPress Core


Ignore:
Timestamp:
09/11/2015 09:07:45 PM (10 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/network/site-info.php

    r33921 r34059  
    5454$is_main_site = is_main_site( $id );
    5555
    56 if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
     56if ( wp_validate_action( 'update-site' ) ) {
    5757    check_admin_referer( 'edit-site' );
    5858
Note: See TracChangeset for help on using the changeset viewer.