Test Failed
Push — master ( 7fe983...516c23 )
by Devin
08:07 queued 03:09
created
includes/admin/reports/class-form-reports-table.php 1 patch
Spacing   +58 added lines, -58 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
 /**
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 		global $status, $page;
57 57
 
58 58
 		// Set parent defaults
59
-		parent::__construct( array(
60
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
61
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
59
+		parent::__construct(array(
60
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
61
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
62 62
 			'ajax'     => false                        // Does this table support ajax?
63
-		) );
63
+		));
64 64
 
65
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
65
+		add_action('give_report_view_actions', array($this, 'category_filter'));
66 66
 		$this->query();
67 67
 
68 68
 	}
@@ -78,32 +78,32 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return string Column Name
80 80
 	 */
81
-	public function column_default( $item, $column_name ) {
82
-		switch ( $column_name ) {
81
+	public function column_default($item, $column_name) {
82
+		switch ($column_name) {
83 83
 			case 'title':
84
-				$title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title'];
84
+				$title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title'];
85 85
 
86 86
 				return sprintf(
87 87
 					'<a href="%s">%s</a>',
88
-					get_edit_post_link( $item['ID'] ),
88
+					get_edit_post_link($item['ID']),
89 89
 					$title
90 90
 				);
91 91
 			case 'sales':
92 92
 				return sprintf(
93 93
 					'<a href="%s">%s</a>',
94
-					admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ),
94
+					admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])),
95 95
 					$item['sales']
96 96
 				);
97 97
 			case 'earnings' :
98
-				return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) );
98
+				return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false)));
99 99
 			case 'average_sales' :
100
-				return round( $item[ $column_name ] );
100
+				return round($item[$column_name]);
101 101
 			case 'average_earnings' :
102
-				return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) );
102
+				return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false)));
103 103
 			case 'details' :
104
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>';
104
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>';
105 105
 			default:
106
-				return $item[ $column_name ];
106
+				return $item[$column_name];
107 107
 		}
108 108
 	}
109 109
 
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_columns() {
119 119
 		$columns = array(
120
-			'title'            => esc_html__( 'Form', 'give' ),
121
-			'sales'            => esc_html__( 'Donations', 'give' ),
122
-			'earnings'         => esc_html__( 'Income', 'give' ),
123
-			'average_sales'    => esc_html__( 'Monthly Average Donations', 'give' ),
124
-			'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ),
125
-			'details'          => esc_html__( 'Detailed Report', 'give' )
120
+			'title'            => esc_html__('Form', 'give'),
121
+			'sales'            => esc_html__('Donations', 'give'),
122
+			'earnings'         => esc_html__('Income', 'give'),
123
+			'average_sales'    => esc_html__('Monthly Average Donations', 'give'),
124
+			'average_earnings' => esc_html__('Monthly Average Income', 'give'),
125
+			'details'          => esc_html__('Detailed Report', 'give')
126 126
 		);
127 127
 
128 128
 		return $columns;
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function get_sortable_columns() {
140 140
 		return array(
141
-			'title'    => array( 'title', true ),
142
-			'sales'    => array( 'sales', false ),
143
-			'earnings' => array( 'earnings', false ),
141
+			'title'    => array('title', true),
142
+			'sales'    => array('sales', false),
143
+			'earnings' => array('earnings', false),
144 144
 		);
145 145
 	}
146 146
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return int Current page number
154 154
 	 */
155 155
 	public function get_paged() {
156
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
156
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
157 157
 	}
158 158
 
159 159
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return int Category ID
166 166
 	 */
167 167
 	public function get_category() {
168
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
168
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
169 169
 	}
170 170
 
171 171
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return void
178 178
 	 */
179
-	public function bulk_actions( $which = '' ) {
179
+	public function bulk_actions($which = '') {
180 180
 
181 181
 	}
182 182
 
@@ -188,27 +188,27 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @param string $which
190 190
 	 */
191
-	protected function display_tablenav( $which ) {
191
+	protected function display_tablenav($which) {
192 192
 
193
-		if ( 'top' === $which ) {
194
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
193
+		if ('top' === $which) {
194
+			wp_nonce_field('bulk-'.$this->_args['plural']);
195 195
 		}
196 196
 		?>
197
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
197
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
198 198
 
199
-			<?php if ( 'top' === $which ) { ?>
199
+			<?php if ('top' === $which) { ?>
200 200
 				<h3 class="alignleft reports-earnings-title">
201
-					<span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span>
201
+					<span><?php esc_html_e('Donation Forms Report', 'give'); ?></span>
202 202
 				</h3>
203 203
 			<?php } ?>
204 204
 
205 205
 			<div class="alignright tablenav-right">
206 206
 				<div class="actions bulkactions">
207
-					<?php $this->bulk_actions( $which ); ?>
207
+					<?php $this->bulk_actions($which); ?>
208 208
 				</div>
209 209
 				<?php
210
-				$this->extra_tablenav( $which );
211
-				$this->pagination( $which );
210
+				$this->extra_tablenav($which);
211
+				$this->pagination($which);
212 212
 				?>
213 213
 			</div>
214 214
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function category_filter() {
230 230
 
231
-		$categories = get_terms( 'form_category' );
232
-		if ( $categories && ! is_wp_error( $categories ) ) {
233
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
231
+		$categories = get_terms('form_category');
232
+		if ($categories && ! is_wp_error($categories)) {
233
+			echo Give()->html->category_dropdown('category', $this->get_category());
234 234
 		}
235 235
 	}
236 236
 
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function query() {
246 246
 
247
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
248
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
247
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
248
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
249 249
 		$category = $this->get_category();
250 250
 
251 251
 		$args = array(
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			'suppress_filters' => true
259 259
 		);
260 260
 
261
-		if ( ! empty( $category ) ) {
261
+		if ( ! empty($category)) {
262 262
 			$args['tax_query'] = array(
263 263
 				array(
264 264
 					'taxonomy' => 'form_category',
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			);
268 268
 		}
269 269
 
270
-		switch ( $orderby ) :
270
+		switch ($orderby) :
271 271
 			case 'title' :
272 272
 				$args['orderby'] = 'title';
273 273
 				break;
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 				break;
284 284
 		endswitch;
285 285
 
286
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
286
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
287 287
 
288
-		$this->donation_forms = new WP_Query( $args );
288
+		$this->donation_forms = new WP_Query($args);
289 289
 
290 290
 		// Store total number of donation forms count.
291 291
 		$this->count = $this->donation_forms->found_posts;
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 
306 306
 		$give_forms = $this->donation_forms->posts;
307 307
 
308
-		if ( $give_forms ) {
309
-			foreach ( $give_forms as $form ) {
308
+		if ($give_forms) {
309
+			foreach ($give_forms as $form) {
310 310
 				$reports_data[] = array(
311 311
 					'ID'               => $form,
312
-					'title'            => get_the_title( $form ),
313
-					'sales'            => give_get_form_sales_stats( $form ),
314
-					'earnings'         => give_get_form_earnings_stats( $form ),
315
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
316
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
312
+					'title'            => get_the_title($form),
313
+					'sales'            => give_get_form_sales_stats($form),
314
+					'earnings'         => give_get_form_earnings_stats($form),
315
+					'average_sales'    => give_get_average_monthly_form_sales($form),
316
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
317 317
 				);
318 318
 			}
319 319
 		}
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 		$columns = $this->get_columns();
339 339
 		$hidden = array(); // No hidden columns
340 340
 		$sortable = $this->get_sortable_columns();
341
-		$this->_column_headers = array( $columns, $hidden, $sortable );
341
+		$this->_column_headers = array($columns, $hidden, $sortable);
342 342
 		$this->items = $this->reports_data();
343 343
 		$total_items = $this->count;
344 344
 
345
-		$this->set_pagination_args( array(
345
+		$this->set_pagination_args(array(
346 346
 				'total_items' => $total_items,
347 347
 				'per_page'    => $this->per_page,
348
-				'total_pages' => ceil( $total_items / $this->per_page )
348
+				'total_pages' => ceil($total_items / $this->per_page)
349 349
 			)
350 350
 		);
351 351
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export-earnings.php 1 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,10 +61,10 @@  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' ),
64
+			'date'      => __('Date', 'give'),
65
+			'donations' => __('Donations', 'give'),
66 66
 			/* translators: %s: currency */
67
-			'earnings'  => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) )
67
+			'earnings'  => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true))
68 68
 		);
69 69
 
70 70
 		return $cols;
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function get_data() {
81 81
 
82
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
83
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
84
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
85
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
82
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
83
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
84
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
85
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
86 86
 
87 87
 		$data  = array();
88 88
 		$year  = $start_year;
89 89
 		$stats = new Give_Payment_Stats;
90 90
 
91
-		while ( $year <= $end_year ) {
91
+		while ($year <= $end_year) {
92 92
 
93
-			if ( $year == $start_year && $year == $end_year ) {
93
+			if ($year == $start_year && $year == $end_year) {
94 94
 
95 95
 				$m1 = $start_month;
96 96
 				$m2 = $end_month;
97 97
 
98
-			} elseif ( $year == $start_year ) {
98
+			} elseif ($year == $start_year) {
99 99
 
100 100
 				$m1 = $start_month;
101 101
 				$m2 = 12;
102 102
 
103
-			} elseif ( $year == $end_year ) {
103
+			} elseif ($year == $end_year) {
104 104
 
105 105
 				$m1 = 1;
106 106
 				$m2 = $end_month;
@@ -112,28 +112,28 @@  discard block
 block discarded – undo
112 112
 
113 113
 			}
114 114
 
115
-			while ( $m1 <= $m2 ) {
115
+			while ($m1 <= $m2) {
116 116
 
117
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
118
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
117
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
118
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
119 119
 
120 120
 				$data[] = array(
121
-					'date'      => date_i18n( 'F Y', $date1 ),
122
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
123
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ),
121
+					'date'      => date_i18n('F Y', $date1),
122
+					'donations' => $stats->get_sales(0, $date1, $date2),
123
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)),
124 124
 				);
125 125
 
126
-				$m1 ++;
126
+				$m1++;
127 127
 
128 128
 			}
129 129
 
130 130
 
131
-			$year ++;
131
+			$year++;
132 132
 
133 133
 		}
134 134
 
135
-		$data = apply_filters( 'give_export_get_data', $data );
136
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
135
+		$data = apply_filters('give_export_get_data', $data);
136
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
137 137
 
138 138
 		return $data;
139 139
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-payments.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => __( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => __( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => __( 'Email', 'give' ),
45
-			'first'     => __( 'First Name', 'give' ),
46
-			'last'      => __( 'Last Name', 'give' ),
47
-			'address1'  => __( 'Address 1', 'give' ),
48
-			'address2'  => __( 'Address 2', 'give' ),
49
-			'city'      => __( 'City', 'give' ),
50
-			'state'     => __( 'State', 'give' ),
51
-			'country'   => __( 'Country', 'give' ),
52
-			'zip'       => __( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => __( 'Form ID', 'give' ),
54
-			'form_name' => __( 'Form Name', 'give' ),
55
-			'amount'    => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')',
56
-			'gateway'   => __( 'Payment Method', 'give' ),
57
-			'trans_id'  => __( 'Transaction ID', 'give' ),
58
-			'key'       => __( 'Key', 'give' ),
59
-			'date'      => __( 'Date', 'give' ),
60
-			'user'      => __( 'User', 'give' ),
61
-			'status'    => __( 'Status', 'give' )
42
+			'id'        => __('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => __('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => __('Email', 'give'),
45
+			'first'     => __('First Name', 'give'),
46
+			'last'      => __('Last Name', 'give'),
47
+			'address1'  => __('Address 1', 'give'),
48
+			'address2'  => __('Address 2', 'give'),
49
+			'city'      => __('City', 'give'),
50
+			'state'     => __('State', 'give'),
51
+			'country'   => __('Country', 'give'),
52
+			'zip'       => __('Zip / Postal Code', 'give'),
53
+			'form_id'   => __('Form ID', 'give'),
54
+			'form_name' => __('Form Name', 'give'),
55
+			'amount'    => __('Amount', 'give').' ('.give_currency_symbol('', true).')',
56
+			'gateway'   => __('Payment Method', 'give'),
57
+			'trans_id'  => __('Transaction ID', 'give'),
58
+			'key'       => __('Key', 'give'),
59
+			'date'      => __('Date', 'give'),
60
+			'user'      => __('User', 'give'),
61
+			'status'    => __('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 			'status' => $this->status
87 87
 		);
88 88
 
89
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
89
+		if ( ! empty($this->start) || ! empty($this->end)) {
90 90
 
91 91
 			$args['date_query'] = array(
92 92
 				array(
93
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
94
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
93
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
94
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
95 95
 					'inclusive' => true
96 96
 				)
97 97
 			);
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 
101 101
 		// Add category or tag to payment query if any.
102
-		if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) {
102
+		if ( ! empty($this->categories) || ! empty($this->tags)) {
103 103
 			$form_args = array(
104 104
 				'post_type'      => 'give_forms',
105 105
 				'post_status'    => 'publish',
106
-				'posts_per_page' => - 1,
106
+				'posts_per_page' => -1,
107 107
 				'fields'         => 'ids',
108 108
 				'tax_query'      => array(
109 109
 					'relation' => 'AND',
@@ -111,72 +111,72 @@  discard block
 block discarded – undo
111 111
 			);
112 112
 
113 113
 
114
-			if ( ! empty( $this->categories ) ) {
114
+			if ( ! empty($this->categories)) {
115 115
 				$form_args['tax_query'][] = array(
116 116
 					'taxonomy' => 'give_forms_category',
117 117
 					'terms'    => $this->categories,
118 118
 				);
119 119
 			}
120 120
 
121
-			if ( ! empty( $this->tags ) ) {
121
+			if ( ! empty($this->tags)) {
122 122
 				$form_args['tax_query'][] = array(
123 123
 					'taxonomy' => 'give_forms_tag',
124 124
 					'terms'    => $this->tags,
125 125
 				);
126 126
 			}
127 127
 
128
-			$forms = new WP_Query( $form_args );
128
+			$forms = new WP_Query($form_args);
129 129
 
130
-			if ( empty( $forms->posts ) ) {
130
+			if (empty($forms->posts)) {
131 131
 				return array();
132 132
 			}
133 133
 
134 134
 			$args['give_forms'] = $forms->posts;
135 135
 		}
136 136
 
137
-		$payments = give_get_payments( $args );
137
+		$payments = give_get_payments($args);
138 138
 
139
-		if ( $payments ) {
139
+		if ($payments) {
140 140
 
141
-			foreach ( $payments as $payment ) {
142
-				$payment_meta = give_get_payment_meta( $payment->ID );
143
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
144
-				$total        = give_get_payment_amount( $payment->ID );
145
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
141
+			foreach ($payments as $payment) {
142
+				$payment_meta = give_get_payment_meta($payment->ID);
143
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
144
+				$total        = give_get_payment_amount($payment->ID);
145
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
146 146
 
147
-				if ( is_numeric( $user_id ) ) {
148
-					$user = get_userdata( $user_id );
147
+				if (is_numeric($user_id)) {
148
+					$user = get_userdata($user_id);
149 149
 				} else {
150 150
 					$user = false;
151 151
 				}
152 152
 
153 153
 				$data[] = array(
154 154
 					'id'        => $payment->ID,
155
-					'seq_id'    => give_get_payment_number( $payment->ID ),
155
+					'seq_id'    => give_get_payment_number($payment->ID),
156 156
 					'email'     => $payment_meta['email'],
157 157
 					'first'     => $user_info['first_name'],
158 158
 					'last'      => $user_info['last_name'],
159
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
160
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
161
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
162
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
163
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
164
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
165
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
166
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
167
-					'amount'    => html_entity_decode( give_format_amount( $total, array( 'sanitize' => false ) ) ),
168
-					'gateway'   => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ),
169
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
159
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
160
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
161
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
162
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
163
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
164
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
165
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
166
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
167
+					'amount'    => html_entity_decode(give_format_amount($total, array('sanitize' => false))),
168
+					'gateway'   => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)),
169
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
170 170
 					'key'       => $payment_meta['key'],
171 171
 					'date'      => $payment->post_date,
172
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
173
-					'status'    => give_get_payment_status( $payment, true )
172
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
173
+					'status'    => give_get_payment_status($payment, true)
174 174
 				);
175 175
 
176 176
 			}
177 177
 
178
-			$data = apply_filters( 'give_export_get_data', $data );
179
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
178
+			$data = apply_filters('give_export_get_data', $data);
179
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
180 180
 
181 181
 			return $data;
182 182
 
@@ -196,27 +196,27 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$status = $this->status;
198 198
 		$args   = array(
199
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
200
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
199
+			'start-date' => date('n/d/Y', strtotime($this->start)),
200
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
201 201
 		);
202 202
 
203
-		if ( 'any' == $status ) {
203
+		if ('any' == $status) {
204 204
 
205
-			$total = array_sum( (array) give_count_payments( $args ) );
205
+			$total = array_sum((array) give_count_payments($args));
206 206
 
207 207
 		} else {
208 208
 
209
-			$total = give_count_payments( $args )->$status;
209
+			$total = give_count_payments($args)->$status;
210 210
 
211 211
 		}
212 212
 
213 213
 		$percentage = 100;
214 214
 
215
-		if ( $total > 0 ) {
216
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
215
+		if ($total > 0) {
216
+			$percentage = ((30 * $this->step) / $total) * 100;
217 217
 		}
218 218
 
219
-		if ( $percentage > 100 ) {
219
+		if ($percentage > 100) {
220 220
 			$percentage = 100;
221 221
 		}
222 222
 
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @param array $request The Form Data passed into the batch processing.
232 232
 	 */
233
-	public function set_properties( $request ) {
234
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
235
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
236
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
237
-		$this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array();
238
-		$this->tags       = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array();
233
+	public function set_properties($request) {
234
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
235
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
236
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
237
+		$this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array();
238
+		$this->tags       = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array();
239 239
 	}
240 240
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades-complete.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 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
 <div class="wrap" id="poststuff">
18 18
 	<div id="give-updates">
19
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1>
19
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1>
20 20
 		<div class="give-update-panel-content">
21
-			<p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give' ); ?></p>
21
+			<p><?php esc_html_e('Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give'); ?></p>
22 22
 		</div>
23 23
 
24 24
 	</div>
Please login to merge, or discard this patch.
includes/admin/upgrades/views/plugins-update-section.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* @var Give_Updates $give_updates */
3
-$plugins = $give_updates->get_updates( 'plugin' );
4
-if ( empty( $plugins ) ) {
3
+$plugins = $give_updates->get_updates('plugin');
4
+if (empty($plugins)) {
5 5
 	return;
6 6
 }
7 7
 
8 8
 ob_start();
9
-foreach ( $plugins as $plugin_data ) {
10
-	if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) {
9
+foreach ($plugins as $plugin_data) {
10
+	if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) {
11 11
 		continue;
12 12
 	}
13 13
 
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	$author_name = $plugin_data['Author'];
16 16
 
17 17
 	// Link the plugin name to the plugin URL if available.
18
-	if ( ! empty( $plugin_data['PluginURI'] ) ) {
18
+	if ( ! empty($plugin_data['PluginURI'])) {
19 19
 		$plugin_name = sprintf(
20 20
 			'<a href="%s" title="%s">%s</a> (%s)',
21
-			esc_url( $plugin_data['PluginURI'] ),
22
-			esc_attr__( 'Visit plugin homepage', 'give' ),
21
+			esc_url($plugin_data['PluginURI']),
22
+			esc_attr__('Visit plugin homepage', 'give'),
23 23
 			$plugin_name,
24
-			esc_html( $plugin_data['Version'] )
24
+			esc_html($plugin_data['Version'])
25 25
 		);
26 26
 	}
27 27
 
28 28
 	// Link the author name to the author URL if available.
29
-	if ( ! empty( $plugin_data['AuthorURI'] ) ) {
29
+	if ( ! empty($plugin_data['AuthorURI'])) {
30 30
 		$author_name = sprintf(
31 31
 			'<a href="%s" title="%s">%s</a>',
32
-			esc_url( $plugin_data['AuthorURI'] ),
33
-			esc_attr__( 'Visit author homepage', 'give' ),
32
+			esc_url($plugin_data['AuthorURI']),
33
+			esc_attr__('Visit author homepage', 'give'),
34 34
 			$author_name
35 35
 		);
36 36
 	}
37 37
 	?>
38
-	<tr <?php echo( true !== $plugin_data['License'] ? 'data-tooltip="' . __( 'Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give' ) . '"' : '' ); ?>>
39
-		<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
38
+	<tr <?php echo(true !== $plugin_data['License'] ? 'data-tooltip="'.__('Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give').'"' : ''); ?>>
39
+		<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
40 40
 		<td>
41 41
 			<?php
42
-			echo ( true === $plugin_data['License'] ) ? '<span class="dashicons dashicons-yes"></span>' . __( 'Licensed', 'give' ) : '<span class="dashicons dashicons-no-alt"></span>' . __( 'Unlicensed', 'give' );
42
+			echo (true === $plugin_data['License']) ? '<span class="dashicons dashicons-yes"></span>'.__('Licensed', 'give') : '<span class="dashicons dashicons-no-alt"></span>'.__('Unlicensed', 'give');
43 43
 
44 44
 			echo sprintf(
45 45
 				' &ndash; %s &ndash; %s',
46
-				sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ),
47
-				sprintf( __( '(Latest Version: %s)' ), $plugin_data['update']->new_version )
46
+				sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))),
47
+				sprintf(__('(Latest Version: %s)'), $plugin_data['update']->new_version)
48 48
 			);
49 49
 			?>
50 50
 		</td>
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Amount', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' ),
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Amount', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
83
+					echo give_price($post_id, false);
84
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
89
-					echo give_goal( $post_id, false );
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89
+					echo give_goal($post_id, false);
90 90
 				} else {
91
-					esc_html_e( 'No Goal Set', 'give' );
91
+					esc_html_e('No Goal Set', 'give');
92 92
 				}
93 93
 
94
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
94
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
95 95
 				break;
96 96
 			case 'donations':
97
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
98
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ) . '">';
99
-					echo give_get_form_sales_stats( $post_id );
97
+				if (current_user_can('view_give_form_stats', $post_id)) {
98
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)).'">';
99
+					echo give_get_form_sales_stats($post_id);
100 100
 					echo '</a>';
101 101
 				} else {
102 102
 					echo '-';
103 103
 				}
104 104
 				break;
105 105
 			case 'earnings':
106
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
107
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">';
108
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) );
106
+				if (current_user_can('view_give_form_stats', $post_id)) {
107
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">';
108
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false)));
109 109
 					echo '</a>';
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'shortcode':
115
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
115
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
116 116
 				break;
117 117
 		}// End switch().
118 118
 	}// End if().
119 119
 }
120 120
 
121
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
121
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
122 122
 
123 123
 /**
124 124
  * Registers the sortable columns in the list table
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @return array $columns Array of sortable columns
131 131
  */
132
-function give_sortable_form_columns( $columns ) {
132
+function give_sortable_form_columns($columns) {
133 133
 	$columns['price']     = 'amount';
134 134
 	$columns['sales']     = 'sales';
135 135
 	$columns['earnings']  = 'earnings';
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	return $columns;
140 140
 }
141 141
 
142
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
142
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
143 143
 
144 144
 /**
145 145
  * Sorts Columns in the Forms List Table
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
  *
151 151
  * @return array $vars Array of all the sort variables.
152 152
  */
153
-function give_sort_forms( $vars ) {
153
+function give_sort_forms($vars) {
154 154
 	// Check if we're viewing the "give_forms" post type.
155
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
155
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
156 156
 		return $vars;
157 157
 	}
158 158
 
159
-	switch ( $vars['orderby'] ) {
159
+	switch ($vars['orderby']) {
160 160
 		// Check if 'orderby' is set to "sales".
161 161
 		case 'sales':
162 162
 			$vars = array_merge(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 		// Check if "orderby" is set to "price/amount".
183 183
 		case 'amount':
184
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
184
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
185 185
 
186 186
 			$vars['orderby']    = 'meta_value_num';
187 187
 			$vars['meta_query'] = array(
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
  *
234 234
  * @return array       Array of all sort variables.
235 235
  */
236
-function give_filter_forms( $vars ) {
237
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
236
+function give_filter_forms($vars) {
237
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
238 238
 
239 239
 		// If an author ID was passed, use it
240
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
240
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
241 241
 
242 242
 			$author_id = $_REQUEST['author'];
243
-			if ( (int) $author_id !== get_current_user_id() ) {
244
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
243
+			if ((int) $author_id !== get_current_user_id()) {
244
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
245 245
 					'response' => 403,
246
-				) );
246
+				));
247 247
 			}
248 248
 			$vars = array_merge(
249 249
 				$vars,
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
  * @return void
268 268
  */
269 269
 function give_forms_load() {
270
-	add_filter( 'request', 'give_sort_forms' );
271
-	add_filter( 'request', 'give_filter_forms' );
270
+	add_filter('request', 'give_sort_forms');
271
+	add_filter('request', 'give_filter_forms');
272 272
 }
273 273
 
274
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
274
+add_action('load-edit.php', 'give_forms_load', 9999);
275 275
 
276 276
 /**
277 277
  * Remove Forms Month Filter
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
  * @global      $typenow The post type we are viewing.
286 286
  * @return array Empty array disables the dropdown.
287 287
  */
288
-function give_remove_month_filter( $dates ) {
288
+function give_remove_month_filter($dates) {
289 289
 	global $typenow;
290 290
 
291
-	if ( $typenow == 'give_forms' ) {
291
+	if ($typenow == 'give_forms') {
292 292
 		$dates = array();
293 293
 	}
294 294
 
295 295
 	return $dates;
296 296
 }
297 297
 
298
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
298
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
299 299
 
300 300
 /**
301 301
  * Updates price when saving post
@@ -306,23 +306,23 @@  discard block
 block discarded – undo
306 306
  *
307 307
  * @return int|null
308 308
  */
309
-function give_price_save_quick_edit( $post_id ) {
310
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
309
+function give_price_save_quick_edit($post_id) {
310
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
311 311
 		return;
312 312
 	}
313
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
313
+	if ( ! current_user_can('edit_post', $post_id)) {
314 314
 		return $post_id;
315 315
 	}
316
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
316
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
317 317
 		return $post_id;
318 318
 	}
319 319
 
320
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
321
-		give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) );
320
+	if (isset($_REQUEST['_give_regprice'])) {
321
+		give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice']))));
322 322
 	}
323 323
 }
324 324
 
325
-add_action( 'save_post', 'give_price_save_quick_edit' );
325
+add_action('save_post', 'give_price_save_quick_edit');
326 326
 
327 327
 /**
328 328
  * Process bulk edit actions via AJAX
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
  */
333 333
 function give_save_bulk_edit() {
334 334
 
335
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
335
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
336 336
 
337
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
338
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
339
-		foreach ( $post_ids as $post_id ) {
337
+	if ( ! empty($post_ids) && is_array($post_ids)) {
338
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
339
+		foreach ($post_ids as $post_id) {
340 340
 
341
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
341
+			if ( ! current_user_can('edit_post', $post_id)) {
342 342
 				continue;
343 343
 			}
344 344
 
345
-			if ( ! empty( $price ) ) {
346
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) );
345
+			if ( ! empty($price)) {
346
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price));
347 347
 			}
348 348
 		}
349 349
 	}
@@ -351,4 +351,4 @@  discard block
 block discarded – undo
351 351
 	die();
352 352
 }
353 353
 
354
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
354
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +32 added lines, -32 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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,27 +46,27 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date(_x('F j, Y', 'dashboard widget', 'give')); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					esc_html__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					esc_html__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59 59
 			<p class="give-dashboard-today-earnings"><?php
60
-				$earnings_today = $stats->get_earnings( 0, 'today', false );
61
-				echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) );
60
+				$earnings_today = $stats->get_earnings(0, 'today', false);
61
+				echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false)));
62 62
 			?></p>
63 63
 
64 64
 			<p class="give-orders-today"><?php
65
-				$donations_today = $stats->get_sales( 0, 'today', false );
65
+				$donations_today = $stats->get_sales(0, 'today', false);
66 66
 				printf(
67 67
 					/* translators: %s: daily donation count */
68
-					esc_html__( '%s donations today', 'give' ),
69
-					give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) )
68
+					esc_html__('%s donations today', 'give'),
69
+					give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false))
70 70
 				);
71 71
 			?></p>
72 72
 
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 		<table class="give-table-stats">
77 77
 			<thead style="display: none;">
78 78
 			<tr>
79
-				<th><?php esc_html_e( 'This Week', 'give' ); ?></th>
80
-				<th><?php esc_html_e( 'This Month', 'give' ); ?></th>
81
-				<th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th>
79
+				<th><?php esc_html_e('This Week', 'give'); ?></th>
80
+				<th><?php esc_html_e('This Month', 'give'); ?></th>
81
+				<th><?php esc_html_e('Past 30 Days', 'give'); ?></th>
82 82
 			</tr>
83 83
 			</thead>
84 84
 			<tbody>
85 85
 			<tr id="give-table-stats-tr-1">
86 86
 				<td>
87
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p>
87
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p>
88 88
 
89
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Week', 'give' ); ?></p>
89
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Week', 'give'); ?></p>
90 90
 				</td>
91 91
 				<td>
92
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p>
92
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p>
93 93
 
94
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Month', 'give' ); ?></p>
94
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Month', 'give'); ?></p>
95 95
 				</td>
96 96
 			</tr>
97 97
 			<tr id="give-table-stats-tr-2">
98 98
 				<td>
99
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p>
99
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p>
100 100
 
101
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'Last Month', 'give' ); ?></p>
101
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('Last Month', 'give'); ?></p>
102 102
 				</td>
103 103
 				<td>
104
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ), array( 'decimal' => false, 'sanitize' => false ) ) ) ?></p>
104
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false), array('decimal' => false, 'sanitize' => false))) ?></p>
105 105
 
106
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Year', 'give' ); ?></p>
106
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Year', 'give'); ?></p>
107 107
 				</td>
108 108
 			</tr>
109 109
 			</tbody>
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return array
125 125
  */
126
-function give_dashboard_at_a_glance_widget( $items ) {
127
-	$num_posts = wp_count_posts( 'give_forms' );
126
+function give_dashboard_at_a_glance_widget($items) {
127
+	$num_posts = wp_count_posts('give_forms');
128 128
 
129
-	if ( $num_posts && $num_posts->publish ) {
129
+	if ($num_posts && $num_posts->publish) {
130 130
 
131 131
 		$text = sprintf(
132 132
 			/* translators: %s: number of posts published */
133
-			_n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ),
133
+			_n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'),
134 134
 			$num_posts->publish
135 135
 		);
136 136
 
137
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
137
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
138 138
 
139
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
139
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
140 140
 			$text = sprintf(
141 141
 				'<a class="give-forms-count" href="%1$s">%2$s</a>',
142
-				admin_url( 'edit.php?post_type=give_forms' ),
142
+				admin_url('edit.php?post_type=give_forms'),
143 143
 				$text
144 144
 			);
145 145
 		} else {
@@ -155,4 +155,4 @@  discard block
 block discarded – undo
155 155
 	return $items;
156 156
 }
157 157
 
158
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
158
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 1 patch
Spacing   +17 added lines, -17 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
 
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return  mixed
29 29
  */
30
-function __give_sanitize_number_decimals_setting_field( $value ) {
30
+function __give_sanitize_number_decimals_setting_field($value) {
31 31
 	$value_changed = false;
32 32
 	$old_value     = $value;
33 33
 
34
-	if ( isset( $_POST['decimal_separator'] ) ) {
35
-		$value         = ! empty( $_POST['decimal_separator'] ) ? $value : 0;
34
+	if (isset($_POST['decimal_separator'])) {
35
+		$value         = ! empty($_POST['decimal_separator']) ? $value : 0;
36 36
 		$value_changed = true;
37 37
 	}
38 38
 
39
-	if ( $value_changed && ( $old_value != $value ) ) {
40
-		Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) );
39
+	if ($value_changed && ($old_value != $value)) {
40
+		Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give'));
41 41
 	}
42 42
 
43
-	$value = absint( $value );
43
+	$value = absint($value);
44 44
 
45
-	if( 6 <= $value ) {
45
+	if (6 <= $value) {
46 46
 		$value = 5;
47
-		Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give' ) );
47
+		Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give'));
48 48
 	}
49 49
 
50
-	return absint( $value );
50
+	return absint($value);
51 51
 }
52 52
 
53
-add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 );
53
+add_filter('give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10);
54 54
 
55 55
 
56 56
 /**
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return  mixed
68 68
  */
69
-function __give_validate_decimal_separator_setting_field( $value ) {
70
-	$thousand_separator = give_clean( $_POST['thousands_separator'] );
71
-	$decimal_separator  = give_clean( $_POST['decimal_separator'] );
69
+function __give_validate_decimal_separator_setting_field($value) {
70
+	$thousand_separator = give_clean($_POST['thousands_separator']);
71
+	$decimal_separator  = give_clean($_POST['decimal_separator']);
72 72
 
73
-	if ( $decimal_separator === $thousand_separator ) {
73
+	if ($decimal_separator === $thousand_separator) {
74 74
 		$value                    = '';
75 75
 		$_POST['number_decimals'] = 0;
76
-		Give_Admin_Settings::add_error( 'give-decimal-separator', __( 'The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give' ) );
76
+		Give_Admin_Settings::add_error('give-decimal-separator', __('The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give'));
77 77
 	}
78 78
 
79 79
 	return $value;
80 80
 }
81 81
 
82
-add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 );
83 82
\ No newline at end of file
83
+add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10);
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  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
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
28 28
 
29
-		parent::__construct( 'give_goal' );
29
+		parent::__construct('give_goal');
30 30
 	}
31 31
 
32 32
 	/**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$create_form_link = sprintf(
40 40
 		/* translators: %s: create new form URL */
41
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42
-			admin_url( 'post-new.php?post_type=give_forms' )
41
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
42
+			admin_url('post-new.php?post_type=give_forms')
43 43
 		);
44 44
 
45 45
 		return array(
@@ -51,35 +51,35 @@  discard block
 block discarded – undo
51 51
 					'meta_value' => 'enabled',
52 52
 				),
53 53
 				'name'        => 'id',
54
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
55
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
54
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
55
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
56 56
 				'required'    => array(
57
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
58
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
57
+					'alert' => esc_html__('You must first select a Form!', 'give'),
58
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
59 59
 				),
60 60
 			),
61 61
 			array(
62 62
 				'type' => 'container',
63
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
63
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
64 64
 			),
65 65
 			array(
66 66
 				'type'    => 'listbox',
67 67
 				'name'    => 'show_text',
68
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
69
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
68
+				'label'   => esc_attr__('Show Text:', 'give'),
69
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html__( 'Show', 'give' ),
72
-					'false' => esc_html__( 'Hide', 'give' ),
71
+					'true'  => esc_html__('Show', 'give'),
72
+					'false' => esc_html__('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'show_bar',
78
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
79
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
78
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
79
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
80 80
 				'options' => array(
81
-					'true'  => esc_html__( 'Show', 'give' ),
82
-					'false' => esc_html__( 'Hide', 'give' ),
81
+					'true'  => esc_html__('Show', 'give'),
82
+					'false' => esc_html__('Hide', 'give'),
83 83
 				),
84 84
 			),
85 85
 		);
Please login to merge, or discard this patch.