Skip to content

Commit

Permalink
Add nonce for widget accessibility mode.
Browse files Browse the repository at this point in the history
Props vortfu.

See #23328.

Merges [39765] to 3.7 branch.

Built from https://develop.svn.wordpress.org/branches/3.7@39771


git-svn-id: http://core.svn.wordpress.org/branches/3.7@39709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
aaroncampbell committed Jan 11, 2017
1 parent 45af63e commit bf3ac93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wp-admin/includes/screen.php
Expand Up @@ -901,7 +901,8 @@ public function show_screen_options() {

switch ( $this->id ) {
case 'widgets':
$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";
$nonce = wp_create_nonce( 'widgets-access' );
$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";
break;
default:
$this->_screen_settings = '';
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/widgets.php
Expand Up @@ -17,6 +17,8 @@

$widgets_access = get_user_setting( 'widgets_access' );
if ( isset($_GET['widgets-access']) ) {
check_admin_referer( 'widgets-access' );

$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
set_user_setting( 'widgets_access', $widgets_access );
}
Expand Down

0 comments on commit bf3ac93

Please sign in to comment.