New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trac 39693: Fix missing assignment of widgets on theme switch #251

Open
wants to merge 10 commits into
base: master
from

Fix minor PHPCS issues in diff

  • Loading branch information...
westonruter committed Sep 1, 2017
commit 206f97d434748ea4b113cf91446f1efc70d44b83
@@ -713,7 +713,10 @@ function switch_theme( $stylesheet ) {
}
if ( is_array( $_sidebars_widgets ) ) {
set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets ) );
set_theme_mod( 'sidebars_widgets', array(
'time' => time(),
'data' => $_sidebars_widgets,
) );
}
// Migrate from the old mods_{name} option to theme_mods_{slug}.
@@ -1134,7 +1134,7 @@ function retrieve_widgets( $theme_changed = false ) {
sort( $sidebars_widgets_keys );
sort( $registered_sidebars_keys );
if ( $sidebars_widgets_keys == $registered_sidebars_keys ) {
if ( $sidebars_widgets_keys === $registered_sidebars_keys ) {
$sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids );
return $sidebars_widgets;
@@ -1271,7 +1271,7 @@ function _wp_map_sidebars( $old_sidebars_widgets ) {
$orphaned = 0;
foreach ( $old_sidebars_widgets as $widgets ) {
if ( is_array( $widgets ) && ! empty( $widgets ) ) {
$new_sidebars_widgets[ 'orphaned_widgets_' . ++$orphaned ] = $widgets;
$new_sidebars_widgets[ 'orphaned_widgets_' . ( ++$orphaned ) ] = $widgets;
}
}
@@ -929,11 +929,11 @@ function test_retrieve_widgets_for_customizer() {
}
/**
*
* Test _wp_remove_unregistered_widgets.
*
* @covers _wp_remove_unregistered_widgets()
*/
function test__wp_remove_unregistered_widgets() {
public function test__wp_remove_unregistered_widgets() {
$widgets = array(
'sidebar-1' => array( 'tag_cloud-1' ),
'sidebar-2' => array( 'text-1' ),
@@ -963,7 +963,7 @@ function test__wp_remove_unregistered_widgets() {
*
* @covers _wp_map_sidebars()
*/
function test_one_sidebar_each() {
public function test_one_sidebar_each() {
$this->register_sidebars( array( 'primary' ) );
$prev_theme_sidebars = array(
'unique-slug' => 1,
@@ -982,7 +982,7 @@ function test_one_sidebar_each() {
*
* @covers _wp_map_sidebars()
*/
function test_sidebars_with_same_slug() {
public function test_sidebars_with_same_slug() {
$this->register_sidebars( array( 'primary', 'secondary' ) );
$prev_theme_sidebars = array(
'primary' => 1,
@@ -999,7 +999,7 @@ function test_sidebars_with_same_slug() {
*
* @covers _wp_map_sidebars()
*/
function test_sidebar_guessing() {
public function test_sidebar_guessing() {
$this->register_sidebars( array( 'primary', 'secondary' ) );
$prev_theme_sidebars = array(
@@ -1021,7 +1021,7 @@ function test_sidebar_guessing() {
*
* @covers _wp_map_sidebars()
*/
function test_sidebar_guessing_one_menu_per_group() {
public function test_sidebar_guessing_one_menu_per_group() {
$this->register_sidebars( array( 'primary' ) );
$prev_theme_sidebars = array(
'top-menu' => array(),
@@ -1041,7 +1041,7 @@ function test_sidebar_guessing_one_menu_per_group() {
*
* @covers _wp_map_sidebars()
*/
function test_sidebar_guessing_one_menu_per_sidebar() {
public function test_sidebar_guessing_one_menu_per_sidebar() {
$this->register_sidebars( array( 'primary', 'main' ) );
$prev_theme_sidebars = array(
ProTip! Use n and p to navigate between commits in a pull request.