Test Failed
Push — master ( 35678a...7fea6f )
by Devin
07:20
created
includes/class-give-cli-commands.php 1 patch
Spacing   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
14 14
 // Add give command.
15
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
15
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
16 16
 
17 17
 
18 18
 /**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @subcommand    logo
78 78
 	 */
79
-	public function ascii( $args, $assoc_args ) {
80
-		WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/dist/images/give-ascii-logo.txt' ) );
79
+	public function ascii($args, $assoc_args) {
80
+		WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/dist/images/give-ascii-logo.txt'));
81 81
 	}
82 82
 
83 83
 
@@ -102,54 +102,54 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @subcommand    details
104 104
 	 */
105
-	public function details( $args, $assoc_args ) {
105
+	public function details($args, $assoc_args) {
106 106
 
107 107
 		/**
108 108
 		 * Plugin Information
109 109
 		 */
110
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
110
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
111 111
 
112 112
 		/**
113 113
 		 * General Information.
114 114
 		 */
115
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
115
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
116 116
 
117
-		$success_page = give_get_option( 'success_page' );
118
-		$failure_page = give_get_option( 'failure_page' );
119
-		$history_page = give_get_option( 'history_page' );
117
+		$success_page = give_get_option('success_page');
118
+		$failure_page = give_get_option('failure_page');
119
+		$history_page = give_get_option('history_page');
120 120
 
121
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
122
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
123
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
124
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
121
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
122
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
123
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
124
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
125 125
 
126 126
 		/**
127 127
 		 * Currency Information.
128 128
 		 */
129
-		$default_gateway = give_get_option( 'default_gateway' );
129
+		$default_gateway = give_get_option('default_gateway');
130 130
 
131
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
131
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
132 132
 
133
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
134
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
135
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
136
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
137
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
138
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) );
139
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) );
133
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
134
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
135
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
136
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
137
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
138
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
139
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
140 140
 
141 141
 		// Payment gateways Information.
142
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
143
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
142
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
143
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
144 144
 
145
-		if ( ! empty( $gateways ) ) {
145
+		if ( ! empty($gateways)) {
146 146
 			self::$counter = 1;
147
-			foreach ( $gateways as $gateway ) {
148
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
149
-				self::$counter ++;
147
+			foreach ($gateways as $gateway) {
148
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
149
+				self::$counter++;
150 150
 			}
151 151
 		} else {
152
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
152
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
153 153
 		}
154 154
 	}
155 155
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @subcommand    forms
183 183
 	 */
184
-	public function forms( $args, $assoc_args ) {
184
+	public function forms($args, $assoc_args) {
185 185
 		global $wp_query;
186
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
187
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
186
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
187
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
188 188
 		$start   = time();
189 189
 
190 190
 		// Cache previous number query var.
191 191
 		$is_set_number = $cache_per_page = false;
192
-		if ( isset( $wp_query->query_vars['number'] ) ) {
192
+		if (isset($wp_query->query_vars['number'])) {
193 193
 			$cache_per_page = $wp_query->query_vars['number'];
194 194
 			$is_set_number  = true;
195 195
 		}
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 		$wp_query->query_vars['number'] = $number;
199 199
 
200 200
 		// Get forms.
201
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
201
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
202 202
 
203 203
 		// Reset number query var.
204
-		if ( $is_set_number ) {
204
+		if ($is_set_number) {
205 205
 			$wp_query->query_vars['number'] = $cache_per_page;
206 206
 		}
207 207
 
208 208
 		// Bailout.
209
-		if ( array_key_exists( 'error', $forms ) ) {
209
+		if (array_key_exists('error', $forms)) {
210 210
 
211
-			WP_CLI::warning( $forms['error'] );
211
+			WP_CLI::warning($forms['error']);
212 212
 
213 213
 			return;
214
-		} elseif ( empty( $forms['forms'] ) ) {
214
+		} elseif (empty($forms['forms'])) {
215 215
 
216
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
216
+			WP_CLI::error(__('No forms found.', 'give'));
217 217
 
218 218
 			return;
219 219
 		}
@@ -221,25 +221,25 @@  discard block
 block discarded – undo
221 221
 		// Param to check if form typeis already showed or not.
222 222
 		$is_show_form_type = false;
223 223
 
224
-		if ( 1 === count( $forms ) && $form_id ) {
224
+		if (1 === count($forms) && $form_id) {
225 225
 			// Show single form.
226
-			foreach ( $forms['forms'][0] as $key => $info ) {
227
-				switch ( $key ) {
226
+			foreach ($forms['forms'][0] as $key => $info) {
227
+				switch ($key) {
228 228
 					case 'stats':
229
-						$this->color_main_heading( ucfirst( $key ) );
229
+						$this->color_main_heading(ucfirst($key));
230 230
 
231
-						foreach ( $info as $heading => $data ) {
232
-							$this->color_sub_heading( ucfirst( $heading ) );
233
-							switch ( $heading ) {
231
+						foreach ($info as $heading => $data) {
232
+							$this->color_sub_heading(ucfirst($heading));
233
+							switch ($heading) {
234 234
 								default:
235
-									foreach ( $data as $subheading => $subdata ) {
235
+									foreach ($data as $subheading => $subdata) {
236 236
 
237
-										switch ( $subheading ) {
237
+										switch ($subheading) {
238 238
 											case 'earnings':
239
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
239
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
240 240
 												break;
241 241
 											default:
242
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
242
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
243 243
 										}
244 244
 									}
245 245
 							}
@@ -249,26 +249,26 @@  discard block
 block discarded – undo
249 249
 					case 'pricing':
250 250
 					case 'info':
251 251
 					default:
252
-						$this->color_main_heading( ucfirst( $key ) );
252
+						$this->color_main_heading(ucfirst($key));
253 253
 
254 254
 						// Show form type.
255
-						if ( ! $is_show_form_type ) {
256
-							$form              = new Give_Donate_Form( $form_id );
255
+						if ( ! $is_show_form_type) {
256
+							$form              = new Give_Donate_Form($form_id);
257 257
 							$is_show_form_type = true;
258 258
 
259
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
259
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
260 260
 						}
261 261
 
262
-						foreach ( $info as $heading => $data ) {
262
+						foreach ($info as $heading => $data) {
263 263
 
264
-							switch ( $heading ) {
264
+							switch ($heading) {
265 265
 								case 'id':
266
-									WP_CLI::log( $this->color_message( $heading, $data ) );
266
+									WP_CLI::log($this->color_message($heading, $data));
267 267
 									break;
268 268
 
269 269
 								default:
270
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
271
-									WP_CLI::log( $this->color_message( $heading, $data ) );
270
+									$data = empty($data) ? __('Not set', 'give') : $data;
271
+									WP_CLI::log($this->color_message($heading, $data));
272 272
 							}
273 273
 						}
274 274
 				}// End switch().
@@ -279,37 +279,37 @@  discard block
 block discarded – undo
279 279
 			$is_table_first_row_set = false;
280 280
 			$table_column_count     = 0;
281 281
 
282
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
282
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
283 283
 
284
-			foreach ( $forms['forms'] as $index => $form_data ) {
284
+			foreach ($forms['forms'] as $index => $form_data) {
285 285
 
286 286
 				// Default table data.
287 287
 				$table_first_row = array();
288 288
 				$table_row       = array();
289 289
 
290
-				foreach ( $form_data['info'] as $key => $form ) {
290
+				foreach ($form_data['info'] as $key => $form) {
291 291
 
292 292
 					// Do not show thumbnail, content and link in table.
293
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
293
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
294 294
 						continue;
295 295
 					}
296 296
 
297
-					if ( ! $is_table_first_row_set ) {
297
+					if ( ! $is_table_first_row_set) {
298 298
 						$table_first_row[] = $key;
299 299
 					}
300 300
 
301 301
 					$table_row[] = $form;
302 302
 
303
-					if ( 'status' === $key ) {
303
+					if ('status' === $key) {
304 304
 						// First array item will be an form id in our case.
305
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
305
+						$form = new Give_Donate_Form(absint($table_row[0]));
306 306
 
307 307
 						$table_row[] = $form->get_type();
308 308
 					}
309 309
 				}
310 310
 
311 311
 				// Set table first row.
312
-				if ( ! $is_table_first_row_set ) {
312
+				if ( ! $is_table_first_row_set) {
313 313
 
314 314
 					// Add extra column to table.
315 315
 					$table_first_row[] = 'type';
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 				$table_data[] = $table_row;
323 323
 			}// End foreach().
324 324
 
325
-			$this->display_table( $table_data );
325
+			$this->display_table($table_data);
326 326
 		}// End if().
327 327
 	}
328 328
 
@@ -375,59 +375,59 @@  discard block
 block discarded – undo
375 375
 	 *
376 376
 	 * @subcommand    donors
377 377
 	 */
378
-	public function donors( $args, $assoc_args ) {
378
+	public function donors($args, $assoc_args) {
379 379
 		global $wp_query;
380
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
381
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
382
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
383
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
384
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
385
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
386
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
380
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
381
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
382
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
383
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
384
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
385
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
386
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
387 387
 		$start    = time();
388 388
 
389
-		if ( $create ) {
390
-			if ( 80 < $create ) {
391
-				WP_CLI::warning( 'Currently we can only generate maximum 80 donors.', 'give' );
389
+		if ($create) {
390
+			if (80 < $create) {
391
+				WP_CLI::warning('Currently we can only generate maximum 80 donors.', 'give');
392 392
 				$create = 80;
393 393
 			}
394 394
 
395 395
 			$number = 1;
396 396
 
397
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
398
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
397
+			if (isset($assoc_args['email']) && ! is_email($email)) {
398
+				WP_CLI::warning('Wrong email address provided.', 'give');
399 399
 
400 400
 				return;
401 401
 			}
402 402
 
403 403
 			// Create one or more donors.
404
-			if ( ! $email ) {
404
+			if ( ! $email) {
405 405
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
406
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
406
+				$number = is_numeric($create) ? absint($create) : 1;
407 407
 			}
408 408
 
409
-			for ( $i = 0; $i < $number; $i ++ ) {
409
+			for ($i = 0; $i < $number; $i++) {
410 410
 				$name  = $name ? $name : $this->get_random_name();
411
-				$email = $email ? $email : $this->get_random_email( $name );
411
+				$email = $email ? $email : $this->get_random_email($name);
412 412
 
413 413
 				$args = array(
414 414
 					'email' => $email,
415 415
 					'name'  => $name,
416 416
 				);
417 417
 
418
-				$donor_id = Give()->donors->add( $args );
418
+				$donor_id = Give()->donors->add($args);
419 419
 
420
-				if ( $donor_id ) {
421
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) );
420
+				if ($donor_id) {
421
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id)));
422 422
 				} else {
423
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
423
+					WP_CLI::error(__('Failed to create donor', 'give'));
424 424
 				}
425 425
 
426 426
 				// Reset email and name to false so it is generated on the next loop (if creating donors).
427 427
 				$email = $name = false;
428 428
 			}
429 429
 
430
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
430
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
431 431
 
432 432
 		} else {
433 433
 			// Counter.
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 			 */
442 442
 			// Cache previous number query var.
443 443
 			$is_set_number = $cache_per_page = false;
444
-			if ( isset( $wp_query->query_vars['number'] ) ) {
444
+			if (isset($wp_query->query_vars['number'])) {
445 445
 				$cache_per_page = $wp_query->query_vars['number'];
446 446
 				$is_set_number  = true;
447 447
 			}
@@ -450,24 +450,24 @@  discard block
 block discarded – undo
450 450
 			$wp_query->query_vars['number'] = $number;
451 451
 
452 452
 			// Get donors.
453
-			if ( $form_id ) {
453
+			if ($form_id) {
454 454
 				// @TODO: Allow user to get a list of donors by donation status.
455
-				$donors = $this->get_donors_by_form_id( $form_id );
455
+				$donors = $this->get_donors_by_form_id($form_id);
456 456
 			} else {
457
-				$donors = $this->api->get_donors( $search );
457
+				$donors = $this->api->get_donors($search);
458 458
 			}
459 459
 
460 460
 			// Reset number query var.
461
-			if ( $is_set_number ) {
461
+			if ($is_set_number) {
462 462
 				$wp_query->query_vars['number'] = $cache_per_page;
463 463
 			}
464 464
 
465
-			if ( isset( $donors['error'] ) ) {
466
-				WP_CLI::error( $donors['error'] );
465
+			if (isset($donors['error'])) {
466
+				WP_CLI::error($donors['error']);
467 467
 			}
468 468
 
469
-			if ( empty( $donors ) ) {
470
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
469
+			if (empty($donors)) {
470
+				WP_CLI::error(__('No donors found.', 'give'));
471 471
 
472 472
 				return;
473 473
 			}
@@ -475,24 +475,24 @@  discard block
 block discarded – undo
475 475
 			$table_data             = array();
476 476
 			$is_table_first_row_set = false;
477 477
 
478
-			foreach ( $donors['donors'] as $donor_data ) {
478
+			foreach ($donors['donors'] as $donor_data) {
479 479
 				// Set default table row data.
480
-				$table_first_row = array( __( 's_no', 'give' ) );
481
-				$table_row       = array( self::$counter );
480
+				$table_first_row = array(__('s_no', 'give'));
481
+				$table_row       = array(self::$counter);
482 482
 
483
-				foreach ( $donor_data as $key => $donor ) {
484
-					switch ( $key ) {
483
+				foreach ($donor_data as $key => $donor) {
484
+					switch ($key) {
485 485
 						case 'stats':
486
-							foreach ( $donor as $heading => $data ) {
486
+							foreach ($donor as $heading => $data) {
487 487
 
488 488
 								// Get first row.
489
-								if ( ! $is_table_first_row_set ) {
489
+								if ( ! $is_table_first_row_set) {
490 490
 									$table_first_row[] = $heading;
491 491
 								}
492 492
 
493
-								switch ( $heading ) {
493
+								switch ($heading) {
494 494
 									case 'total_spent':
495
-										$table_row[] = give_currency_filter( $data );
495
+										$table_row[] = give_currency_filter($data);
496 496
 										break;
497 497
 
498 498
 									default:
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 
504 504
 						case 'info':
505 505
 						default:
506
-							foreach ( $donor as $heading => $data ) {
506
+							foreach ($donor as $heading => $data) {
507 507
 
508 508
 								// Get first row.
509
-								if ( ! $is_table_first_row_set ) {
509
+								if ( ! $is_table_first_row_set) {
510 510
 									$table_first_row[] = $heading;
511 511
 								}
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 				}
517 517
 
518 518
 				// Add first row data to table data.
519
-				if ( ! $is_table_first_row_set ) {
519
+				if ( ! $is_table_first_row_set) {
520 520
 					$table_data[]           = $table_first_row;
521 521
 					$is_table_first_row_set = true;
522 522
 				}
@@ -525,44 +525,44 @@  discard block
 block discarded – undo
525 525
 				$table_data[] = $table_row;
526 526
 
527 527
 				// Increase counter.
528
-				self::$counter ++;
528
+				self::$counter++;
529 529
 			}// End foreach().
530 530
 
531
-			switch ( $format ) {
531
+			switch ($format) {
532 532
 				case 'json':
533 533
 					$table_column_name = $table_data[0];
534
-					unset( $table_data[0] );
534
+					unset($table_data[0]);
535 535
 
536 536
 					$new_table_data = array();
537
-					foreach ( $table_data as $index => $data ) {
538
-						foreach ( $data as $key => $value ) {
539
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
537
+					foreach ($table_data as $index => $data) {
538
+						foreach ($data as $key => $value) {
539
+							$new_table_data[$index][$table_column_name[$key]] = $value;
540 540
 						}
541 541
 					}
542 542
 
543
-					WP_CLI::log( json_encode( $new_table_data ) );
543
+					WP_CLI::log(json_encode($new_table_data));
544 544
 					break;
545 545
 
546 546
 				case 'csv':
547
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
548
-					$fp        = fopen( $file_path, 'w' );
547
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
548
+					$fp        = fopen($file_path, 'w');
549 549
 
550
-					if ( is_writable( $file_path ) ) {
551
-						foreach ( $table_data as $fields ) {
552
-							fputcsv( $fp, $fields );
550
+					if (is_writable($file_path)) {
551
+						foreach ($table_data as $fields) {
552
+							fputcsv($fp, $fields);
553 553
 						}
554 554
 
555
-						fclose( $fp );
555
+						fclose($fp);
556 556
 
557
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
557
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
558 558
 					} else {
559
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
559
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
560 560
 					}
561 561
 
562 562
 					break;
563 563
 
564 564
 				default:
565
-					$this->display_table( $table_data );
565
+					$this->display_table($table_data);
566 566
 			}// End switch().
567 567
 		}// End if().
568 568
 	}
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 	 *
593 593
 	 * @subcommand    donations
594 594
 	 */
595
-	public function donations( $args, $assoc_args ) {
595
+	public function donations($args, $assoc_args) {
596 596
 		global $wp_query;
597
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
597
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
598 598
 
599 599
 		// Cache previous number query var.
600 600
 		$is_set_number = $cache_per_page = false;
601
-		if ( isset( $wp_query->query_vars['number'] ) ) {
601
+		if (isset($wp_query->query_vars['number'])) {
602 602
 			$cache_per_page = $wp_query->query_vars['number'];
603 603
 			$is_set_number  = true;
604 604
 		}
@@ -610,46 +610,46 @@  discard block
 block discarded – undo
610 610
 		$donations = $this->api->get_recent_donations();
611 611
 
612 612
 		// Reset number query var.
613
-		if ( $is_set_number ) {
613
+		if ($is_set_number) {
614 614
 			$wp_query->query_vars['number'] = $cache_per_page;
615 615
 		}
616 616
 
617
-		if ( empty( $donations ) ) {
618
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
617
+		if (empty($donations)) {
618
+			WP_CLI::error(__('No donations found.', 'give'));
619 619
 
620 620
 			return;
621 621
 		}
622 622
 
623 623
 		self::$counter = 1;
624 624
 
625
-		foreach ( $donations['donations'] as $key => $donation ) {
626
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
627
-			self::$counter ++;
625
+		foreach ($donations['donations'] as $key => $donation) {
626
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
627
+			self::$counter++;
628 628
 
629
-			foreach ( $donation as $column => $data ) {
629
+			foreach ($donation as $column => $data) {
630 630
 
631
-				if ( is_array( $data ) ) {
632
-					$this->color_sub_heading( $column );
633
-					foreach ( $data as $subcolumn => $subdata ) {
631
+				if (is_array($data)) {
632
+					$this->color_sub_heading($column);
633
+					foreach ($data as $subcolumn => $subdata) {
634 634
 
635 635
 						// Decode html codes.
636
-						switch ( $subcolumn ) {
636
+						switch ($subcolumn) {
637 637
 							case 'name':
638
-								$subdata = html_entity_decode( $subdata );
638
+								$subdata = html_entity_decode($subdata);
639 639
 								break;
640 640
 						}
641 641
 
642 642
 						// @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta.
643
-						if ( is_array( $subdata ) ) {
643
+						if (is_array($subdata)) {
644 644
 							continue;
645 645
 						}
646 646
 
647
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
647
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
648 648
 					}
649 649
 					continue;
650 650
 				}
651 651
 
652
-				WP_CLI::log( $this->color_message( $column, $data ) );
652
+				WP_CLI::log($this->color_message($column, $data));
653 653
 			}
654 654
 		}
655 655
 	}
@@ -689,27 +689,27 @@  discard block
 block discarded – undo
689 689
 	 *
690 690
 	 * @return        void
691 691
 	 */
692
-	public function report( $args, $assoc_args ) {
692
+	public function report($args, $assoc_args) {
693 693
 		$stats      = new Give_Payment_Stats();
694
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
695
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
696
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
697
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
694
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
695
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
696
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
697
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
698 698
 
699
-		if ( ! empty( $date ) ) {
699
+		if ( ! empty($date)) {
700 700
 			$start_date = $date;
701 701
 			$end_date   = false;
702
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
702
+		} elseif (empty($date) && empty($start_date)) {
703 703
 			$start_date = 'this_month';
704 704
 			$end_date   = false;
705 705
 		}
706 706
 
707 707
 		// Get stats.
708
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
709
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
708
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
709
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
710 710
 
711
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings, array( 'decode_currency' => true ) ) ) );
712
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
711
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings, array('decode_currency' => true))));
712
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
713 713
 	}
714 714
 
715 715
 
@@ -736,27 +736,27 @@  discard block
 block discarded – undo
736 736
 	 *
737 737
 	 * @subcommand    cache
738 738
 	 */
739
-	public function cache( $args, $assoc_args ) {
740
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
739
+	public function cache($args, $assoc_args) {
740
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
741 741
 
742 742
 		// Bailout.
743
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
744
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
743
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
744
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
745 745
 
746 746
 			return;
747 747
 		}
748 748
 
749
-		switch ( $action ) {
749
+		switch ($action) {
750 750
 			case 'delete':
751 751
 				// Reset counter.
752 752
 				self::$counter = 1;
753 753
 
754
-				if ( $this->delete_stats_transients() ) {
754
+				if ($this->delete_stats_transients()) {
755 755
 					// Report .eading.
756
-					WP_CLI::success( 'Give cache deleted.' );
756
+					WP_CLI::success('Give cache deleted.');
757 757
 				} else {
758 758
 					// Report .eading.
759
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
759
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
760 760
 				}
761 761
 				break;
762 762
 		}
@@ -785,27 +785,27 @@  discard block
 block discarded – undo
785 785
 			ARRAY_A
786 786
 		);
787 787
 
788
-		if ( ! empty( $stat_option_names ) ) {
788
+		if ( ! empty($stat_option_names)) {
789 789
 
790
-			foreach ( $stat_option_names as $option_name ) {
790
+			foreach ($stat_option_names as $option_name) {
791 791
 				$error       = false;
792 792
 				$option_name = $option_name['option_name'];
793 793
 
794
-				switch ( true ) {
795
-					case ( false !== strpos( $option_name, 'transient' ) ):
796
-						$option_name = str_replace( '_transient_', '', $option_name );
797
-						$error       = delete_transient( $option_name );
794
+				switch (true) {
795
+					case (false !== strpos($option_name, 'transient')):
796
+						$option_name = str_replace('_transient_', '', $option_name);
797
+						$error       = delete_transient($option_name);
798 798
 						break;
799 799
 
800 800
 					default:
801
-						$error = delete_option( $option_name );
801
+						$error = delete_option($option_name);
802 802
 				}
803 803
 
804
-				if ( $error ) {
805
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
806
-					self::$counter ++;
804
+				if ($error) {
805
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
806
+					self::$counter++;
807 807
 				} else {
808
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
808
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
809 809
 				}
810 810
 			}
811 811
 
@@ -826,13 +826,13 @@  discard block
 block discarded – undo
826 826
 	 *
827 827
 	 * @return   string
828 828
 	 */
829
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
829
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
830 830
 		// Add colon.
831
-		if ( $colon ) {
832
-			$heading = $heading . ': ';
831
+		if ($colon) {
832
+			$heading = $heading.': ';
833 833
 		}
834 834
 
835
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
835
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
836 836
 	}
837 837
 
838 838
 
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 	 *
848 848
 	 * @return    void
849 849
 	 */
850
-	private function color_main_heading( $heading, $color = 'g' ) {
851
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
850
+	private function color_main_heading($heading, $color = 'g') {
851
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
852 852
 	}
853 853
 
854 854
 	/**
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	 *
862 862
 	 * @return    void
863 863
 	 */
864
-	private function color_sub_heading( $subheading ) {
865
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
864
+	private function color_sub_heading($subheading) {
865
+		WP_CLI::log("\n--->".$subheading.'', '', false);
866 866
 	}
867 867
 
868 868
 
@@ -876,17 +876,17 @@  discard block
 block discarded – undo
876 876
 	 *
877 877
 	 * @return    void
878 878
 	 */
879
-	private function display_table( $data ) {
879
+	private function display_table($data) {
880 880
 		$table = new \cli\Table();
881 881
 
882 882
 		// Set table header.
883
-		$table->setHeaders( $data[0] );
883
+		$table->setHeaders($data[0]);
884 884
 
885 885
 		// Remove table header.
886
-		unset( $data[0] );
886
+		unset($data[0]);
887 887
 
888 888
 		// Set table data.
889
-		$table->setRows( $data );
889
+		$table->setRows($data);
890 890
 
891 891
 		// Display table.
892 892
 		$table->display();
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 	 * @return array
904 904
 	 */
905 905
 
906
-	private function get_donors_by_form_id( $form_id ) {
906
+	private function get_donors_by_form_id($form_id) {
907 907
 		$donors = array();
908 908
 
909 909
 		$donations = new Give_Payments_Query(
910 910
 			array(
911
-				'give_forms' => array( $form_id ),
912
-				'number'     => - 1,
913
-				'status'     => array( 'publish' ),
911
+				'give_forms' => array($form_id),
912
+				'number'     => -1,
913
+				'status'     => array('publish'),
914 914
 			)
915 915
 		);
916 916
 
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
 		$skip_donors = array();
919 919
 
920 920
 		/* @var Give_Payment|object $donation Payment object. */
921
-		foreach ( $donations as $donation ) {
921
+		foreach ($donations as $donation) {
922 922
 
923
-			if ( in_array( $donation->customer_id, $skip_donors, true ) ) {
923
+			if (in_array($donation->customer_id, $skip_donors, true)) {
924 924
 				continue;
925 925
 			}
926 926
 
927
-			if ( ! empty( $donors ) ) {
928
-				$donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) );
927
+			if ( ! empty($donors)) {
928
+				$donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id)));
929 929
 			} else {
930
-				$donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) );
930
+				$donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id));
931 931
 			}
932 932
 
933 933
 			$skip_donors[] = $donation->customer_id;
@@ -972,15 +972,15 @@  discard block
 block discarded – undo
972 972
 		);
973 973
 
974 974
 		// Generate a random forename.
975
-		$random_name = $names[ mt_rand( 0, sizeof( $names ) - 1 ) ];
975
+		$random_name = $names[mt_rand(0, sizeof($names) - 1)];
976 976
 
977 977
 		// Generate a random surname.
978
-		$random_surname = $surnames[ mt_rand( 0, sizeof( $surnames ) - 1 ) ];
978
+		$random_surname = $surnames[mt_rand(0, sizeof($surnames) - 1)];
979 979
 
980 980
 		// Generate name.
981 981
 		$name = "{$random_name} {$random_surname}";
982 982
 
983
-		if ( in_array( $name, $this->new_donor_names ) ) {
983
+		if (in_array($name, $this->new_donor_names)) {
984 984
 			$name = $this->get_random_name();
985 985
 		}
986 986
 
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
 	 *
1000 1000
 	 * @return string
1001 1001
 	 */
1002
-	private function get_random_email( $name ) {
1003
-		return implode( '.', explode( ' ', strtolower( $name ) ) ) . '@test.com';
1002
+	private function get_random_email($name) {
1003
+		return implode('.', explode(' ', strtolower($name))).'@test.com';
1004 1004
 	}
1005 1005
 
1006 1006
 	/**
@@ -1015,59 +1015,59 @@  discard block
 block discarded – undo
1015 1015
 	 * @when after_wp_load
1016 1016
 	 * @subcommand test-mode
1017 1017
 	 */
1018
-	public function test_mode( $args, $assoc ) {
1018
+	public function test_mode($args, $assoc) {
1019 1019
 
1020 1020
 		// Return if associative arguments are not specified.
1021
-		if ( empty( $assoc ) ) {
1022
-			WP_CLI::error( "--enable or --disable flag is missing." );
1021
+		if (empty($assoc)) {
1022
+			WP_CLI::error("--enable or --disable flag is missing.");
1023 1023
 			return;
1024 1024
 		}
1025 1025
 
1026
-		$enabled_gateways = give_get_option( 'gateways' );
1027
-		$default_gateway  = give_get_option( 'default_gateway' );
1026
+		$enabled_gateways = give_get_option('gateways');
1027
+		$default_gateway  = give_get_option('default_gateway');
1028 1028
 
1029 1029
 
1030 1030
 		// Enable Test Mode.
1031
-		if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'enable' ) ) {
1031
+		if (true === WP_CLI\Utils\get_flag_value($assoc, 'enable')) {
1032 1032
 
1033 1033
 			// Set `Test Mode` to `enabled`.
1034
-			give_update_option( 'test_mode', 'enabled' );
1034
+			give_update_option('test_mode', 'enabled');
1035 1035
 
1036 1036
 
1037 1037
 			// Enable `Test Donation` gateway.
1038 1038
 			$enabled_gateways['manual'] = "1";
1039
-			give_update_option( 'gateways', $enabled_gateways );
1039
+			give_update_option('gateways', $enabled_gateways);
1040 1040
 
1041 1041
 
1042 1042
 			// Set `Test Donation` as default gateway.
1043
-			add_option( 'give_test_mode_default_gateway', $default_gateway );
1044
-			give_update_option( 'default_gateway', 'manual' );
1043
+			add_option('give_test_mode_default_gateway', $default_gateway);
1044
+			give_update_option('default_gateway', 'manual');
1045 1045
 
1046 1046
 
1047 1047
 			// Show success message on completion.
1048
-			WP_CLI::success( 'Give Test mode enabled' );
1048
+			WP_CLI::success('Give Test mode enabled');
1049 1049
 		}
1050 1050
 
1051 1051
 		// Disable Test Mode.
1052
-		if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'disable' ) ) {
1052
+		if (true === WP_CLI\Utils\get_flag_value($assoc, 'disable')) {
1053 1053
 
1054 1054
 			// Set `Test Mode` to `disabled`.
1055
-			give_update_option( 'test_mode', 'disabled' );
1055
+			give_update_option('test_mode', 'disabled');
1056 1056
 
1057 1057
 
1058 1058
 			// Disable `Test Donation` gateway.
1059
-			unset( $enabled_gateways['manual'] );
1060
-			give_update_option( 'gateways', $enabled_gateways );
1059
+			unset($enabled_gateways['manual']);
1060
+			give_update_option('gateways', $enabled_gateways);
1061 1061
 
1062 1062
 
1063 1063
 			// Backup `Default Gateway` setting for restore on test mode disable.
1064
-			$default_gateway_backup = get_option( 'give_test_mode_default_gateway' );
1065
-			give_update_option( 'default_gateway', $default_gateway_backup );
1066
-			delete_option( 'give_test_mode_default_gateway' );
1064
+			$default_gateway_backup = get_option('give_test_mode_default_gateway');
1065
+			give_update_option('default_gateway', $default_gateway_backup);
1066
+			delete_option('give_test_mode_default_gateway');
1067 1067
 
1068 1068
 
1069 1069
 			// Show success message on completion.
1070
-			WP_CLI::success( 'Give Test mode disabled' );
1070
+			WP_CLI::success('Give Test mode disabled');
1071 1071
 		}
1072 1072
 	}
1073 1073
 
@@ -1082,8 +1082,8 @@  discard block
 block discarded – undo
1082 1082
 	 *
1083 1083
 	 * @return boolean
1084 1084
 	 */
1085
-	private function is_git_repo( $repo_path ) {
1086
-		if ( is_dir( "{$repo_path}.git" ) ) {
1085
+	private function is_git_repo($repo_path) {
1086
+		if (is_dir("{$repo_path}.git")) {
1087 1087
 			return true;
1088 1088
 		}
1089 1089
 
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
 	 *
1101 1101
 	 * @return string
1102 1102
 	 */
1103
-	private function get_git_current_branch( $repo_path ) {
1103
+	private function get_git_current_branch($repo_path) {
1104 1104
 
1105
-		exec( "cd $repo_path && git branch | grep '\*'", $branch_names );
1105
+		exec("cd $repo_path && git branch | grep '\*'", $branch_names);
1106 1106
 
1107
-		$branch_name = trim( strtolower( str_replace( '* ', '', $branch_names[0] ) ) );
1107
+		$branch_name = trim(strtolower(str_replace('* ', '', $branch_names[0])));
1108 1108
 
1109 1109
 		return $branch_name;
1110 1110
 	}
@@ -1134,59 +1134,59 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @subcommand addon-update
1136 1136
 	 */
1137
-	public function addon_update( $pos, $assoc ) {
1137
+	public function addon_update($pos, $assoc) {
1138 1138
 
1139 1139
 		/**
1140 1140
 		 * Only 1 associative argument should be passed.
1141 1141
 		 * It can be either `--name` or `--exclude`
1142 1142
 		 */
1143
-		if ( count( $assoc ) > 1 ) {
1144
-			WP_CLI::error( __( 'Too many associative arguments.', 'give' ) );
1143
+		if (count($assoc) > 1) {
1144
+			WP_CLI::error(__('Too many associative arguments.', 'give'));
1145 1145
 		}
1146 1146
 
1147 1147
 		/**
1148 1148
 		 * Update a single Give addon.
1149 1149
 		 */
1150
-		if ( false !== ( $addon_name = WP_CLI\Utils\get_flag_value( $assoc, 'name', false ) ) ) {
1151
-			$give_addon_path = glob( WP_CONTENT_DIR . "/plugins/$addon_name/" , GLOB_ONLYDIR );
1150
+		if (false !== ($addon_name = WP_CLI\Utils\get_flag_value($assoc, 'name', false))) {
1151
+			$give_addon_path = glob(WP_CONTENT_DIR."/plugins/$addon_name/", GLOB_ONLYDIR);
1152 1152
 
1153 1153
 			/**
1154 1154
 			 * Display error if the plugin (addon) name entered does
1155 1155
 			 * not exist.
1156 1156
 			 */
1157
-			if ( empty( $give_addon_path ) ) {
1158
-				WP_CLI::error( sprintf( __( "The Give addon '%s' does not exist.", 'give' ), $addon_name ) );
1157
+			if (empty($give_addon_path)) {
1158
+				WP_CLI::error(sprintf(__("The Give addon '%s' does not exist.", 'give'), $addon_name));
1159 1159
 			}
1160 1160
 
1161 1161
 			/**
1162 1162
 			 * If the directory does not contain a Git
1163 1163
 			 * repository, then display error and halt.
1164 1164
 			 */
1165
-			if ( ! $this->is_git_repo( $give_addon_path[0] ) ) {
1166
-				WP_CLI::error( __( 'This is not a Git repo', 'give' ) );
1165
+			if ( ! $this->is_git_repo($give_addon_path[0])) {
1166
+				WP_CLI::error(__('This is not a Git repo', 'give'));
1167 1167
 			}
1168 1168
 
1169 1169
 			/**
1170 1170
 			 * Get the current branch name. This branch will be updated next.
1171 1171
 			 */
1172
-			$branch_name = $this->get_git_current_branch( $give_addon_path[0] );
1172
+			$branch_name = $this->get_git_current_branch($give_addon_path[0]);
1173 1173
 
1174 1174
 			/**
1175 1175
 			 * Take the latest pull of the current branch, i.e.;
1176 1176
 			 * sync it with origin.
1177 1177
 			 */
1178
-			passthru( "cd $give_addon_path[0] && git pull origin $branch_name", $return_var );
1178
+			passthru("cd $give_addon_path[0] && git pull origin $branch_name", $return_var);
1179 1179
 
1180 1180
 			/**
1181 1181
 			 * Show success/error messages depending on whether the
1182 1182
 			 * current branch of the addon was updated or not.
1183 1183
 			 */
1184
-			if ( 0 === $return_var ) {
1185
-				WP_CLI::success( sprintf( __( "The Give addon '%s' is up-to-date with origin." ), $addon_name ) );
1184
+			if (0 === $return_var) {
1185
+				WP_CLI::success(sprintf(__("The Give addon '%s' is up-to-date with origin."), $addon_name));
1186 1186
 
1187 1187
 				return;
1188
-			} elseif ( 1 === $return_var ) {
1189
-				WP_CLI::error( sprintf( __( "The Give addon '%s' was not updated." ), $addon_name ) );
1188
+			} elseif (1 === $return_var) {
1189
+				WP_CLI::error(sprintf(__("The Give addon '%s' was not updated."), $addon_name));
1190 1190
 			}
1191 1191
 		}
1192 1192
 
@@ -1194,34 +1194,34 @@  discard block
 block discarded – undo
1194 1194
 		 * Convert the comma-separated string of Give-addons in the
1195 1195
 		 * excluded list into array.
1196 1196
 		 */
1197
-		$addon_names = WP_CLI\Utils\get_flag_value( $assoc, 'exclude', array() );
1198
-		if ( ! empty( $addon_names ) ) {
1199
-			$addon_names = array_map( 'trim', explode( ',', $addon_names ) );
1197
+		$addon_names = WP_CLI\Utils\get_flag_value($assoc, 'exclude', array());
1198
+		if ( ! empty($addon_names)) {
1199
+			$addon_names = array_map('trim', explode(',', $addon_names));
1200 1200
 		}
1201 1201
 
1202 1202
 		/**
1203 1203
 		 * Get directory paths of all the addons including
1204 1204
 		 * Give Core.
1205 1205
 		 */
1206
-		$give_addon_directories = glob( WP_CONTENT_DIR . '/plugins/[gG]ive*/' , GLOB_ONLYDIR );
1206
+		$give_addon_directories = glob(WP_CONTENT_DIR.'/plugins/[gG]ive*/', GLOB_ONLYDIR);
1207 1207
 
1208
-		foreach ( $give_addon_directories as $repo ) {
1208
+		foreach ($give_addon_directories as $repo) {
1209 1209
 
1210 1210
 			/**
1211 1211
 			 * Extract the plugin/addon folder name
1212 1212
 			 * from the absolute path.
1213 1213
 			 */
1214
-			$plugin_name = basename( $repo );
1214
+			$plugin_name = basename($repo);
1215 1215
 
1216 1216
 			/**
1217 1217
 			 * If the Give addon directory does not contain
1218 1218
 			 * a Git repo, then continue.
1219 1219
 			 */
1220
-			if ( ! $this->is_git_repo( $repo ) ) {
1220
+			if ( ! $this->is_git_repo($repo)) {
1221 1221
 				WP_CLI::line(
1222 1222
 					sprintf(
1223
-						__( "%s: '%s' does not contain git repo.", 'give' ),
1224
-						WP_CLI::colorize( '%RError%n' ),
1223
+						__("%s: '%s' does not contain git repo.", 'give'),
1224
+						WP_CLI::colorize('%RError%n'),
1225 1225
 						$plugin_name
1226 1226
 					)
1227 1227
 				);
@@ -1232,34 +1232,34 @@  discard block
 block discarded – undo
1232 1232
 			/**
1233 1233
 			 * Continue if the Give addon name is in the exlusion list.
1234 1234
 			 */
1235
-			if ( in_array( $plugin_name, $addon_names, true ) ) {
1235
+			if (in_array($plugin_name, $addon_names, true)) {
1236 1236
 				continue;
1237 1237
 			}
1238 1238
 
1239 1239
 			/* Get the current branch name */
1240
-			$branch_name = $this->get_git_current_branch( $repo );
1240
+			$branch_name = $this->get_git_current_branch($repo);
1241 1241
 
1242 1242
 			/**
1243 1243
 			 * Show a colorized (CYAN) title for each addon/plugin
1244 1244
 			 * before a pull.
1245 1245
 			 */
1246
-			WP_CLI::line( WP_CLI::colorize( "> %CUpdating $plugin_name | $branch_name%n" ) );
1246
+			WP_CLI::line(WP_CLI::colorize("> %CUpdating $plugin_name | $branch_name%n"));
1247 1247
 
1248 1248
 			/**
1249 1249
 			 * Git pull from the current branch using
1250 1250
 			 * remote `origin`.
1251 1251
 			 */
1252
-			if ( ! empty( $branch_name ) ) {
1253
-				passthru( "cd $repo && git pull origin $branch_name", $return_var );
1252
+			if ( ! empty($branch_name)) {
1253
+				passthru("cd $repo && git pull origin $branch_name", $return_var);
1254 1254
 			}
1255 1255
 
1256 1256
 			$items[] = array(
1257 1257
 				'Give Addon' => $plugin_name,
1258 1258
 				'Branch'     => $branch_name,
1259 1259
 				'Remote'     => 'origin',
1260
-				'Status'     => ( 0 === $return_var )
1261
-					? __( 'Success', 'give' )
1262
-					: __( 'Failed', 'give' ),
1260
+				'Status'     => (0 === $return_var)
1261
+					? __('Success', 'give')
1262
+					: __('Failed', 'give'),
1263 1263
 			);
1264 1264
 
1265 1265
 			/**
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-grid.php 1 patch
Spacing   +33 added lines, -33 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 Grid', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Grid', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Grid', 'give');
28 28
 
29
-		parent::__construct( 'give_form_grid' );
29
+		parent::__construct('give_form_grid');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,73 +39,73 @@  discard block
 block discarded – undo
39 39
 		return array(
40 40
 			array(
41 41
 				'type' => 'container',
42
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
42
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
43 43
 			),
44 44
 			array(
45 45
 				'type'        => 'textbox',
46 46
 				'name'        => 'ids',
47
-				'label'       => esc_attr__( 'Form IDs:', 'give' ),
48
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ),
49
-				'placeholder' => esc_html__( 'All Forms', 'give' )
47
+				'label'       => esc_attr__('Form IDs:', 'give'),
48
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'),
49
+				'placeholder' => esc_html__('All Forms', 'give')
50 50
 			),
51 51
 			array(
52 52
 				'type'        => 'listbox',
53 53
 				'name'        => 'columns',
54
-				'label'       => esc_attr__( 'Columns:', 'give' ),
55
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
54
+				'label'       => esc_attr__('Columns:', 'give'),
55
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
56 56
 				'options'     => array(
57
-					'1' => esc_html__( '1', 'give' ),
58
-					'2' => esc_html__( '2', 'give' ),
59
-					'3' => esc_html__( '3', 'give' ),
60
-					'4' => esc_html__( '4', 'give' ),
57
+					'1' => esc_html__('1', 'give'),
58
+					'2' => esc_html__('2', 'give'),
59
+					'3' => esc_html__('3', 'give'),
60
+					'4' => esc_html__('4', 'give'),
61 61
 				),
62
-				'placeholder' => esc_html__( 'Best Fit', 'give' )
62
+				'placeholder' => esc_html__('Best Fit', 'give')
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_goal',
67
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
68
-				'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ),
67
+				'label'   => esc_attr__('Show Goal:', 'give'),
68
+				'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_excerpt',
77
-				'label'   => esc_attr__( 'Show Excerpt:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ),
77
+				'label'   => esc_attr__('Show Excerpt:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the excerpt?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'show_featured_image',
87
-				'label'   => esc_attr__( 'Show Featured Image:', 'give' ),
88
-				'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ),
87
+				'label'   => esc_attr__('Show Featured Image:', 'give'),
88
+				'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'),
89 89
 				'options' => array(
90
-					'true'  => esc_html__( 'Show', 'give' ),
91
-					'false' => esc_html__( 'Hide', 'give' ),
90
+					'true'  => esc_html__('Show', 'give'),
91
+					'false' => esc_html__('Hide', 'give'),
92 92
 				),
93 93
 			),
94 94
 			array(
95 95
 				'type'    => 'listbox',
96 96
 				'name'    => 'display_style',
97
-				'label'   => esc_attr__( 'Display Style:', 'give' ),
98
-				'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ),
97
+				'label'   => esc_attr__('Display Style:', 'give'),
98
+				'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'),
99 99
 				'options' => array(
100
-					'redirect'     => esc_html__( 'Redirect', 'give' ),
101
-					'modal_reveal' => esc_html__( 'Modal', 'give' ),
100
+					'redirect'     => esc_html__('Redirect', 'give'),
101
+					'modal_reveal' => esc_html__('Modal', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'textbox',
106 106
 				'name'    => 'forms_per_page',
107
-				'label'   => esc_attr__( 'Forms Per Page:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Sets the number of forms to display per page.', 'give' ),
107
+				'label'   => esc_attr__('Forms Per Page:', 'give'),
108
+				'tooltip' => esc_attr__('Sets the number of forms to display per page.', 'give'),
109 109
 				'value'   => 12,
110 110
 			),
111 111
 		);
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
34 34
 			parent::__construct();
35 35
 
36 36
 			// Do not use main form for this tab.
37
-			if ( give_get_current_setting_tab() === $this->id ) {
38
-				add_action( 'give_admin_field_enabled_gateways', array( $this, 'render_enabled_gateways' ), 10, 2 );
37
+			if (give_get_current_setting_tab() === $this->id) {
38
+				add_action('give_admin_field_enabled_gateways', array($this, 'render_enabled_gateways'), 10, 2);
39 39
 			}
40 40
 		}
41 41
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			$settings        = array();
50 50
 			$current_section = give_get_current_setting_section();
51 51
 
52
-			switch ( $current_section ) {
52
+			switch ($current_section) {
53 53
 				case 'paypal-standard':
54 54
 					$settings = array(
55 55
 						// Section 2: PayPal Standard.
@@ -58,55 +58,55 @@  discard block
 block discarded – undo
58 58
 							'id'   => 'give_title_gateway_settings_2',
59 59
 						),
60 60
 						array(
61
-							'name' => __( 'PayPal Email', 'give' ),
62
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
61
+							'name' => __('PayPal Email', 'give'),
62
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
63 63
 							'id'   => 'paypal_email',
64 64
 							'type' => 'email',
65 65
 						),
66 66
 						array(
67
-							'name' => __( 'PayPal Page Style', 'give' ),
68
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
67
+							'name' => __('PayPal Page Style', 'give'),
68
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
69 69
 							'id'   => 'paypal_page_style',
70 70
 							'type' => 'text',
71 71
 						),
72 72
 						array(
73
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
74
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
73
+							'name'    => __('PayPal Transaction Type', 'give'),
74
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
75 75
 							'id'      => 'paypal_button_type',
76 76
 							'type'    => 'radio_inline',
77 77
 							'options' => array(
78
-								'donation' => __( 'Donation', 'give' ),
79
-								'standard' => __( 'Standard Transaction', 'give' )
78
+								'donation' => __('Donation', 'give'),
79
+								'standard' => __('Standard Transaction', 'give')
80 80
 							),
81 81
 							'default' => 'donation',
82 82
 						),
83 83
 						array(
84
-							'name'    => __( 'Billing Details', 'give' ),
85
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
84
+							'name'    => __('Billing Details', 'give'),
85
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
86 86
 							'id'      => 'paypal_standard_billing_details',
87 87
 							'type'    => 'radio_inline',
88 88
 							'default' => 'disabled',
89 89
 							'options' => array(
90
-								'enabled'  => __( 'Enabled', 'give' ),
91
-								'disabled' => __( 'Disabled', 'give' ),
90
+								'enabled'  => __('Enabled', 'give'),
91
+								'disabled' => __('Disabled', 'give'),
92 92
 							)
93 93
 						),
94 94
 						array(
95
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
96
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
95
+							'name'    => __('PayPal IPN Verification', 'give'),
96
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
97 97
 							'id'      => 'paypal_verification',
98 98
 							'type'    => 'radio_inline',
99 99
 							'default' => 'enabled',
100 100
 							'options' => array(
101
-								'enabled'  => __( 'Enabled', 'give' ),
102
-								'disabled' => __( 'Disabled', 'give' ),
101
+								'enabled'  => __('Enabled', 'give'),
102
+								'disabled' => __('Disabled', 'give'),
103 103
 							)
104 104
 						),
105 105
 						array(
106
-							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
106
+							'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
107 107
 							'id'    => 'paypal_standard_gateway_settings_docs_link',
108
-							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
109
-							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
108
+							'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
109
+							'title' => __('PayPal Standard Gateway Settings', 'give'),
110 110
 							'type'  => 'give_docs_link',
111 111
 						),
112 112
 						array(
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 							'id'   => 'give_title_gateway_settings_3',
125 125
 						),
126 126
 						array(
127
-							'name'    => __( 'Collect Billing Details', 'give' ),
128
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
127
+							'name'    => __('Collect Billing Details', 'give'),
128
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
129 129
 							'id'      => 'give_offline_donation_enable_billing_fields',
130 130
 							'type'    => 'radio_inline',
131 131
 							'default' => 'disabled',
132 132
 							'options' => array(
133
-								'enabled'  => __( 'Enabled', 'give' ),
134
-								'disabled' => __( 'Disabled', 'give' )
133
+								'enabled'  => __('Enabled', 'give'),
134
+								'disabled' => __('Disabled', 'give')
135 135
 							)
136 136
 						),
137 137
 						array(
138
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
139
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
138
+							'name'    => __('Offline Donation Instructions', 'give'),
139
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
140 140
 							'id'      => 'global_offline_donation_content',
141 141
 							'default' => give_get_default_offline_donation_content(),
142 142
 							'type'    => 'wysiwyg',
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 							)
146 146
 						),
147 147
 						array(
148
-							'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
148
+							'name'  => esc_html__('Offline Donations Settings Docs Link', 'give'),
149 149
 							'id'    => 'offline_gateway_settings_docs_link',
150
-							'url'   => esc_url( 'http://docs.givewp.com/offlinegateway' ),
151
-							'title' => __( 'Offline Gateway Settings', 'give' ),
150
+							'url'   => esc_url('http://docs.givewp.com/offlinegateway'),
151
+							'title' => __('Offline Gateway Settings', 'give'),
152 152
 							'type'  => 'give_docs_link',
153 153
 						),
154 154
 						array(
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 							'type' => 'title'
167 167
 						),
168 168
 						array(
169
-							'name'    => __( 'Test Mode', 'give' ),
170
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
169
+							'name'    => __('Test Mode', 'give'),
170
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
171 171
 							'id'      => 'test_mode',
172 172
 							'type'    => 'radio_inline',
173 173
 							'default' => 'disabled',
174 174
 							'options' => array(
175
-								'enabled'  => __( 'Enabled', 'give' ),
176
-								'disabled' => __( 'Disabled', 'give' ),
175
+								'enabled'  => __('Enabled', 'give'),
176
+								'disabled' => __('Disabled', 'give'),
177 177
 							)
178 178
 						),
179 179
 						array(
180
-							'name' => __( 'Enabled Gateways', 'give' ),
181
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
180
+							'name' => __('Enabled Gateways', 'give'),
181
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
182 182
 							'id'   => 'gateways',
183 183
 							'type' => 'enabled_gateways'
184 184
 						),
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 						 * This setting will not render on admin setting screen but help internal code to recognize "gateways_label"  setting and add them to give setting when save.
191 191
 						 */
192 192
 						array(
193
-							'name' => __( 'Gateways Label', 'give' ),
193
+							'name' => __('Gateways Label', 'give'),
194 194
 							'desc' => '',
195 195
 							'id'   => 'gateways_label',
196 196
 							'type' => 'gateways_label_hidden'
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 						 * This setting will not render on admin setting screen but help internal code to recognize "default_gateway"  setting and add them to give setting when save.
204 204
 						 */
205 205
 						array(
206
-							'name' => __( 'Default Gateway', 'give' ),
207
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
206
+							'name' => __('Default Gateway', 'give'),
207
+							'desc' => __('The gateway that will be selected by default.', 'give'),
208 208
 							'id'   => 'default_gateway',
209 209
 							'type' => 'default_gateway_hidden'
210 210
 						),
211 211
 
212 212
 						array(
213
-							'name'  => __( 'Gateways Docs Link', 'give' ),
213
+							'name'  => __('Gateways Docs Link', 'give'),
214 214
 							'id'    => 'gateway_settings_docs_link',
215
-							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
216
-							'title' => __( 'Gateway Settings', 'give' ),
215
+							'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
216
+							'title' => __('Gateway Settings', 'give'),
217 217
 							'type'  => 'give_docs_link',
218 218
 						),
219 219
 						array(
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			 * Filter the payment gateways settings.
229 229
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
230 230
 			 */
231
-			$settings = apply_filters( 'give_settings_gateways', $settings );
231
+			$settings = apply_filters('give_settings_gateways', $settings);
232 232
 
233 233
 			/**
234 234
 			 * Filter the settings.
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			 *
238 238
 			 * @param  array $settings
239 239
 			 */
240
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
240
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
241 241
 
242 242
 			// Output.
243 243
 			return $settings;
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 		 */
252 252
 		public function get_sections() {
253 253
 			$sections = array(
254
-				'gateways-settings' => __( 'Gateways', 'give' ),
255
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
256
-				'offline-donations' => __( 'Offline Donations', 'give' )
254
+				'gateways-settings' => __('Gateways', 'give'),
255
+				'paypal-standard'   => __('PayPal Standard', 'give'),
256
+				'offline-donations' => __('Offline Donations', 'give')
257 257
 			);
258 258
 
259
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
259
+			return apply_filters('give_get_sections_'.$this->id, $sections);
260 260
 		}
261 261
 
262 262
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 		 * @param $field
270 270
 		 * @param $settings
271 271
 		 */
272
-		public function render_enabled_gateways( $field, $settings ) {
272
+		public function render_enabled_gateways($field, $settings) {
273 273
 			$id              = $field['id'];
274
-			$gateways        = give_get_ordered_payment_gateways( give_get_payment_gateways() );
275
-			$gateways_label  = give_get_option( 'gateways_label', array() );
276
-			$default_gateway = give_get_option( 'default_gateway', current( array_keys( $gateways ) ) );
274
+			$gateways        = give_get_ordered_payment_gateways(give_get_payment_gateways());
275
+			$gateways_label  = give_get_option('gateways_label', array());
276
+			$default_gateway = give_get_option('default_gateway', current(array_keys($gateways)));
277 277
 
278 278
 			ob_start();
279 279
 
@@ -288,51 +288,51 @@  discard block
 block discarded – undo
288 288
 						<span>%3$s</span>
289 289
 						<span>%4$s</span>
290 290
 						',
291
-				__( 'Gateway', 'give' ),
292
-				__( 'Label', 'give' ),
293
-				__( 'Default', 'give' ),
294
-				__( 'Enabled', 'give' )
291
+				__('Gateway', 'give'),
292
+				__('Label', 'give'),
293
+				__('Default', 'give'),
294
+				__('Enabled', 'give')
295 295
 			);
296 296
 			echo '</div>';
297 297
 
298 298
 			echo '<ul class="give-checklist-fields give-payment-gatways-list">';
299
-			foreach ( $gateways as $key => $option ) :
299
+			foreach ($gateways as $key => $option) :
300 300
 				$enabled = null;
301
-				if ( is_array( $settings ) && array_key_exists( $key, $settings ) ) {
301
+				if (is_array($settings) && array_key_exists($key, $settings)) {
302 302
 					$enabled = '1';
303 303
 				}
304 304
 
305 305
 				echo '<li>';
306
-				printf( '<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>' );
307
-				printf( '<span class="admin-label">%s</span>', esc_html( $option['admin_label'] ) );
306
+				printf('<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>');
307
+				printf('<span class="admin-label">%s</span>', esc_html($option['admin_label']));
308 308
 
309 309
 				$label = '';
310
-				if ( ! empty( $gateways_label[ $key ] ) ) {
311
-					$label = $gateways_label[ $key ];
310
+				if ( ! empty($gateways_label[$key])) {
311
+					$label = $gateways_label[$key];
312 312
 				}
313 313
 
314 314
 				printf(
315 315
 					'<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>',
316 316
 					'gateways_label',
317
-					esc_attr( $key ),
318
-					esc_html( $label ),
319
-					esc_html( $option['checkout_label'] )
317
+					esc_attr($key),
318
+					esc_html($label),
319
+					esc_html($option['checkout_label'])
320 320
 				);
321 321
 
322 322
 				printf(
323 323
 					'<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>',
324 324
 					'default_gateway',
325 325
 					$key,
326
-					checked( $key, $default_gateway, false ),
327
-					disabled( NULL, $enabled, false )
326
+					checked($key, $default_gateway, false),
327
+					disabled(NULL, $enabled, false)
328 328
 				);
329 329
 
330 330
 				printf(
331 331
 					'<input class="gateways-checkbox" name="%1$s[%2$s]" id="%1$s[%2$s]" type="checkbox" value="1" %3$s data-payment-gateway="%4$s"/>',
332
-					esc_attr( $id ),
333
-					esc_attr( $key ),
334
-					checked( '1', $enabled, false ),
335
-					esc_html( $option['admin_label'] )
332
+					esc_attr($id),
333
+					esc_attr($key),
334
+					checked('1', $enabled, false),
335
+					esc_html($option['admin_label'])
336 336
 				);
337 337
 				echo '</li>';
338 338
 			endforeach;
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
 		<h2 class="nav-tab-wrapper">
121 121
 			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
 			</a>
125 125
 			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
 			</a>
129 129
 			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
 			</a>
133 133
 			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-			   href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+			   href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
 			</a>
137 137
 		</h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
 		<div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 			<p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: http://docs.givewp.com/docs */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'http://docs.givewp.com/docs' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('http://docs.givewp.com/docs')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			<div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 			<div class="feature-section clearfix introduction">
176 176
 
177 177
 				<div class="video feature-section-item">
178
-					<img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
-						 alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+					<img src="<?php echo GIVE_PLUGIN_URL.'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
+						 alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
 				</div>
181 181
 
182 182
 				<div class="content feature-section-item last-feature">
183 183
 
184
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
 						<span class="dashicons dashicons-external"></span>
190 190
 					</a>
191 191
 
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 
199 199
 				<div class="content feature-section-item">
200 200
 
201
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
 					<h4>Find Out More:</h4>
206 206
 					<ul class="ul-disc">
207 207
 						<li><a href="https://givewp.com/"
208
-							   target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
+							   target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
209 209
 						<li><a href="https://givewp.com/features/"
210
-							   target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
210
+							   target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
211 211
 						<li><a href="https://givewp.com/documentation/"
212
-							   target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
212
+							   target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
213 213
 					</ul>
214 214
 
215 215
 				</div>
216 216
 
217 217
 				<div class="content  feature-section-item last-feature">
218
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>"
219
-						 alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
218
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/dist/images/admin/give-form-mockup.png' ?>"
219
+						 alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
220 220
 				</div>
221 221
 
222 222
 			</div>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return void
236 236
 	 */
237 237
 	public function changelog_screen() {
238
-		list( $display_version ) = explode( '-', GIVE_VERSION );
238
+		list($display_version) = explode('-', GIVE_VERSION);
239 239
 		?>
240 240
 		<div class="wrap about-wrap">
241 241
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 			<p class="about-text"><?php
244 244
 				printf(
245 245
 				/* translators: %s: Give version */
246
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
246
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
247 247
 					$display_version
248 248
 				);
249 249
 				?></p>
250 250
 			<div class="give-badge"><?php
251 251
 				printf(
252 252
 				/* translators: %s: Give version */
253
-					esc_html__( 'Version %s', 'give' ),
253
+					esc_html__('Version %s', 'give'),
254 254
 					$display_version
255 255
 				);
256 256
 				?></div>
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			<?php $this->tabs(); ?>
259 259
 
260 260
 			<div class="changelog">
261
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
261
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
262 262
 
263 263
 				<div class="feature-section">
264 264
 					<?php echo $this->parse_readme(); ?>
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 			</div>
267 267
 
268 268
 			<div class="return-to-dashboard">
269
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
269
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
270 270
 					'post_type' => 'give_forms',
271 271
 					'page'      => 'give-settings'
272
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
272
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
273 273
 			</div>
274 274
 		</div>
275 275
 		<?php
@@ -283,36 +283,36 @@  discard block
 block discarded – undo
283 283
 	 * @return void
284 284
 	 */
285 285
 	public function getting_started_screen() {
286
-		list( $display_version ) = explode( '-', GIVE_VERSION );
286
+		list($display_version) = explode('-', GIVE_VERSION);
287 287
 		?>
288 288
 		<div class="wrap about-wrap get-started">
289 289
 
290 290
 			<?php $this->get_welcome_header() ?>
291 291
 
292
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
292
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
293 293
 
294 294
 			<?php give_get_newsletter(); ?>
295 295
 
296 296
 			<div class="give-badge"><?php
297 297
 				printf(
298 298
 				/* translators: %s: Give version */
299
-					esc_html__( 'Version %s', 'give' ),
299
+					esc_html__('Version %s', 'give'),
300 300
 					$display_version
301 301
 				);
302 302
 				?></div>
303 303
 
304 304
 			<?php $this->tabs(); ?>
305 305
 
306
-			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
306
+			<p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
307 307
 
308 308
 			<div class="feature-section clearfix">
309 309
 
310 310
 				<div class="content feature-section-item">
311
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
311
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
312 312
 
313
-					<p><?php esc_html_e( 'Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
313
+					<p><?php esc_html_e('Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
314 314
 
315
-					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p>
315
+					<p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give'); ?></p>
316 316
 				</div>
317 317
 
318 318
 				<div class="content feature-section-item last-feature">
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 				</div>
330 330
 
331 331
 				<div class="content feature-section-item last-feature">
332
-					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
332
+					<h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
333 333
 
334
-					<p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
334
+					<p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
335 335
 				</div>
336 336
 
337 337
 			</div>
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 			<div class="feature-section clearfix">
341 341
 
342 342
 				<div class="content feature-section-item add-content">
343
-					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
343
+					<h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
344 344
 
345
-					<p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
345
+					<p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
346 346
 
347
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
347
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
348 348
 				</div>
349 349
 
350 350
 				<div class="content feature-section-item last-feature">
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 				</div>
362 362
 
363 363
 				<div class="content feature-section-item last-feature">
364
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
364
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
365 365
 
366
-					<p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
366
+					<p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
367 367
 				</div>
368 368
 
369 369
 
@@ -383,20 +383,20 @@  discard block
 block discarded – undo
383 383
 	 * @return void
384 384
 	 */
385 385
 	public function credits_screen() {
386
-		list( $display_version ) = explode( '-', GIVE_VERSION );
386
+		list($display_version) = explode('-', GIVE_VERSION);
387 387
 		?>
388 388
 		<div class="wrap about-wrap">
389 389
 
390 390
 			<?php $this->get_welcome_header() ?>
391 391
 
392
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
392
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
393 393
 
394 394
 			<?php give_get_newsletter(); ?>
395 395
 
396 396
 			<div class="give-badge"><?php
397 397
 				printf(
398 398
 				/* translators: %s: Give version */
399
-					esc_html__( 'Version %s', 'give' ),
399
+					esc_html__('Version %s', 'give'),
400 400
 					$display_version
401 401
 				);
402 402
 				?></div>
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 			<p class="about-description"><?php
407 407
 				printf(
408 408
 				/* translators: %s: https://github.com/WordImpress/give */
409
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
410
-					esc_url( 'https://github.com/WordImpress/give' )
409
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
410
+					esc_url('https://github.com/WordImpress/give')
411 411
 				);
412 412
 				?></p>
413 413
 
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 	 * @return string $readme HTML formatted readme file
425 425
 	 */
426 426
 	public function parse_readme() {
427
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
427
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
428 428
 
429
-		if ( ! $file ) {
430
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
429
+		if ( ! $file) {
430
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
431 431
 		} else {
432
-			$readme = file_get_contents( $file );
433
-			$readme = nl2br( esc_html( $readme ) );
434
-			$readme = explode( '== Changelog ==', $readme );
435
-			$readme = end( $readme );
436
-
437
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
438
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
439
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
440
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
441
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
432
+			$readme = file_get_contents($file);
433
+			$readme = nl2br(esc_html($readme));
434
+			$readme = explode('== Changelog ==', $readme);
435
+			$readme = end($readme);
436
+
437
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
438
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
439
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
440
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
441
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
442 442
 		}
443 443
 
444 444
 		return $readme;
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
 	public function contributors() {
456 456
 		$contributors = $this->get_contributors();
457 457
 
458
-		if ( empty( $contributors ) ) {
458
+		if (empty($contributors)) {
459 459
 			return '';
460 460
 		}
461 461
 
462 462
 		$contributor_list = '<ul class="wp-people-group">';
463 463
 
464
-		foreach ( $contributors as $contributor ) {
464
+		foreach ($contributors as $contributor) {
465 465
 			$contributor_list .= '<li class="wp-person">';
466 466
 			$contributor_list .= sprintf(
467 467
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
468
-				esc_url( 'https://github.com/' . $contributor->login ),
469
-				esc_url( $contributor->avatar_url ),
470
-				esc_attr( $contributor->login )
468
+				esc_url('https://github.com/'.$contributor->login),
469
+				esc_url($contributor->avatar_url),
470
+				esc_attr($contributor->login)
471 471
 			);
472 472
 			$contributor_list .= sprintf(
473 473
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
474
-				esc_url( 'https://github.com/' . $contributor->login ),
475
-				esc_html( $contributor->login )
474
+				esc_url('https://github.com/'.$contributor->login),
475
+				esc_html($contributor->login)
476 476
 			);
477 477
 			$contributor_list .= '</li>';
478 478
 		}
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 	 * @return array $contributors List of contributors
491 491
 	 */
492 492
 	public function get_contributors() {
493
-		$contributors = Give_Cache::get( 'give_contributors', true );
493
+		$contributors = Give_Cache::get('give_contributors', true);
494 494
 
495
-		if ( false !== $contributors ) {
495
+		if (false !== $contributors) {
496 496
 			return $contributors;
497 497
 		}
498 498
 
499
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
499
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
500 500
 
501
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
501
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
502 502
 			return array();
503 503
 		}
504 504
 
505
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
505
+		$contributors = json_decode(wp_remote_retrieve_body($response));
506 506
 
507
-		if ( ! is_array( $contributors ) ) {
507
+		if ( ! is_array($contributors)) {
508 508
 			return array();
509 509
 		}
510 510
 
511
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
511
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
512 512
 
513 513
 		return $contributors;
514 514
 	}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function get_welcome_header() {
522 522
 		// Badge for welcome page
523
-		$badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png';
523
+		$badge_url = GIVE_PLUGIN_URL.'assets/dist/images/give-badge.png';
524 524
 		?>
525 525
 		<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
526 526
 		<?php $this->social_media_elements(); ?>
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 			<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
614 614
 				printf(
615 615
 				/* translators: %s: Give twitter user @givewp */
616
-					esc_html_e( 'Follow %s', 'give' ),
616
+					esc_html_e('Follow %s', 'give'),
617 617
 					'@givewp'
618 618
 				);
619 619
 				?></a>
@@ -647,27 +647,27 @@  discard block
 block discarded – undo
647 647
 	public function welcome() {
648 648
 
649 649
 		// Bail if no activation redirect
650
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) {
650
+		if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) {
651 651
 			return;
652 652
 		}
653 653
 
654 654
 		// Delete the redirect transient
655
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
655
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
656 656
 
657 657
 		// Bail if activating from network, or bulk
658
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
658
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
659 659
 			return;
660 660
 		}
661 661
 
662
-		$upgrade = get_option( 'give_version_upgraded_from' );
662
+		$upgrade = get_option('give_version_upgraded_from');
663 663
 
664
-		if ( ! $upgrade ) { // First time install
665
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
664
+		if ( ! $upgrade) { // First time install
665
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
666 666
 			exit;
667
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
667
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
668 668
 
669 669
 		} else { // Welcome is NOT disabled in settings
670
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
670
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
671 671
 			exit;
672 672
 		}
673 673
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donor-register-email.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if access directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_New_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_New_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_New_Donor_Register_Email
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
 		 * @since   2.0
32 32
 		 */
33 33
 		public function init() {
34
-			$this->load( array(
34
+			$this->load(array(
35 35
 				'id'                    => 'new-donor-register',
36
-				'label'                 => __( 'New User Registration', 'give' ),
37
-				'description'           => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ),
36
+				'label'                 => __('New User Registration', 'give'),
37
+				'description'           => __('Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give'),
38 38
 				'has_recipient_field'   => true,
39 39
 				'notification_status'   => 'enabled',
40 40
 				'has_preview_header'    => true,
41
-				'email_tag_context'     => array( 'donor', 'general' ),
41
+				'email_tag_context'     => array('donor', 'general'),
42 42
 				'form_metabox_setting'  => false,
43 43
 				'default_email_subject' => sprintf(
44 44
 					/* translators: %s: site name */
45
-					esc_attr__( '[%s] New User Registration', 'give' ),
46
-					get_bloginfo( 'name' )
45
+					esc_attr__('[%s] New User Registration', 'give'),
46
+					get_bloginfo('name')
47 47
 				),
48 48
 				'default_email_message' => $this->get_default_email_message(),
49
-				'default_email_header'  => __( 'New User Registration', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('New User Registration', 'give'),
50
+			));
51 51
 
52 52
 			// Setup action hook.
53 53
 			add_action(
54 54
 				"give_{$this->config['id']}_email_notification",
55
-				array( $this, 'setup_email_notification' ),
55
+				array($this, 'setup_email_notification'),
56 56
 				10,
57 57
 				2
58 58
 			);
59 59
 
60 60
 			add_filter(
61 61
 				'give_email_preview_header',
62
-				array( $this, 'email_preview_header' ),
62
+				array($this, 'email_preview_header'),
63 63
 				10,
64 64
 				2
65 65
 			);
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		 * @return string
75 75
 		 */
76 76
 		function get_default_email_message() {
77
-			$message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n";
78
-			$message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
79
-			$message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n";
77
+			$message = esc_attr__('New user registration on your site {sitename}:', 'give')."\r\n\r\n";
78
+			$message .= esc_attr__('Username: {username}', 'give')."\r\n\r\n";
79
+			$message .= esc_attr__('Email: {user_email}', 'give')."\r\n";
80 80
 
81 81
 			/**
82 82
 			 * Filter the default email message
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * @since 2.0
97 97
 		 */
98 98
 		public function setup_email_data() {
99
-			Give()->emails->__set( 'heading', $this->get_email_header() );
99
+			Give()->emails->__set('heading', $this->get_email_header());
100 100
 		}
101 101
 
102 102
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 		 *
112 112
 		 * @return string
113 113
 		 */
114
-		public function setup_email_notification( $user_id, $user_data ) {
114
+		public function setup_email_notification($user_id, $user_data) {
115 115
 			$this->setup_email_data();
116 116
 
117
-			$this->send_email_notification( array(
117
+			$this->send_email_notification(array(
118 118
 				'user_id' => $user_id,
119
-			) );
119
+			));
120 120
 		}
121 121
 
122 122
 
@@ -130,42 +130,42 @@  discard block
 block discarded – undo
130 130
 		 * @param Give_New_Donor_Register_Email $email
131 131
 		 * @return string
132 132
 		 */
133
-		public function email_preview_header( $email_preview_header, $email ) {
133
+		public function email_preview_header($email_preview_header, $email) {
134 134
 			// Bailout.
135
-			if ( $this->config['id'] !== $email->config['id'] ) {
135
+			if ($this->config['id'] !== $email->config['id']) {
136 136
 				return $email_preview_header;
137 137
 			}
138 138
 
139 139
 			// Payment receipt switcher
140
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
140
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
141 141
 
142 142
 			// Get payments.
143 143
 			$donors  = new Give_API();
144
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
144
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
145 145
 			$options = array();
146 146
 
147 147
 			// Default option.
148
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
148
+			$options[0] = esc_html__('No donor(s) found.', 'give');
149 149
 
150 150
 			// Provide nice human readable options.
151
-			if ( $donors ) {
152
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
153
-				foreach ( $donors as $donor ) {
151
+			if ($donors) {
152
+				$options[0] = esc_html__('- Select a donor -', 'give');
153
+				foreach ($donors as $donor) {
154 154
 					// Exclude customers for which wp user not exist.
155
-					if ( ! $donor['info']['user_id'] ) {
155
+					if ( ! $donor['info']['user_id']) {
156 156
 						continue;
157 157
 					}
158
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
158
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
159 159
 				}
160 160
 			}
161 161
 
162
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
162
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
163 163
 			$query            = $request_url_data['query'];
164 164
 
165 165
 			// Remove user id query param if set from request url.
166
-			$query = remove_query_arg( array( 'user_id' ), $query );
166
+			$query = remove_query_arg(array('user_id'), $query);
167 167
 
168
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
168
+			$request_url = home_url('/?'.str_replace('', '', $query));
169 169
 			?>
170 170
 			<script type="text/javascript">
171 171
 				function change_preview() {
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 			<div class="give_preview_email_user_id_main">
200 200
 
201 201
 				<label for="give_preview_email_user_id" class="give_preview_email_user_id_label">
202
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
202
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
203 203
 				</label>
204 204
 
205 205
 				<?php
206 206
 				// The select field with 100 latest transactions
207
-				echo Give()->html->select( array(
207
+				echo Give()->html->select(array(
208 208
 					'name'             => 'preview_email_user_id',
209 209
 					'selected'         => $user_id,
210 210
 					'id'               => 'give_preview_email_user_id',
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					'select_atts'      => 'onchange="change_preview()"',
215 215
 					'show_option_all'  => false,
216 216
 					'show_option_none' => false,
217
-				) );
217
+				));
218 218
 				?>
219 219
 				<!-- Closing tag-->
220 220
 			</div>
Please login to merge, or discard this patch.
includes/admin/emails/class-offline-donation-instruction-email.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_Offline_Donation_Instruction_Email' ) ) :
19
+if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_Offline_Donation_Instruction_Email
@@ -36,33 +36,33 @@  discard block
 block discarded – undo
36 36
 		 */
37 37
 		public function init() {
38 38
 			// Initialize empty payment.
39
-			$this->payment = new Give_Payment( 0 );
39
+			$this->payment = new Give_Payment(0);
40 40
 
41
-			$this->load( array(
41
+			$this->load(array(
42 42
 				'id'                           => 'offline-donation-instruction',
43
-				'label'                        => __( 'Offline Donation Instructions', 'give' ),
44
-				'description'                  => __( 'Sent to the donor when they submit an offline donation.', 'give' ),
45
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
43
+				'label'                        => __('Offline Donation Instructions', 'give'),
44
+				'description'                  => __('Sent to the donor when they submit an offline donation.', 'give'),
45
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
46 46
 				'form_metabox_setting'         => true,
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tag_values'     => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51
-				'default_email_subject'        => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
51
+				'default_email_subject'        => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
52 52
 				'default_email_message'        => give_get_default_offline_donation_email_content(),
53
-				'default_email_header'         => __( 'Offline Donation Instructions', 'give' ),
53
+				'default_email_header'         => __('Offline Donation Instructions', 'give'),
54 54
 				'notices' => array(
55 55
 					'non-notification-status-editable' => sprintf(
56 56
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
57
-						__( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ),
58
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations') ),
59
-						__( 'Edit Setting', 'give' )
57
+						__('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'),
58
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations')),
59
+						__('Edit Setting', 'give')
60 60
 					)
61 61
 				),
62
-			) );
62
+			));
63 63
 
64
-			add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) );
65
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
64
+			add_action('give_insert_payment', array($this, 'setup_email_notification'));
65
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
66 66
 		}
67 67
 
68 68
 		/**
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 		 *
75 75
 		 * @return string
76 76
 		 */
77
-		public function get_email_message( $form_id = null ) {
77
+		public function get_email_message($form_id = null) {
78 78
 			$message = Give_Email_Notification_Util::get_value(
79 79
 				$this,
80
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
80
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
81 81
 				$form_id,
82 82
 				$this->config['default_email_message']
83 83
 			);
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @return string
108 108
 		 */
109
-		public function get_email_subject( $form_id = null ) {
109
+		public function get_email_subject($form_id = null) {
110 110
 			$subject = wp_strip_all_tags(
111 111
 				Give_Email_Notification_Util::get_value(
112 112
 					$this,
113
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
113
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
114 114
 					$form_id,
115 115
 					$this->config['default_email_subject']
116 116
 				)
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		 * @param int $form_id
140 140
 		 * @return array
141 141
 		 */
142
-		public function get_email_attachments( $form_id = null ) {
142
+		public function get_email_attachments($form_id = null) {
143 143
 			/**
144 144
 			 * Filter the attachments.
145 145
 			 * Note: This filter will deprecate soon.
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 				$this->payment->payment_meta
203 203
 			);
204 204
 
205
-			Give()->emails->__set( 'from_name', $from_name );
206
-			Give()->emails->__set( 'from_email', $from_email );
207
-			Give()->emails->__set( 'heading', $this->get_email_header() );
208
-			Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) );
205
+			Give()->emails->__set('from_name', $from_name);
206
+			Give()->emails->__set('from_email', $from_email);
207
+			Give()->emails->__set('heading', $this->get_email_header());
208
+			Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta));
209 209
 		}
210 210
 
211 211
 		/**
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param int $payment_id
218 218
 		 */
219
-		public function setup_email_notification( $payment_id ) {
220
-			$this->payment = new Give_Payment( $payment_id );
219
+		public function setup_email_notification($payment_id) {
220
+			$this->payment = new Give_Payment($payment_id);
221 221
 
222 222
 			// Exit if not donation was not with offline donation.
223
-			if ( 'offline' !== $this->payment->gateway ) {
223
+			if ('offline' !== $this->payment->gateway) {
224 224
 				return;
225 225
 			}
226 226
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 			$this->setup_email_data();
229 229
 
230 230
 			// Send email.
231
-			$this->send_email_notification( array(
231
+			$this->send_email_notification(array(
232 232
 				'payment_id' => $this->payment->ID,
233
-			) );
233
+			));
234 234
 		}
235 235
 
236 236
 		/**
@@ -242,18 +242,18 @@  discard block
 block discarded – undo
242 242
 		 * @param $update_options
243 243
 		 * @param $option_name
244 244
 		 */
245
-		public function set_notification_status( $update_options, $option_name ) {
245
+		public function set_notification_status($update_options, $option_name) {
246 246
 			// Get updated settings.
247 247
 			$update_options = give_get_settings();
248 248
 
249
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
249
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
250 250
 
251 251
 			if (
252
-				empty( $update_options["{$this->config['id']}_notification"] )
252
+				empty($update_options["{$this->config['id']}_notification"])
253 253
 				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
254 254
 			) {
255 255
 				$update_options["{$this->config['id']}_notification"] = $notification_status;
256
-				update_option( $option_name, $update_options );
256
+				update_option($option_name, $update_options);
257 257
 			}
258 258
 		}
259 259
 
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * @return array
271 271
 		 */
272
-		public function add_metabox_setting_field( $settings, $form_id ) {
273
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
272
+		public function add_metabox_setting_field($settings, $form_id) {
273
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
274 274
 				$settings[] = array(
275 275
 					'id'     => $this->config['id'],
276 276
 					'title'  => $this->config['label'],
277
-					'fields' => $this->get_setting_fields( $form_id ),
277
+					'fields' => $this->get_setting_fields($form_id),
278 278
 				);
279 279
 			}
280 280
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donation-email.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if access directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
20
-if ( ! class_exists( 'Give_New_Donation_Email' ) ) :
20
+if ( ! class_exists('Give_New_Donation_Email')) :
21 21
 
22 22
 	/**
23 23
 	 * Give_New_Donation_Email
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 		 */
38 38
 		public function init() {
39 39
 			// Initialize empty payment.
40
-			$this->payment = new Give_Payment( 0 );
40
+			$this->payment = new Give_Payment(0);
41 41
 
42
-			$this->load( array(
42
+			$this->load(array(
43 43
 				'id'                    => 'new-donation',
44
-				'label'                 => __( 'New Donation', 'give' ),
45
-				'description'           => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ),
44
+				'label'                 => __('New Donation', 'give'),
45
+				'description'           => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'),
46 46
 				'has_recipient_field'   => true,
47 47
 				'notification_status'   => 'enabled',
48 48
 				'form_metabox_setting'  => true,
49
-				'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
49
+				'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'),
50 50
 				'default_email_message' => give_get_default_donation_notification_email(),
51
-				'default_email_header'  => __( 'New Donation!', 'give' ),
52
-			) );
51
+				'default_email_header'  => __('New Donation!', 'give'),
52
+			));
53 53
 
54
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) );
54
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'));
55 55
 		}
56 56
 
57 57
 		/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @return string
66 66
 		 */
67
-		public function get_email_subject( $form_id = null ) {
67
+		public function get_email_subject($form_id = null) {
68 68
 			$subject = wp_strip_all_tags(
69 69
 				Give_Email_Notification_Util::get_value(
70 70
 					$this,
71
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
71
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
72 72
 					$form_id,
73 73
 					$this->config['default_email_subject']
74 74
 				)
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			$subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID );
83
+			$subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID);
84 84
 
85 85
 			/**
86 86
 			 * Filters the donation notification subject.
87 87
 			 *
88 88
 			 * @since 2.0
89 89
 			 */
90
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
90
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
91 91
 
92 92
 			return $subject;
93 93
 		}
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @return string
105 105
 		 */
106
-		public function get_email_message( $form_id = null ) {
106
+		public function get_email_message($form_id = null) {
107 107
 			$message = Give_Email_Notification_Util::get_value(
108 108
 				$this,
109
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
109
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
110 110
 				$form_id,
111 111
 				$this->config['default_email_message']
112 112
 			);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @param int $form_id
150 150
 		 * @return array
151 151
 		 */
152
-		public function get_email_attachments( $form_id = null ) {
152
+		public function get_email_attachments($form_id = null) {
153 153
 			/**
154 154
 			 * Filters the donation notification email attachments.
155 155
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 				$this->payment->payment_meta
213 213
 			);
214 214
 
215
-			Give()->emails->__set( 'from_name', $from_name );
216
-			Give()->emails->__set( 'from_email', $from_email );
217
-			Give()->emails->__set( 'heading', $this->get_email_header() );
215
+			Give()->emails->__set('from_name', $from_name);
216
+			Give()->emails->__set('from_email', $from_email);
217
+			Give()->emails->__set('heading', $this->get_email_header());
218 218
 
219 219
 			/**
220 220
 			 * Filters the donation notification email headers.
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				$this->payment->payment_meta
229 229
 			);
230 230
 
231
-			Give()->emails->__set( 'headers', $headers );
231
+			Give()->emails->__set('headers', $headers);
232 232
 		}
233 233
 
234 234
 		/**
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 		 *
240 240
 		 * @param int $payment_id
241 241
 		 */
242
-		public function setup_email_notification( $payment_id ) {
243
-			$this->payment = new Give_Payment( $payment_id );
242
+		public function setup_email_notification($payment_id) {
243
+			$this->payment = new Give_Payment($payment_id);
244 244
 
245 245
 			// Set email data.
246 246
 			$this->setup_email_data();
247 247
 
248 248
 			// Send email.
249
-			$this->send_email_notification( array(
249
+			$this->send_email_notification(array(
250 250
 				'payment_id' => $payment_id,
251
-			) );
251
+			));
252 252
 		}
253 253
 	}
254 254
 
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notification-table.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 * @access public
37 37
 	 */
38 38
 	public function __construct() {
39
-		parent::__construct( array(
40
-			'singular' => __( 'Give Email Notification', 'give' ),
41
-			'plural'   => __( 'Give Email Notifications', 'give' ),
42
-		) );
39
+		parent::__construct(array(
40
+			'singular' => __('Give Email Notification', 'give'),
41
+			'plural'   => __('Give Email Notifications', 'give'),
42
+		));
43 43
 
44 44
 		$this->email_notifications = Give_Email_Notifications::get_instance();
45 45
 	}
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 2.0
61 61
 		 */
62
-		return apply_filters( 'give_email_notification_setting_columns', array(
63
-			'cb'         => __( 'Email Status', 'give' ),
64
-			'name'       => __( 'Email', 'give' ),
65
-			'email_type' => __( 'Content Type', 'give' ),
66
-			'recipient'  => __( 'Recipient(s)', 'give' ),
67
-			'setting'    => __( 'Edit Email', 'give' ),
68
-		) );
62
+		return apply_filters('give_email_notification_setting_columns', array(
63
+			'cb'         => __('Email Status', 'give'),
64
+			'name'       => __('Email', 'give'),
65
+			'email_type' => __('Content Type', 'give'),
66
+			'recipient'  => __('Recipient(s)', 'give'),
67
+			'setting'    => __('Edit Email', 'give'),
68
+		));
69 69
 	}
70 70
 
71 71
 	/**
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return  string
80 80
 	 */
81
-	public function column_name( $email ) {
82
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
83
-		$actions  = $this->get_row_actions( $email );
81
+	public function column_name($email) {
82
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
83
+		$actions  = $this->get_row_actions($email);
84 84
 
85 85
 		ob_start();
86 86
 		?>
87 87
 		<a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a>
88 88
 
89
-		<?php if ( $desc = $email->config['description'] ) : ?>
90
-			<?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?>
89
+		<?php if ($desc = $email->config['description']) : ?>
90
+			<?php echo Give()->tooltips->render_help(esc_attr($desc)); ?>
91 91
 		<?php endif; ?>
92 92
 
93
-		<?php echo $this->row_actions( $actions ); ?>
93
+		<?php echo $this->row_actions($actions); ?>
94 94
 		<?php
95 95
 		return ob_get_clean();
96 96
 	}
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string
107 107
 	 */
108
-	public function column_recipient( $email ) {
108
+	public function column_recipient($email) {
109 109
 		ob_start();
110 110
 
111
-		if( Give_Email_Notification_Util::has_recipient_field( $email ) ) {
111
+		if (Give_Email_Notification_Util::has_recipient_field($email)) {
112 112
 			$recipients = $email->get_recipient();
113
-			if ( is_array( $recipients ) ) {
114
-				$recipients = implode( '<br>', $recipients );
113
+			if (is_array($recipients)) {
114
+				$recipients = implode('<br>', $recipients);
115 115
 			}
116 116
 
117 117
 			echo $recipients;
118 118
 
119
-		} elseif ( ! empty( $email->config['recipient_group_name'] ) ) {
119
+		} elseif ( ! empty($email->config['recipient_group_name'])) {
120 120
 			echo $email->config['recipient_group_name'];
121 121
 		}
122 122
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return string
135 135
 	 */
136
-	public function column_cb( $email ) {
136
+	public function column_cb($email) {
137 137
 		$notification_status  = $email->get_notification_status();
138
-		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email );
139
-		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active( $email )
138
+		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email);
139
+		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active($email)
140 140
 			? 'dashicons dashicons-yes'
141 141
 			: 'dashicons dashicons-no-alt';
142 142
 		$attributes           = array(
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 			'data-edit'   => $user_can_edit_status,
147 147
 		);
148 148
 
149
-		if ( ! $user_can_edit_status ) {
150
-			$icon_classes         = 'dashicons dashicons-lock';
149
+		if ( ! $user_can_edit_status) {
150
+			$icon_classes = 'dashicons dashicons-lock';
151 151
 
152
-			$attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] );
152
+			$attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']);
153 153
 		}
154 154
 
155 155
 		$html = sprintf(
156 156
 			'<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>',
157
-			give_get_attribute_str( $attributes ),
157
+			give_get_attribute_str($attributes),
158 158
 			$icon_classes
159 159
 		);
160 160
 
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string
174 174
 	 */
175
-	public function column_email_type( Give_Email_Notification $email ) {
175
+	public function column_email_type(Give_Email_Notification $email) {
176 176
 		$email_content_type_label = apply_filters(
177 177
 			"give_email_list_render_{$email->config['id']}_email_content_type",
178
-			Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ),
178
+			Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']),
179 179
 			$email
180 180
 		);
181 181
 
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string
194 194
 	 */
195
-	public function column_setting( Give_Email_Notification $email ) {
196
-		return Give()->tooltips->render_link( array(
197
-			'label'       => __( 'Edit', 'give' ) . " {$email->config['label']}",
195
+	public function column_setting(Give_Email_Notification $email) {
196
+		return Give()->tooltips->render_link(array(
197
+			'label'       => __('Edit', 'give')." {$email->config['label']}",
198 198
 			'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>',
199
-			'link'        => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) ),
199
+			'link'        => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id'])),
200 200
 			'attributes'  => array(
201 201
 				'class' => 'button button-small',
202 202
 			),
203
-		) );
203
+		));
204 204
 	}
205 205
 
206 206
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return array
216 216
 	 */
217
-	private function get_row_actions( $email ) {
218
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
217
+	private function get_row_actions($email) {
218
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
219 219
 
220 220
 		/**
221 221
 		 * Filter the row actions
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$row_actions = apply_filters(
228 228
 			'give_email_notification_row_actions',
229 229
 			array(
230
-				'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>',
230
+				'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>',
231 231
 			),
232 232
 			$email
233 233
 		);
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 		$hidden                = array();
249 249
 		$email_notifications   = array();
250 250
 		$sortable              = $this->get_sortable_columns();
251
-		$this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() );
251
+		$this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name());
252 252
 
253 253
 		// Set email notifications.
254 254
 		/* @var Give_Email_Notification $email_notification */
255
-		foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) {
256
-			if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) {
255
+		foreach ($this->email_notifications->get_email_notifications() as $email_notification) {
256
+			if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) {
257 257
 				$email_notifications[] = $email_notification;
258 258
 			}
259 259
 		}
260 260
 
261
-		$totalItems  = count( $email_notifications );
261
+		$totalItems  = count($email_notifications);
262 262
 		$this->items = $email_notifications;
263
-		$this->set_pagination_args( array(
263
+		$this->set_pagination_args(array(
264 264
 			'total_items' => $totalItems,
265 265
 			'per_page'    => $this->per_page,
266
-		) );
266
+		));
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @access public
274 274
 	 */
275 275
 	public function no_items() {
276
-		_e( 'No give email notification found.', 'give' );
276
+		_e('No give email notification found.', 'give');
277 277
 	}
278 278
 
279 279
 	/**
Please login to merge, or discard this patch.
includes/admin/emails/class-email-setting-field.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return array
23 23
 	 */
24
-	public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) {
25
-		$setting_fields = self::get_default_setting_fields( $email, $form_id );
24
+	public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) {
25
+		$setting_fields = self::get_default_setting_fields($email, $form_id);
26 26
 
27 27
 		// Recipient field.
28
-		$setting_fields[] = self::get_recipient_setting_field( $email, $form_id, Give_Email_Notification_Util::has_recipient_field( $email ) );
28
+		$setting_fields[] = self::get_recipient_setting_field($email, $form_id, Give_Email_Notification_Util::has_recipient_field($email));
29 29
 
30 30
 		// Add extra setting field.
31
-		if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) {
32
-			$setting_fields = array_merge( $setting_fields, $extra_setting_field );
31
+		if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) {
32
+			$setting_fields = array_merge($setting_fields, $extra_setting_field);
33 33
 		}
34 34
 
35 35
 		// Preview field.
36
-		if ( Give_Email_Notification_Util::has_preview( $email ) ) {
37
-			$setting_fields[] = self::get_preview_setting_field( $email, $form_id );
36
+		if (Give_Email_Notification_Util::has_preview($email)) {
37
+			$setting_fields[] = self::get_preview_setting_field($email, $form_id);
38 38
 		}
39 39
 
40
-		$setting_fields = self::add_section_end( $email, $setting_fields );
40
+		$setting_fields = self::add_section_end($email, $setting_fields);
41 41
 
42 42
 		/**
43 43
 		 * Filter the email notification settings.
44 44
 		 *
45 45
 		 * @since 2.0
46 46
 		 */
47
-		return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id );
47
+		return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id);
48 48
 	}
49 49
 
50 50
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool
60 60
 	 */
61
-	public static function has_section_end( $setting ) {
62
-		$last_field      = end( $setting );
61
+	public static function has_section_end($setting) {
62
+		$last_field      = end($setting);
63 63
 		$has_section_end = false;
64 64
 
65
-		if ( 'sectionend' === $last_field['type'] ) {
65
+		if ('sectionend' === $last_field['type']) {
66 66
 			$has_section_end = true;
67 67
 		}
68 68
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public static function get_section_start( Give_Email_Notification $email, $form_id = null ) {
83
+	public static function get_section_start(Give_Email_Notification $email, $form_id = null) {
84 84
 		// Add section end field.
85 85
 		$setting = array(
86 86
 			'id'    => "give_title_email_settings_{$email->config['id']}",
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public static function add_section_end( Give_Email_Notification $email, $setting ) {
106
-		if ( ! self::has_section_end( $setting ) ) {
105
+	public static function add_section_end(Give_Email_Notification $email, $setting) {
106
+		if ( ! self::has_section_end($setting)) {
107 107
 			// Add section end field.
108 108
 			$setting[] = array(
109 109
 				'id'   => "give_title_email_settings_{$email->config['id']}",
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return array
127 127
 	 */
128
-	public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) {
129
-		$settings[] = self::get_section_start( $email, $form_id );
130
-		$settings[] = self::get_notification_status_field( $email, $form_id );
128
+	public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) {
129
+		$settings[] = self::get_section_start($email, $form_id);
130
+		$settings[] = self::get_notification_status_field($email, $form_id);
131 131
 
132
-		if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) {
133
-			if ( $form_id || give_is_add_new_form_page() ) {
132
+		if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) {
133
+			if ($form_id || give_is_add_new_form_page()) {
134 134
 				// Do not allow admin to disable notification on perform basis.
135
-				unset( $settings[1]['options']['disabled'] );
135
+				unset($settings[1]['options']['disabled']);
136 136
 			} else {
137 137
 				// Do not allow admin to edit notification status globally.
138
-				unset( $settings[1] );
138
+				unset($settings[1]);
139 139
 			}
140 140
 		}
141 141
 
142
-		$settings[] = self::get_email_subject_field( $email, $form_id );
143
-		$settings[] = self::get_email_header_field( $email, $form_id );
144
-		$settings[] = self::get_email_message_field( $email, $form_id );
142
+		$settings[] = self::get_email_subject_field($email, $form_id);
143
+		$settings[] = self::get_email_header_field($email, $form_id);
144
+		$settings[] = self::get_email_message_field($email, $form_id);
145 145
 
146
-		if ( Give_Email_Notification_Util::is_content_type_editable( $email ) ) {
147
-			$settings[] = self::get_email_content_type_field( $email, $form_id );
146
+		if (Give_Email_Notification_Util::is_content_type_editable($email)) {
147
+			$settings[] = self::get_email_content_type_field($email, $form_id);
148 148
 		}
149 149
 
150 150
 		return $settings;
@@ -161,31 +161,31 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return array
163 163
 	 */
164
-	public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) {
164
+	public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) {
165 165
 		$option = array(
166
-			'enabled'  => __( 'Enabled', 'give' ),
167
-			'disabled' => __( 'Disabled', 'give' ),
166
+			'enabled'  => __('Enabled', 'give'),
167
+			'disabled' => __('Disabled', 'give'),
168 168
 		);
169 169
 
170 170
 		$default_value = $email->get_notification_status();
171 171
 
172 172
 		// Add global options.
173
-		if ( $form_id || give_is_add_new_form_page() ) {
173
+		if ($form_id || give_is_add_new_form_page()) {
174 174
 			$option = array(
175
-				'global'   => __( 'Global Options' ),
176
-				'enabled'  => __( 'Customize', 'give' ),
177
-				'disabled' => __( 'Disabled', 'give' ),
175
+				'global'   => __('Global Options'),
176
+				'enabled'  => __('Customize', 'give'),
177
+				'disabled' => __('Disabled', 'give'),
178 178
 			);
179 179
 
180 180
 			$default_value = 'global';
181 181
 		}
182 182
 
183
-		$description = isset( $_GET['page'] ) && 'give-settings' === $_GET['page'] ? __( 'Choose whether you want this email enabled or not.', 'give' ) : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) );
183
+		$description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails'));
184 184
 
185 185
 		return array(
186
-			'name'          => esc_html__( 'Notification', 'give' ),
186
+			'name'          => esc_html__('Notification', 'give'),
187 187
 			'desc'          => $description,
188
-			'id'            => self::get_prefix( $email, $form_id ) . 'notification',
188
+			'id'            => self::get_prefix($email, $form_id).'notification',
189 189
 			'type'          => 'radio_inline',
190 190
 			'default'       => $default_value,
191 191
 			'options'       => $option,
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array
206 206
 	 */
207
-	public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) {
207
+	public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) {
208 208
 		return array(
209
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_subject',
210
-			'name'    => esc_html__( 'Email Subject', 'give' ),
211
-			'desc'    => esc_html__( 'Enter the email subject line.', 'give' ),
209
+			'id'      => self::get_prefix($email, $form_id).'email_subject',
210
+			'name'    => esc_html__('Email Subject', 'give'),
211
+			'desc'    => esc_html__('Enter the email subject line.', 'give'),
212 212
 			'default' => $email->config['default_email_subject'],
213 213
 			'type'    => 'text',
214 214
 		);
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return array
226 226
 	 */
227
-	public static function get_email_header_field( Give_Email_Notification $email, $form_id = null ) {
227
+	public static function get_email_header_field(Give_Email_Notification $email, $form_id = null) {
228 228
 		return array(
229
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_header',
230
-			'name'    => esc_html__( 'Email Header', 'give' ),
231
-			'desc'    => esc_html__( 'Enter the email header that appears at the top of the email.', 'give' ),
229
+			'id'      => self::get_prefix($email, $form_id).'email_header',
230
+			'name'    => esc_html__('Email Header', 'give'),
231
+			'desc'    => esc_html__('Enter the email header that appears at the top of the email.', 'give'),
232 232
 			'default' => $email->config['default_email_header'],
233 233
 			'type'    => 'text',
234 234
 		);
@@ -245,28 +245,28 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return array
247 247
 	 */
248
-	public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) {
249
-		$desc = esc_html__( 'Enter the email message.', 'give' );
248
+	public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) {
249
+		$desc = esc_html__('Enter the email message.', 'give');
250 250
 
251
-		if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) {
251
+		if ($email_tag_list = $email->get_allowed_email_tags(true)) {
252 252
 			$desc = sprintf(
253 253
 				'%1$s <br> %2$s: %3$s %4$s',
254
-				__( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ),
255
-				__( 'Available template tags', 'give' ),
254
+				__('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'),
255
+				__('Available template tags', 'give'),
256 256
 				$email_tag_list,
257 257
 				sprintf(
258 258
 					'<br><a href="%1$s" target="_blank">%2$s</a> %3$s',
259
-					esc_url( 'http://docs.givewp.com/meta-email-tags' ),
260
-					__( 'See our documentation', 'give' ),
261
-					__( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' )
259
+					esc_url('http://docs.givewp.com/meta-email-tags'),
260
+					__('See our documentation', 'give'),
261
+					__('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give')
262 262
 				)
263 263
 			);
264 264
 
265 265
 		}
266 266
 
267 267
 		return array(
268
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_message',
269
-			'name'    => esc_html__( 'Email message', 'give' ),
268
+			'id'      => self::get_prefix($email, $form_id).'email_message',
269
+			'name'    => esc_html__('Email message', 'give'),
270 270
 			'desc'    => $desc,
271 271
 			'type'    => 'wysiwyg',
272 272
 			'default' => $email->config['default_email_message'],
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return array
286 286
 	 */
287
-	public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) {
287
+	public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) {
288 288
 		return array(
289
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_content_type',
290
-			'name'    => esc_html__( 'Email Content Type', 'give' ),
291
-			'desc'    => __( 'Choose email type.', 'give' ),
289
+			'id'      => self::get_prefix($email, $form_id).'email_content_type',
290
+			'name'    => esc_html__('Email Content Type', 'give'),
291
+			'desc'    => __('Choose email type.', 'give'),
292 292
 			'type'    => 'select',
293 293
 			'options' => array(
294
-				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ),
295
-				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ),
294
+				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type('text/html'),
295
+				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'),
296 296
 			),
297 297
 			'default' => $email->config['content_type'],
298 298
 		);
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return array
314 314
 	 */
315
-	public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null, $edit_recipient = true ) {
315
+	public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null, $edit_recipient = true) {
316 316
 		$recipient = array(
317
-			'id'               => self::get_prefix( $email, $form_id ) . 'recipient',
318
-			'name'             => esc_html__( 'Email Recipients', 'give' ),
319
-			'desc'             => __( 'Enter the email address(es) that should receive a notification.', 'give' ),
317
+			'id'               => self::get_prefix($email, $form_id).'recipient',
318
+			'name'             => esc_html__('Email Recipients', 'give'),
319
+			'desc'             => __('Enter the email address(es) that should receive a notification.', 'give'),
320 320
 			'type'             => 'email',
321
-			'default'          => get_bloginfo( 'admin_email' ),
321
+			'default'          => get_bloginfo('admin_email'),
322 322
 			'repeat'           => true,
323
-			'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ),
323
+			'repeat_btn_title' => esc_html__('Add Recipient', 'give'),
324 324
 		);
325 325
 
326
-		if ( $form_id || give_is_add_new_form_page() ) {
327
-			$recipient['name']    = __( 'Email', 'give' );
326
+		if ($form_id || give_is_add_new_form_page()) {
327
+			$recipient['name']    = __('Email', 'give');
328 328
 			$recipient['default'] = '';
329 329
 			$recipient['id']      = 'email';
330
-			$recipient['desc']    = __( 'Enter the email address that should receive a notification.', 'give' );
330
+			$recipient['desc']    = __('Enter the email address that should receive a notification.', 'give');
331 331
 
332 332
 			$recipient = array(
333
-				'id'      => self::get_prefix( $email, $form_id ) . 'recipient',
333
+				'id'      => self::get_prefix($email, $form_id).'recipient',
334 334
 				'type'    => 'group',
335 335
 				'options' => array(
336
-					'add_button'    => __( 'Add Email', 'give' ),
337
-					'header_title'  => __( 'Email Recipient', 'give' ),
336
+					'add_button'    => __('Add Email', 'give'),
337
+					'header_title'  => __('Email Recipient', 'give'),
338 338
 					'remove_button' => '<span class="dashicons dashicons-no"></span>',
339 339
 				),
340 340
 				'fields'  => array(
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 
346 346
 		// Disable field if email donor has recipient field.
347 347
 		// @see https://github.com/WordImpress/Give/issues/2657
348
-		if ( ! $edit_recipient ) {
349
-			if ( 'group' == $recipient['type'] ) {
350
-				$recipient         = current( $recipient['fields'] );
348
+		if ( ! $edit_recipient) {
349
+			if ('group' == $recipient['type']) {
350
+				$recipient         = current($recipient['fields']);
351 351
 				$recipient['type'] = 'text';
352 352
 			}
353 353
 
354 354
 			$recipient['attributes']['disabled'] = 'disabled';
355 355
 			$recipient['value']                  = $recipient['default'] = '{donor_email}';
356 356
 			$recipient['repeat']                 = false;
357
-			$recipient['desc']                   = __( 'This email is automatically sent to the donor and the recipient cannot be customized.', 'give' );
357
+			$recipient['desc']                   = __('This email is automatically sent to the donor and the recipient cannot be customized.', 'give');
358 358
 		}
359 359
 
360 360
 		return $recipient;
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return array
373 373
 	 */
374
-	public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) {
374
+	public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) {
375 375
 		return array(
376
-			'name' => __( 'Preview Email', 'give' ),
377
-			'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
-				'give' ),
379
-			'id'   => self::get_prefix( $email, $form_id ) . 'preview_buttons',
376
+			'name' => __('Preview Email', 'give'),
377
+			'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
+				'give'),
379
+			'id'   => self::get_prefix($email, $form_id).'preview_buttons',
380 380
 			'type' => 'email_preview_buttons',
381 381
 		);
382 382
 	}
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string
395 395
 	 */
396
-	public static function get_prefix( Give_Email_Notification $email, $form_id = null ) {
396
+	public static function get_prefix(Give_Email_Notification $email, $form_id = null) {
397 397
 		$meta_key = "{$email->config['id']}_";
398 398
 
399
-		if ( $form_id || give_is_add_new_form_page() ) {
399
+		if ($form_id || give_is_add_new_form_page()) {
400 400
 			$meta_key = "_give_{$email->config['id']}_";
401 401
 		}
402 402
 
Please login to merge, or discard this patch.