From d0e3147e8a97f8dfd3e463eb505d9331ffa16fb7 Mon Sep 17 00:00:00 2001 From: Frankie Jarrett Date: Mon, 9 Jun 2014 16:36:57 -0500 Subject: [PATCH] Trivial code formatting --- includes/charts.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/charts.php b/includes/charts.php index e9d9efa4..6f3a4ebe 100644 --- a/includes/charts.php +++ b/includes/charts.php @@ -3,15 +3,13 @@ class WP_Stream_Reports_Charts { public function __construct() { - // Make charts add_filter( 'wp_stream_reports_make_chart', array( $this, 'pie_chart_coordinates' ), 10, 2 ); add_filter( 'wp_stream_reports_make_chart', array( $this, 'bar_chart_coordinates' ), 10, 2 ); add_filter( 'wp_stream_reports_make_chart', array( $this, 'line_chart_coordinates' ), 10, 2 ); - } - - function line_chart_coordinates( $records, $args ) { + + public function line_chart_coordinates( $records, $args ) { if ( 'line' !== $args['chart_type'] ) { return $records; } @@ -30,6 +28,7 @@ function line_chart_coordinates( $records, $args ) { } $coordinates = array(); + foreach ( $sorted as $line_name => $points ) { $line_data = array( 'key' => $line_name, @@ -49,10 +48,11 @@ function line_chart_coordinates( $records, $args ) { return $coordinates; } - function pie_chart_coordinates( $records, $args ) { + public function pie_chart_coordinates( $records, $args ) { if ( 'pie' !== $args['chart_type'] ) { return $records; } + $counts = array(); foreach ( $records as $type => $items ) { @@ -65,7 +65,7 @@ function pie_chart_coordinates( $records, $args ) { return $counts; } - function bar_chart_coordinates( $records, $args ) { + public function bar_chart_coordinates( $records, $args ) { if ( 'multibar' !== $args['chart_type'] ) { return $records; } @@ -125,6 +125,7 @@ public function count_by_field( $field, $records, $callback = '' ) { */ public function group_by_field( $field, $records, $callback = '' ) { $sorted = array(); + foreach ( $records as $record ) { $key = $record->$field; @@ -176,4 +177,3 @@ protected function collapse_dates( $date ) { } } -