From 12db99072a54fc867a07438a6b1d860a970e7c56 Mon Sep 17 00:00:00 2001 From: Jay Wood Date: Fri, 30 Sep 2016 14:17:53 -0400 Subject: [PATCH] Add backwards compat fix for new single-stage array --- content-warning-v2.php | 2 +- includes/admin.php | 16 ++++++++++++++++ includes/api.php | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/content-warning-v2.php b/content-warning-v2.php index 3cfb786..aca9151 100644 --- a/content-warning-v2.php +++ b/content-warning-v2.php @@ -86,13 +86,13 @@ class ContentWarning_v2 { add_action( 'wp_footer', array( $this, 'render_dialog' ) ); add_action( 'wp_head', array( $this, 'override_css' ) ); + if ( ! is_admin() ) { } $this->plugin_classes(); } - /** * Get Cookie Name * diff --git a/includes/admin.php b/includes/admin.php index 98bba57..09ccd5b 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -37,6 +37,9 @@ class CWV2_Admin { * @since 3.6.3 */ function hooks() { + + add_action( 'admin_init', array( $this, 'admin_init' ) ); + // Post Meta Box for this. add_action( 'add_meta_boxes', array( $this, 'setup_metabox' ) ); add_action( 'save_post', array( $this, 'cwv3_meta_save' ) ); @@ -59,6 +62,19 @@ class CWV2_Admin { add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_script' ) ); } + /** + * Back compat update + * + * @deprecated Will deprecate a few versions out. + * @author JayWood + */ + public function admin_init() { + $color = get_option( 'cwv3_bg_color', '' ); + if ( isset( $color['color'] ) ) { + update_option( 'cwv3_bg_color', $color['color'] ); + } + } + /** * Enqueues up the adminisrator scripts/styles * diff --git a/includes/api.php b/includes/api.php index d00626f..9705af5 100644 --- a/includes/api.php +++ b/includes/api.php @@ -25,7 +25,7 @@ function cwv3_get_css() { $opacity = get_option( 'cwv3_bg_opacity', '' ); $bg_image_css = ! empty( $image ) ? 'background: url( '. esc_url( $image ) . ' ) no-repeat top center;' : ''; - $bg_color_css = ! empty( $color ) ? 'background-color: ' . $color['color'] . ';' : ''; + $bg_color_css = ! empty( $color ) ? 'background-color: ' . $color . ';' : ''; ob_start(); ?>