Test Failed
Pull Request — master (#3657)
by Ravinder
12:53 queued 04:57
created
includes/class-notices.php 1 patch
Spacing   +112 added lines, -113 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 	 * @since 1.8.9
54 54
 	 */
55 55
 	public function __construct() {
56
-		add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 );
57
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
56
+		add_action('admin_notices', array($this, 'render_admin_notices'), 999);
57
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
58 58
 
59
-		add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 );
60
-		add_action( 'give_pre_form_output', array( $this, 'render_frontend_form_notices' ), 10, 1 );
61
-		add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) );
59
+		add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999);
60
+		add_action('give_pre_form_output', array($this, 'render_frontend_form_notices'), 10, 1);
61
+		add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices'));
62 62
 
63 63
 		/**
64 64
 		 * Backward compatibility for deprecated params.
65 65
 		 *
66 66
 		 * @since 1.8.14
67 67
 		 */
68
-		add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) );
69
-		add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) );
70
-		add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) );
68
+		add_filter('give_register_notice_args', array($this, 'bc_deprecated_params'));
69
+		add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params'));
70
+		add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public function bc_deprecated_params( $args ) {
83
+	public function bc_deprecated_params($args) {
84 84
 		/**
85 85
 		 *  Param: auto_dismissible
86 86
 		 *  deprecated in 1.8.14
87 87
 		 *
88 88
 		 *  Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto
89 89
 		 */
90
-		if ( isset( $args['auto_dismissible'] ) ) {
91
-			if ( ! empty( $args['auto_dismissible'] ) ) {
90
+		if (isset($args['auto_dismissible'])) {
91
+			if ( ! empty($args['auto_dismissible'])) {
92 92
 				$args['dismissible'] = 'auto';
93 93
 			}
94 94
 			// unset auto_dismissible as it has been deprecated.
95
-			unset( $args['auto_dismissible'] );
95
+			unset($args['auto_dismissible']);
96 96
 		}
97 97
 
98 98
 		return $args;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public function register_notice( $notice_args ) {
111
+	public function register_notice($notice_args) {
112 112
 		// Bailout.
113
-		if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) {
113
+		if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) {
114 114
 			return false;
115 115
 		}
116 116
 
@@ -159,39 +159,39 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @since 1.8.14
161 161
 		 */
162
-		$notice_args = apply_filters( 'give_register_notice_args', $notice_args );
162
+		$notice_args = apply_filters('give_register_notice_args', $notice_args);
163 163
 
164 164
 		// Set extra dismiss links if any.
165
-		if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) {
165
+		if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) {
166 166
 
167
-			preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link );
167
+			preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link);
168 168
 
169
-			if ( ! empty( $extra_notice_dismiss_link ) ) {
170
-				$extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 );
171
-				foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) {
169
+			if ( ! empty($extra_notice_dismiss_link)) {
170
+				$extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3);
171
+				foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) {
172 172
 					// Create array og key ==> value by parsing query string created after renaming data attributes.
173
-					$data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array(
173
+					$data_attribute_query_str = str_replace(array('data-', '-', '"'), array(
174 174
 						'',
175 175
 						'_',
176 176
 						'',
177
-					), implode( '&', $extra_notice_dismiss_link ) );
177
+					), implode('&', $extra_notice_dismiss_link));
178 178
 
179
-					$notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str );
179
+					$notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str);
180 180
 				}
181 181
 			}
182 182
 		}
183 183
 
184 184
 
185
-		self::$notices[ $notice_args['id'] ] = $notice_args;
185
+		self::$notices[$notice_args['id']] = $notice_args;
186 186
 
187 187
 		// Auto set show param if not already set.
188
-		if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) {
189
-			self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true;
188
+		if ( ! isset(self::$notices[$notice_args['id']]['show'])) {
189
+			self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true;
190 190
 		}
191 191
 
192 192
 		// Auto set time interval for shortly.
193
-		if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) {
194
-			self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS;
193
+		if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) {
194
+			self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS;
195 195
 		}
196 196
 
197 197
 		return true;
@@ -205,51 +205,51 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function render_admin_notices() {
207 207
 		// Bailout.
208
-		if ( empty( self::$notices ) ) {
208
+		if (empty(self::$notices)) {
209 209
 			return;
210 210
 		}
211 211
 
212 212
 		$output = '';
213 213
 
214
-		foreach ( self::$notices as $notice_id => $notice ) {
214
+		foreach (self::$notices as $notice_id => $notice) {
215 215
 			// Check flag set to true to show notice.
216
-			if ( ! $notice['show'] ) {
216
+			if ( ! $notice['show']) {
217 217
 				continue;
218 218
 			}
219 219
 
220 220
 
221 221
 			// Render custom html.
222
-			if( ! empty( $notice['description_html'] ) ) {
222
+			if ( ! empty($notice['description_html'])) {
223 223
 				$output .= "{$notice['description_html']} \n";
224 224
 				continue;
225 225
 			}
226 226
 
227 227
 			// Check if notice dismissible or not.
228
-			if ( ! self::$has_auto_dismissible_notice ) {
229
-				self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] );
228
+			if ( ! self::$has_auto_dismissible_notice) {
229
+				self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']);
230 230
 			}
231 231
 
232 232
 			// Check if notice dismissible or not.
233
-			if ( ! self::$has_dismiss_interval_notice ) {
233
+			if ( ! self::$has_dismiss_interval_notice) {
234 234
 				self::$has_dismiss_interval_notice = $notice['dismiss_interval'];
235 235
 			}
236 236
 
237
-			$css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] );
237
+			$css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']);
238 238
 
239
-			$css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}";
240
-			$output    .= sprintf(
241
-				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n",
239
+			$css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}";
240
+			$output .= sprintf(
241
+				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n",
242 242
 				$css_id,
243 243
 				$css_class,
244
-				give_clean( $notice['dismissible'] ),
244
+				give_clean($notice['dismissible']),
245 245
 				$notice['dismissible_type'],
246 246
 				$notice['dismiss_interval'],
247 247
 				$notice['id'],
248
-				empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ),
248
+				empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"),
249 249
 				$notice['dismiss_interval_time']
250 250
 			);
251 251
 
252
-			$output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" );
252
+			$output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>");
253 253
 			$output .= "</div> \n";
254 254
 		}
255 255
 
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param int $form_id
269 269
 	 */
270
-	public function render_frontend_notices( $form_id = 0 ) {
270
+	public function render_frontend_notices($form_id = 0) {
271 271
 		$errors = give_get_errors();
272 272
 
273
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0;
273
+		$request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0;
274 274
 
275 275
 		// Sanity checks first: Ensure that gateway returned errors display on the appropriate form.
276
-		if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
276
+		if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
277 277
 			return;
278 278
 		}
279 279
 
280
-		if ( $errors ) {
281
-			self::print_frontend_errors( $errors );
280
+		if ($errors) {
281
+			self::print_frontend_errors($errors);
282 282
 
283 283
 			give_clear_errors();
284 284
 		}
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @return void
297 297
 	 */
298
-	public function render_frontend_form_notices( $form_id ) {
299
-		$display_option = give_get_meta( $form_id, '_give_payment_display', true );
298
+	public function render_frontend_form_notices($form_id) {
299
+		$display_option = give_get_meta($form_id, '_give_payment_display', true);
300 300
 
301
-		if ( 'modal' === $display_option ) {
302
-			add_action( 'give_payment_mode_top', array( $this, 'render_frontend_notices' ) );
301
+		if ('modal' === $display_option) {
302
+			add_action('give_payment_mode_top', array($this, 'render_frontend_notices'));
303 303
 		} else {
304
-			add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 );
304
+			add_action('give_pre_form', array($this, 'render_frontend_notices'), 11);
305 305
 		}
306 306
 	}
307 307
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @access private
313 313
 	 */
314 314
 	private function print_js() {
315
-		if ( self::$has_auto_dismissible_notice ) :
315
+		if (self::$has_auto_dismissible_notice) :
316 316
 			?>
317 317
 			<script>
318 318
 				jQuery(document).ready(function () {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			<?php
329 329
 		endif;
330 330
 
331
-		if ( self::$has_dismiss_interval_notice ) :
331
+		if (self::$has_dismiss_interval_notice) :
332 332
 			?>
333 333
 			<script>
334 334
 				jQuery(document).ready(function () {
@@ -407,36 +407,36 @@  discard block
 block discarded – undo
407 407
 	 * @access public
408 408
 	 */
409 409
 	public function dismiss_notices() {
410
-		$_post     = give_clean( $_POST );
411
-		$notice_id = esc_attr( $_post['notice_id'] );
410
+		$_post     = give_clean($_POST);
411
+		$notice_id = esc_attr($_post['notice_id']);
412 412
 
413 413
 		// Bailout.
414 414
 		if (
415
-			empty( $notice_id ) ||
416
-			empty( $_post['dismissible_type'] ) ||
417
-			empty( $_post['dismiss_interval'] ) ||
418
-			! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' )
415
+			empty($notice_id) ||
416
+			empty($_post['dismissible_type']) ||
417
+			empty($_post['dismiss_interval']) ||
418
+			! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce')
419 419
 		) {
420 420
 			wp_send_json_error();
421 421
 		}
422 422
 
423
-		$notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] );
424
-		if ( 'user' === $_post['dismissible_type'] ) {
423
+		$notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']);
424
+		if ('user' === $_post['dismissible_type']) {
425 425
 			$current_user = wp_get_current_user();
426
-			$notice_key   = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID );
426
+			$notice_key   = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID);
427 427
 		}
428 428
 
429
-		$notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null;
429
+		$notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null;
430 430
 
431 431
 		// Save option to hide notice.
432
-		Give_Cache::set( $notice_key, true, $notice_dismiss_time, true );
432
+		Give_Cache::set($notice_key, true, $notice_dismiss_time, true);
433 433
 
434 434
 		/**
435 435
 		 * Fire the action when notice dismissed
436 436
 		 *
437 437
 		 * @since 2.2.0
438 438
 		 */
439
-		do_action( 'give_notice_dismissed', $_post );
439
+		do_action('give_notice_dismissed', $_post);
440 440
 
441 441
 		wp_send_json_success();
442 442
 	}
@@ -454,18 +454,18 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @return string
456 456
 	 */
457
-	public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) {
457
+	public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) {
458 458
 		$notice_key = "_give_notice_{$notice_id}";
459 459
 
460
-		if ( ! empty( $dismiss_interval ) ) {
460
+		if ( ! empty($dismiss_interval)) {
461 461
 			$notice_key .= "_{$dismiss_interval}";
462 462
 		}
463 463
 
464
-		if ( $user_id ) {
464
+		if ($user_id) {
465 465
 			$notice_key .= "_{$user_id}";
466 466
 		}
467 467
 
468
-		$notice_key = sanitize_key( $notice_key );
468
+		$notice_key = sanitize_key($notice_key);
469 469
 
470 470
 		return $notice_key;
471 471
 	}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @return string
480 480
 	 */
481
-	public function get_dismiss_link( $notice_args ) {
481
+	public function get_dismiss_link($notice_args) {
482 482
 		$notice_args = wp_parse_args(
483 483
 			$notice_args,
484 484
 			array(
485
-				'title'                 => __( 'Click here', 'give' ),
485
+				'title'                 => __('Click here', 'give'),
486 486
 				'dismissible_type'      => '',
487 487
 				'dismiss_interval'      => '',
488 488
 				'dismiss_interval_time' => null,
@@ -509,31 +509,31 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @return bool|null
511 511
 	 */
512
-	public function is_notice_dismissed( $notice ) {
513
-		$notice_key          = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] );
512
+	public function is_notice_dismissed($notice) {
513
+		$notice_key          = $this->get_notice_key($notice['id'], $notice['dismiss_interval']);
514 514
 		$is_notice_dismissed = false;
515 515
 
516
-		if ( 'user' === $notice['dismissible_type'] ) {
516
+		if ('user' === $notice['dismissible_type']) {
517 517
 			$current_user = wp_get_current_user();
518
-			$notice_key   = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID );
518
+			$notice_key   = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID);
519 519
 		}
520 520
 
521
-		$notice_data = Give_Cache::get( $notice_key, true );
521
+		$notice_data = Give_Cache::get($notice_key, true);
522 522
 
523 523
 		// Find notice dismiss link status if notice has extra dismissible links.
524
-		if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) {
524
+		if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) {
525 525
 
526
-			foreach ( $notice['extra_links'] as $extra_link ) {
527
-				$new_notice_data = wp_parse_args( $extra_link, $notice );
528
-				unset( $new_notice_data['extra_links'] );
526
+			foreach ($notice['extra_links'] as $extra_link) {
527
+				$new_notice_data = wp_parse_args($extra_link, $notice);
528
+				unset($new_notice_data['extra_links']);
529 529
 
530
-				if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) {
530
+				if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) {
531 531
 					return $is_notice_dismissed;
532 532
 				}
533 533
 			}
534 534
 		}
535 535
 
536
-		$is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data );
536
+		$is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data);
537 537
 
538 538
 		return $is_notice_dismissed;
539 539
 	}
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 *
548 548
 	 * @param array $errors
549 549
 	 */
550
-	public static function print_frontend_errors( $errors ) {
550
+	public static function print_frontend_errors($errors) {
551 551
 		// Bailout.
552
-		if ( ! $errors ) {
552
+		if ( ! $errors) {
553 553
 			return;
554 554
 		}
555 555
 
@@ -564,37 +564,37 @@  discard block
 block discarded – undo
564 564
 		);
565 565
 
566 566
 		// Note: we will remove give_errors class in future.
567
-		$classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) );
567
+		$classes = apply_filters('give_error_class', array('give_notices', 'give_errors'));
568 568
 
569
-		echo sprintf( '<div class="%s">', implode( ' ', $classes ) );
569
+		echo sprintf('<div class="%s">', implode(' ', $classes));
570 570
 
571 571
 		// Loop error codes and display errors.
572
-		foreach ( $errors as $error_id => $error ) {
572
+		foreach ($errors as $error_id => $error) {
573 573
 			// Backward compatibility v<1.8.11
574
-			if ( is_string( $error ) ) {
574
+			if (is_string($error)) {
575 575
 				$error = array(
576 576
 					'message'     => $error,
577 577
 					'notice_args' => array(),
578 578
 				);
579 579
 			}
580 580
 
581
-			$notice_args = wp_parse_args( $error['notice_args'], $default_notice_args );
581
+			$notice_args = wp_parse_args($error['notice_args'], $default_notice_args);
582 582
 
583 583
 			/**
584 584
 			 * Filter to modify Frontend Errors args before errors is display.
585 585
 			 *
586 586
 			 * @since 1.8.14
587 587
 			 */
588
-			$notice_args = apply_filters( 'give_frontend_errors_args', $notice_args );
588
+			$notice_args = apply_filters('give_frontend_errors_args', $notice_args);
589 589
 
590 590
 			echo sprintf(
591 591
 				'<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d">
592 592
 						<p><strong>%4$s</strong>: %5$s</p>
593 593
 					</div>',
594 594
 				$error_id,
595
-				give_clean( $notice_args['dismissible'] ),
596
-				absint( $notice_args['dismiss_interval'] ),
597
-				esc_html__( 'Error', 'give' ),
595
+				give_clean($notice_args['dismissible']),
596
+				absint($notice_args['dismiss_interval']),
597
+				esc_html__('Error', 'give'),
598 598
 				$error['message']
599 599
 			);
600 600
 		}
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 	 *
617 617
 	 * @return  string
618 618
 	 */
619
-	public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) {
620
-		if ( empty( $message ) ) {
619
+	public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) {
620
+		if (empty($message)) {
621 621
 			return '';
622 622
 		}
623 623
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 			'dismiss_interval' => 5000,
633 633
 		);
634 634
 
635
-		$notice_args = wp_parse_args( $notice_args, $default_notice_args );
635
+		$notice_args = wp_parse_args($notice_args, $default_notice_args);
636 636
 
637 637
 		// Notice dismissible must be true for dismiss type.
638 638
 		$notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type'];
@@ -642,15 +642,14 @@  discard block
 block discarded – undo
642 642
 		 *
643 643
 		 * @since 1.8.14
644 644
 		 */
645
-		$notice_args = apply_filters( 'give_frontend_notice_args', $notice_args );
645
+		$notice_args = apply_filters('give_frontend_notice_args', $notice_args);
646 646
 
647 647
 		$close_icon = 'manual' === $notice_args['dismiss_type'] ?
648 648
 			sprintf(
649 649
 				'<img class="notice-dismiss give-notice-close" src="%s" />',
650
-				esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' )
650
+				esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg')
651 651
 
652
-			) :
653
-			'';
652
+			) : '';
654 653
 
655 654
 		// Note: we will remove give_errors class in future.
656 655
 		$error = sprintf(
@@ -661,15 +660,15 @@  discard block
 block discarded – undo
661 660
 						%6$s
662 661
 					</div>',
663 662
 			$notice_type,
664
-			give_clean( $notice_args['dismissible'] ),
665
-			absint( $notice_args['dismiss_interval'] ),
666
-			give_clean( $notice_args['dismiss_type'] ),
663
+			give_clean($notice_args['dismissible']),
664
+			absint($notice_args['dismiss_interval']),
665
+			give_clean($notice_args['dismiss_type']),
667 666
 			$message,
668 667
 			$close_icon
669 668
 
670 669
 		);
671 670
 
672
-		if ( ! $echo ) {
671
+		if ( ! $echo) {
673 672
 			return $error;
674 673
 		}
675 674
 
@@ -689,24 +688,24 @@  discard block
 block discarded – undo
689 688
 	 *
690 689
 	 * @return string
691 690
 	 */
692
-	public function print_admin_notices( $notice_args = array() ) {
691
+	public function print_admin_notices($notice_args = array()) {
693 692
 		// Bailout.
694
-		if ( empty( $notice_args['description'] ) ) {
693
+		if (empty($notice_args['description'])) {
695 694
 			return '';
696 695
 		}
697 696
 
698
-		$defaults    = array(
697
+		$defaults = array(
699 698
 			'id'          => '',
700 699
 			'echo'        => true,
701 700
 			'notice_type' => 'warning',
702 701
 			'dismissible' => true,
703 702
 		);
704
-		$notice_args = wp_parse_args( $notice_args, $defaults );
703
+		$notice_args = wp_parse_args($notice_args, $defaults);
705 704
 
706 705
 		$output    = '';
707
-		$css_id    = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' );
706
+		$css_id    = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-');
708 707
 		$css_class = "notice-{$notice_args['notice_type']} give-notice notice inline";
709
-		$css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : '';
708
+		$css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : '';
710 709
 		$output    .= sprintf(
711 710
 			'<div id="%1$s" class="%2$s"><p>%3$s</p></div>',
712 711
 			$css_id,
@@ -714,7 +713,7 @@  discard block
 block discarded – undo
714 713
 			$notice_args['description']
715 714
 		);
716 715
 
717
-		if ( ! $notice_args['echo'] ) {
716
+		if ( ! $notice_args['echo']) {
718 717
 			return $output;
719 718
 		}
720 719
 
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 	 * Instantiate the class
33 33
 	 */
34 34
 	public function __construct() {
35
-		$this->self = get_class( $this );
35
+		$this->self = get_class($this);
36 36
 
37 37
 		parent::__construct(
38
-			strtolower( $this->self ),
39
-			esc_html__( 'Give - Donation Form', 'give' ),
38
+			strtolower($this->self),
39
+			esc_html__('Give - Donation Form', 'give'),
40 40
 			array(
41
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ),
41
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give'),
42 42
 			)
43 43
 		);
44 44
 
45
-		add_action( 'widgets_init', array( $this, 'widget_init' ) );
46
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
45
+		add_action('widgets_init', array($this, 'widget_init'));
46
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
47 47
 	}
48 48
 
49 49
 	/**
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return void
55 55
 	 */
56
-	public function admin_widget_scripts( $hook ) {
56
+	public function admin_widget_scripts($hook) {
57 57
 
58 58
 		// Directories of assets.
59
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
60
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
61
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
59
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
60
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
61
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
62 62
 
63 63
 		// Use minified libraries if SCRIPT_DEBUG is turned off.
64
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
64
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
65 65
 
66 66
 		// Widget Script.
67
-		if ( 'widgets.php' === $hook ) {
67
+		if ('widgets.php' === $hook) {
68 68
 
69
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
69
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
70 70
 		}
71 71
 	}
72 72
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 *                        before_widget, and after_widget.
78 78
 	 * @param array $instance The settings for the particular instance of the widget.
79 79
 	 */
80
-	public function widget( $args, $instance ) {
81
-		$title   = ! empty( $instance['title'] ) ? $instance['title'] : '';
82
-		$title   = apply_filters( 'widget_title', $title, $instance, $this->id_base );
80
+	public function widget($args, $instance) {
81
+		$title   = ! empty($instance['title']) ? $instance['title'] : '';
82
+		$title   = apply_filters('widget_title', $title, $instance, $this->id_base);
83 83
 		$form_id = (int) $instance['id'];
84 84
 
85 85
 		echo $args['before_widget']; // XSS ok.
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 		 *
92 92
 		 * @since 1.0
93 93
 		 */
94
-		do_action( 'give_before_forms_widget', $form_id );
94
+		do_action('give_before_forms_widget', $form_id);
95 95
 
96
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; // XSS ok.
96
+		echo $title ? $args['before_title'].$title.$args['after_title'] : ''; // XSS ok.
97 97
 
98
-		give_get_donation_form( $instance );
98
+		give_get_donation_form($instance);
99 99
 
100 100
 		echo $args['after_widget']; // XSS ok.
101 101
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @since 1.0
108 108
 		 */
109
-		do_action( 'give_after_forms_widget', $form_id );
109
+		do_action('give_after_forms_widget', $form_id);
110 110
 	}
111 111
 
112 112
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $instance Current settings.
116 116
 	 */
117
-	public function form( $instance ) {
117
+	public function form($instance) {
118 118
 		$defaults = array(
119 119
 			'title'                 => '',
120 120
 			'id'                    => '',
@@ -124,74 +124,74 @@  discard block
 block discarded – undo
124 124
 			'continue_button_title' => '',
125 125
 		);
126 126
 
127
-		$instance = wp_parse_args( (array) $instance, $defaults );
127
+		$instance = wp_parse_args((array) $instance, $defaults);
128 128
 
129 129
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
130
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
130
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
131 131
 
132 132
 		// Query Give Forms.
133 133
 		$args = array(
134 134
 			'post_type'      => 'give_forms',
135
-			'posts_per_page' => - 1,
135
+			'posts_per_page' => -1,
136 136
 			'post_status'    => 'publish',
137 137
 		);
138 138
 
139
-		$give_forms = get_posts( $args );
139
+		$give_forms = get_posts($args);
140 140
 		?>
141 141
 		<div class="give_forms_widget_container">
142 142
 
143 143
 			<?php // Widget: widget Title. ?>
144 144
 			<p>
145
-				<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
146
-				<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /><br>
147
-				<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
145
+				<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
146
+				<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" /><br>
147
+				<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
148 148
 			</p>
149 149
 
150 150
 			<?php // Widget: Give Form. ?>
151 151
 			<p>
152
-				<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
153
-				<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
154
-					<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
155
-					<?php foreach ( $give_forms as $give_form ) { ?>
152
+				<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
153
+				<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
154
+					<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
155
+					<?php foreach ($give_forms as $give_form) { ?>
156 156
 						<?php /* translators: %s: Title */ ?>
157
-						<?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?>
158
-						<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo esc_html( $form_title ); ?></option>
157
+						<?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?>
158
+						<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo esc_html($form_title); ?></option>
159 159
 					<?php } ?>
160 160
 				</select><br>
161
-				<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
161
+				<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
162 162
 			</p>
163 163
 
164 164
 			<?php // Widget: Display Style. ?>
165 165
 			<p class="give_forms_display_style_setting_row">
166
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br>
167
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-onpage" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
168
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-reveal" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
169
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-modal"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-modal" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label>
170
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-button"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-button" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br>
166
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br>
167
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-onpage"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-onpage" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
168
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-reveal"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-reveal" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
169
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-modal"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-modal" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label>
170
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-button"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-button" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br>
171 171
 				<small class="give-field-description">
172
-					<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
172
+					<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
173 173
 				</small>
174 174
 			</p>
175 175
 
176 176
 			<?php // Widget: Continue Button Title. ?>
177 177
 			<p class="give_forms_continue_button_title_setting_row">
178
-				<label for="<?php echo esc_attr( $this->get_field_id( 'continue_button_title' ) ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label>
179
-				<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'continue_button_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'continue_button_title' ) ); ?>" value="<?php echo esc_attr( $instance['continue_button_title'] ); ?>" /><br>
180
-				<small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small>
178
+				<label for="<?php echo esc_attr($this->get_field_id('continue_button_title')); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label>
179
+				<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('continue_button_title')); ?>" name="<?php echo esc_attr($this->get_field_name('continue_button_title')); ?>" value="<?php echo esc_attr($instance['continue_button_title']); ?>" /><br>
180
+				<small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small>
181 181
 			</p>
182 182
 
183 183
 			<?php // Widget: Floating Labels. ?>
184 184
 			<p>
185
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
186
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-global"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-global" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
187
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-enabled" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
188
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-disabled" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
185
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
186
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-global"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-global" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
187
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-enabled"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-enabled" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
188
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-disabled"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-disabled" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
189 189
 				<small class="give-field-description">
190 190
 					<?php
191 191
 					printf(
192 192
 						/* translators: %s: http://docs.givewp.com/form-floating-labels */
193
-						esc_html__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
194
-						esc_url( 'http://docs.givewp.com/form-floating-labels' )
193
+						esc_html__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
194
+						esc_url('http://docs.givewp.com/form-floating-labels')
195 195
 					);
196 196
 					?>
197 197
 					</small>
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 
200 200
 			<?php // Widget: Display Content. ?>
201 201
 			<p>
202
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br>
203
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-none"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-none" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label>
204
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-above"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-above" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label>
205
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-below"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-below" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br>
206
-				<small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small>
202
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br>
203
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-none"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-none" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label>
204
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-above"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-above" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label>
205
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-below"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-below" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br>
206
+				<small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small>
207 207
 		</div>
208 208
 		<?php
209 209
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return void
215 215
 	 */
216 216
 	public function widget_init() {
217
-		register_widget( $this->self );
217
+		register_widget($this->self);
218 218
 	}
219 219
 
220 220
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return array
227 227
 	 */
228
-	public function update( $new_instance, $old_instance ) {
228
+	public function update($new_instance, $old_instance) {
229 229
 		$this->flush_widget_cache();
230 230
 
231 231
 		return $new_instance;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @return void
238 238
 	 */
239 239
 	public function flush_widget_cache() {
240
-		wp_cache_delete( $this->self, 'widget' );
240
+		wp_cache_delete($this->self, 'widget');
241 241
 	}
242 242
 }
243 243
 
Please login to merge, or discard this patch.
includes/admin/emails/class-offline-donation-instruction-email.php 1 patch
Spacing   +36 added lines, -36 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,9 +202,9 @@  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( '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('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta));
208 208
 		}
209 209
 
210 210
 		/**
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 		 *
216 216
 		 * @param int $payment_id
217 217
 		 */
218
-		public function setup_email_notification( $payment_id ) {
219
-			$this->payment = new Give_Payment( $payment_id );
218
+		public function setup_email_notification($payment_id) {
219
+			$this->payment = new Give_Payment($payment_id);
220 220
 
221 221
 			// Exit if not donation was not with offline donation.
222
-			if ( 'offline' !== $this->payment->gateway ) {
222
+			if ('offline' !== $this->payment->gateway) {
223 223
 				return;
224 224
 			}
225 225
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 			$this->setup_email_data();
228 228
 
229 229
 			// Send email.
230
-			$this->send_email_notification( array(
230
+			$this->send_email_notification(array(
231 231
 				'payment_id' => $this->payment->ID,
232
-			) );
232
+			));
233 233
 		}
234 234
 
235 235
 		/**
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
 		 * @param $update_options
242 242
 		 * @param $option_name
243 243
 		 */
244
-		public function set_notification_status( $update_options, $option_name ) {
244
+		public function set_notification_status($update_options, $option_name) {
245 245
 			// Get updated settings.
246 246
 			$update_options = give_get_settings();
247 247
 
248
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
248
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
249 249
 
250 250
 			if (
251
-				empty( $update_options["{$this->config['id']}_notification"] )
251
+				empty($update_options["{$this->config['id']}_notification"])
252 252
 				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
253 253
 			) {
254 254
 				$update_options["{$this->config['id']}_notification"] = $notification_status;
255
-				update_option( $option_name, $update_options, false );
255
+				update_option($option_name, $update_options, false);
256 256
 			}
257 257
 		}
258 258
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 		 *
269 269
 		 * @return array
270 270
 		 */
271
-		public function add_metabox_setting_field( $settings, $form_id ) {
272
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
271
+		public function add_metabox_setting_field($settings, $form_id) {
272
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
273 273
 				$settings[] = array(
274 274
 					'id'     => $this->config['id'],
275 275
 					'title'  => $this->config['label'],
276
-					'fields' => $this->get_setting_fields( $form_id ),
276
+					'fields' => $this->get_setting_fields($form_id),
277 277
 				);
278 278
 			}
279 279
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donor-register-email.php 1 patch
Spacing   +34 added lines, -34 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
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 		 *
102 102
 		 * @return string
103 103
 		 */
104
-		public function setup_email_notification( $user_id, $user_data ) {
104
+		public function setup_email_notification($user_id, $user_data) {
105 105
 			$this->setup_email_data();
106 106
 
107
-			$this->send_email_notification( array(
107
+			$this->send_email_notification(array(
108 108
 				'user_id' => $user_id,
109
-			) );
109
+			));
110 110
 		}
111 111
 
112 112
 
@@ -120,42 +120,42 @@  discard block
 block discarded – undo
120 120
 		 * @param Give_New_Donor_Register_Email $email
121 121
 		 * @return string
122 122
 		 */
123
-		public function email_preview_header( $email_preview_header, $email ) {
123
+		public function email_preview_header($email_preview_header, $email) {
124 124
 			// Bailout.
125
-			if ( $this->config['id'] !== $email->config['id'] ) {
125
+			if ($this->config['id'] !== $email->config['id']) {
126 126
 				return $email_preview_header;
127 127
 			}
128 128
 
129 129
 			// Payment receipt switcher
130
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
130
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
131 131
 
132 132
 			// Get payments.
133 133
 			$donors  = new Give_API();
134
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
134
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
135 135
 			$options = array();
136 136
 
137 137
 			// Default option.
138
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
138
+			$options[0] = esc_html__('No donor(s) found.', 'give');
139 139
 
140 140
 			// Provide nice human readable options.
141
-			if ( $donors ) {
142
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
143
-				foreach ( $donors as $donor ) {
141
+			if ($donors) {
142
+				$options[0] = esc_html__('- Select a donor -', 'give');
143
+				foreach ($donors as $donor) {
144 144
 					// Exclude customers for which wp user not exist.
145
-					if ( ! $donor['info']['user_id'] ) {
145
+					if ( ! $donor['info']['user_id']) {
146 146
 						continue;
147 147
 					}
148
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
148
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
149 149
 				}
150 150
 			}
151 151
 
152
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
152
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
153 153
 			$query            = $request_url_data['query'];
154 154
 
155 155
 			// Remove user id query param if set from request url.
156
-			$query = remove_query_arg( array( 'user_id' ), $query );
156
+			$query = remove_query_arg(array('user_id'), $query);
157 157
 
158
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
158
+			$request_url = home_url('/?'.str_replace('', '', $query));
159 159
 			?>
160 160
 			<script type="text/javascript">
161 161
 				function change_preview() {
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 			<div class="give_preview_email_user_id_main">
190 190
 
191 191
 				<label for="give_preview_email_user_id" class="give_preview_email_user_id_label">
192
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
192
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
193 193
 				</label>
194 194
 
195 195
 				<?php
196 196
 				// The select field with 100 latest transactions
197
-				echo Give()->html->select( array(
197
+				echo Give()->html->select(array(
198 198
 					'name'             => 'preview_email_user_id',
199 199
 					'selected'         => $user_id,
200 200
 					'id'               => 'give_preview_email_user_id',
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 					'select_atts'      => 'onchange="change_preview()"',
205 205
 					'show_option_all'  => false,
206 206
 					'show_option_none' => false,
207
-				) );
207
+				));
208 208
 				?>
209 209
 				<!-- Closing tag-->
210 210
 			</div>
Please login to merge, or discard this patch.
includes/admin/emails/class-new-offline-donation-email.php 1 patch
Spacing   +41 added lines, -41 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_New_Offline_Donation_Email' ) ) :
19
+if ( ! class_exists('Give_New_Offline_Donation_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_New_Offline_Donation_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'                           => 'new-offline-donation',
43
-				'label'                        => __( 'New Offline Donation', 'give' ),
44
-				'description'                  => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ),
43
+				'label'                        => __('New Offline Donation', 'give'),
44
+				'description'                  => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'),
45 45
 				'has_recipient_field'          => true,
46
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
46
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tags_values'    => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51 51
 				'default_email_subject'        => $this->get_default_email_subject(),
52 52
 				'default_email_message'        => $this->get_default_email_message(),
53
-				'default_email_header'         => __( 'New Offline Donation!', 'give' ),
53
+				'default_email_header'         => __('New Offline Donation!', '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
 		/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			 */
82 82
 			$subject = apply_filters(
83 83
 				'give_offline_admin_donation_notification_subject',
84
-				__( 'New Pending Donation', 'give' )
84
+				__('New Pending Donation', 'give')
85 85
 			);
86 86
 
87 87
 			/**
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 		 * @return string
107 107
 		 */
108 108
 		public function get_default_email_message() {
109
-			$message = __( 'Dear Admin,', 'give' ) . "\n\n";
110
-			$message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
111
-			$message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
109
+			$message = __('Dear Admin,', 'give')."\n\n";
110
+			$message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
111
+			$message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
112 112
 
113
-			$message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
114
-			$message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
113
+			$message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
114
+			$message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
115 115
 
116 116
 			$message .= sprintf(
117 117
 				'<a href="%1$s">%2$s</a>',
118
-				admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ),
119
-				__( 'Click Here to View and/or Update Donation Details', 'give' )
120
-			) . "\n\n";
118
+				admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID),
119
+				__('Click Here to View and/or Update Donation Details', 'give')
120
+			)."\n\n";
121 121
 
122 122
 			/**
123 123
 			 * Filter the donation receipt email message
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 		 *
156 156
 		 * @return string
157 157
 		 */
158
-		public function get_email_message( $form_id = null ) {
158
+		public function get_email_message($form_id = null) {
159 159
 			$message = Give_Email_Notification_Util::get_value(
160 160
 				$this,
161
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
161
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
162 162
 				$form_id,
163 163
 				$this->config['default_email_message']
164 164
 			);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		 *
199 199
 		 * @return array
200 200
 		 */
201
-		public function get_email_attachments( $form_id = null ) {
201
+		public function get_email_attachments($form_id = null) {
202 202
 			/**
203 203
 			 * Filter the attachments.
204 204
 			 * Note: This filter will deprecate soon.
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 		 *
250 250
 		 * @param int $payment_id
251 251
 		 */
252
-		public function setup_email_notification( $payment_id ) {
253
-			$this->payment = new Give_Payment( $payment_id );
252
+		public function setup_email_notification($payment_id) {
253
+			$this->payment = new Give_Payment($payment_id);
254 254
 
255 255
 			// Exit if not donation was not with offline donation.
256
-			if ( 'offline' !== $this->payment->gateway ) {
256
+			if ('offline' !== $this->payment->gateway) {
257 257
 				return;
258 258
 			}
259 259
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 			$this->setup_email_data();
262 262
 
263 263
 			// Send email.
264
-			$this->send_email_notification( array(
264
+			$this->send_email_notification(array(
265 265
 				'payment_id' => $this->payment->ID,
266
-			) );
266
+			));
267 267
 		}
268 268
 
269 269
 		/**
@@ -275,18 +275,18 @@  discard block
 block discarded – undo
275 275
 		 * @param $update_options
276 276
 		 * @param $option_name
277 277
 		 */
278
-		public function set_notification_status( $update_options, $option_name ) {
278
+		public function set_notification_status($update_options, $option_name) {
279 279
 			// Get updated settings.
280 280
 			$update_options = give_get_settings();
281 281
 
282
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
282
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
283 283
 
284 284
 			if (
285
-				empty( $update_options[ "{$this->config['id']}_notification" ] )
286
-				|| $notification_status !== $update_options[ "{$this->config['id']}_notification" ]
285
+				empty($update_options["{$this->config['id']}_notification"])
286
+				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
287 287
 			) {
288
-				$update_options[ "{$this->config['id']}_notification" ] = $notification_status;
289
-				update_option( $option_name, $update_options, false );
288
+				$update_options["{$this->config['id']}_notification"] = $notification_status;
289
+				update_option($option_name, $update_options, false);
290 290
 			}
291 291
 		}
292 292
 
@@ -301,13 +301,13 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @return array
303 303
 		 */
304
-		public function add_metabox_setting_field( $settings, $form_id ) {
304
+		public function add_metabox_setting_field($settings, $form_id) {
305 305
 
306
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
306
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
307 307
 				$settings[] = array(
308 308
 					'id'     => $this->config['id'],
309 309
 					'title'  => $this->config['label'],
310
-					'fields' => $this->get_setting_fields( $form_id ),
310
+					'fields' => $this->get_setting_fields($form_id),
311 311
 				);
312 312
 			}
313 313
 
Please login to merge, or discard this patch.
includes/admin/emails/class-donation-receipt-email.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) :
18
+if ( ! class_exists('Give_Donation_Receipt_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Donation_Receipt_Email
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function init() {
37 37
 			// Initialize empty payment.
38
-			$this->payment = new Give_Payment( 0 );
38
+			$this->payment = new Give_Payment(0);
39 39
 
40
-			$this->load( array(
40
+			$this->load(array(
41 41
 				'id'                   => 'donation-receipt',
42
-				'label'                => __( 'Donation Receipt', 'give' ),
43
-				'description'          => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ),
42
+				'label'                => __('Donation Receipt', 'give'),
43
+				'description'          => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'),
44 44
 				'notification_status'  => 'enabled',
45 45
 				'form_metabox_setting' => true,
46
-				'recipient_group_name' => __( 'Donor', 'give' ),
47
-				'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ),
46
+				'recipient_group_name' => __('Donor', 'give'),
47
+				'default_email_subject' => esc_attr__('Donation Receipt', 'give'),
48 48
 				'default_email_message' => give_get_default_donation_receipt_email(),
49
-				'default_email_header'  => __( 'Donation Receipt', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('Donation Receipt', 'give'),
50
+			));
51 51
 
52
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) );
53
-			add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) );
52
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt'));
53
+			add_action('give_email_links', array($this, 'resend_donation_receipt'));
54 54
 		}
55 55
 
56 56
 		/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		 * @param int $form_id
63 63
 		 * @return string
64 64
 		 */
65
-		public function get_email_subject( $form_id = null ) {
65
+		public function get_email_subject($form_id = null) {
66 66
 			$subject = wp_strip_all_tags(
67 67
 				Give_Email_Notification_Util::get_value(
68 68
 					$this,
69
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
69
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
70 70
 					$form_id,
71 71
 					$this->config['default_email_subject']
72 72
 				)
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		 * @param int $form_id
110 110
 		 * @return string
111 111
 		 */
112
-		public function get_email_message( $form_id = null ) {
112
+		public function get_email_message($form_id = null) {
113 113
 			$message = Give_Email_Notification_Util::get_value(
114 114
 				$this,
115
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
115
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
116 116
 				$form_id,
117 117
 				$this->config['default_email_message']
118 118
 			);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			 * @since 1.0
125 125
 			 */
126 126
 			$message = apply_filters(
127
-				'give_donation_receipt_' . Give()->emails->get_template(),
127
+				'give_donation_receipt_'.Give()->emails->get_template(),
128 128
 				$message,
129 129
 				$this->payment->ID,
130 130
 				$this->payment->payment_meta
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		 * @param int $form_id
168 168
 		 * @return array
169 169
 		 */
170
-		public function get_email_attachments( $form_id = null) {
170
+		public function get_email_attachments($form_id = null) {
171 171
 			/**
172 172
 			 * Filter the attachments.
173 173
 			 * Note: this filter will deprecate soon.
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 				$this->payment->payment_meta
237 237
 			);
238 238
 
239
-			Give()->emails->__set( 'from_name', $from_name );
240
-			Give()->emails->__set( 'from_email', $from_email );
239
+			Give()->emails->__set('from_name', $from_name);
240
+			Give()->emails->__set('from_email', $from_email);
241 241
 
242 242
 			/**
243 243
 			 * Filters the donation receipt's email headers.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				$this->payment->payment_meta
255 255
 			);
256 256
 
257
-			Give()->emails->__set( 'headers', $headers );
257
+			Give()->emails->__set('headers', $headers);
258 258
 		}
259 259
 
260 260
 		/**
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
 		 *
266 266
 		 * @param $payment_id
267 267
 		 */
268
-		public function send_donation_receipt( $payment_id ) {
269
-			$this->payment = new Give_Payment( $payment_id );
268
+		public function send_donation_receipt($payment_id) {
269
+			$this->payment = new Give_Payment($payment_id);
270 270
 
271 271
 			// Setup email data.
272 272
 			$this->setup_email_data();
273 273
 
274 274
 			// Send email.
275
-			$this->send_email_notification( array(
275
+			$this->send_email_notification(array(
276 276
 				'payment_id' => $this->payment->ID,
277
-			) );
277
+			));
278 278
 		}
279 279
 
280 280
 		/**
@@ -285,35 +285,35 @@  discard block
 block discarded – undo
285 285
 		 *
286 286
 		 * @param array $data Donation details.
287 287
 		 */
288
-		public function resend_donation_receipt( $data ) {
289
-			$purchase_id = absint( $data['purchase_id'] );
288
+		public function resend_donation_receipt($data) {
289
+			$purchase_id = absint($data['purchase_id']);
290 290
 
291
-			if ( empty( $purchase_id ) ) {
291
+			if (empty($purchase_id)) {
292 292
 				return;
293 293
 			}
294 294
 
295 295
 			// Get donation payment information.
296
-			$this->payment = new Give_Payment( $purchase_id );
296
+			$this->payment = new Give_Payment($purchase_id);
297 297
 
298
-			if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) {
299
-				wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array(
298
+			if ( ! current_user_can('edit_give_payments', $this->payment->ID)) {
299
+				wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array(
300 300
 					'response' => 403,
301
-				) );
301
+				));
302 302
 			}
303 303
 
304 304
 			// Setup email data.
305 305
 			$this->setup_email_data();
306 306
 
307 307
 			// Send email.
308
-			$this->send_email_notification( array(
308
+			$this->send_email_notification(array(
309 309
 				'payment_id' => $this->payment->ID,
310
-			) );
310
+			));
311 311
 
312
-			wp_redirect( add_query_arg( array(
312
+			wp_redirect(add_query_arg(array(
313 313
 				'give-messages[]' => 'email-sent',
314 314
 				'give-action'     => false,
315 315
 				'purchase_id'     => false,
316
-			) ) );
316
+			)));
317 317
 			exit;
318 318
 		}
319 319
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donation-email.php 1 patch
Spacing   +24 added lines, -24 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,8 +212,8 @@  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 );
215
+			Give()->emails->__set('from_name', $from_name);
216
+			Give()->emails->__set('from_email', $from_email);
217 217
 
218 218
 			/**
219 219
 			 * Filters the donation notification email headers.
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 				$this->payment->payment_meta
228 228
 			);
229 229
 
230
-			Give()->emails->__set( 'headers', $headers );
230
+			Give()->emails->__set('headers', $headers);
231 231
 		}
232 232
 
233 233
 		/**
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		 *
239 239
 		 * @param int $payment_id
240 240
 		 */
241
-		public function setup_email_notification( $payment_id ) {
242
-			$this->payment = new Give_Payment( $payment_id );
241
+		public function setup_email_notification($payment_id) {
242
+			$this->payment = new Give_Payment($payment_id);
243 243
 
244 244
 			// Set email data.
245 245
 			$this->setup_email_data();
246 246
 
247 247
 			// Send email.
248
-			$this->send_email_notification( array(
248
+			$this->send_email_notification(array(
249 249
 				'payment_id' => $payment_id,
250
-			) );
250
+			));
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
includes/admin/emails/class-email-access-email.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Email_Access_Email' ) ) :
18
+if ( ! class_exists('Give_Email_Access_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Email_Access_Email
@@ -31,31 +31,31 @@  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'                           => 'email-access',
36
-				'label'                        => __( 'Email access', 'give' ),
37
-				'description'                  => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ),
38
-				'notification_status'          => give_get_option( 'email_access', 'disabled' ),
36
+				'label'                        => __('Email access', 'give'),
37
+				'description'                  => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'),
38
+				'notification_status'          => give_get_option('email_access', 'disabled'),
39 39
 				'form_metabox_setting'         => false,
40 40
 				'notification_status_editable' => false,
41 41
 				'email_tag_context'            => 'donor',
42
-				'recipient_group_name'         => __( 'Donor', 'give' ),
43
-				'default_email_subject'        => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ),
42
+				'recipient_group_name'         => __('Donor', 'give'),
43
+				'default_email_subject'        => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')),
44 44
 				'default_email_message'        => $this->get_default_email_message(),
45
-				'default_email_header'         => __( 'Confirm Email', 'give' ),
45
+				'default_email_header'         => __('Confirm Email', 'give'),
46 46
 				'notices' => array(
47 47
 					'non-notification-status-editable' => sprintf(
48 48
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
49
-						__( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ),
50
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control') ),
51
-						__( 'Edit Setting', 'give' )
49
+						__('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'),
50
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control')),
51
+						__('Edit Setting', 'give')
52 52
 					)
53 53
 				),
54
-			) );
54
+			));
55 55
 
56
-			add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 );
57
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
58
-			add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 );
56
+			add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2);
57
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
58
+			add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2);
59 59
 		}
60 60
 
61 61
 		/**
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 		 *
69 69
 		 * @return string
70 70
 		 */
71
-		public function get_email_subject( $form_id = null ) {
71
+		public function get_email_subject($form_id = null) {
72 72
 			$subject = wp_strip_all_tags(
73 73
 				Give_Email_Notification_Util::get_value(
74 74
 					$this,
75
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
75
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
76 76
 					$form_id,
77 77
 					$this->config['default_email_subject']
78 78
 				)
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 			 *
85 85
 			 * @since 1.0
86 86
 			 */
87
-			$subject = apply_filters( 'give_email_access_token_subject', $subject );
87
+			$subject = apply_filters('give_email_access_token_subject', $subject);
88 88
 
89 89
 			/**
90 90
 			 * Filters the donation notification subject.
91 91
 			 *
92 92
 			 * @since 2.0
93 93
 			 */
94
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
94
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
95 95
 
96 96
 			return $subject;
97 97
 		}
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 		 *
108 108
 		 * @return string
109 109
 		 */
110
-		public function get_email_message( $form_id = null ) {
110
+		public function get_email_message($form_id = null) {
111 111
 			$message = Give_Email_Notification_Util::get_value(
112 112
 				$this,
113
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
113
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
114 114
 				$form_id,
115 115
 				$this->config['default_email_message']
116 116
 			);
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 			 *
122 122
 			 * @since 1.0
123 123
 			 */
124
-			$message = apply_filters( 'give_email_access_token_message', $message );
124
+			$message = apply_filters('give_email_access_token_message', $message);
125 125
 
126 126
 			/**
127 127
 			 * Filter the email message
128 128
 			 *
129 129
 			 * @since 2.0
130 130
 			 */
131
-			$message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id );
131
+			$message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id);
132 132
 
133 133
 			return $message;
134 134
 		}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param int $form_id
144 144
 		 * @return array
145 145
 		 */
146
-		public function get_email_attachments( $form_id = null ) {
146
+		public function get_email_attachments($form_id = null) {
147 147
 			/**
148 148
 			 * Filters the donation notification email attachments.
149 149
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			 *
152 152
 			 * @since 1.0
153 153
 			 */
154
-			$attachments = apply_filters( 'give_admin_donation_notification_attachments', array() );
154
+			$attachments = apply_filters('give_admin_donation_notification_attachments', array());
155 155
 
156 156
 			/**
157 157
 			 * Filters the donation notification email attachments.
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			 *
160 160
 			 * @since 2.0
161 161
 			 */
162
-			$attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id );
162
+			$attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id);
163 163
 
164 164
 			return $attachments;
165 165
 		}
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 		 * @return string
175 175
 		 */
176 176
 		public function get_default_email_message() {
177
-			$message = __( 'Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give' ) . "\n\n";
178
-			$message .= '{email_access_link}' . "\n\n";
177
+			$message = __('Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give')."\n\n";
178
+			$message .= '{email_access_link}'."\n\n";
179 179
 			$message .= "\n\n";
180
-			$message .= __( 'Sincerely,', 'give' ) . "\n";
181
-			$message .= get_bloginfo( 'name' ) . "\n";
180
+			$message .= __('Sincerely,', 'give')."\n";
181
+			$message .= get_bloginfo('name')."\n";
182 182
 
183 183
 			/**
184 184
 			 * Filter the new donation email message
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			 *
188 188
 			 * @param string $message
189 189
 			 */
190
-			return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this );
190
+			return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this);
191 191
 		}
192 192
 
193 193
 
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 		 *
202 202
 		 * @return string
203 203
 		 */
204
-		public function get_email_header( $form_id = null ) {
205
-			$subject = parent::get_email_header( $form_id );
204
+		public function get_email_header($form_id = null) {
205
+			$subject = parent::get_email_header($form_id);
206 206
 
207 207
 			/**
208 208
 			 * Filter the email header
209 209
 			 *
210 210
 			 * @since 1.0
211 211
 			 */
212
-			$subject  =  apply_filters( 'give_email_access_token_heading', $subject );
212
+			$subject = apply_filters('give_email_access_token_heading', $subject);
213 213
 
214 214
 			return  $subject;
215 215
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			 *
228 228
 			 * @since 1.0
229 229
 			 */
230
-			$from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() );
230
+			$from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name());
231 231
 
232 232
 			/**
233 233
 			 * Filters the from email.
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
 			 *
236 236
 			 * @since 1.0
237 237
 			 */
238
-			$from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() );
238
+			$from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address());
239 239
 
240
-			Give()->emails->__set( 'from_name', $from_name );
241
-			Give()->emails->__set( 'from_email', $from_email );
240
+			Give()->emails->__set('from_name', $from_name);
241
+			Give()->emails->__set('from_email', $from_email);
242 242
 
243 243
 			/**
244 244
 			 * Filters the donation notification email headers.
245 245
 			 *
246 246
 			 * @since 1.0
247 247
 			 */
248
-			$headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() );
248
+			$headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers());
249 249
 
250
-			Give()->emails->__set( 'headers', $headers );
250
+			Give()->emails->__set('headers', $headers);
251 251
 		}
252 252
 
253 253
 		/**
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 		 *
262 262
 		 * @return bool
263 263
 		 */
264
-		public function setup_email_notification( $donor_id, $email ) {
265
-			$donor = Give()->donors->get_donor_by( 'email', $email );
264
+		public function setup_email_notification($donor_id, $email) {
265
+			$donor = Give()->donors->get_donor_by('email', $email);
266 266
 			$this->recipient_email = $email;
267 267
 
268 268
 			// Set email data.
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
 		 * @param $update_options
288 288
 		 * @param $option_name
289 289
 		 */
290
-		public function set_notification_status( $update_options, $option_name ) {
290
+		public function set_notification_status($update_options, $option_name) {
291 291
 			// Get updated settings.
292 292
 			$update_options = give_get_settings();
293 293
 
294 294
 			if (
295
-				! empty( $update_options['email_access'] )
296
-				&& ! empty( $update_options[ "{$this->config['id']}_notification" ] )
297
-				&& $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ]
295
+				! empty($update_options['email_access'])
296
+				&& ! empty($update_options["{$this->config['id']}_notification"])
297
+				&& $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"]
298 298
 			) {
299
-				$update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access'];
300
-				update_option( $option_name, $update_options, false );
299
+				$update_options["{$this->config['id']}_notification"] = $update_options['email_access'];
300
+				update_option($option_name, $update_options, false);
301 301
 			}
302 302
 		}
303 303
 
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 		 * @param Give_Email_Access_Email $email
313 313
 		 * @return string
314 314
 		 */
315
-		public function email_preview_header( $email_preview_header, $email ) {
316
-			if( $this->config['id'] === $email->config['id'] ) {
315
+		public function email_preview_header($email_preview_header, $email) {
316
+			if ($this->config['id'] === $email->config['id']) {
317 317
 				$email_preview_header = '';
318 318
 			}
319 319
 
Please login to merge, or discard this patch.
includes/admin/reports/graphing.php 1 patch
Spacing   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$dates          = give_get_report_dates();
27 27
 
28 28
 	// Determine graph options.
29
-	switch ( $dates['range'] ) :
29
+	switch ($dates['range']) :
30 30
 		case 'today':
31 31
 		case 'yesterday':
32 32
 			$day_by_day = true;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$day_by_day = false;
39 39
 			break;
40 40
 		case 'other':
41
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
41
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
42 42
 				$day_by_day = false;
43 43
 			} else {
44 44
 				$day_by_day = true;
@@ -55,60 +55,60 @@  discard block
 block discarded – undo
55 55
 	$earnings_data = array();
56 56
 	$sales_data    = array();
57 57
 
58
-	if ( 'today' === $dates['range'] || 'yesterday' === $dates['range'] ) {
58
+	if ('today' === $dates['range'] || 'yesterday' === $dates['range']) {
59 59
 
60 60
 		// Hour by hour.
61 61
 		$hour  = 0;
62
-		$month = date( 'n', current_time( 'timestamp' ) );
63
-		while ( $hour <= 23 ) :
62
+		$month = date('n', current_time('timestamp'));
63
+		while ($hour <= 23) :
64 64
 
65
-			$start_date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] );
66
-			$end_date   = mktime( $hour, 59, 59, $month, $dates['day'], $dates['year'] );
67
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
68
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
65
+			$start_date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']);
66
+			$end_date   = mktime($hour, 59, 59, $month, $dates['day'], $dates['year']);
67
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
68
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
69 69
 
70 70
 			$sales_totals    += $sales;
71 71
 			$earnings_totals += $earnings;
72 72
 
73
-			$sales_data[]    = array( $start_date * 1000, $sales );
74
-			$earnings_data[] = array( $start_date * 1000, $earnings );
73
+			$sales_data[]    = array($start_date * 1000, $sales);
74
+			$earnings_data[] = array($start_date * 1000, $earnings);
75 75
 
76
-			$hour ++;
76
+			$hour++;
77 77
 		endwhile;
78 78
 
79
-	} elseif ( 'this_week' === $dates['range'] || 'last_week' === $dates['range'] ) {
79
+	} elseif ('this_week' === $dates['range'] || 'last_week' === $dates['range']) {
80 80
 
81 81
 		// Day by day.
82 82
 		$day     = $dates['day'];
83 83
 		$day_end = $dates['day_end'];
84 84
 		$month   = $dates['m_start'];
85
-		while ( $day <= $day_end ) :
85
+		while ($day <= $day_end) :
86 86
 
87
-			$start_date = mktime( 0, 0, 0, $month, $day, $dates['year'] );
88
-			$end_date   = mktime( 23, 59, 59, $month, $day, $dates['year'] );
89
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
90
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
87
+			$start_date = mktime(0, 0, 0, $month, $day, $dates['year']);
88
+			$end_date   = mktime(23, 59, 59, $month, $day, $dates['year']);
89
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
90
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
91 91
 
92 92
 			$sales_totals    += $sales;
93 93
 			$earnings_totals += $earnings;
94 94
 
95
-			$sales_data[]    = array( $start_date * 1000, $sales );
96
-			$earnings_data[] = array( $start_date * 1000, $earnings );
97
-			$day ++;
95
+			$sales_data[]    = array($start_date * 1000, $sales);
96
+			$earnings_data[] = array($start_date * 1000, $earnings);
97
+			$day++;
98 98
 		endwhile;
99 99
 
100 100
 	} else {
101 101
 
102 102
 		$y = $dates['year'];
103
-		while ( $y <= $dates['year_end'] ) :
103
+		while ($y <= $dates['year_end']) :
104 104
 
105
-			if ( $dates['year'] === $dates['year_end'] ) {
105
+			if ($dates['year'] === $dates['year_end']) {
106 106
 				$month_start = $dates['m_start'];
107 107
 				$month_end   = $dates['m_end'];
108
-			} elseif ( $y === $dates['year'] ) {
108
+			} elseif ($y === $dates['year']) {
109 109
 				$month_start = $dates['m_start'];
110 110
 				$month_end   = 12;
111
-			} elseif ( $y === $dates['year_end'] ) {
111
+			} elseif ($y === $dates['year_end']) {
112 112
 				$month_start = 1;
113 113
 				$month_end   = $dates['m_end'];
114 114
 			} else {
@@ -117,67 +117,67 @@  discard block
 block discarded – undo
117 117
 			}
118 118
 
119 119
 			$i = $month_start;
120
-			while ( $i <= $month_end ) :
120
+			while ($i <= $month_end) :
121 121
 
122
-				if ( $day_by_day ) {
122
+				if ($day_by_day) {
123 123
 
124
-					if ( $i === $month_end ) {
124
+					if ($i === $month_end) {
125 125
 
126 126
 						$num_of_days = $dates['day_end'];
127 127
 
128 128
 					} else {
129 129
 
130
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
130
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
131 131
 
132 132
 					}
133 133
 
134 134
 					$d = $dates['day'];
135 135
 
136
-					while ( $d <= $num_of_days ) :
136
+					while ($d <= $num_of_days) :
137 137
 
138
-						$start_date = mktime( 0, 0, 0, $i, $d, $y );
139
-						$end_date   = mktime( 23, 59, 59, $i, $d, $y );
140
-						$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
141
-						$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
138
+						$start_date = mktime(0, 0, 0, $i, $d, $y);
139
+						$end_date   = mktime(23, 59, 59, $i, $d, $y);
140
+						$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
141
+						$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
142 142
 
143 143
 						$sales_totals    += $sales;
144 144
 						$earnings_totals += $earnings;
145 145
 
146
-						$sales_data[]    = array( $start_date * 1000, $sales );
147
-						$earnings_data[] = array( $start_date * 1000, $earnings );
146
+						$sales_data[]    = array($start_date * 1000, $sales);
147
+						$earnings_data[] = array($start_date * 1000, $earnings);
148 148
 
149
-						$d ++;
149
+						$d++;
150 150
 
151 151
 					endwhile;
152 152
 
153 153
 				} else {
154 154
 
155 155
 					// This Quarter, Last Quarter, This Year, Last Year.
156
-					$start_date = mktime( 0, 0, 0, $i, 1, $y );
157
-					$end_date   = mktime( 23, 59, 59, $i + 1, 0, $y );
158
-					$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
159
-					$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
156
+					$start_date = mktime(0, 0, 0, $i, 1, $y);
157
+					$end_date   = mktime(23, 59, 59, $i + 1, 0, $y);
158
+					$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
159
+					$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
160 160
 
161 161
 					$sales_totals    += $sales;
162 162
 					$earnings_totals += $earnings;
163 163
 
164
-					$sales_data[]    = array( $start_date * 1000, $sales );
165
-					$earnings_data[] = array( $start_date * 1000, $earnings );
164
+					$sales_data[]    = array($start_date * 1000, $sales);
165
+					$earnings_data[] = array($start_date * 1000, $earnings);
166 166
 
167 167
 				}
168 168
 
169
-				$i ++;
169
+				$i++;
170 170
 
171 171
 			endwhile;
172 172
 
173
-			$y ++;
173
+			$y++;
174 174
 		endwhile;
175 175
 
176 176
 	}
177 177
 
178 178
 	$data = array(
179
-		__( 'Income', 'give' )    => $earnings_data,
180
-		__( 'Donations', 'give' ) => $sales_data,
179
+		__('Income', 'give')    => $earnings_data,
180
+		__('Donations', 'give') => $sales_data,
181 181
 	);
182 182
 
183 183
 	// start our own output buffer.
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 				<div class="inside">
191 191
 					<?php give_reports_graph_controls(); ?>
192 192
 					<?php
193
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' === $dates['range'] ) {
198
+					if ('this_month' === $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -204,21 +204,21 @@  discard block
 block discarded – undo
204 204
 			<table class="widefat reports-table alignleft" style="max-width:450px">
205 205
 				<tbody>
206 206
 				<tr>
207
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
208
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
207
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
208
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
209 209
 				</tr>
210 210
 				<tr class="alternate">
211
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?><strong></th>
211
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?><strong></th>
212 212
 					<td><?php echo $sales_totals; ?></td>
213 213
 				</tr>
214
-				<?php if ( 'this_month' === $dates['range'] ) : ?>
214
+				<?php if ('this_month' === $dates['range']) : ?>
215 215
 					<tr>
216
-						<th scope="row"><strong><?php _e( 'Estimated monthly income:', 'give' ); ?></strong></th>
217
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td>
216
+						<th scope="row"><strong><?php _e('Estimated monthly income:', 'give'); ?></strong></th>
217
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'], array('sanitize' => false))); ?></td>
218 218
 					</tr>
219 219
 					<tr class="alternate">
220
-						<th scope="row"><strong><?php _e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
221
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
220
+						<th scope="row"><strong><?php _e('Estimated monthly donations:', 'give'); ?></strong></th>
221
+						<td><?php echo floor($estimated['sales']); ?></td>
222 222
 					</tr>
223 223
 				<?php endif; ?>
224 224
 			</table>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			 *
232 232
 			 * @since 1.0
233 233
 			 */
234
-			do_action( 'give_reports_graph_additional_stats' );
234
+			do_action('give_reports_graph_additional_stats');
235 235
 			?>
236 236
 
237 237
 		</div>
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return void
255 255
  */
256
-function give_reports_graph_of_form( $form_id = 0 ) {
256
+function give_reports_graph_of_form($form_id = 0) {
257 257
 	// Retrieve the queried dates.
258 258
 	$dates = give_get_report_dates();
259 259
 
260 260
 	// Determine graph options.
261
-	switch ( $dates['range'] ) :
261
+	switch ($dates['range']) :
262 262
 		case 'today':
263 263
 		case 'yesterday':
264 264
 			$day_by_day = true;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			$day_by_day = false;
277 277
 			break;
278 278
 		case 'other':
279
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
279
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
280 280
 				$day_by_day = false;
281 281
 			} else {
282 282
 				$day_by_day = true;
@@ -288,75 +288,75 @@  discard block
 block discarded – undo
288 288
 	endswitch;
289 289
 
290 290
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown.
291
-	$sales_totals    = 0;            // Total sales for time period shown.
291
+	$sales_totals    = 0; // Total sales for time period shown.
292 292
 
293 293
 	$earnings_data = array();
294 294
 	$sales_data    = array();
295 295
 	$stats         = new Give_Payment_Stats();
296 296
 
297
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
297
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
298 298
 
299 299
 		// Hour by hour
300 300
 		$month  = $dates['m_start'];
301 301
 		$hour   = 0;
302 302
 		$minute = 0;
303 303
 		$second = 0;
304
-		while ( $hour <= 23 ) :
304
+		while ($hour <= 23) :
305 305
 
306
-			if ( $hour == 23 ) {
306
+			if ($hour == 23) {
307 307
 				$minute = $second = 59;
308 308
 			}
309 309
 
310
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
311
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
310
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
311
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
312 312
 
313
-			$sales         = $stats->get_sales( $form_id, $date, $date_end );
313
+			$sales         = $stats->get_sales($form_id, $date, $date_end);
314 314
 			$sales_totals += $sales;
315 315
 
316
-			$earnings         = $stats->get_earnings( $form_id, $date, $date_end );
316
+			$earnings         = $stats->get_earnings($form_id, $date, $date_end);
317 317
 			$earnings_totals += $earnings;
318 318
 
319
-			$sales_data[]    = array( $date * 1000, $sales );
320
-			$earnings_data[] = array( $date * 1000, $earnings );
319
+			$sales_data[]    = array($date * 1000, $sales);
320
+			$earnings_data[] = array($date * 1000, $earnings);
321 321
 
322
-			$hour ++;
322
+			$hour++;
323 323
 		endwhile;
324 324
 
325
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
325
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
326 326
 
327 327
 		// Day by day.
328 328
 		$day     = $dates['day'];
329 329
 		$day_end = $dates['day_end'];
330 330
 		$month   = $dates['m_start'];
331
-		while ( $day <= $day_end ) :
331
+		while ($day <= $day_end) :
332 332
 
333
-			$date          = mktime( 0, 0, 0, $month, $day, $dates['year'] );
334
-			$date_end      = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
335
-			$sales         = $stats->get_sales( $form_id, $date, $date_end );
333
+			$date          = mktime(0, 0, 0, $month, $day, $dates['year']);
334
+			$date_end      = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
335
+			$sales         = $stats->get_sales($form_id, $date, $date_end);
336 336
 			$sales_totals += $sales;
337 337
 
338
-			$earnings         = $stats->get_earnings( $form_id, $date, $date_end );
338
+			$earnings         = $stats->get_earnings($form_id, $date, $date_end);
339 339
 			$earnings_totals += $earnings;
340 340
 
341
-			$sales_data[]    = array( $date * 1000, $sales );
342
-			$earnings_data[] = array( $date * 1000, $earnings );
341
+			$sales_data[]    = array($date * 1000, $sales);
342
+			$earnings_data[] = array($date * 1000, $earnings);
343 343
 
344
-			$day ++;
344
+			$day++;
345 345
 		endwhile;
346 346
 
347 347
 	} else {
348 348
 
349 349
 		$y = $dates['year'];
350 350
 
351
-		while ( $y <= $dates['year_end'] ) :
351
+		while ($y <= $dates['year_end']) :
352 352
 
353 353
 			$last_year = false;
354 354
 
355
-			if ( $dates['year'] == $dates['year_end'] ) {
355
+			if ($dates['year'] == $dates['year_end']) {
356 356
 				$month_start = $dates['m_start'];
357 357
 				$month_end   = $dates['m_end'];
358 358
 				$last_year   = true;
359
-			} elseif ( $y == $dates['year'] ) {
359
+			} elseif ($y == $dates['year']) {
360 360
 				$month_start = $dates['m_start'];
361 361
 				$month_end   = 12;
362 362
 			} else {
@@ -365,68 +365,68 @@  discard block
 block discarded – undo
365 365
 			}
366 366
 
367 367
 			$i = $month_start;
368
-			while ( $i <= $month_end ) :
368
+			while ($i <= $month_end) :
369 369
 
370
-				if ( $day_by_day ) {
370
+				if ($day_by_day) {
371 371
 
372
-					if ( $i == $month_end && $last_year ) {
372
+					if ($i == $month_end && $last_year) {
373 373
 
374 374
 						$num_of_days = $dates['day_end'];
375 375
 
376 376
 					} else {
377 377
 
378
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
378
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
379 379
 
380 380
 					}
381 381
 
382 382
 					$d = $dates['day'];
383
-					while ( $d <= $num_of_days ) :
383
+					while ($d <= $num_of_days) :
384 384
 
385
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
386
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
385
+						$date     = mktime(0, 0, 0, $i, $d, $y);
386
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
387 387
 
388
-						$sales         = $stats->get_sales( $form_id, $date, $end_date );
388
+						$sales         = $stats->get_sales($form_id, $date, $end_date);
389 389
 						$sales_totals += $sales;
390 390
 
391
-						$earnings         = $stats->get_earnings( $form_id, $date, $end_date );
391
+						$earnings         = $stats->get_earnings($form_id, $date, $end_date);
392 392
 						$earnings_totals += $earnings;
393 393
 
394
-						$sales_data[]    = array( $date * 1000, $sales );
395
-						$earnings_data[] = array( $date * 1000, $earnings );
396
-						$d ++;
394
+						$sales_data[]    = array($date * 1000, $sales);
395
+						$earnings_data[] = array($date * 1000, $earnings);
396
+						$d++;
397 397
 
398 398
 					endwhile;
399 399
 
400 400
 				} else {
401 401
 
402
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
402
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
403 403
 
404
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
405
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
404
+					$date     = mktime(0, 0, 0, $i, 1, $y);
405
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
406 406
 
407
-					$sales         = $stats->get_sales( $form_id, $date, $end_date );
407
+					$sales         = $stats->get_sales($form_id, $date, $end_date);
408 408
 					$sales_totals += $sales;
409 409
 
410
-					$earnings         = $stats->get_earnings( $form_id, $date, $end_date );
410
+					$earnings         = $stats->get_earnings($form_id, $date, $end_date);
411 411
 					$earnings_totals += $earnings;
412 412
 
413
-					$sales_data[]    = array( $date * 1000, $sales );
414
-					$earnings_data[] = array( $date * 1000, $earnings );
413
+					$sales_data[]    = array($date * 1000, $sales);
414
+					$earnings_data[] = array($date * 1000, $earnings);
415 415
 
416 416
 				}
417 417
 
418
-				$i ++;
418
+				$i++;
419 419
 
420 420
 			endwhile;
421 421
 
422
-			$y ++;
422
+			$y++;
423 423
 		endwhile;
424 424
 
425 425
 	}
426 426
 
427 427
 	$data = array(
428
-		__( 'Income', 'give' )    => $earnings_data,
429
-		__( 'Donations', 'give' ) => $sales_data,
428
+		__('Income', 'give')    => $earnings_data,
429
+		__('Donations', 'give') => $sales_data,
430 430
 	);
431 431
 
432 432
 	?>
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	<?php
435 435
 			printf(
436 436
 				/* translators: %s: form title */
437
-				esc_html__( 'Income Report for %s', 'give' ),
438
-				get_the_title( $form_id )
437
+				esc_html__('Income Report for %s', 'give'),
438
+				get_the_title($form_id)
439 439
 			);
440 440
 			?>
441 441
 			</span></h3>
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 				<div class="inside">
446 446
 					<?php give_reports_graph_controls(); ?>
447 447
 					<?php
448
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
449
-					$graph->set( 'x_mode', 'time' );
450
-					$graph->set( 'multiple_y_axes', true );
448
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
449
+					$graph->set('x_mode', 'time');
450
+					$graph->set('multiple_y_axes', true);
451 451
 					$graph->display();
452 452
 					?>
453 453
 				</div>
@@ -456,20 +456,20 @@  discard block
 block discarded – undo
456 456
 			<table class="widefat reports-table alignleft" style="max-width:450px">
457 457
 				<tbody>
458 458
 				<tr>
459
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
460
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
459
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
460
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
461 461
 				</tr>
462 462
 				<tr class="alternate">
463
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th>
463
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?></strong></th>
464 464
 					<td><?php echo $sales_totals; ?></td>
465 465
 				</tr>
466 466
 				<tr>
467
-					<th scope="row"><strong><?php _e( 'Average monthly income:', 'give' ); ?></strong></th>
468
-					<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td>
467
+					<th scope="row"><strong><?php _e('Average monthly income:', 'give'); ?></strong></th>
468
+					<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id), array('sanitize' => false))); ?></td>
469 469
 				</tr>
470 470
 				<tr class="alternate">
471
-					<th scope="row"><strong><?php _e( 'Average monthly donations:', 'give' ); ?></strong></th>
472
-					<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
471
+					<th scope="row"><strong><?php _e('Average monthly donations:', 'give'); ?></strong></th>
472
+					<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
473 473
 				</tr>
474 474
 				</tbody>
475 475
 			</table>
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			 *
483 483
 			 * @since 1.0
484 484
 			 */
485
-			do_action( 'give_reports_graph_additional_stats' );
485
+			do_action('give_reports_graph_additional_stats');
486 486
 			?>
487 487
 
488 488
 		</div>
@@ -502,26 +502,26 @@  discard block
 block discarded – undo
502 502
 function give_reports_graph_controls() {
503 503
 	$date_options = apply_filters(
504 504
 		'give_report_date_options', array(
505
-			'today'        => __( 'Today', 'give' ),
506
-			'yesterday'    => __( 'Yesterday', 'give' ),
507
-			'this_week'    => __( 'This Week', 'give' ),
508
-			'last_week'    => __( 'Last Week', 'give' ),
509
-			'this_month'   => __( 'This Month', 'give' ),
510
-			'last_month'   => __( 'Last Month', 'give' ),
511
-			'this_quarter' => __( 'This Quarter', 'give' ),
512
-			'last_quarter' => __( 'Last Quarter', 'give' ),
513
-			'this_year'    => __( 'This Year', 'give' ),
514
-			'last_year'    => __( 'Last Year', 'give' ),
515
-			'other'        => __( 'Custom', 'give' ),
505
+			'today'        => __('Today', 'give'),
506
+			'yesterday'    => __('Yesterday', 'give'),
507
+			'this_week'    => __('This Week', 'give'),
508
+			'last_week'    => __('Last Week', 'give'),
509
+			'this_month'   => __('This Month', 'give'),
510
+			'last_month'   => __('Last Month', 'give'),
511
+			'this_quarter' => __('This Quarter', 'give'),
512
+			'last_quarter' => __('Last Quarter', 'give'),
513
+			'this_year'    => __('This Year', 'give'),
514
+			'last_year'    => __('Last Year', 'give'),
515
+			'other'        => __('Custom', 'give'),
516 516
 		)
517 517
 	);
518 518
 
519 519
 	$dates   = give_get_report_dates();
520 520
 	$display = $dates['range'] == 'other' ? '' : 'display: none;';
521
-	$tab     = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
521
+	$tab     = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
522 522
 
523
-	if ( empty( $dates['day_end'] ) ) {
524
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
523
+	if (empty($dates['day_end'])) {
524
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
525 525
 	}
526 526
 
527 527
 	/**
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @since 1.0
531 531
 	 */
532
-	do_action( 'give_report_graph_controls_before' );
532
+	do_action('give_report_graph_controls_before');
533 533
 	?>
534 534
 	<form id="give-graphs-filter" method="get">
535 535
 		<div class="tablenav top">
@@ -537,56 +537,56 @@  discard block
 block discarded – undo
537 537
 
538 538
 				<input type="hidden" name="post_type" value="give_forms" />
539 539
 				<input type="hidden" name="page" value="give-reports" />
540
-				<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
540
+				<input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" />
541 541
 
542
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
543
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
542
+				<?php if (isset($_GET['form-id'])) : ?>
543
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
544 544
 				<?php endif; ?>
545 545
 
546 546
 				<div id="give-graphs-date-options-wrap">
547 547
 					<select id="give-graphs-date-options" name="range">
548
-						<?php foreach ( $date_options as $key => $option ) : ?>
549
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
548
+						<?php foreach ($date_options as $key => $option) : ?>
549
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
550 550
 						<?php endforeach; ?>
551 551
 					</select>
552 552
 
553
-					<div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>">
554
-						<span class="screen-reader-text"><?php _e( 'From', 'give' ); ?>&nbsp;</span>
553
+					<div id="give-date-range-options" style="<?php echo esc_attr($display); ?>">
554
+						<span class="screen-reader-text"><?php _e('From', 'give'); ?>&nbsp;</span>
555 555
 						<select id="give-graphs-month-start" name="m_start" aria-label="Start Month">
556
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
557
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
556
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
557
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
558 558
 							<?php endfor; ?>
559 559
 						</select>
560 560
 						<select id="give-graphs-day-start" name="day" aria-label="Start Day">
561
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
562
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option>
561
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
562
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option>
563 563
 							<?php endfor; ?>
564 564
 						</select>
565 565
 						<select id="give-graphs-year-start" name="year" aria-label="Start Year">
566
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
567
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option>
566
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
567
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option>
568 568
 							<?php endfor; ?>
569 569
 						</select>
570
-						<span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
570
+						<span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
571 571
 						<span>&ndash;</span>
572 572
 						<select id="give-graphs-month-end" name="m_end" aria-label="End Month">
573
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
574
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
573
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
574
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
575 575
 							<?php endfor; ?>
576 576
 						</select>
577 577
 						<select id="give-graphs-day-end" name="day_end" aria-label="End Day">
578
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
579
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
578
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
579
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option>
580 580
 							<?php endfor; ?>
581 581
 						</select>
582 582
 						<select id="give-graphs-year-end" name="year_end" aria-label="End Year">
583
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
584
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
583
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
584
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option>
585 585
 							<?php endfor; ?>
586 586
 						</select>
587 587
 					</div>
588 588
 
589
-					<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" />
589
+					<input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" />
590 590
 				</div>
591 591
 
592 592
 				<input type="hidden" name="give_action" value="filter_reports" />
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	 *
600 600
 	 * @since 1.0
601 601
 	 */
602
-	do_action( 'give_report_graph_controls_after' );
602
+	do_action('give_report_graph_controls_after');
603 603
 }
604 604
 
605 605
 /**
@@ -615,66 +615,66 @@  discard block
 block discarded – undo
615 615
 function give_get_report_dates() {
616 616
 	$dates = array();
617 617
 
618
-	$current_time = current_time( 'timestamp' );
618
+	$current_time = current_time('timestamp');
619 619
 
620
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
621
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
622
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
623
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
624
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
625
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
626
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
620
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
621
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
622
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
623
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
624
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
625
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
626
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
627 627
 
628 628
 	// Modify dates based on predefined ranges.
629
-	switch ( $dates['range'] ) :
629
+	switch ($dates['range']) :
630 630
 
631 631
 		case 'this_month':
632
-			$dates['m_start']  = date( 'n', $current_time );
633
-			$dates['m_end']    = date( 'n', $current_time );
632
+			$dates['m_start']  = date('n', $current_time);
633
+			$dates['m_end']    = date('n', $current_time);
634 634
 			$dates['day']      = 1;
635
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
636
-			$dates['year']     = date( 'Y' );
637
-			$dates['year_end'] = date( 'Y' );
635
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
636
+			$dates['year']     = date('Y');
637
+			$dates['year_end'] = date('Y');
638 638
 			break;
639 639
 
640 640
 		case 'last_month':
641
-			if ( date( 'n' ) == 1 ) {
641
+			if (date('n') == 1) {
642 642
 				$dates['m_start']  = 12;
643 643
 				$dates['m_end']    = 12;
644
-				$dates['year']     = date( 'Y', $current_time ) - 1;
645
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
644
+				$dates['year']     = date('Y', $current_time) - 1;
645
+				$dates['year_end'] = date('Y', $current_time) - 1;
646 646
 			} else {
647
-				$dates['m_start']  = date( 'n' ) - 1;
648
-				$dates['m_end']    = date( 'n' ) - 1;
647
+				$dates['m_start']  = date('n') - 1;
648
+				$dates['m_end']    = date('n') - 1;
649 649
 				$dates['year_end'] = $dates['year'];
650 650
 			}
651
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
651
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
652 652
 			break;
653 653
 
654 654
 		case 'today':
655
-			$dates['day']      = date( 'd', $current_time );
656
-			$dates['day_end']  = date( 'd', $current_time );
657
-			$dates['m_start']  = date( 'n', $current_time );
658
-			$dates['m_end']    = date( 'n', $current_time );
659
-			$dates['year']     = date( 'Y', $current_time );
660
-			$dates['year_end'] = date( 'Y', $current_time );
655
+			$dates['day']      = date('d', $current_time);
656
+			$dates['day_end']  = date('d', $current_time);
657
+			$dates['m_start']  = date('n', $current_time);
658
+			$dates['m_end']    = date('n', $current_time);
659
+			$dates['year']     = date('Y', $current_time);
660
+			$dates['year_end'] = date('Y', $current_time);
661 661
 			break;
662 662
 
663 663
 		case 'yesterday':
664
-			$year  = date( 'Y', $current_time );
665
-			$month = date( 'n', $current_time );
666
-			$day   = date( 'd', $current_time );
664
+			$year  = date('Y', $current_time);
665
+			$month = date('n', $current_time);
666
+			$day   = date('d', $current_time);
667 667
 
668
-			if ( $month == 1 && $day == 1 ) {
668
+			if ($month == 1 && $day == 1) {
669 669
 
670 670
 				$year -= 1;
671 671
 				$month = 12;
672
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
672
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
673 673
 
674
-			} elseif ( $month > 1 && $day == 1 ) {
674
+			} elseif ($month > 1 && $day == 1) {
675 675
 
676 676
 				$month -= 1;
677
-				$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
677
+				$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
678 678
 
679 679
 			} else {
680 680
 
@@ -690,48 +690,48 @@  discard block
 block discarded – undo
690 690
 			break;
691 691
 
692 692
 		case 'this_week':
693
-			$dates['day']     = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
694
-			$dates['day']    += get_option( 'start_of_week' );
693
+			$dates['day']     = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
694
+			$dates['day']    += get_option('start_of_week');
695 695
 			$dates['day_end'] = $dates['day'] + 6;
696
-			$dates['m_start'] = date( 'n', $current_time );
697
-			$dates['m_end']   = date( 'n', $current_time );
698
-			$dates['year']    = date( 'Y', $current_time );
696
+			$dates['m_start'] = date('n', $current_time);
697
+			$dates['m_end']   = date('n', $current_time);
698
+			$dates['year']    = date('Y', $current_time);
699 699
 			break;
700 700
 
701 701
 		case 'last_week':
702
-			$dates['day']     = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
703
-			$dates['day']    += get_option( 'start_of_week' );
702
+			$dates['day']     = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
703
+			$dates['day']    += get_option('start_of_week');
704 704
 			$dates['day_end'] = $dates['day'] + 6;
705
-			$dates['year']    = date( 'Y' );
706
-
707
-			if ( date( 'j', $current_time ) <= 7 ) {
708
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
709
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
710
-				if ( $dates['m_start'] <= 1 ) {
711
-					$dates['year']     = date( 'Y', $current_time ) - 1;
712
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
705
+			$dates['year']    = date('Y');
706
+
707
+			if (date('j', $current_time) <= 7) {
708
+				$dates['m_start'] = date('n', $current_time) - 1;
709
+				$dates['m_end']   = date('n', $current_time) - 1;
710
+				if ($dates['m_start'] <= 1) {
711
+					$dates['year']     = date('Y', $current_time) - 1;
712
+					$dates['year_end'] = date('Y', $current_time) - 1;
713 713
 				}
714 714
 			} else {
715
-				$dates['m_start'] = date( 'n', $current_time );
716
-				$dates['m_end']   = date( 'n', $current_time );
715
+				$dates['m_start'] = date('n', $current_time);
716
+				$dates['m_end']   = date('n', $current_time);
717 717
 			}
718 718
 			break;
719 719
 
720 720
 		case 'this_quarter':
721
-			$month_now     = date( 'n', $current_time );
722
-			$dates['year'] = date( 'Y', $current_time );
721
+			$month_now     = date('n', $current_time);
722
+			$dates['year'] = date('Y', $current_time);
723 723
 
724
-			if ( $month_now <= 3 ) {
724
+			if ($month_now <= 3) {
725 725
 
726 726
 				$dates['m_start'] = 1;
727 727
 				$dates['m_end']   = 4;
728 728
 
729
-			} elseif ( $month_now <= 6 ) {
729
+			} elseif ($month_now <= 6) {
730 730
 
731 731
 				$dates['m_start'] = 4;
732 732
 				$dates['m_end']   = 7;
733 733
 
734
-			} elseif ( $month_now <= 9 ) {
734
+			} elseif ($month_now <= 9) {
735 735
 
736 736
 				$dates['m_start'] = 7;
737 737
 				$dates['m_end']   = 10;
@@ -740,28 +740,28 @@  discard block
 block discarded – undo
740 740
 
741 741
 				$dates['m_start']  = 10;
742 742
 				$dates['m_end']    = 1;
743
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
743
+				$dates['year_end'] = date('Y', $current_time) + 1;
744 744
 
745 745
 			}
746 746
 			break;
747 747
 
748 748
 		case 'last_quarter':
749
-			$month_now         = date( 'n', $current_time );
750
-			$dates['year']     = date( 'Y', $current_time );
751
-			$dates['year_end'] = date( 'Y', $current_time );
749
+			$month_now         = date('n', $current_time);
750
+			$dates['year']     = date('Y', $current_time);
751
+			$dates['year_end'] = date('Y', $current_time);
752 752
 
753
-			if ( $month_now <= 3 ) {
753
+			if ($month_now <= 3) {
754 754
 
755 755
 				$dates['m_start'] = 10;
756 756
 				$dates['m_end']   = 1;
757
-				$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year.
757
+				$dates['year']    = date('Y', $current_time) - 1; // Previous year.
758 758
 
759
-			} elseif ( $month_now <= 6 ) {
759
+			} elseif ($month_now <= 6) {
760 760
 
761 761
 				$dates['m_start'] = 1;
762 762
 				$dates['m_end']   = 4;
763 763
 
764
-			} elseif ( $month_now <= 9 ) {
764
+			} elseif ($month_now <= 9) {
765 765
 
766 766
 				$dates['m_start'] = 4;
767 767
 				$dates['m_end']   = 7;
@@ -777,20 +777,20 @@  discard block
 block discarded – undo
777 777
 		case 'this_year':
778 778
 			$dates['m_start']  = 1;
779 779
 			$dates['m_end']    = 12;
780
-			$dates['year']     = date( 'Y', $current_time );
781
-			$dates['year_end'] = date( 'Y', $current_time );
780
+			$dates['year']     = date('Y', $current_time);
781
+			$dates['year_end'] = date('Y', $current_time);
782 782
 			break;
783 783
 
784 784
 		case 'last_year':
785 785
 			$dates['m_start']  = 1;
786 786
 			$dates['m_end']    = 12;
787
-			$dates['year']     = date( 'Y', $current_time ) - 1;
788
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
787
+			$dates['year']     = date('Y', $current_time) - 1;
788
+			$dates['year_end'] = date('Y', $current_time) - 1;
789 789
 			break;
790 790
 
791 791
 	endswitch;
792 792
 
793
-	return apply_filters( 'give_report_dates', $dates );
793
+	return apply_filters('give_report_dates', $dates);
794 794
 }
795 795
 
796 796
 /**
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
  *
802 802
  * @param $data
803 803
  */
804
-function give_parse_report_dates( $data ) {
804
+function give_parse_report_dates($data) {
805 805
 	$dates = give_get_report_dates();
806 806
 
807 807
 	$view = give_get_reporting_view();
808
-	$tab  = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
809
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
808
+	$tab  = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
809
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
810 810
 
811
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
811
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id))));
812 812
 	give_die();
813 813
 }
814 814
 
815
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
815
+add_action('give_filter_reports', 'give_parse_report_dates');
816 816
 
817 817
 
818 818
 /**
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 
836 836
 	echo Give()->tooltips->render_link(
837 837
 		array(
838
-			'label'       => esc_attr__( 'Clicking this will clear the reports cache.', 'give' ),
839
-			'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' . esc_html__( 'Refresh Report Data', 'give' ),
838
+			'label'       => esc_attr__('Clicking this will clear the reports cache.', 'give'),
839
+			'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>'.esc_html__('Refresh Report Data', 'give'),
840 840
 			'link'        => $url,
841 841
 			'position'    => 'left',
842 842
 			'attributes'  => array(
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 	);
847 847
 }
848 848
 
849
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
849
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
850 850
 
851 851
 /**
852 852
  * Trigger the refresh of reports transients
@@ -857,20 +857,20 @@  discard block
 block discarded – undo
857 857
  *
858 858
  * @return void
859 859
  */
860
-function give_run_refresh_reports_transients( $data ) {
860
+function give_run_refresh_reports_transients($data) {
861 861
 
862
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
862
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
863 863
 		return;
864 864
 	}
865 865
 
866 866
 	// Monthly stats.
867
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
867
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
868 868
 
869 869
 	// Total earning.
870
-	delete_option( 'give_earnings_total' );
870
+	delete_option('give_earnings_total');
871 871
 
872 872
 	// @todo: Refresh only range related stat cache
873 873
 	give_delete_donation_stats();
874 874
 }
875 875
 
876
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
876
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
Please login to merge, or discard this patch.