WordPress.org

Make WordPress Core

Ticket #9490: 9490.diff

File 9490.diff, 958 bytes (added by Denis-de-Bernardy, 9 years ago)
  • Users/denis/Sites/sem-pro/wp-admin/widgets.php

     
    2626// $sidebar = What sidebar are we editing?
    2727if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']]) ) {
    2828        $sidebar = attribute_escape( $_GET['sidebar'] );
     29        setcookie('sidebar_' . COOKIEHASH, $sidebar, time() + 14 * 86400, COOKIEPATH, COOKIE_DOMAIN);
     30} elseif ( isset($_COOKIE['sidebar_' . COOKIEHASH]) && isset($wp_registered_sidebars[$_COOKIE['sidebar_' . COOKIEHASH]]) ) {
     31        $sidebar = attribute_escape( $_COOKIE['sidebar_' . COOKIEHASH] );
    2932} elseif ( is_array($wp_registered_sidebars) && !empty($wp_registered_sidebars) ) {
    3033        // By default we look at the first defined sidebar
    3134        $sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) );