From a654a090e6bd8e6bd8ce97f6700582bf84f71a72 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 22 Aug 2016 10:27:14 +1000 Subject: [PATCH] Use array_keys to prevent error in admin --- includes/admin/settings/class-sp-settings-page.php | 4 ++-- includes/class-sp-template-loader.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/admin/settings/class-sp-settings-page.php b/includes/admin/settings/class-sp-settings-page.php index be6c8e6c..ad8efc20 100644 --- a/includes/admin/settings/class-sp-settings-page.php +++ b/includes/admin/settings/class-sp-settings-page.php @@ -91,7 +91,7 @@ class SP_Settings_Page { $templates = array_merge( array_flip( $layout ), $templates ); - $slice = array_search( 'tabs', array_flip( $templates ) ); + $slice = array_search( 'tabs', array_keys( $templates ) ); if ( $slice ) { $templates = array_slice( $templates, 0, $slice ); } @@ -144,7 +144,7 @@ class SP_Settings_Page { $templates = array_merge( array_flip( $layout ), $templates ); - $slice = array_search( 'tabs', array_flip( $templates ) ); + $slice = array_search( 'tabs', array_keys( $templates ) ); if ( $slice ) { $templates = array_slice( $templates, $slice ); } else { diff --git a/includes/class-sp-template-loader.php b/includes/class-sp-template-loader.php index 9ff22fac..a6a8f5cc 100644 --- a/includes/class-sp-template-loader.php +++ b/includes/class-sp-template-loader.php @@ -75,7 +75,7 @@ class SP_Template_Loader { $templates = apply_filters( 'sportspress_' . $type . '_templates', $templates ); // Split templates into sections and tabs - $slice = array_search( 'tabs', array_flip( $templates ) ); + $slice = array_search( 'tabs', array_keys( $templates ) ); if ( $slice ) { $section_templates = array_slice( $templates, 0, $slice ); $tab_templates = array_slice( $templates, $slice );