Test Failed
Pull Request — master (#2668)
by Devin
07:48
created
includes/class-give-email-access.php 1 patch
Spacing   +50 added lines, -50 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
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	public function __construct() {
107 107
 
108 108
 		// get it started
109
-		add_action( 'init', array( $this, 'init' ) );
109
+		add_action('init', array($this, 'init'));
110 110
 	}
111 111
 
112 112
 	/**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	public function init() {
123 123
 
124 124
 		// Bail Out, if user is logged in.
125
-		if ( is_user_logged_in() ) {
125
+		if (is_user_logged_in()) {
126 126
 			return;
127 127
 		}
128 128
 
129 129
 		// Are db columns setup?
130
-		$column_exists = Give()->donors->does_column_exist( 'token' );
131
-		if ( ! $column_exists ) {
130
+		$column_exists = Give()->donors->does_column_exist('token');
131
+		if ( ! $column_exists) {
132 132
 			$this->create_columns();
133 133
 		}
134 134
 
135 135
 		// Timeouts.
136
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
137
-		$this->limit_throttle   = apply_filters( 'give_nl_limit_throttle', 3 );
138
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
136
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
137
+		$this->limit_throttle   = apply_filters('give_nl_limit_throttle', 3);
138
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
139 139
 
140 140
 		// Setup login.
141 141
 		$this->check_for_token();
142 142
 
143
-		if ( $this->token_exists ) {
144
-			add_filter( 'give_can_view_receipt', '__return_true' );
145
-			add_filter( 'give_user_pending_verification', '__return_false' );
146
-			add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) );
143
+		if ($this->token_exists) {
144
+			add_filter('give_can_view_receipt', '__return_true');
145
+			add_filter('give_user_pending_verification', '__return_false');
146
+			add_filter('give_get_users_donations_args', array($this, 'users_donations_args'));
147 147
 		}
148 148
 
149 149
 	}
@@ -158,23 +158,23 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return bool
160 160
 	 */
161
-	public function can_send_email( $donor_id ) {
161
+	public function can_send_email($donor_id) {
162 162
 
163
-		$donor = Give()->donors->get_donor_by( 'id', $donor_id );
163
+		$donor = Give()->donors->get_donor_by('id', $donor_id);
164 164
 
165
-		if ( is_object( $donor ) && count( $donor ) > 0 ) {
165
+		if (is_object($donor) && count($donor) > 0) {
166 166
 
167
-			$email_throttle_count = (int) give_get_meta( $donor_id, '_give_email_throttle_count', true );
167
+			$email_throttle_count = (int) give_get_meta($donor_id, '_give_email_throttle_count', true);
168 168
 
169 169
 			$cache_key = "give_cache_email_throttle_limit_exhausted_{$donor_id}";
170 170
 			if (
171 171
 				$email_throttle_count < $this->limit_throttle &&
172
-				true !== Give_Cache::get( $cache_key )
172
+				true !== Give_Cache::get($cache_key)
173 173
 			) {
174
-				give_update_meta( $donor_id, '_give_email_throttle_count', $email_throttle_count + 1 );
174
+				give_update_meta($donor_id, '_give_email_throttle_count', $email_throttle_count + 1);
175 175
 			} else {
176
-				give_update_meta( $donor_id, '_give_email_throttle_count', 0 );
177
-				Give_Cache::set( $cache_key, true, $this->verify_throttle );
176
+				give_update_meta($donor_id, '_give_email_throttle_count', 0);
177
+				Give_Cache::set($cache_key, true, $this->verify_throttle);
178 178
 				return false;
179 179
 			}
180 180
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return bool
196 196
 	 */
197
-	public function send_email( $donor_id, $email ) {
198
-		return apply_filters( 'give_email-access_email_notification', $donor_id, $email );
197
+	public function send_email($donor_id, $email) {
198
+		return apply_filters('give_email-access_email_notification', $donor_id, $email);
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,28 +208,28 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function check_for_token() {
210 210
 
211
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
211
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
212 212
 
213 213
 		// Check for cookie.
214
-		if ( empty( $token ) ) {
215
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
214
+		if (empty($token)) {
215
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
216 216
 		}
217 217
 
218 218
 		// Must have a token.
219
-		if ( ! empty( $token ) ) {
219
+		if ( ! empty($token)) {
220 220
 
221
-			if ( ! $this->is_valid_token( $token ) ) {
222
-				if ( ! $this->is_valid_verify_key( $token ) ) {
221
+			if ( ! $this->is_valid_token($token)) {
222
+				if ( ! $this->is_valid_verify_key($token)) {
223 223
 					return false;
224 224
 				}
225 225
 			}
226 226
 
227 227
 			// Set Receipt Access Session.
228
-			Give()->session->set( 'receipt_access', true );
228
+			Give()->session->set('receipt_access', true);
229 229
 			$this->token_exists = true;
230 230
 			// Set cookie.
231
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
232
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
231
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
232
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
233 233
 
234 234
 			return true;
235 235
 		}
@@ -245,26 +245,26 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return bool
247 247
 	 */
248
-	public function is_valid_token( $token ) {
248
+	public function is_valid_token($token) {
249 249
 
250 250
 		global $wpdb;
251 251
 
252 252
 		// Make sure token isn't expired.
253
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
253
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
254 254
 
255 255
 		$email = $wpdb->get_var(
256
-			$wpdb->prepare( "SELECT email FROM {$wpdb->donors} WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
256
+			$wpdb->prepare("SELECT email FROM {$wpdb->donors} WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
257 257
 		);
258 258
 
259
-		if ( ! empty( $email ) ) {
259
+		if ( ! empty($email)) {
260 260
 			$this->token_email = $email;
261 261
 			$this->token       = $token;
262 262
 			return true;
263 263
 		}
264 264
 
265 265
 		// Set error only if email access form isn't being submitted.
266
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
267
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) );
266
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
267
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give')));
268 268
 		}
269 269
 
270 270
 		return false;
@@ -283,25 +283,25 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return void
285 285
 	 */
286
-	public function set_verify_key( $donor_id, $email, $verify_key ) {
286
+	public function set_verify_key($donor_id, $email, $verify_key) {
287 287
 		global $wpdb;
288 288
 
289
-		$now = date( 'Y-m-d H:i:s' );
289
+		$now = date('Y-m-d H:i:s');
290 290
 
291 291
 		// Insert or update?
292 292
 		$row_id = (int) $wpdb->get_var(
293
-			$wpdb->prepare( "SELECT id FROM {$wpdb->donors} WHERE id = %d LIMIT 1", $donor_id )
293
+			$wpdb->prepare("SELECT id FROM {$wpdb->donors} WHERE id = %d LIMIT 1", $donor_id)
294 294
 		);
295 295
 
296 296
 		// Update.
297
-		if ( ! empty( $row_id ) ) {
297
+		if ( ! empty($row_id)) {
298 298
 			$wpdb->query(
299
-				$wpdb->prepare( "UPDATE {$wpdb->donors} SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
299
+				$wpdb->prepare("UPDATE {$wpdb->donors} SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
300 300
 			);
301 301
 		} // Insert.
302 302
 		else {
303 303
 			$wpdb->query(
304
-				$wpdb->prepare( "INSERT INTO {$wpdb->donors} ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
304
+				$wpdb->prepare("INSERT INTO {$wpdb->donors} ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
305 305
 			);
306 306
 		}
307 307
 	}
@@ -316,21 +316,21 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @return bool
318 318
 	 */
319
-	public function is_valid_verify_key( $token ) {
319
+	public function is_valid_verify_key($token) {
320 320
 		/* @var WPDB $wpdb */
321 321
 		global $wpdb;
322 322
 
323 323
 		// See if the verify_key exists.
324 324
 		$row = $wpdb->get_row(
325
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token )
325
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token)
326 326
 		);
327 327
 
328
-		$now = date( 'Y-m-d H:i:s' );
328
+		$now = date('Y-m-d H:i:s');
329 329
 
330 330
 		// Set token and remove verify key.
331
-		if ( ! empty( $row ) ) {
331
+		if ( ! empty($row)) {
332 332
 			$wpdb->query(
333
-				$wpdb->prepare( "UPDATE {$wpdb->donors} SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
333
+				$wpdb->prepare("UPDATE {$wpdb->donors} SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
334 334
 			);
335 335
 
336 336
 			$this->token_email = $row->email;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return mixed
356 356
 	 */
357
-	public function users_donations_args( $args ) {
357
+	public function users_donations_args($args) {
358 358
 		$args['user'] = $this->token_email;
359 359
 
360 360
 		return $args;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 		global $wpdb;
376 376
 
377 377
 		// Create columns in donors table.
378
-		$wpdb->query( "ALTER TABLE {$wpdb->donors} ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
378
+		$wpdb->query("ALTER TABLE {$wpdb->donors} ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
379 379
 	}
380 380
 
381 381
 }
Please login to merge, or discard this patch.
includes/class-give-db-payment-meta.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta';
53
+		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 			KEY meta_key (meta_key)
100 100
 			) {$charset_collate};";
101 101
 
102
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
103
-		dbDelta( $sql );
102
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
103
+		dbDelta($sql);
104 104
 
105
-		update_option( $this->table_name . '_db_version', $this->version );
105
+		update_option($this->table_name.'_db_version', $this->version);
106 106
 	}
107 107
 
108 108
 	/**
@@ -113,6 +113,6 @@  discard block
 block discarded – undo
113 113
 	 * @return bool
114 114
 	 */
115 115
 	protected function is_custom_meta_table_active() {
116
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
116
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +31 added lines, -31 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_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 			// Get current setting page.
71 71
 			$this->current_setting_page = give_get_current_setting_page();
72 72
 
73
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
74
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
75
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
73
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
74
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
75
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
76 76
 
77 77
 			// Output section only if exist.
78 78
 			$sections = $this->get_sections();
79
-			if ( ! empty( $sections ) ) {
80
-				add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array(
79
+			if ( ! empty($sections)) {
80
+				add_action("{$this->current_setting_page}_sections_{$this->id}_page", array(
81 81
 					$this,
82 82
 					'output_sections',
83
-				) );
83
+				));
84 84
 			}
85 85
 
86 86
 			// Save hide button by default.
87 87
 			$GLOBALS['give_hide_save_button'] = true;
88 88
 
89 89
 			// Enable saving feature.
90
-			if ( $this->enable_save ) {
91
-				add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
90
+			if ($this->enable_save) {
91
+				add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
92 92
 			}
93 93
 		}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		function set_default_setting_tab( $setting_tab ) {
116
+		function set_default_setting_tab($setting_tab) {
117 117
 			return $this->default_tab;
118 118
 		}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return array
128 128
 		 */
129
-		public function add_settings_page( $pages ) {
130
-			$pages[ $this->id ] = $this->label;
129
+		public function add_settings_page($pages) {
130
+			$pages[$this->id] = $this->label;
131 131
 
132 132
 			return $pages;
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			 *
147 147
 			 * @param  array $settings
148 148
 			 */
149
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
149
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
150 150
 
151 151
 			// Output.
152 152
 			return $settings;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @return array
160 160
 		 */
161 161
 		public function get_sections() {
162
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
162
+			return apply_filters('give_get_sections_'.$this->id, array());
163 163
 		}
164 164
 
165 165
 		/**
@@ -176,39 +176,39 @@  discard block
 block discarded – undo
176 176
 			$sections = $this->get_sections();
177 177
 
178 178
 			// Bailout.
179
-			if ( empty( $sections ) ) {
179
+			if (empty($sections)) {
180 180
 				return;
181 181
 			}
182 182
 
183 183
 			// Show section settings only if setting section exist.
184
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) {
185
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
184
+			if ($current_section && ! in_array($current_section, array_keys($sections))) {
185
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
186 186
 				$GLOBALS['give_hide_save_button'] = true;
187 187
 
188 188
 				return;
189 189
 			}
190 190
 
191
-			if ( is_null( $this->current_setting_page ) ) {
191
+			if (is_null($this->current_setting_page)) {
192 192
 				$this->current_setting_page = give_get_current_setting_page();
193 193
 			}
194 194
 
195 195
 			$section_list = array();
196
-			foreach ( $sections as $id => $label ) {
196
+			foreach ($sections as $id => $label) {
197 197
 				/**
198 198
 				 * Fire the filter to hide particular section on tab.
199 199
 				 *
200 200
 				 * @since 2.0
201 201
 				 */
202
-				if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) {
202
+				if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) {
203 203
 					continue;
204 204
 				}
205 205
 
206
-				$section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a>';
206
+				$section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a>';
207 207
 			}
208 208
 
209 209
 			echo sprintf(
210 210
 				'<ul class="subsubsub">%s</ul><br class="clear" /><hr>',
211
-				implode( ' | </li>', $section_list )
211
+				implode(' | </li>', $section_list)
212 212
 			);
213 213
 		}
214 214
 
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		 * @return void
222 222
 		 */
223 223
 		public function output() {
224
-			if ( $this->enable_save ) {
224
+			if ($this->enable_save) {
225 225
 				$GLOBALS['give_hide_save_button'] = false;
226 226
 			}
227 227
 
228 228
 			$settings = $this->get_settings();
229 229
 
230
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
230
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
231 231
 		}
232 232
 
233 233
 		/**
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 			$settings        = $this->get_settings();
241 241
 			$current_section = give_get_current_setting_section();
242 242
 
243
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
243
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
244 244
 
245 245
 			/**
246 246
 			 * Trigger Action
247 247
 			 *
248 248
 			 * @since 1.8
249 249
 			 */
250
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
250
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
251 251
 		}
252 252
 
253 253
 		/**
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 			$section         = $this->get_sections();
265 265
 			$current_section = give_get_current_setting_section();
266 266
 
267
-			if ( array_key_exists( $current_section, $section ) ) {
268
-				$heading[] = $section[ $current_section ];
267
+			if (array_key_exists($current_section, $section)) {
268
+				$heading[] = $section[$current_section];
269 269
 			}
270 270
 
271
-			return array_unique( $heading );
271
+			return array_unique($heading);
272 272
 		}
273 273
 
274 274
 		/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		public function get_heading_html() {
283 283
 			return sprintf(
284 284
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
285
-				implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() )
285
+				implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading())
286 286
 			);
287 287
 		}
288 288
 	}
Please login to merge, or discard this patch.
includes/admin/donors/donors.php 2 patches
Spacing   +213 added lines, -213 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
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string
27 27
  */
28
-function __give_get_format_address( $address, $address_args = array() ) {
28
+function __give_get_format_address($address, $address_args = array()) {
29 29
 	$address_html = '';
30 30
 	$address_args = wp_parse_args(
31 31
 		$address_args,
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	$address_id = $address_args['type'];
41 41
 
42 42
 	// Bailout.
43
-	if ( empty( $address ) || ! is_array( $address ) ) {
43
+	if (empty($address) || ! is_array($address)) {
44 44
 		return $address_html;
45 45
 	}
46 46
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 	$address_html .= sprintf(
50 50
 		'<span data-address-type="line1">%1$s</span>%2$s',
51 51
 		$address['line1'],
52
-		( ! empty( $address['line2'] ) ? '<br>' : '' )
52
+		( ! empty($address['line2']) ? '<br>' : '')
53 53
 	);
54 54
 	$address_html .= sprintf(
55 55
 		'<span data-address-type="line2">%1$s</span>%2$s',
56 56
 		$address['line2'],
57
-		( ! empty( $address['city'] ) ? '<br>' : '' )
57
+		( ! empty($address['city']) ? '<br>' : '')
58 58
 	);
59 59
 	$address_html .= sprintf(
60 60
 		'<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s',
61 61
 		$address['city'],
62
-		( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ),
63
-		( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ),
64
-		( ! empty( $address['country'] ) ? '<br>' : '' )
62
+		( ! empty($address['state']) ? ", {$address['state']}" : ''),
63
+		( ! empty($address['zip']) ? " {$address['zip']}" : ''),
64
+		( ! empty($address['country']) ? '<br>' : '')
65 65
 	);
66 66
 	$address_html .= sprintf(
67 67
 		'<span data-address-type="country">%s</span><br>',
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	// Address action.
72 72
 	$address_html .= sprintf(
73 73
 		'<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>',
74
-		__( 'Edit', 'give' ),
75
-		__( 'Remove', 'give' )
74
+		__('Edit', 'give'),
75
+		__('Remove', 'give')
76 76
 	);
77 77
 
78 78
 	/**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @since 2.0
82 82
 	 */
83
-	$address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args );
83
+	$address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args);
84 84
 
85 85
 	// Set unique id and index for multi type address.
86
-	if ( isset( $address_args['index'] ) ) {
86
+	if (isset($address_args['index'])) {
87 87
 		$address_label = "{$address_label} #{$address_args['index']}";
88 88
 	}
89 89
 
90
-	if ( isset( $address_args['id'] ) ) {
90
+	if (isset($address_args['id'])) {
91 91
 		$address_id = "{$address_id}_{$address_args['id']}";
92 92
 	}
93 93
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function give_donors_page() {
114 114
 	$default_views  = give_donor_views();
115
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
116
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
117
-		give_render_donor_view( $requested_view, $default_views );
115
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors';
116
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
117
+		give_render_donor_view($requested_view, $default_views);
118 118
 	} else {
119 119
 		give_donors_list();
120 120
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 	$views = array();
132 132
 
133
-	return apply_filters( 'give_donor_views', $views );
133
+	return apply_filters('give_donor_views', $views);
134 134
 
135 135
 }
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	$tabs = array();
146 146
 
147
-	return apply_filters( 'give_donor_tabs', $tabs );
147
+	return apply_filters('give_donor_tabs', $tabs);
148 148
 
149 149
 }
150 150
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function give_donors_list() {
158 158
 
159
-	include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php';
159
+	include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php';
160 160
 
161 161
 	$donors_table = new Give_Donor_List_Table();
162 162
 	$donors_table->prepare_items();
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 		 *
170 170
 		 * @since 1.0
171 171
 		 */
172
-		do_action( 'give_donors_table_top' );
172
+		do_action('give_donors_table_top');
173 173
 		?>
174 174
 
175 175
 		<hr class="wp-header-end">
176
-		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
177
-			<?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?>
176
+		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
177
+			<?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?>
178 178
 			<input type="hidden" name="post_type" value="give_forms" />
179 179
 			<input type="hidden" name="page" value="give-donors" />
180 180
 			<input type="hidden" name="view" value="donors" />
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		 *
192 192
 		 * @since 1.0
193 193
 		 */
194
-		do_action( 'give_donors_table_bottom' );
194
+		do_action('give_donors_table_bottom');
195 195
 		?>
196 196
 	</div>
197 197
 	<?php
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return void
209 209
  */
210
-function give_render_donor_view( $view, $callbacks ) {
210
+function give_render_donor_view($view, $callbacks) {
211 211
 
212 212
 	$render = true;
213 213
 
214
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
214
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
215 215
 
216
-	if ( ! current_user_can( $donor_view_role ) ) {
217
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
216
+	if ( ! current_user_can($donor_view_role)) {
217
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
218 218
 		$render = false;
219 219
 	}
220 220
 
221
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
222
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
221
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
222
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
223 223
 		$render = false;
224 224
 	}
225 225
 
226 226
 	$donor_id          = (int) $_GET['id'];
227
-	$reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : '';
228
-	$donor             = new Give_Donor( $donor_id );
227
+	$reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : '';
228
+	$donor             = new Give_Donor($donor_id);
229 229
 
230 230
 	// Reconnect User with Donor profile.
231
-	if ( $reconnect_user_id ) {
232
-		give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() );
231
+	if ($reconnect_user_id) {
232
+		give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array());
233 233
 	}
234 234
 
235
-	if ( empty( $donor->id ) ) {
236
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
235
+	if (empty($donor->id)) {
236
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
237 237
 		$render = false;
238 238
 	}
239 239
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 
243 243
 	<div class='wrap'>
244 244
 
245
-		<?php if ( give_get_errors() ) : ?>
245
+		<?php if (give_get_errors()) : ?>
246 246
 			<div class="error settings-error">
247
-				<?php Give()->notices->render_frontend_notices( 0 ); ?>
247
+				<?php Give()->notices->render_frontend_notices(0); ?>
248 248
 			</div>
249 249
 		<?php endif; ?>
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			<?php
253 253
 			printf(
254 254
 			/* translators: %s: donor number */
255
-				esc_html__( 'Donor %s', 'give' ),
255
+				esc_html__('Donor %s', 'give'),
256 256
 				$donor_id
257 257
 			);
258 258
 			?>
@@ -260,26 +260,26 @@  discard block
 block discarded – undo
260 260
 
261 261
 		<hr class="wp-header-end">
262 262
 
263
-		<?php if ( $donor && $render ) : ?>
263
+		<?php if ($donor && $render) : ?>
264 264
 
265 265
 			<h2 class="nav-tab-wrapper">
266 266
 				<?php
267
-				foreach ( $donor_tabs as $key => $tab ) :
267
+				foreach ($donor_tabs as $key => $tab) :
268 268
 					$active = $key === $view ? true : false;
269 269
 					$class  = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
270 270
 					printf(
271
-						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n",
272
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
273
-						esc_attr( $class ),
274
-						sanitize_html_class( $tab['dashicon'] ),
275
-						esc_html( $tab['title'] )
271
+						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
272
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)),
273
+						esc_attr($class),
274
+						sanitize_html_class($tab['dashicon']),
275
+						esc_html($tab['title'])
276 276
 					);
277 277
 				endforeach;
278 278
 				?>
279 279
 			</h2>
280 280
 
281 281
 			<div id="give-donor-card-wrapper">
282
-				<?php $callbacks[ $view ]( $donor ) ?>
282
+				<?php $callbacks[$view]($donor) ?>
283 283
 			</div>
284 284
 
285 285
 		<?php endif; ?>
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
  *
300 300
  * @return void
301 301
  */
302
-function give_donor_view( $donor ) {
302
+function give_donor_view($donor) {
303 303
 
304
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
304
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
305 305
 
306 306
 	/**
307 307
 	 * Fires in donor profile screen, above the donor card.
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @param object $donor The donor object being displayed.
312 312
 	 */
313
-	do_action( 'give_donor_card_top', $donor );
313
+	do_action('give_donor_card_top', $donor);
314 314
 
315 315
 	// Set Read only to the fields which needs to be locked.
316 316
 	$read_only = '';
317
-	if ( $donor->user_id ) {
317
+	if ($donor->user_id) {
318 318
 		$read_only = 'readonly="readonly"';
319 319
 	}
320 320
 	?>
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
 	<div id="donor-summary" class="info-wrapper donor-section postbox">
323 323
 
324 324
 		<form id="edit-donor-info" method="post"
325
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
325
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
326 326
 
327 327
 			<div class="donor-info">
328 328
 
329 329
 				<div class="donor-bio-header clearfix">
330 330
 
331 331
 					<div class="avatar-wrap left" id="donor-avatar">
332
-						<?php echo get_avatar( $donor->email ); ?>
332
+						<?php echo get_avatar($donor->email); ?>
333 333
 					</div>
334 334
 
335 335
 					<div id="donor-name-wrap" class="left">
@@ -337,18 +337,18 @@  discard block
 block discarded – undo
337 337
 						<span class="donor-name info-item edit-item">
338 338
 							<input <?php echo $read_only; ?> size="15" data-key="first_name"
339 339
 							                                 name="customerinfo[first_name]" type="text"
340
-							                                 value="<?php esc_attr_e( $donor->get_first_name() ); ?>"
341
-							                                 placeholder="<?php _e( 'First Name', 'give' ); ?>"/>
342
-							<?php if ( $donor->user_id ) : ?>
340
+							                                 value="<?php esc_attr_e($donor->get_first_name()); ?>"
341
+							                                 placeholder="<?php _e('First Name', 'give'); ?>"/>
342
+							<?php if ($donor->user_id) : ?>
343 343
 								<a href="#" class="give-lock-block">
344 344
 									<i class="give-icon give-icon-locked"></i>
345 345
 								</a>
346 346
 							<?php endif; ?>
347 347
 							<input <?php echo $read_only; ?> size="15" data-key="last_name"
348 348
 							                                 name="customerinfo[last_name]" type="text"
349
-							                                 value="<?php esc_attr_e( $donor->get_last_name() ); ?>"
350
-							                                 placeholder="<?php _e( 'Last Name', 'give' ); ?>"/>
351
-							<?php if ( $donor->user_id ) : ?>
349
+							                                 value="<?php esc_attr_e($donor->get_last_name()); ?>"
350
+							                                 placeholder="<?php _e('Last Name', 'give'); ?>"/>
351
+							<?php if ($donor->user_id) : ?>
352 352
 								<a href="#" class="give-lock-block">
353 353
 									<i class="give-icon give-icon-locked"></i>
354 354
 								</a>
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 									data-key="name"><?php echo $donor->name; ?></span></span>
359 359
 					</div>
360 360
 					<p class="donor-since info-item">
361
-						<?php _e( 'Donor since', 'give' ); ?>
362
-						<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
361
+						<?php _e('Donor since', 'give'); ?>
362
+						<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
363 363
 					</p>
364
-					<?php if ( current_user_can( $donor_edit_role ) ) : ?>
364
+					<?php if (current_user_can($donor_edit_role)) : ?>
365 365
 						<a href="#" id="edit-donor"
366
-						   class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
366
+						   class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
367 367
 					<?php endif; ?>
368 368
 				</div>
369 369
 				<!-- /donor-bio-header -->
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					<table class="widefat">
374 374
 						<tbody>
375 375
 						<tr class="alternate">
376
-							<th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th>
376
+							<th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th>
377 377
 							<td>
378 378
 									<span class="donor-user-id info-item edit-item">
379 379
 										<?php
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
 											'data'  => $data_atts,
391 391
 										);
392 392
 
393
-										if ( ! empty( $user_id ) ) {
394
-											$userdata              = get_userdata( $user_id );
393
+										if ( ! empty($user_id)) {
394
+											$userdata              = get_userdata($user_id);
395 395
 											$user_args['selected'] = $user_id;
396 396
 										}
397 397
 
398
-										echo Give()->html->ajax_user_search( $user_args );
398
+										echo Give()->html->ajax_user_search($user_args);
399 399
 										?>
400 400
 									</span>
401 401
 
402 402
 								<span class="donor-user-id info-item editable">
403
-										<?php if ( ! empty( $userdata ) ) : ?>
404
-											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
403
+										<?php if ( ! empty($userdata)) : ?>
404
+											<span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span>
405 405
 										<?php else: ?>
406
-											<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
406
+											<span data-key="user_id"><?php _e('None', 'give'); ?></span>
407 407
 										<?php endif; ?>
408
-									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
408
+									<?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0):
409 409
 
410 410
 										echo sprintf(
411 411
 											'- <span class="disconnect-user">
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 				                                       | <span class="view-user-profile">
415 415
  											                <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a>
416 416
  										               </span>',
417
-											__( 'Disconnects the current user ID from this donor record.', 'give' ),
418
-											__( 'Disconnect User', 'give' ),
419
-											'user-edit.php?user_id=' . $donor->user_id,
420
-											__( 'View User Profile of current user ID.', 'give' ),
421
-											__( 'View User Profile', 'give' )
417
+											__('Disconnects the current user ID from this donor record.', 'give'),
418
+											__('Disconnect User', 'give'),
419
+											'user-edit.php?user_id='.$donor->user_id,
420
+											__('View User Profile of current user ID.', 'give'),
421
+											__('View User Profile', 'give')
422 422
 										);
423 423
 
424 424
 										endif; ?>
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 
435 435
 			<span id="donor-edit-actions" class="edit-item">
436 436
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/>
437
-				<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?>
437
+				<?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?>
438 438
 				<input type="hidden" name="give_action" value="edit-donor"/>
439 439
 				<input type="submit" id="give-edit-donor-save" class="button-secondary"
440
-				       value="<?php _e( 'Update Donor', 'give' ); ?>"/>
441
-				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
440
+				       value="<?php _e('Update Donor', 'give'); ?>"/>
441
+				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
442 442
 			</span>
443 443
 
444 444
 		</form>
@@ -453,24 +453,24 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @param Give_Donor $donor The donor object being displayed.
455 455
 	 */
456
-	do_action( 'give_donor_before_stats', $donor );
456
+	do_action('give_donor_before_stats', $donor);
457 457
 	?>
458 458
 
459 459
 	<div id="donor-stats-wrapper" class="donor-section postbox clear">
460 460
 		<ul>
461 461
 			<li>
462
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>">
462
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>">
463 463
 					<span class="dashicons dashicons-heart"></span>
464 464
 					<?php
465 465
 					// Completed Donations.
466
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count );
467
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor );
466
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count);
467
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor);
468 468
 					?>
469 469
 				</a>
470 470
 			</li>
471 471
 			<li>
472 472
 				<span class="dashicons dashicons-chart-area"></span>
473
-				<?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
473
+				<?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?>
474 474
 			</li>
475 475
 			<?php
476 476
 			/**
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			 *
483 483
 			 * @param object $donor The donor object being displayed.
484 484
 			 */
485
-			do_action( 'give_donor_stats_list', $donor );
485
+			do_action('give_donor_stats_list', $donor);
486 486
 			?>
487 487
 		</ul>
488 488
 	</div>
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @param Give_Donor $donor The donor object being displayed.
497 497
 	 */
498
-	do_action( 'give_donor_before_address', $donor );
498
+	do_action('give_donor_before_address', $donor);
499 499
 	?>
500 500
 
501 501
 	<div id="donor-address-wrapper" class="donor-section clear">
502
-		<h3><?php _e( 'Addresses', 'give' ); ?></h3>
502
+		<h3><?php _e('Addresses', 'give'); ?></h3>
503 503
 
504 504
 		<div class="postbox">
505 505
 			<div class="give-spinner-wrapper">
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
 				<div class="all-address">
510 510
 					<div class="give-grid-row">
511 511
 						<?php
512
-						if ( ! empty( $donor->address ) ) :
512
+						if ( ! empty($donor->address)) :
513 513
 							// Default address always will be at zero array index.
514 514
 							$is_set_as_default = null;
515 515
 
516
-							foreach ( $donor->address as $address_type => $addresses ) {
516
+							foreach ($donor->address as $address_type => $addresses) {
517 517
 
518
-								switch ( true ) {
519
-									case is_array( end( $addresses ) ):
518
+								switch (true) {
519
+									case is_array(end($addresses)):
520 520
 										$index = 1;
521
-										foreach ( $addresses as $id => $address ) {
521
+										foreach ($addresses as $id => $address) {
522 522
 											echo __give_get_format_address(
523 523
 												$address,
524 524
 												array(
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
 												)
529 529
 											);
530 530
 
531
-											$index ++;
531
+											$index++;
532 532
 										}
533 533
 										break;
534 534
 
535
-									case is_string( end( $addresses ) ):
535
+									case is_string(end($addresses)):
536 536
 										echo __give_get_format_address(
537 537
 											$addresses,
538 538
 											array(
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
 						endif;
546 546
 						?>
547 547
 					</div>
548
-					<span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) {
548
+					<span class="give-no-address-message<?php if ( ! empty($donor->address)) {
549 549
 						echo ' give-hidden';
550 550
 					} ?>">
551
-						<?php _e( 'This donor does not have any addresses saved.', 'give' ); ?>
551
+						<?php _e('This donor does not have any addresses saved.', 'give'); ?>
552 552
 					</span>
553 553
 					<button class="button add-new-address">
554
-						<?php _e( 'Add Address', 'give' ); ?>
554
+						<?php _e('Add Address', 'give'); ?>
555 555
 					</button>
556 556
 				</div>
557 557
 
@@ -561,26 +561,26 @@  discard block
 block discarded – undo
561 561
 							<tbody>
562 562
 							<tr>
563 563
 								<th class="col">
564
-									<label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label>
564
+									<label class="country"><?php esc_html_e('Country:', 'give'); ?></label>
565 565
 								</th>
566 566
 								<td>
567 567
 									<?php
568
-									echo Give()->html->select( array(
568
+									echo Give()->html->select(array(
569 569
 										'options'          => give_get_country_list(),
570 570
 										'name'             => 'country',
571
-										'selected'         => give_get_option( 'base_country' ),
571
+										'selected'         => give_get_option('base_country'),
572 572
 										'show_option_all'  => false,
573 573
 										'show_option_none' => false,
574 574
 										'chosen'           => true,
575
-										'placeholder'      => esc_attr__( 'Select a country', 'give' ),
576
-										'data'             => array( 'search-type' => 'no_ajax' ),
577
-									) );
575
+										'placeholder'      => esc_attr__('Select a country', 'give'),
576
+										'data'             => array('search-type' => 'no_ajax'),
577
+									));
578 578
 									?>
579 579
 								</td>
580 580
 							</tr>
581 581
 							<tr>
582 582
 								<th class="col">
583
-									<label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
583
+									<label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label>
584 584
 								</th>
585 585
 								<td>
586 586
 									<input id="line1" name="line1" type="text" class="medium-text"/>
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 							</tr>
589 589
 							<tr>
590 590
 								<th class="col">
591
-									<label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
591
+									<label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label>
592 592
 								</th>
593 593
 								<td>
594 594
 									<input id="line2" type="text" name="line2" value="" class="medium-text"/>
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 							</tr>
598 598
 							<tr>
599 599
 								<th class="col">
600
-									<label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label>
600
+									<label for="city"><?php esc_html_e('City:', 'give'); ?></label>
601 601
 								</th>
602 602
 								<td>
603 603
 									<input id="city" type="text" name="city" value="" class="medium-text"/>
@@ -605,41 +605,41 @@  discard block
 block discarded – undo
605 605
 							</tr>
606 606
 							<?php
607 607
 							$no_states_country = give_no_states_country_list();
608
-							$base_country      = give_get_option( 'base_country' );
609
-							if ( ! array_key_exists( $base_country, $no_states_country ) ) {
608
+							$base_country      = give_get_option('base_country');
609
+							if ( ! array_key_exists($base_country, $no_states_country)) {
610 610
 								?>
611 611
 								<tr class="give-field-wrap">
612 612
 									<th class="col">
613
-										<label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
613
+										<label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
614 614
 									</th>
615 615
 									<td>
616 616
 										<?php
617
-										$states     = give_get_states( $base_country );
617
+										$states     = give_get_states($base_country);
618 618
 										$state_args = array(
619 619
 											'name'  => 'state',
620 620
 											'class' => 'regular-text',
621 621
 										);
622 622
 
623
-										if ( empty( $states ) ) {
623
+										if (empty($states)) {
624 624
 
625 625
 											// Show Text field, if empty states.
626
-											$state_args = wp_parse_args( $state_args, array(
627
-												'value' => give_get_option( 'base_state' ),
628
-											) );
629
-											echo Give()->html->text( $state_args );
626
+											$state_args = wp_parse_args($state_args, array(
627
+												'value' => give_get_option('base_state'),
628
+											));
629
+											echo Give()->html->text($state_args);
630 630
 										} else {
631 631
 
632 632
 											// Show Chosen DropDown, if states are not empty.
633
-											$state_args = wp_parse_args( $state_args, array(
633
+											$state_args = wp_parse_args($state_args, array(
634 634
 												'options'          => $states,
635
-												'selected'         => give_get_option( 'base_state' ),
635
+												'selected'         => give_get_option('base_state'),
636 636
 												'show_option_all'  => false,
637 637
 												'show_option_none' => false,
638 638
 												'chosen'           => true,
639
-												'placeholder'      => __( 'Select a state', 'give' ),
640
-												'data'             => array( 'search-type' => 'no_ajax' ),
641
-											) );
642
-											echo Give()->html->select( $state_args );
639
+												'placeholder'      => __('Select a state', 'give'),
640
+												'data'             => array('search-type' => 'no_ajax'),
641
+											));
642
+											echo Give()->html->select($state_args);
643 643
 										}
644 644
 										?>
645 645
 									</td>
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 							?>
650 650
 							<tr>
651 651
 								<th class="col">
652
-									<label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
652
+									<label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
653 653
 								</th>
654 654
 								<td>
655 655
 									<input id="zip" type="text" name="zip" value="" class="medium-text"/>
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
 							</tr>
658 658
 							<tr>
659 659
 								<td colspan="2">
660
-									<?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?>
660
+									<?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?>
661 661
 									<input type="hidden" name="address-action" value="add">
662 662
 									<input type="hidden" name="address-id" value="">
663 663
 									<input type="submit" class="button button-primary js-save"
664
-									       value="<?php _e( 'Save', 'give' ); ?>">&nbsp;&nbsp;<button
665
-											class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button>
664
+									       value="<?php _e('Save', 'give'); ?>">&nbsp;&nbsp;<button
665
+											class="button js-cancel"><?php _e('Cancel', 'give'); ?></button>
666 666
 								</td>
667 667
 							</tr>
668 668
 							</tbody>
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 *
682 682
 	 * @param Give_Donor $donor The donor object being displayed.
683 683
 	 */
684
-	do_action( 'give_donor_before_tables_wrapper', $donor );
684
+	do_action('give_donor_before_tables_wrapper', $donor);
685 685
 	?>
686 686
 
687 687
 	<div id="donor-tables-wrapper" class="donor-section">
@@ -694,46 +694,46 @@  discard block
 block discarded – undo
694 694
 		 *
695 695
 		 * @param object $donor The donor object being displayed.
696 696
 		 */
697
-		do_action( 'give_donor_before_tables', $donor );
697
+		do_action('give_donor_before_tables', $donor);
698 698
 		?>
699 699
 
700
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
700
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
701 701
 
702 702
 		<table class="wp-list-table widefat striped emails">
703 703
 			<thead>
704 704
 			<tr>
705
-				<th><?php _e( 'Email', 'give' ); ?></th>
706
-				<th><?php _e( 'Actions', 'give' ); ?></th>
705
+				<th><?php _e('Email', 'give'); ?></th>
706
+				<th><?php _e('Actions', 'give'); ?></th>
707 707
 			</tr>
708 708
 			</thead>
709 709
 
710 710
 			<tbody>
711
-			<?php if ( ! empty( $donor->emails ) ) { ?>
711
+			<?php if ( ! empty($donor->emails)) { ?>
712 712
 
713
-				<?php foreach ( $donor->emails as $key => $email ) : ?>
713
+				<?php foreach ($donor->emails as $key => $email) : ?>
714 714
 					<tr data-key="<?php echo $key; ?>">
715 715
 						<td>
716 716
 							<?php echo $email; ?>
717
-							<?php if ( 'primary' === $key ) : ?>
717
+							<?php if ('primary' === $key) : ?>
718 718
 								<span class="dashicons dashicons-star-filled primary-email-icon"></span>
719 719
 							<?php endif; ?>
720 720
 						</td>
721 721
 						<td>
722
-							<?php if ( 'primary' !== $key ) : ?>
722
+							<?php if ('primary' !== $key) : ?>
723 723
 								<?php
724
-								$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id );
725
-								$promote_url = wp_nonce_url( add_query_arg( array(
726
-									'email'       => rawurlencode( $email ),
724
+								$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id);
725
+								$promote_url = wp_nonce_url(add_query_arg(array(
726
+									'email'       => rawurlencode($email),
727 727
 									'give_action' => 'set_donor_primary_email',
728
-								), $base_url ), 'give-set-donor-primary-email' );
729
-								$remove_url  = wp_nonce_url( add_query_arg( array(
730
-									'email'       => rawurlencode( $email ),
728
+								), $base_url), 'give-set-donor-primary-email');
729
+								$remove_url = wp_nonce_url(add_query_arg(array(
730
+									'email'       => rawurlencode($email),
731 731
 									'give_action' => 'remove_donor_email',
732
-								), $base_url ), 'give-remove-donor-email' );
732
+								), $base_url), 'give-remove-donor-email');
733 733
 								?>
734
-								<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
734
+								<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
735 735
 								&nbsp;|&nbsp;
736
-								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
736
+								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
737 737
 							<?php endif; ?>
738 738
 						</td>
739 739
 					</tr>
@@ -743,14 +743,14 @@  discard block
 block discarded – undo
743 743
 					<td colspan="2" class="add-donor-email-td">
744 744
 						<div class="add-donor-email-wrapper">
745 745
 							<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/>
746
-							<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
746
+							<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
747 747
 							<input type="email" name="additional-email" value=""
748
-							       placeholder="<?php _e( 'Email Address', 'give' ); ?>"/>&nbsp;
748
+							       placeholder="<?php _e('Email Address', 'give'); ?>"/>&nbsp;
749 749
 							<input type="checkbox" name="make-additional-primary" value="1"
750 750
 							       id="make-additional-primary"/>&nbsp;<label
751
-									for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
751
+									for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
752 752
 							<button class="button-secondary give-add-donor-email"
753
-							        id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button>
753
+							        id="add-donor-email"><?php _e('Add Email', 'give'); ?></button>
754 754
 							<span class="spinner"></span>
755 755
 						</div>
756 756
 						<div class="notice-wrap"></div>
@@ -758,50 +758,50 @@  discard block
 block discarded – undo
758 758
 				</tr>
759 759
 			<?php } else { ?>
760 760
 				<tr>
761
-					<td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td>
761
+					<td colspan="2"><?php _e('No Emails Found', 'give'); ?></td>
762 762
 				</tr>
763 763
 			<?php }// End if().
764 764
 			?>
765 765
 			</tbody>
766 766
 		</table>
767 767
 
768
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
768
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
769 769
 		<?php
770
-		$payment_ids = explode( ',', $donor->payment_ids );
771
-		$payments    = give_get_payments( array(
770
+		$payment_ids = explode(',', $donor->payment_ids);
771
+		$payments    = give_get_payments(array(
772 772
 			'post__in' => $payment_ids,
773
-		) );
774
-		$payments    = array_slice( $payments, 0, 10 );
773
+		));
774
+		$payments    = array_slice($payments, 0, 10);
775 775
 		?>
776 776
 		<table class="wp-list-table widefat striped payments">
777 777
 			<thead>
778 778
 			<tr>
779
-				<th scope="col"><?php _e( 'ID', 'give' ); ?></th>
780
-				<th scope="col"><?php _e( 'Amount', 'give' ); ?></th>
781
-				<th scope="col"><?php _e( 'Date', 'give' ); ?></th>
782
-				<th scope="col"><?php _e( 'Status', 'give' ); ?></th>
783
-				<th scope="col"><?php _e( 'Actions', 'give' ); ?></th>
779
+				<th scope="col"><?php _e('ID', 'give'); ?></th>
780
+				<th scope="col"><?php _e('Amount', 'give'); ?></th>
781
+				<th scope="col"><?php _e('Date', 'give'); ?></th>
782
+				<th scope="col"><?php _e('Status', 'give'); ?></th>
783
+				<th scope="col"><?php _e('Actions', 'give'); ?></th>
784 784
 			</tr>
785 785
 			</thead>
786 786
 			<tbody>
787
-			<?php if ( ! empty( $payments ) ) { ?>
788
-				<?php foreach ( $payments as $payment ) : ?>
787
+			<?php if ( ! empty($payments)) { ?>
788
+				<?php foreach ($payments as $payment) : ?>
789 789
 					<tr>
790 790
 						<td><?php echo $payment->ID; ?></td>
791
-						<td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td>
792
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
793
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
791
+						<td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td>
792
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
793
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
794 794
 						<td>
795 795
 							<?php
796 796
 							printf(
797 797
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
798
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
798
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID),
799 799
 								sprintf(
800 800
 								/* translators: %s: Donation ID */
801
-									esc_attr__( 'View Donation %s.', 'give' ),
801
+									esc_attr__('View Donation %s.', 'give'),
802 802
 									$payment->ID
803 803
 								),
804
-								__( 'View Donation', 'give' )
804
+								__('View Donation', 'give')
805 805
 							);
806 806
 							?>
807 807
 
@@ -816,47 +816,47 @@  discard block
 block discarded – undo
816 816
 							 * @param object $donor   The donor object being displayed.
817 817
 							 * @param object $payment The payment object being displayed.
818 818
 							 */
819
-							do_action( 'give_donor_recent_purchases_actions', $donor, $payment );
819
+							do_action('give_donor_recent_purchases_actions', $donor, $payment);
820 820
 							?>
821 821
 						</td>
822 822
 					</tr>
823 823
 				<?php endforeach; ?>
824 824
 			<?php } else { ?>
825 825
 				<tr>
826
-					<td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td>
826
+					<td colspan="5"><?php _e('No donations found.', 'give'); ?></td>
827 827
 				</tr>
828 828
 			<?php }// End if().
829 829
 			?>
830 830
 			</tbody>
831 831
 		</table>
832 832
 
833
-		<h3><?php _e( 'Completed Forms', 'give' ); ?></h3>
833
+		<h3><?php _e('Completed Forms', 'give'); ?></h3>
834 834
 		<?php
835
-		$donations = give_get_users_completed_donations( $donor->email );
835
+		$donations = give_get_users_completed_donations($donor->email);
836 836
 		?>
837 837
 		<table class="wp-list-table widefat striped donations">
838 838
 			<thead>
839 839
 			<tr>
840
-				<th scope="col"><?php _e( 'Form', 'give' ); ?></th>
841
-				<th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th>
840
+				<th scope="col"><?php _e('Form', 'give'); ?></th>
841
+				<th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th>
842 842
 			</tr>
843 843
 			</thead>
844 844
 			<tbody>
845
-			<?php if ( ! empty( $donations ) ) { ?>
846
-				<?php foreach ( $donations as $donation ) : ?>
845
+			<?php if ( ! empty($donations)) { ?>
846
+				<?php foreach ($donations as $donation) : ?>
847 847
 					<tr>
848 848
 						<td><?php echo $donation->post_title; ?></td>
849 849
 						<td>
850 850
 							<?php
851 851
 							printf(
852 852
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
853
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
853
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
854 854
 								sprintf(
855 855
 								/* translators: %s: form name */
856
-									esc_attr__( 'View Form %s.', 'give' ),
856
+									esc_attr__('View Form %s.', 'give'),
857 857
 									$donation->post_title
858 858
 								),
859
-								__( 'View Form', 'give' )
859
+								__('View Form', 'give')
860 860
 							);
861 861
 							?>
862 862
 						</td>
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 				<?php endforeach; ?>
865 865
 			<?php } else { ?>
866 866
 				<tr>
867
-					<td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td>
867
+					<td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td>
868 868
 				</tr>
869 869
 			<?php } ?>
870 870
 			</tbody>
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		 *
879 879
 		 * @param object $donor The donor object being displayed.
880 880
 		 */
881
-		do_action( 'give_donor_after_tables', $donor );
881
+		do_action('give_donor_after_tables', $donor);
882 882
 		?>
883 883
 
884 884
 	</div>
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 	 *
892 892
 	 * @param object $donor The donor object being displayed.
893 893
 	 */
894
-	do_action( 'give_donor_card_bottom', $donor );
894
+	do_action('give_donor_card_bottom', $donor);
895 895
 
896 896
 }
897 897
 
@@ -904,31 +904,31 @@  discard block
 block discarded – undo
904 904
  *
905 905
  * @return void
906 906
  */
907
-function give_donor_notes_view( $donor ) {
907
+function give_donor_notes_view($donor) {
908 908
 
909
-	$paged       = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
910
-	$paged       = absint( $paged );
909
+	$paged       = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
910
+	$paged       = absint($paged);
911 911
 	$note_count  = $donor->get_notes_count();
912
-	$per_page    = apply_filters( 'give_donor_notes_per_page', 20 );
913
-	$total_pages = ceil( $note_count / $per_page );
914
-	$donor_notes = $donor->get_notes( $per_page, $paged );
912
+	$per_page    = apply_filters('give_donor_notes_per_page', 20);
913
+	$total_pages = ceil($note_count / $per_page);
914
+	$donor_notes = $donor->get_notes($per_page, $paged);
915 915
 	?>
916 916
 
917 917
 	<div id="donor-notes-wrapper">
918 918
 		<div class="donor-notes-header">
919
-			<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
919
+			<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
920 920
 		</div>
921
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
921
+		<h3><?php _e('Notes', 'give'); ?></h3>
922 922
 
923
-		<?php if ( 1 == $paged ) : ?>
923
+		<?php if (1 == $paged) : ?>
924 924
 			<div style="display: block; margin-bottom: 55px;">
925 925
 				<form id="give-add-donor-note" method="post"
926
-				      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>">
926
+				      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>">
927 927
 					<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea>
928 928
 					<br/>
929 929
 					<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/>
930 930
 					<input type="hidden" name="give_action" value="add-donor-note"/>
931
-					<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?>
931
+					<?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?>
932 932
 					<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/>
933 933
 				</form>
934 934
 			</div>
@@ -943,26 +943,26 @@  discard block
 block discarded – undo
943 943
 			'show_all' => true,
944 944
 		);
945 945
 
946
-		echo paginate_links( $pagination_args );
946
+		echo paginate_links($pagination_args);
947 947
 		?>
948 948
 
949 949
 		<div id="give-donor-notes" class="postbox">
950
-			<?php if ( count( $donor_notes ) > 0 ) { ?>
951
-				<?php foreach ( $donor_notes as $key => $note ) : ?>
950
+			<?php if (count($donor_notes) > 0) { ?>
951
+				<?php foreach ($donor_notes as $key => $note) : ?>
952 952
 					<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
953 953
 					<span class="note-content-wrap">
954
-						<?php echo stripslashes( $note ); ?>
954
+						<?php echo stripslashes($note); ?>
955 955
 					</span>
956 956
 					</div>
957 957
 				<?php endforeach; ?>
958 958
 			<?php } else { ?>
959 959
 				<div class="give-no-donor-notes">
960
-					<?php _e( 'No donor notes found.', 'give' ); ?>
960
+					<?php _e('No donor notes found.', 'give'); ?>
961 961
 				</div>
962 962
 			<?php } ?>
963 963
 		</div>
964 964
 
965
-		<?php echo paginate_links( $pagination_args ); ?>
965
+		<?php echo paginate_links($pagination_args); ?>
966 966
 
967 967
 	</div>
968 968
 
@@ -978,9 +978,9 @@  discard block
 block discarded – undo
978 978
  *
979 979
  * @return void
980 980
  */
981
-function give_donor_delete_view( $donor ) {
981
+function give_donor_delete_view($donor) {
982 982
 
983
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
983
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
984 984
 
985 985
 	/**
986 986
 	 * Fires in donor delete screen, above the content.
@@ -989,16 +989,16 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @param object $donor The donor object being displayed.
991 991
 	 */
992
-	do_action( 'give_donor_delete_top', $donor );
992
+	do_action('give_donor_delete_top', $donor);
993 993
 	?>
994 994
 
995 995
 	<div class="info-wrapper donor-section">
996 996
 
997 997
 		<form id="delete-donor" method="post"
998
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>">
998
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>">
999 999
 
1000 1000
 			<div class="donor-notes-header">
1001
-				<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
1001
+				<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
1002 1002
 			</div>
1003 1003
 
1004 1004
 
@@ -1006,20 +1006,20 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 				<span class="delete-donor-options">
1008 1008
 					<p>
1009
-						<?php echo Give()->html->checkbox( array(
1009
+						<?php echo Give()->html->checkbox(array(
1010 1010
 							'name' => 'give-donor-delete-confirm',
1011
-						) ); ?>
1012
-						<label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
1011
+						)); ?>
1012
+						<label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
1013 1013
 					</p>
1014 1014
 
1015 1015
 					<p>
1016
-						<?php echo Give()->html->checkbox( array(
1016
+						<?php echo Give()->html->checkbox(array(
1017 1017
 							'name'    => 'give-donor-delete-records',
1018 1018
 							'options' => array(
1019 1019
 								'disabled' => true,
1020 1020
 							),
1021
-						) ); ?>
1022
-						<label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label>
1021
+						)); ?>
1022
+						<label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label>
1023 1023
 					</p>
1024 1024
 
1025 1025
 					<?php
@@ -1032,19 +1032,19 @@  discard block
 block discarded – undo
1032 1032
 					 *
1033 1033
 					 * @param object $donor The donor object being displayed.
1034 1034
 					 */
1035
-					do_action( 'give_donor_delete_inputs', $donor );
1035
+					do_action('give_donor_delete_inputs', $donor);
1036 1036
 					?>
1037 1037
 				</span>
1038 1038
 
1039 1039
 				<span id="donor-edit-actions">
1040 1040
 					<input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/>
1041
-					<?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?>
1041
+					<?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?>
1042 1042
 					<input type="hidden" name="give_action" value="delete-donor"/>
1043 1043
 					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary"
1044
-					       value="<?php _e( 'Delete Donor', 'give' ); ?>"/>
1044
+					       value="<?php _e('Delete Donor', 'give'); ?>"/>
1045 1045
 					<a id="give-delete-donor-cancel"
1046
-					   href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"
1047
-					   class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
1046
+					   href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"
1047
+					   class="delete"><?php _e('Cancel', 'give'); ?></a>
1048 1048
 				</span>
1049 1049
 
1050 1050
 			</div>
@@ -1060,5 +1060,5 @@  discard block
 block discarded – undo
1060 1060
 	 *
1061 1061
 	 * @param object $donor The donor object being displayed.
1062 1062
 	 */
1063
-	do_action( 'give_donor_delete_bottom', $donor );
1063
+	do_action('give_donor_delete_bottom', $donor);
1064 1064
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -402,8 +402,11 @@
 block discarded – undo
402 402
 								<span class="donor-user-id info-item editable">
403 403
 										<?php if ( ! empty( $userdata ) ) : ?>
404 404
 											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
405
-										<?php else: ?>
406
-											<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
405
+										<?php else {
406
+	: ?>
407
+											<span data-key="user_id"><?php _e( 'None', 'give' );
408
+}
409
+?></span>
407 410
 										<?php endif; ?>
408 411
 									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
409 412
 
Please login to merge, or discard this patch.
includes/admin/donors/donor-actions.php 1 patch
Spacing   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,33 +23,33 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array|bool $output Response messages
25 25
  */
26
-function give_edit_donor( $args ) {
26
+function give_edit_donor($args) {
27 27
 
28
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
28
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
31
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
30
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
31
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
32 32
 			'response' => 403,
33
-		) );
33
+		));
34 34
 	}
35 35
 
36
-	if ( empty( $args ) ) {
36
+	if (empty($args)) {
37 37
 		return false;
38 38
 	}
39 39
 
40
-	$donor_info = give_clean( $args['customerinfo'] );
40
+	$donor_info = give_clean($args['customerinfo']);
41 41
 	$donor_id   = (int) $args['customerinfo']['id'];
42 42
 	$nonce      = $args['_wpnonce'];
43 43
 
44
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
45
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
44
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
45
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
46 46
 			'response' => 400,
47
-		) );
47
+		));
48 48
 	}
49 49
 
50
-	$donor = new Give_Donor( $donor_id );
50
+	$donor = new Give_Donor($donor_id);
51 51
 
52
-	if ( empty( $donor->id ) ) {
52
+	if (empty($donor->id)) {
53 53
 		return false;
54 54
 	}
55 55
 
@@ -64,39 +64,39 @@  discard block
 block discarded – undo
64 64
 		'country' => '',
65 65
 	);
66 66
 
67
-	$donor_info = wp_parse_args( $donor_info, $defaults );
67
+	$donor_info = wp_parse_args($donor_info, $defaults);
68 68
 
69
-	if ( (int) $donor_info['user_id'] !== (int) $donor->user_id ) {
69
+	if ((int) $donor_info['user_id'] !== (int) $donor->user_id) {
70 70
 
71 71
 		// Make sure we don't already have this user attached to a donor.
72
-		if ( ! empty( $donor_info['user_id'] ) && false !== Give()->donors->get_donor_by( 'user_id', $donor_info['user_id'] ) ) {
73
-			give_set_error( 'give-invalid-donor-user_id', sprintf( __( 'The User ID #%d is already associated with a different donor.', 'give' ), $donor_info['user_id'] ) );
72
+		if ( ! empty($donor_info['user_id']) && false !== Give()->donors->get_donor_by('user_id', $donor_info['user_id'])) {
73
+			give_set_error('give-invalid-donor-user_id', sprintf(__('The User ID #%d is already associated with a different donor.', 'give'), $donor_info['user_id']));
74 74
 		}
75 75
 
76 76
 		// Make sure it's actually a user.
77
-		$user = get_user_by( 'id', $donor_info['user_id'] );
78
-		if ( ! empty( $donor_info['user_id'] ) && false === $user ) {
79
-			give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID #%d does not exist. Please assign an existing user.', 'give' ), $donor_info['user_id'] ) );
77
+		$user = get_user_by('id', $donor_info['user_id']);
78
+		if ( ! empty($donor_info['user_id']) && false === $user) {
79
+			give_set_error('give-invalid-user_id', sprintf(__('The User ID #%d does not exist. Please assign an existing user.', 'give'), $donor_info['user_id']));
80 80
 		}
81 81
 	}
82 82
 
83
-	if ( give_get_errors() ) {
83
+	if (give_get_errors()) {
84 84
 		return false;
85 85
 	}
86 86
 
87 87
 	// If First name of donor is empty, then fetch the current first name of donor.
88
-	if ( empty( $donor_info['first_name'] ) ) {
88
+	if (empty($donor_info['first_name'])) {
89 89
 		$donor_info['first_name'] = $donor->get_first_name();
90 90
 	}
91 91
 
92 92
 	// Sanitize the inputs.
93 93
 	$donor_data               = array();
94
-	$donor_data['name']       = trim( "{$donor_info['first_name']} {$donor_info['last_name']}" );
94
+	$donor_data['name']       = trim("{$donor_info['first_name']} {$donor_info['last_name']}");
95 95
 	$donor_data['first_name'] = $donor_info['first_name'];
96 96
 	$donor_data['last_name']  = $donor_info['last_name'];
97 97
 	$donor_data['user_id']    = $donor_info['user_id'];
98 98
 
99
-	$donor_data             = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id );
99
+	$donor_data = apply_filters('give_edit_donor_info', $donor_data, $donor_id);
100 100
 
101 101
 	/**
102 102
 	 * Filter the address
@@ -104,28 +104,28 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @since 1.0
106 106
 	 */
107
-	$address                = apply_filters( 'give_edit_donor_address', array(), $donor_id );
107
+	$address                = apply_filters('give_edit_donor_address', array(), $donor_id);
108 108
 
109
-	$donor_data             = give_clean( $donor_data );
110
-	$address                = give_clean( $address );
109
+	$donor_data             = give_clean($donor_data);
110
+	$address                = give_clean($address);
111 111
 
112
-	$output = give_connect_user_donor_profile( $donor, $donor_data, $address );
112
+	$output = give_connect_user_donor_profile($donor, $donor_data, $address);
113 113
 
114
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
115
-		header( 'Content-Type: application/json' );
116
-		echo json_encode( $output );
114
+	if (defined('DOING_AJAX') && DOING_AJAX) {
115
+		header('Content-Type: application/json');
116
+		echo json_encode($output);
117 117
 		wp_die();
118 118
 	}
119 119
 
120
-	if ( $output['success'] ) {
121
-		wp_redirect( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-message=profile-updated" ) );
120
+	if ($output['success']) {
121
+		wp_redirect(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-message=profile-updated"));
122 122
 	}
123 123
 
124 124
 	exit;
125 125
 
126 126
 }
127 127
 
128
-add_action( 'give_edit-donor', 'give_edit_donor', 10, 1 );
128
+add_action('give_edit-donor', 'give_edit_donor', 10, 1);
129 129
 
130 130
 /**
131 131
  * Save a donor note.
@@ -136,40 +136,40 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return int The Note ID that was saved, or 0 if nothing was saved.
138 138
  */
139
-function give_donor_save_note( $args ) {
139
+function give_donor_save_note($args) {
140 140
 
141
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
141
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
142 142
 
143
-	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
144
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
143
+	if ( ! is_admin() || ! current_user_can($donor_view_role)) {
144
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
145 145
 			'response' => 403,
146
-		) );
146
+		));
147 147
 	}
148 148
 
149
-	if ( empty( $args ) ) {
149
+	if (empty($args)) {
150 150
 		return false;
151 151
 	}
152 152
 
153
-	$donor_note = trim( give_clean( $args['donor_note'] ) );
153
+	$donor_note = trim(give_clean($args['donor_note']));
154 154
 	$donor_id   = (int) $args['customer_id'];
155 155
 	$nonce      = $args['add_donor_note_nonce'];
156 156
 
157
-	if ( ! wp_verify_nonce( $nonce, 'add-donor-note' ) ) {
158
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
157
+	if ( ! wp_verify_nonce($nonce, 'add-donor-note')) {
158
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
159 159
 			'response' => 400,
160
-		) );
160
+		));
161 161
 	}
162 162
 
163
-	if ( empty( $donor_note ) ) {
164
-		give_set_error( 'empty-donor-note', __( 'A note is required.', 'give' ) );
163
+	if (empty($donor_note)) {
164
+		give_set_error('empty-donor-note', __('A note is required.', 'give'));
165 165
 	}
166 166
 
167
-	if ( give_get_errors() ) {
167
+	if (give_get_errors()) {
168 168
 		return false;
169 169
 	}
170 170
 
171
-	$donor    = new Give_Donor( $donor_id );
172
-	$new_note = $donor->add_note( $donor_note );
171
+	$donor    = new Give_Donor($donor_id);
172
+	$new_note = $donor->add_note($donor_note);
173 173
 
174 174
 	/**
175 175
 	 * Fires before inserting donor note.
@@ -179,22 +179,22 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @since 1.0
181 181
 	 */
182
-	do_action( 'give_pre_insert_donor_note', $donor_id, $new_note );
182
+	do_action('give_pre_insert_donor_note', $donor_id, $new_note);
183 183
 
184
-	if ( ! empty( $new_note ) && ! empty( $donor->id ) ) {
184
+	if ( ! empty($new_note) && ! empty($donor->id)) {
185 185
 
186 186
 		ob_start();
187 187
 		?>
188 188
 		<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
189 189
 			<span class="note-content-wrap">
190
-				<?php echo stripslashes( $new_note ); ?>
190
+				<?php echo stripslashes($new_note); ?>
191 191
 			</span>
192 192
 		</div>
193 193
 		<?php
194 194
 		$output = ob_get_contents();
195 195
 		ob_end_clean();
196 196
 
197
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
197
+		if (defined('DOING_AJAX') && DOING_AJAX) {
198 198
 			echo $output;
199 199
 			exit;
200 200
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 }
209 209
 
210
-add_action( 'give_add-donor-note', 'give_donor_save_note', 10, 1 );
210
+add_action('give_add-donor-note', 'give_donor_save_note', 10, 1);
211 211
 
212 212
 /**
213 213
  * Delete a donor.
@@ -218,41 +218,41 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return int Whether it was a successful deletion.
220 220
  */
221
-function give_donor_delete( $args ) {
221
+function give_donor_delete($args) {
222 222
 
223
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
223
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
224 224
 
225
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
226
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
225
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
226
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
227 227
 			'response' => 403,
228
-		) );
228
+		));
229 229
 	}
230 230
 
231
-	if ( empty( $args ) ) {
231
+	if (empty($args)) {
232 232
 		return false;
233 233
 	}
234 234
 
235 235
 	$donor_id    = (int) $args['customer_id'];
236
-	$confirm     = ! empty( $args['give-donor-delete-confirm'] ) ? true : false;
237
-	$remove_data = ! empty( $args['give-donor-delete-records'] ) ? true : false;
236
+	$confirm     = ! empty($args['give-donor-delete-confirm']) ? true : false;
237
+	$remove_data = ! empty($args['give-donor-delete-records']) ? true : false;
238 238
 	$nonce       = $args['_wpnonce'];
239 239
 
240
-	if ( ! wp_verify_nonce( $nonce, 'delete-donor' ) ) {
241
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
240
+	if ( ! wp_verify_nonce($nonce, 'delete-donor')) {
241
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
242 242
 			'response' => 400,
243
-		) );
243
+		));
244 244
 	}
245 245
 
246
-	if ( ! $confirm ) {
247
-		give_set_error( 'donor-delete-no-confirm', __( 'Please confirm you want to delete this donor.', 'give' ) );
246
+	if ( ! $confirm) {
247
+		give_set_error('donor-delete-no-confirm', __('Please confirm you want to delete this donor.', 'give'));
248 248
 	}
249 249
 
250
-	if ( give_get_errors() ) {
251
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id ) );
250
+	if (give_get_errors()) {
251
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id));
252 252
 		exit;
253 253
 	}
254 254
 
255
-	$donor = new Give_Donor( $donor_id );
255
+	$donor = new Give_Donor($donor_id);
256 256
 
257 257
 	/**
258 258
 	 * Fires before deleting donor.
@@ -263,50 +263,50 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @since 1.0
265 265
 	 */
266
-	do_action( 'give_pre_delete_donor', $donor_id, $confirm, $remove_data );
266
+	do_action('give_pre_delete_donor', $donor_id, $confirm, $remove_data);
267 267
 
268
-	if ( $donor->id > 0 ) {
268
+	if ($donor->id > 0) {
269 269
 
270
-		$payments_array = explode( ',', $donor->payment_ids );
271
-		$success        = Give()->donors->delete( $donor->id );
270
+		$payments_array = explode(',', $donor->payment_ids);
271
+		$success        = Give()->donors->delete($donor->id);
272 272
 
273
-		if ( $success ) {
273
+		if ($success) {
274 274
 
275
-			if ( $remove_data ) {
275
+			if ($remove_data) {
276 276
 
277 277
 				// Remove all donations, logs, etc.
278
-				foreach ( $payments_array as $payment_id ) {
279
-					give_delete_donation( $payment_id );
278
+				foreach ($payments_array as $payment_id) {
279
+					give_delete_donation($payment_id);
280 280
 				}
281 281
 			} else {
282 282
 
283 283
 				// Just set the donations to customer_id of 0.
284
-				foreach ( $payments_array as $payment_id ) {
285
-					give_update_payment_meta( $payment_id, '_give_payment_donor_id', 0 );
284
+				foreach ($payments_array as $payment_id) {
285
+					give_update_payment_meta($payment_id, '_give_payment_donor_id', 0);
286 286
 				}
287 287
 			}
288 288
 
289
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted' );
289
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted');
290 290
 
291 291
 		} else {
292 292
 
293
-			give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor.', 'give' ) );
294
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor_id );
293
+			give_set_error('give-donor-delete-failed', __('Error deleting donor.', 'give'));
294
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor_id);
295 295
 
296 296
 		}
297 297
 	} else {
298 298
 
299
-		give_set_error( 'give-donor-delete-invalid-id', __( 'Invalid Donor ID.', 'give' ) );
300
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
299
+		give_set_error('give-donor-delete-invalid-id', __('Invalid Donor ID.', 'give'));
300
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
301 301
 
302 302
 	}
303 303
 
304
-	wp_redirect( $redirect );
304
+	wp_redirect($redirect);
305 305
 	exit;
306 306
 
307 307
 }
308 308
 
309
-add_action( 'give_delete-donor', 'give_donor_delete', 10, 1 );
309
+add_action('give_delete-donor', 'give_donor_delete', 10, 1);
310 310
 
311 311
 /**
312 312
  * Disconnect a user ID from a donor
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return bool|array If the disconnect was successful.
319 319
  */
320
-function give_disconnect_donor_user_id( $args ) {
320
+function give_disconnect_donor_user_id($args) {
321 321
 
322
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
322
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
323 323
 
324
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
325
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
324
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
325
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
326 326
 			'response' => 403,
327
-		) );
327
+		));
328 328
 	}
329 329
 
330
-	if ( empty( $args ) ) {
330
+	if (empty($args)) {
331 331
 		return false;
332 332
 	}
333 333
 
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 
336 336
 	$nonce = $args['_wpnonce'];
337 337
 
338
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
339
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
338
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
339
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
340 340
 			'response' => 400,
341
-		) );
341
+		));
342 342
 	}
343 343
 
344
-	$donor = new Give_Donor( $donor_id );
345
-	if ( empty( $donor->id ) ) {
344
+	$donor = new Give_Donor($donor_id);
345
+	if (empty($donor->id)) {
346 346
 		return false;
347 347
 	}
348 348
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @since 1.0
358 358
 	 */
359
-	do_action( 'give_pre_donor_disconnect_user_id', $donor_id, $user_id );
359
+	do_action('give_pre_donor_disconnect_user_id', $donor_id, $user_id);
360 360
 
361 361
 	$output     = array();
362 362
 	$donor_args = array(
@@ -365,19 +365,19 @@  discard block
 block discarded – undo
365 365
 
366 366
 
367 367
 	$output['success'] = true;
368
-	if ( ! $donor->update( $donor_args ) ) {
369
-		update_user_meta( $user_id, '_give_is_donor_disconnected', true );
370
-		update_user_meta( $user_id, '_give_disconnected_donor_id', $donor->id );
371
-		$donor->update_meta( '_give_disconnected_user_id', $user_id );
368
+	if ( ! $donor->update($donor_args)) {
369
+		update_user_meta($user_id, '_give_is_donor_disconnected', true);
370
+		update_user_meta($user_id, '_give_disconnected_donor_id', $donor->id);
371
+		$donor->update_meta('_give_disconnected_user_id', $user_id);
372 372
 
373 373
 		$output['success'] = true;
374 374
 
375 375
 	} else {
376 376
 		$output['success'] = false;
377
-		give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor.', 'give' ) );
377
+		give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor.', 'give'));
378 378
 	}
379 379
 
380
-	$output['redirect'] = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' ) . $donor_id;
380
+	$output['redirect'] = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=').$donor_id;
381 381
 
382 382
 	/**
383 383
 	 * Fires after disconnecting user ID from a donor.
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @since 1.0
388 388
 	 */
389
-	do_action( 'give_post_donor_disconnect_user_id', $donor_id );
389
+	do_action('give_post_donor_disconnect_user_id', $donor_id);
390 390
 
391
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
392
-		header( 'Content-Type: application/json' );
393
-		echo json_encode( $output );
391
+	if (defined('DOING_AJAX') && DOING_AJAX) {
392
+		header('Content-Type: application/json');
393
+		echo json_encode($output);
394 394
 		wp_die();
395 395
 	}
396 396
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
 }
400 400
 
401
-add_action( 'give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1 );
401
+add_action('give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1);
402 402
 
403 403
 /**
404 404
  * Add an email address to the donor from within the admin and log a donor note.
@@ -409,86 +409,86 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return mixed If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string).
411 411
  */
412
-function give_add_donor_email( $args ) {
412
+function give_add_donor_email($args) {
413 413
 
414 414
 	$donor_id = '';
415
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
415
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
416 416
 
417
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
418
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
417
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
418
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
419 419
 			'response' => 403,
420
-		) );
420
+		));
421 421
 	}
422 422
 
423 423
 	$output = array();
424
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
424
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
425 425
 		$output['success'] = false;
426
-		if ( empty( $args['email'] ) ) {
427
-			$output['message'] = __( 'Email address is required.', 'give' );
428
-		} elseif ( empty( $args['customer_id'] ) ) {
429
-			$output['message'] = __( 'Donor ID is required.', 'give' );
426
+		if (empty($args['email'])) {
427
+			$output['message'] = __('Email address is required.', 'give');
428
+		} elseif (empty($args['customer_id'])) {
429
+			$output['message'] = __('Donor ID is required.', 'give');
430 430
 		} else {
431
-			$output['message'] = __( 'An error has occurred. Please try again.', 'give' );
431
+			$output['message'] = __('An error has occurred. Please try again.', 'give');
432 432
 		}
433
-	} elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
433
+	} elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
434 434
 		$output = array(
435 435
 			'success' => false,
436
-			'message' => __( 'Nonce verification failed.', 'give' ),
436
+			'message' => __('Nonce verification failed.', 'give'),
437 437
 		);
438
-	} elseif ( ! is_email( $args['email'] ) ) {
438
+	} elseif ( ! is_email($args['email'])) {
439 439
 		$output = array(
440 440
 			'success' => false,
441
-			'message' => __( 'Invalid email.', 'give' ),
441
+			'message' => __('Invalid email.', 'give'),
442 442
 		);
443 443
 	} else {
444
-		$email    = sanitize_email( $args['email'] );
444
+		$email    = sanitize_email($args['email']);
445 445
 		$donor_id = (int) $args['customer_id'];
446 446
 		$primary  = 'true' === $args['primary'] ? true : false;
447
-		$donor    = new Give_Donor( $donor_id );
448
-		if ( false === $donor->add_email( $email, $primary ) ) {
449
-			if ( in_array( $email, $donor->emails ) ) {
447
+		$donor    = new Give_Donor($donor_id);
448
+		if (false === $donor->add_email($email, $primary)) {
449
+			if (in_array($email, $donor->emails)) {
450 450
 				$output = array(
451 451
 					'success' => false,
452
-					'message' => __( 'Email already associated with this donor.', 'give' ),
452
+					'message' => __('Email already associated with this donor.', 'give'),
453 453
 				);
454 454
 			} else {
455 455
 				$output = array(
456 456
 					'success' => false,
457
-					'message' => __( 'Email address is already associated with another donor.', 'give' ),
457
+					'message' => __('Email address is already associated with another donor.', 'give'),
458 458
 				);
459 459
 			}
460 460
 		} else {
461
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&give-message=email-added' );
461
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&give-message=email-added');
462 462
 			$output   = array(
463 463
 				'success'  => true,
464
-				'message'  => __( 'Email successfully added to donor.', 'give' ),
464
+				'message'  => __('Email successfully added to donor.', 'give'),
465 465
 				'redirect' => $redirect,
466 466
 			);
467 467
 
468 468
 			$user       = wp_get_current_user();
469
-			$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
470
-			$donor_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login );
471
-			$donor->add_note( $donor_note );
469
+			$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
470
+			$donor_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login);
471
+			$donor->add_note($donor_note);
472 472
 
473
-			if ( $primary ) {
474
-				$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login );
475
-				$donor->add_note( $donor_note );
473
+			if ($primary) {
474
+				$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login);
475
+				$donor->add_note($donor_note);
476 476
 			}
477 477
 		}
478 478
 	} // End if().
479 479
 
480
-	do_action( 'give_post_add_donor_email', $donor_id, $args );
480
+	do_action('give_post_add_donor_email', $donor_id, $args);
481 481
 
482
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
483
-		header( 'Content-Type: application/json' );
484
-		echo json_encode( $output );
482
+	if (defined('DOING_AJAX') && DOING_AJAX) {
483
+		header('Content-Type: application/json');
484
+		echo json_encode($output);
485 485
 		wp_die();
486 486
 	}
487 487
 
488 488
 	return $output;
489 489
 }
490 490
 
491
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
491
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
492 492
 
493 493
 
494 494
 /**
@@ -499,39 +499,39 @@  discard block
 block discarded – undo
499 499
  * @return bool|null
500 500
  */
501 501
 function give_remove_donor_email() {
502
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
502
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
503 503
 		return false;
504 504
 	}
505
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
505
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
506 506
 		return false;
507 507
 	}
508
-	if ( empty( $_GET['_wpnonce'] ) ) {
508
+	if (empty($_GET['_wpnonce'])) {
509 509
 		return false;
510 510
 	}
511 511
 
512 512
 	$nonce = $_GET['_wpnonce'];
513
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
514
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
513
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
514
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
515 515
 			'response' => 403,
516
-		) );
516
+		));
517 517
 	}
518 518
 
519
-	$donor = new Give_Donor( $_GET['id'] );
520
-	if ( $donor->remove_email( $_GET['email'] ) ) {
521
-		$url        = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
519
+	$donor = new Give_Donor($_GET['id']);
520
+	if ($donor->remove_email($_GET['email'])) {
521
+		$url        = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
522 522
 		$user       = wp_get_current_user();
523
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
524
-		$donor_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login );
525
-		$donor->add_note( $donor_note );
523
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
524
+		$donor_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login);
525
+		$donor->add_note($donor_note);
526 526
 	} else {
527
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
527
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
528 528
 	}
529 529
 
530
-	wp_safe_redirect( $url );
530
+	wp_safe_redirect($url);
531 531
 	exit;
532 532
 }
533 533
 
534
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
534
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
535 535
 
536 536
 
537 537
 /**
@@ -543,44 +543,44 @@  discard block
 block discarded – undo
543 543
  * @return bool|null
544 544
  */
545 545
 function give_set_donor_primary_email() {
546
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
546
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
547 547
 		return false;
548 548
 	}
549 549
 
550
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
550
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
551 551
 		return false;
552 552
 	}
553 553
 
554
-	if ( empty( $_GET['_wpnonce'] ) ) {
554
+	if (empty($_GET['_wpnonce'])) {
555 555
 		return false;
556 556
 	}
557 557
 
558 558
 	$nonce = $_GET['_wpnonce'];
559 559
 
560
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
561
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
560
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
561
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
562 562
 			'response' => 403,
563
-		) );
563
+		));
564 564
 	}
565 565
 
566
-	$donor = new Give_Donor( $_GET['id'] );
566
+	$donor = new Give_Donor($_GET['id']);
567 567
 
568
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
569
-		$url        = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
568
+	if ($donor->set_primary_email($_GET['email'])) {
569
+		$url        = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
570 570
 		$user       = wp_get_current_user();
571
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
572
-		$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login );
571
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
572
+		$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login);
573 573
 
574
-		$donor->add_note( $donor_note );
574
+		$donor->add_note($donor_note);
575 575
 	} else {
576
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
576
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
577 577
 	}
578 578
 
579
-	wp_safe_redirect( $url );
579
+	wp_safe_redirect($url);
580 580
 	exit;
581 581
 }
582 582
 
583
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
583
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
584 584
 
585 585
 /**
586 586
  * Delete Donor using Bulk Actions.
@@ -591,57 +591,57 @@  discard block
 block discarded – undo
591 591
  *
592 592
  * @return void
593 593
  */
594
-function give_delete_donor( $args ) {
594
+function give_delete_donor($args) {
595 595
 
596
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
596
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
597 597
 
598
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
599
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
598
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
599
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
600 600
 			'response' => 403,
601
-		) );
601
+		));
602 602
 	}
603 603
 
604 604
 	$give_args            = array();
605
-	$donor_ids            = ( ! empty( $_GET['donor'] ) && is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array();
606
-	$delete_donor         = ! empty( $_GET['give-delete-donor-confirm'] ) ? $_GET['give-delete-donor-confirm'] : '';
607
-	$delete_donations     = ! empty( $_GET['give-delete-donor-records'] ) ? $_GET['give-delete-donor-records'] : '';
608
-	$search_keyword       = ! empty( $_GET['s'] ) ? $_GET['s'] : '';
609
-	$give_args['orderby'] = ! empty( $_GET['orderby'] ) ? $_GET['orderby'] : 'id';
610
-	$give_args['order']   = ! empty( $_GET['order'] ) ? $_GET['order'] : 'desc';
605
+	$donor_ids            = ( ! empty($_GET['donor']) && is_array($_GET['donor']) && count($_GET['donor']) > 0) ? $_GET['donor'] : array();
606
+	$delete_donor         = ! empty($_GET['give-delete-donor-confirm']) ? $_GET['give-delete-donor-confirm'] : '';
607
+	$delete_donations     = ! empty($_GET['give-delete-donor-records']) ? $_GET['give-delete-donor-records'] : '';
608
+	$search_keyword       = ! empty($_GET['s']) ? $_GET['s'] : '';
609
+	$give_args['orderby'] = ! empty($_GET['orderby']) ? $_GET['orderby'] : 'id';
610
+	$give_args['order']   = ! empty($_GET['order']) ? $_GET['order'] : 'desc';
611 611
 	$nonce                = $args['_wpnonce'];
612 612
 
613 613
 	// Verify Nonce for deleting bulk donors.
614
-	if ( ! wp_verify_nonce( $nonce, 'bulk-donors' ) ) {
615
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
614
+	if ( ! wp_verify_nonce($nonce, 'bulk-donors')) {
615
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
616 616
 			'response' => 400,
617
-		) );
617
+		));
618 618
 	}
619 619
 
620
-	if( count( $donor_ids ) > 0 ) {
621
-		foreach ( $donor_ids as $donor_id ) {
622
-			$donor = new Give_Donor( $donor_id );
620
+	if (count($donor_ids) > 0) {
621
+		foreach ($donor_ids as $donor_id) {
622
+			$donor = new Give_Donor($donor_id);
623 623
 
624
-			if ( $donor->id > 0 ) {
624
+			if ($donor->id > 0) {
625 625
 
626
-				if( $delete_donor ) {
627
-					$donor_deleted = Give()->donors->delete( $donor->id );
626
+				if ($delete_donor) {
627
+					$donor_deleted = Give()->donors->delete($donor->id);
628 628
 
629
-					if ( $donor_deleted ) {
630
-						$donation_ids  = explode( ',', $donor->payment_ids );
629
+					if ($donor_deleted) {
630
+						$donation_ids = explode(',', $donor->payment_ids);
631 631
 
632
-						if( $delete_donations ) {
632
+						if ($delete_donations) {
633 633
 
634 634
 							// Remove all donations, logs, etc.
635
-							foreach ( $donation_ids as $donation_id ) {
636
-								give_delete_donation( $donation_id );
635
+							foreach ($donation_ids as $donation_id) {
636
+								give_delete_donation($donation_id);
637 637
 							}
638 638
 
639 639
 							$give_args['give-message'] = 'donor-donations-deleted';
640 640
 						} else {
641 641
 
642 642
 							// Just set the donations to customer_id of 0.
643
-							foreach ( $donation_ids as $donation_id ) {
644
-								give_update_payment_meta( $donation_id, '_give_payment_customer_id', 0 );
643
+							foreach ($donation_ids as $donation_id) {
644
+								give_update_payment_meta($donation_id, '_give_payment_customer_id', 0);
645 645
 							}
646 646
 
647 647
 							$give_args['give-message'] = 'donor-deleted';
@@ -658,13 +658,13 @@  discard block
 block discarded – undo
658 658
 		}
659 659
 
660 660
 		// Add Search Keyword on redirection, if it exists.
661
-		if ( ! empty( $search_keyword ) ) {
661
+		if ( ! empty($search_keyword)) {
662 662
 			$give_args['s'] = $search_keyword;
663 663
 		}
664 664
 
665
-		wp_redirect( add_query_arg( $give_args, admin_url( 'edit.php?post_type=give_forms&page=give-donors' ) ) );
665
+		wp_redirect(add_query_arg($give_args, admin_url('edit.php?post_type=give_forms&page=give-donors')));
666 666
 		give_die();
667 667
 	}
668 668
 }
669 669
 
670
-add_action( 'give_delete_donor', 'give_delete_donor' );
671 670
\ No newline at end of file
671
+add_action('give_delete_donor', 'give_delete_donor');
672 672
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 								'disabled' => __( 'Disabled', 'give' ),
98 98
 							)
99 99
 						),
100
-                        array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
102
-                            'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
105
-                            'type'  => 'give_docs_link',
106
-                        ),
100
+						array(
101
+							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
102
+							'id'    => 'paypal_standard_gateway_settings_docs_link',
103
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
+							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
105
+							'type'  => 'give_docs_link',
106
+						),
107 107
 						array(
108 108
 							'type' => 'sectionend',
109 109
 							'id'   => 'give_title_gateway_settings_2',
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
 							'id'   => 'default_gateway',
184 184
 							'type' => 'default_gateway'
185 185
 						),
186
-                        array(
187
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
188
-                            'id'    => 'gateway_settings_docs_link',
189
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
190
-                            'title' => __( 'Gateway Settings', 'give' ),
191
-                            'type'  => 'give_docs_link',
192
-                        ),
186
+						array(
187
+							'name'  => __( 'Gateways Docs Link', 'give' ),
188
+							'id'    => 'gateway_settings_docs_link',
189
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
190
+							'title' => __( 'Gateway Settings', 'give' ),
191
+							'type'  => 'give_docs_link',
192
+						),
193 193
 						array(
194 194
 							'id'   => 'give_title_gateway_settings_1',
195 195
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'paypal-standard':
49 49
 					$settings = array(
50 50
 						// Section 2: PayPal Standard.
@@ -53,55 +53,55 @@  discard block
 block discarded – undo
53 53
 							'id'   => 'give_title_gateway_settings_2',
54 54
 						),
55 55
 						array(
56
-							'name' => __( 'PayPal Email', 'give' ),
57
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
56
+							'name' => __('PayPal Email', 'give'),
57
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
58 58
 							'id'   => 'paypal_email',
59 59
 							'type' => 'email',
60 60
 						),
61 61
 						array(
62
-							'name' => __( 'PayPal Page Style', 'give' ),
63
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
62
+							'name' => __('PayPal Page Style', 'give'),
63
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
64 64
 							'id'   => 'paypal_page_style',
65 65
 							'type' => 'text',
66 66
 						),
67 67
 						array(
68
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
69
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
68
+							'name'    => __('PayPal Transaction Type', 'give'),
69
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
70 70
 							'id'      => 'paypal_button_type',
71 71
 							'type'    => 'radio_inline',
72 72
 							'options' => array(
73
-								'donation' => __( 'Donation', 'give' ),
74
-								'standard' => __( 'Standard Transaction', 'give' )
73
+								'donation' => __('Donation', 'give'),
74
+								'standard' => __('Standard Transaction', 'give')
75 75
 							),
76 76
 							'default' => 'donation',
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Billing Details', 'give' ),
80
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
79
+							'name'    => __('Billing Details', 'give'),
80
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
81 81
 							'id'      => 'paypal_standard_billing_details',
82 82
 							'type'    => 'radio_inline',
83 83
 							'default' => 'disabled',
84 84
 							'options' => array(
85
-								'enabled'  => __( 'Enabled', 'give' ),
86
-								'disabled' => __( 'Disabled', 'give' ),
85
+								'enabled'  => __('Enabled', 'give'),
86
+								'disabled' => __('Disabled', 'give'),
87 87
 							)
88 88
 						),
89 89
 						array(
90
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
91
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
90
+							'name'    => __('PayPal IPN Verification', 'give'),
91
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
92 92
 							'id'      => 'paypal_verification',
93 93
 							'type'    => 'radio_inline',
94 94
 							'default' => 'enabled',
95 95
 							'options' => array(
96
-								'enabled'  => __( 'Enabled', 'give' ),
97
-								'disabled' => __( 'Disabled', 'give' ),
96
+								'enabled'  => __('Enabled', 'give'),
97
+								'disabled' => __('Disabled', 'give'),
98 98
 							)
99 99
 						),
100 100
                         array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
101
+                            'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
102 102
                             'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
103
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
104
+                            'title' => __('PayPal Standard Gateway Settings', 'give'),
105 105
                             'type'  => 'give_docs_link',
106 106
                         ),
107 107
 						array(
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 							'id'   => 'give_title_gateway_settings_3',
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Collect Billing Details', 'give' ),
123
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
122
+							'name'    => __('Collect Billing Details', 'give'),
123
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
124 124
 							'id'      => 'give_offline_donation_enable_billing_fields',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'disabled',
127 127
 							'options' => array(
128
-								'enabled'  => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' )
128
+								'enabled'  => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give')
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
134
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
133
+							'name'    => __('Offline Donation Instructions', 'give'),
134
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
135 135
 							'id'      => 'global_offline_donation_content',
136 136
 							'default' => give_get_default_offline_donation_content(),
137 137
 							'type'    => 'wysiwyg',
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 							)
141 141
 						),
142 142
 						array(
143
-							'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
143
+							'name'  => esc_html__('Offline Donations Settings Docs Link', 'give'),
144 144
 							'id'    => 'offline_gateway_settings_docs_link',
145
-							'url'   => esc_url( 'http://docs.givewp.com/offlinegateway' ),
146
-							'title' => __( 'Offline Gateway Settings', 'give' ),
145
+							'url'   => esc_url('http://docs.givewp.com/offlinegateway'),
146
+							'title' => __('Offline Gateway Settings', 'give'),
147 147
 							'type'  => 'give_docs_link',
148 148
 						),
149 149
 						array(
@@ -161,33 +161,33 @@  discard block
 block discarded – undo
161 161
 							'type' => 'title'
162 162
 						),
163 163
 						array(
164
-							'name'    => __( 'Test Mode', 'give' ),
165
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
164
+							'name'    => __('Test Mode', 'give'),
165
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
166 166
 							'id'      => 'test_mode',
167 167
 							'type'    => 'radio_inline',
168 168
 							'default' => 'disabled',
169 169
 							'options' => array(
170
-								'enabled'  => __( 'Enabled', 'give' ),
171
-								'disabled' => __( 'Disabled', 'give' ),
170
+								'enabled'  => __('Enabled', 'give'),
171
+								'disabled' => __('Disabled', 'give'),
172 172
 							)
173 173
 						),
174 174
 						array(
175
-							'name' => __( 'Enabled Gateways', 'give' ),
176
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
175
+							'name' => __('Enabled Gateways', 'give'),
176
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
177 177
 							'id'   => 'gateways',
178 178
 							'type' => 'enabled_gateways'
179 179
 						),
180 180
 						array(
181
-							'name' => __( 'Default Gateway', 'give' ),
182
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
181
+							'name' => __('Default Gateway', 'give'),
182
+							'desc' => __('The gateway that will be selected by default.', 'give'),
183 183
 							'id'   => 'default_gateway',
184 184
 							'type' => 'default_gateway'
185 185
 						),
186 186
                         array(
187
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
187
+                            'name'  => __('Gateways Docs Link', 'give'),
188 188
                             'id'    => 'gateway_settings_docs_link',
189
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
190
-                            'title' => __( 'Gateway Settings', 'give' ),
189
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
190
+                            'title' => __('Gateway Settings', 'give'),
191 191
                             'type'  => 'give_docs_link',
192 192
                         ),
193 193
 						array(
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			 * Filter the payment gateways settings.
203 203
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
204 204
 			 */
205
-			$settings = apply_filters( 'give_settings_gateways', $settings );
205
+			$settings = apply_filters('give_settings_gateways', $settings);
206 206
 
207 207
 			/**
208 208
 			 * Filter the settings.
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			 *
212 212
 			 * @param  array $settings
213 213
 			 */
214
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
214
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
215 215
 
216 216
 			// Output.
217 217
 			return $settings;
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 		 */
226 226
 		public function get_sections() {
227 227
 			$sections = array(
228
-				'gateways-settings' => __( 'Gateways', 'give' ),
229
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
230
-				'offline-donations' => __( 'Offline Donations', 'give' )
228
+				'gateways-settings' => __('Gateways', 'give'),
229
+				'paypal-standard'   => __('PayPal Standard', 'give'),
230
+				'offline-donations' => __('Offline Donations', 'give')
231 231
 			);
232 232
 
233
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
233
+			return apply_filters('give_get_sections_'.$this->id, $sections);
234 234
 		}
235 235
 	}
236 236
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-cmb2-backward-compatibility.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) :
12
+if ( ! class_exists('Give_CMB2_Settings_Loader')) :
13 13
 
14 14
 	/**
15 15
 	 * This class loads the cmb2 settings.
@@ -52,30 +52,30 @@  discard block
 block discarded – undo
52 52
 
53 53
 			// Get current tab.
54 54
 			$this->current_tab     = give_get_current_setting_tab();
55
-			$this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] );
55
+			$this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']);
56 56
 
57 57
 			// Tab ID.
58 58
 			$this->id = $this->current_tab;
59 59
 
60 60
 			// Add addon tabs.
61
-			add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 );
61
+			add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999);
62 62
 
63 63
 			// Add save hook to addons.
64
-			add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 );
64
+			add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999);
65 65
 
66 66
 			// Add backward compatibility filters plugin settings.
67
-			$setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' );
67
+			$setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses');
68 68
 
69 69
 			// Filter Payment Gateways settings.
70
-			if ( in_array( $this->current_tab, $setting_tabs ) ) {
71
-				add_filter( "give_get_settings_{$this->current_tab}", array(
70
+			if (in_array($this->current_tab, $setting_tabs)) {
71
+				add_filter("give_get_settings_{$this->current_tab}", array(
72 72
 					$this,
73 73
 					'get_filtered_addon_settings',
74
-				), 999999, 1 );
75
-				add_filter( "give_get_sections_{$this->current_tab}", array(
74
+				), 999999, 1);
75
+				add_filter("give_get_sections_{$this->current_tab}", array(
76 76
 					$this,
77 77
 					'get_filtered_addon_sections',
78
-				), 999999, 1 );
78
+				), 999999, 1);
79 79
 			}
80 80
 		}
81 81
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @return string
90 90
 		 */
91
-		function set_default_setting_tab( $setting_tab ) {
91
+		function set_default_setting_tab($setting_tab) {
92 92
 			$default_tab = '';
93 93
 
94 94
 			// Set default tab to first setting tab.
95
-			if ( $sections = array_keys( $this->get_sections() ) ) {
96
-				$default_tab = current( $sections );
95
+			if ($sections = array_keys($this->get_sections())) {
96
+				$default_tab = current($sections);
97 97
 			}
98 98
 
99 99
 			return $default_tab;
@@ -108,29 +108,29 @@  discard block
 block discarded – undo
108 108
 		 *
109 109
 		 * @return mixed
110 110
 		 */
111
-		function add_addon_settings_page( $pages ) {
111
+		function add_addon_settings_page($pages) {
112 112
 			// Previous setting page.
113 113
 			$previous_pages = $this->prev_settings->give_get_settings_tabs();
114 114
 
115 115
 			// API and System Info setting tab merge to Tools setting tab, so remove them from tabs.
116
-			unset( $previous_pages['api'] );
117
-			unset( $previous_pages['system_info'] );
116
+			unset($previous_pages['api']);
117
+			unset($previous_pages['system_info']);
118 118
 
119 119
 			// Tab is not register.
120
-			$pages_diff = array_keys( array_diff( $previous_pages, $pages ) );
120
+			$pages_diff = array_keys(array_diff($previous_pages, $pages));
121 121
 
122 122
 			// Merge old settings with new settings.
123
-			$pages = array_merge( $pages, $previous_pages );
123
+			$pages = array_merge($pages, $previous_pages);
124 124
 
125
-			if ( in_array( $this->current_tab, $pages_diff ) ) {
125
+			if (in_array($this->current_tab, $pages_diff)) {
126 126
 				// Filter & actions.
127
-				add_filter( "give_default_setting_tab_section_{$this->current_tab}", array(
127
+				add_filter("give_default_setting_tab_section_{$this->current_tab}", array(
128 128
 					$this,
129 129
 					'set_default_setting_tab',
130
-				), 10 );
131
-				add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) );
132
-				add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 );
133
-				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) );
130
+				), 10);
131
+				add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections'));
132
+				add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10);
133
+				add_action("give-settings_save_{$this->current_tab}", array($this, 'save'));
134 134
 			}
135 135
 
136 136
 			return $pages;
@@ -146,29 +146,29 @@  discard block
 block discarded – undo
146 146
 		 *
147 147
 		 * @return mixed
148 148
 		 */
149
-		function setup_addon_save_hook( $pages ) {
149
+		function setup_addon_save_hook($pages) {
150 150
 			$page_ids = array();
151 151
 
152
-			foreach ( $pages as $page ) {
153
-				$page_ids = $page->add_settings_page( $page_ids );
152
+			foreach ($pages as $page) {
153
+				$page_ids = $page->add_settings_page($page_ids);
154 154
 			}
155 155
 
156 156
 			// Previous setting page.
157 157
 			$previous_pages = $this->prev_settings->give_get_settings_tabs();
158 158
 
159 159
 			// API and System Info setting tab merge to Tools setting tab, so remove them from tabs.
160
-			unset( $previous_pages['api'] );
161
-			unset( $previous_pages['system_info'] );
160
+			unset($previous_pages['api']);
161
+			unset($previous_pages['system_info']);
162 162
 
163 163
 			// Tab is not register.
164
-			$pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) );
164
+			$pages_diff = array_keys(array_diff($previous_pages, $page_ids));
165 165
 
166 166
 			// Merge old settings with new settings.
167 167
 			// $pages = array_merge( $page_ids, $previous_pages );
168 168
 
169
-			if ( in_array( $this->current_tab, $pages_diff ) ) {
169
+			if (in_array($this->current_tab, $pages_diff)) {
170 170
 				// Filter & actions.
171
-				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) );
171
+				add_action("give-settings_save_{$this->current_tab}", array($this, 'save'));
172 172
 			}
173 173
 
174 174
 			return $pages;
@@ -183,16 +183,16 @@  discard block
 block discarded – undo
183 183
 		 *
184 184
 		 * @return string
185 185
 		 */
186
-		function get_section_name( $field_name ) {
186
+		function get_section_name($field_name) {
187 187
 			// Bailout.
188
-			if ( empty( $field_name ) ) {
188
+			if (empty($field_name)) {
189 189
 				return $field_name;
190 190
 			}
191 191
 
192
-			$section_name = explode( ' ', $field_name );
192
+			$section_name = explode(' ', $field_name);
193 193
 
194 194
 			// Output.
195
-			return strip_tags( implode( ' ', $section_name ) );
195
+			return strip_tags(implode(' ', $section_name));
196 196
 		}
197 197
 
198 198
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 *
208 208
 		 * @return mixed
209 209
 		 */
210
-		public function en_translation( $translation, $text ) {
210
+		public function en_translation($translation, $text) {
211 211
 			return $text;
212 212
 		}
213 213
 
@@ -221,59 +221,59 @@  discard block
 block discarded – undo
221 221
 		 *
222 222
 		 * @return mixed
223 223
 		 */
224
-		function get_filtered_addon_sections( $sections = array() ) {
224
+		function get_filtered_addon_sections($sections = array()) {
225 225
 			// New sections.
226 226
 			$new_sections = array();
227
-			$sections_ID  = array_keys( $sections );
228
-			$setting_fields = $this->prev_settings->give_settings( $this->current_tab );
227
+			$sections_ID  = array_keys($sections);
228
+			$setting_fields = $this->prev_settings->give_settings($this->current_tab);
229 229
 
230 230
 			// We need untranslated settings for backward compatibility.
231
-			add_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 );
232
-			$en_setting_fields = $this->prev_settings->give_settings( $this->current_tab );
233
-			remove_filter( 'gettext', array( $this, 'en_translation' ), 10 );
231
+			add_filter('gettext', array($this, 'en_translation'), 10, 2);
232
+			$en_setting_fields = $this->prev_settings->give_settings($this->current_tab);
233
+			remove_filter('gettext', array($this, 'en_translation'), 10);
234 234
 			
235
-			if ( ! empty( $setting_fields ) && ! empty( $setting_fields['fields'] ) ) {
235
+			if ( ! empty($setting_fields) && ! empty($setting_fields['fields'])) {
236 236
 
237
-				foreach ( $setting_fields['fields'] as $index => $field ) {
237
+				foreach ($setting_fields['fields'] as $index => $field) {
238 238
 					// Collect new sections from addons.
239
-					if ( 'give_title' !== $field['type'] ) {
239
+					if ('give_title' !== $field['type']) {
240 240
 						continue;
241 241
 					}
242 242
 
243 243
 					// Untranslated setting name.
244
-					$en_setting_field_name = isset( $en_setting_fields['fields'][ $index ]['name'] ) ? $en_setting_fields['fields'][ $index ]['name'] : '';
244
+					$en_setting_field_name = isset($en_setting_fields['fields'][$index]['name']) ? $en_setting_fields['fields'][$index]['name'] : '';
245 245
 
246 246
 					// Section name.
247
-					$field['name'] = isset( $field['name'] ) ? $field['name'] : '';
248
-					$section_name  = $this->get_section_name( $field['name'] );
247
+					$field['name'] = isset($field['name']) ? $field['name'] : '';
248
+					$section_name  = $this->get_section_name($field['name']);
249 249
 
250 250
 					// Check if section name exit and section title array is not empty.
251
-					if ( ! empty( $sections ) && ! empty( $en_setting_field_name ) ) {
251
+					if ( ! empty($sections) && ! empty($en_setting_field_name)) {
252 252
 
253 253
 						// Bailout: Do not load section if it is already exist.
254 254
 						if (
255
-							in_array( sanitize_title( $en_setting_field_name ), $sections_ID ) // Check section id.
256
-							|| in_array( $section_name, $sections )                            // Check section name.
255
+							in_array(sanitize_title($en_setting_field_name), $sections_ID) // Check section id.
256
+							|| in_array($section_name, $sections)                            // Check section name.
257 257
 						) {
258 258
 							continue;
259 259
 						}
260 260
 					}
261 261
 
262 262
 					// Collect new sections from addons.
263
-					$new_sections[ sanitize_title( $field['name'] ) ] = $section_name;
263
+					$new_sections[sanitize_title($field['name'])] = $section_name;
264 264
 				}
265 265
 			}
266 266
 
267 267
 			// Add new section.
268
-			if ( ! empty( $new_sections ) ) {
269
-				$sections = array_merge( $sections, $new_sections );
268
+			if ( ! empty($new_sections)) {
269
+				$sections = array_merge($sections, $new_sections);
270 270
 			}
271 271
 
272 272
 			// Remove section tab conditionally.
273
-			switch ( give_get_current_setting_tab() ) {
273
+			switch (give_get_current_setting_tab()) {
274 274
 				case 'emails':
275 275
 					// unset( $sections['donation-receipt'] );
276
-					unset( $sections['new-donation-notification'] );
276
+					unset($sections['new-donation-notification']);
277 277
 			}
278 278
 
279 279
 			// Output.
@@ -291,23 +291,23 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @return array
293 293
 		 */
294
-		function get_filtered_addon_settings( $settings, $setting_fields = array() ) {
294
+		function get_filtered_addon_settings($settings, $setting_fields = array()) {
295 295
 			global $wp_filter;
296 296
 
297 297
 			$new_setting_fields = array();
298 298
 
299
-			if ( ! empty( $settings ) ) {
299
+			if ( ! empty($settings)) {
300 300
 				// Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ).
301
-				if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) {
301
+				if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) {
302 302
 					$last_sectionend_pos = 0;
303
-					foreach ( $settings as $index => $setting ) {
303
+					foreach ($settings as $index => $setting) {
304 304
 						// We need setting till last section end.
305
-						if ( 'sectionend' === $setting['type'] ) {
305
+						if ('sectionend' === $setting['type']) {
306 306
 							$last_sectionend_pos = ++ $index;
307 307
 						}
308 308
 					}
309 309
 
310
-					$settings = array_slice( $settings, 0, $last_sectionend_pos );
310
+					$settings = array_slice($settings, 0, $last_sectionend_pos);
311 311
 
312 312
 					return $settings;
313 313
 				}
@@ -316,24 +316,24 @@  discard block
 block discarded – undo
316 316
 				$prev_title_field_id = '';
317 317
 
318 318
 				// Create new setting fields.
319
-				foreach ( $settings as $index => $field ) {
319
+				foreach ($settings as $index => $field) {
320 320
 
321 321
 					// Bailout: Must need field type to process.
322
-					if ( ! isset( $field['type'] ) ) {
322
+					if ( ! isset($field['type'])) {
323 323
 						continue;
324 324
 					}
325 325
 
326 326
 					// Set wrapper class if any.
327
-					if ( ! empty( $field['row_classes'] ) ) {
327
+					if ( ! empty($field['row_classes'])) {
328 328
 						$field['wrapper_class'] = $field['row_classes'];
329
-						unset( $field['row_classes'] );
329
+						unset($field['row_classes']);
330 330
 					}
331 331
 
332
-					$field['name'] = ! isset( $field['name'] ) ? '' : $field['name'];
333
-					$field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc'];
332
+					$field['name'] = ! isset($field['name']) ? '' : $field['name'];
333
+					$field['desc'] = ! isset($field['desc']) ? '' : $field['desc'];
334 334
 
335 335
 					// Modify cmb2 setting fields.
336
-					switch ( $field['type'] ) {
336
+					switch ($field['type']) {
337 337
 						case 'text' :
338 338
 						case 'file' :
339 339
 							$field['css'] = 'width:25em;';
@@ -357,18 +357,18 @@  discard block
 block discarded – undo
357 357
 							$field['type'] = 'title';
358 358
 
359 359
 							// Since we are showing sections, so there now ned to show horizontal rules.
360
-							if ( '<hr>' === $field['desc'] ) {
360
+							if ('<hr>' === $field['desc']) {
361 361
 								$field['desc'] = '';
362 362
 							}
363 363
 
364 364
 							break;
365 365
 					}
366 366
 
367
-					if ( 'title' === $field['type'] ) {
367
+					if ('title' === $field['type']) {
368 368
 
369 369
 						// If we do not have first element as title then these field will be skip from frontend
370 370
 						// because there are not belong to any section, so put all abandon fields under first section.
371
-						if ( $index && empty( $prev_title_field_id ) ) {
371
+						if ($index && empty($prev_title_field_id)) {
372 372
 							array_unshift(
373 373
 								$new_setting_fields,
374 374
 								array(
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 							$prev_title_field_id = $field['id'];
383 383
 
384 384
 							continue;
385
-						} elseif ( $index ) {
385
+						} elseif ($index) {
386 386
 							// Section end.
387 387
 							$new_setting_fields[] = array(
388 388
 								'type' => 'sectionend',
@@ -414,52 +414,52 @@  discard block
 block discarded – undo
414 414
 
415 415
 				// Check if setting page has title section or not.
416 416
 				// If setting page does not have title section  then add title section to it and fix section end array id.
417
-				if ( 'title' !== $new_setting_fields[0]['type'] ) {
417
+				if ('title' !== $new_setting_fields[0]['type']) {
418 418
 					array_unshift(
419 419
 						$new_setting_fields,
420 420
 						array(
421
-							'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ),
421
+							'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''),
422 422
 							'type'  => 'title',
423
-							'desc'  => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '',
424
-							'id'    => ( isset( $settings['id'] ) ? $settings['id'] : '' ),
423
+							'desc'  => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '',
424
+							'id'    => (isset($settings['id']) ? $settings['id'] : ''),
425 425
 						)
426 426
 					);
427 427
 
428 428
 					// Update id in section end array if does not contain.
429
-					if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) {
430
-						$new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' );
429
+					if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) {
430
+						$new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : '');
431 431
 					}
432 432
 				}
433 433
 
434 434
 				// Return only section related settings.
435
-				if ( $sections = $this->get_filtered_addon_sections() ) {
436
-					$new_setting_fields = $this->get_section_settings( $new_setting_fields );
435
+				if ($sections = $this->get_filtered_addon_sections()) {
436
+					$new_setting_fields = $this->get_section_settings($new_setting_fields);
437 437
 				}
438 438
 
439 439
 				// Third party plugin backward compatibility.
440
-				$wp_filter_keys = array_keys( $wp_filter );
441
-				foreach ( $new_setting_fields as $index => $field ) {
442
-					if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) {
440
+				$wp_filter_keys = array_keys($wp_filter);
441
+				foreach ($new_setting_fields as $index => $field) {
442
+					if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) {
443 443
 						continue;
444 444
 					}
445 445
 
446 446
 					$cmb2_filter_name = "cmb2_render_{$field['type']}";
447 447
 
448
-					if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) {
448
+					if (in_array($cmb2_filter_name, $wp_filter_keys)) {
449 449
 
450
-						if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) {
451
-							$cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks );
450
+						if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) {
451
+							$cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks);
452 452
 						} else {
453
-							$cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] );
453
+							$cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]);
454 454
 						}
455 455
 
456
-						if ( ! empty( $cmb2_filter_arr ) ) {
456
+						if ( ! empty($cmb2_filter_arr)) {
457 457
 							// Note: function can be called either globally or with class object, it depends on how developer invoke it.
458
-							$new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr );
459
-							add_action( "give_admin_field_{$field['type']}", array(
458
+							$new_setting_fields[$index]['func'] = current($cmb2_filter_arr);
459
+							add_action("give_admin_field_{$field['type']}", array(
460 460
 								$this,
461 461
 								'addon_setting_field',
462
-							), 10, 2 );
462
+							), 10, 2);
463 463
 						}
464 464
 					}
465 465
 				}
@@ -480,31 +480,31 @@  discard block
 block discarded – undo
480 480
 		 *
481 481
 		 * @return array
482 482
 		 */
483
-		function get_section_settings( $tab_settings ) {
483
+		function get_section_settings($tab_settings) {
484 484
 			$current_section = give_get_current_setting_section();
485 485
 
486 486
 			// Note: If we are opening default tab for addon setting then it is possible that we will get empty string as current section
487 487
 			// because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section
488 488
 			// This is hack to fix this.
489
-			if ( empty( $current_section ) ) {
490
-				$current_section = $this->set_default_setting_tab( $current_section );
489
+			if (empty($current_section)) {
490
+				$current_section = $this->set_default_setting_tab($current_section);
491 491
 			}
492 492
 
493 493
 			$section_start               = false;
494 494
 			$section_end                 = false;
495 495
 			$section_only_setting_fields = array();
496 496
 
497
-			foreach ( $tab_settings as $field ) {
498
-				if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) {
497
+			foreach ($tab_settings as $field) {
498
+				if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) {
499 499
 					$section_start = true;
500 500
 				}
501 501
 
502
-				if ( ! $section_start || $section_end ) {
502
+				if ( ! $section_start || $section_end) {
503 503
 					continue;
504 504
 				}
505 505
 
506
-				if ( $section_start && ! $section_end ) {
507
-					if ( 'sectionend' == $field['type'] ) {
506
+				if ($section_start && ! $section_end) {
507
+					if ('sectionend' == $field['type']) {
508 508
 						$section_end = true;
509 509
 					}
510 510
 					$section_only_setting_fields[] = $field;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			// Remove title from setting, prevent it from render in setting tab.
515 515
 			$section_only_setting_fields[0]['title'] = '';
516 516
 
517
-			return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings );
517
+			return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings);
518 518
 		}
519 519
 
520 520
 
@@ -528,17 +528,17 @@  discard block
 block discarded – undo
528 528
 		 *
529 529
 		 * @return void
530 530
 		 */
531
-		function addon_setting_field( $field, $saved_value ) {
531
+		function addon_setting_field($field, $saved_value) {
532 532
 			// Create object for cmb2  function callback backward compatibility.
533 533
 			// Note: Do not call any cmb2 function on these objects
534
-			$field_obj      = (object) array( 'args' => $field );
535
-			$field_type_obj = (object) array( 'field' => $field_obj );
534
+			$field_obj      = (object) array('args' => $field);
535
+			$field_type_obj = (object) array('field' => $field_obj);
536 536
 
537
-			switch ( $this->current_tab ) :
537
+			switch ($this->current_tab) :
538 538
 				case 'licenses':
539 539
 					?>
540 540
 					<div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>">
541
-						<?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?>
541
+						<?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?>
542 542
 					</div>
543 543
 					<?php break;
544 544
 
@@ -546,21 +546,21 @@  discard block
 block discarded – undo
546 546
 					$colspan = 'colspan="2"';
547 547
 					?>
548 548
 					<tr valign="top">
549
-						<?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( '&nbsp;' ) ) ) : ?>
549
+						<?php if ( ! empty($field['name']) && ! in_array($field['name'], array('&nbsp;'))) : ?>
550 550
 							<th scope="row" class="titledesc">
551
-								<label for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label>
551
+								<label for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label>
552 552
 							</th>
553 553
 							<?php $colspan = ''; ?>
554 554
 						<?php endif; ?>
555 555
 						<td class="give-forminp" <?php echo $colspan; ?>>
556 556
 							<?php
557
-							if ( is_array( $field['func']['function'] ) ) {
557
+							if (is_array($field['func']['function'])) {
558 558
 								$classname = $field['func']['function'][0];
559 559
 								$function_name = $field['func']['function'][1];
560
-								$classname->$function_name( $field_obj, $saved_value, '', '', $field_type_obj );
560
+								$classname->$function_name($field_obj, $saved_value, '', '', $field_type_obj);
561 561
 							} else {
562 562
 								$function_name = $field['func']['function'];
563
-								$function_name( $field_obj, $saved_value, '', '', $field_type_obj );
563
+								$function_name($field_obj, $saved_value, '', '', $field_type_obj);
564 564
 							}
565 565
 							?>
566 566
 						</td>
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
 		public function get_sections() {
579 579
 			$sections = array();
580 580
 
581
-			if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) {
582
-				foreach ( $setting_fields['fields'] as $field ) {
583
-					if ( 'give_title' == $field['type'] ) {
584
-						$sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] );
581
+			if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) {
582
+				foreach ($setting_fields['fields'] as $field) {
583
+					if ('give_title' == $field['type']) {
584
+						$sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']);
585 585
 					}
586 586
 				}
587 587
 			}
@@ -601,16 +601,16 @@  discard block
 block discarded – undo
601 601
 
602 602
 			$new_setting_fields = array();
603 603
 
604
-			if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) {
605
-				if ( isset( $setting_fields['fields'] ) ) {
604
+			if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) {
605
+				if (isset($setting_fields['fields'])) {
606 606
 
607 607
 					$tab_data = array(
608 608
 						'id'         => $setting_fields['id'],
609 609
 						'give_title' => $setting_fields['give_title'],
610
-						'desc'       => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ),
610
+						'desc'       => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''),
611 611
 					);
612 612
 
613
-					$new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data );
613
+					$new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data);
614 614
 				}
615 615
 			}
616 616
 
@@ -627,24 +627,24 @@  discard block
 block discarded – undo
627 627
 			$sections = $this->get_sections();
628 628
 
629 629
 			// Show section settings only if setting section exist.
630
-			if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) {
631
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
630
+			if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) {
631
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
632 632
 				$GLOBALS['give_hide_save_button'] = true;
633 633
 
634 634
 				return;
635 635
 			}
636 636
 
637 637
 			// Bailout.
638
-			if ( empty( $sections ) ) {
638
+			if (empty($sections)) {
639 639
 				return;
640 640
 			}
641 641
 
642 642
 			echo '<ul class="subsubsub">';
643 643
 
644
-			$array_keys = array_keys( $sections );
644
+			$array_keys = array_keys($sections);
645 645
 
646
-			foreach ( $sections as $id => $label ) {
647
-				echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
646
+			foreach ($sections as $id => $label) {
647
+				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'&section='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>';
648 648
 			}
649 649
 
650 650
 			echo '</ul><br class="clear" /><hr>';
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		public function output() {
660 660
 			$settings = $this->get_settings();
661 661
 
662
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
662
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
663 663
 		}
664 664
 
665 665
 		/**
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		public function save() {
672 672
 			$settings = $this->get_settings();
673 673
 
674
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
674
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
675 675
 		}
676 676
 	}
677 677
 endif;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-email.php 1 patch
Spacing   +25 added lines, -25 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_Email' ) ) :
16
+if ( ! class_exists('Give_Settings_Email')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Email.
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'emails';
30
-			$this->label = esc_html__( 'Emails', 'give' );
30
+			$this->label = esc_html__('Emails', 'give');
31 31
 
32 32
 			$this->default_tab = 'email-settings';
33 33
 
34 34
 			parent::__construct();
35 35
 
36
-			add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) );
36
+			add_action('give_admin_field_email_notification', array($this, 'email_notification_setting'));
37 37
 		}
38 38
 
39 39
 		/**
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 			$settings        = array();
47 47
 			$current_section = give_get_current_setting_section();
48 48
 
49
-			switch ( $current_section ) {
49
+			switch ($current_section) {
50 50
 				case 'email-settings' :
51 51
 					$settings = array(
52 52
 
53 53
 						// Section 1: Email Notification Listing.
54 54
 						array(
55
-							'desc'       => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ),
55
+							'desc'       => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'),
56 56
 							'type'       => 'title',
57 57
 							'id'         => 'give_email_notification_settings',
58 58
 							'table_html' => false,
@@ -67,42 +67,42 @@  discard block
 block discarded – undo
67 67
 
68 68
 						// Section 2: Email Sender Setting
69 69
 						array(
70
-							'title' => __( 'Email Sender Options', 'give' ),
70
+							'title' => __('Email Sender Options', 'give'),
71 71
 							'id'    => 'give_title_email_settings_1',
72 72
 							'type'  => 'title',
73 73
 						),
74 74
 						array(
75 75
 							'id'      => 'email_template',
76
-							'name'    => esc_html__( 'Email Template', 'give' ),
77
-							'desc'    => esc_html__( 'Choose your template from the available registered template types.', 'give' ),
76
+							'name'    => esc_html__('Email Template', 'give'),
77
+							'desc'    => esc_html__('Choose your template from the available registered template types.', 'give'),
78 78
 							'type'    => 'select',
79 79
 							'options' => give_get_email_templates(),
80 80
 						),
81 81
 						array(
82 82
 							'id'   => 'email_logo',
83
-							'name' => esc_html__( 'Logo', 'give' ),
84
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
83
+							'name' => esc_html__('Logo', 'give'),
84
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
85 85
 							'type' => 'file',
86 86
 						),
87 87
 						array(
88 88
 							'id'      => 'from_name',
89
-							'name'    => esc_html__( 'From Name', 'give' ),
90
-							'desc'    => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ),
91
-							'default' => get_bloginfo( 'name' ),
89
+							'name'    => esc_html__('From Name', 'give'),
90
+							'desc'    => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'),
91
+							'default' => get_bloginfo('name'),
92 92
 							'type'    => 'text',
93 93
 						),
94 94
 						array(
95 95
 							'id'      => 'from_email',
96
-							'name'    => esc_html__( 'From Email', 'give' ),
97
-							'desc'    => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ),
98
-							'default' => get_bloginfo( 'admin_email' ),
96
+							'name'    => esc_html__('From Email', 'give'),
97
+							'desc'    => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'),
98
+							'default' => get_bloginfo('admin_email'),
99 99
 							'type'    => 'text',
100 100
 						),
101 101
 						array(
102
-							'name'  => esc_html__( 'Donation Notification Settings Docs Link', 'give' ),
102
+							'name'  => esc_html__('Donation Notification Settings Docs Link', 'give'),
103 103
 							'id'    => 'donation_notification_settings_docs_link',
104
-							'url'   => esc_url( 'http://docs.givewp.com/settings-donation-notification' ),
105
-							'title' => __( 'Donation Notification Settings', 'give' ),
104
+							'url'   => esc_url('http://docs.givewp.com/settings-donation-notification'),
105
+							'title' => __('Donation Notification Settings', 'give'),
106 106
 							'type'  => 'give_docs_link',
107 107
 						),
108 108
 						array(
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			 * Filter the emails settings.
118 118
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
119 119
 			 */
120
-			$settings = apply_filters( 'give_settings_emails', $settings );
120
+			$settings = apply_filters('give_settings_emails', $settings);
121 121
 
122 122
 			/**
123 123
 			 * Filter the settings.
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @param  array $settings
128 128
 			 */
129
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
129
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
130 130
 
131 131
 			// Output.
132 132
 			return $settings;
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		 */
141 141
 		public function get_sections() {
142 142
 			$sections = array(
143
-				'email-settings' => esc_html__( 'Email Settings', 'give' ),
143
+				'email-settings' => esc_html__('Email Settings', 'give'),
144 144
 			);
145 145
 
146
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
146
+			return apply_filters('give_get_sections_'.$this->id, $sections);
147 147
 		}
148 148
 
149 149
 		/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		 */
155 155
 		public function email_notification_setting() {
156 156
 			// Load email notification table.
157
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php';
157
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php';
158 158
 
159 159
 			// Init table.
160 160
 			$email_notifications_table = new Give_Email_Notification_Table();
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-advanced.php 1 patch
Spacing   +37 added lines, -37 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_Advanced' ) ) :
16
+if ( ! class_exists('Give_Settings_Advanced')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Advanced.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'advanced';
30
-			$this->label = __( 'Advanced', 'give' );
30
+			$this->label = __('Advanced', 'give');
31 31
 
32 32
 			$this->default_tab = 'advanced-options';
33 33
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 			$current_section = give_get_current_setting_section();
47 47
 
48
-			switch ( $current_section ) {
48
+			switch ($current_section) {
49 49
 				case 'advanced-options':
50 50
 					$settings = array(
51 51
 						array(
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title',
54 54
 						),
55 55
 						array(
56
-							'name'    => __( 'Remove Data on Uninstall', 'give' ),
57
-							'desc'    => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ),
56
+							'name'    => __('Remove Data on Uninstall', 'give'),
57
+							'desc'    => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'),
58 58
 							'id'      => 'uninstall_on_delete',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'disabled',
61 61
 							'options' => array(
62
-								'enabled'  => __( 'Yes, Remove all data', 'give' ),
63
-								'disabled' => __( 'No, keep my Give settings and donation data', 'give' ),
62
+								'enabled'  => __('Yes, Remove all data', 'give'),
63
+								'disabled' => __('No, keep my Give settings and donation data', 'give'),
64 64
 							),
65 65
 						),
66 66
 						array(
67
-							'name'    => __( 'Default User Role', 'give' ),
68
-							'desc'    => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ),
67
+							'name'    => __('Default User Role', 'give'),
68
+							'desc'    => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'),
69 69
 							'id'      => 'donor_default_user_role',
70 70
 							'type'    => 'select',
71 71
 							'default' => 'give_donor',
@@ -73,44 +73,44 @@  discard block
 block discarded – undo
73 73
 						),
74 74
 						array(
75 75
 							/* translators: %s: the_content */
76
-							'name'    => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ),
76
+							'name'    => sprintf(__('%s filter', 'give'), '<code>the_content</code>'),
77 77
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
78
-							'desc'    => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
78
+							'desc'    => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
79 79
 							'id'      => 'the_content_filter',
80 80
 							'default' => 'enabled',
81 81
 							'type'    => 'radio_inline',
82 82
 							'options' => array(
83
-								'enabled'  => __( 'Enabled', 'give' ),
84
-								'disabled' => __( 'Disabled', 'give' ),
83
+								'enabled'  => __('Enabled', 'give'),
84
+								'disabled' => __('Disabled', 'give'),
85 85
 							),
86 86
 						),
87 87
 						array(
88
-							'name'    => __( 'Script Loading Location', 'give' ),
89
-							'desc'    => __( 'This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give' ),
88
+							'name'    => __('Script Loading Location', 'give'),
89
+							'desc'    => __('This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give'),
90 90
 							'id'      => 'scripts_footer',
91 91
 							'type'    => 'radio_inline',
92 92
 							'default' => 'disabled',
93 93
 							'options' => array(
94
-								'disabled' => __( 'Head', 'give' ),
95
-								'enabled'  => __( 'Footer', 'give' ),
94
+								'disabled' => __('Head', 'give'),
95
+								'enabled'  => __('Footer', 'give'),
96 96
 							),
97 97
 						),
98 98
 						array(
99
-							'name'    => __( 'Akismet SPAM Protection', 'give' ),
100
-							'desc'    => __( 'Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give' ),
99
+							'name'    => __('Akismet SPAM Protection', 'give'),
100
+							'desc'    => __('Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give'),
101 101
 							'id'      => 'akismet_spam_protection',
102 102
 							'type'    => 'radio_inline',
103
-							'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled',
103
+							'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled',
104 104
 							'options' => array(
105
-								'enabled'  => __( 'Enabled', 'give' ),
106
-								'disabled' => __( 'Disabled', 'give' ),
105
+								'enabled'  => __('Enabled', 'give'),
106
+								'disabled' => __('Disabled', 'give'),
107 107
 							),
108 108
 						),
109 109
 						array(
110
-							'name'  => __( 'Advanced Settings Docs Link', 'give' ),
110
+							'name'  => __('Advanced Settings Docs Link', 'give'),
111 111
 							'id'    => 'advanced_settings_docs_link',
112
-							'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
113
-							'title' => __( 'Advanced Settings', 'give' ),
112
+							'url'   => esc_url('http://docs.givewp.com/settings-advanced'),
113
+							'title' => __('Advanced Settings', 'give'),
114 114
 							'type'  => 'give_docs_link',
115 115
 						),
116 116
 						array(
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @since 2.0
128 128
 			 */
129
-			if( apply_filters( 'give_settings_advanced_show_cache_setting', false ) ) {
130
-				array_splice( $settings, 1, 0, array(
129
+			if (apply_filters('give_settings_advanced_show_cache_setting', false)) {
130
+				array_splice($settings, 1, 0, array(
131 131
 					array(
132
-						'name'    => __( 'Cache', 'give' ),
133
-						'desc'    => __( 'If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give' ),
132
+						'name'    => __('Cache', 'give'),
133
+						'desc'    => __('If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give'),
134 134
 						'id'      => 'cache',
135 135
 						'type'    => 'radio_inline',
136 136
 						'default' => 'enabled',
137 137
 						'options' => array(
138
-							'enabled'  => __( 'Enabled', 'give' ),
139
-							'disabled' => __( 'Disabled', 'give' ),
138
+							'enabled'  => __('Enabled', 'give'),
139
+							'disabled' => __('Disabled', 'give'),
140 140
 						),
141 141
 					)
142
-				) );
142
+				));
143 143
 			}
144 144
 
145 145
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			 * Filter the advanced settings.
148 148
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
149 149
 			 */
150
-			$settings = apply_filters( 'give_settings_advanced', $settings );
150
+			$settings = apply_filters('give_settings_advanced', $settings);
151 151
 
152 152
 			/**
153 153
 			 * Filter the settings.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			 *
157 157
 			 * @param  array $settings
158 158
 			 */
159
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
159
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
160 160
 
161 161
 			// Output.
162 162
 			return $settings;
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 		 */
171 171
 		public function get_sections() {
172 172
 			$sections = array(
173
-				'advanced-options' => __( 'Advanced Options', 'give' ),
173
+				'advanced-options' => __('Advanced Options', 'give'),
174 174
 			);
175 175
 
176
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
176
+			return apply_filters('give_get_sections_'.$this->id, $sections);
177 177
 		}
178 178
 	}
179 179
 
Please login to merge, or discard this patch.