Completed
Pull Request — master (#517)
by Chris
15:12
created
includes/admin/reporting/class-donor-reports-table.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Donor Reports Table Class
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Reports
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Donor Reports Table Class
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Reports
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 
174 174
 			case 'num_purchases' :
175 175
 				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
176
+						 admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
+						 ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => __( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => __( 'Donors', 'give' ),    // Plural name of the listed records
65
+		parent::__construct(array(
66
+			'singular' => __('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records
68 68
 			'ajax'     => false                        // Does this table support ajax?
69
-		) );
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,29 +124,29 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' == $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' == $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donors Report', 'give' ); ?></span></h3>
135
+			<h3 class="alignleft reports-earnings-title"><span><?php _e('Donors Report', 'give'); ?></span></h3>
136 136
 
137 137
 			<div class="alignright tablenav-right">
138 138
 				<div class="actions bulkactions">
139 139
 					<?php
140
-					if ( 'top' == $which ) {
141
-						$this->give_search_box( __( 'Search Donors', 'give' ), 'give-donors-report-search' );
140
+					if ('top' == $which) {
141
+						$this->give_search_box(__('Search Donors', 'give'), 'give-donors-report-search');
142 142
 					}
143 143
 
144
-					$this->bulk_actions( $which ); ?>
144
+					$this->bulk_actions($which); ?>
145 145
 
146 146
 				</div>
147 147
 				<?php
148
-				$this->extra_tablenav( $which );
149
-				$this->pagination( $which );
148
+				$this->extra_tablenav($which);
149
+				$this->pagination($which);
150 150
 				?>
151 151
 			</div>
152 152
 
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Column Name
170 170
 	 */
171
-	public function column_default( $item, $column_name ) {
172
-		switch ( $column_name ) {
171
+	public function column_default($item, $column_name) {
172
+		switch ($column_name) {
173 173
 
174 174
 			case 'num_purchases' :
175
-				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
175
+				$value = '<a href="'.
176
+				         admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
177
+				         ).'">'.esc_html($item['num_purchases']).'</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
181
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
181
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
182 182
 				break;
183 183
 
184 184
 			default:
185
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
185
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
186 186
 				break;
187 187
 		}
188 188
 
189
-		return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] );
189
+		return apply_filters('give_report_column_'.$column_name, $value, $item['id']);
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function get_columns() {
200 200
 		$columns = array(
201
-			'name'          => __( 'Name', 'give' ),
202
-			'id'            => __( 'ID', 'give' ),
203
-			'email'         => __( 'Email', 'give' ),
204
-			'num_purchases' => __( 'Purchases', 'give' ),
205
-			'amount_spent'  => __( 'Total Spent', 'give' )
201
+			'name'          => __('Name', 'give'),
202
+			'id'            => __('ID', 'give'),
203
+			'email'         => __('Email', 'give'),
204
+			'num_purchases' => __('Purchases', 'give'),
205
+			'amount_spent'  => __('Total Spent', 'give')
206 206
 		);
207 207
 
208
-		return apply_filters( 'give_report_donor_columns', $columns );
208
+		return apply_filters('give_report_donor_columns', $columns);
209 209
 
210 210
 	}
211 211
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	public function get_sortable_columns() {
220 220
 		return array(
221
-			'id'            => array( 'id', true ),
222
-			'name'          => array( 'name', true ),
223
-			'num_purchases' => array( 'purchase_count', false ),
224
-			'amount_spent'  => array( 'purchase_value', false ),
221
+			'id'            => array('id', true),
222
+			'name'          => array('name', true),
223
+			'num_purchases' => array('purchase_count', false),
224
+			'amount_spent'  => array('purchase_value', false),
225 225
 		);
226 226
 	}
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @return void
234 234
 	 */
235
-	public function bulk_actions( $which = '' ) {
235
+	public function bulk_actions($which = '') {
236 236
 		// These aren't really bulk actions but this outputs the markup in the right place
237 237
 		give_report_views();
238 238
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		}
293 293
 
294
-		$donors = Give()->customers->get_customers( $args );
294
+		$donors = Give()->customers->get_customers($args);
295 295
 
296
-		if ( $donors ) {
296
+		if ($donors) {
297 297
 
298
-			$this->count = count( $donors );
298
+			$this->count = count($donors);
299 299
 
300
-			foreach ( $donors as $donor ) {
300
+			foreach ($donors as $donor) {
301 301
 
302
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
302
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $donor->id,
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 		$hidden   = array(); // No hidden columns
333 333
 		$sortable = $this->get_sortable_columns();
334 334
 
335
-		$this->_column_headers = array( $columns, $hidden, $sortable );
335
+		$this->_column_headers = array($columns, $hidden, $sortable);
336 336
 
337 337
 		$this->items = $this->reports_data();
338 338
 
339 339
 		$this->total = give_count_total_customers();
340 340
 
341
-		$this->set_pagination_args( array(
341
+		$this->set_pagination_args(array(
342 342
 			'total_items' => $this->total,
343 343
 			'per_page'    => $this->per_page,
344
-			'total_pages' => ceil( $this->total / $this->per_page )
345
-		) );
344
+			'total_pages' => ceil($this->total / $this->per_page)
345
+		));
346 346
 	}
347 347
 }
348 348
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param string $text     Label for the search box
82 82
 	 * @param string $input_id ID of the search box
83 83
 	 *
84
-	 * @return false
84
+	 * @return false|null
85 85
 	 */
86 86
 	public function search_box( $text, $input_id ) {
87 87
 		return;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @access public
255 255
 	 * @since  1.0
256
-	 * @return mixed string If search is present, false otherwise
256
+	 * @return string|false string If search is present, false otherwise
257 257
 	 */
258 258
 	public function get_search() {
259 259
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-customers.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Donors Export Class
4
- *
5
- * This class handles donor export
6
- *
7
- * @package     Give
8
- * @subpackage  Admin/Reports
9
- * @copyright   Copyright (c) 2015, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.0
12
- */
3
+	 * Donors Export Class
4
+	 *
5
+	 * This class handles donor export
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Admin/Reports
9
+	 * @copyright   Copyright (c) 2015, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.0
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		$extra = '';
48 48
 
49
-		if ( ! empty( $_POST['give_export_download'] ) ) {
50
-			$extra = sanitize_title( get_the_title( absint( $_POST['give_export_download'] ) ) ) . '-';
49
+		if ( ! empty($_POST['give_export_download'])) {
50
+			$extra = sanitize_title(get_the_title(absint($_POST['give_export_download']))).'-';
51 51
 		}
52 52
 
53 53
 		nocache_headers();
54
-		header( 'Content-Type: text/csv; charset=utf-8' );
55
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_donors_export_filename', 'give-export-' . $extra . $this->export_type . '-' . date( 'm-d-Y' ) ) . '.csv' );
56
-		header( "Expires: 0" );
54
+		header('Content-Type: text/csv; charset=utf-8');
55
+		header('Content-Disposition: attachment; filename='.apply_filters('give_donors_export_filename', 'give-export-'.$extra.$this->export_type.'-'.date('m-d-Y')).'.csv');
56
+		header("Expires: 0");
57 57
 	}
58 58
 
59 59
 	/**
@@ -64,26 +64,26 @@  discard block
 block discarded – undo
64 64
 	 * @return array $cols All the columns
65 65
 	 */
66 66
 	public function csv_cols() {
67
-		if ( ! empty( $_POST['give_export_download'] ) ) {
67
+		if ( ! empty($_POST['give_export_download'])) {
68 68
 			$cols = array(
69
-				'first_name' => __( 'First Name', 'give' ),
70
-				'last_name'  => __( 'Last Name', 'give' ),
71
-				'email'      => __( 'Email', 'give' ),
72
-				'date'       => __( 'Date Donated', 'give' )
69
+				'first_name' => __('First Name', 'give'),
70
+				'last_name'  => __('Last Name', 'give'),
71
+				'email'      => __('Email', 'give'),
72
+				'date'       => __('Date Donated', 'give')
73 73
 			);
74 74
 		} else {
75 75
 
76 76
 			$cols = array();
77 77
 
78
-			if ( 'emails' != $_POST['give_export_option'] ) {
79
-				$cols['name'] = __( 'Name', 'give' );
78
+			if ('emails' != $_POST['give_export_option']) {
79
+				$cols['name'] = __('Name', 'give');
80 80
 			}
81 81
 
82
-			$cols['email'] = __( 'Email', 'give' );
82
+			$cols['email'] = __('Email', 'give');
83 83
 
84
-			if ( 'full' == $_POST['give_export_option'] ) {
85
-				$cols['purchases'] = __( 'Total Donations', 'give' );
86
-				$cols['amount']    = __( 'Total Donated', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')';
84
+			if ('full' == $_POST['give_export_option']) {
85
+				$cols['purchases'] = __('Total Donations', 'give');
86
+				$cols['amount']    = __('Total Donated', 'give').' ('.html_entity_decode(give_currency_filter('')).')';
87 87
 			}
88 88
 
89 89
 		}
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 
106 106
 		$data = array();
107 107
 
108
-		if ( ! empty( $_POST['give_export_download'] ) ) {
108
+		if ( ! empty($_POST['give_export_download'])) {
109 109
 
110 110
 			// Export donors of a specific product
111 111
 			global $give_logs;
112 112
 
113 113
 			$args = array(
114
-				'post_parent' => absint( $_POST['give_export_download'] ),
114
+				'post_parent' => absint($_POST['give_export_download']),
115 115
 				'log_type'    => 'sale',
116 116
 				'nopaging'    => true
117 117
 			);
118 118
 
119
-			if ( isset( $_POST['give_price_option'] ) ) {
119
+			if (isset($_POST['give_price_option'])) {
120 120
 				$args['meta_query'] = array(
121 121
 					array(
122 122
 						'key'   => '_give_log_price_id',
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 				);
126 126
 			}
127 127
 
128
-			$logs = $give_logs->get_connected_logs( $args );
128
+			$logs = $give_logs->get_connected_logs($args);
129 129
 
130
-			if ( $logs ) {
131
-				foreach ( $logs as $log ) {
132
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
133
-					$user_info  = give_get_payment_meta_user_info( $payment_id );
130
+			if ($logs) {
131
+				foreach ($logs as $log) {
132
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
133
+					$user_info  = give_get_payment_meta_user_info($payment_id);
134 134
 					$data[]     = array(
135 135
 						'first_name' => $user_info['first_name'],
136 136
 						'last_name'  => $user_info['last_name'],
@@ -143,30 +143,30 @@  discard block
 block discarded – undo
143 143
 		} else {
144 144
 
145 145
 			// Export all donors
146
-			$donors = Give()->customers->get_customers( array( 'number' => - 1 ) );
146
+			$donors = Give()->customers->get_customers(array('number' => -1));
147 147
 
148 148
 			$i = 0;
149 149
 
150
-			foreach ( $donors as $donor ) {
150
+			foreach ($donors as $donor) {
151 151
 
152
-				if ( 'emails' != $_POST['give_export_option'] ) {
153
-					$data[ $i ]['name'] = $donor->name;
152
+				if ('emails' != $_POST['give_export_option']) {
153
+					$data[$i]['name'] = $donor->name;
154 154
 				}
155 155
 
156
-				$data[ $i ]['email'] = $donor->email;
156
+				$data[$i]['email'] = $donor->email;
157 157
 
158
-				if ( 'full' == $_POST['give_export_option'] ) {
158
+				if ('full' == $_POST['give_export_option']) {
159 159
 
160
-					$data[ $i ]['purchases'] = $donor->purchase_count;
161
-					$data[ $i ]['amount']    = give_format_amount( $donor->purchase_value );
160
+					$data[$i]['purchases'] = $donor->purchase_count;
161
+					$data[$i]['amount']    = give_format_amount($donor->purchase_value);
162 162
 
163 163
 				}
164
-				$i ++;
164
+				$i++;
165 165
 			}
166 166
 		}
167 167
 
168
-		$data = apply_filters( 'give_export_get_data', $data );
169
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
168
+		$data = apply_filters('give_export_get_data', $data);
169
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
170 170
 
171 171
 		return $data;
172 172
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-earnings.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Earnings Export Class
4
- *
5
- * This class handles earnings export
6
- *
7
- * @package     Give
8
- * @subpackage  Admin/Reports
9
- * @copyright   Copyright (c) 2015, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.0
12
- */
3
+	 * Earnings Export Class
4
+	 *
5
+	 * This class handles earnings export
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Admin/Reports
9
+	 * @copyright   Copyright (c) 2015, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.0
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		nocache_headers();
48
-		header( 'Content-Type: text/csv; charset=utf-8' );
49
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
50
-		header( "Expires: 0" );
48
+		header('Content-Type: text/csv; charset=utf-8');
49
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
50
+		header("Expires: 0");
51 51
 
52 52
 	}
53 53
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	public function csv_cols() {
62 62
 
63 63
 		$cols = array(
64
-			'date'      => __( 'Date', 'give' ),
65
-			'donations' => __( 'Donations', 'give' ),
66
-			'earnings'  => __( 'Income', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')'
64
+			'date'      => __('Date', 'give'),
65
+			'donations' => __('Donations', 'give'),
66
+			'earnings'  => __('Income', 'give').' ('.html_entity_decode(give_currency_filter('')).')'
67 67
 		);
68 68
 
69 69
 		return $cols;
@@ -78,28 +78,28 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function get_data() {
80 80
 
81
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
82
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
83
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
84
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
81
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
82
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
83
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
84
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
85 85
 
86 86
 		$data  = array();
87 87
 		$year  = $start_year;
88 88
 		$stats = new Give_Payment_Stats;
89 89
 
90
-		while ( $year <= $end_year ) {
90
+		while ($year <= $end_year) {
91 91
 
92
-			if ( $year == $start_year && $year == $end_year ) {
92
+			if ($year == $start_year && $year == $end_year) {
93 93
 
94 94
 				$m1 = $start_month;
95 95
 				$m2 = $end_month;
96 96
 
97
-			} elseif ( $year == $start_year ) {
97
+			} elseif ($year == $start_year) {
98 98
 
99 99
 				$m1 = $start_month;
100 100
 				$m2 = 12;
101 101
 
102
-			} elseif ( $year == $end_year ) {
102
+			} elseif ($year == $end_year) {
103 103
 
104 104
 				$m1 = 1;
105 105
 				$m2 = $end_month;
@@ -111,28 +111,28 @@  discard block
 block discarded – undo
111 111
 
112 112
 			}
113 113
 
114
-			while ( $m1 <= $m2 ) {
114
+			while ($m1 <= $m2) {
115 115
 
116
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
117
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
116
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
117
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
118 118
 
119 119
 				$data[] = array(
120
-					'date'      => date_i18n( 'F Y', $date1 ),
121
-					'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ),
122
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ),
120
+					'date'      => date_i18n('F Y', $date1),
121
+					'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')),
122
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2)),
123 123
 				);
124 124
 
125
-				$m1 ++;
125
+				$m1++;
126 126
 
127 127
 			}
128 128
 
129 129
 
130
-			$year ++;
130
+			$year++;
131 131
 
132 132
 		}
133 133
 
134
-		$data = apply_filters( 'give_export_get_data', $data );
135
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
134
+		$data = apply_filters('give_export_get_data', $data);
135
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
136 136
 
137 137
 		return $data;
138 138
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-payments.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Payments Export Class
4
- *
5
- * This class handles payment export
6
- *
7
- * @package     Give
8
- * @subpackage  Admin/Reports
9
- * @copyright   Copyright (c) 2015, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.4.4
12
- */
3
+	 * Payments Export Class
4
+	 *
5
+	 * This class handles payment export
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Admin/Reports
9
+	 * @copyright   Copyright (c) 2015, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.4.4
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 	 * @return void
38 38
 	 */
39 39
 	public function headers() {
40
-		ignore_user_abort( true );
40
+		ignore_user_abort(true);
41 41
 
42
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
43
-			set_time_limit( 0 );
42
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
43
+			set_time_limit(0);
44 44
 		}
45 45
 
46
-		$month = isset( $_POST['month'] ) ? absint( $_POST['month'] ) : date( 'n' );
47
-		$year  = isset( $_POST['year'] ) ? absint( $_POST['year'] ) : date( 'Y' );
46
+		$month = isset($_POST['month']) ? absint($_POST['month']) : date('n');
47
+		$year  = isset($_POST['year']) ? absint($_POST['year']) : date('Y');
48 48
 
49 49
 		nocache_headers();
50
-		header( 'Content-Type: text/csv; charset=utf-8' );
51
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_payments_export_filename', 'give-export-' . $this->export_type . '-' . $month . '-' . $year ) . '.csv' );
52
-		header( "Expires: 0" );
50
+		header('Content-Type: text/csv; charset=utf-8');
51
+		header('Content-Disposition: attachment; filename='.apply_filters('give_payments_export_filename', 'give-export-'.$this->export_type.'-'.$month.'-'.$year).'.csv');
52
+		header("Expires: 0");
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,30 +63,30 @@  discard block
 block discarded – undo
63 63
 		global $give_options;
64 64
 
65 65
 		$cols = array(
66
-			'id'       => __( 'ID', 'give' ), // unaltered payment ID (use for querying)
67
-			'seq_id'   => __( 'Payment Number', 'give' ), // sequential payment ID
68
-			'email'    => __( 'Email', 'give' ),
69
-			'first'    => __( 'First Name', 'give' ),
70
-			'last'     => __( 'Last Name', 'give' ),
71
-			'address1' => __( 'Address', 'give' ),
72
-			'address2' => __( 'Address (Line 2)', 'give' ),
73
-			'city'     => __( 'City', 'give' ),
74
-			'state'    => __( 'State', 'give' ),
75
-			'country'  => __( 'Country', 'give' ),
76
-			'zip'      => __( 'Zip Code', 'give' ),
77
-			'amount'   => __( 'Donation Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')',
78
-			'form_id'  => __( 'Form ID', 'give' ),
79
-			'form'     => __( 'Form Title', 'give' ),
80
-			'gateway'  => __( 'Payment Method', 'give' ),
81
-			'trans_id' => __( 'Transaction ID', 'give' ),
82
-			'key'      => __( 'Purchase Key', 'give' ),
83
-			'date'     => __( 'Date', 'give' ),
84
-			'user'     => __( 'User', 'give' ),
85
-			'status'   => __( 'Status', 'give' )
66
+			'id'       => __('ID', 'give'), // unaltered payment ID (use for querying)
67
+			'seq_id'   => __('Payment Number', 'give'), // sequential payment ID
68
+			'email'    => __('Email', 'give'),
69
+			'first'    => __('First Name', 'give'),
70
+			'last'     => __('Last Name', 'give'),
71
+			'address1' => __('Address', 'give'),
72
+			'address2' => __('Address (Line 2)', 'give'),
73
+			'city'     => __('City', 'give'),
74
+			'state'    => __('State', 'give'),
75
+			'country'  => __('Country', 'give'),
76
+			'zip'      => __('Zip Code', 'give'),
77
+			'amount'   => __('Donation Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')',
78
+			'form_id'  => __('Form ID', 'give'),
79
+			'form'     => __('Form Title', 'give'),
80
+			'gateway'  => __('Payment Method', 'give'),
81
+			'trans_id' => __('Transaction ID', 'give'),
82
+			'key'      => __('Purchase Key', 'give'),
83
+			'date'     => __('Date', 'give'),
84
+			'user'     => __('User', 'give'),
85
+			'status'   => __('Status', 'give')
86 86
 		);
87 87
 
88
-		if ( ! give_get_option( 'enable_sequential' ) ) {
89
-			unset( $cols['seq_id'] );
88
+		if ( ! give_get_option('enable_sequential')) {
89
+			unset($cols['seq_id']);
90 90
 		}
91 91
 
92 92
 		return $cols;
@@ -106,57 +106,57 @@  discard block
 block discarded – undo
106 106
 
107 107
 		$data = array();
108 108
 
109
-		$payments = give_get_payments( array(
109
+		$payments = give_get_payments(array(
110 110
 			'offset' => 0,
111
-			'number' => - 1,
111
+			'number' => -1,
112 112
 			'mode'   => give_is_test_mode() ? 'test' : 'live',
113
-			'status' => isset( $_POST['give_export_payment_status'] ) ? $_POST['give_export_payment_status'] : 'any',
114
-			'month'  => isset( $_POST['month'] ) ? absint( $_POST['month'] ) : date( 'n' ),
115
-			'year'   => isset( $_POST['year'] ) ? absint( $_POST['year'] ) : date( 'Y' )
116
-		) );
113
+			'status' => isset($_POST['give_export_payment_status']) ? $_POST['give_export_payment_status'] : 'any',
114
+			'month'  => isset($_POST['month']) ? absint($_POST['month']) : date('n'),
115
+			'year'   => isset($_POST['year']) ? absint($_POST['year']) : date('Y')
116
+		));
117 117
 
118
-		foreach ( $payments as $payment ) {
119
-			$payment_meta = give_get_payment_meta( $payment->ID );
120
-			$user_info    = give_get_payment_meta_user_info( $payment->ID );
121
-			$total        = give_get_payment_amount( $payment->ID );
122
-			$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
118
+		foreach ($payments as $payment) {
119
+			$payment_meta = give_get_payment_meta($payment->ID);
120
+			$user_info    = give_get_payment_meta_user_info($payment->ID);
121
+			$total        = give_get_payment_amount($payment->ID);
122
+			$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
123 123
 
124 124
 			$form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '';
125 125
 			$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
126 126
 
127
-			if ( is_numeric( $user_id ) ) {
128
-				$user = get_userdata( $user_id );
127
+			if (is_numeric($user_id)) {
128
+				$user = get_userdata($user_id);
129 129
 			} else {
130 130
 				$user = false;
131 131
 			}
132 132
 
133 133
 			$data[] = array(
134 134
 				'id'       => $payment->ID,
135
-				'seq_id'   => give_get_payment_number( $payment->ID ),
135
+				'seq_id'   => give_get_payment_number($payment->ID),
136 136
 				'email'    => $payment_meta['email'],
137 137
 				'first'    => $user_info['first_name'],
138 138
 				'last'     => $user_info['last_name'],
139
-				'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
140
-				'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
141
-				'city'     => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
142
-				'state'    => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
143
-				'country'  => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
144
-				'zip'      => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
145
-				'amount'   => html_entity_decode( give_format_amount( $total ) ),
139
+				'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
140
+				'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
141
+				'city'     => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
142
+				'state'    => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
143
+				'country'  => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
144
+				'zip'      => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
145
+				'amount'   => html_entity_decode(give_format_amount($total)),
146 146
 				'form_id'  => $form_id,
147 147
 				'form'     => $form_title,
148
-				'gateway'  => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ),
149
-				'trans_id' => give_get_payment_transaction_id( $payment->ID ),
148
+				'gateway'  => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)),
149
+				'trans_id' => give_get_payment_transaction_id($payment->ID),
150 150
 				'key'      => $payment_meta['key'],
151 151
 				'date'     => $payment->post_date,
152
-				'user'     => $user ? $user->display_name : __( 'guest', 'give' ),
153
-				'status'   => give_get_payment_status( $payment, true )
152
+				'user'     => $user ? $user->display_name : __('guest', 'give'),
153
+				'status'   => give_get_payment_status($payment, true)
154 154
 			);
155 155
 
156 156
 		}
157 157
 
158
-		$data = apply_filters( 'give_export_get_data', $data );
159
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
158
+		$data = apply_filters('give_export_get_data', $data);
159
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
160 160
 
161 161
 		return $data;
162 162
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-export.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Export Class
4
- *
5
- * This is the base class for all export methods. Each data export type (donors, payments, etc) extend this class
6
- *
7
- * @package     Give
8
- * @subpackage  Admin/Reports
9
- * @copyright   Copyright (c) 2015, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.0
12
- */
3
+	 * Export Class
4
+	 *
5
+	 * This is the base class for all export methods. Each data export type (donors, payments, etc) extend this class
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Admin/Reports
9
+	 * @copyright   Copyright (c) 2015, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.0
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 * @return void
49 49
 	 */
50 50
 	public function headers() {
51
-		ignore_user_abort( true );
51
+		ignore_user_abort(true);
52 52
 
53
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
54
-			set_time_limit( 0 );
53
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
54
+			set_time_limit(0);
55 55
 		}
56 56
 
57 57
 		nocache_headers();
58
-		header( 'Content-Type: text/csv; charset=utf-8' );
59
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
60
-		header( "Expires: 0" );
58
+		header('Content-Type: text/csv; charset=utf-8');
59
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
60
+		header("Expires: 0");
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function csv_cols() {
71 71
 		$cols = array(
72
-			'id'   => __( 'ID', 'give' ),
73
-			'date' => __( 'Date', 'give' )
72
+			'id'   => __('ID', 'give'),
73
+			'date' => __('Date', 'give')
74 74
 		);
75 75
 
76 76
 		return $cols;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function get_csv_cols() {
87 87
 		$cols = $this->csv_cols();
88 88
 
89
-		return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols );
89
+		return apply_filters('give_export_csv_cols_'.$this->export_type, $cols);
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	public function csv_cols_out() {
101 101
 		$cols = $this->get_csv_cols();
102 102
 		$i    = 1;
103
-		foreach ( $cols as $col_id => $column ) {
104
-			echo '"' . addslashes( $column ) . '"';
105
-			echo $i == count( $cols ) ? '' : ',';
106
-			$i ++;
103
+		foreach ($cols as $col_id => $column) {
104
+			echo '"'.addslashes($column).'"';
105
+			echo $i == count($cols) ? '' : ',';
106
+			$i++;
107 107
 		}
108 108
 		echo "\r\n";
109 109
 	}
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 		$data = array(
121 121
 			0 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			),
125 125
 			1 => array(
126 126
 				'id'   => '',
127
-				'data' => date( 'F j, Y' )
127
+				'data' => date('F j, Y')
128 128
 			)
129 129
 		);
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
133 133
 
134 134
 		return $data;
135 135
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		$cols = $this->get_csv_cols();
148 148
 
149 149
 		// Output each row
150
-		foreach ( $data as $row ) {
150
+		foreach ($data as $row) {
151 151
 			$i = 1;
152
-			foreach ( $row as $col_id => $column ) {
152
+			foreach ($row as $col_id => $column) {
153 153
 				// Make sure the column is valid
154
-				if ( array_key_exists( $col_id, $cols ) ) {
155
-					echo '"' . addslashes( $column ) . '"';
156
-					echo $i == count( $cols ) ? '' : ',';
157
-					$i ++;
154
+				if (array_key_exists($col_id, $cols)) {
155
+					echo '"'.addslashes($column).'"';
156
+					echo $i == count($cols) ? '' : ',';
157
+					$i++;
158 158
 				}
159 159
 			}
160 160
 			echo "\r\n";
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function export() {
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/reporting/class-form-reports-table.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Download Reports Table Class
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Reports
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Download Reports Table Class
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Reports
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . __( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99 99
 			'title'            => give_get_forms_label_singular(),
100
-			'sales'            => __( 'Donations', 'give' ),
101
-			'earnings'         => __( 'Income', 'give' ),
102
-			'average_sales'    => __( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => __( 'Monthly Average Income', 'give' ),
104
-			'details'          => __( 'Detailed Report', 'give' )
100
+			'sales'            => __('Donations', 'give'),
101
+			'earnings'         => __('Income', 'give'),
102
+			'average_sales'    => __('Monthly Average Donations', 'give'),
103
+			'average_earnings' => __('Monthly Average Income', 'give'),
104
+			'details'          => __('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 		// These aren't really bulk actions but this outputs the markup in the right place
175 175
 		give_report_views();
176 176
 	}
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @param string $which
185 185
 	 */
186
-	protected function display_tablenav( $which ) {
186
+	protected function display_tablenav($which) {
187 187
 
188
-		if ( 'top' == $which ) {
189
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
188
+		if ('top' == $which) {
189
+			wp_nonce_field('bulk-'.$this->_args['plural']);
190 190
 		}
191 191
 		?>
192
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
192
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
193 193
 
194
-			<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Form Report', 'give' ); ?></span></h3>
194
+			<h3 class="alignleft reports-earnings-title"><span><?php _e('Form Report', 'give'); ?></span></h3>
195 195
 
196 196
 			<div class="alignright tablenav-right">
197 197
 				<div class="actions bulkactions">
198
-					<?php $this->bulk_actions( $which ); ?>
198
+					<?php $this->bulk_actions($which); ?>
199 199
 				</div>
200 200
 				<?php
201
-				$this->extra_tablenav( $which );
202
-				$this->pagination( $which );
201
+				$this->extra_tablenav($which);
202
+				$this->pagination($which);
203 203
 				?>
204 204
 			</div>
205 205
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function category_filter() {
221 221
 
222
-		$categories = get_terms( 'form_category' );
223
-		if ( $categories && ! is_wp_error( $categories ) ) {
224
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
222
+		$categories = get_terms('form_category');
223
+		if ($categories && ! is_wp_error($categories)) {
224
+			echo Give()->html->category_dropdown('category', $this->get_category());
225 225
 		}
226 226
 	}
227 227
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function query() {
237 237
 
238
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
239
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
238
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
239
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
240 240
 		$category = $this->get_category();
241 241
 
242 242
 		$args = array(
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			'suppress_filters' => true
250 250
 		);
251 251
 
252
-		if ( ! empty( $category ) ) {
252
+		if ( ! empty($category)) {
253 253
 			$args['tax_query'] = array(
254 254
 				array(
255 255
 					'taxonomy' => 'form_category',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		}
260 260
 
261
-		switch ( $orderby ) :
261
+		switch ($orderby) :
262 262
 			case 'title' :
263 263
 				$args['orderby'] = 'title';
264 264
 				break;
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 				break;
275 275
 		endswitch;
276 276
 
277
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
277
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
278 278
 
279
-		$this->products = new WP_Query( $args );
279
+		$this->products = new WP_Query($args);
280 280
 
281 281
 	}
282 282
 
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 
293 293
 		$give_forms = $this->products->posts;
294 294
 
295
-		if ( $give_forms ) {
296
-			foreach ( $give_forms as $form ) {
295
+		if ($give_forms) {
296
+			foreach ($give_forms as $form) {
297 297
 				$reports_data[] = array(
298 298
 					'ID'               => $form,
299
-					'title'            => get_the_title( $form ),
300
-					'sales'            => give_get_form_sales_stats( $form ),
301
-					'earnings'         => give_get_form_earnings_stats( $form ),
302
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
303
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
299
+					'title'            => get_the_title($form),
300
+					'sales'            => give_get_form_sales_stats($form),
301
+					'earnings'         => give_get_form_earnings_stats($form),
302
+					'average_sales'    => give_get_average_monthly_form_sales($form),
303
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
304 304
 				);
305 305
 			}
306 306
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$sortable = $this->get_sortable_columns();
330 330
 
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 
333 333
 		$data = $this->reports_data();
334 334
 
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 
337 337
 		$this->items = $data;
338 338
 
339
-		$this->set_pagination_args( array(
339
+		$this->set_pagination_args(array(
340 340
 				'total_items' => $total_items,
341 341
 				'per_page'    => $this->per_page,
342
-				'total_pages' => ceil( $total_items / $this->per_page )
342
+				'total_pages' => ceil($total_items / $this->per_page)
343 343
 			)
344 344
 		);
345 345
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Gateway Error Log View Class
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Reports
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- */
3
+	 * Gateway Error Log View Class
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Reports
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 */
10 10
 
11 11
 // Exit if accessed directly
12 12
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : __( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Log Message', 'give' ); ?> "><?php _e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Log Message', 'give'); ?> "><?php _e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
103
-
104
-				echo wpautop( $intro );
105
-				echo wpautop( __( '<strong>Log data:</strong>', 'give' ) );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103
+
104
+				echo wpautop($intro);
105
+				echo wpautop(__('<strong>Log data:</strong>', 'give'));
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => __( 'Log ID', 'give' ),
126
-			'payment_id' => __( 'Payment ID', 'give' ),
127
-			'error'      => __( 'Error', 'give' ),
128
-			'message'    => __( 'Error Message', 'give' ),
129
-			'gateway'    => __( 'Gateway', 'give' ),
130
-			'date'       => __( 'Date', 'give' )
125
+			'ID'         => __('Log ID', 'give'),
126
+			'payment_id' => __('Payment ID', 'give'),
127
+			'error'      => __('Error', 'give'),
128
+			'message'    => __('Error Message', 'give'),
129
+			'gateway'    => __('Gateway', 'give'),
130
+			'date'       => __('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		// These aren't really bulk actions but this outputs the markup in the right place
156 156
 		give_log_views();
157 157
 	}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		global $give_logs;
169 169
 
170 170
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
171
-		wp_suspend_cache_addition( true );
171
+		wp_suspend_cache_addition(true);
172 172
 
173 173
 		$logs_data = array();
174 174
 		$paged     = $this->get_paged();
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
 			'paged'    => $paged
178 178
 		);
179 179
 
180
-		$logs = $give_logs->get_connected_logs( $log_query );
180
+		$logs = $give_logs->get_connected_logs($log_query);
181 181
 
182
-		if ( $logs ) {
183
-			foreach ( $logs as $log ) {
182
+		if ($logs) {
183
+			foreach ($logs as $log) {
184 184
 
185 185
 				$logs_data[] = array(
186 186
 					'ID'         => $log->ID,
187
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
187
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
188 188
 					'payment_id' => $log->post_parent,
189 189
 					'error'      => 'error',
190
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
190
+					'gateway'    => give_get_payment_gateway($log->post_parent),
191 191
 					'date'       => $log->post_date
192 192
 				);
193 193
 			}
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 		$columns               = $this->get_columns();
216 216
 		$hidden                = array(); // No hidden columns
217 217
 		$sortable              = $this->get_sortable_columns();
218
-		$this->_column_headers = array( $columns, $hidden, $sortable );
218
+		$this->_column_headers = array($columns, $hidden, $sortable);
219 219
 		$current_page          = $this->get_pagenum();
220 220
 		$this->items           = $this->get_logs();
221
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
221
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
222 222
 
223
-		$this->set_pagination_args( array(
223
+		$this->set_pagination_args(array(
224 224
 				'total_items' => $total_items,
225 225
 				'per_page'    => $this->per_page,
226
-				'total_pages' => ceil( $total_items / $this->per_page )
226
+				'total_pages' => ceil($total_items / $this->per_page)
227 227
 			)
228 228
 		);
229 229
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-give-graph.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Graphs
4
- *
5
- * This class handles building pretty report graphs
6
- *
7
- * @package     Give
8
- * @subpackage  Admin/Reports
9
- * @copyright   Copyright (c) 2012, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.0
12
- */
3
+	 * Graphs
4
+	 *
5
+	 * This class handles building pretty report graphs
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Admin/Reports
9
+	 * @copyright   Copyright (c) 2012, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.0
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @since 1.0
80 80
 	 */
81
-	public function __construct( $_data ) {
81
+	public function __construct($_data) {
82 82
 
83 83
 		$this->data = $_data;
84 84
 
85 85
 		// Generate unique ID
86
-		$this->id = md5( rand() );
86
+		$this->id = md5(rand());
87 87
 
88 88
 		// Setup default options;
89
-		$this->options = apply_filters( 'give_graph_args', array(
89
+		$this->options = apply_filters('give_graph_args', array(
90 90
 			'y_mode'          => null,
91 91
 			'x_mode'          => null,
92 92
 			'y_decimals'      => 0,
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			'bars'            => true,
104 104
 			'lines'           => false,
105 105
 			'points'          => true
106
-		) );
106
+		));
107 107
 
108 108
 	}
109 109
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @since 1.0
117 117
 	 */
118
-	public function set( $key, $value ) {
119
-		$this->options[ $key ] = $value;
118
+	public function set($key, $value) {
119
+		$this->options[$key] = $value;
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @since 1.0
128 128
 	 */
129
-	public function get( $key ) {
130
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
129
+	public function get($key) {
130
+		return isset($this->options[$key]) ? $this->options[$key] : false;
131 131
 	}
132 132
 
133 133
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @since 1.0
137 137
 	 */
138 138
 	public function get_data() {
139
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
139
+		return apply_filters('give_get_graph_data', $this->data, $this);
140 140
 	}
141 141
 
142 142
 	/**
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function load_scripts() {
148 148
 		// Use minified libraries if SCRIPT_DEBUG is turned off
149
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
149
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
150 150
 
151
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
152
-		wp_enqueue_script( 'jquery-flot-orderbars' );
151
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
152
+		wp_enqueue_script('jquery-flot-orderbars');
153 153
 
154
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
155
-		wp_enqueue_script( 'jquery-flot-time' );
154
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
155
+		wp_enqueue_script('jquery-flot-time');
156 156
 
157
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
158
-		wp_enqueue_script( 'jquery-flot-resize' );
157
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
158
+		wp_enqueue_script('jquery-flot-resize');
159 159
 
160
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
161
-		wp_enqueue_script( 'jquery-flot' );
160
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
161
+		wp_enqueue_script('jquery-flot');
162 162
 
163 163
 	}
164 164
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 					[
186 186
 						<?php
187 187
 							$order = 0;
188
-							foreach( $this->get_data() as $label => $data ) :
188
+							foreach ($this->get_data() as $label => $data) :
189 189
 						?>
190 190
 						{
191
-							label : "<?php echo esc_attr( $label ); ?>",
192
-							id    : "<?php echo sanitize_key( $label ); ?>",
191
+							label : "<?php echo esc_attr($label); ?>",
192
+							id    : "<?php echo sanitize_key($label); ?>",
193 193
 							// data format is: [ point on x, value on y ]
194
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
194
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
195 195
 							points: {
196 196
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
197 197
 							},
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 								fill     : true,
207 207
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
208 208
 							},
209
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
209
+							<?php if ($this->options['multiple_y_axes']) : ?>
210 210
 							yaxis : <?php echo $yaxis_count; ?>
211 211
 							<?php endif; ?>
212 212
 
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 						grid: {
221 221
 							show           : true,
222 222
 							aboveData      : false,
223
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
224
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
225
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
226
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
223
+							color          : "<?php echo $this->options['color']; ?>",
224
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
225
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
226
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
227 227
 							clickable      : false,
228 228
 							hoverable      : true
229 229
 						},
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 							mode        : "<?php echo $this->options['x_mode']; ?>",
235 235
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
236 236
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
237
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
237
+							<?php if ($this->options['x_mode'] != 'time') : ?>
238 238
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
239 239
 							<?php endif; ?>
240 240
 						},
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 							min         : 0,
244 244
 							mode        : "<?php echo $this->options['y_mode']; ?>",
245 245
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
246
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
246
+							<?php if ($this->options['y_mode'] != 'time') : ?>
247 247
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>
248 248
 							<?php endif; ?>
249 249
 						}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 * @since 1.0
304 304
 	 */
305 305
 	public function display() {
306
-		do_action( 'give_before_graph', $this );
306
+		do_action('give_before_graph', $this);
307 307
 		echo $this->build_graph();
308
-		do_action( 'give_after_graph', $this );
308
+		do_action('give_after_graph', $this);
309 309
 	}
310 310
 
311 311
 }
Please login to merge, or discard this patch.
includes/admin/reporting/logs.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_logs_view_sales() {
26
-	include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' );
26
+	include(dirname(__FILE__).'/class-sales-logs-list-table.php');
27 27
 
28 28
 	$logs_table = new Give_Sales_Log_Table();
29 29
 	$logs_table->prepare_items();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
34
+add_action('give_logs_view_sales', 'give_logs_view_sales');
35 35
 
36 36
 
37 37
 /**
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  */
45 45
 function give_logs_view_gateway_errors() {
46
-	include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' );
46
+	include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php');
47 47
 
48 48
 	$logs_table = new Give_Gateway_Error_Log_Table();
49 49
 	$logs_table->prepare_items();
50 50
 	$logs_table->display();
51 51
 }
52 52
 
53
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
53
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
54 54
 
55 55
 /**
56 56
  * API Request Logs
@@ -62,28 +62,28 @@  discard block
 block discarded – undo
62 62
  * @return void
63 63
  */
64 64
 function give_logs_view_api_requests() {
65
-	include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' );
65
+	include(dirname(__FILE__).'/class-api-requests-logs-list-table.php');
66 66
 
67 67
 	$logs_table = new Give_API_Request_Log_Table();
68 68
 	$logs_table->prepare_items();
69 69
 	?>
70 70
 	<div class="wrap">
71
-		<?php do_action( 'give_logs_api_requests_top' ); ?>
72
-		<form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>">
71
+		<?php do_action('give_logs_api_requests_top'); ?>
72
+		<form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>">
73 73
 			<?php
74
-			$logs_table->search_box( __( 'Search', 'give' ), 'give-api-requests' );
74
+			$logs_table->search_box(__('Search', 'give'), 'give-api-requests');
75 75
 			$logs_table->display();
76 76
 			?>
77 77
 			<input type="hidden" name="post_type" value="give_forms" />
78 78
 			<input type="hidden" name="page" value="give-reports" />
79 79
 			<input type="hidden" name="tab" value="logs" />
80 80
 		</form>
81
-		<?php do_action( 'give_logs_api_requests_bottom' ); ?>
81
+		<?php do_action('give_logs_api_requests_bottom'); ?>
82 82
 	</div>
83 83
 <?php
84 84
 }
85 85
 
86
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
86
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
87 87
 
88 88
 
89 89
 /**
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function give_log_default_views() {
96 96
 	$views = array(
97
-		'sales'          => __( 'Donations', 'give' ),
98
-		'gateway_errors' => __( 'Payment Errors', 'give' ),
99
-		'api_requests'   => __( 'API Requests', 'give' )
97
+		'sales'          => __('Donations', 'give'),
98
+		'gateway_errors' => __('Payment Errors', 'give'),
99
+		'api_requests'   => __('API Requests', 'give')
100 100
 	);
101 101
 
102
-	$views = apply_filters( 'give_log_views', $views );
102
+	$views = apply_filters('give_log_views', $views);
103 103
 
104 104
 	return $views;
105 105
 }
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function give_log_views() {
114 114
 	$views        = give_log_default_views();
115
-	$current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales';
115
+	$current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales';
116 116
 	?>
117 117
 	<form id="give-logs-filter" method="get" action="edit.php">
118 118
 		<select id="give-logs-view" name="view">
119
-			<option value="-1"><?php _e( 'Log Type', 'give' ); ?></option>
120
-			<?php foreach ( $views as $view_id => $label ): ?>
121
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
119
+			<option value="-1"><?php _e('Log Type', 'give'); ?></option>
120
+			<?php foreach ($views as $view_id => $label): ?>
121
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
122 122
 			<?php endforeach; ?>
123 123
 		</select>
124 124
 
125
-		<?php do_action( 'give_log_view_actions' ); ?>
125
+		<?php do_action('give_log_view_actions'); ?>
126 126
 
127 127
 		<input type="hidden" name="post_type" value="give_forms" />
128 128
 		<input type="hidden" name="page" value="give-reports" />
129 129
 		<input type="hidden" name="tab" value="logs" />
130 130
 
131
-		<?php submit_button( __( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
131
+		<?php submit_button(__('Apply', 'give'), 'secondary', 'submit', false); ?>
132 132
 	</form>
133 133
 <?php
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Logs UI
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Reports
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Logs UI
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Reports
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.