WordPress.org

Make WordPress Core

Changeset 39768


Ignore:
Timestamp:
01/11/2017 01:50:33 AM (3 years ago)
Author:
aaroncampbell
Message:

Add nonce for widget accessibility mode.

Props vortfu.

See #23328.

Merges [39765] to 4.0 branch.

Location:
branches/4.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/wp-admin/includes/screen.php

    r29588 r39768  
    970970        switch ( $this->base ) {
    971971            case 'widgets':
    972                 $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
     972                $nonce = wp_create_nonce( 'widgets-access' );
     973                $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __('Disable accessibility mode') . "</a></p>\n";
    973974                break;
    974975            case 'post' :
  • branches/4.0/src/wp-admin/widgets.php

    r29206 r39768  
    1818$widgets_access = get_user_setting( 'widgets_access' );
    1919if ( isset($_GET['widgets-access']) ) {
     20    check_admin_referer( 'widgets-access' );
     21
    2022    $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
    2123    set_user_setting( 'widgets_access', $widgets_access );
Note: See TracChangeset for help on using the changeset viewer.