Test Failed
Push — master ( 95d83a...9f58db )
by Devin
11:53 queued 05:36
created
includes/admin/tools/views/html-admin-page-imports.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Imports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.8.14
20 20
 				 */
21
-				do_action( 'give_tools_tab_import_content_top' );
21
+				do_action('give_tools_tab_import_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat Import-options-table give-table">
25 25
 					<thead>
26 26
 					<tr>
27
-						<th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th>
28
-						<th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th>
27
+						<th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th>
28
+						<th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th>
29 29
 					</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 					 *
39 39
 					 * @since 1.8.14
40 40
 					 */
41
-					do_action( 'give_tools_tab_import_table_top' );
41
+					do_action('give_tools_tab_import_table_top');
42 42
 					?>
43 43
 
44 44
 					<tr class="give-Import-pdf-sales-earnings">
45 45
 						<td scope="row" class="row-title">
46 46
 							<h3>
47
-								<span><?php esc_html_e( 'Import Donations', 'give' ); ?></span>
47
+								<span><?php esc_html_e('Import Donations', 'give'); ?></span>
48 48
 							</h3>
49
-							<p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p>
49
+							<p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p>
50 50
 						</td>
51 51
 						<td>
52
-							<a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>">
53
-								<?php esc_html_e( 'Import CSV', 'give' ); ?>
52
+							<a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>">
53
+								<?php esc_html_e('Import CSV', 'give'); ?>
54 54
 							</a>
55 55
 						</td>
56 56
 					</tr>
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 					<tr class="give-import-core-settings">
59 59
 						<td scope="row" class="row-title">
60 60
 							<h3>
61
-								<span><?php esc_html_e( 'Import Give Settings', 'give' ); ?></span>
61
+								<span><?php esc_html_e('Import Give Settings', 'give'); ?></span>
62 62
 							</h3>
63
-							<p><?php esc_html_e( 'Import Give\'s settings in JSON format.', 'give' ); ?></p>
63
+							<p><?php esc_html_e('Import Give\'s settings in JSON format.', 'give'); ?></p>
64 64
 						</td>
65 65
 						<td>
66
-							<a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_core_setting' ) ); ?>">
67
-								<?php esc_html_e( 'Import JSON', 'give' ); ?>
66
+							<a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_core_setting')); ?>">
67
+								<?php esc_html_e('Import JSON', 'give'); ?>
68 68
 							</a>
69 69
 						</td>
70 70
 					</tr>
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 					 *
79 79
 					 * @since 1.8.14
80 80
 					 */
81
-					do_action( 'give_tools_tab_import_table_bottom' );
81
+					do_action('give_tools_tab_import_table_bottom');
82 82
 					?>
83 83
 					</tbody>
84 84
 				</table>
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 				 *
90 90
 				 * @since 1.8.14
91 91
 				 */
92
-				do_action( 'give_tools_tab_import_content_bottom' );
92
+				do_action('give_tools_tab_import_content_bottom');
93 93
 				?>
94 94
 
95 95
 			</div>
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-import-core-settings.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Import Core Settings
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.8.17
18 18
  */
19
-do_action( 'give_tools_import_core_settings_main_before' );
19
+do_action('give_tools_import_core_settings_main_before');
20 20
 ?>
21 21
 	<div id="poststuff">
22 22
 		<div class="postbox">
23
-			<h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Settings', 'give' ); ?></h1>
23
+			<h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Settings', 'give'); ?></h1>
24 24
 			<div class="inside give-tools-setting-page-import give-import-core-settings">
25 25
 				<?php
26 26
 				/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 				 *
29 29
 				 * @since 1.8.17
30 30
 				 */
31
-				do_action( 'give_tools_import_core_settings_form_before_start' );
31
+				do_action('give_tools_import_core_settings_form_before_start');
32 32
 				?>
33 33
 				<form method="post" id="give-import-core-settings-form"
34 34
 				      class="give-import-form tools-setting-page-import tools-setting-page-import"
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 					 *
41 41
 					 * @since 1.8.17
42 42
 					 */
43
-					do_action( 'give_tools_import_core_settings_form_start' );
43
+					do_action('give_tools_import_core_settings_form_start');
44 44
 					?>
45 45
 
46 46
 					<?php
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 					 *
50 50
 					 * @since 1.8.17
51 51
 					 */
52
-					do_action( 'give_tools_import_core_settings_form_end' );
52
+					do_action('give_tools_import_core_settings_form_end');
53 53
 					?>
54 54
 				</form>
55 55
 				<?php
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				 *
59 59
 				 * @since 1.8.17
60 60
 				 */
61
-				do_action( 'give_tools_import_core_settings_form_after_end' );
61
+				do_action('give_tools_import_core_settings_form_after_end');
62 62
 				?>
63 63
 			</div><!-- .inside -->
64 64
 		</div><!-- .postbox -->
@@ -69,4 +69,4 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @since 1.8.17
71 71
  */
72
-do_action( 'give_tools_import_core_settings_main_after' );
72
+do_action('give_tools_import_core_settings_main_after');
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-system-info.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_System_Info' ) ) :
16
+if ( ! class_exists('Give_Settings_System_Info')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_System_Info.
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'system-info';
37
-			$this->label = esc_html__( 'System Info', 'give' );
37
+			$this->label = esc_html__('System Info', 'give');
38 38
 
39 39
 			parent::__construct();
40 40
 
41 41
 			// Do not use main form for this tab.
42
-			if ( give_get_current_setting_tab() === $this->id ) {
43
-				add_action( "give-tools_open_form", '__return_empty_string' );
44
-				add_action( "give-tools_close_form", '__return_empty_string' );
42
+			if (give_get_current_setting_tab() === $this->id) {
43
+				add_action("give-tools_open_form", '__return_empty_string');
44
+				add_action("give-tools_close_form", '__return_empty_string');
45 45
 			}
46 46
 		}
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 */
54 54
 		public function output() {
55 55
 			$GLOBALS['give_hide_save_button'] = true;
56
-			include_once( 'views/html-admin-page-system-info.php' );
56
+			include_once('views/html-admin-page-system-info.php');
57 57
 		}
58 58
 	}
59 59
 
Please login to merge, or discard this patch.
includes/admin/reports/class-gateways-reports-table.php 1 patch
Spacing   +48 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		$donation_list_page_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
67
+	public function column_default($item, $column_name) {
68
+		$donation_list_page_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
69 69
 
70
-		switch ( $column_name ) {
70
+		switch ($column_name) {
71 71
 			case 'complete_sales':
72
-				$value = $item[ $column_name ] ?
72
+				$value = $item[$column_name] ?
73 73
 					sprintf(
74 74
 						'<a href="%s">%s</a>',
75 75
 						add_query_arg(
@@ -79,13 +79,12 @@  discard block
 block discarded – undo
79 79
 							),
80 80
 							$donation_list_page_url
81 81
 						),
82
-						$item[ $column_name ]
83
-					) :
84
-					$item[ $column_name ];
82
+						$item[$column_name]
83
+					) : $item[$column_name];
85 84
 				break;
86 85
 
87 86
 			case 'pending_sales':
88
-				$value = $item[ $column_name ] ?
87
+				$value = $item[$column_name] ?
89 88
 					sprintf(
90 89
 						'<a href="%s">%s</a>',
91 90
 						add_query_arg(
@@ -95,13 +94,12 @@  discard block
 block discarded – undo
95 94
 							),
96 95
 							$donation_list_page_url
97 96
 						),
98
-						$item[ $column_name ]
99
-					) :
100
-					$item[ $column_name ];
97
+						$item[$column_name]
98
+					) : $item[$column_name];
101 99
 				break;
102 100
 
103 101
 			case 'total_sales':
104
-				$value = $item[ $column_name ] ?
102
+				$value = $item[$column_name] ?
105 103
 					sprintf(
106 104
 						'<a href="%s">%s</a>',
107 105
 						add_query_arg(
@@ -110,14 +108,13 @@  discard block
 block discarded – undo
110 108
 							),
111 109
 							$donation_list_page_url
112 110
 						),
113
-						$item[ $column_name ]
114
-					) :
115
-					$item[ $column_name ];
111
+						$item[$column_name]
112
+					) : $item[$column_name];
116 113
 
117 114
 				break;
118 115
 
119 116
 			default:
120
-				$value = $item[ $column_name ];
117
+				$value = $item[$column_name];
121 118
 		}
122 119
 
123 120
 		return $value;
@@ -132,11 +129,11 @@  discard block
 block discarded – undo
132 129
 	 */
133 130
 	public function get_columns() {
134 131
 		$columns = array(
135
-			'label'           => esc_attr__( 'Gateway', 'give' ),
136
-			'complete_sales'  => esc_attr__( 'Complete Payments', 'give' ),
137
-			'pending_sales'   => esc_attr__( 'Pending / Failed Payments', 'give' ),
138
-			'total_sales'     => esc_attr__( 'Total Payments', 'give' ),
139
-			'total_donations' => esc_attr__( 'Total Donated', 'give' )
132
+			'label'           => esc_attr__('Gateway', 'give'),
133
+			'complete_sales'  => esc_attr__('Complete Payments', 'give'),
134
+			'pending_sales'   => esc_attr__('Pending / Failed Payments', 'give'),
135
+			'total_sales'     => esc_attr__('Total Payments', 'give'),
136
+			'total_donations' => esc_attr__('Total Donated', 'give')
140 137
 		);
141 138
 
142 139
 		return $columns;
@@ -151,7 +148,7 @@  discard block
 block discarded – undo
151 148
 	 */
152 149
 	public function get_sortable_columns() {
153 150
 		return array(
154
-			'total_donations' => array( 'total_donations', false )
151
+			'total_donations' => array('total_donations', false)
155 152
 		);
156 153
 	}
157 154
 
@@ -164,7 +161,7 @@  discard block
 block discarded – undo
164 161
 	 * @return int Current page number
165 162
 	 */
166 163
 	public function get_paged() {
167
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
164
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
168 165
 	}
169 166
 
170 167
 
@@ -175,7 +172,7 @@  discard block
 block discarded – undo
175 172
 	 * @since  1.0
176 173
 	 * @return void
177 174
 	 */
178
-	public function bulk_actions( $which = '' ) {
175
+	public function bulk_actions($which = '') {
179 176
 
180 177
 	}
181 178
 
@@ -187,27 +184,27 @@  discard block
 block discarded – undo
187 184
 	 *
188 185
 	 * @param string $which
189 186
 	 */
190
-	protected function display_tablenav( $which ) {
187
+	protected function display_tablenav($which) {
191 188
 
192
-		if ( 'top' === $which ) {
193
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
189
+		if ('top' === $which) {
190
+			wp_nonce_field('bulk-'.$this->_args['plural']);
194 191
 		}
195 192
 		?>
196
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
193
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
197 194
 
198
-			<?php if ( 'top' === $which ) { ?>
195
+			<?php if ('top' === $which) { ?>
199 196
 				<h2 class="alignleft reports-earnings-title screen-reader-text">
200
-					<?php _e( 'Donation Methods Report', 'give' ); ?>
197
+					<?php _e('Donation Methods Report', 'give'); ?>
201 198
 				</h2>
202 199
 			<?php } ?>
203 200
 
204 201
 			<div class="alignright tablenav-right">
205 202
 				<div class="actions bulkactions">
206
-					<?php $this->bulk_actions( $which ); ?>
203
+					<?php $this->bulk_actions($which); ?>
207 204
 				</div>
208 205
 				<?php
209
-				$this->extra_tablenav( $which );
210
-				$this->pagination( $which );
206
+				$this->extra_tablenav($which);
207
+				$this->pagination($which);
211 208
 				?>
212 209
 			</div>
213 210
 
@@ -229,17 +226,17 @@  discard block
 block discarded – undo
229 226
 	 *
230 227
 	 * @return int
231 228
 	 */
232
-	public function give_sort_total_donations( $old_value, $new_value ) {
229
+	public function give_sort_total_donations($old_value, $new_value) {
233 230
 		// If no sort, default to label.
234
-		$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label';
231
+		$orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label';
235 232
 
236 233
 		//If no order, default to asc.
237
-		$order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc';
234
+		$order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
238 235
 
239 236
 		//Determine sort order.
240
-		$result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] );
237
+		$result = strcmp($old_value[$orderby], $new_value[$orderby]);
241 238
 
242
-		return ( $order === 'asc' ) ? $result : -$result;
239
+		return ($order === 'asc') ? $result : -$result;
243 240
 	}
244 241
 
245 242
 
@@ -256,10 +253,10 @@  discard block
 block discarded – undo
256 253
 		$gateways     = give_get_payment_gateways();
257 254
 		$stats        = new Give_Payment_Stats();
258 255
 
259
-		foreach ( $gateways as $gateway_id => $gateway ) {
256
+		foreach ($gateways as $gateway_id => $gateway) {
260 257
 
261
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
262
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
258
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
259
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
263 260
 
264 261
 			$reports_data[] = array(
265 262
 				'ID'              => $gateway_id,
@@ -267,7 +264,7 @@  discard block
 block discarded – undo
267 264
 				'complete_sales'  => $complete_count,
268 265
 				'pending_sales'   => $pending_count,
269 266
 				'total_sales'     => $complete_count + $pending_count,
270
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ),
267
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))),
271 268
 			);
272 269
 		}
273 270
 
@@ -288,11 +285,11 @@  discard block
 block discarded – undo
288 285
 		$columns               = $this->get_columns();
289 286
 		$hidden                = array(); // No hidden columns
290 287
 		$sortable              = $this->get_sortable_columns();
291
-		$this->_column_headers = array( $columns, $hidden, $sortable );
288
+		$this->_column_headers = array($columns, $hidden, $sortable);
292 289
 		$this->items           = $this->reports_data();
293 290
 
294 291
 		// Sort Array when we are sorting data in array.
295
-		usort( $this->items, array( $this, 'give_sort_total_donations' ) );
292
+		usort($this->items, array($this, 'give_sort_total_donations'));
296 293
 
297 294
 	}
298 295
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades-complete.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 ?>
17 17
 <div class="wrap" id="poststuff">
18 18
 	<div id="give-updates">
19
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1>
19
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1>
20 20
 		<hr class="wp-header-end">
21 21
 
22 22
 		<div class="give-update-panel-content">
23
-			<p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and its add-ons.', 'give' ); ?></p>
23
+			<p><?php esc_html_e('Congratulations! You are running the latest versions of Give and its add-ons.', 'give'); ?></p>
24 24
 		</div>
25 25
 
26 26
 	</div>
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export-earnings.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 		give_ignore_user_abort();
42 42
 
43 43
 		nocache_headers();
44
-		header( 'Content-Type: text/csv; charset=utf-8' );
45
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
46
-		header( "Expires: 0" );
44
+		header('Content-Type: text/csv; charset=utf-8');
45
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
46
+		header("Expires: 0");
47 47
 
48 48
 	}
49 49
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	public function csv_cols() {
58 58
 
59 59
 		$cols = array(
60
-			'date'      => __( 'Date', 'give' ),
61
-			'donations' => __( 'Donations', 'give' ),
60
+			'date'      => __('Date', 'give'),
61
+			'donations' => __('Donations', 'give'),
62 62
 			/* translators: %s: currency */
63
-			'earnings'  => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) )
63
+			'earnings'  => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true))
64 64
 		);
65 65
 
66 66
 		return $cols;
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function get_data() {
77 77
 
78
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
79
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
80
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
81
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
78
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
79
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
80
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
81
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
82 82
 
83 83
 		$data  = array();
84 84
 		$year  = $start_year;
85 85
 		$stats = new Give_Payment_Stats;
86 86
 
87
-		while ( $year <= $end_year ) {
87
+		while ($year <= $end_year) {
88 88
 
89
-			if ( $year == $start_year && $year == $end_year ) {
89
+			if ($year == $start_year && $year == $end_year) {
90 90
 
91 91
 				$m1 = $start_month;
92 92
 				$m2 = $end_month;
93 93
 
94
-			} elseif ( $year == $start_year ) {
94
+			} elseif ($year == $start_year) {
95 95
 
96 96
 				$m1 = $start_month;
97 97
 				$m2 = 12;
98 98
 
99
-			} elseif ( $year == $end_year ) {
99
+			} elseif ($year == $end_year) {
100 100
 
101 101
 				$m1 = 1;
102 102
 				$m2 = $end_month;
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
 
109 109
 			}
110 110
 
111
-			while ( $m1 <= $m2 ) {
111
+			while ($m1 <= $m2) {
112 112
 
113
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
114
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
113
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
114
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
115 115
 
116 116
 				$data[] = array(
117
-					'date'      => date_i18n( 'F Y', $date1 ),
118
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
119
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ),
117
+					'date'      => date_i18n('F Y', $date1),
118
+					'donations' => $stats->get_sales(0, $date1, $date2),
119
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)),
120 120
 				);
121 121
 
122
-				$m1 ++;
122
+				$m1++;
123 123
 
124 124
 			}
125 125
 
126 126
 
127
-			$year ++;
127
+			$year++;
128 128
 
129 129
 		}
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @since 1.8
42 42
  *
43
- * @return bool
43
+ * @return false|null
44 44
  */
45 45
 function give_redirect_to_clean_url_admin_pages() {
46 46
 	// Give admin pages.
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
  * @access public
993 993
  * @since  2.0
994 994
  *
995
- * @return bool
995
+ * @return false|null
996 996
  */
997 997
 function give_update_donor_name_on_user_update( $user_id = 0 ) {
998 998
 
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
  * @param  int          $user_id       User ID.
1033 1033
  * @param  WP_User|bool $old_user_data User data.
1034 1034
  *
1035
- * @return bool
1035
+ * @return false|null
1036 1036
  */
1037 1037
 function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
1038 1038
 
Please login to merge, or discard this patch.
Spacing   +296 added lines, -302 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
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	);
53 53
 
54 54
 	// Get current page.
55
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
55
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
56 56
 
57 57
 	// Bailout.
58 58
 	if (
59
-		empty( $current_page )
60
-		|| empty( $_GET['_wp_http_referer'] )
61
-		|| ! in_array( $current_page, $give_pages )
59
+		empty($current_page)
60
+		|| empty($_GET['_wp_http_referer'])
61
+		|| ! in_array($current_page, $give_pages)
62 62
 	) {
63 63
 		return false;
64 64
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @since 1.8
70 70
 	 */
71
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
71
+	$redirect = apply_filters("give_validate_{$current_page}", true);
72 72
 
73
-	if ( $redirect ) {
73
+	if ($redirect) {
74 74
 		// Redirect.
75 75
 		wp_redirect(
76 76
 			remove_query_arg(
77
-				array( '_wp_http_referer', '_wpnonce' ),
78
-				wp_unslash( $_SERVER['REQUEST_URI'] )
77
+				array('_wp_http_referer', '_wpnonce'),
78
+				wp_unslash($_SERVER['REQUEST_URI'])
79 79
 			)
80 80
 		);
81 81
 		exit;
82 82
 	}
83 83
 }
84 84
 
85
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
85
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
86 86
 
87 87
 
88 88
 /**
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function give_hide_outdated_php_notice() {
98 98
 
99
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
99
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
100 100
 		give_die();
101 101
 	}
102 102
 
103 103
 	// Transient key name.
104 104
 	$transient_key = '_give_hide_outdated_php_notices_shortly';
105 105
 
106
-	if ( Give_Cache::get( $transient_key, true ) ) {
106
+	if (Give_Cache::get($transient_key, true)) {
107 107
 		return;
108 108
 	}
109 109
 
110 110
 	// Hide notice for 24 hours.
111
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
111
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
112 112
 
113 113
 	give_die();
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
117
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
118 118
 
119 119
 /**
120 120
  * Register admin notices.
@@ -123,27 +123,27 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _give_register_admin_notices() {
125 125
 	// Bailout.
126
-	if ( ! is_admin() ) {
126
+	if ( ! is_admin()) {
127 127
 		return;
128 128
 	}
129 129
 
130 130
 	// Bulk action notices.
131 131
 	if (
132
-		isset( $_GET['action'] ) &&
133
-		! empty( $_GET['action'] )
132
+		isset($_GET['action']) &&
133
+		! empty($_GET['action'])
134 134
 	) {
135 135
 
136 136
 		// Add payment bulk notice.
137 137
 		if (
138
-			current_user_can( 'edit_give_payments' ) &&
139
-			isset( $_GET['payment'] ) &&
140
-			! empty( $_GET['payment'] )
138
+			current_user_can('edit_give_payments') &&
139
+			isset($_GET['payment']) &&
140
+			! empty($_GET['payment'])
141 141
 		) {
142
-			$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
142
+			$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
143 143
 
144
-			switch ( $_GET['action'] ) {
144
+			switch ($_GET['action']) {
145 145
 				case 'delete':
146
-					Give()->notices->register_notice( array(
146
+					Give()->notices->register_notice(array(
147 147
 						'id'          => 'bulk_action_delete',
148 148
 						'type'        => 'updated',
149 149
 						'description' => sprintf(
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 							),
156 156
 							$payment_count ),
157 157
 						'show'        => true,
158
-					) );
158
+					));
159 159
 
160 160
 					break;
161 161
 
162 162
 				case 'resend-receipt':
163
-					Give()->notices->register_notice( array(
163
+					Give()->notices->register_notice(array(
164 164
 						'id'          => 'bulk_action_resend_receipt',
165 165
 						'type'        => 'updated',
166 166
 						'description' => sprintf(
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 							$payment_count
174 174
 						),
175 175
 						'show'        => true,
176
-					) );
176
+					));
177 177
 					break;
178 178
 
179 179
 				case 'set-status-publish' :
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 				case 'set-status-cancelled' :
186 186
 				case 'set-status-abandoned' :
187 187
 				case 'set-status-preapproval' :
188
-					Give()->notices->register_notice( array(
188
+					Give()->notices->register_notice(array(
189 189
 						'id'          => 'bulk_action_status_change',
190 190
 						'type'        => 'updated',
191 191
 						'description' => _n(
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 							'give'
196 196
 						),
197 197
 						'show'        => true,
198
-					) );
198
+					));
199 199
 					break;
200 200
 			}// End switch().
201 201
 		}// End if().
@@ -203,239 +203,239 @@  discard block
 block discarded – undo
203 203
 
204 204
 	// Add give message notices.
205 205
 	$message_notices = give_get_admin_messages_key();
206
-	if ( ! empty( $message_notices ) ) {
207
-		foreach ( $message_notices as $message_notice ) {
206
+	if ( ! empty($message_notices)) {
207
+		foreach ($message_notices as $message_notice) {
208 208
 			// Donation reports errors.
209
-			if ( current_user_can( 'view_give_reports' ) ) {
210
-				switch ( $message_notice ) {
209
+			if (current_user_can('view_give_reports')) {
210
+				switch ($message_notice) {
211 211
 					case 'donation-deleted' :
212
-						Give()->notices->register_notice( array(
212
+						Give()->notices->register_notice(array(
213 213
 							'id'          => 'give-donation-deleted',
214 214
 							'type'        => 'updated',
215
-							'description' => __( 'The donation has been deleted.', 'give' ),
215
+							'description' => __('The donation has been deleted.', 'give'),
216 216
 							'show'        => true,
217
-						) );
217
+						));
218 218
 						break;
219 219
 					case 'email-sent' :
220
-						Give()->notices->register_notice( array(
220
+						Give()->notices->register_notice(array(
221 221
 							'id'          => 'give-email-sent',
222 222
 							'type'        => 'updated',
223
-							'description' => __( 'The donation receipt has been resent.', 'give' ),
223
+							'description' => __('The donation receipt has been resent.', 'give'),
224 224
 							'show'        => true,
225
-						) );
225
+						));
226 226
 						break;
227 227
 					case 'refreshed-reports' :
228
-						Give()->notices->register_notice( array(
228
+						Give()->notices->register_notice(array(
229 229
 							'id'          => 'give-refreshed-reports',
230 230
 							'type'        => 'updated',
231
-							'description' => __( 'The reports cache has been cleared.', 'give' ),
231
+							'description' => __('The reports cache has been cleared.', 'give'),
232 232
 							'show'        => true,
233
-						) );
233
+						));
234 234
 						break;
235 235
 					case 'donation-note-deleted' :
236
-						Give()->notices->register_notice( array(
236
+						Give()->notices->register_notice(array(
237 237
 							'id'          => 'give-donation-note-deleted',
238 238
 							'type'        => 'updated',
239
-							'description' => __( 'The donation note has been deleted.', 'give' ),
239
+							'description' => __('The donation note has been deleted.', 'give'),
240 240
 							'show'        => true,
241
-						) );
241
+						));
242 242
 						break;
243 243
 				}// End switch().
244 244
 			}// End if().
245 245
 
246 246
 			// Give settings notices and errors.
247
-			if ( current_user_can( 'manage_give_settings' ) ) {
248
-				switch ( $message_notice ) {
247
+			if (current_user_can('manage_give_settings')) {
248
+				switch ($message_notice) {
249 249
 					case 'settings-imported' :
250
-						Give()->notices->register_notice( array(
250
+						Give()->notices->register_notice(array(
251 251
 							'id'          => 'give-settings-imported',
252 252
 							'type'        => 'updated',
253
-							'description' => __( 'The settings have been imported.', 'give' ),
253
+							'description' => __('The settings have been imported.', 'give'),
254 254
 							'show'        => true,
255
-						) );
255
+						));
256 256
 						break;
257 257
 					case 'api-key-generated' :
258
-						Give()->notices->register_notice( array(
258
+						Give()->notices->register_notice(array(
259 259
 							'id'          => 'give-api-key-generated',
260 260
 							'type'        => 'updated',
261
-							'description' => __( 'API keys have been generated.', 'give' ),
261
+							'description' => __('API keys have been generated.', 'give'),
262 262
 							'show'        => true,
263
-						) );
263
+						));
264 264
 						break;
265 265
 					case 'api-key-exists' :
266
-						Give()->notices->register_notice( array(
266
+						Give()->notices->register_notice(array(
267 267
 							'id'          => 'give-api-key-exists',
268 268
 							'type'        => 'updated',
269
-							'description' => __( 'The specified user already has API keys.', 'give' ),
269
+							'description' => __('The specified user already has API keys.', 'give'),
270 270
 							'show'        => true,
271
-						) );
271
+						));
272 272
 						break;
273 273
 					case 'api-key-regenerated' :
274
-						Give()->notices->register_notice( array(
274
+						Give()->notices->register_notice(array(
275 275
 							'id'          => 'give-api-key-regenerated',
276 276
 							'type'        => 'updated',
277
-							'description' => __( 'API keys have been regenerated.', 'give' ),
277
+							'description' => __('API keys have been regenerated.', 'give'),
278 278
 							'show'        => true,
279
-						) );
279
+						));
280 280
 						break;
281 281
 					case 'api-key-revoked' :
282
-						Give()->notices->register_notice( array(
282
+						Give()->notices->register_notice(array(
283 283
 							'id'          => 'give-api-key-revoked',
284 284
 							'type'        => 'updated',
285
-							'description' => __( 'API keys have been revoked.', 'give' ),
285
+							'description' => __('API keys have been revoked.', 'give'),
286 286
 							'show'        => true,
287
-						) );
287
+						));
288 288
 						break;
289 289
 					case 'sent-test-email' :
290
-						Give()->notices->register_notice( array(
290
+						Give()->notices->register_notice(array(
291 291
 							'id'          => 'give-sent-test-email',
292 292
 							'type'        => 'updated',
293
-							'description' => __( 'The test email has been sent.', 'give' ),
293
+							'description' => __('The test email has been sent.', 'give'),
294 294
 							'show'        => true,
295
-						) );
295
+						));
296 296
 						break;
297 297
 					case 'matched-success-failure-page':
298
-						Give()->notices->register_notice( array(
298
+						Give()->notices->register_notice(array(
299 299
 							'id'          => 'give-matched-success-failure-page',
300 300
 							'type'        => 'updated',
301
-							'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
301
+							'description' => __('You cannot set the success and failed pages to the same page', 'give'),
302 302
 							'show'        => true,
303
-						) );
303
+						));
304 304
 						break;
305 305
 				}// End switch().
306 306
 			}// End if().
307 307
 
308 308
 			// Payments errors.
309
-			if ( current_user_can( 'edit_give_payments' ) ) {
310
-				switch ( $message_notice ) {
309
+			if (current_user_can('edit_give_payments')) {
310
+				switch ($message_notice) {
311 311
 					case 'note-added' :
312
-						Give()->notices->register_notice( array(
312
+						Give()->notices->register_notice(array(
313 313
 							'id'          => 'give-note-added',
314 314
 							'type'        => 'updated',
315
-							'description' => __( 'The donation note has been added.', 'give' ),
315
+							'description' => __('The donation note has been added.', 'give'),
316 316
 							'show'        => true,
317
-						) );
317
+						));
318 318
 						break;
319 319
 					case 'payment-updated' :
320
-						Give()->notices->register_notice( array(
320
+						Give()->notices->register_notice(array(
321 321
 							'id'          => 'give-payment-updated',
322 322
 							'type'        => 'updated',
323
-							'description' => __( 'The donation has been updated.', 'give' ),
323
+							'description' => __('The donation has been updated.', 'give'),
324 324
 							'show'        => true,
325
-						) );
325
+						));
326 326
 						break;
327 327
 				}// End switch().
328 328
 			}// End if().
329 329
 
330 330
 			// Donor Notices.
331
-			if ( current_user_can( 'edit_give_payments' ) ) {
332
-				switch ( $message_notice ) {
331
+			if (current_user_can('edit_give_payments')) {
332
+				switch ($message_notice) {
333 333
 					case 'donor-deleted' :
334
-						Give()->notices->register_notice( array(
334
+						Give()->notices->register_notice(array(
335 335
 							'id'          => 'give-donor-deleted',
336 336
 							'type'        => 'updated',
337
-							'description' => __( 'The selected donor(s) has been deleted.', 'give' ),
337
+							'description' => __('The selected donor(s) has been deleted.', 'give'),
338 338
 							'show'        => true,
339
-						) );
339
+						));
340 340
 						break;
341 341
 
342 342
 					case 'donor-donations-deleted' :
343
-						Give()->notices->register_notice( array(
343
+						Give()->notices->register_notice(array(
344 344
 							'id'          => 'give-donor-donations-deleted',
345 345
 							'type'        => 'updated',
346
-							'description' => __( 'The selected donor(s) and the associated donation(s) has been deleted.', 'give' ),
346
+							'description' => __('The selected donor(s) and the associated donation(s) has been deleted.', 'give'),
347 347
 							'show'        => true,
348
-						) );
348
+						));
349 349
 						break;
350 350
 
351 351
 					case 'confirm-delete-donor' :
352
-						Give()->notices->register_notice( array(
352
+						Give()->notices->register_notice(array(
353 353
 							'id'          => 'give-confirm-delete-donor',
354 354
 							'type'        => 'updated',
355
-							'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ),
355
+							'description' => __('You must confirm to delete the selected donor(s).', 'give'),
356 356
 							'show'        => true,
357
-						) );
357
+						));
358 358
 						break;
359 359
 
360 360
 					case 'invalid-donor-id' :
361
-						Give()->notices->register_notice( array(
361
+						Give()->notices->register_notice(array(
362 362
 							'id'          => 'give-invalid-donor-id',
363 363
 							'type'        => 'updated',
364
-							'description' => __( 'Invalid Donor ID.', 'give' ),
364
+							'description' => __('Invalid Donor ID.', 'give'),
365 365
 							'show'        => true,
366
-						) );
366
+						));
367 367
 						break;
368 368
 
369 369
 					case 'donor-delete-failed' :
370
-						Give()->notices->register_notice( array(
370
+						Give()->notices->register_notice(array(
371 371
 							'id'          => 'give-donor-delete-failed',
372 372
 							'type'        => 'error',
373
-							'description' => __( 'Unable to delete selected donor(s).', 'give' ),
373
+							'description' => __('Unable to delete selected donor(s).', 'give'),
374 374
 							'show'        => true,
375
-						) );
375
+						));
376 376
 						break;
377 377
 
378 378
 					case 'email-added' :
379
-						Give()->notices->register_notice( array(
379
+						Give()->notices->register_notice(array(
380 380
 							'id'          => 'give-email-added',
381 381
 							'type'        => 'updated',
382
-							'description' => __( 'Donor email added.', 'give' ),
382
+							'description' => __('Donor email added.', 'give'),
383 383
 							'show'        => true,
384
-						) );
384
+						));
385 385
 						break;
386 386
 
387 387
 					case 'email-removed' :
388
-						Give()->notices->register_notice( array(
388
+						Give()->notices->register_notice(array(
389 389
 							'id'          => 'give-email-removed',
390 390
 							'type'        => 'updated',
391
-							'description' => __( 'Donor email removed.', 'give' ),
391
+							'description' => __('Donor email removed.', 'give'),
392 392
 							'show'        => true,
393
-						) );
393
+						));
394 394
 						break;
395 395
 
396 396
 					case 'email-remove-failed' :
397
-						Give()->notices->register_notice( array(
397
+						Give()->notices->register_notice(array(
398 398
 							'id'          => 'give-email-remove-failed',
399 399
 							'type'        => 'updated',
400
-							'description' => __( 'Failed to remove donor email.', 'give' ),
400
+							'description' => __('Failed to remove donor email.', 'give'),
401 401
 							'show'        => true,
402
-						) );
402
+						));
403 403
 						break;
404 404
 
405 405
 					case 'primary-email-updated' :
406
-						Give()->notices->register_notice( array(
406
+						Give()->notices->register_notice(array(
407 407
 							'id'          => 'give-primary-email-updated',
408 408
 							'type'        => 'updated',
409
-							'description' => __( 'Primary email updated for donor.', 'give' ),
409
+							'description' => __('Primary email updated for donor.', 'give'),
410 410
 							'show'        => true,
411
-						) );
411
+						));
412 412
 						break;
413 413
 
414 414
 					case 'primary-email-failed' :
415
-						Give()->notices->register_notice( array(
415
+						Give()->notices->register_notice(array(
416 416
 							'id'          => 'give-primary-email-failed',
417 417
 							'type'        => 'updated',
418
-							'description' => __( 'Failed to set primary email.', 'give' ),
418
+							'description' => __('Failed to set primary email.', 'give'),
419 419
 							'show'        => true,
420
-						) );
420
+						));
421 421
 						break;
422 422
 
423 423
 					case 'reconnect-user' :
424
-						Give()->notices->register_notice( array(
424
+						Give()->notices->register_notice(array(
425 425
 							'id'          => 'give-reconnect-user',
426 426
 							'type'        => 'updated',
427
-							'description' => __( 'User has been successfully connected with Donor.', 'give' ),
427
+							'description' => __('User has been successfully connected with Donor.', 'give'),
428 428
 							'show'        => true,
429
-						) );
429
+						));
430 430
 						break;
431 431
 
432 432
 					case 'profile-updated' :
433
-						Give()->notices->register_notice( array(
433
+						Give()->notices->register_notice(array(
434 434
 							'id'          => 'give-profile-updated',
435 435
 							'type'        => 'updated',
436
-							'description' => __( 'Donor information updated successfully.', 'give' ),
436
+							'description' => __('Donor information updated successfully.', 'give'),
437 437
 							'show'        => true,
438
-						) );
438
+						));
439 439
 						break;
440 440
 				}// End switch().
441 441
 			}// End if().
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	}
444 444
 }
445 445
 
446
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
446
+add_action('admin_notices', '_give_register_admin_notices', - 1);
447 447
 
448 448
 
449 449
 /**
@@ -453,39 +453,38 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool
455 455
  */
456
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
457
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
458
-		give_is_setting_enabled( $_POST['test_mode'] ) :
459
-		give_is_test_mode();
456
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
457
+	$is_test_mode = ! empty($_POST['test_mode']) ?
458
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
460 459
 
461 460
 	if (
462
-		! current_user_can( 'view_give_reports' ) ||
461
+		! current_user_can('view_give_reports') ||
463 462
 		! $is_test_mode
464 463
 	) {
465 464
 		return false;
466 465
 	}
467 466
 
468 467
 	// Add the main site admin menu item.
469
-	$wp_admin_bar->add_menu( array(
468
+	$wp_admin_bar->add_menu(array(
470 469
 		'id'     => 'give-test-notice',
471
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
470
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
472 471
 		'parent' => 'top-secondary',
473
-		'title'  => __( 'Give Test Mode Active', 'give' ),
472
+		'title'  => __('Give Test Mode Active', 'give'),
474 473
 		'meta'   => array(
475 474
 			'class' => 'give-test-mode-active',
476 475
 		),
477
-	) );
476
+	));
478 477
 
479 478
 	return true;
480 479
 }
481 480
 
482
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
481
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
483 482
 
484 483
 /**
485 484
  * Outputs the Give admin bar CSS.
486 485
  */
487 486
 function _give_test_mode_notice_admin_bar_css() {
488
-	if ( ! give_is_test_mode() ) {
487
+	if ( ! give_is_test_mode()) {
489 488
 		return;
490 489
 	}
491 490
 	?>
@@ -503,7 +502,7 @@  discard block
 block discarded – undo
503 502
 	<?php
504 503
 }
505 504
 
506
-add_action( 'admin_head', '_give_test_mode_notice_admin_bar_css' );
505
+add_action('admin_head', '_give_test_mode_notice_admin_bar_css');
507 506
 
508 507
 
509 508
 /**
@@ -513,12 +512,12 @@  discard block
 block discarded – undo
513 512
  */
514 513
 function give_import_page_link_callback() {
515 514
 	?>
516
-	<a href="<?php echo esc_url( give_import_page_url() ); ?>"
517
-	   class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a>
515
+	<a href="<?php echo esc_url(give_import_page_url()); ?>"
516
+	   class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a>
518 517
 
519 518
 	<?php
520 519
 	// Check if view donation single page only.
521
-	if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) {
520
+	if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) {
522 521
 		?>
523 522
 		<style type="text/css">
524 523
 			.wrap #transaction-details-heading {
@@ -529,7 +528,7 @@  discard block
 block discarded – undo
529 528
 	}
530 529
 }
531 530
 
532
-add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 );
531
+add_action('give_payments_page_top', 'give_import_page_link_callback', 11);
533 532
 
534 533
 /**
535 534
  * Load donation import ajax callback
@@ -545,9 +544,9 @@  discard block
 block discarded – undo
545 544
 	Give_Cache::get_instance()->disable();
546 545
 
547 546
 	$import_setting = array();
548
-	$fields         = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
547
+	$fields         = isset($_POST['fields']) ? $_POST['fields'] : null;
549 548
 
550
-	parse_str( $fields, $output );
549
+	parse_str($fields, $output);
551 550
 
552 551
 	$import_setting['create_user'] = $output['create_user'];
553 552
 	$import_setting['mode']        = $output['mode'];
@@ -557,69 +556,69 @@  discard block
 block discarded – undo
557 556
 	$import_setting['dry_run']     = $output['dry_run'];
558 557
 
559 558
 	// Parent key id.
560
-	$main_key = maybe_unserialize( $output['main_key'] );
561
-
562
-	$current    = absint( $_REQUEST['current'] );
563
-	$total_ajax = absint( $_REQUEST['total_ajax'] );
564
-	$start      = absint( $_REQUEST['start'] );
565
-	$end        = absint( $_REQUEST['end'] );
566
-	$next       = absint( $_REQUEST['next'] );
567
-	$total      = absint( $_REQUEST['total'] );
568
-	$per_page   = absint( $_REQUEST['per_page'] );
569
-	if ( empty( $output['delimiter'] ) ) {
559
+	$main_key = maybe_unserialize($output['main_key']);
560
+
561
+	$current    = absint($_REQUEST['current']);
562
+	$total_ajax = absint($_REQUEST['total_ajax']);
563
+	$start      = absint($_REQUEST['start']);
564
+	$end        = absint($_REQUEST['end']);
565
+	$next       = absint($_REQUEST['next']);
566
+	$total      = absint($_REQUEST['total']);
567
+	$per_page   = absint($_REQUEST['per_page']);
568
+	if (empty($output['delimiter'])) {
570 569
 		$delimiter = ',';
571 570
 	} else {
572 571
 		$delimiter = $output['delimiter'];
573 572
 	}
574 573
 
575 574
 	// Processing done here.
576
-	$raw_data                  = give_get_donation_data_from_csv( $output['csv'], $start, $end, $delimiter );
577
-	$raw_key                   = maybe_unserialize( $output['mapto'] );
575
+	$raw_data                  = give_get_donation_data_from_csv($output['csv'], $start, $end, $delimiter);
576
+	$raw_key                   = maybe_unserialize($output['mapto']);
578 577
 	$import_setting['raw_key'] = $raw_key;
579 578
 
580
-	if ( ! empty( $output['dry_run'] ) ) {
581
-		$import_setting['csv_raw_data'] = give_get_donation_data_from_csv( $output['csv'], 1, $end, $delimiter );
579
+	if ( ! empty($output['dry_run'])) {
580
+		$import_setting['csv_raw_data'] = give_get_donation_data_from_csv($output['csv'], 1, $end, $delimiter);
582 581
 
583
-		$import_setting['donors_list'] = Give()->donors->get_donors( array(
584
-			'number' => - 1,
585
-			'fields' => array( 'id', 'user_id', 'email' ),
586
-		) );
582
+		$import_setting['donors_list'] = Give()->donors->get_donors(array(
583
+			'number' => -1,
584
+			'fields' => array('id', 'user_id', 'email'),
585
+		));
587 586
 	}
588 587
 
589 588
 	// Prevent normal emails.
590
-	remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 );
591
-	remove_action( 'give_insert_user', 'give_new_user_notification', 10 );
592
-	remove_action( 'give_insert_payment', 'give_payment_save_page_data' );
589
+	remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999);
590
+	remove_action('give_insert_user', 'give_new_user_notification', 10);
591
+	remove_action('give_insert_payment', 'give_payment_save_page_data');
593 592
 
594 593
 	$current_key = $start;
595
-	foreach ( $raw_data as $row_data ) {
594
+	foreach ($raw_data as $row_data) {
596 595
 		$import_setting['donation_key'] = $current_key;
597
-		give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting );
598
-		$current_key ++;
596
+		give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting);
597
+		$current_key++;
599 598
 	}
600 599
 
601 600
 	// Check if function exists or not.
602
-	if ( function_exists( 'give_payment_save_page_data' ) ) {
603
-		add_action( 'give_insert_payment', 'give_payment_save_page_data' );
601
+	if (function_exists('give_payment_save_page_data')) {
602
+		add_action('give_insert_payment', 'give_payment_save_page_data');
604 603
 	}
605
-	add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
606
-	add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 );
604
+	add_action('give_insert_user', 'give_new_user_notification', 10, 2);
605
+	add_action('give_complete_donation', 'give_trigger_donation_receipt', 999);
607 606
 
608
-	if ( $next == false ) {
607
+	if ($next == false) {
609 608
 		$json_data = array(
610 609
 			'success' => true,
611
-			'message' => __( 'All donation uploaded successfully!', 'give' ),
610
+			'message' => __('All donation uploaded successfully!', 'give'),
612 611
 		);
613 612
 	} else {
614 613
 		$index_start = $start;
615 614
 		$index_end   = $end;
616 615
 		$last        = false;
617 616
 		$next        = true;
618
-		if ( $next ) {
617
+		if ($next) {
619 618
 			$index_start = $index_start + $per_page;
620
-			$index_end   = $per_page + ( $index_start - 1 );
619
+			$index_end   = $per_page + ($index_start - 1);
621 620
 		}
622
-		if ( $index_end >= $total ) {
621
+		if ($index_end >= $total) {
623 622
 			$index_end = $total;
624 623
 			$last      = true;
625 624
 		}
@@ -633,31 +632,31 @@  discard block
 block discarded – undo
633 632
 		);
634 633
 	}
635 634
 
636
-	$url              = give_import_page_url( array(
635
+	$url = give_import_page_url(array(
637 636
 		'step'          => '4',
638 637
 		'importer-type' => 'import_donations',
639 638
 		'csv'           => $output['csv'],
640 639
 		'total'         => $total,
641 640
 		'delete_csv'    => $import_setting['delete_csv'],
642
-		'success'       => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ),
641
+		'success'       => (isset($json_data['success']) ? $json_data['success'] : ''),
643 642
 		'dry_run'       => $output['dry_run'],
644
-	) );
643
+	));
645 644
 	$json_data['url'] = $url;
646 645
 
647
-	$current ++;
646
+	$current++;
648 647
 	$json_data['current'] = $current;
649 648
 
650
-	$percentage              = ( 100 / ( $total_ajax + 1 ) ) * $current;
649
+	$percentage              = (100 / ($total_ajax + 1)) * $current;
651 650
 	$json_data['percentage'] = $percentage;
652 651
 
653 652
 	// Enable Give cache
654 653
 	Give_Cache::get_instance()->enable();
655 654
 
656
-	$json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields );
657
-	wp_die( json_encode( $json_data ) );
655
+	$json_data = apply_filters('give_import_ajax_responces', $json_data, $fields);
656
+	wp_die(json_encode($json_data));
658 657
 }
659 658
 
660
-add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' );
659
+add_action('wp_ajax_give_donation_import', 'give_donation_import_callback');
661 660
 
662 661
 /**
663 662
  * Load core settings import ajax callback
@@ -669,8 +668,8 @@  discard block
 block discarded – undo
669 668
  */
670 669
 
671 670
 function give_core_settings_import_callback() {
672
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
673
-	parse_str( $fields, $fields );
671
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
672
+	parse_str($fields, $fields);
674 673
 
675 674
 	$json_data['success'] = false;
676 675
 
@@ -685,22 +684,22 @@  discard block
 block discarded – undo
685 684
 	 *
686 685
 	 * @return array $fields
687 686
 	 */
688
-	$fields = (array) apply_filters( 'give_import_core_settings_fields', $fields );
687
+	$fields = (array) apply_filters('give_import_core_settings_fields', $fields);
689 688
 
690
-	$file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false );
689
+	$file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false);
691 690
 
692
-	if ( ! empty( $file_name ) ) {
693
-		$type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' );
691
+	if ( ! empty($file_name)) {
692
+		$type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge');
694 693
 
695 694
 		// Get the json data from the file and then alter it in array format
696
-		$json_string   = give_get_core_settings_json( $file_name );
697
-		$json_to_array = json_decode( $json_string, true );
695
+		$json_string   = give_get_core_settings_json($file_name);
696
+		$json_to_array = json_decode($json_string, true);
698 697
 
699 698
 		// get the current settign from the options table.
700
-		$host_give_options = get_option( 'give_settings', array() );
699
+		$host_give_options = get_option('give_settings', array());
701 700
 
702 701
 		// Save old settins for backup.
703
-		update_option( 'give_settings_old', $host_give_options, false );
702
+		update_option('give_settings_old', $host_give_options, false);
704 703
 
705 704
 		/**
706 705
 		 * Filter to Modify Core Settings that are being going to get import in options table as give settings.
@@ -716,9 +715,9 @@  discard block
 block discarded – undo
716 715
 		 *
717 716
 		 * @return array $json_to_array Setting that are being going to get imported
718 717
 		 */
719
-		$json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields );
718
+		$json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields);
720 719
 
721
-		update_option( 'give_settings', $json_to_array, false );
720
+		update_option('give_settings', $json_to_array, false);
722 721
 
723 722
 		$json_data['success'] = true;
724 723
 	}
@@ -734,16 +733,16 @@  discard block
 block discarded – undo
734 733
 	 *
735 734
 	 * @return array $url
736 735
 	 */
737
-	$json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array(
738
-		'step'          => ( empty( $json_data['success'] ) ? '1' : '3' ),
736
+	$json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array(
737
+		'step'          => (empty($json_data['success']) ? '1' : '3'),
739 738
 		'importer-type' => 'import_core_setting',
740
-		'success'       => ( empty( $json_data['success'] ) ? '0' : '1' ),
741
-	) ) );
739
+		'success'       => (empty($json_data['success']) ? '0' : '1'),
740
+	)));
742 741
 
743
-	wp_send_json( $json_data );
742
+	wp_send_json($json_data);
744 743
 }
745 744
 
746
-add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' );
745
+add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback');
747 746
 
748 747
 /**
749 748
  * Initializes blank slate content if a list table is empty.
@@ -755,7 +754,7 @@  discard block
 block discarded – undo
755 754
 	$blank_slate->init();
756 755
 }
757 756
 
758
-add_action( 'current_screen', 'give_blank_slate' );
757
+add_action('current_screen', 'give_blank_slate');
759 758
 
760 759
 /**
761 760
  * Validate Fields of User Profile
@@ -768,24 +767,24 @@  discard block
 block discarded – undo
768 767
  *
769 768
  * @return mixed
770 769
  */
771
-function give_validate_user_profile( $errors, $update, $user ) {
770
+function give_validate_user_profile($errors, $update, $user) {
772 771
 
773
-	if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) {
772
+	if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) {
774 773
 		return;
775 774
 	}
776 775
 
777
-	if ( ! empty( $user->ID ) ) {
778
-		$donor = Give()->donors->get_donor_by( 'user_id', $user->ID );
776
+	if ( ! empty($user->ID)) {
777
+		$donor = Give()->donors->get_donor_by('user_id', $user->ID);
779 778
 
780
-		if ( $donor ) {
779
+		if ($donor) {
781 780
 			// If Donor is attached with User, then validate first name.
782
-			if ( empty( $_POST['first_name'] ) ) {
781
+			if (empty($_POST['first_name'])) {
783 782
 				$errors->add(
784 783
 					'empty_first_name',
785 784
 					sprintf(
786 785
 						'<strong>%1$s:</strong> %2$s',
787
-						__( 'ERROR', 'give' ),
788
-						__( 'Please enter your first name.', 'give' )
786
+						__('ERROR', 'give'),
787
+						__('Please enter your first name.', 'give')
789 788
 					)
790 789
 				);
791 790
 			}
@@ -794,7 +793,7 @@  discard block
 block discarded – undo
794 793
 
795 794
 }
796 795
 
797
-add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 );
796
+add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3);
798 797
 
799 798
 /**
800 799
  * Show Donor Information on User Profile Page.
@@ -803,19 +802,19 @@  discard block
 block discarded – undo
803 802
  *
804 803
  * @since 2.0
805 804
  */
806
-function give_donor_information_profile_fields( $user ) {
807
-	$donor = Give()->donors->get_donor_by( 'user_id', $user->ID );
805
+function give_donor_information_profile_fields($user) {
806
+	$donor = Give()->donors->get_donor_by('user_id', $user->ID);
808 807
 
809 808
 	// Display Donor Information, only if donor is attached with User.
810
-	if ( ! empty( $donor->user_id ) ) {
809
+	if ( ! empty($donor->user_id)) {
811 810
 		?>
812 811
 		<table class="form-table">
813 812
 			<tbody>
814 813
 			<tr>
815
-				<th scope="row"><?php _e( 'Donor', 'give' ); ?></th>
814
+				<th scope="row"><?php _e('Donor', 'give'); ?></th>
816 815
 				<td>
817
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
818
-						<?php _e( 'View Donor Information', 'give' ); ?>
816
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
817
+						<?php _e('View Donor Information', 'give'); ?>
819 818
 					</a>
820 819
 				</td>
821 820
 			</tr>
@@ -825,7 +824,7 @@  discard block
 block discarded – undo
825 824
 	}
826 825
 }
827 826
 
828
-add_action( 'personal_options', 'give_donor_information_profile_fields' );
827
+add_action('personal_options', 'give_donor_information_profile_fields');
829 828
 /**
830 829
  * Get Array of WP User Roles.
831 830
  *
@@ -837,8 +836,8 @@  discard block
 block discarded – undo
837 836
 	$user_roles = array();
838 837
 
839 838
 	// Loop through User Roles.
840
-	foreach ( get_editable_roles() as $role_name => $role_info ) :
841
-		$user_roles[ $role_name ] = $role_info['name'];
839
+	foreach (get_editable_roles() as $role_name => $role_info) :
840
+		$user_roles[$role_name] = $role_info['name'];
842 841
 	endforeach;
843 842
 
844 843
 	return $user_roles;
@@ -855,48 +854,46 @@  discard block
 block discarded – undo
855 854
 function __give_ajax_donor_manage_addresses() {
856 855
 	// Bailout.
857 856
 	if (
858
-		empty( $_POST['form'] ) ||
859
-		empty( $_POST['donorID'] )
857
+		empty($_POST['form']) ||
858
+		empty($_POST['donorID'])
860 859
 	) {
861
-		wp_send_json_error( array(
860
+		wp_send_json_error(array(
862 861
 			'error' => 1,
863
-		) );
862
+		));
864 863
 	}
865 864
 
866
-	$post                  = give_clean( wp_parse_args( $_POST ) );
867
-	$donorID               = absint( $post['donorID'] );
868
-	$form_data             = give_clean( wp_parse_args( $post['form'] ) );
869
-	$is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) );
870
-	$address_type          = false !== strpos( $form_data['address-id'], '_' ) ?
871
-		array_shift( explode( '_', $form_data['address-id'] ) ) :
872
-		$form_data['address-id'];
873
-	$address_id            = false !== strpos( $form_data['address-id'], '_' ) ?
874
-		array_pop( explode( '_', $form_data['address-id'] ) ) :
875
-		null;
865
+	$post                  = give_clean(wp_parse_args($_POST));
866
+	$donorID               = absint($post['donorID']);
867
+	$form_data             = give_clean(wp_parse_args($post['form']));
868
+	$is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_'));
869
+	$address_type          = false !== strpos($form_data['address-id'], '_') ?
870
+		array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id'];
871
+	$address_id            = false !== strpos($form_data['address-id'], '_') ?
872
+		array_pop(explode('_', $form_data['address-id'])) : null;
876 873
 	$response_data         = array(
877 874
 		'action' => $form_data['address-action'],
878 875
 		'id'     => $form_data['address-id'],
879 876
 	);
880 877
 
881 878
 	// Security check.
882
-	if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) {
883
-		wp_send_json_error( array(
879
+	if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) {
880
+		wp_send_json_error(array(
884 881
 				'error'     => 1,
885 882
 				'error_msg' => wp_sprintf(
886 883
 					'<div class="notice notice-error"><p>%s</p></div>',
887
-					__( 'Error: Security issue.', 'give' )
884
+					__('Error: Security issue.', 'give')
888 885
 				),
889 886
 			)
890 887
 		);
891 888
 	}
892 889
 
893
-	$donor = new Give_Donor( $donorID );
890
+	$donor = new Give_Donor($donorID);
894 891
 
895 892
 	// Verify donor.
896
-	if ( ! $donor->id ) {
897
-		wp_send_json_error( array(
893
+	if ( ! $donor->id) {
894
+		wp_send_json_error(array(
898 895
 			'error' => 3,
899
-		) );
896
+		));
900 897
 	}
901 898
 
902 899
 	// Unset all data except address.
@@ -907,59 +904,57 @@  discard block
 block discarded – undo
907 904
 	);
908 905
 
909 906
 	// Process action.
910
-	switch ( $response_data['action'] ) {
907
+	switch ($response_data['action']) {
911 908
 
912 909
 		case 'add':
913
-			if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) {
914
-				wp_send_json_error( array(
910
+			if ( ! $donor->add_address("{$address_type}[]", $form_data)) {
911
+				wp_send_json_error(array(
915 912
 						'error'     => 1,
916 913
 						'error_msg' => wp_sprintf(
917 914
 							'<div class="notice notice-error"><p>%s</p></div>',
918
-							__( 'Error: Unable to save the address. Please check if address already exist.', 'give' )
915
+							__('Error: Unable to save the address. Please check if address already exist.', 'give')
919 916
 						),
920 917
 					)
921 918
 				);
922 919
 			}
923 920
 
924
-			$total_addresses = count( $donor->address[ $address_type ] );
921
+			$total_addresses = count($donor->address[$address_type]);
925 922
 
926 923
 			$address_index = $is_multi_address_type ?
927
-				$total_addresses - 1 :
928
-				$address_type;
924
+				$total_addresses - 1 : $address_type;
929 925
 
930
-			$array_keys = array_keys( $donor->address[ $address_type ] );
926
+			$array_keys = array_keys($donor->address[$address_type]);
931 927
 
932 928
 			$address_id = $is_multi_address_type ?
933
-				end( $array_keys ) :
934
-				$address_type;
929
+				end($array_keys) : $address_type;
935 930
 
936 931
 			$response_data['address_html'] = __give_get_format_address(
937
-				end( $donor->address['billing'] ),
932
+				end($donor->address['billing']),
938 933
 				array(
939 934
 					// We can add only billing address from donor screen.
940 935
 					'type'  => 'billing',
941 936
 					'id'    => $address_id,
942
-					'index' => ++ $address_index,
937
+					'index' => ++$address_index,
943 938
 				)
944 939
 			);
945
-			$response_data['success_msg']  = wp_sprintf(
940
+			$response_data['success_msg'] = wp_sprintf(
946 941
 				'<div class="notice updated"><p>%s</p></div>',
947
-				__( 'Successfully added a new address to the donor.', 'give' )
942
+				__('Successfully added a new address to the donor.', 'give')
948 943
 			);
949 944
 
950
-			if ( $is_multi_address_type ) {
945
+			if ($is_multi_address_type) {
951 946
 				$response_data['id'] = "{$response_data['id']}_{$address_index}";
952 947
 			}
953 948
 
954 949
 			break;
955 950
 
956 951
 		case 'remove':
957
-			if ( ! $donor->remove_address( $response_data['id'] ) ) {
958
-				wp_send_json_error( array(
952
+			if ( ! $donor->remove_address($response_data['id'])) {
953
+				wp_send_json_error(array(
959 954
 						'error'     => 2,
960 955
 						'error_msg' => wp_sprintf(
961 956
 							'<div class="notice notice-error"><p>%s</p></div>',
962
-							__( 'Error: Unable to delete address.', 'give' )
957
+							__('Error: Unable to delete address.', 'give')
963 958
 						),
964 959
 					)
965 960
 				);
@@ -967,18 +962,18 @@  discard block
 block discarded – undo
967 962
 
968 963
 			$response_data['success_msg'] = wp_sprintf(
969 964
 				'<div class="notice updated"><p>%s</p></div>',
970
-				__( 'Successfully removed a address of donor.', 'give' )
965
+				__('Successfully removed a address of donor.', 'give')
971 966
 			);
972 967
 
973 968
 			break;
974 969
 
975 970
 		case 'update':
976
-			if ( ! $donor->update_address( $response_data['id'], $form_data ) ) {
977
-				wp_send_json_error( array(
971
+			if ( ! $donor->update_address($response_data['id'], $form_data)) {
972
+				wp_send_json_error(array(
978 973
 						'error'     => 3,
979 974
 						'error_msg' => wp_sprintf(
980 975
 							'<div class="notice notice-error"><p>%s</p></div>',
981
-							__( 'Error: Unable to update address. Please check if address already exist.', 'give' )
976
+							__('Error: Unable to update address. Please check if address already exist.', 'give')
982 977
 						),
983 978
 					)
984 979
 				);
@@ -986,26 +981,25 @@  discard block
 block discarded – undo
986 981
 
987 982
 			$response_data['address_html'] = __give_get_format_address(
988 983
 				$is_multi_address_type ?
989
-					$donor->address[ $address_type ][ $address_id ] :
990
-					$donor->address[ $address_type ],
984
+					$donor->address[$address_type][$address_id] : $donor->address[$address_type],
991 985
 				array(
992 986
 					'type'  => $address_type,
993 987
 					'id'    => $address_id,
994 988
 					'index' => $address_id,
995 989
 				)
996 990
 			);
997
-			$response_data['success_msg']  = wp_sprintf(
991
+			$response_data['success_msg'] = wp_sprintf(
998 992
 				'<div class="notice updated"><p>%s</p></div>',
999
-				__( 'Successfully updated a address of donor', 'give' )
993
+				__('Successfully updated a address of donor', 'give')
1000 994
 			);
1001 995
 
1002 996
 			break;
1003 997
 	}// End switch().
1004 998
 
1005
-	wp_send_json_success( $response_data );
999
+	wp_send_json_success($response_data);
1006 1000
 }
1007 1001
 
1008
-add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' );
1002
+add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses');
1009 1003
 
1010 1004
 /**
1011 1005
  * Admin donor billing address label
@@ -1016,13 +1010,13 @@  discard block
 block discarded – undo
1016 1010
  *
1017 1011
  * @return string
1018 1012
  */
1019
-function __give_donor_billing_address_label( $address_label ) {
1020
-	$address_label = __( 'Billing Address', 'give' );
1013
+function __give_donor_billing_address_label($address_label) {
1014
+	$address_label = __('Billing Address', 'give');
1021 1015
 
1022 1016
 	return $address_label;
1023 1017
 }
1024 1018
 
1025
-add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' );
1019
+add_action('give_donor_billing_address_label', '__give_donor_billing_address_label');
1026 1020
 
1027 1021
 /**
1028 1022
  * Admin donor personal address label
@@ -1033,13 +1027,13 @@  discard block
 block discarded – undo
1033 1027
  *
1034 1028
  * @return string
1035 1029
  */
1036
-function __give_donor_personal_address_label( $address_label ) {
1037
-	$address_label = __( 'Personal Address', 'give' );
1030
+function __give_donor_personal_address_label($address_label) {
1031
+	$address_label = __('Personal Address', 'give');
1038 1032
 
1039 1033
 	return $address_label;
1040 1034
 }
1041 1035
 
1042
-add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' );
1036
+add_action('give_donor_personal_address_label', '__give_donor_personal_address_label');
1043 1037
 
1044 1038
 /**
1045 1039
  * Update Donor Information when User Profile is updated from admin.
@@ -1052,34 +1046,34 @@  discard block
 block discarded – undo
1052 1046
  *
1053 1047
  * @return bool
1054 1048
  */
1055
-function give_update_donor_name_on_user_update( $user_id = 0 ) {
1049
+function give_update_donor_name_on_user_update($user_id = 0) {
1056 1050
 
1057
-	if ( current_user_can( 'edit_user', $user_id ) ) {
1051
+	if (current_user_can('edit_user', $user_id)) {
1058 1052
 
1059
-		$donor = new Give_Donor( $user_id, true );
1053
+		$donor = new Give_Donor($user_id, true);
1060 1054
 
1061 1055
 		// Bailout, if donor doesn't exists.
1062
-		if ( ! $donor ) {
1056
+		if ( ! $donor) {
1063 1057
 			return false;
1064 1058
 		}
1065 1059
 
1066 1060
 		// Get User First name and Last name.
1067
-		$first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true );
1068
-		$last_name  = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true );
1069
-		$full_name  = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) );
1061
+		$first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true);
1062
+		$last_name  = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true);
1063
+		$full_name  = strip_tags(wp_unslash(trim("{$first_name} {$last_name}")));
1070 1064
 
1071 1065
 		// Assign User First name and Last name to Donor.
1072
-		Give()->donors->update( $donor->id, array(
1066
+		Give()->donors->update($donor->id, array(
1073 1067
 			'name' => $full_name,
1074
-		) );
1075
-		Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
1076
-		Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
1068
+		));
1069
+		Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
1070
+		Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
1077 1071
 
1078 1072
 	}
1079 1073
 }
1080 1074
 
1081
-add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 );
1082
-add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 );
1075
+add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10);
1076
+add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10);
1083 1077
 
1084 1078
 
1085 1079
 /**
@@ -1094,31 +1088,31 @@  discard block
 block discarded – undo
1094 1088
  *
1095 1089
  * @return bool
1096 1090
  */
1097
-function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
1091
+function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) {
1098 1092
 
1099
-	$donor = new Give_Donor( $user_id, true );
1093
+	$donor = new Give_Donor($user_id, true);
1100 1094
 
1101
-	if ( ! $donor ) {
1095
+	if ( ! $donor) {
1102 1096
 		return false;
1103 1097
 	}
1104 1098
 
1105
-	$user = get_userdata( $user_id );
1099
+	$user = get_userdata($user_id);
1106 1100
 
1107
-	if ( ! empty( $user ) && $user->user_email !== $donor->email ) {
1101
+	if ( ! empty($user) && $user->user_email !== $donor->email) {
1108 1102
 
1109
-		$success = Give()->donors->update( $donor->id, array(
1103
+		$success = Give()->donors->update($donor->id, array(
1110 1104
 			'email' => $user->user_email,
1111
-		) );
1105
+		));
1112 1106
 
1113
-		if ( $success ) {
1107
+		if ($success) {
1114 1108
 			// Update some payment meta if we need to
1115
-			$payments_array = explode( ',', $donor->payment_ids );
1109
+			$payments_array = explode(',', $donor->payment_ids);
1116 1110
 
1117
-			if ( ! empty( $payments_array ) ) {
1111
+			if ( ! empty($payments_array)) {
1118 1112
 
1119
-				foreach ( $payments_array as $payment_id ) {
1113
+				foreach ($payments_array as $payment_id) {
1120 1114
 
1121
-					give_update_payment_meta( $payment_id, 'email', $user->user_email );
1115
+					give_update_payment_meta($payment_id, 'email', $user->user_email);
1122 1116
 
1123 1117
 				}
1124 1118
 			}
@@ -1131,14 +1125,14 @@  discard block
 block discarded – undo
1131 1125
 			 * @param  WP_User    $user  WordPress User object.
1132 1126
 			 * @param  Give_Donor $donor Give donor object.
1133 1127
 			 */
1134
-			do_action( 'give_update_donor_email_on_user_update', $user, $donor );
1128
+			do_action('give_update_donor_email_on_user_update', $user, $donor);
1135 1129
 
1136 1130
 		}
1137 1131
 	}
1138 1132
 
1139 1133
 }
1140 1134
 
1141
-add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 );
1135
+add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2);
1142 1136
 
1143 1137
 
1144 1138
 /**
@@ -1147,15 +1141,15 @@  discard block
 block discarded – undo
1147 1141
 function give_cache_flush() {
1148 1142
 	$result = Give_Cache::flush_cache();
1149 1143
 
1150
-	if ( $result ) {
1151
-		wp_send_json_success( array(
1152
-			'message' => __( 'Cache flushed successfully.', 'give' ),
1144
+	if ($result) {
1145
+		wp_send_json_success(array(
1146
+			'message' => __('Cache flushed successfully.', 'give'),
1153 1147
 		));
1154 1148
 	} else {
1155
-		wp_send_json_error( array(
1156
-			'message' => __( 'An error occured while flushing the cache.', 'give' ),
1149
+		wp_send_json_error(array(
1150
+			'message' => __('An error occured while flushing the cache.', 'give'),
1157 1151
 		));
1158 1152
 	}
1159 1153
 }
1160 1154
 
1161
-add_action( 'wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0 );
1155
+add_action('wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0);
Please login to merge, or discard this patch.
includes/admin/emails/abstract-email-notification.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -600,7 +600,7 @@
 block discarded – undo
600 600
 		 *
601 601
 		 * @param int $form_id
602 602
 		 *
603
-		 * @return array|string
603
+		 * @return string
604 604
 		 */
605 605
 		public function get_preview_email_recipient( $form_id = null ) {
606 606
 			$recipients = $this->get_recipient( $form_id );
Please login to merge, or discard this patch.
Spacing   +163 added lines, -164 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_Email_Notification' ) ) :
19
+if ( ! class_exists('Give_Email_Notification')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_Email_Notification
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 		 *
95 95
 		 * @return Give_Email_Notification
96 96
 		 */
97
-		public static function get_instance( $email_notification_id = '' ) {
97
+		public static function get_instance($email_notification_id = '') {
98 98
 			$class = '';
99 99
 
100
-			if ( ! empty( $email_notification_id ) ) {
100
+			if ( ! empty($email_notification_id)) {
101 101
 				/* @var Give_Email_Notification $class */
102
-				foreach ( self::$singleton as $class ) {
103
-					if ( $email_notification_id === $class->config['id'] ) {
104
-						$class = get_class( $class );
102
+				foreach (self::$singleton as $class) {
103
+					if ($email_notification_id === $class->config['id']) {
104
+						$class = get_class($class);
105 105
 						break;
106 106
 					}
107 107
 				}
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 				$class = get_called_class();
110 110
 			}
111 111
 
112
-			if ( ! empty( $class ) && ( ! array_key_exists( $class, self::$singleton ) || is_null( self::$singleton[ $class ] ) ) ) {
113
-				self::$singleton[ $class ] = new $class();
112
+			if ( ! empty($class) && ( ! array_key_exists($class, self::$singleton) || is_null(self::$singleton[$class]))) {
113
+				self::$singleton[$class] = new $class();
114 114
 			}
115 115
 
116
-			return ( isset( self::$singleton[ $class ] ) ? self::$singleton[ $class ] : null );
116
+			return (isset(self::$singleton[$class]) ? self::$singleton[$class] : null);
117 117
 		}
118 118
 
119 119
 		/**
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
 		 *
125 125
 		 * @param array $config
126 126
 		 */
127
-		public function load( $config ) {
127
+		public function load($config) {
128 128
 			// Set notification configuration.
129
-			$this->config = wp_parse_args( $config, $this->config );
129
+			$this->config = wp_parse_args($config, $this->config);
130 130
 
131 131
 			// Set email preview header status.
132 132
 			$this->config['has_preview_header'] = $this->config['has_preview'] && $this->config['has_preview_header'] ? true : false;
133 133
 
134 134
 			// Set email content type
135
-			$this->config['content_type'] = empty( $this->config['content_type'] ) || ! in_array( $this->config['content_type'], array(
135
+			$this->config['content_type'] = empty($this->config['content_type']) || ! in_array($this->config['content_type'], array(
136 136
 				'text/html',
137 137
 				'text/plain',
138
-			) )
138
+			))
139 139
 				? Give()->emails->get_content_type()
140 140
 				: $this->config['content_type'];
141
-			$this->config['content_type'] = give_get_option( Give_Email_Setting_Field::get_prefix( $this ) . 'email_content_type', $this->config['content_type'] );
141
+			$this->config['content_type'] = give_get_option(Give_Email_Setting_Field::get_prefix($this).'email_content_type', $this->config['content_type']);
142 142
 
143 143
 			// Set email template type.
144
-			$this->config['email_template'] = empty( $this->config['email_template'] )
145
-				? give_get_option( 'email_template' )
144
+			$this->config['email_template'] = empty($this->config['email_template'])
145
+				? give_get_option('email_template')
146 146
 				: $this->config['email_template'];
147 147
 
148 148
 			// Set recipient group name.
149
-			$this->config['recipient_group_name'] = empty( $this->config['recipient_group_name'] )
150
-				? ( ! Give_Email_Notification_Util::has_recipient_field( $this ) ? __( 'Donor', 'give' ) : '' )
149
+			$this->config['recipient_group_name'] = empty($this->config['recipient_group_name'])
150
+				? ( ! Give_Email_Notification_Util::has_recipient_field($this) ? __('Donor', 'give') : '')
151 151
 				: $this->config['recipient_group_name'];
152 152
 
153 153
 			// Non notification status editable notice.
154
-			$this->config['notices']['non-notification-status-editable'] = empty( $this->config['notices']['non-notification-status-editable'] )
155
-				? __( 'You can not edit notification status from here.', 'give' )
154
+			$this->config['notices']['non-notification-status-editable'] = empty($this->config['notices']['non-notification-status-editable'])
155
+				? __('You can not edit notification status from here.', 'give')
156 156
 				: $this->config['notices']['non-notification-status-editable'];
157 157
 
158 158
 			/**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			 * @param                         array                   Give_Email_Notification::config
164 164
 			 * @param Give_Email_Notification $this
165 165
 			 */
166
-			$this->config = apply_filters( 'give_email_api_notification_config', $this->config, $this );
166
+			$this->config = apply_filters('give_email_api_notification_config', $this->config, $this);
167 167
 
168 168
 			// Setup filters.
169 169
 			$this->setup_filters();
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		 */
179 179
 		private function setup_filters() {
180 180
 			// Apply filter only for current email notification section.
181
-			if ( give_get_current_setting_section() === $this->config['id'] ) {
181
+			if (give_get_current_setting_section() === $this->config['id']) {
182 182
 				// Initialize email context for email notification.
183 183
 				$this->config['email_tag_context'] = apply_filters(
184 184
 					"give_{$this->config['id']}_email_tag_context",
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 			}
189 189
 
190 190
 			// Setup setting fields.
191
-			if( $this->config['show_on_emails_setting_page'] ) {
192
-				add_filter( 'give_get_settings_emails', array( $this, 'add_setting_fields' ), 10, 2 );
191
+			if ($this->config['show_on_emails_setting_page']) {
192
+				add_filter('give_get_settings_emails', array($this, 'add_setting_fields'), 10, 2);
193 193
 			}
194 194
 
195
-			if ( $this->config['form_metabox_setting'] && ! empty( $this->config['form_metabox_id'] ) ) {
195
+			if ($this->config['form_metabox_setting'] && ! empty($this->config['form_metabox_id'])) {
196 196
 				add_filter(
197 197
 					$this->config['form_metabox_id'],
198
-					array( $this, 'add_metabox_setting_field' ),
198
+					array($this, 'add_metabox_setting_field'),
199 199
 					10,
200 200
 					2
201 201
 				);
202 202
 			}
203 203
 
204
-			if( $this->config['has_recipient_field'] ) {
204
+			if ($this->config['has_recipient_field']) {
205 205
 				add_action(
206 206
 						"give_save__give_{$this->config['id']}_recipient",
207
-						array( $this, 'validate_form_recipient_field_value' ),
207
+						array($this, 'validate_form_recipient_field_value'),
208 208
 						10,
209 209
 						3
210 210
 				);
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 		 *
254 254
 		 * @return array
255 255
 		 */
256
-		public function add_section( $sections ) {
257
-			$sections[ $this->config['id'] ] = $this->config['label'];
256
+		public function add_section($sections) {
257
+			$sections[$this->config['id']] = $this->config['label'];
258 258
 
259 259
 			return $sections;
260 260
 		}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		 *
269 269
 		 * @return bool
270 270
 		 */
271
-		public function hide_section( $hide_section ) {
271
+		public function hide_section($hide_section) {
272 272
 			$hide_section = true;
273 273
 
274 274
 			return $hide_section;
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 		 *
285 285
 		 * @return  array
286 286
 		 */
287
-		public function add_setting_fields( $settings ) {
288
-			if ( $this->config['id'] === give_get_current_setting_section() ) {
287
+		public function add_setting_fields($settings) {
288
+			if ($this->config['id'] === give_get_current_setting_section()) {
289 289
 				$settings = $this->get_setting_fields();
290 290
 			}
291 291
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @return array
305 305
 		 */
306
-		public function get_setting_fields( $form_id = null ) {
307
-			return Give_Email_Setting_Field::get_setting_fields( $this, $form_id );
306
+		public function get_setting_fields($form_id = null) {
307
+			return Give_Email_Setting_Field::get_setting_fields($this, $form_id);
308 308
 		}
309 309
 
310 310
 
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 		 *
320 320
 		 * @return array
321 321
 		 */
322
-		public function add_metabox_setting_field( $settings, $form_id ) {
322
+		public function add_metabox_setting_field($settings, $form_id) {
323 323
 
324
-			if( Give_Email_Notification_Util::is_email_notification_active( $this ) ) {
324
+			if (Give_Email_Notification_Util::is_email_notification_active($this)) {
325 325
 				$settings[] = array(
326 326
 					'id'     => $this->config['id'],
327 327
 					'title'  => $this->config['label'],
328
-					'fields' => $this->get_setting_fields( $form_id ),
328
+					'fields' => $this->get_setting_fields($form_id),
329 329
 				);
330 330
 			}
331 331
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		 *
344 344
 		 * @return array
345 345
 		 */
346
-		public function get_extra_setting_fields( $form_id = null ) {
346
+		public function get_extra_setting_fields($form_id = null) {
347 347
 			return array();
348 348
 		}
349 349
 
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 		 *
361 361
 		 * @return string|array
362 362
 		 */
363
-		public function get_recipient( $form_id = null ) {
364
-			if ( empty( $this->recipient_email ) && $this->config['has_recipient_field'] ) {
363
+		public function get_recipient($form_id = null) {
364
+			if (empty($this->recipient_email) && $this->config['has_recipient_field']) {
365 365
 				$this->recipient_email = Give_Email_Notification_Util::get_value(
366 366
 						$this,
367
-						Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'recipient',
367
+						Give_Email_Setting_Field::get_prefix($this, $form_id).'recipient',
368 368
 						$form_id
369 369
 				);
370 370
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				 * @since 1.0
376 376
 				 * @deprecated 2.0
377 377
 				 */
378
-				$this->recipient_email = apply_filters( 'give_admin_notice_emails', $this->recipient_email, $this, $form_id );
378
+				$this->recipient_email = apply_filters('give_admin_notice_emails', $this->recipient_email, $this, $form_id);
379 379
 			}
380 380
 
381 381
 			/**
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
 		 *
406 406
 		 * @return bool
407 407
 		 */
408
-		public function get_notification_status( $form_id = null ) {
409
-			$notification_status = empty( $form_id )
410
-				? give_get_option( "{$this->config['id']}_notification", $this->config['notification_status'] )
411
-				: give_get_meta( $form_id, Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'notification', true, 'global' );
408
+		public function get_notification_status($form_id = null) {
409
+			$notification_status = empty($form_id)
410
+				? give_get_option("{$this->config['id']}_notification", $this->config['notification_status'])
411
+				: give_get_meta($form_id, Give_Email_Setting_Field::get_prefix($this, $form_id).'notification', true, 'global');
412 412
 
413 413
 			/**
414 414
 			 * Filter the notification status.
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		 *
434 434
 		 * @return string
435 435
 		 */
436
-		function get_email_subject( $form_id = null ) {
436
+		function get_email_subject($form_id = null) {
437 437
 			$subject = wp_strip_all_tags(
438 438
 				Give_Email_Notification_Util::get_value(
439 439
 					$this,
440
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
440
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
441 441
 					$form_id,
442 442
 					$this->config['default_email_subject']
443 443
 				)
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 		 *
467 467
 		 * @return string
468 468
 		 */
469
-		public function get_email_message( $form_id = null ) {
469
+		public function get_email_message($form_id = null) {
470 470
 			$message = Give_Email_Notification_Util::get_value(
471 471
 				$this,
472
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
472
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
473 473
 				$form_id,
474 474
 				$this->config['default_email_message']
475 475
 			);
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 		 *
497 497
 		 * @return string
498 498
 		 */
499
-		public function get_email_header( $form_id = null ) {
499
+		public function get_email_header($form_id = null) {
500 500
 			$header = Give_Email_Notification_Util::get_value(
501 501
 				$this,
502
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_header',
502
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_header',
503 503
 				$form_id,
504 504
 				$this->config['default_email_header']
505 505
 			);
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 		 *
528 528
 		 * @return string
529 529
 		 */
530
-		public function get_email_content_type( $form_id ) {
530
+		public function get_email_content_type($form_id) {
531 531
 			$content_type = Give_Email_Notification_Util::get_value(
532 532
 				$this,
533
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_content_type',
533
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_content_type',
534 534
 				$form_id,
535 535
 				$this->config['content_type']
536 536
 			);
@@ -558,15 +558,14 @@  discard block
 block discarded – undo
558 558
 		 *
559 559
 		 * @return string
560 560
 		 */
561
-		public function get_email_template( $form_id ) {
562
-			$email_template = give_get_meta( $form_id, '_give_email_template', true );
561
+		public function get_email_template($form_id) {
562
+			$email_template = give_get_meta($form_id, '_give_email_template', true);
563 563
 			$email_template = Give_Email_Notification_Util::get_value(
564 564
 				$this,
565
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) .'email_template',
565
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_template',
566 566
 				$form_id,
567
-				! empty( $email_template ) && Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ?
568
-					$email_template :
569
-					$this->config['email_template']
567
+				! empty($email_template) && Give_Email_Notification_Util::can_use_form_email_options($this, $form_id) ?
568
+					$email_template : $this->config['email_template']
570 569
 			);
571 570
 
572 571
 			/**
@@ -593,20 +592,20 @@  discard block
 block discarded – undo
593 592
 		 *
594 593
 		 * @return array
595 594
 		 */
596
-		public function get_allowed_email_tags( $formatted = false ) {
595
+		public function get_allowed_email_tags($formatted = false) {
597 596
 			// Get all email tags.
598 597
 			$email_tags = Give()->email_tags->get_tags();
599 598
 
600 599
 			// Skip if all email template tags context setup exit.
601
-			if ( $this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context'] ) {
600
+			if ($this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context']) {
602 601
 				$email_context = (array) $this->config['email_tag_context'];
603 602
 
604
-				foreach ( $email_tags as $index => $email_tag ) {
605
-					if ( in_array( $email_tag['context'], $email_context ) ) {
603
+				foreach ($email_tags as $index => $email_tag) {
604
+					if (in_array($email_tag['context'], $email_context)) {
606 605
 						continue;
607 606
 					}
608 607
 
609
-					unset( $email_tags[ $index ] );
608
+					unset($email_tags[$index]);
610 609
 				}
611 610
 			}
612 611
 
@@ -614,17 +613,17 @@  discard block
 block discarded – undo
614 613
 			 * Disallow tags on Email Notifications which don't have a
615 614
 			 * recipient and if the tag's is_admin property is set to true.
616 615
 			 */
617
-			if ( false === $this->config['has_recipient_field'] ) {
618
-				foreach ( $email_tags as $index => $email_tag ) {
619
-					if ( true === $email_tag['is_admin'] ) {
620
-						unset( $email_tags[ $index ] );
616
+			if (false === $this->config['has_recipient_field']) {
617
+				foreach ($email_tags as $index => $email_tag) {
618
+					if (true === $email_tag['is_admin']) {
619
+						unset($email_tags[$index]);
621 620
 					}
622 621
 				}
623 622
 			}
624 623
 
625
-			if ( count( $email_tags ) && $formatted ) : ob_start() ?>
624
+			if (count($email_tags) && $formatted) : ob_start() ?>
626 625
 				<ul class="give-email-tags-wrap">
627
-					<?php foreach ( $email_tags as $email_tag ) : ?>
626
+					<?php foreach ($email_tags as $email_tag) : ?>
628 627
 						<li class="give_<?php echo $email_tag['tag']; ?>_tag">
629 628
 							<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['desc']; ?>
630 629
 						</li>
@@ -647,8 +646,8 @@  discard block
 block discarded – undo
647 646
 		 *
648 647
 		 * @return array|string
649 648
 		 */
650
-		public function get_preview_email_recipient( $form_id = null ) {
651
-			$recipients = $this->get_recipient( $form_id );
649
+		public function get_preview_email_recipient($form_id = null) {
650
+			$recipients = $this->get_recipient($form_id);
652 651
 
653 652
 			/**
654 653
 			 * Filter the preview email recipients.
@@ -658,7 +657,7 @@  discard block
 block discarded – undo
658 657
 			 * @param string|array            $recipients List of recipients.
659 658
 			 * @param Give_Email_Notification $this
660 659
 			 */
661
-			$recipients = apply_filters( 'give_get_preview_email_recipient', $recipients, $this, $form_id );
660
+			$recipients = apply_filters('give_get_preview_email_recipient', $recipients, $this, $form_id);
662 661
 
663 662
 			return $recipients;
664 663
 		}
@@ -673,13 +672,13 @@  discard block
 block discarded – undo
673 672
 		 *
674 673
 		 * @return array
675 674
 		 */
676
-		public function get_email_attachments( $form_id = null ) {
675
+		public function get_email_attachments($form_id = null) {
677 676
 			/**
678 677
 			 * Filter the attachment.
679 678
 			 *
680 679
 			 * @since 2.0
681 680
 			 */
682
-			return apply_filters( "give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id );
681
+			return apply_filters("give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id);
683 682
 		}
684 683
 
685 684
 
@@ -693,43 +692,43 @@  discard block
 block discarded – undo
693 692
 		 *
694 693
 		 * @return bool
695 694
 		 */
696
-		public function send_preview_email( $send = true ) {
695
+		public function send_preview_email($send = true) {
697 696
 			// Get form id
698
-			$form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
697
+			$form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
699 698
 
700 699
 			// setup email data.
701 700
 			$this->setup_email_data();
702 701
 
703 702
 			$attachments  = $this->get_email_attachments();
704
-			$message      = $this->preview_email_template_tags( $this->get_email_message( $form_id ) );
705
-			$subject      = $this->preview_email_template_tags( $this->get_email_subject( $form_id ) );
706
-			$content_type = $this->get_email_content_type( $form_id );
703
+			$message      = $this->preview_email_template_tags($this->get_email_message($form_id));
704
+			$subject      = $this->preview_email_template_tags($this->get_email_subject($form_id));
705
+			$content_type = $this->get_email_content_type($form_id);
707 706
 
708 707
 			// Setup email content type.
709
-			Give()->emails->__set( 'content_type', $content_type );
710
-			Give()->emails->__set( 'html', true );
708
+			Give()->emails->__set('content_type', $content_type);
709
+			Give()->emails->__set('html', true);
711 710
 
712 711
 			// Setup email template
713
-			Give()->emails->__set( 'template', $this->get_email_template( $form_id ) );
712
+			Give()->emails->__set('template', $this->get_email_template($form_id));
714 713
 
715 714
 			// Set email header.
716
-			Give()->emails->__set( 'heading', $this->preview_email_template_tags( $this->get_email_header( $form_id ) ) );
715
+			Give()->emails->__set('heading', $this->preview_email_template_tags($this->get_email_header($form_id)));
717 716
 
718 717
 			// Format plain content type email.
719
-			if ( 'text/plain' === $content_type ) {
720
-				Give()->emails->__set( 'html', false );
721
-				Give()->emails->__set( 'template', 'none' );
722
-				$message = strip_tags( $message );
718
+			if ('text/plain' === $content_type) {
719
+				Give()->emails->__set('html', false);
720
+				Give()->emails->__set('template', 'none');
721
+				$message = strip_tags($message);
723 722
 			}
724 723
 
725
-			if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) {
724
+			if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) {
726 725
 				Give()->emails->form_id      = $form_id;
727
-				Give()->emails->from_name    = give_get_meta( $form_id, '_give_from_name', true );
728
-				Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true );
726
+				Give()->emails->from_name    = give_get_meta($form_id, '_give_from_name', true);
727
+				Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true);
729 728
 			}
730 729
 
731 730
 			return $send
732
-				? Give()->emails->send( $this->get_preview_email_recipient( $form_id ), $subject, $message, $attachments )
731
+				? Give()->emails->send($this->get_preview_email_recipient($form_id), $subject, $message, $attachments)
733 732
 				: false;
734 733
 		}
735 734
 
@@ -751,13 +750,13 @@  discard block
 block discarded – undo
751 750
 		 *
752 751
 		 * @return bool
753 752
 		 */
754
-		public function send_email_notification( $email_tag_args = array() ) {
753
+		public function send_email_notification($email_tag_args = array()) {
755 754
 			/**
756 755
 			 * Fire the filter
757 756
 			 *
758 757
 			 * @since 2.2.3
759 758
 			 */
760
-			if ( apply_filters( 'give_is_stop_email_notification', false, $this ) ) {
759
+			if (apply_filters('give_is_stop_email_notification', false, $this)) {
761 760
 				return false;
762 761
 			}
763 762
 
@@ -769,16 +768,16 @@  discard block
 block discarded – undo
769 768
 			 *
770 769
 			 * @since 2.0
771 770
 			 */
772
-			$email_tag_args = apply_filters( "give_{$this->config['id']}_email_tag_args", $email_tag_args, $this );
771
+			$email_tag_args = apply_filters("give_{$this->config['id']}_email_tag_args", $email_tag_args, $this);
773 772
 
774 773
 			// Get form id.
775
-			$form_id = ! empty( $email_tag_args['form_id'] )
776
-				? absint( $email_tag_args['form_id'] )
777
-				: ( ! empty( $email_tag_args['payment_id'] ) ? give_get_payment_form_id( $email_tag_args['payment_id'] ) : null );
774
+			$form_id = ! empty($email_tag_args['form_id'])
775
+				? absint($email_tag_args['form_id'])
776
+				: ( ! empty($email_tag_args['payment_id']) ? give_get_payment_form_id($email_tag_args['payment_id']) : null);
778 777
 
779 778
 
780 779
 			// Do not send email if notification is disable.
781
-			if ( ! Give_Email_Notification_Util::is_email_notification_active( $this, $form_id ) ) {
780
+			if ( ! Give_Email_Notification_Util::is_email_notification_active($this, $form_id)) {
782 781
 				return false;
783 782
 			}
784 783
 
@@ -787,44 +786,44 @@  discard block
 block discarded – undo
787 786
 			 *
788 787
 			 * @since 2.0
789 788
 			 */
790
-			do_action( "give_{$this->config['id']}_email_send_before", $this, $form_id );
789
+			do_action("give_{$this->config['id']}_email_send_before", $this, $form_id);
791 790
 
792 791
 			$attachments  = $this->get_email_attachments();
793
-			$message      = give_do_email_tags( $this->get_email_message( $form_id ), $email_tag_args );
794
-			$subject      = give_do_email_tags( $this->get_email_subject( $form_id ), $email_tag_args );
795
-			$content_type = $this->get_email_content_type( $form_id );
792
+			$message      = give_do_email_tags($this->get_email_message($form_id), $email_tag_args);
793
+			$subject      = give_do_email_tags($this->get_email_subject($form_id), $email_tag_args);
794
+			$content_type = $this->get_email_content_type($form_id);
796 795
 
797 796
 			// Setup email content type.
798
-			Give()->emails->__set( 'content_type', $content_type );
799
-			Give()->emails->__set( 'html', true );
797
+			Give()->emails->__set('content_type', $content_type);
798
+			Give()->emails->__set('html', true);
800 799
 
801 800
 			// Set email template.
802
-			Give()->emails->__set( 'template', $this->get_email_template( $form_id ) );
801
+			Give()->emails->__set('template', $this->get_email_template($form_id));
803 802
 
804 803
 			// Set email header.
805
-			Give()->emails->__set( 'heading', give_do_email_tags( $this->get_email_header( $form_id ), $email_tag_args ) );
804
+			Give()->emails->__set('heading', give_do_email_tags($this->get_email_header($form_id), $email_tag_args));
806 805
 
807
-			if ( 'text/plain' === $content_type ) {
808
-				Give()->emails->__set( 'html', false );
809
-				Give()->emails->__set( 'template', 'none' );
810
-				$message = strip_tags( $message );
806
+			if ('text/plain' === $content_type) {
807
+				Give()->emails->__set('html', false);
808
+				Give()->emails->__set('template', 'none');
809
+				$message = strip_tags($message);
811 810
 			}
812 811
 
813
-			if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) {
812
+			if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) {
814 813
 				Give()->emails->form_id      = $form_id;
815
-				Give()->emails->from_name    = give_get_meta( $form_id, '_give_from_name', true );
816
-				Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true );
814
+				Give()->emails->from_name    = give_get_meta($form_id, '_give_from_name', true);
815
+				Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true);
817 816
 			}
818 817
 
819 818
 			// Send email.
820
-			$email_status = Give()->emails->send( $this->get_recipient( $form_id ), $subject, $message, $attachments );
819
+			$email_status = Give()->emails->send($this->get_recipient($form_id), $subject, $message, $attachments);
821 820
 
822 821
 			/**
823 822
 			 * Fire action after after email send.
824 823
 			 *
825 824
 			 * @since 2.0
826 825
 			 */
827
-			do_action( "give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id );
826
+			do_action("give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id);
828 827
 
829 828
 			return $email_status;
830 829
 		}
@@ -839,63 +838,63 @@  discard block
 block discarded – undo
839 838
 		 *
840 839
 		 * @return string
841 840
 		 */
842
-		public function preview_email_template_tags( $message ) {
841
+		public function preview_email_template_tags($message) {
843 842
 			// Set Payment.
844
-			$payment_id = give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'preview_id' );
845
-			$payment    = $payment_id ? new Give_Payment( $payment_id ) : new stdClass();
843
+			$payment_id = give_check_variable(give_clean($_GET), 'isset_empty', 0, 'preview_id');
844
+			$payment    = $payment_id ? new Give_Payment($payment_id) : new stdClass();
846 845
 
847 846
 			// Set donor.
848 847
 			$user_id = $payment_id
849 848
 				? $payment->user_id
850
-				: give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'user_id' );
849
+				: give_check_variable(give_clean($_GET), 'isset_empty', 0, 'user_id');
851 850
 			$user_id = $user_id ? $user_id : wp_get_current_user()->ID;
852 851
 
853 852
 			// Set receipt.
854
-			$receipt_id = strtolower( md5( uniqid() ) );
853
+			$receipt_id = strtolower(md5(uniqid()));
855 854
 
856
-			$receipt_link_url = esc_url( add_query_arg( array(
855
+			$receipt_link_url = esc_url(add_query_arg(array(
857 856
 				'payment_key' => $receipt_id,
858
-			), give_get_history_page_uri() ) );
857
+			), give_get_history_page_uri()));
859 858
 
860 859
 			$receipt_link = sprintf(
861 860
 				'<a href="%1$s">%2$s</a>',
862 861
 				$receipt_link_url,
863
-				esc_html__( 'View the receipt in your browser &raquo;', 'give' )
862
+				esc_html__('View the receipt in your browser &raquo;', 'give')
864 863
 			);
865 864
 
866 865
 			// Set default values for tags.
867 866
 			$this->config['preview_email_tags_values'] = wp_parse_args(
868 867
 				$this->config['preview_email_tags_values'],
869 868
 				array(
870
-					'name'                     => give_email_tag_first_name( array(
869
+					'name'                     => give_email_tag_first_name(array(
871 870
 						'payment_id' => $payment_id,
872 871
 						'user_id'    => $user_id,
873
-					) ),
874
-					'fullname'                 => give_email_tag_fullname( array(
872
+					)),
873
+					'fullname'                 => give_email_tag_fullname(array(
875 874
 						'payment_id' => $payment_id,
876 875
 						'user_id'    => $user_id,
877
-					) ),
878
-					'username'                 => give_email_tag_username( array(
876
+					)),
877
+					'username'                 => give_email_tag_username(array(
879 878
 						'payment_id' => $payment_id,
880 879
 						'user_id'    => $user_id,
881
-					) ),
882
-					'user_email'               => give_email_tag_user_email( array(
880
+					)),
881
+					'user_email'               => give_email_tag_user_email(array(
883 882
 						'payment_id' => $payment_id,
884 883
 						'user_id'    => $user_id,
885
-					) ),
886
-					'payment_total'            => $payment_id ? give_email_tag_payment_total( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
887
-					'amount'                   => $payment_id ? give_email_tag_amount( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
888
-					'price'                    => $payment_id ? give_email_tag_price( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
889
-					'payment_method'           => $payment_id ? give_email_tag_payment_method( array( 'payment_id' => $payment_id ) ) : __( 'PayPal', 'give' ),
884
+					)),
885
+					'payment_total'            => $payment_id ? give_email_tag_payment_total(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
886
+					'amount'                   => $payment_id ? give_email_tag_amount(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
887
+					'price'                    => $payment_id ? give_email_tag_price(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
888
+					'payment_method'           => $payment_id ? give_email_tag_payment_method(array('payment_id' => $payment_id)) : __('PayPal', 'give'),
890 889
 					'receipt_id'               => $receipt_id,
891
-					'payment_id'               => $payment_id ? $payment_id : rand( 2000, 2050 ),
890
+					'payment_id'               => $payment_id ? $payment_id : rand(2000, 2050),
892 891
 					'receipt_link_url'         => $receipt_link_url,
893 892
 					'receipt_link'             => $receipt_link,
894
-					'date'                     => $payment_id ? date( give_date_format(), strtotime( $payment->date ) ) : date( give_date_format(), current_time( 'timestamp' ) ),
895
-					'donation'                 => $payment_id ? give_email_tag_donation( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title', 'give' ),
896
-					'form_title'               => $payment_id ? give_email_tag_form_title( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ),
897
-					'sitename'                 => $payment_id ? give_email_tag_sitename( array( 'payment_id' => $payment_id ) ) : get_bloginfo( 'name' ),
898
-					'billing_address'         => $payment_id ? give_email_tag_billing_address( array( 'payment_id' => $payment_id ) ) : '',
893
+					'date'                     => $payment_id ? date(give_date_format(), strtotime($payment->date)) : date(give_date_format(), current_time('timestamp')),
894
+					'donation'                 => $payment_id ? give_email_tag_donation(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title', 'give'),
895
+					'form_title'               => $payment_id ? give_email_tag_form_title(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'),
896
+					'sitename'                 => $payment_id ? give_email_tag_sitename(array('payment_id' => $payment_id)) : get_bloginfo('name'),
897
+					'billing_address'         => $payment_id ? give_email_tag_billing_address(array('payment_id' => $payment_id)) : '',
899 898
 					'email_access_link'       => sprintf(
900 899
 						'<a href="%1$s">%2$s</a>',
901 900
 						add_query_arg(
@@ -904,13 +903,13 @@  discard block
 block discarded – undo
904 903
 							),
905 904
 							give_get_history_page_uri()
906 905
 						),
907
-						__( 'View your donation history &raquo;', 'give' )
906
+						__('View your donation history &raquo;', 'give')
908 907
 					),
909
-					'reset_password_link'     => $user_id ? give_email_tag_reset_password_link( array( 'user_id' => $user_id ), $payment_id ) : '',
908
+					'reset_password_link'     => $user_id ? give_email_tag_reset_password_link(array('user_id' => $user_id), $payment_id) : '',
910 909
 					'site_url'                => sprintf(
911 910
 						'<a href="%1$s">%2$s</a>',
912
-						get_bloginfo( 'url' ),
913
-						get_bloginfo( 'url' )
911
+						get_bloginfo('url'),
912
+						get_bloginfo('url')
914 913
 					),
915 914
 					'admin_email'             => give_email_admin_email(),
916 915
 					'offline_mailing_address' => give_email_offline_mailing_address(),
@@ -918,13 +917,13 @@  discard block
 block discarded – undo
918 917
 			);
919 918
 
920 919
 			// Decode tags.
921
-			foreach ( $this->config['preview_email_tags_values'] as $preview_tag => $value ) {
922
-				if ( isset( $this->config['preview_email_tags_values'][ $preview_tag ] ) ) {
923
-					$message = str_replace( "{{$preview_tag}}", $this->config['preview_email_tags_values'][ $preview_tag ], $message );
920
+			foreach ($this->config['preview_email_tags_values'] as $preview_tag => $value) {
921
+				if (isset($this->config['preview_email_tags_values'][$preview_tag])) {
922
+					$message = str_replace("{{$preview_tag}}", $this->config['preview_email_tags_values'][$preview_tag], $message);
924 923
 				}
925 924
 			}
926 925
 
927
-			return apply_filters( 'give_email_preview_template_tags', $message );
926
+			return apply_filters('give_email_preview_template_tags', $message);
928 927
 		}
929 928
 
930 929
 		/**
@@ -949,17 +948,17 @@  discard block
 block discarded – undo
949 948
 		 * @param $post_id
950 949
 		 *
951 950
 		 */
952
-		public function validate_form_recipient_field_value( $form_meta_key, $form_meta_value, $post_id ) {
951
+		public function validate_form_recipient_field_value($form_meta_key, $form_meta_value, $post_id) {
953 952
 			// Get valid emails.
954
-			$new_form_meta_value = array_filter( $form_meta_value, function ( $value ) {
955
-				return ! empty( $value['email'] ) && is_email( $value['email'] );
953
+			$new_form_meta_value = array_filter($form_meta_value, function($value) {
954
+				return ! empty($value['email']) && is_email($value['email']);
956 955
 			} );
957 956
 
958 957
 			// Remove duplicate emails from array.
959 958
 			$email_arr = array();
960
-			foreach ( $new_form_meta_value as $index => $email ) {
961
-				if( in_array( $email['email'], $email_arr  ) ) {
962
-					unset( $new_form_meta_value[$index] );
959
+			foreach ($new_form_meta_value as $index => $email) {
960
+				if (in_array($email['email'], $email_arr)) {
961
+					unset($new_form_meta_value[$index]);
963 962
 					continue;
964 963
 				}
965 964
 
@@ -968,25 +967,25 @@  discard block
 block discarded – undo
968 967
 
969 968
 			$update = false;
970 969
 
971
-			if ( empty( $new_form_meta_value ) ) {
970
+			if (empty($new_form_meta_value)) {
972 971
 				// Set default recipient.
973 972
 				$form_meta_value = array(
974 973
 					array(
975
-						'email' => get_bloginfo( 'admin_email' )
974
+						'email' => get_bloginfo('admin_email')
976 975
 					),
977 976
 				);
978 977
 
979 978
 				$update = true;
980 979
 
981
-			} elseif ( count( $new_form_meta_value ) !== count( $form_meta_value ) ) {
980
+			} elseif (count($new_form_meta_value) !== count($form_meta_value)) {
982 981
 				// Filter recipient emails.
983 982
 				$form_meta_value = $new_form_meta_value;
984 983
 
985 984
 				$update = true;
986 985
 			}
987 986
 
988
-			if( $update ) {
989
-				give_update_meta( $post_id, $form_meta_key, $form_meta_value );
987
+			if ($update) {
988
+				give_update_meta($post_id, $form_meta_key, $form_meta_value);
990 989
 			}
991 990
 		}
992 991
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-donor-register-email.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
 		 * @param string                    $email_preview_header
121 121
 		 * @param Give_Donor_Register_Email $email
122 122
 		 *
123
-		 * @return bool
123
+		 * @return string|null
124 124
 		 */
125 125
 		public function email_preview_header( $email_preview_header, $email ) {
126 126
 			// Bailout.
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 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_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_Donor_Register_Email
@@ -31,34 +31,34 @@  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'                    => 'donor-register',
36
-				'label'                 => __( 'User Registration Information', 'give' ),
37
-				'description'           => __( 'Sent to the donor when they register for an account on the site.', 'give' ),
36
+				'label'                 => __('User Registration Information', 'give'),
37
+				'description'           => __('Sent to the donor when they register for an account on the site.', 'give'),
38 38
 				'notification_status'   => 'enabled',
39 39
 				'form_metabox_setting'  => false,
40
-				'recipient_group_name'  => __( 'Donor', 'give' ),
41
-				'email_tag_context'     => array( 'donor', 'general' ),
40
+				'recipient_group_name'  => __('Donor', 'give'),
41
+				'email_tag_context'     => array('donor', 'general'),
42 42
 				'default_email_subject' => sprintf(
43 43
 				/* translators: %s: site name */
44
-					esc_attr__( '[%s] Your username and password', 'give' ),
45
-					get_bloginfo( 'name' )
44
+					esc_attr__('[%s] Your username and password', 'give'),
45
+					get_bloginfo('name')
46 46
 				),
47 47
 				'default_email_message' => $this->get_default_email_message(),
48
-				'default_email_header'  => __( 'New User Registration', 'give' ),
49
-			) );
48
+				'default_email_header'  => __('New User Registration', 'give'),
49
+			));
50 50
 
51 51
 			// Setup action hook.
52 52
 			add_action(
53 53
 				"give_{$this->config['id']}_email_notification",
54
-				array( $this, 'setup_email_notification' ),
54
+				array($this, 'setup_email_notification'),
55 55
 				10,
56 56
 				2
57 57
 			);
58 58
 
59 59
 			add_filter(
60 60
 				'give_email_preview_header',
61
-				array( $this, 'email_preview_header' ),
61
+				array($this, 'email_preview_header'),
62 62
 				10,
63 63
 				2
64 64
 			);
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 		 * @return string
74 74
 		 */
75 75
 		function get_default_email_message() {
76
-			$message = esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
76
+			$message = esc_attr__('Username: {username}', 'give')."\r\n\r\n";
77 77
 
78
-			$message .= __( 'To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give' ) . "\r\n";
79
-			$message .= '{reset_password_link}' . "\r\n\r\n";
78
+			$message .= __('To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give')."\r\n";
79
+			$message .= '{reset_password_link}'."\r\n\r\n";
80 80
 
81
-			$message .= __( 'After resetting password, Please login to your account with link below.', 'give' ) . "\r\n";
82
-			$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login &raquo;', 'give' ) . '</a>' . "\r\n";
81
+			$message .= __('After resetting password, Please login to your account with link below.', 'give')."\r\n";
82
+			$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login &raquo;', 'give').'</a>'."\r\n";
83 83
 
84 84
 			/**
85 85
 			 * Filter the default email message
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @return string
105 105
 		 */
106
-		public function setup_email_notification( $user_id, $user_data ) {
106
+		public function setup_email_notification($user_id, $user_data) {
107 107
 			$this->setup_email_data();
108 108
 
109 109
 			$this->recipient_email = $user_data['email'];
110 110
 
111
-			$this->send_email_notification( array(
111
+			$this->send_email_notification(array(
112 112
 				'user_id' => $user_id,
113
-			) );
113
+			));
114 114
 		}
115 115
 
116 116
 		/**
@@ -124,42 +124,42 @@  discard block
 block discarded – undo
124 124
 		 *
125 125
 		 * @return bool
126 126
 		 */
127
-		public function email_preview_header( $email_preview_header, $email ) {
127
+		public function email_preview_header($email_preview_header, $email) {
128 128
 			// Bailout.
129
-			if ( $this->config['id'] !== $email->config['id'] ) {
129
+			if ($this->config['id'] !== $email->config['id']) {
130 130
 				return $email_preview_header;
131 131
 			}
132 132
 
133 133
 			// Payment receipt switcher
134
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
134
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
135 135
 
136 136
 			// Get payments.
137 137
 			$donors  = new Give_API();
138
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
138
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
139 139
 			$options = array();
140 140
 
141 141
 			// Default option.
142
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
142
+			$options[0] = esc_html__('No donor(s) found.', 'give');
143 143
 
144 144
 			// Provide nice human readable options.
145
-			if ( $donors ) {
146
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
147
-				foreach ( $donors as $donor ) {
145
+			if ($donors) {
146
+				$options[0] = esc_html__('- Select a donor -', 'give');
147
+				foreach ($donors as $donor) {
148 148
 					// Exclude customers for which wp user not exist.
149
-					if ( ! $donor['info']['user_id'] ) {
149
+					if ( ! $donor['info']['user_id']) {
150 150
 						continue;
151 151
 					}
152
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
152
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
153 153
 				}
154 154
 			}
155 155
 
156
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
156
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
157 157
 			$query            = $request_url_data['query'];
158 158
 
159 159
 			// Remove user id query param if set from request url.
160
-			$query = remove_query_arg( array( 'user_id' ), $query );
160
+			$query = remove_query_arg(array('user_id'), $query);
161 161
 
162
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
162
+			$request_url = home_url('/?'.str_replace('', '', $query));
163 163
 			?>
164 164
 
165 165
 			<!-- Start constructing HTML output.-->
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 				</script>
178 178
 
179 179
 				<label for="give_preview_email_user_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">
180
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
180
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
181 181
 				</label>
182 182
 
183 183
 				<?php
184 184
 				// The select field with 100 latest transactions
185
-				echo Give()->html->select( array(
185
+				echo Give()->html->select(array(
186 186
 					'name'             => 'preview_email_user_id',
187 187
 					'selected'         => $user_id,
188 188
 					'id'               => 'give_preview_email_user_id',
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 					'select_atts'      => 'onchange="change_preview()"',
193 193
 					'show_option_all'  => false,
194 194
 					'show_option_none' => false,
195
-				) );
195
+				));
196 196
 				?>
197 197
 			</div>
198 198
 			<?php
Please login to merge, or discard this patch.