Skip to content

Commit

Permalink
Have get_admin_color_scheme() return an array instead of an object
Browse files Browse the repository at this point in the history
  • Loading branch information
cabrerahector committed Sep 20, 2017
1 parent 5ee9302 commit 0a9634d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions admin/class-wordpress-popular-posts-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ public function print_chart_script( $data, $containter_id ){

jQuery("#<?php echo $containter_id; ?> p").remove();

var wpp_chart_views_color = '<?php echo $color_scheme->colors[2]; ?>';
var wpp_chart_comments_color = '<?php echo $color_scheme->colors[3]; ?>';
var wpp_chart_views_color = '<?php echo $color_scheme[2]; ?>';
var wpp_chart_comments_color = '<?php echo $color_scheme[3]; ?>';

var wpp_chart_data = {
labels: [ <?php foreach( $data['dates'] as $date => $date_data ) : echo "'" . date_i18n( 'D d', strtotime( $date ) ) . "', "; endforeach; ?>],
Expand Down Expand Up @@ -846,18 +846,14 @@ private function get_admin_color_scheme(){
$color_scheme = 'fresh';
}

if ( isset($_wp_admin_css_colors[ $color_scheme ]) ) {
return $_wp_admin_css_colors[ $color_scheme ];
if ( isset($_wp_admin_css_colors[ $color_scheme ]) && isset($_wp_admin_css_colors[ $color_scheme ]->colors) ) {
return $_wp_admin_css_colors[ $color_scheme ]->colors;
}

}

// Fallback, just in case

$theme = new stdClass;
$theme->colors = array( '#333', '#999', '#881111', '#a80000' );

return $theme;
return array( '#333', '#999', '#881111', '#a80000' );

}

Expand Down

0 comments on commit 0a9634d

Please sign in to comment.