Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/admin/settings/class-settings-gateways.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
34 34
 			parent::__construct();
35 35
 
36 36
 			// Do not use main form for this tab.
37
-			if ( give_get_current_setting_tab() === $this->id ) {
38
-				add_action( 'give_admin_field_enabled_gateways', array( $this, 'render_enabled_gateways' ), 10, 2 );
37
+			if (give_get_current_setting_tab() === $this->id) {
38
+				add_action('give_admin_field_enabled_gateways', array($this, 'render_enabled_gateways'), 10, 2);
39 39
 			}
40 40
 		}
41 41
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			$settings        = array();
50 50
 			$current_section = give_get_current_setting_section();
51 51
 
52
-			switch ( $current_section ) {
52
+			switch ($current_section) {
53 53
 				case 'paypal-standard':
54 54
 					$settings = array(
55 55
 						// Section 2: PayPal Standard.
@@ -58,55 +58,55 @@  discard block
 block discarded – undo
58 58
 							'id'   => 'give_title_gateway_settings_2',
59 59
 						),
60 60
 						array(
61
-							'name' => __( 'PayPal Email', 'give' ),
62
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
61
+							'name' => __('PayPal Email', 'give'),
62
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
63 63
 							'id'   => 'paypal_email',
64 64
 							'type' => 'email',
65 65
 						),
66 66
 						array(
67
-							'name' => __( 'PayPal Page Style', 'give' ),
68
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
67
+							'name' => __('PayPal Page Style', 'give'),
68
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
69 69
 							'id'   => 'paypal_page_style',
70 70
 							'type' => 'text',
71 71
 						),
72 72
 						array(
73
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
74
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
73
+							'name'    => __('PayPal Transaction Type', 'give'),
74
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
75 75
 							'id'      => 'paypal_button_type',
76 76
 							'type'    => 'radio_inline',
77 77
 							'options' => array(
78
-								'donation' => __( 'Donation', 'give' ),
79
-								'standard' => __( 'Standard Transaction', 'give' )
78
+								'donation' => __('Donation', 'give'),
79
+								'standard' => __('Standard Transaction', 'give')
80 80
 							),
81 81
 							'default' => 'donation',
82 82
 						),
83 83
 						array(
84
-							'name'    => __( 'Billing Details', 'give' ),
85
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
84
+							'name'    => __('Billing Details', 'give'),
85
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
86 86
 							'id'      => 'paypal_standard_billing_details',
87 87
 							'type'    => 'radio_inline',
88 88
 							'default' => 'disabled',
89 89
 							'options' => array(
90
-								'enabled'  => __( 'Enabled', 'give' ),
91
-								'disabled' => __( 'Disabled', 'give' ),
90
+								'enabled'  => __('Enabled', 'give'),
91
+								'disabled' => __('Disabled', 'give'),
92 92
 							)
93 93
 						),
94 94
 						array(
95
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
96
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
95
+							'name'    => __('PayPal IPN Verification', 'give'),
96
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
97 97
 							'id'      => 'paypal_verification',
98 98
 							'type'    => 'radio_inline',
99 99
 							'default' => 'enabled',
100 100
 							'options' => array(
101
-								'enabled'  => __( 'Enabled', 'give' ),
102
-								'disabled' => __( 'Disabled', 'give' ),
101
+								'enabled'  => __('Enabled', 'give'),
102
+								'disabled' => __('Disabled', 'give'),
103 103
 							)
104 104
 						),
105 105
 						array(
106
-							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
106
+							'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
107 107
 							'id'    => 'paypal_standard_gateway_settings_docs_link',
108
-							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
109
-							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
108
+							'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
109
+							'title' => __('PayPal Standard Gateway Settings', 'give'),
110 110
 							'type'  => 'give_docs_link',
111 111
 						),
112 112
 						array(
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 							'id'   => 'give_title_gateway_settings_3',
125 125
 						),
126 126
 						array(
127
-							'name'    => __( 'Collect Billing Details', 'give' ),
128
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
127
+							'name'    => __('Collect Billing Details', 'give'),
128
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
129 129
 							'id'      => 'give_offline_donation_enable_billing_fields',
130 130
 							'type'    => 'radio_inline',
131 131
 							'default' => 'disabled',
132 132
 							'options' => array(
133
-								'enabled'  => __( 'Enabled', 'give' ),
134
-								'disabled' => __( 'Disabled', 'give' )
133
+								'enabled'  => __('Enabled', 'give'),
134
+								'disabled' => __('Disabled', 'give')
135 135
 							)
136 136
 						),
137 137
 						array(
138
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
139
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
138
+							'name'    => __('Offline Donation Instructions', 'give'),
139
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
140 140
 							'id'      => 'global_offline_donation_content',
141 141
 							'default' => give_get_default_offline_donation_content(),
142 142
 							'type'    => 'wysiwyg',
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 							)
146 146
 						),
147 147
 						array(
148
-							'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
148
+							'name'  => esc_html__('Offline Donations Settings Docs Link', 'give'),
149 149
 							'id'    => 'offline_gateway_settings_docs_link',
150
-							'url'   => esc_url( 'http://docs.givewp.com/offlinegateway' ),
151
-							'title' => __( 'Offline Gateway Settings', 'give' ),
150
+							'url'   => esc_url('http://docs.givewp.com/offlinegateway'),
151
+							'title' => __('Offline Gateway Settings', 'give'),
152 152
 							'type'  => 'give_docs_link',
153 153
 						),
154 154
 						array(
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 							'type' => 'title'
167 167
 						),
168 168
 						array(
169
-							'name'    => __( 'Test Mode', 'give' ),
170
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
169
+							'name'    => __('Test Mode', 'give'),
170
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
171 171
 							'id'      => 'test_mode',
172 172
 							'type'    => 'radio_inline',
173 173
 							'default' => 'disabled',
174 174
 							'options' => array(
175
-								'enabled'  => __( 'Enabled', 'give' ),
176
-								'disabled' => __( 'Disabled', 'give' ),
175
+								'enabled'  => __('Enabled', 'give'),
176
+								'disabled' => __('Disabled', 'give'),
177 177
 							)
178 178
 						),
179 179
 						array(
180
-							'name' => __( 'Enabled Gateways', 'give' ),
181
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
180
+							'name' => __('Enabled Gateways', 'give'),
181
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
182 182
 							'id'   => 'gateways',
183 183
 							'type' => 'enabled_gateways'
184 184
 						),
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 						 * This setting will not render on admin setting screen but help internal code to recognize "gateways_label"  setting and add them to give setting when save.
191 191
 						 */
192 192
 						array(
193
-							'name' => __( 'Gateways Label', 'give' ),
193
+							'name' => __('Gateways Label', 'give'),
194 194
 							'desc' => '',
195 195
 							'id'   => 'gateways_label',
196 196
 							'type' => 'gateways_label_hidden'
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 						 * This setting will not render on admin setting screen but help internal code to recognize "default_gateway"  setting and add them to give setting when save.
204 204
 						 */
205 205
 						array(
206
-							'name' => __( 'Default Gateway', 'give' ),
207
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
206
+							'name' => __('Default Gateway', 'give'),
207
+							'desc' => __('The gateway that will be selected by default.', 'give'),
208 208
 							'id'   => 'default_gateway',
209 209
 							'type' => 'default_gateway_hidden'
210 210
 						),
211 211
 
212 212
 						array(
213
-							'name'  => __( 'Gateways Docs Link', 'give' ),
213
+							'name'  => __('Gateways Docs Link', 'give'),
214 214
 							'id'    => 'gateway_settings_docs_link',
215
-							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
216
-							'title' => __( 'Gateway Settings', 'give' ),
215
+							'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
216
+							'title' => __('Gateway Settings', 'give'),
217 217
 							'type'  => 'give_docs_link',
218 218
 						),
219 219
 						array(
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			 * Filter the payment gateways settings.
229 229
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
230 230
 			 */
231
-			$settings = apply_filters( 'give_settings_gateways', $settings );
231
+			$settings = apply_filters('give_settings_gateways', $settings);
232 232
 
233 233
 			/**
234 234
 			 * Filter the settings.
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			 *
238 238
 			 * @param  array $settings
239 239
 			 */
240
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
240
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
241 241
 
242 242
 			// Output.
243 243
 			return $settings;
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 		 */
252 252
 		public function get_sections() {
253 253
 			$sections = array(
254
-				'gateways-settings' => __( 'Gateways', 'give' ),
255
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
256
-				'offline-donations' => __( 'Offline Donations', 'give' )
254
+				'gateways-settings' => __('Gateways', 'give'),
255
+				'paypal-standard'   => __('PayPal Standard', 'give'),
256
+				'offline-donations' => __('Offline Donations', 'give')
257 257
 			);
258 258
 
259
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
259
+			return apply_filters('give_get_sections_'.$this->id, $sections);
260 260
 		}
261 261
 
262 262
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 		 * @param $field
270 270
 		 * @param $settings
271 271
 		 */
272
-		public function render_enabled_gateways( $field, $settings ) {
272
+		public function render_enabled_gateways($field, $settings) {
273 273
 			$id              = $field['id'];
274
-			$gateways        = give_get_ordered_payment_gateways( give_get_payment_gateways() );
275
-			$gateways_label  = give_get_option( 'gateways_label', array() );
276
-			$default_gateway = give_get_option( 'default_gateway', current( array_keys( $gateways ) ) );
274
+			$gateways        = give_get_ordered_payment_gateways(give_get_payment_gateways());
275
+			$gateways_label  = give_get_option('gateways_label', array());
276
+			$default_gateway = give_get_option('default_gateway', current(array_keys($gateways)));
277 277
 
278 278
 			ob_start();
279 279
 
@@ -288,51 +288,51 @@  discard block
 block discarded – undo
288 288
 						<span>%3$s</span>
289 289
 						<span>%4$s</span>
290 290
 						',
291
-				__( 'Gateway', 'give' ),
292
-				__( 'Label', 'give' ),
293
-				__( 'Default', 'give' ),
294
-				__( 'Enabled', 'give' )
291
+				__('Gateway', 'give'),
292
+				__('Label', 'give'),
293
+				__('Default', 'give'),
294
+				__('Enabled', 'give')
295 295
 			);
296 296
 			echo '</div>';
297 297
 
298 298
 			echo '<ul class="give-checklist-fields give-payment-gatways-list">';
299
-			foreach ( $gateways as $key => $option ) :
299
+			foreach ($gateways as $key => $option) :
300 300
 				$enabled = null;
301
-				if ( is_array( $settings ) && array_key_exists( $key, $settings ) ) {
301
+				if (is_array($settings) && array_key_exists($key, $settings)) {
302 302
 					$enabled = '1';
303 303
 				}
304 304
 
305 305
 				echo '<li>';
306
-				printf( '<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>' );
307
-				printf( '<span class="admin-label">%s</span>', esc_html( $option['admin_label'] ) );
306
+				printf('<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>');
307
+				printf('<span class="admin-label">%s</span>', esc_html($option['admin_label']));
308 308
 
309 309
 				$label = '';
310
-				if ( ! empty( $gateways_label[ $key ] ) ) {
311
-					$label = $gateways_label[ $key ];
310
+				if ( ! empty($gateways_label[$key])) {
311
+					$label = $gateways_label[$key];
312 312
 				}
313 313
 
314 314
 				printf(
315 315
 					'<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>',
316 316
 					'gateways_label',
317
-					esc_attr( $key ),
318
-					esc_html( $label ),
319
-					esc_html( $option['checkout_label'] )
317
+					esc_attr($key),
318
+					esc_html($label),
319
+					esc_html($option['checkout_label'])
320 320
 				);
321 321
 
322 322
 				printf(
323 323
 					'<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>',
324 324
 					'default_gateway',
325 325
 					$key,
326
-					checked( $key, $default_gateway, false ),
327
-					disabled( NULL, $enabled, false )
326
+					checked($key, $default_gateway, false),
327
+					disabled(NULL, $enabled, false)
328 328
 				);
329 329
 
330 330
 				printf(
331 331
 					'<input class="gateways-checkbox" name="%1$s[%2$s]" id="%1$s[%2$s]" type="checkbox" value="1" %3$s data-payment-gateway="%4$s"/>',
332
-					esc_attr( $id ),
333
-					esc_attr( $key ),
334
-					checked( '1', $enabled, false ),
335
-					esc_html( $option['admin_label'] )
332
+					esc_attr($id),
333
+					esc_attr($key),
334
+					checked('1', $enabled, false),
335
+					esc_html($option['admin_label'])
336 336
 				);
337 337
 				echo '</li>';
338 338
 			endforeach;
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +488 added lines, -488 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,70 +25,70 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ) :
81
+		case version_compare($give_version, '2.0.1', '<') :
82 82
 			// Do nothing on fresh install.
83
-			if ( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 
91
-		case version_compare( $give_version, '2.0.2', '<' ) :
91
+		case version_compare($give_version, '2.0.2', '<') :
92 92
 			// Remove 2.0.1 update to rerun on 2.0.2
93 93
 			$completed_upgrades = give_get_completed_upgrades();
94 94
 			$v201_updates       = array(
@@ -98,35 +98,35 @@  discard block
 block discarded – undo
98 98
 				'v201_logs_upgrades',
99 99
 			);
100 100
 
101
-			foreach ( $v201_updates as $v201_update ) {
102
-				if ( in_array( $v201_update, $completed_upgrades ) ) {
103
-					unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] );
101
+			foreach ($v201_updates as $v201_update) {
102
+				if (in_array($v201_update, $completed_upgrades)) {
103
+					unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]);
104 104
 				}
105 105
 			}
106 106
 
107
-			update_option( 'give_completed_upgrades', $completed_upgrades );
107
+			update_option('give_completed_upgrades', $completed_upgrades);
108 108
 
109 109
 			// Do nothing on fresh install.
110
-			if ( ! doing_action( 'give_upgrades' ) ) {
110
+			if ( ! doing_action('give_upgrades')) {
111 111
 				give_v201_create_tables();
112
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
112
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
113 113
 				Give_Updates::$background_updater->dispatch();
114 114
 			}
115 115
 
116 116
 			$did_upgrade = true;
117 117
 
118
-		case version_compare( $give_version, '2.0.3', '<' ) :
118
+		case version_compare($give_version, '2.0.3', '<') :
119 119
 			give_v203_upgrades();
120 120
 			$did_upgrade = true;
121 121
 	}
122 122
 
123
-	if ( $did_upgrade ) {
124
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
123
+	if ($did_upgrade) {
124
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
125 125
 	}
126 126
 }
127 127
 
128
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
129
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
128
+add_action('admin_init', 'give_do_automatic_upgrades');
129
+add_action('give_upgrades', 'give_do_automatic_upgrades');
130 130
 
131 131
 /**
132 132
  * Display Upgrade Notices.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return void
142 142
  */
143
-function give_show_upgrade_notices( $give_updates ) {
143
+function give_show_upgrade_notices($give_updates) {
144 144
 	// v1.3.2 Upgrades
145 145
 	$give_updates->register(
146 146
 		array(
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 	);
207 207
 
208 208
 	// v1.8.17 Upgrades for donations.
209
-	$give_updates->register( array(
209
+	$give_updates->register(array(
210 210
 		'id'       => 'v1817_update_donation_iranian_currency_code',
211 211
 		'version'  => '1.8.17',
212 212
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
213
-	) );
213
+	));
214 214
 
215 215
 	// v1.8.17 Upgrades for cleanup of user roles.
216
-	$give_updates->register( array(
216
+	$give_updates->register(array(
217 217
 		'id'       => 'v1817_cleanup_user_roles',
218 218
 		'version'  => '1.8.17',
219 219
 		'callback' => 'give_v1817_cleanup_user_roles',
220
-	) );
220
+	));
221 221
 
222 222
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
223
-	$give_updates->register( array(
223
+	$give_updates->register(array(
224 224
 		'id'       => 'v1818_assign_custom_amount_set_donation',
225 225
 		'version'  => '1.8.18',
226 226
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
227
-	) );
227
+	));
228 228
 
229 229
 	// v1.8.18 Cleanup the Give Worker Role Caps.
230
-	$give_updates->register( array(
230
+	$give_updates->register(array(
231 231
 		'id'       => 'v1818_give_worker_role_cleanup',
232 232
 		'version'  => '1.8.18',
233 233
 		'callback' => 'give_v1818_give_worker_role_cleanup',
234
-	) );
234
+	));
235 235
 
236 236
 	// v2.0.0 Upgrades
237 237
 	$give_updates->register(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			'id'       => 'v20_move_metadata_into_new_table',
286 286
 			'version'  => '2.0.0',
287 287
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
288
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
288
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
289 289
 		)
290 290
 	);
291 291
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			'id'       => 'v201_move_metadata_into_new_table',
332 332
 			'version'  => '2.0.1',
333 333
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
334
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
334
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
335 335
 		)
336 336
 	);
337 337
 
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
 			'id'       => 'v213_delete_donation_meta',
360 360
 			'version'  => '2.1.3',
361 361
 			'callback' => 'give_v213_delete_donation_meta_callback',
362
-			'depends'  => array( 'v201_move_metadata_into_new_table' )
362
+			'depends'  => array('v201_move_metadata_into_new_table')
363 363
 		)
364 364
 	);
365 365
 
366 366
 }
367 367
 
368
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
368
+add_action('give_register_updates', 'give_show_upgrade_notices');
369 369
 
370 370
 /**
371 371
  * Triggers all upgrade functions
@@ -377,29 +377,29 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_trigger_upgrades() {
379 379
 
380
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
381
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
380
+	if ( ! current_user_can('manage_give_settings')) {
381
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
382 382
 			'response' => 403,
383
-		) );
383
+		));
384 384
 	}
385 385
 
386
-	$give_version = get_option( 'give_version' );
386
+	$give_version = get_option('give_version');
387 387
 
388
-	if ( ! $give_version ) {
388
+	if ( ! $give_version) {
389 389
 		// 1.0 is the first version to use this option so we must add it.
390 390
 		$give_version = '1.0';
391
-		add_option( 'give_version', $give_version );
391
+		add_option('give_version', $give_version);
392 392
 	}
393 393
 
394
-	update_option( 'give_version', GIVE_VERSION );
395
-	delete_option( 'give_doing_upgrade' );
394
+	update_option('give_version', GIVE_VERSION);
395
+	delete_option('give_doing_upgrade');
396 396
 
397
-	if ( DOING_AJAX ) {
398
-		die( 'complete' );
397
+	if (DOING_AJAX) {
398
+		die('complete');
399 399
 	} // End if().
400 400
 }
401 401
 
402
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
402
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
403 403
 
404 404
 
405 405
 /**
@@ -417,10 +417,10 @@  discard block
 block discarded – undo
417 417
 
418 418
 	// UPDATE DB METAKEYS.
419 419
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
420
-	$query = $wpdb->query( $sql );
420
+	$query = $wpdb->query($sql);
421 421
 
422 422
 	$give_updates->percentage = 100;
423
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
423
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
424 424
 }
425 425
 
426 426
 
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 	$where  .= "AND ( p.post_status = 'abandoned' )";
445 445
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
446 446
 
447
-	$sql            = $select . $join . $where;
448
-	$found_payments = $wpdb->get_col( $sql );
447
+	$sql            = $select.$join.$where;
448
+	$found_payments = $wpdb->get_col($sql);
449 449
 
450
-	foreach ( $found_payments as $payment ) {
450
+	foreach ($found_payments as $payment) {
451 451
 
452 452
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
453
-		$modified_time = get_post_modified_time( 'U', false, $payment );
453
+		$modified_time = get_post_modified_time('U', false, $payment);
454 454
 
455 455
 		// 1450124863 =  12/10/2015 20:42:25.
456
-		if ( $modified_time >= 1450124863 ) {
456
+		if ($modified_time >= 1450124863) {
457 457
 
458
-			give_update_payment_status( $payment, 'pending' );
458
+			give_update_payment_status($payment, 'pending');
459 459
 
460 460
 		}
461 461
 	}
462 462
 
463 463
 	$give_updates->percentage = 100;
464
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
464
+	give_set_upgrade_complete('upgrade_give_offline_status');
465 465
 }
466 466
 
467 467
 
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
  */
475 475
 function give_v152_cleanup_users() {
476 476
 
477
-	$give_version = get_option( 'give_version' );
477
+	$give_version = get_option('give_version');
478 478
 
479
-	if ( ! $give_version ) {
479
+	if ( ! $give_version) {
480 480
 		// 1.0 is the first version to use this option so we must add it.
481 481
 		$give_version = '1.0';
482 482
 	}
483 483
 
484
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
484
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
485 485
 
486 486
 	// v1.5.2 Upgrades
487
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
487
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
488 488
 
489 489
 		// Delete all caps with "ss".
490 490
 		// Also delete all unused "campaign" roles.
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 		);
532 532
 
533 533
 		global $wp_roles;
534
-		foreach ( $delete_caps as $cap ) {
535
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
536
-				$wp_roles->remove_cap( $role, $cap );
534
+		foreach ($delete_caps as $cap) {
535
+			foreach (array_keys($wp_roles->roles) as $role) {
536
+				$wp_roles->remove_cap($role, $cap);
537 537
 			}
538 538
 		}
539 539
 
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 		$roles->add_caps();
544 544
 
545 545
 		// The Update Ran.
546
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
547
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
548
-		delete_option( 'give_doing_upgrade' );
546
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
547
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
548
+		delete_option('give_doing_upgrade');
549 549
 
550 550
 	}// End if().
551 551
 
552 552
 }
553 553
 
554
-add_action( 'admin_init', 'give_v152_cleanup_users' );
554
+add_action('admin_init', 'give_v152_cleanup_users');
555 555
 
556 556
 /**
557 557
  * 1.6 Upgrade routine to create the customer meta table.
@@ -594,53 +594,53 @@  discard block
 block discarded – undo
594 594
 
595 595
 	// Get addons license key.
596 596
 	$addons = array();
597
-	foreach ( $give_options as $key => $value ) {
598
-		if ( false !== strpos( $key, '_license_key' ) ) {
599
-			$addons[ $key ] = $value;
597
+	foreach ($give_options as $key => $value) {
598
+		if (false !== strpos($key, '_license_key')) {
599
+			$addons[$key] = $value;
600 600
 		}
601 601
 	}
602 602
 
603 603
 	// Bailout: We do not have any addon license data to upgrade.
604
-	if ( empty( $addons ) ) {
604
+	if (empty($addons)) {
605 605
 		return false;
606 606
 	}
607 607
 
608
-	foreach ( $addons as $key => $addon_license ) {
608
+	foreach ($addons as $key => $addon_license) {
609 609
 
610 610
 		// Get addon shortname.
611
-		$shortname = str_replace( '_license_key', '', $key );
611
+		$shortname = str_replace('_license_key', '', $key);
612 612
 
613 613
 		// Addon license option name.
614
-		$addon_license_option_name = $shortname . '_license_active';
614
+		$addon_license_option_name = $shortname.'_license_active';
615 615
 
616 616
 		// bailout if license is empty.
617
-		if ( empty( $addon_license ) ) {
618
-			delete_option( $addon_license_option_name );
617
+		if (empty($addon_license)) {
618
+			delete_option($addon_license_option_name);
619 619
 			continue;
620 620
 		}
621 621
 
622 622
 		// Get addon name.
623 623
 		$addon_name       = array();
624
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
625
-		foreach ( $addon_name_parts as $name_part ) {
624
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
625
+		foreach ($addon_name_parts as $name_part) {
626 626
 
627 627
 			// Fix addon name
628
-			switch ( $name_part ) {
628
+			switch ($name_part) {
629 629
 				case 'authorizenet' :
630 630
 					$name_part = 'authorize.net';
631 631
 					break;
632 632
 			}
633 633
 
634
-			$addon_name[] = ucfirst( $name_part );
634
+			$addon_name[] = ucfirst($name_part);
635 635
 		}
636 636
 
637
-		$addon_name = implode( ' ', $addon_name );
637
+		$addon_name = implode(' ', $addon_name);
638 638
 
639 639
 		// Data to send to the API.
640 640
 		$api_params = array(
641 641
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
642 642
 			'license'    => $addon_license,
643
-			'item_name'  => urlencode( $addon_name ),
643
+			'item_name'  => urlencode($addon_name),
644 644
 			'url'        => home_url(),
645 645
 		);
646 646
 
@@ -655,17 +655,17 @@  discard block
 block discarded – undo
655 655
 		);
656 656
 
657 657
 		// Make sure there are no errors.
658
-		if ( is_wp_error( $response ) ) {
659
-			delete_option( $addon_license_option_name );
658
+		if (is_wp_error($response)) {
659
+			delete_option($addon_license_option_name);
660 660
 			continue;
661 661
 		}
662 662
 
663 663
 		// Tell WordPress to look for updates.
664
-		set_site_transient( 'update_plugins', null );
664
+		set_site_transient('update_plugins', null);
665 665
 
666 666
 		// Decode license data.
667
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
668
-		update_option( $addon_license_option_name, $license_data );
667
+		$license_data = json_decode(wp_remote_retrieve_body($response));
668
+		update_option($addon_license_option_name, $license_data);
669 669
 	}// End foreach().
670 670
 }
671 671
 
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 	);
696 696
 
697 697
 	global $wp_roles;
698
-	foreach ( $delete_caps as $cap ) {
699
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
700
-			$wp_roles->remove_cap( $role, $cap );
698
+	foreach ($delete_caps as $cap) {
699
+		foreach (array_keys($wp_roles->roles) as $role) {
700
+			$wp_roles->remove_cap($role, $cap);
701 701
 		}
702 702
 	}
703 703
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 function give_v18_upgrades_core_setting() {
732 732
 	// Core settings which changes from checkbox to radio.
733 733
 	$core_setting_names = array_merge(
734
-		array_keys( give_v18_renamed_core_settings() ),
734
+		array_keys(give_v18_renamed_core_settings()),
735 735
 		array(
736 736
 			'uninstall_on_delete',
737 737
 			'scripts_footer',
@@ -743,48 +743,48 @@  discard block
 block discarded – undo
743 743
 	);
744 744
 
745 745
 	// Bailout: If not any setting define.
746
-	if ( $give_settings = get_option( 'give_settings' ) ) {
746
+	if ($give_settings = get_option('give_settings')) {
747 747
 
748 748
 		$setting_changed = false;
749 749
 
750 750
 		// Loop: check each setting field.
751
-		foreach ( $core_setting_names as $setting_name ) {
751
+		foreach ($core_setting_names as $setting_name) {
752 752
 			// New setting name.
753
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
753
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
754 754
 
755 755
 			// Continue: If setting already set.
756 756
 			if (
757
-				array_key_exists( $new_setting_name, $give_settings )
758
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
757
+				array_key_exists($new_setting_name, $give_settings)
758
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
759 759
 			) {
760 760
 				continue;
761 761
 			}
762 762
 
763 763
 			// Set checkbox value to radio value.
764
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
764
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
765 765
 
766 766
 			// @see https://github.com/WordImpress/Give/issues/1063.
767
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
767
+			if (false !== strpos($setting_name, 'disable_')) {
768 768
 
769
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
770
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
769
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
770
+			} elseif (false !== strpos($setting_name, 'enable_')) {
771 771
 
772
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
772
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
773 773
 			}
774 774
 
775 775
 			// Tell bot to update core setting to db.
776
-			if ( ! $setting_changed ) {
776
+			if ( ! $setting_changed) {
777 777
 				$setting_changed = true;
778 778
 			}
779 779
 		}
780 780
 
781 781
 		// Update setting only if they changed.
782
-		if ( $setting_changed ) {
783
-			update_option( 'give_settings', $give_settings );
782
+		if ($setting_changed) {
783
+			update_option('give_settings', $give_settings);
784 784
 		}
785 785
 	}// End if().
786 786
 
787
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
787
+	give_set_upgrade_complete('v18_upgrades_core_setting');
788 788
 }
789 789
 
790 790
 /**
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	$give_updates = Give_Updates::get_instance();
799 799
 
800 800
 	// form query
801
-	$forms = new WP_Query( array(
801
+	$forms = new WP_Query(array(
802 802
 			'paged'          => $give_updates->step,
803 803
 			'status'         => 'any',
804 804
 			'order'          => 'ASC',
@@ -807,41 +807,41 @@  discard block
 block discarded – undo
807 807
 		)
808 808
 	);
809 809
 
810
-	if ( $forms->have_posts() ) {
811
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
810
+	if ($forms->have_posts()) {
811
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
812 812
 
813
-		while ( $forms->have_posts() ) {
813
+		while ($forms->have_posts()) {
814 814
 			$forms->the_post();
815 815
 
816 816
 			// Form content.
817 817
 			// Note in version 1.8 display content setting split into display content and content placement setting.
818 818
 			// You can delete _give_content_option in future.
819
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
820
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
821
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
822
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
819
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
820
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
821
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
822
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
823 823
 
824
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
825
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
824
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
825
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
826 826
 			}
827 827
 
828 828
 			// "Disable" Guest Donation. Checkbox.
829 829
 			// See: https://github.com/WordImpress/Give/issues/1470.
830
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
831
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
832
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
830
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
831
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
832
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
833 833
 
834 834
 			// Offline Donations.
835 835
 			// See: https://github.com/WordImpress/Give/issues/1579.
836
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
837
-			if ( 'no' === $offline_donation ) {
836
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
837
+			if ('no' === $offline_donation) {
838 838
 				$offline_donation_newval = 'global';
839
-			} elseif ( 'yes' === $offline_donation ) {
839
+			} elseif ('yes' === $offline_donation) {
840 840
 				$offline_donation_newval = 'enabled';
841 841
 			} else {
842 842
 				$offline_donation_newval = 'disabled';
843 843
 			}
844
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
844
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
845 845
 
846 846
 			// Convert yes/no setting field to enabled/disabled.
847 847
 			$form_radio_settings = array(
@@ -861,15 +861,15 @@  discard block
 block discarded – undo
861 861
 				'_give_offline_donation_enable_billing_fields_single',
862 862
 			);
863 863
 
864
-			foreach ( $form_radio_settings as $meta_key ) {
864
+			foreach ($form_radio_settings as $meta_key) {
865 865
 				// Get value.
866
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
866
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
867 867
 
868 868
 				// Convert meta value only if it is in yes/no/none.
869
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
869
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
870 870
 
871
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
872
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
871
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
872
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
873 873
 				}
874 874
 			}
875 875
 		}// End while().
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 
879 879
 	} else {
880 880
 		// No more forms found, finish up.
881
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
881
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
882 882
 	}
883 883
 }
884 884
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 				'%_transient_give_stats_%',
946 946
 				'give_cache%',
947 947
 				'%_transient_give_add_ons_feed%',
948
-				'%_transient__give_ajax_works' .
948
+				'%_transient__give_ajax_works'.
949 949
 				'%_transient_give_total_api_keys%',
950 950
 				'%_transient_give_i18n_give_promo_hide%',
951 951
 				'%_transient_give_contributors%',
@@ -972,24 +972,24 @@  discard block
 block discarded – undo
972 972
 		ARRAY_A
973 973
 	);
974 974
 
975
-	if ( ! empty( $user_apikey_options ) ) {
976
-		foreach ( $user_apikey_options as $user ) {
977
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
978
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
979
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
975
+	if ( ! empty($user_apikey_options)) {
976
+		foreach ($user_apikey_options as $user) {
977
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
978
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
979
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
980 980
 		}
981 981
 	}
982 982
 
983
-	if ( ! empty( $cached_options ) ) {
984
-		foreach ( $cached_options as $option ) {
985
-			switch ( true ) {
986
-				case ( false !== strpos( $option, 'transient' ) ):
987
-					$option = str_replace( '_transient_', '', $option );
988
-					delete_transient( $option );
983
+	if ( ! empty($cached_options)) {
984
+		foreach ($cached_options as $option) {
985
+			switch (true) {
986
+				case (false !== strpos($option, 'transient')):
987
+					$option = str_replace('_transient_', '', $option);
988
+					delete_transient($option);
989 989
 					break;
990 990
 
991 991
 				default:
992
-					delete_option( $option );
992
+					delete_option($option);
993 993
 			}
994 994
 		}
995 995
 	}
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	global $wp_roles;
1008 1008
 
1009 1009
 	// Get the role object.
1010
-	$give_worker = get_role( 'give_worker' );
1010
+	$give_worker = get_role('give_worker');
1011 1011
 
1012 1012
 	// A list of capabilities to add for give workers.
1013 1013
 	$caps_to_add = array(
@@ -1015,9 +1015,9 @@  discard block
 block discarded – undo
1015 1015
 		'edit_pages',
1016 1016
 	);
1017 1017
 
1018
-	foreach ( $caps_to_add as $cap ) {
1018
+	foreach ($caps_to_add as $cap) {
1019 1019
 		// Add the capability.
1020
-		$give_worker->add_cap( $cap );
1020
+		$give_worker->add_cap($cap);
1021 1021
 	}
1022 1022
 
1023 1023
 }
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 	$give_updates = Give_Updates::get_instance();
1035 1035
 
1036 1036
 	// form query.
1037
-	$donation_forms = new WP_Query( array(
1037
+	$donation_forms = new WP_Query(array(
1038 1038
 			'paged'          => $give_updates->step,
1039 1039
 			'status'         => 'any',
1040 1040
 			'order'          => 'ASC',
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
 		)
1044 1044
 	);
1045 1045
 
1046
-	if ( $donation_forms->have_posts() ) {
1047
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1046
+	if ($donation_forms->have_posts()) {
1047
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1048 1048
 
1049
-		while ( $donation_forms->have_posts() ) {
1049
+		while ($donation_forms->have_posts()) {
1050 1050
 			$donation_forms->the_post();
1051 1051
 			$form_id = get_the_ID();
1052 1052
 
@@ -1054,41 +1054,41 @@  discard block
 block discarded – undo
1054 1054
 			update_post_meta(
1055 1055
 				$form_id,
1056 1056
 				'_give_set_price',
1057
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1057
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1058 1058
 			);
1059 1059
 
1060 1060
 			// Remove formatting from _give_custom_amount_minimum.
1061 1061
 			update_post_meta(
1062 1062
 				$form_id,
1063 1063
 				'_give_custom_amount_minimum',
1064
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1064
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1065 1065
 			);
1066 1066
 
1067 1067
 			// Bailout.
1068
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1068
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1069 1069
 				continue;
1070 1070
 			}
1071 1071
 
1072
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1072
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1073 1073
 
1074
-			if ( ! empty( $donation_levels ) ) {
1074
+			if ( ! empty($donation_levels)) {
1075 1075
 
1076
-				foreach ( $donation_levels as $index => $donation_level ) {
1077
-					if ( isset( $donation_level['_give_amount'] ) ) {
1078
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1076
+				foreach ($donation_levels as $index => $donation_level) {
1077
+					if (isset($donation_level['_give_amount'])) {
1078
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1079 1079
 					}
1080 1080
 				}
1081 1081
 
1082
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1082
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1083 1083
 
1084
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1084
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1085 1085
 
1086
-				$min_amount = min( $donation_levels_amounts );
1087
-				$max_amount = max( $donation_levels_amounts );
1086
+				$min_amount = min($donation_levels_amounts);
1087
+				$max_amount = max($donation_levels_amounts);
1088 1088
 
1089 1089
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1090
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1091
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1090
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1091
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1092 1092
 			}
1093 1093
 
1094 1094
 		}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 		wp_reset_postdata();
1098 1098
 	} else {
1099 1099
 		// The Update Ran.
1100
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1100
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1101 1101
 	}
1102 1102
 
1103 1103
 }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
  */
1148 1148
 function give_v20_upgrades() {
1149 1149
 	// Update cache setting.
1150
-	give_update_option( 'cache', 'enabled' );
1150
+	give_update_option('cache', 'enabled');
1151 1151
 
1152 1152
 	// Upgrade email settings.
1153 1153
 	give_v20_upgrades_email_setting();
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 	$all_setting = give_get_settings();
1167 1167
 
1168 1168
 	// Bailout on fresh install.
1169
-	if ( empty( $all_setting ) ) {
1169
+	if (empty($all_setting)) {
1170 1170
 		return;
1171 1171
 	}
1172 1172
 
@@ -1185,19 +1185,19 @@  discard block
 block discarded – undo
1185 1185
 		'admin_notices'                 => 'new-donation_notification',
1186 1186
 	);
1187 1187
 
1188
-	foreach ( $settings as $old_setting => $new_setting ) {
1188
+	foreach ($settings as $old_setting => $new_setting) {
1189 1189
 		// Do not update already modified
1190
-		if ( ! is_array( $new_setting ) ) {
1191
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1190
+		if ( ! is_array($new_setting)) {
1191
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1192 1192
 				continue;
1193 1193
 			}
1194 1194
 		}
1195 1195
 
1196
-		switch ( $old_setting ) {
1196
+		switch ($old_setting) {
1197 1197
 			case 'admin_notices':
1198
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1198
+				$notification_status = give_get_option($old_setting, 'enabled');
1199 1199
 
1200
-				give_update_option( $new_setting, $notification_status );
1200
+				give_update_option($new_setting, $notification_status);
1201 1201
 
1202 1202
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1203 1203
 				// give_delete_option( $old_setting );
@@ -1208,19 +1208,19 @@  discard block
 block discarded – undo
1208 1208
 			case 'admin_notice_emails':
1209 1209
 				$recipients = give_get_admin_notice_emails();
1210 1210
 
1211
-				foreach ( $new_setting as $setting ) {
1211
+				foreach ($new_setting as $setting) {
1212 1212
 					// bailout if setting already exist.
1213
-					if ( array_key_exists( $setting, $all_setting ) ) {
1213
+					if (array_key_exists($setting, $all_setting)) {
1214 1214
 						continue;
1215 1215
 					}
1216 1216
 
1217
-					give_update_option( $setting, $recipients );
1217
+					give_update_option($setting, $recipients);
1218 1218
 				}
1219 1219
 				break;
1220 1220
 
1221 1221
 			default:
1222
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1223
-				give_delete_option( $old_setting );
1222
+				give_update_option($new_setting, give_get_option($old_setting));
1223
+				give_delete_option($old_setting);
1224 1224
 		}
1225 1225
 	}
1226 1226
 }
@@ -1237,22 +1237,22 @@  discard block
 block discarded – undo
1237 1237
 	$give_settings        = give_get_settings();
1238 1238
 	$give_setting_updated = false;
1239 1239
 
1240
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1240
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1241 1241
 		$give_settings['number_decimals']   = 0;
1242 1242
 		$give_settings['decimal_separator'] = '';
1243 1243
 		$give_setting_updated               = true;
1244 1244
 
1245
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1245
+	} elseif (empty($give_settings['decimal_separator'])) {
1246 1246
 		$give_settings['number_decimals'] = 0;
1247 1247
 		$give_setting_updated             = true;
1248 1248
 
1249
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1249
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1250 1250
 		$give_settings['number_decimals'] = 5;
1251 1251
 		$give_setting_updated             = true;
1252 1252
 	}
1253 1253
 
1254
-	if ( $give_setting_updated ) {
1255
-		update_option( 'give_settings', $give_settings );
1254
+	if ($give_setting_updated) {
1255
+		update_option('give_settings', $give_settings);
1256 1256
 	}
1257 1257
 }
1258 1258
 
@@ -1271,69 +1271,69 @@  discard block
 block discarded – undo
1271 1271
 	$give_updates = Give_Updates::get_instance();
1272 1272
 
1273 1273
 	// form query.
1274
-	$donation_forms = new WP_Query( array(
1274
+	$donation_forms = new WP_Query(array(
1275 1275
 			'paged'          => $give_updates->step,
1276 1276
 			'status'         => 'any',
1277 1277
 			'order'          => 'ASC',
1278
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1278
+			'post_type'      => array('give_forms', 'give_payment'),
1279 1279
 			'posts_per_page' => 20,
1280 1280
 		)
1281 1281
 	);
1282
-	if ( $donation_forms->have_posts() ) {
1283
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1282
+	if ($donation_forms->have_posts()) {
1283
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1284 1284
 
1285
-		while ( $donation_forms->have_posts() ) {
1285
+		while ($donation_forms->have_posts()) {
1286 1286
 			$donation_forms->the_post();
1287 1287
 			global $post;
1288 1288
 
1289
-			$meta = get_post_meta( $post->ID );
1289
+			$meta = get_post_meta($post->ID);
1290 1290
 
1291
-			switch ( $post->post_type ) {
1291
+			switch ($post->post_type) {
1292 1292
 				case 'give_forms':
1293 1293
 					// _give_set_price.
1294
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1295
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1294
+					if ( ! empty($meta['_give_set_price'][0])) {
1295
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1296 1296
 					}
1297 1297
 
1298 1298
 					// _give_custom_amount_minimum.
1299
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1300
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1299
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1300
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1301 1301
 					}
1302 1302
 
1303 1303
 					// _give_levels_minimum_amount.
1304
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1305
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1304
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1305
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1306 1306
 					}
1307 1307
 
1308 1308
 					// _give_levels_maximum_amount.
1309
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1310
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1309
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1310
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1311 1311
 					}
1312 1312
 
1313 1313
 					// _give_set_goal.
1314
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1315
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1314
+					if ( ! empty($meta['_give_set_goal'][0])) {
1315
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1316 1316
 					}
1317 1317
 
1318 1318
 					// _give_form_earnings.
1319
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1320
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1319
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1320
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1321 1321
 					}
1322 1322
 
1323 1323
 					// _give_custom_amount_minimum.
1324
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1325
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1324
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1325
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1326 1326
 
1327
-						foreach ( $donation_levels as $index => $level ) {
1328
-							if ( empty( $level['_give_amount'] ) ) {
1327
+						foreach ($donation_levels as $index => $level) {
1328
+							if (empty($level['_give_amount'])) {
1329 1329
 								continue;
1330 1330
 							}
1331 1331
 
1332
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1332
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1333 1333
 						}
1334 1334
 
1335 1335
 						$meta['_give_donation_levels'] = $donation_levels;
1336
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1336
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1337 1337
 					}
1338 1338
 
1339 1339
 
@@ -1341,8 +1341,8 @@  discard block
 block discarded – undo
1341 1341
 
1342 1342
 				case 'give_payment':
1343 1343
 					// _give_payment_total.
1344
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1345
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1344
+					if ( ! empty($meta['_give_payment_total'][0])) {
1345
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1346 1346
 					}
1347 1347
 
1348 1348
 					break;
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		wp_reset_postdata();
1354 1354
 	} else {
1355 1355
 		// The Update Ran.
1356
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1356
+		give_set_upgrade_complete('v1812_update_amount_values');
1357 1357
 	}
1358 1358
 }
1359 1359
 
@@ -1372,22 +1372,22 @@  discard block
 block discarded – undo
1372 1372
 	$give_updates = Give_Updates::get_instance();
1373 1373
 
1374 1374
 	// form query.
1375
-	$donors = Give()->donors->get_donors( array(
1375
+	$donors = Give()->donors->get_donors(array(
1376 1376
 			'number' => 20,
1377
-			'offset' => $give_updates->get_offset( 20 ),
1377
+			'offset' => $give_updates->get_offset(20),
1378 1378
 		)
1379 1379
 	);
1380 1380
 
1381
-	if ( ! empty( $donors ) ) {
1382
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1381
+	if ( ! empty($donors)) {
1382
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1383 1383
 
1384 1384
 		/* @var Object $donor */
1385
-		foreach ( $donors as $donor ) {
1386
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1385
+		foreach ($donors as $donor) {
1386
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1387 1387
 		}
1388 1388
 	} else {
1389 1389
 		// The Update Ran.
1390
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1390
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1391 1391
 	}
1392 1392
 }
1393 1393
 
@@ -1401,25 +1401,25 @@  discard block
 block discarded – undo
1401 1401
 	$give_updates = Give_Updates::get_instance();
1402 1402
 
1403 1403
 	// Fetch all the existing donors.
1404
-	$donors = Give()->donors->get_donors( array(
1404
+	$donors = Give()->donors->get_donors(array(
1405 1405
 			'number' => 20,
1406
-			'offset' => $give_updates->get_offset( 20 ),
1406
+			'offset' => $give_updates->get_offset(20),
1407 1407
 		)
1408 1408
 	);
1409 1409
 
1410
-	if ( ! empty( $donors ) ) {
1411
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1410
+	if ( ! empty($donors)) {
1411
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1412 1412
 
1413 1413
 		/* @var Object $donor */
1414
-		foreach ( $donors as $donor ) {
1414
+		foreach ($donors as $donor) {
1415 1415
 			$user_id = $donor->user_id;
1416 1416
 
1417 1417
 			// Proceed, if donor is attached with user.
1418
-			if ( $user_id ) {
1419
-				$user = get_userdata( $user_id );
1418
+			if ($user_id) {
1419
+				$user = get_userdata($user_id);
1420 1420
 
1421 1421
 				// Update user role, if user has subscriber role.
1422
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1422
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1423 1423
 					wp_update_user(
1424 1424
 						array(
1425 1425
 							'ID'   => $user_id,
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 		}
1432 1432
 	} else {
1433 1433
 		// The Update Ran.
1434
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1434
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1435 1435
 	}
1436 1436
 }
1437 1437
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function give_v1813_upgrades() {
1445 1445
 	// Update admin setting.
1446
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1446
+	give_update_option('donor_default_user_role', 'give_donor');
1447 1447
 
1448 1448
 	// Update Give roles.
1449 1449
 	$roles = new Give_Roles();
@@ -1461,33 +1461,33 @@  discard block
 block discarded – undo
1461 1461
 	$give_updates = Give_Updates::get_instance();
1462 1462
 
1463 1463
 	// form query.
1464
-	$payments = new WP_Query( array(
1464
+	$payments = new WP_Query(array(
1465 1465
 			'paged'          => $give_updates->step,
1466 1466
 			'status'         => 'any',
1467 1467
 			'order'          => 'ASC',
1468
-			'post_type'      => array( 'give_payment' ),
1468
+			'post_type'      => array('give_payment'),
1469 1469
 			'posts_per_page' => 100,
1470 1470
 		)
1471 1471
 	);
1472 1472
 
1473
-	if ( $payments->have_posts() ) {
1474
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1473
+	if ($payments->have_posts()) {
1474
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1475 1475
 
1476
-		while ( $payments->have_posts() ) {
1476
+		while ($payments->have_posts()) {
1477 1477
 			$payments->the_post();
1478 1478
 
1479
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1479
+			$payment_meta = give_get_payment_meta(get_the_ID());
1480 1480
 
1481
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1481
+			if ('RIAL' === $payment_meta['currency']) {
1482 1482
 				$payment_meta['currency'] = 'IRR';
1483
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1483
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1484 1484
 			}
1485 1485
 
1486 1486
 		}
1487 1487
 
1488 1488
 	} else {
1489 1489
 		// The Update Ran.
1490
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1490
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1491 1491
 	}
1492 1492
 }
1493 1493
 
@@ -1500,9 +1500,9 @@  discard block
 block discarded – undo
1500 1500
 function give_v1817_upgrades() {
1501 1501
 	$give_settings = give_get_settings();
1502 1502
 
1503
-	if ( 'RIAL' === $give_settings['currency'] ) {
1503
+	if ('RIAL' === $give_settings['currency']) {
1504 1504
 		$give_settings['currency'] = 'IRR';
1505
-		update_option( 'give_settings', $give_settings );
1505
+		update_option('give_settings', $give_settings);
1506 1506
 	}
1507 1507
 }
1508 1508
 
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 
1516 1516
 	global $wp_roles;
1517 1517
 
1518
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1518
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1519 1519
 		return;
1520 1520
 	}
1521 1521
 
@@ -1539,15 +1539,15 @@  discard block
 block discarded – undo
1539 1539
 		),
1540 1540
 	);
1541 1541
 
1542
-	foreach ( $add_caps as $role => $caps ) {
1543
-		foreach ( $caps as $cap ) {
1544
-			$wp_roles->add_cap( $role, $cap );
1542
+	foreach ($add_caps as $role => $caps) {
1543
+		foreach ($caps as $cap) {
1544
+			$wp_roles->add_cap($role, $cap);
1545 1545
 		}
1546 1546
 	}
1547 1547
 
1548
-	foreach ( $remove_caps as $role => $caps ) {
1549
-		foreach ( $caps as $cap ) {
1550
-			$wp_roles->remove_cap( $role, $cap );
1548
+	foreach ($remove_caps as $role => $caps) {
1549
+		foreach ($caps as $cap) {
1550
+			$wp_roles->remove_cap($role, $cap);
1551 1551
 		}
1552 1552
 	}
1553 1553
 
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
 	$roles->add_roles();
1572 1572
 	$roles->add_caps();
1573 1573
 
1574
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1574
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1575 1575
 }
1576 1576
 
1577 1577
 /**
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
 function give_v1818_upgrades() {
1583 1583
 
1584 1584
 	// Remove email_access_installed from give_settings.
1585
-	give_delete_option( 'email_access_installed' );
1585
+	give_delete_option('email_access_installed');
1586 1586
 }
1587 1587
 
1588 1588
 /**
@@ -1595,23 +1595,23 @@  discard block
 block discarded – undo
1595 1595
 	/* @var Give_Updates $give_updates */
1596 1596
 	$give_updates = Give_Updates::get_instance();
1597 1597
 
1598
-	$donations = new WP_Query( array(
1598
+	$donations = new WP_Query(array(
1599 1599
 			'paged'          => $give_updates->step,
1600 1600
 			'status'         => 'any',
1601 1601
 			'order'          => 'ASC',
1602
-			'post_type'      => array( 'give_payment' ),
1602
+			'post_type'      => array('give_payment'),
1603 1603
 			'posts_per_page' => 100,
1604 1604
 		)
1605 1605
 	);
1606 1606
 
1607
-	if ( $donations->have_posts() ) {
1608
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1607
+	if ($donations->have_posts()) {
1608
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1609 1609
 
1610
-		while ( $donations->have_posts() ) {
1610
+		while ($donations->have_posts()) {
1611 1611
 			$donations->the_post();
1612 1612
 
1613
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1614
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1613
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1614
+			$donation_meta = give_get_payment_meta(get_the_ID());
1615 1615
 
1616 1616
 			// Update Donation meta with price_id set as custom, only if it is:
1617 1617
 			// 1. Donation Type = Set Donation.
@@ -1620,19 +1620,19 @@  discard block
 block discarded – undo
1620 1620
 			if (
1621 1621
 				$form->ID &&
1622 1622
 				$form->is_set_type_donation_form() &&
1623
-				( 'custom' !== $donation_meta['price_id'] ) &&
1624
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1623
+				('custom' !== $donation_meta['price_id']) &&
1624
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1625 1625
 			) {
1626 1626
 				$donation_meta['price_id'] = 'custom';
1627
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1628
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1627
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1628
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1629 1629
 			}
1630 1630
 		}
1631 1631
 
1632 1632
 		wp_reset_postdata();
1633 1633
 	} else {
1634 1634
 		// Update Ran Successfully.
1635
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1635
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1636 1636
 	}
1637 1637
 }
1638 1638
 
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 
1651 1651
 	global $wp_roles;
1652 1652
 
1653
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1653
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1654 1654
 		return;
1655 1655
 	}
1656 1656
 
@@ -1668,9 +1668,9 @@  discard block
 block discarded – undo
1668 1668
 		),
1669 1669
 	);
1670 1670
 
1671
-	foreach ( $remove_caps as $role => $caps ) {
1672
-		foreach ( $caps as $cap ) {
1673
-			$wp_roles->remove_cap( $role, $cap );
1671
+	foreach ($remove_caps as $role => $caps) {
1672
+		foreach ($caps as $cap) {
1673
+			$wp_roles->remove_cap($role, $cap);
1674 1674
 		}
1675 1675
 	}
1676 1676
 
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 	$roles->add_roles();
1682 1682
 	$roles->add_caps();
1683 1683
 
1684
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1684
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1685 1685
 }
1686 1686
 
1687 1687
 /**
@@ -1695,7 +1695,7 @@  discard block
 block discarded – undo
1695 1695
 	$give_updates = Give_Updates::get_instance();
1696 1696
 
1697 1697
 	// form query
1698
-	$forms = new WP_Query( array(
1698
+	$forms = new WP_Query(array(
1699 1699
 			'paged'          => $give_updates->step,
1700 1700
 			'status'         => 'any',
1701 1701
 			'order'          => 'ASC',
@@ -1704,22 +1704,22 @@  discard block
 block discarded – undo
1704 1704
 		)
1705 1705
 	);
1706 1706
 
1707
-	if ( $forms->have_posts() ) {
1708
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1707
+	if ($forms->have_posts()) {
1708
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1709 1709
 
1710
-		while ( $forms->have_posts() ) {
1710
+		while ($forms->have_posts()) {
1711 1711
 			$forms->the_post();
1712 1712
 			global $post;
1713 1713
 
1714 1714
 			// Update offline instruction email notification status.
1715
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1716
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1715
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1716
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1717 1717
 				'enabled',
1718 1718
 				'global',
1719
-			) )
1719
+			))
1720 1720
 				? $offline_instruction_notification_status
1721 1721
 				: 'global';
1722
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1722
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1723 1723
 
1724 1724
 			// Update offline instruction email message.
1725 1725
 			update_post_meta(
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
 		wp_reset_postdata();
1752 1752
 	} else {
1753 1753
 		// No more forms found, finish up.
1754
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1754
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1755 1755
 	}
1756 1756
 }
1757 1757
 
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 	$give_updates = Give_Updates::get_instance();
1769 1769
 
1770 1770
 	// form query
1771
-	$forms = new WP_Query( array(
1771
+	$forms = new WP_Query(array(
1772 1772
 			'paged'          => $give_updates->step,
1773 1773
 			'status'         => 'any',
1774 1774
 			'order'          => 'ASC',
@@ -1777,19 +1777,19 @@  discard block
 block discarded – undo
1777 1777
 		)
1778 1778
 	);
1779 1779
 
1780
-	if ( $forms->have_posts() ) {
1781
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1780
+	if ($forms->have_posts()) {
1781
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1782 1782
 
1783
-		while ( $forms->have_posts() ) {
1783
+		while ($forms->have_posts()) {
1784 1784
 			$forms->the_post();
1785 1785
 			global $post;
1786 1786
 
1787 1787
 			// Split _give_payment_meta meta.
1788 1788
 			// @todo Remove _give_payment_meta after releases 2.0
1789
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1789
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1790 1790
 
1791
-			if ( ! empty( $payment_meta ) ) {
1792
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1791
+			if ( ! empty($payment_meta)) {
1792
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1793 1793
 			}
1794 1794
 
1795 1795
 			$deprecated_meta_keys = array(
@@ -1798,9 +1798,9 @@  discard block
 block discarded – undo
1798 1798
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1799 1799
 			);
1800 1800
 
1801
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1801
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1802 1802
 				// Do not add new meta key if already exist.
1803
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1803
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1804 1804
 					continue;
1805 1805
 				}
1806 1806
 
@@ -1809,25 +1809,25 @@  discard block
 block discarded – undo
1809 1809
 					array(
1810 1810
 						'post_id'    => $post->ID,
1811 1811
 						'meta_key'   => $new_meta_key,
1812
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1812
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1813 1813
 					)
1814 1814
 				);
1815 1815
 			}
1816 1816
 
1817 1817
 			// Bailout
1818
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1818
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1819 1819
 				/* @var Give_Donor $donor */
1820
-				$donor = new Give_Donor( $donor_id );
1820
+				$donor = new Give_Donor($donor_id);
1821 1821
 
1822
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1823
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1824
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1825
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1826
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1827
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1822
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1823
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1824
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1825
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1826
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1827
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1828 1828
 
1829 1829
 				// Save address.
1830
-				$donor->add_address( 'billing[]', $address );
1830
+				$donor->add_address('billing[]', $address);
1831 1831
 			}
1832 1832
 
1833 1833
 		}// End while().
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1839 1839
 
1840 1840
 		// No more forms found, finish up.
1841
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1841
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1842 1842
 	}
1843 1843
 }
1844 1844
 
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 	$give_updates = Give_Updates::get_instance();
1855 1855
 
1856 1856
 	// form query
1857
-	$forms = new WP_Query( array(
1857
+	$forms = new WP_Query(array(
1858 1858
 			'paged'          => $give_updates->step,
1859 1859
 			'order'          => 'DESC',
1860 1860
 			'post_type'      => 'give_log',
@@ -1863,20 +1863,20 @@  discard block
 block discarded – undo
1863 1863
 		)
1864 1864
 	);
1865 1865
 
1866
-	if ( $forms->have_posts() ) {
1867
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1866
+	if ($forms->have_posts()) {
1867
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1868 1868
 
1869
-		while ( $forms->have_posts() ) {
1869
+		while ($forms->have_posts()) {
1870 1870
 			$forms->the_post();
1871 1871
 			global $post;
1872 1872
 
1873
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1873
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1874 1874
 				continue;
1875 1875
 			}
1876 1876
 
1877
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1878
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1879
-			$term_name = ! empty( $term ) ? $term->slug : '';
1877
+			$term      = get_the_terms($post->ID, 'give_log_type');
1878
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1879
+			$term_name = ! empty($term) ? $term->slug : '';
1880 1880
 
1881 1881
 			$log_data = array(
1882 1882
 				'ID'           => $post->ID,
@@ -1889,29 +1889,29 @@  discard block
 block discarded – undo
1889 1889
 			);
1890 1890
 			$log_meta = array();
1891 1891
 
1892
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1893
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1894
-					switch ( $meta_key ) {
1892
+			if ($old_log_meta = get_post_meta($post->ID)) {
1893
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1894
+					switch ($meta_key) {
1895 1895
 						case '_give_log_payment_id':
1896
-							$log_data['log_parent']        = current( $meta_value );
1896
+							$log_data['log_parent']        = current($meta_value);
1897 1897
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1898 1898
 							break;
1899 1899
 
1900 1900
 						default:
1901
-							$log_meta[ $meta_key ] = current( $meta_value );
1901
+							$log_meta[$meta_key] = current($meta_value);
1902 1902
 					}
1903 1903
 				}
1904 1904
 			}
1905 1905
 
1906
-			if ( 'api_request' === $term_name ) {
1906
+			if ('api_request' === $term_name) {
1907 1907
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1908 1908
 			}
1909 1909
 
1910
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1910
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1911 1911
 
1912
-			if ( ! empty( $log_meta ) ) {
1913
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1914
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1912
+			if ( ! empty($log_meta)) {
1913
+				foreach ($log_meta as $meta_key => $meta_value) {
1914
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1915 1915
 				}
1916 1916
 			}
1917 1917
 
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 		Give()->logs->delete_cache();
1954 1954
 
1955 1955
 		// No more forms found, finish up.
1956
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1956
+		give_set_upgrade_complete('v20_logs_upgrades');
1957 1957
 	}
1958 1958
 }
1959 1959
 
@@ -1969,19 +1969,19 @@  discard block
 block discarded – undo
1969 1969
 	$give_updates = Give_Updates::get_instance();
1970 1970
 
1971 1971
 	// form query
1972
-	$payments = new WP_Query( array(
1972
+	$payments = new WP_Query(array(
1973 1973
 			'paged'          => $give_updates->step,
1974 1974
 			'status'         => 'any',
1975 1975
 			'order'          => 'ASC',
1976
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1976
+			'post_type'      => array('give_forms', 'give_payment'),
1977 1977
 			'posts_per_page' => 100,
1978 1978
 		)
1979 1979
 	);
1980 1980
 
1981
-	if ( $payments->have_posts() ) {
1982
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1981
+	if ($payments->have_posts()) {
1982
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1983 1983
 
1984
-		while ( $payments->have_posts() ) {
1984
+		while ($payments->have_posts()) {
1985 1985
 			$payments->the_post();
1986 1986
 			global $post;
1987 1987
 
@@ -1993,19 +1993,19 @@  discard block
 block discarded – undo
1993 1993
 				ARRAY_A
1994 1994
 			);
1995 1995
 
1996
-			if ( ! empty( $meta_data ) ) {
1997
-				foreach ( $meta_data as $index => $data ) {
1996
+			if ( ! empty($meta_data)) {
1997
+				foreach ($meta_data as $index => $data) {
1998 1998
 					// Check for duplicate meta values.
1999
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1999
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2000 2000
 						continue;
2001 2001
 					}
2002 2002
 
2003
-					switch ( $post->post_type ) {
2003
+					switch ($post->post_type) {
2004 2004
 						case 'give_forms':
2005 2005
 							$data['form_id'] = $data['post_id'];
2006
-							unset( $data['post_id'] );
2006
+							unset($data['post_id']);
2007 2007
 
2008
-							Give()->form_meta->insert( $data );
2008
+							Give()->form_meta->insert($data);
2009 2009
 							// @todo: delete form meta from post meta table after releases 2.0.
2010 2010
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2011 2011
 
@@ -2013,9 +2013,9 @@  discard block
 block discarded – undo
2013 2013
 
2014 2014
 						case 'give_payment':
2015 2015
 							$data['payment_id'] = $data['post_id'];
2016
-							unset( $data['post_id'] );
2016
+							unset($data['post_id']);
2017 2017
 
2018
-							Give()->payment_meta->insert( $data );
2018
+							Give()->payment_meta->insert($data);
2019 2019
 
2020 2020
 							// @todo: delete donation meta from post meta table after releases 2.0.
2021 2021
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 		wp_reset_postdata();
2031 2031
 	} else {
2032 2032
 		// No more forms found, finish up.
2033
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2033
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2034 2034
 	}
2035 2035
 
2036 2036
 }
@@ -2046,44 +2046,44 @@  discard block
 block discarded – undo
2046 2046
 	/* @var Give_Updates $give_updates */
2047 2047
 	$give_updates = Give_Updates::get_instance();
2048 2048
 
2049
-	$donors = Give()->donors->get_donors( array(
2049
+	$donors = Give()->donors->get_donors(array(
2050 2050
 		'paged'  => $give_updates->step,
2051 2051
 		'number' => 100,
2052
-	) );
2052
+	));
2053 2053
 
2054
-	if ( $donors ) {
2055
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2054
+	if ($donors) {
2055
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2056 2056
 		// Loop through Donors
2057
-		foreach ( $donors as $donor ) {
2057
+		foreach ($donors as $donor) {
2058 2058
 
2059
-			$donor_name       = explode( ' ', $donor->name, 2 );
2060
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2061
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2059
+			$donor_name       = explode(' ', $donor->name, 2);
2060
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2061
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2062 2062
 
2063 2063
 			// If first name meta of donor is not created, then create it.
2064
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2065
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2064
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2065
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2066 2066
 			}
2067 2067
 
2068 2068
 			// If last name meta of donor is not created, then create it.
2069
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2070
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2069
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2070
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2071 2071
 			}
2072 2072
 
2073 2073
 			// If Donor is connected with WP User then update user meta.
2074
-			if ( $donor->user_id ) {
2075
-				if ( isset( $donor_name[0] ) ) {
2076
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2074
+			if ($donor->user_id) {
2075
+				if (isset($donor_name[0])) {
2076
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2077 2077
 				}
2078
-				if ( isset( $donor_name[1] ) ) {
2079
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2078
+				if (isset($donor_name[1])) {
2079
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2080 2080
 				}
2081 2081
 			}
2082 2082
 		}
2083 2083
 
2084 2084
 	} else {
2085 2085
 		// The Update Ran.
2086
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2086
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2087 2087
 	}
2088 2088
 
2089 2089
 }
@@ -2112,15 +2112,15 @@  discard block
 block discarded – undo
2112 2112
 
2113 2113
 	$users = $user_query->get_results();
2114 2114
 
2115
-	if ( $users ) {
2116
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2115
+	if ($users) {
2116
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2117 2117
 
2118 2118
 		// Loop through Donors
2119
-		foreach ( $users as $user ) {
2119
+		foreach ($users as $user) {
2120 2120
 			/* @var Give_Donor $donor */
2121
-			$donor = new Give_Donor( $user->ID, true );
2121
+			$donor = new Give_Donor($user->ID, true);
2122 2122
 
2123
-			if ( ! $donor->id ) {
2123
+			if ( ! $donor->id) {
2124 2124
 				continue;
2125 2125
 			}
2126 2126
 
@@ -2136,10 +2136,10 @@  discard block
 block discarded – undo
2136 2136
 				)
2137 2137
 			);
2138 2138
 
2139
-			if ( ! empty( $address ) ) {
2140
-				$address = maybe_unserialize( $address );
2141
-				$donor->add_address( 'personal', $address );
2142
-				$donor->add_address( 'billing[]', $address );
2139
+			if ( ! empty($address)) {
2140
+				$address = maybe_unserialize($address);
2141
+				$donor->add_address('personal', $address);
2142
+				$donor->add_address('billing[]', $address);
2143 2143
 
2144 2144
 
2145 2145
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 
2150 2150
 	} else {
2151 2151
 		// The Update Ran.
2152
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2152
+		give_set_upgrade_complete('v20_upgrades_user_address');
2153 2153
 	}
2154 2154
 
2155 2155
 }
@@ -2173,15 +2173,15 @@  discard block
 block discarded – undo
2173 2173
 	);
2174 2174
 
2175 2175
 	// Alter customer table
2176
-	foreach ( $tables as $old_table => $new_table ) {
2176
+	foreach ($tables as $old_table => $new_table) {
2177 2177
 		if (
2178
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2179
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2178
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2179
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2180 2180
 		) {
2181
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2181
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2182 2182
 
2183
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2184
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2183
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2184
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2185 2185
 			}
2186 2186
 		}
2187 2187
 	}
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
 	$give_updates->percentage = 100;
2190 2190
 
2191 2191
 	// No more forms found, finish up.
2192
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2192
+	give_set_upgrade_complete('v20_rename_donor_tables');
2193 2193
 
2194 2194
 	// Re initiate donor classes.
2195 2195
 	Give()->donors     = new Give_DB_Donors();
@@ -2207,19 +2207,19 @@  discard block
 block discarded – undo
2207 2207
 function give_v201_create_tables() {
2208 2208
 	global $wpdb;
2209 2209
 
2210
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2210
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2211 2211
 		Give()->payment_meta->create_table();
2212 2212
 	}
2213 2213
 
2214
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2214
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2215 2215
 		Give()->form_meta->create_table();
2216 2216
 	}
2217 2217
 
2218
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2218
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2219 2219
 		Give()->logs->log_db->create_table();
2220 2220
 	}
2221 2221
 
2222
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2222
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2223 2223
 		Give()->logs->logmeta_db->create_table();
2224 2224
 	}
2225 2225
 }
@@ -2244,31 +2244,31 @@  discard block
 block discarded – undo
2244 2244
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2245 2245
 			)
2246 2246
 			AND $wpdb->posts.post_type = 'give_payment'
2247
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2247
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2248 2248
 			ORDER BY $wpdb->posts.post_date ASC 
2249 2249
 			LIMIT 100
2250
-			OFFSET " . $give_updates->get_offset( 100 )
2250
+			OFFSET ".$give_updates->get_offset(100)
2251 2251
 	);
2252 2252
 
2253
-	if ( ! empty( $payments ) ) {
2254
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2253
+	if ( ! empty($payments)) {
2254
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2255 2255
 
2256
-		foreach ( $payments as $payment_id ) {
2257
-			$post = get_post( $payment_id );
2258
-			setup_postdata( $post );
2256
+		foreach ($payments as $payment_id) {
2257
+			$post = get_post($payment_id);
2258
+			setup_postdata($post);
2259 2259
 
2260 2260
 			// Do not add new meta keys if already refactored.
2261
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2261
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2262 2262
 				continue;
2263 2263
 			}
2264 2264
 
2265 2265
 
2266 2266
 			// Split _give_payment_meta meta.
2267 2267
 			// @todo Remove _give_payment_meta after releases 2.0
2268
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2268
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2269 2269
 
2270
-			if ( ! empty( $payment_meta ) ) {
2271
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2270
+			if ( ! empty($payment_meta)) {
2271
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2272 2272
 			}
2273 2273
 
2274 2274
 			$deprecated_meta_keys = array(
@@ -2277,9 +2277,9 @@  discard block
 block discarded – undo
2277 2277
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2278 2278
 			);
2279 2279
 
2280
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2280
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2281 2281
 				// Do not add new meta key if already exist.
2282
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2282
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2283 2283
 					continue;
2284 2284
 				}
2285 2285
 
@@ -2288,25 +2288,25 @@  discard block
 block discarded – undo
2288 2288
 					array(
2289 2289
 						'post_id'    => $post->ID,
2290 2290
 						'meta_key'   => $new_meta_key,
2291
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2291
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2292 2292
 					)
2293 2293
 				);
2294 2294
 			}
2295 2295
 
2296 2296
 			// Bailout
2297
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2297
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2298 2298
 				/* @var Give_Donor $donor */
2299
-				$donor = new Give_Donor( $donor_id );
2299
+				$donor = new Give_Donor($donor_id);
2300 2300
 
2301
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2302
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2303
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2304
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2305
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2306
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2301
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2302
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2303
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2304
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2305
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2306
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2307 2307
 
2308 2308
 				// Save address.
2309
-				$donor->add_address( 'billing[]', $address );
2309
+				$donor->add_address('billing[]', $address);
2310 2310
 			}
2311 2311
 
2312 2312
 		}// End while().
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2318 2318
 
2319 2319
 		// No more forms found, finish up.
2320
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2320
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2321 2321
 	}
2322 2322
 }
2323 2323
 
@@ -2337,21 +2337,21 @@  discard block
 block discarded – undo
2337 2337
 			SELECT ID FROM $wpdb->posts 
2338 2338
 			WHERE 1=1
2339 2339
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2340
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2340
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2341 2341
 			ORDER BY $wpdb->posts.post_date ASC 
2342 2342
 			LIMIT 100
2343
-			OFFSET " . $give_updates->get_offset( 100 )
2343
+			OFFSET ".$give_updates->get_offset(100)
2344 2344
 	);
2345 2345
 
2346
-	if ( ! empty( $payments ) ) {
2347
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2346
+	if ( ! empty($payments)) {
2347
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2348 2348
 			'give_forms',
2349 2349
 			'give_payment',
2350
-		) ), $give_updates->step * 100 );
2350
+		)), $give_updates->step * 100);
2351 2351
 
2352
-		foreach ( $payments as $payment_id ) {
2353
-			$post = get_post( $payment_id );
2354
-			setup_postdata( $post );
2352
+		foreach ($payments as $payment_id) {
2353
+			$post = get_post($payment_id);
2354
+			setup_postdata($post);
2355 2355
 
2356 2356
 			$meta_data = $wpdb->get_results(
2357 2357
 				$wpdb->prepare(
@@ -2361,19 +2361,19 @@  discard block
 block discarded – undo
2361 2361
 				ARRAY_A
2362 2362
 			);
2363 2363
 
2364
-			if ( ! empty( $meta_data ) ) {
2365
-				foreach ( $meta_data as $index => $data ) {
2364
+			if ( ! empty($meta_data)) {
2365
+				foreach ($meta_data as $index => $data) {
2366 2366
 					// Check for duplicate meta values.
2367
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
2367
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2368 2368
 						continue;
2369 2369
 					}
2370 2370
 
2371
-					switch ( $post->post_type ) {
2371
+					switch ($post->post_type) {
2372 2372
 						case 'give_forms':
2373 2373
 							$data['form_id'] = $data['post_id'];
2374
-							unset( $data['post_id'] );
2374
+							unset($data['post_id']);
2375 2375
 
2376
-							Give()->form_meta->insert( $data );
2376
+							Give()->form_meta->insert($data);
2377 2377
 							// @todo: delete form meta from post meta table after releases 2.0.
2378 2378
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2379 2379
 
@@ -2381,9 +2381,9 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
 						case 'give_payment':
2383 2383
 							$data['payment_id'] = $data['post_id'];
2384
-							unset( $data['post_id'] );
2384
+							unset($data['post_id']);
2385 2385
 
2386
-							Give()->payment_meta->insert( $data );
2386
+							Give()->payment_meta->insert($data);
2387 2387
 
2388 2388
 							// @todo: delete donation meta from post meta table after releases 2.0.
2389 2389
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 		wp_reset_postdata();
2399 2399
 	} else {
2400 2400
 		// No more forms found, finish up.
2401
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2401
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2402 2402
 	}
2403 2403
 
2404 2404
 }
@@ -2419,26 +2419,26 @@  discard block
 block discarded – undo
2419 2419
 			SELECT ID FROM $wpdb->posts 
2420 2420
 			WHERE 1=1
2421 2421
 			AND $wpdb->posts.post_type = 'give_log'
2422
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2422
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2423 2423
 			ORDER BY $wpdb->posts.post_date ASC 
2424 2424
 			LIMIT 100
2425
-			OFFSET " . $give_updates->get_offset( 100 )
2425
+			OFFSET ".$give_updates->get_offset(100)
2426 2426
 	);
2427 2427
 
2428
-	if ( ! empty( $logs ) ) {
2429
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2428
+	if ( ! empty($logs)) {
2429
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2430 2430
 
2431
-		foreach ( $logs as $log_id ) {
2432
-			$post = get_post( $log_id );
2433
-			setup_postdata( $post );
2431
+		foreach ($logs as $log_id) {
2432
+			$post = get_post($log_id);
2433
+			setup_postdata($post);
2434 2434
 
2435
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2435
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2436 2436
 				continue;
2437 2437
 			}
2438 2438
 
2439
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2440
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2441
-			$term_name = ! empty( $term ) ? $term->slug : '';
2439
+			$term      = get_the_terms($post->ID, 'give_log_type');
2440
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2441
+			$term_name = ! empty($term) ? $term->slug : '';
2442 2442
 
2443 2443
 			$log_data = array(
2444 2444
 				'ID'           => $post->ID,
@@ -2451,29 +2451,29 @@  discard block
 block discarded – undo
2451 2451
 			);
2452 2452
 			$log_meta = array();
2453 2453
 
2454
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2455
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2456
-					switch ( $meta_key ) {
2454
+			if ($old_log_meta = get_post_meta($post->ID)) {
2455
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2456
+					switch ($meta_key) {
2457 2457
 						case '_give_log_payment_id':
2458
-							$log_data['log_parent']        = current( $meta_value );
2458
+							$log_data['log_parent']        = current($meta_value);
2459 2459
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2460 2460
 							break;
2461 2461
 
2462 2462
 						default:
2463
-							$log_meta[ $meta_key ] = current( $meta_value );
2463
+							$log_meta[$meta_key] = current($meta_value);
2464 2464
 					}
2465 2465
 				}
2466 2466
 			}
2467 2467
 
2468
-			if ( 'api_request' === $term_name ) {
2468
+			if ('api_request' === $term_name) {
2469 2469
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2470 2470
 			}
2471 2471
 
2472
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2472
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2473 2473
 
2474
-			if ( ! empty( $log_meta ) ) {
2475
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2476
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2474
+			if ( ! empty($log_meta)) {
2475
+				foreach ($log_meta as $meta_key => $meta_value) {
2476
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2477 2477
 				}
2478 2478
 			}
2479 2479
 
@@ -2486,7 +2486,7 @@  discard block
 block discarded – undo
2486 2486
 		Give()->logs->delete_cache();
2487 2487
 
2488 2488
 		// No more forms found, finish up.
2489
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2489
+		give_set_upgrade_complete('v201_logs_upgrades');
2490 2490
 	}
2491 2491
 }
2492 2492
 
@@ -2501,51 +2501,51 @@  discard block
 block discarded – undo
2501 2501
 	global $wpdb;
2502 2502
 	give_v201_create_tables();
2503 2503
 
2504
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2505
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2506
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2504
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2505
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2506
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2507 2507
 		$donor_data = array();
2508 2508
 
2509
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2510
-			foreach ( $missing_donors as $donor_id ) {
2509
+		if ($missing_donors = array_diff($customers, $donors)) {
2510
+			foreach ($missing_donors as $donor_id) {
2511 2511
 				$donor_data[] = array(
2512
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2513
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2512
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2513
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2514 2514
 
2515 2515
 				);
2516 2516
 			}
2517 2517
 		}
2518 2518
 
2519
-		if ( ! empty( $donor_data ) ) {
2519
+		if ( ! empty($donor_data)) {
2520 2520
 			$donor_table_name      = Give()->donors->table_name;
2521 2521
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2522 2522
 
2523 2523
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2524 2524
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2525 2525
 
2526
-			foreach ( $donor_data as $donor ) {
2526
+			foreach ($donor_data as $donor) {
2527 2527
 				$donor['info'][0] = (array) $donor['info'][0];
2528 2528
 
2529 2529
 				// Prevent duplicate meta id issue.
2530
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2530
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2531 2531
 					continue;
2532 2532
 				}
2533 2533
 
2534
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2534
+				$donor_id = Give()->donors->add($donor['info'][0]);
2535 2535
 
2536
-				if ( ! empty( $donor['meta'] ) ) {
2537
-					foreach ( $donor['meta'] as $donor_meta ) {
2536
+				if ( ! empty($donor['meta'])) {
2537
+					foreach ($donor['meta'] as $donor_meta) {
2538 2538
 						$donor_meta = (array) $donor_meta;
2539 2539
 
2540 2540
 						// Prevent duplicate meta id issue.
2541
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2542
-							unset( $donor_meta['meta_id'] );
2541
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2542
+							unset($donor_meta['meta_id']);
2543 2543
 						}
2544 2544
 
2545 2545
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2546
-						unset( $donor_meta['customer_id'] );
2546
+						unset($donor_meta['customer_id']);
2547 2547
 
2548
-						Give()->donor_meta->insert( $donor_meta );
2548
+						Give()->donor_meta->insert($donor_meta);
2549 2549
 					}
2550 2550
 				}
2551 2551
 
@@ -2564,35 +2564,35 @@  discard block
 block discarded – undo
2564 2564
 					)
2565 2565
 				);
2566 2566
 
2567
-				$donor = new Give_Donor( $donor_id );
2567
+				$donor = new Give_Donor($donor_id);
2568 2568
 
2569
-				if ( ! empty( $address ) ) {
2570
-					$address = maybe_unserialize( $address );
2571
-					$donor->add_address( 'personal', $address );
2572
-					$donor->add_address( 'billing[]', $address );
2569
+				if ( ! empty($address)) {
2570
+					$address = maybe_unserialize($address);
2571
+					$donor->add_address('personal', $address);
2572
+					$donor->add_address('billing[]', $address);
2573 2573
 				}
2574 2574
 
2575
-				$donor_name       = explode( ' ', $donor->name, 2 );
2576
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2577
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2575
+				$donor_name       = explode(' ', $donor->name, 2);
2576
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2577
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2578 2578
 
2579 2579
 				// If first name meta of donor is not created, then create it.
2580
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2581
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2580
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2581
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2582 2582
 				}
2583 2583
 
2584 2584
 				// If last name meta of donor is not created, then create it.
2585
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2586
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2585
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2586
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2587 2587
 				}
2588 2588
 
2589 2589
 				// If Donor is connected with WP User then update user meta.
2590
-				if ( $donor->user_id ) {
2591
-					if ( isset( $donor_name[0] ) ) {
2592
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2590
+				if ($donor->user_id) {
2591
+					if (isset($donor_name[0])) {
2592
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2593 2593
 					}
2594
-					if ( isset( $donor_name[1] ) ) {
2595
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2594
+					if (isset($donor_name[1])) {
2595
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2596 2596
 					}
2597 2597
 				}
2598 2598
 			}
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 	}
2604 2604
 
2605 2605
 	Give_Updates::get_instance()->percentage = 100;
2606
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2606
+	give_set_upgrade_complete('v201_add_missing_donors');
2607 2607
 }
2608 2608
 
2609 2609
 
@@ -2616,14 +2616,14 @@  discard block
 block discarded – undo
2616 2616
 	global $wpdb;
2617 2617
 
2618 2618
 	// Do not auto load option.
2619
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2619
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2620 2620
 
2621 2621
 	// Remove from cache.
2622 2622
 	$all_options = wp_load_alloptions();
2623 2623
 
2624
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2625
-		unset( $all_options['give_completed_upgrades'] );
2626
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2624
+	if (isset($all_options['give_completed_upgrades'])) {
2625
+		unset($all_options['give_completed_upgrades']);
2626
+		wp_cache_set('alloptions', $all_options, 'options');
2627 2627
 	}
2628 2628
 
2629 2629
 }
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
 	$give_updates = Give_Updates::get_instance();
2639 2639
 
2640 2640
 	// form query.
2641
-	$donation_forms = new WP_Query( array(
2641
+	$donation_forms = new WP_Query(array(
2642 2642
 			'paged'          => $give_updates->step,
2643 2643
 			'status'         => 'any',
2644 2644
 			'order'          => 'ASC',
@@ -2647,16 +2647,16 @@  discard block
 block discarded – undo
2647 2647
 		)
2648 2648
 	);
2649 2649
 
2650
-	if ( $donation_forms->have_posts() ) {
2651
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
2650
+	if ($donation_forms->have_posts()) {
2651
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
2652 2652
 
2653
-		while ( $donation_forms->have_posts() ) {
2653
+		while ($donation_forms->have_posts()) {
2654 2654
 			$donation_forms->the_post();
2655 2655
 			$form_id = get_the_ID();
2656 2656
 
2657
-			$form_closed_status = give_get_meta( $form_id, '_give_form_status', true );
2658
-			if ( empty( $form_closed_status ) ) {
2659
-				give_set_form_closed_status( $form_id );
2657
+			$form_closed_status = give_get_meta($form_id, '_give_form_status', true);
2658
+			if (empty($form_closed_status)) {
2659
+				give_set_form_closed_status($form_id);
2660 2660
 			}
2661 2661
 		}
2662 2662
 
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
 	} else {
2667 2667
 
2668 2668
 		// The Update Ran.
2669
-		give_set_upgrade_complete( 'v210_verify_form_status_upgrades' );
2669
+		give_set_upgrade_complete('v210_verify_form_status_upgrades');
2670 2670
 	}
2671 2671
 
2672 2672
 }
@@ -2686,22 +2686,22 @@  discard block
 block discarded – undo
2686 2686
 		SELECT DISTINCT payment_id
2687 2687
 		FROM {$donation_meta_table}
2688 2688
 		LIMIT 20
2689
-		OFFSET {$give_updates->get_offset( 20 )}
2689
+		OFFSET {$give_updates->get_offset(20)}
2690 2690
 		"
2691 2691
 	);
2692 2692
 
2693
-	if ( ! empty( $donations ) ) {
2694
-		foreach ( $donations as $donation ) {
2695
-			$donation_obj = get_post( $donation );
2693
+	if ( ! empty($donations)) {
2694
+		foreach ($donations as $donation) {
2695
+			$donation_obj = get_post($donation);
2696 2696
 
2697
-			if ( ! $donation_obj instanceof WP_Post ) {
2698
-				Give()->payment_meta->delete_all_meta( $donation );
2697
+			if ( ! $donation_obj instanceof WP_Post) {
2698
+				Give()->payment_meta->delete_all_meta($donation);
2699 2699
 			}
2700 2700
 		}
2701 2701
 	} else {
2702 2702
 
2703 2703
 		// The Update Ran.
2704
-		give_set_upgrade_complete( 'v213_delete_donation_meta' );
2704
+		give_set_upgrade_complete('v213_delete_donation_meta');
2705 2705
 	}
2706 2706
 
2707 2707
 }
2708 2708
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
 		<h2 class="nav-tab-wrapper">
121 121
 			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
 			</a>
125 125
 			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
 			</a>
129 129
 			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
 			</a>
133 133
 			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-			   href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+			   href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
 			</a>
137 137
 		</h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
 		<div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 			<p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: http://docs.givewp.com/docs */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'http://docs.givewp.com/docs' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('http://docs.givewp.com/docs')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			<div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 			<div class="feature-section clearfix introduction">
176 176
 
177 177
 				<div class="video feature-section-item">
178
-					<img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
-						 alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+					<img src="<?php echo GIVE_PLUGIN_URL.'assets/dist/images/give-logo-photo-mashup.png' ?>"
179
+						 alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
 				</div>
181 181
 
182 182
 				<div class="content feature-section-item last-feature">
183 183
 
184
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
 						<span class="dashicons dashicons-external"></span>
190 190
 					</a>
191 191
 
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 
199 199
 				<div class="content feature-section-item">
200 200
 
201
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
 					<h4>Find Out More:</h4>
206 206
 					<ul class="ul-disc">
207 207
 						<li><a href="https://givewp.com/"
208
-							   target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
+							   target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
209 209
 						<li><a href="https://givewp.com/features/"
210
-							   target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
210
+							   target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
211 211
 						<li><a href="https://givewp.com/documentation/"
212
-							   target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
212
+							   target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
213 213
 					</ul>
214 214
 
215 215
 				</div>
216 216
 
217 217
 				<div class="content  feature-section-item last-feature">
218
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>"
219
-						 alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
218
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/dist/images/admin/give-form-mockup.png' ?>"
219
+						 alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
220 220
 				</div>
221 221
 
222 222
 			</div>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return void
236 236
 	 */
237 237
 	public function changelog_screen() {
238
-		list( $display_version ) = explode( '-', GIVE_VERSION );
238
+		list($display_version) = explode('-', GIVE_VERSION);
239 239
 		?>
240 240
 		<div class="wrap about-wrap">
241 241
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 			<p class="about-text"><?php
244 244
 				printf(
245 245
 				/* translators: %s: Give version */
246
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
246
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
247 247
 					$display_version
248 248
 				);
249 249
 				?></p>
250 250
 			<div class="give-badge"><?php
251 251
 				printf(
252 252
 				/* translators: %s: Give version */
253
-					esc_html__( 'Version %s', 'give' ),
253
+					esc_html__('Version %s', 'give'),
254 254
 					$display_version
255 255
 				);
256 256
 				?></div>
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			<?php $this->tabs(); ?>
259 259
 
260 260
 			<div class="changelog">
261
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
261
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
262 262
 
263 263
 				<div class="feature-section">
264 264
 					<?php echo $this->parse_readme(); ?>
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 			</div>
267 267
 
268 268
 			<div class="return-to-dashboard">
269
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
269
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
270 270
 					'post_type' => 'give_forms',
271 271
 					'page'      => 'give-settings'
272
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
272
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
273 273
 			</div>
274 274
 		</div>
275 275
 		<?php
@@ -283,36 +283,36 @@  discard block
 block discarded – undo
283 283
 	 * @return void
284 284
 	 */
285 285
 	public function getting_started_screen() {
286
-		list( $display_version ) = explode( '-', GIVE_VERSION );
286
+		list($display_version) = explode('-', GIVE_VERSION);
287 287
 		?>
288 288
 		<div class="wrap about-wrap get-started">
289 289
 
290 290
 			<?php $this->get_welcome_header() ?>
291 291
 
292
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
292
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
293 293
 
294 294
 			<?php give_get_newsletter(); ?>
295 295
 
296 296
 			<div class="give-badge"><?php
297 297
 				printf(
298 298
 				/* translators: %s: Give version */
299
-					esc_html__( 'Version %s', 'give' ),
299
+					esc_html__('Version %s', 'give'),
300 300
 					$display_version
301 301
 				);
302 302
 				?></div>
303 303
 
304 304
 			<?php $this->tabs(); ?>
305 305
 
306
-			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
306
+			<p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
307 307
 
308 308
 			<div class="feature-section clearfix">
309 309
 
310 310
 				<div class="content feature-section-item">
311
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
311
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
312 312
 
313
-					<p><?php esc_html_e( 'Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
313
+					<p><?php esc_html_e('Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
314 314
 
315
-					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p>
315
+					<p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give'); ?></p>
316 316
 				</div>
317 317
 
318 318
 				<div class="content feature-section-item last-feature">
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 				</div>
330 330
 
331 331
 				<div class="content feature-section-item last-feature">
332
-					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
332
+					<h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
333 333
 
334
-					<p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
334
+					<p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
335 335
 				</div>
336 336
 
337 337
 			</div>
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 			<div class="feature-section clearfix">
341 341
 
342 342
 				<div class="content feature-section-item add-content">
343
-					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
343
+					<h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
344 344
 
345
-					<p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
345
+					<p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
346 346
 
347
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
347
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
348 348
 				</div>
349 349
 
350 350
 				<div class="content feature-section-item last-feature">
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 				</div>
362 362
 
363 363
 				<div class="content feature-section-item last-feature">
364
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
364
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
365 365
 
366
-					<p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
366
+					<p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
367 367
 				</div>
368 368
 
369 369
 
@@ -383,20 +383,20 @@  discard block
 block discarded – undo
383 383
 	 * @return void
384 384
 	 */
385 385
 	public function credits_screen() {
386
-		list( $display_version ) = explode( '-', GIVE_VERSION );
386
+		list($display_version) = explode('-', GIVE_VERSION);
387 387
 		?>
388 388
 		<div class="wrap about-wrap">
389 389
 
390 390
 			<?php $this->get_welcome_header() ?>
391 391
 
392
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
392
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
393 393
 
394 394
 			<?php give_get_newsletter(); ?>
395 395
 
396 396
 			<div class="give-badge"><?php
397 397
 				printf(
398 398
 				/* translators: %s: Give version */
399
-					esc_html__( 'Version %s', 'give' ),
399
+					esc_html__('Version %s', 'give'),
400 400
 					$display_version
401 401
 				);
402 402
 				?></div>
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 			<p class="about-description"><?php
407 407
 				printf(
408 408
 				/* translators: %s: https://github.com/WordImpress/give */
409
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
410
-					esc_url( 'https://github.com/WordImpress/give' )
409
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
410
+					esc_url('https://github.com/WordImpress/give')
411 411
 				);
412 412
 				?></p>
413 413
 
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 	 * @return string $readme HTML formatted readme file
425 425
 	 */
426 426
 	public function parse_readme() {
427
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
427
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
428 428
 
429
-		if ( ! $file ) {
430
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
429
+		if ( ! $file) {
430
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
431 431
 		} else {
432
-			$readme = file_get_contents( $file );
433
-			$readme = nl2br( esc_html( $readme ) );
434
-			$readme = explode( '== Changelog ==', $readme );
435
-			$readme = end( $readme );
436
-
437
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
438
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
439
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
440
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
441
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
432
+			$readme = file_get_contents($file);
433
+			$readme = nl2br(esc_html($readme));
434
+			$readme = explode('== Changelog ==', $readme);
435
+			$readme = end($readme);
436
+
437
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
438
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
439
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
440
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
441
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
442 442
 		}
443 443
 
444 444
 		return $readme;
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
 	public function contributors() {
456 456
 		$contributors = $this->get_contributors();
457 457
 
458
-		if ( empty( $contributors ) ) {
458
+		if (empty($contributors)) {
459 459
 			return '';
460 460
 		}
461 461
 
462 462
 		$contributor_list = '<ul class="wp-people-group">';
463 463
 
464
-		foreach ( $contributors as $contributor ) {
464
+		foreach ($contributors as $contributor) {
465 465
 			$contributor_list .= '<li class="wp-person">';
466 466
 			$contributor_list .= sprintf(
467 467
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
468
-				esc_url( 'https://github.com/' . $contributor->login ),
469
-				esc_url( $contributor->avatar_url ),
470
-				esc_attr( $contributor->login )
468
+				esc_url('https://github.com/'.$contributor->login),
469
+				esc_url($contributor->avatar_url),
470
+				esc_attr($contributor->login)
471 471
 			);
472 472
 			$contributor_list .= sprintf(
473 473
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
474
-				esc_url( 'https://github.com/' . $contributor->login ),
475
-				esc_html( $contributor->login )
474
+				esc_url('https://github.com/'.$contributor->login),
475
+				esc_html($contributor->login)
476 476
 			);
477 477
 			$contributor_list .= '</li>';
478 478
 		}
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 	 * @return array $contributors List of contributors
491 491
 	 */
492 492
 	public function get_contributors() {
493
-		$contributors = Give_Cache::get( 'give_contributors', true );
493
+		$contributors = Give_Cache::get('give_contributors', true);
494 494
 
495
-		if ( false !== $contributors ) {
495
+		if (false !== $contributors) {
496 496
 			return $contributors;
497 497
 		}
498 498
 
499
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
499
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
500 500
 
501
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
501
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
502 502
 			return array();
503 503
 		}
504 504
 
505
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
505
+		$contributors = json_decode(wp_remote_retrieve_body($response));
506 506
 
507
-		if ( ! is_array( $contributors ) ) {
507
+		if ( ! is_array($contributors)) {
508 508
 			return array();
509 509
 		}
510 510
 
511
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
511
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
512 512
 
513 513
 		return $contributors;
514 514
 	}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function get_welcome_header() {
522 522
 		// Badge for welcome page
523
-		$badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png';
523
+		$badge_url = GIVE_PLUGIN_URL.'assets/dist/images/give-badge.png';
524 524
 		?>
525 525
 		<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
526 526
 		<?php $this->social_media_elements(); ?>
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 			<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
614 614
 				printf(
615 615
 				/* translators: %s: Give twitter user @givewp */
616
-					esc_html_e( 'Follow %s', 'give' ),
616
+					esc_html_e('Follow %s', 'give'),
617 617
 					'@givewp'
618 618
 				);
619 619
 				?></a>
@@ -647,27 +647,27 @@  discard block
 block discarded – undo
647 647
 	public function welcome() {
648 648
 
649 649
 		// Bail if no activation redirect
650
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) {
650
+		if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) {
651 651
 			return;
652 652
 		}
653 653
 
654 654
 		// Delete the redirect transient
655
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
655
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
656 656
 
657 657
 		// Bail if activating from network, or bulk
658
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
658
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
659 659
 			return;
660 660
 		}
661 661
 
662
-		$upgrade = get_option( 'give_version_upgraded_from' );
662
+		$upgrade = get_option('give_version_upgraded_from');
663 663
 
664
-		if ( ! $upgrade ) { // First time install
665
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
664
+		if ( ! $upgrade) { // First time install
665
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
666 666
 			exit;
667
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
667
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
668 668
 
669 669
 		} else { // Welcome is NOT disabled in settings
670
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
670
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
671 671
 			exit;
672 672
 		}
673 673
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donor-register-email.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if access directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_New_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_New_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_New_Donor_Register_Email
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
 		 * @since   2.0
32 32
 		 */
33 33
 		public function init() {
34
-			$this->load( array(
34
+			$this->load(array(
35 35
 				'id'                    => 'new-donor-register',
36
-				'label'                 => __( 'New User Registration', 'give' ),
37
-				'description'           => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ),
36
+				'label'                 => __('New User Registration', 'give'),
37
+				'description'           => __('Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give'),
38 38
 				'has_recipient_field'   => true,
39 39
 				'notification_status'   => 'enabled',
40 40
 				'has_preview_header'    => true,
41
-				'email_tag_context'     => array( 'donor', 'general' ),
41
+				'email_tag_context'     => array('donor', 'general'),
42 42
 				'form_metabox_setting'  => false,
43 43
 				'default_email_subject' => sprintf(
44 44
 					/* translators: %s: site name */
45
-					esc_attr__( '[%s] New User Registration', 'give' ),
46
-					get_bloginfo( 'name' )
45
+					esc_attr__('[%s] New User Registration', 'give'),
46
+					get_bloginfo('name')
47 47
 				),
48 48
 				'default_email_message' => $this->get_default_email_message(),
49
-				'default_email_header'  => __( 'New User Registration', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('New User Registration', 'give'),
50
+			));
51 51
 
52 52
 			// Setup action hook.
53 53
 			add_action(
54 54
 				"give_{$this->config['id']}_email_notification",
55
-				array( $this, 'setup_email_notification' ),
55
+				array($this, 'setup_email_notification'),
56 56
 				10,
57 57
 				2
58 58
 			);
59 59
 
60 60
 			add_filter(
61 61
 				'give_email_preview_header',
62
-				array( $this, 'email_preview_header' ),
62
+				array($this, 'email_preview_header'),
63 63
 				10,
64 64
 				2
65 65
 			);
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		 * @return string
75 75
 		 */
76 76
 		function get_default_email_message() {
77
-			$message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n";
78
-			$message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
79
-			$message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n";
77
+			$message = esc_attr__('New user registration on your site {sitename}:', 'give')."\r\n\r\n";
78
+			$message .= esc_attr__('Username: {username}', 'give')."\r\n\r\n";
79
+			$message .= esc_attr__('Email: {user_email}', 'give')."\r\n";
80 80
 
81 81
 			/**
82 82
 			 * Filter the default email message
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * @since 2.0
97 97
 		 */
98 98
 		public function setup_email_data() {
99
-			Give()->emails->__set( 'heading', $this->get_email_header() );
99
+			Give()->emails->__set('heading', $this->get_email_header());
100 100
 		}
101 101
 
102 102
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 		 *
112 112
 		 * @return string
113 113
 		 */
114
-		public function setup_email_notification( $user_id, $user_data ) {
114
+		public function setup_email_notification($user_id, $user_data) {
115 115
 			$this->setup_email_data();
116 116
 
117
-			$this->send_email_notification( array(
117
+			$this->send_email_notification(array(
118 118
 				'user_id' => $user_id,
119
-			) );
119
+			));
120 120
 		}
121 121
 
122 122
 
@@ -130,42 +130,42 @@  discard block
 block discarded – undo
130 130
 		 * @param Give_New_Donor_Register_Email $email
131 131
 		 * @return string
132 132
 		 */
133
-		public function email_preview_header( $email_preview_header, $email ) {
133
+		public function email_preview_header($email_preview_header, $email) {
134 134
 			// Bailout.
135
-			if ( $this->config['id'] !== $email->config['id'] ) {
135
+			if ($this->config['id'] !== $email->config['id']) {
136 136
 				return $email_preview_header;
137 137
 			}
138 138
 
139 139
 			// Payment receipt switcher
140
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
140
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
141 141
 
142 142
 			// Get payments.
143 143
 			$donors  = new Give_API();
144
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
144
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
145 145
 			$options = array();
146 146
 
147 147
 			// Default option.
148
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
148
+			$options[0] = esc_html__('No donor(s) found.', 'give');
149 149
 
150 150
 			// Provide nice human readable options.
151
-			if ( $donors ) {
152
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
153
-				foreach ( $donors as $donor ) {
151
+			if ($donors) {
152
+				$options[0] = esc_html__('- Select a donor -', 'give');
153
+				foreach ($donors as $donor) {
154 154
 					// Exclude customers for which wp user not exist.
155
-					if ( ! $donor['info']['user_id'] ) {
155
+					if ( ! $donor['info']['user_id']) {
156 156
 						continue;
157 157
 					}
158
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
158
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
159 159
 				}
160 160
 			}
161 161
 
162
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
162
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
163 163
 			$query            = $request_url_data['query'];
164 164
 
165 165
 			// Remove user id query param if set from request url.
166
-			$query = remove_query_arg( array( 'user_id' ), $query );
166
+			$query = remove_query_arg(array('user_id'), $query);
167 167
 
168
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
168
+			$request_url = home_url('/?'.str_replace('', '', $query));
169 169
 			?>
170 170
 			<script type="text/javascript">
171 171
 				function change_preview() {
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 			<div class="give_preview_email_user_id_main">
200 200
 
201 201
 				<label for="give_preview_email_user_id" class="give_preview_email_user_id_label">
202
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
202
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
203 203
 				</label>
204 204
 
205 205
 				<?php
206 206
 				// The select field with 100 latest transactions
207
-				echo Give()->html->select( array(
207
+				echo Give()->html->select(array(
208 208
 					'name'             => 'preview_email_user_id',
209 209
 					'selected'         => $user_id,
210 210
 					'id'               => 'give_preview_email_user_id',
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					'select_atts'      => 'onchange="change_preview()"',
215 215
 					'show_option_all'  => false,
216 216
 					'show_option_none' => false,
217
-				) );
217
+				));
218 218
 				?>
219 219
 				<!-- Closing tag-->
220 220
 			</div>
Please login to merge, or discard this patch.
includes/admin/emails/class-offline-donation-instruction-email.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_Offline_Donation_Instruction_Email' ) ) :
19
+if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_Offline_Donation_Instruction_Email
@@ -36,33 +36,33 @@  discard block
 block discarded – undo
36 36
 		 */
37 37
 		public function init() {
38 38
 			// Initialize empty payment.
39
-			$this->payment = new Give_Payment( 0 );
39
+			$this->payment = new Give_Payment(0);
40 40
 
41
-			$this->load( array(
41
+			$this->load(array(
42 42
 				'id'                           => 'offline-donation-instruction',
43
-				'label'                        => __( 'Offline Donation Instructions', 'give' ),
44
-				'description'                  => __( 'Sent to the donor when they submit an offline donation.', 'give' ),
45
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
43
+				'label'                        => __('Offline Donation Instructions', 'give'),
44
+				'description'                  => __('Sent to the donor when they submit an offline donation.', 'give'),
45
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
46 46
 				'form_metabox_setting'         => true,
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tag_values'     => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51
-				'default_email_subject'        => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
51
+				'default_email_subject'        => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
52 52
 				'default_email_message'        => give_get_default_offline_donation_email_content(),
53
-				'default_email_header'         => __( 'Offline Donation Instructions', 'give' ),
53
+				'default_email_header'         => __('Offline Donation Instructions', 'give'),
54 54
 				'notices' => array(
55 55
 					'non-notification-status-editable' => sprintf(
56 56
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
57
-						__( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ),
58
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations') ),
59
-						__( 'Edit Setting', 'give' )
57
+						__('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'),
58
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations')),
59
+						__('Edit Setting', 'give')
60 60
 					)
61 61
 				),
62
-			) );
62
+			));
63 63
 
64
-			add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) );
65
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
64
+			add_action('give_insert_payment', array($this, 'setup_email_notification'));
65
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
66 66
 		}
67 67
 
68 68
 		/**
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 		 *
75 75
 		 * @return string
76 76
 		 */
77
-		public function get_email_message( $form_id = null ) {
77
+		public function get_email_message($form_id = null) {
78 78
 			$message = Give_Email_Notification_Util::get_value(
79 79
 				$this,
80
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
80
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
81 81
 				$form_id,
82 82
 				$this->config['default_email_message']
83 83
 			);
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @return string
108 108
 		 */
109
-		public function get_email_subject( $form_id = null ) {
109
+		public function get_email_subject($form_id = null) {
110 110
 			$subject = wp_strip_all_tags(
111 111
 				Give_Email_Notification_Util::get_value(
112 112
 					$this,
113
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
113
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
114 114
 					$form_id,
115 115
 					$this->config['default_email_subject']
116 116
 				)
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		 * @param int $form_id
140 140
 		 * @return array
141 141
 		 */
142
-		public function get_email_attachments( $form_id = null ) {
142
+		public function get_email_attachments($form_id = null) {
143 143
 			/**
144 144
 			 * Filter the attachments.
145 145
 			 * Note: This filter will deprecate soon.
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 				$this->payment->payment_meta
203 203
 			);
204 204
 
205
-			Give()->emails->__set( 'from_name', $from_name );
206
-			Give()->emails->__set( 'from_email', $from_email );
207
-			Give()->emails->__set( 'heading', $this->get_email_header() );
208
-			Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) );
205
+			Give()->emails->__set('from_name', $from_name);
206
+			Give()->emails->__set('from_email', $from_email);
207
+			Give()->emails->__set('heading', $this->get_email_header());
208
+			Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta));
209 209
 		}
210 210
 
211 211
 		/**
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param int $payment_id
218 218
 		 */
219
-		public function setup_email_notification( $payment_id ) {
220
-			$this->payment = new Give_Payment( $payment_id );
219
+		public function setup_email_notification($payment_id) {
220
+			$this->payment = new Give_Payment($payment_id);
221 221
 
222 222
 			// Exit if not donation was not with offline donation.
223
-			if ( 'offline' !== $this->payment->gateway ) {
223
+			if ('offline' !== $this->payment->gateway) {
224 224
 				return;
225 225
 			}
226 226
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 			$this->setup_email_data();
229 229
 
230 230
 			// Send email.
231
-			$this->send_email_notification( array(
231
+			$this->send_email_notification(array(
232 232
 				'payment_id' => $this->payment->ID,
233
-			) );
233
+			));
234 234
 		}
235 235
 
236 236
 		/**
@@ -242,18 +242,18 @@  discard block
 block discarded – undo
242 242
 		 * @param $update_options
243 243
 		 * @param $option_name
244 244
 		 */
245
-		public function set_notification_status( $update_options, $option_name ) {
245
+		public function set_notification_status($update_options, $option_name) {
246 246
 			// Get updated settings.
247 247
 			$update_options = give_get_settings();
248 248
 
249
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
249
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
250 250
 
251 251
 			if (
252
-				empty( $update_options["{$this->config['id']}_notification"] )
252
+				empty($update_options["{$this->config['id']}_notification"])
253 253
 				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
254 254
 			) {
255 255
 				$update_options["{$this->config['id']}_notification"] = $notification_status;
256
-				update_option( $option_name, $update_options );
256
+				update_option($option_name, $update_options);
257 257
 			}
258 258
 		}
259 259
 
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * @return array
271 271
 		 */
272
-		public function add_metabox_setting_field( $settings, $form_id ) {
273
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
272
+		public function add_metabox_setting_field($settings, $form_id) {
273
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
274 274
 				$settings[] = array(
275 275
 					'id'     => $this->config['id'],
276 276
 					'title'  => $this->config['label'],
277
-					'fields' => $this->get_setting_fields( $form_id ),
277
+					'fields' => $this->get_setting_fields($form_id),
278 278
 				);
279 279
 			}
280 280
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donation-email.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if access directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
20
-if ( ! class_exists( 'Give_New_Donation_Email' ) ) :
20
+if ( ! class_exists('Give_New_Donation_Email')) :
21 21
 
22 22
 	/**
23 23
 	 * Give_New_Donation_Email
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 		 */
38 38
 		public function init() {
39 39
 			// Initialize empty payment.
40
-			$this->payment = new Give_Payment( 0 );
40
+			$this->payment = new Give_Payment(0);
41 41
 
42
-			$this->load( array(
42
+			$this->load(array(
43 43
 				'id'                    => 'new-donation',
44
-				'label'                 => __( 'New Donation', 'give' ),
45
-				'description'           => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ),
44
+				'label'                 => __('New Donation', 'give'),
45
+				'description'           => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'),
46 46
 				'has_recipient_field'   => true,
47 47
 				'notification_status'   => 'enabled',
48 48
 				'form_metabox_setting'  => true,
49
-				'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
49
+				'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'),
50 50
 				'default_email_message' => give_get_default_donation_notification_email(),
51
-				'default_email_header'  => __( 'New Donation!', 'give' ),
52
-			) );
51
+				'default_email_header'  => __('New Donation!', 'give'),
52
+			));
53 53
 
54
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) );
54
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'));
55 55
 		}
56 56
 
57 57
 		/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @return string
66 66
 		 */
67
-		public function get_email_subject( $form_id = null ) {
67
+		public function get_email_subject($form_id = null) {
68 68
 			$subject = wp_strip_all_tags(
69 69
 				Give_Email_Notification_Util::get_value(
70 70
 					$this,
71
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
71
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
72 72
 					$form_id,
73 73
 					$this->config['default_email_subject']
74 74
 				)
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			$subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID );
83
+			$subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID);
84 84
 
85 85
 			/**
86 86
 			 * Filters the donation notification subject.
87 87
 			 *
88 88
 			 * @since 2.0
89 89
 			 */
90
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
90
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
91 91
 
92 92
 			return $subject;
93 93
 		}
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @return string
105 105
 		 */
106
-		public function get_email_message( $form_id = null ) {
106
+		public function get_email_message($form_id = null) {
107 107
 			$message = Give_Email_Notification_Util::get_value(
108 108
 				$this,
109
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
109
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
110 110
 				$form_id,
111 111
 				$this->config['default_email_message']
112 112
 			);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @param int $form_id
150 150
 		 * @return array
151 151
 		 */
152
-		public function get_email_attachments( $form_id = null ) {
152
+		public function get_email_attachments($form_id = null) {
153 153
 			/**
154 154
 			 * Filters the donation notification email attachments.
155 155
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 				$this->payment->payment_meta
213 213
 			);
214 214
 
215
-			Give()->emails->__set( 'from_name', $from_name );
216
-			Give()->emails->__set( 'from_email', $from_email );
217
-			Give()->emails->__set( 'heading', $this->get_email_header() );
215
+			Give()->emails->__set('from_name', $from_name);
216
+			Give()->emails->__set('from_email', $from_email);
217
+			Give()->emails->__set('heading', $this->get_email_header());
218 218
 
219 219
 			/**
220 220
 			 * Filters the donation notification email headers.
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				$this->payment->payment_meta
229 229
 			);
230 230
 
231
-			Give()->emails->__set( 'headers', $headers );
231
+			Give()->emails->__set('headers', $headers);
232 232
 		}
233 233
 
234 234
 		/**
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 		 *
240 240
 		 * @param int $payment_id
241 241
 		 */
242
-		public function setup_email_notification( $payment_id ) {
243
-			$this->payment = new Give_Payment( $payment_id );
242
+		public function setup_email_notification($payment_id) {
243
+			$this->payment = new Give_Payment($payment_id);
244 244
 
245 245
 			// Set email data.
246 246
 			$this->setup_email_data();
247 247
 
248 248
 			// Send email.
249
-			$this->send_email_notification( array(
249
+			$this->send_email_notification(array(
250 250
 				'payment_id' => $payment_id,
251
-			) );
251
+			));
252 252
 		}
253 253
 	}
254 254
 
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notification-table.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 * @access public
37 37
 	 */
38 38
 	public function __construct() {
39
-		parent::__construct( array(
40
-			'singular' => __( 'Give Email Notification', 'give' ),
41
-			'plural'   => __( 'Give Email Notifications', 'give' ),
42
-		) );
39
+		parent::__construct(array(
40
+			'singular' => __('Give Email Notification', 'give'),
41
+			'plural'   => __('Give Email Notifications', 'give'),
42
+		));
43 43
 
44 44
 		$this->email_notifications = Give_Email_Notifications::get_instance();
45 45
 	}
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 2.0
61 61
 		 */
62
-		return apply_filters( 'give_email_notification_setting_columns', array(
63
-			'cb'         => __( 'Email Status', 'give' ),
64
-			'name'       => __( 'Email', 'give' ),
65
-			'email_type' => __( 'Content Type', 'give' ),
66
-			'recipient'  => __( 'Recipient(s)', 'give' ),
67
-			'setting'    => __( 'Edit Email', 'give' ),
68
-		) );
62
+		return apply_filters('give_email_notification_setting_columns', array(
63
+			'cb'         => __('Email Status', 'give'),
64
+			'name'       => __('Email', 'give'),
65
+			'email_type' => __('Content Type', 'give'),
66
+			'recipient'  => __('Recipient(s)', 'give'),
67
+			'setting'    => __('Edit Email', 'give'),
68
+		));
69 69
 	}
70 70
 
71 71
 	/**
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return  string
80 80
 	 */
81
-	public function column_name( $email ) {
82
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
83
-		$actions  = $this->get_row_actions( $email );
81
+	public function column_name($email) {
82
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
83
+		$actions  = $this->get_row_actions($email);
84 84
 
85 85
 		ob_start();
86 86
 		?>
87 87
 		<a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a>
88 88
 
89
-		<?php if ( $desc = $email->config['description'] ) : ?>
90
-			<?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?>
89
+		<?php if ($desc = $email->config['description']) : ?>
90
+			<?php echo Give()->tooltips->render_help(esc_attr($desc)); ?>
91 91
 		<?php endif; ?>
92 92
 
93
-		<?php echo $this->row_actions( $actions ); ?>
93
+		<?php echo $this->row_actions($actions); ?>
94 94
 		<?php
95 95
 		return ob_get_clean();
96 96
 	}
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string
107 107
 	 */
108
-	public function column_recipient( $email ) {
108
+	public function column_recipient($email) {
109 109
 		ob_start();
110 110
 
111
-		if( Give_Email_Notification_Util::has_recipient_field( $email ) ) {
111
+		if (Give_Email_Notification_Util::has_recipient_field($email)) {
112 112
 			$recipients = $email->get_recipient();
113
-			if ( is_array( $recipients ) ) {
114
-				$recipients = implode( '<br>', $recipients );
113
+			if (is_array($recipients)) {
114
+				$recipients = implode('<br>', $recipients);
115 115
 			}
116 116
 
117 117
 			echo $recipients;
118 118
 
119
-		} elseif ( ! empty( $email->config['recipient_group_name'] ) ) {
119
+		} elseif ( ! empty($email->config['recipient_group_name'])) {
120 120
 			echo $email->config['recipient_group_name'];
121 121
 		}
122 122
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return string
135 135
 	 */
136
-	public function column_cb( $email ) {
136
+	public function column_cb($email) {
137 137
 		$notification_status  = $email->get_notification_status();
138
-		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email );
139
-		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active( $email )
138
+		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email);
139
+		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active($email)
140 140
 			? 'dashicons dashicons-yes'
141 141
 			: 'dashicons dashicons-no-alt';
142 142
 		$attributes           = array(
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 			'data-edit'   => $user_can_edit_status,
147 147
 		);
148 148
 
149
-		if ( ! $user_can_edit_status ) {
150
-			$icon_classes         = 'dashicons dashicons-lock';
149
+		if ( ! $user_can_edit_status) {
150
+			$icon_classes = 'dashicons dashicons-lock';
151 151
 
152
-			$attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] );
152
+			$attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']);
153 153
 		}
154 154
 
155 155
 		$html = sprintf(
156 156
 			'<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>',
157
-			give_get_attribute_str( $attributes ),
157
+			give_get_attribute_str($attributes),
158 158
 			$icon_classes
159 159
 		);
160 160
 
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string
174 174
 	 */
175
-	public function column_email_type( Give_Email_Notification $email ) {
175
+	public function column_email_type(Give_Email_Notification $email) {
176 176
 		$email_content_type_label = apply_filters(
177 177
 			"give_email_list_render_{$email->config['id']}_email_content_type",
178
-			Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ),
178
+			Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']),
179 179
 			$email
180 180
 		);
181 181
 
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string
194 194
 	 */
195
-	public function column_setting( Give_Email_Notification $email ) {
196
-		return Give()->tooltips->render_link( array(
197
-			'label'       => __( 'Edit', 'give' ) . " {$email->config['label']}",
195
+	public function column_setting(Give_Email_Notification $email) {
196
+		return Give()->tooltips->render_link(array(
197
+			'label'       => __('Edit', 'give')." {$email->config['label']}",
198 198
 			'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>',
199
-			'link'        => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) ),
199
+			'link'        => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id'])),
200 200
 			'attributes'  => array(
201 201
 				'class' => 'button button-small',
202 202
 			),
203
-		) );
203
+		));
204 204
 	}
205 205
 
206 206
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return array
216 216
 	 */
217
-	private function get_row_actions( $email ) {
218
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
217
+	private function get_row_actions($email) {
218
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
219 219
 
220 220
 		/**
221 221
 		 * Filter the row actions
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$row_actions = apply_filters(
228 228
 			'give_email_notification_row_actions',
229 229
 			array(
230
-				'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>',
230
+				'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>',
231 231
 			),
232 232
 			$email
233 233
 		);
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 		$hidden                = array();
249 249
 		$email_notifications   = array();
250 250
 		$sortable              = $this->get_sortable_columns();
251
-		$this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() );
251
+		$this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name());
252 252
 
253 253
 		// Set email notifications.
254 254
 		/* @var Give_Email_Notification $email_notification */
255
-		foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) {
256
-			if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) {
255
+		foreach ($this->email_notifications->get_email_notifications() as $email_notification) {
256
+			if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) {
257 257
 				$email_notifications[] = $email_notification;
258 258
 			}
259 259
 		}
260 260
 
261
-		$totalItems  = count( $email_notifications );
261
+		$totalItems  = count($email_notifications);
262 262
 		$this->items = $email_notifications;
263
-		$this->set_pagination_args( array(
263
+		$this->set_pagination_args(array(
264 264
 			'total_items' => $totalItems,
265 265
 			'per_page'    => $this->per_page,
266
-		) );
266
+		));
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @access public
274 274
 	 */
275 275
 	public function no_items() {
276
-		_e( 'No give email notification found.', 'give' );
276
+		_e('No give email notification found.', 'give');
277 277
 	}
278 278
 
279 279
 	/**
Please login to merge, or discard this patch.
includes/admin/emails/class-email-setting-field.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return array
23 23
 	 */
24
-	public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) {
25
-		$setting_fields = self::get_default_setting_fields( $email, $form_id );
24
+	public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) {
25
+		$setting_fields = self::get_default_setting_fields($email, $form_id);
26 26
 
27 27
 		// Recipient field.
28
-		$setting_fields[] = self::get_recipient_setting_field( $email, $form_id, Give_Email_Notification_Util::has_recipient_field( $email ) );
28
+		$setting_fields[] = self::get_recipient_setting_field($email, $form_id, Give_Email_Notification_Util::has_recipient_field($email));
29 29
 
30 30
 		// Add extra setting field.
31
-		if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) {
32
-			$setting_fields = array_merge( $setting_fields, $extra_setting_field );
31
+		if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) {
32
+			$setting_fields = array_merge($setting_fields, $extra_setting_field);
33 33
 		}
34 34
 
35 35
 		// Preview field.
36
-		if ( Give_Email_Notification_Util::has_preview( $email ) ) {
37
-			$setting_fields[] = self::get_preview_setting_field( $email, $form_id );
36
+		if (Give_Email_Notification_Util::has_preview($email)) {
37
+			$setting_fields[] = self::get_preview_setting_field($email, $form_id);
38 38
 		}
39 39
 
40
-		$setting_fields = self::add_section_end( $email, $setting_fields );
40
+		$setting_fields = self::add_section_end($email, $setting_fields);
41 41
 
42 42
 		/**
43 43
 		 * Filter the email notification settings.
44 44
 		 *
45 45
 		 * @since 2.0
46 46
 		 */
47
-		return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id );
47
+		return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id);
48 48
 	}
49 49
 
50 50
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool
60 60
 	 */
61
-	public static function has_section_end( $setting ) {
62
-		$last_field      = end( $setting );
61
+	public static function has_section_end($setting) {
62
+		$last_field      = end($setting);
63 63
 		$has_section_end = false;
64 64
 
65
-		if ( 'sectionend' === $last_field['type'] ) {
65
+		if ('sectionend' === $last_field['type']) {
66 66
 			$has_section_end = true;
67 67
 		}
68 68
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public static function get_section_start( Give_Email_Notification $email, $form_id = null ) {
83
+	public static function get_section_start(Give_Email_Notification $email, $form_id = null) {
84 84
 		// Add section end field.
85 85
 		$setting = array(
86 86
 			'id'    => "give_title_email_settings_{$email->config['id']}",
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public static function add_section_end( Give_Email_Notification $email, $setting ) {
106
-		if ( ! self::has_section_end( $setting ) ) {
105
+	public static function add_section_end(Give_Email_Notification $email, $setting) {
106
+		if ( ! self::has_section_end($setting)) {
107 107
 			// Add section end field.
108 108
 			$setting[] = array(
109 109
 				'id'   => "give_title_email_settings_{$email->config['id']}",
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return array
127 127
 	 */
128
-	public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) {
129
-		$settings[] = self::get_section_start( $email, $form_id );
130
-		$settings[] = self::get_notification_status_field( $email, $form_id );
128
+	public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) {
129
+		$settings[] = self::get_section_start($email, $form_id);
130
+		$settings[] = self::get_notification_status_field($email, $form_id);
131 131
 
132
-		if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) {
133
-			if ( $form_id || give_is_add_new_form_page() ) {
132
+		if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) {
133
+			if ($form_id || give_is_add_new_form_page()) {
134 134
 				// Do not allow admin to disable notification on perform basis.
135
-				unset( $settings[1]['options']['disabled'] );
135
+				unset($settings[1]['options']['disabled']);
136 136
 			} else {
137 137
 				// Do not allow admin to edit notification status globally.
138
-				unset( $settings[1] );
138
+				unset($settings[1]);
139 139
 			}
140 140
 		}
141 141
 
142
-		$settings[] = self::get_email_subject_field( $email, $form_id );
143
-		$settings[] = self::get_email_header_field( $email, $form_id );
144
-		$settings[] = self::get_email_message_field( $email, $form_id );
142
+		$settings[] = self::get_email_subject_field($email, $form_id);
143
+		$settings[] = self::get_email_header_field($email, $form_id);
144
+		$settings[] = self::get_email_message_field($email, $form_id);
145 145
 
146
-		if ( Give_Email_Notification_Util::is_content_type_editable( $email ) ) {
147
-			$settings[] = self::get_email_content_type_field( $email, $form_id );
146
+		if (Give_Email_Notification_Util::is_content_type_editable($email)) {
147
+			$settings[] = self::get_email_content_type_field($email, $form_id);
148 148
 		}
149 149
 
150 150
 		return $settings;
@@ -161,31 +161,31 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return array
163 163
 	 */
164
-	public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) {
164
+	public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) {
165 165
 		$option = array(
166
-			'enabled'  => __( 'Enabled', 'give' ),
167
-			'disabled' => __( 'Disabled', 'give' ),
166
+			'enabled'  => __('Enabled', 'give'),
167
+			'disabled' => __('Disabled', 'give'),
168 168
 		);
169 169
 
170 170
 		$default_value = $email->get_notification_status();
171 171
 
172 172
 		// Add global options.
173
-		if ( $form_id || give_is_add_new_form_page() ) {
173
+		if ($form_id || give_is_add_new_form_page()) {
174 174
 			$option = array(
175
-				'global'   => __( 'Global Options' ),
176
-				'enabled'  => __( 'Customize', 'give' ),
177
-				'disabled' => __( 'Disabled', 'give' ),
175
+				'global'   => __('Global Options'),
176
+				'enabled'  => __('Customize', 'give'),
177
+				'disabled' => __('Disabled', 'give'),
178 178
 			);
179 179
 
180 180
 			$default_value = 'global';
181 181
 		}
182 182
 
183
-		$description = isset( $_GET['page'] ) && 'give-settings' === $_GET['page'] ? __( 'Choose whether you want this email enabled or not.', 'give' ) : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) );
183
+		$description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails'));
184 184
 
185 185
 		return array(
186
-			'name'          => esc_html__( 'Notification', 'give' ),
186
+			'name'          => esc_html__('Notification', 'give'),
187 187
 			'desc'          => $description,
188
-			'id'            => self::get_prefix( $email, $form_id ) . 'notification',
188
+			'id'            => self::get_prefix($email, $form_id).'notification',
189 189
 			'type'          => 'radio_inline',
190 190
 			'default'       => $default_value,
191 191
 			'options'       => $option,
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array
206 206
 	 */
207
-	public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) {
207
+	public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) {
208 208
 		return array(
209
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_subject',
210
-			'name'    => esc_html__( 'Email Subject', 'give' ),
211
-			'desc'    => esc_html__( 'Enter the email subject line.', 'give' ),
209
+			'id'      => self::get_prefix($email, $form_id).'email_subject',
210
+			'name'    => esc_html__('Email Subject', 'give'),
211
+			'desc'    => esc_html__('Enter the email subject line.', 'give'),
212 212
 			'default' => $email->config['default_email_subject'],
213 213
 			'type'    => 'text',
214 214
 		);
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return array
226 226
 	 */
227
-	public static function get_email_header_field( Give_Email_Notification $email, $form_id = null ) {
227
+	public static function get_email_header_field(Give_Email_Notification $email, $form_id = null) {
228 228
 		return array(
229
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_header',
230
-			'name'    => esc_html__( 'Email Header', 'give' ),
231
-			'desc'    => esc_html__( 'Enter the email header that appears at the top of the email.', 'give' ),
229
+			'id'      => self::get_prefix($email, $form_id).'email_header',
230
+			'name'    => esc_html__('Email Header', 'give'),
231
+			'desc'    => esc_html__('Enter the email header that appears at the top of the email.', 'give'),
232 232
 			'default' => $email->config['default_email_header'],
233 233
 			'type'    => 'text',
234 234
 		);
@@ -245,28 +245,28 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return array
247 247
 	 */
248
-	public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) {
249
-		$desc = esc_html__( 'Enter the email message.', 'give' );
248
+	public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) {
249
+		$desc = esc_html__('Enter the email message.', 'give');
250 250
 
251
-		if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) {
251
+		if ($email_tag_list = $email->get_allowed_email_tags(true)) {
252 252
 			$desc = sprintf(
253 253
 				'%1$s <br> %2$s: %3$s %4$s',
254
-				__( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ),
255
-				__( 'Available template tags', 'give' ),
254
+				__('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'),
255
+				__('Available template tags', 'give'),
256 256
 				$email_tag_list,
257 257
 				sprintf(
258 258
 					'<br><a href="%1$s" target="_blank">%2$s</a> %3$s',
259
-					esc_url( 'http://docs.givewp.com/meta-email-tags' ),
260
-					__( 'See our documentation', 'give' ),
261
-					__( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' )
259
+					esc_url('http://docs.givewp.com/meta-email-tags'),
260
+					__('See our documentation', 'give'),
261
+					__('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give')
262 262
 				)
263 263
 			);
264 264
 
265 265
 		}
266 266
 
267 267
 		return array(
268
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_message',
269
-			'name'    => esc_html__( 'Email message', 'give' ),
268
+			'id'      => self::get_prefix($email, $form_id).'email_message',
269
+			'name'    => esc_html__('Email message', 'give'),
270 270
 			'desc'    => $desc,
271 271
 			'type'    => 'wysiwyg',
272 272
 			'default' => $email->config['default_email_message'],
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return array
286 286
 	 */
287
-	public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) {
287
+	public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) {
288 288
 		return array(
289
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_content_type',
290
-			'name'    => esc_html__( 'Email Content Type', 'give' ),
291
-			'desc'    => __( 'Choose email type.', 'give' ),
289
+			'id'      => self::get_prefix($email, $form_id).'email_content_type',
290
+			'name'    => esc_html__('Email Content Type', 'give'),
291
+			'desc'    => __('Choose email type.', 'give'),
292 292
 			'type'    => 'select',
293 293
 			'options' => array(
294
-				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ),
295
-				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ),
294
+				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type('text/html'),
295
+				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'),
296 296
 			),
297 297
 			'default' => $email->config['content_type'],
298 298
 		);
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return array
314 314
 	 */
315
-	public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null, $edit_recipient = true ) {
315
+	public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null, $edit_recipient = true) {
316 316
 		$recipient = array(
317
-			'id'               => self::get_prefix( $email, $form_id ) . 'recipient',
318
-			'name'             => esc_html__( 'Email Recipients', 'give' ),
319
-			'desc'             => __( 'Enter the email address(es) that should receive a notification.', 'give' ),
317
+			'id'               => self::get_prefix($email, $form_id).'recipient',
318
+			'name'             => esc_html__('Email Recipients', 'give'),
319
+			'desc'             => __('Enter the email address(es) that should receive a notification.', 'give'),
320 320
 			'type'             => 'email',
321
-			'default'          => get_bloginfo( 'admin_email' ),
321
+			'default'          => get_bloginfo('admin_email'),
322 322
 			'repeat'           => true,
323
-			'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ),
323
+			'repeat_btn_title' => esc_html__('Add Recipient', 'give'),
324 324
 		);
325 325
 
326
-		if ( $form_id || give_is_add_new_form_page() ) {
327
-			$recipient['name']    = __( 'Email', 'give' );
326
+		if ($form_id || give_is_add_new_form_page()) {
327
+			$recipient['name']    = __('Email', 'give');
328 328
 			$recipient['default'] = '';
329 329
 			$recipient['id']      = 'email';
330
-			$recipient['desc']    = __( 'Enter the email address that should receive a notification.', 'give' );
330
+			$recipient['desc']    = __('Enter the email address that should receive a notification.', 'give');
331 331
 
332 332
 			$recipient = array(
333
-				'id'      => self::get_prefix( $email, $form_id ) . 'recipient',
333
+				'id'      => self::get_prefix($email, $form_id).'recipient',
334 334
 				'type'    => 'group',
335 335
 				'options' => array(
336
-					'add_button'    => __( 'Add Email', 'give' ),
337
-					'header_title'  => __( 'Email Recipient', 'give' ),
336
+					'add_button'    => __('Add Email', 'give'),
337
+					'header_title'  => __('Email Recipient', 'give'),
338 338
 					'remove_button' => '<span class="dashicons dashicons-no"></span>',
339 339
 				),
340 340
 				'fields'  => array(
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 
346 346
 		// Disable field if email donor has recipient field.
347 347
 		// @see https://github.com/WordImpress/Give/issues/2657
348
-		if ( ! $edit_recipient ) {
349
-			if ( 'group' == $recipient['type'] ) {
350
-				$recipient         = current( $recipient['fields'] );
348
+		if ( ! $edit_recipient) {
349
+			if ('group' == $recipient['type']) {
350
+				$recipient         = current($recipient['fields']);
351 351
 				$recipient['type'] = 'text';
352 352
 			}
353 353
 
354 354
 			$recipient['attributes']['disabled'] = 'disabled';
355 355
 			$recipient['value']                  = $recipient['default'] = '{donor_email}';
356 356
 			$recipient['repeat']                 = false;
357
-			$recipient['desc']                   = __( 'This email is automatically sent to the donor and the recipient cannot be customized.', 'give' );
357
+			$recipient['desc']                   = __('This email is automatically sent to the donor and the recipient cannot be customized.', 'give');
358 358
 		}
359 359
 
360 360
 		return $recipient;
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return array
373 373
 	 */
374
-	public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) {
374
+	public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) {
375 375
 		return array(
376
-			'name' => __( 'Preview Email', 'give' ),
377
-			'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
-				'give' ),
379
-			'id'   => self::get_prefix( $email, $form_id ) . 'preview_buttons',
376
+			'name' => __('Preview Email', 'give'),
377
+			'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
+				'give'),
379
+			'id'   => self::get_prefix($email, $form_id).'preview_buttons',
380 380
 			'type' => 'email_preview_buttons',
381 381
 		);
382 382
 	}
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string
395 395
 	 */
396
-	public static function get_prefix( Give_Email_Notification $email, $form_id = null ) {
396
+	public static function get_prefix(Give_Email_Notification $email, $form_id = null) {
397 397
 		$meta_key = "{$email->config['id']}_";
398 398
 
399
-		if ( $form_id || give_is_add_new_form_page() ) {
399
+		if ($form_id || give_is_add_new_form_page()) {
400 400
 			$meta_key = "_give_{$email->config['id']}_";
401 401
 		}
402 402
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-offline-donation-email.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) :
19
+if ( ! class_exists('Give_New_Offline_Donation_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_New_Offline_Donation_Email
@@ -36,33 +36,33 @@  discard block
 block discarded – undo
36 36
 		 */
37 37
 		public function init() {
38 38
 			// Initialize empty payment.
39
-			$this->payment = new Give_Payment( 0 );
39
+			$this->payment = new Give_Payment(0);
40 40
 
41
-			$this->load( array(
41
+			$this->load(array(
42 42
 				'id'                           => 'new-offline-donation',
43
-				'label'                        => __( 'New Offline Donation', 'give' ),
44
-				'description'                  => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ),
43
+				'label'                        => __('New Offline Donation', 'give'),
44
+				'description'                  => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'),
45 45
 				'has_recipient_field'          => true,
46
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
46
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tags_values'    => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51 51
 				'default_email_subject'        => $this->get_default_email_subject(),
52 52
 				'default_email_message'        => $this->get_default_email_message(),
53
-				'default_email_header'         => __( 'New Offline Donation!', 'give' ),
53
+				'default_email_header'         => __('New Offline Donation!', 'give'),
54 54
 				'notices' => array(
55 55
 					'non-notification-status-editable' => sprintf(
56 56
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
57
-						__( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ),
58
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations') ),
59
-						__( 'Edit Setting', 'give' )
57
+						__('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'),
58
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations')),
59
+						__('Edit Setting', 'give')
60 60
 					)
61 61
 				),
62
-			) );
62
+			));
63 63
 
64
-			add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) );
65
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
64
+			add_action('give_insert_payment', array($this, 'setup_email_notification'));
65
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
66 66
 		}
67 67
 
68 68
 		/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			 */
82 82
 			$subject = apply_filters(
83 83
 				'give_offline_admin_donation_notification_subject',
84
-				__( 'New Pending Donation', 'give' )
84
+				__('New Pending Donation', 'give')
85 85
 			);
86 86
 
87 87
 			/**
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 		 * @return string
107 107
 		 */
108 108
 		public function get_default_email_message() {
109
-			$message = __( 'Dear Admin,', 'give' ) . "\n\n";
110
-			$message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
111
-			$message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
109
+			$message = __('Dear Admin,', 'give')."\n\n";
110
+			$message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
111
+			$message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
112 112
 
113
-			$message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
114
-			$message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
113
+			$message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
114
+			$message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
115 115
 
116 116
 			$message .= sprintf(
117 117
 				'<a href="%1$s">%2$s</a>',
118
-				admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ),
119
-				__( 'Click Here to View and/or Update Donation Details', 'give' )
120
-			) . "\n\n";
118
+				admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID),
119
+				__('Click Here to View and/or Update Donation Details', 'give')
120
+			)."\n\n";
121 121
 
122 122
 			/**
123 123
 			 * Filter the donation receipt email message
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 		 *
156 156
 		 * @return string
157 157
 		 */
158
-		public function get_email_message( $form_id = null ) {
158
+		public function get_email_message($form_id = null) {
159 159
 			$message = Give_Email_Notification_Util::get_value(
160 160
 				$this,
161
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
161
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
162 162
 				$form_id,
163 163
 				$this->config['default_email_message']
164 164
 			);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		 *
199 199
 		 * @return array
200 200
 		 */
201
-		public function get_email_attachments( $form_id = null ) {
201
+		public function get_email_attachments($form_id = null) {
202 202
 			/**
203 203
 			 * Filter the attachments.
204 204
 			 * Note: This filter will deprecate soon.
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 				)
241 241
 			);
242 242
 
243
-			Give()->emails->__set( 'heading', $this->get_email_header() );
243
+			Give()->emails->__set('heading', $this->get_email_header());
244 244
 		}
245 245
 
246 246
 		/**
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 		 *
252 252
 		 * @param int $payment_id
253 253
 		 */
254
-		public function setup_email_notification( $payment_id ) {
255
-			$this->payment = new Give_Payment( $payment_id );
254
+		public function setup_email_notification($payment_id) {
255
+			$this->payment = new Give_Payment($payment_id);
256 256
 
257 257
 			// Exit if not donation was not with offline donation.
258
-			if ( 'offline' !== $this->payment->gateway ) {
258
+			if ('offline' !== $this->payment->gateway) {
259 259
 				return;
260 260
 			}
261 261
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 			$this->setup_email_data();
264 264
 
265 265
 			// Send email.
266
-			$this->send_email_notification( array(
266
+			$this->send_email_notification(array(
267 267
 				'payment_id' => $this->payment->ID,
268
-			) );
268
+			));
269 269
 		}
270 270
 
271 271
 		/**
@@ -277,18 +277,18 @@  discard block
 block discarded – undo
277 277
 		 * @param $update_options
278 278
 		 * @param $option_name
279 279
 		 */
280
-		public function set_notification_status( $update_options, $option_name ) {
280
+		public function set_notification_status($update_options, $option_name) {
281 281
 			// Get updated settings.
282 282
 			$update_options = give_get_settings();
283 283
 
284
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
284
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
285 285
 
286 286
 			if (
287
-				empty( $update_options[ "{$this->config['id']}_notification" ] )
288
-				|| $notification_status !== $update_options[ "{$this->config['id']}_notification" ]
287
+				empty($update_options["{$this->config['id']}_notification"])
288
+				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
289 289
 			) {
290
-				$update_options[ "{$this->config['id']}_notification" ] = $notification_status;
291
-				update_option( $option_name, $update_options );
290
+				$update_options["{$this->config['id']}_notification"] = $notification_status;
291
+				update_option($option_name, $update_options);
292 292
 			}
293 293
 		}
294 294
 
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @return array
305 305
 		 */
306
-		public function add_metabox_setting_field( $settings, $form_id ) {
306
+		public function add_metabox_setting_field($settings, $form_id) {
307 307
 
308
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
308
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
309 309
 				$settings[] = array(
310 310
 					'id'     => $this->config['id'],
311 311
 					'title'  => $this->config['label'],
312
-					'fields' => $this->get_setting_fields( $form_id ),
312
+					'fields' => $this->get_setting_fields($form_id),
313 313
 				);
314 314
 			}
315 315
 
Please login to merge, or discard this patch.