Test Failed
Push — master ( 66e844...73c6be )
by Devin
04:32
created
includes/admin/settings/class-settings-display.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 								'disabled' => __( 'Disabled', 'give' ),
88 88
 							)
89 89
 						),
90
-                        array(
91
-                            'name'  => __( 'Display Settings Docs Link', 'give' ),
92
-                            'id'    => 'display_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
-                            'title' => __( 'Display Options Settings', 'give' ),
95
-                            'type'  => 'give_docs_link',
96
-                        ),
90
+						array(
91
+							'name'  => __( 'Display Settings Docs Link', 'give' ),
92
+							'id'    => 'display_settings_docs_link',
93
+							'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
+							'title' => __( 'Display Options Settings', 'give' ),
95
+							'type'  => 'give_docs_link',
96
+						),
97 97
 						array(
98 98
 							'id'   => 'give_title_display_settings_1',
99 99
 							'type' => 'sectionend'
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 								'disabled' => __( 'Disabled', 'give' ),
171 171
 							)
172 172
 						),
173
-                        array(
174
-                            'name'  => __( 'Post Types Docs Link', 'give' ),
175
-                            'id'    => 'post_types_settings_docs_link',
176
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
-                            'title' => __( 'Post Types Settings', 'give' ),
178
-                            'type'  => 'give_docs_link',
179
-                        ),
173
+						array(
174
+							'name'  => __( 'Post Types Docs Link', 'give' ),
175
+							'id'    => 'post_types_settings_docs_link',
176
+							'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
+							'title' => __( 'Post Types Settings', 'give' ),
178
+							'type'  => 'give_docs_link',
179
+						),
180 180
 						array(
181 181
 							'id'   => 'give_title_display_settings_2',
182 182
 							'type' => 'sectionend'
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 								'disabled' => __( 'Disabled', 'give' ),
213 213
 							)
214 214
 						),
215
-                        array(
216
-                            'name'  => __( 'Taxonomies Docs Link', 'give' ),
217
-                            'id'    => 'taxonomies_settings_docs_link',
218
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
-                            'title' => __( 'Taxonomies Settings', 'give' ),
220
-                            'type'  => 'give_docs_link',
221
-                        ),
215
+						array(
216
+							'name'  => __( 'Taxonomies Docs Link', 'give' ),
217
+							'id'    => 'taxonomies_settings_docs_link',
218
+							'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
+							'title' => __( 'Taxonomies Settings', 'give' ),
220
+							'type'  => 'give_docs_link',
221
+						),
222 222
 						array(
223 223
 							'id'   => 'give_title_display_settings_3',
224 224
 							'type' => 'sectionend'
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 							'id'   => 'agreement_text',
259 259
 							'type' => 'wysiwyg'
260 260
 						),
261
-                        array(
262
-                            'name'  => __( 'Terms and Conditions Docs Link', 'give' ),
263
-                            'id'    => 'terms_settings_docs_link',
264
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
-                            'title' => __( 'Terms and Conditions Settings', 'give' ),
266
-                            'type'  => 'give_docs_link',
267
-                        ),
261
+						array(
262
+							'name'  => __( 'Terms and Conditions Docs Link', 'give' ),
263
+							'id'    => 'terms_settings_docs_link',
264
+							'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
+							'title' => __( 'Terms and Conditions Settings', 'give' ),
266
+							'type'  => 'give_docs_link',
267
+						),
268 268
 						array(
269 269
 							'id'   => 'give_title_display_settings_4',
270 270
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 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_Display' ) ) :
16
+if ( ! class_exists('Give_Settings_Display')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Display.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'display';
30
-			$this->label = __( 'Display Options', 'give' );
30
+			$this->label = __('Display Options', 'give');
31 31
 
32 32
 			$this->default_tab = 'display-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'display-settings' :
49 49
 					$settings = array(
50 50
 						// Section 1: Display
@@ -53,45 +53,45 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => __( 'Default Give Styles', 'give' ),
57
-							'desc'    => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ),
56
+							'name'    => __('Default Give Styles', 'give'),
57
+							'desc'    => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'),
58 58
 							'id'      => 'css',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'enabled',
61 61
 							'options' => array(
62
-								'enabled' => __( 'Enabled', 'give' ),
63
-								'disabled' => __( 'Disabled', 'give' ),
62
+								'enabled' => __('Enabled', 'give'),
63
+								'disabled' => __('Disabled', 'give'),
64 64
 							)
65 65
 						),
66 66
 						array(
67
-							'name' => __( 'Floating Labels', 'give' ),
67
+							'name' => __('Floating Labels', 'give'),
68 68
 							/* translators: %s: http://docs.givewp.com/form-floating-labels */
69
-							'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
69
+							'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')),
70 70
 							'id'   => 'floatlabels',
71 71
 							'type'    => 'radio_inline',
72 72
 							'default' => 'disabled',
73 73
 							'options' => array(
74
-								'enabled' => __( 'Enabled', 'give' ),
75
-								'disabled' => __( 'Disabled', 'give' ),
74
+								'enabled' => __('Enabled', 'give'),
75
+								'disabled' => __('Disabled', 'give'),
76 76
 							)
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Welcome Screen', 'give' ),
79
+							'name'    => __('Welcome Screen', 'give'),
80 80
 							/* translators: %s: about page URL */
81
-							'desc'    => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
81
+							'desc'    => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
82 82
 							'id'      => 'welcome',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'enabled',
85 85
 							'options' => array(
86
-								'enabled' => __( 'Enabled', 'give' ),
87
-								'disabled' => __( 'Disabled', 'give' ),
86
+								'enabled' => __('Enabled', 'give'),
87
+								'disabled' => __('Disabled', 'give'),
88 88
 							)
89 89
 						),
90 90
                         array(
91
-                            'name'  => __( 'Display Settings Docs Link', 'give' ),
91
+                            'name'  => __('Display Settings Docs Link', 'give'),
92 92
                             'id'    => 'display_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
-                            'title' => __( 'Display Options Settings', 'give' ),
93
+                            'url'   => esc_url('http://docs.givewp.com/form-display-options'),
94
+                            'title' => __('Display Options Settings', 'give'),
95 95
                             'type'  => 'give_docs_link',
96 96
                         ),
97 97
 						array(
@@ -108,73 +108,73 @@  discard block
 block discarded – undo
108 108
 							'type' => 'title'
109 109
 						),
110 110
 						array(
111
-							'name'    => __( 'Form Single Views', 'give' ),
112
-							'desc'    => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
111
+							'name'    => __('Form Single Views', 'give'),
112
+							'desc'    => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
113 113
 							'id'      => 'forms_singular',
114 114
 							'type'    => 'radio_inline',
115 115
 							'default' => 'enabled',
116 116
 							'options' => array(
117
-								'enabled' => __( 'Enabled', 'give' ),
118
-								'disabled' => __( 'Disabled', 'give' ),
117
+								'enabled' => __('Enabled', 'give'),
118
+								'disabled' => __('Disabled', 'give'),
119 119
 							)
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Form Archives', 'give' ),
123
-							'desc'    => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ),
122
+							'name'    => __('Form Archives', 'give'),
123
+							'desc'    => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))),
124 124
 							'id'      => 'forms_archives',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'enabled',
127 127
 							'options' => array(
128
-								'enabled' => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' ),
128
+								'enabled' => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give'),
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Form Excerpts', 'give' ),
134
-							'desc'    => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
133
+							'name'    => __('Form Excerpts', 'give'),
134
+							'desc'    => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
135 135
 							'id'      => 'forms_excerpt',
136 136
 							'type'    => 'radio_inline',
137 137
 							'default' => 'enabled',
138 138
 							'options' => array(
139
-								'enabled' => __( 'Enabled', 'give' ),
140
-								'disabled' => __( 'Disabled', 'give' ),
139
+								'enabled' => __('Enabled', 'give'),
140
+								'disabled' => __('Disabled', 'give'),
141 141
 							)
142 142
 						),
143 143
 						array(
144
-							'name'    => __( 'Form Featured Image', 'give' ),
145
-							'desc'    => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
144
+							'name'    => __('Form Featured Image', 'give'),
145
+							'desc'    => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
146 146
 							'id'      => 'form_featured_img',
147 147
 							'type'    => 'radio_inline',
148 148
 							'default' => 'enabled',
149 149
 							'options' => array(
150
-								'enabled' => __( 'Enabled', 'give' ),
151
-								'disabled' => __( 'Disabled', 'give' ),
150
+								'enabled' => __('Enabled', 'give'),
151
+								'disabled' => __('Disabled', 'give'),
152 152
 							)
153 153
 						),
154 154
 						array(
155
-							'name'    => __( 'Featured Image Size', 'give' ),
156
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
155
+							'name'    => __('Featured Image Size', 'give'),
156
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
157 157
 							'id'      => 'featured_image_size',
158 158
 							'type'    => 'select',
159 159
 							'default' => 'large',
160 160
 							'options' => give_get_featured_image_sizes()
161 161
 						),
162 162
 						array(
163
-							'name'    => __( 'Single Form Sidebar', 'give' ),
164
-							'desc'    => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
163
+							'name'    => __('Single Form Sidebar', 'give'),
164
+							'desc'    => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
165 165
 							'id'      => 'form_sidebar',
166 166
 							'type'    => 'radio_inline',
167 167
 							'default' => 'enabled',
168 168
 							'options' => array(
169
-								'enabled' => __( 'Enabled', 'give' ),
170
-								'disabled' => __( 'Disabled', 'give' ),
169
+								'enabled' => __('Enabled', 'give'),
170
+								'disabled' => __('Disabled', 'give'),
171 171
 							)
172 172
 						),
173 173
                         array(
174
-                            'name'  => __( 'Post Types Docs Link', 'give' ),
174
+                            'name'  => __('Post Types Docs Link', 'give'),
175 175
                             'id'    => 'post_types_settings_docs_link',
176
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
-                            'title' => __( 'Post Types Settings', 'give' ),
176
+                            'url'   => esc_url('http://docs.givewp.com/settings-post-types'),
177
+                            'title' => __('Post Types Settings', 'give'),
178 178
                             'type'  => 'give_docs_link',
179 179
                         ),
180 180
 						array(
@@ -191,32 +191,32 @@  discard block
 block discarded – undo
191 191
 							'type' => 'title'
192 192
 						),
193 193
 						array(
194
-							'name' => __( 'Form Categories', 'give' ),
195
-							'desc' => __( 'Enable Categories for all Give forms.', 'give' ),
194
+							'name' => __('Form Categories', 'give'),
195
+							'desc' => __('Enable Categories for all Give forms.', 'give'),
196 196
 							'id'   => 'categories',
197 197
 							'type'    => 'radio_inline',
198 198
 							'default' => 'disabled',
199 199
 							'options' => array(
200
-								'enabled' => __( 'Enabled', 'give' ),
201
-								'disabled' => __( 'Disabled', 'give' ),
200
+								'enabled' => __('Enabled', 'give'),
201
+								'disabled' => __('Disabled', 'give'),
202 202
 							)
203 203
 						),
204 204
 						array(
205
-							'name' => __( 'Form Tags', 'give' ),
206
-							'desc' => __( 'Enable Tags for all Give forms.', 'give' ),
205
+							'name' => __('Form Tags', 'give'),
206
+							'desc' => __('Enable Tags for all Give forms.', 'give'),
207 207
 							'id'   => 'tags',
208 208
 							'type'    => 'radio_inline',
209 209
 							'default' => 'disabled',
210 210
 							'options' => array(
211
-								'enabled' => __( 'Enabled', 'give' ),
212
-								'disabled' => __( 'Disabled', 'give' ),
211
+								'enabled' => __('Enabled', 'give'),
212
+								'disabled' => __('Disabled', 'give'),
213 213
 							)
214 214
 						),
215 215
                         array(
216
-                            'name'  => __( 'Taxonomies Docs Link', 'give' ),
216
+                            'name'  => __('Taxonomies Docs Link', 'give'),
217 217
                             'id'    => 'taxonomies_settings_docs_link',
218
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
-                            'title' => __( 'Taxonomies Settings', 'give' ),
218
+                            'url'   => esc_url('http://docs.givewp.com/settings-taxonomies'),
219
+                            'title' => __('Taxonomies Settings', 'give'),
220 220
                             'type'  => 'give_docs_link',
221 221
                         ),
222 222
 						array(
@@ -233,36 +233,36 @@  discard block
 block discarded – undo
233 233
 							'type' => 'title'
234 234
 						),
235 235
 						array(
236
-							'name'    => __( 'Terms and Conditions', 'give' ),
237
-							'desc'    => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ),
236
+							'name'    => __('Terms and Conditions', 'give'),
237
+							'desc'    => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'),
238 238
 							'id'      => 'terms',
239 239
 							'type'    => 'radio_inline',
240 240
 							'default' => 'disabled',
241 241
 							'options' => array(
242
-								'enabled' => __( 'Enabled', 'give' ),
243
-								'disabled' => __( 'Disabled', 'give' ),
242
+								'enabled' => __('Enabled', 'give'),
243
+								'disabled' => __('Disabled', 'give'),
244 244
 							)
245 245
 						),
246 246
 						array(
247
-							'name' => __( 'Agree to Terms Label', 'give' ),
248
-							'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ),
247
+							'name' => __('Agree to Terms Label', 'give'),
248
+							'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'),
249 249
 							'id'   => 'agree_to_terms_label',
250 250
 							'attributes'  => array(
251
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
251
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
252 252
 							),
253 253
 							'type' => 'text'
254 254
 						),
255 255
 						array(
256
-							'name' => __( 'Agreement Text', 'give' ),
257
-							'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ),
256
+							'name' => __('Agreement Text', 'give'),
257
+							'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'),
258 258
 							'id'   => 'agreement_text',
259 259
 							'type' => 'wysiwyg'
260 260
 						),
261 261
                         array(
262
-                            'name'  => __( 'Terms and Conditions Docs Link', 'give' ),
262
+                            'name'  => __('Terms and Conditions Docs Link', 'give'),
263 263
                             'id'    => 'terms_settings_docs_link',
264
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
-                            'title' => __( 'Terms and Conditions Settings', 'give' ),
264
+                            'url'   => esc_url('http://docs.givewp.com/settings-terms'),
265
+                            'title' => __('Terms and Conditions Settings', 'give'),
266 266
                             'type'  => 'give_docs_link',
267 267
                         ),
268 268
 						array(
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 * Filter the display options settings.
278 278
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
279 279
 			 */
280
-			$settings = apply_filters( 'give_settings_display', $settings );
280
+			$settings = apply_filters('give_settings_display', $settings);
281 281
 
282 282
 			/**
283 283
 			 * Filter the settings.
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			 * @since  1.8
286 286
 			 * @param  array $settings
287 287
 			 */
288
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
288
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
289 289
 
290 290
 			// Output.
291 291
 			return $settings;
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 		 */
300 300
 		public function get_sections() {
301 301
 			$sections = array(
302
-				'display-settings'    => __( 'Display', 'give' ),
303
-				'post-types'          => __( 'Post Types', 'give' ),
304
-				'taxonomies'          => __( 'Taxonomies', 'give' ),
305
-				'term-and-conditions' => __( 'Terms and Conditions', 'give' )
302
+				'display-settings'    => __('Display', 'give'),
303
+				'post-types'          => __('Post Types', 'give'),
304
+				'taxonomies'          => __('Taxonomies', 'give'),
305
+				'term-and-conditions' => __('Terms and Conditions', 'give')
306 306
 			);
307 307
 
308
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
308
+			return apply_filters('give_get_sections_'.$this->id, $sections);
309 309
 		}
310 310
 	}
311 311
 
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 * @return void
49 49
 	 */
50 50
 	public function headers() {
51
-		ignore_user_abort( true );
51
+		ignore_user_abort(true);
52 52
 
53
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
54
-			set_time_limit( 0 );
53
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
54
+			set_time_limit(0);
55 55
 		}
56 56
 
57 57
 		nocache_headers();
58
-		header( 'Content-Type: text/csv; charset=utf-8' );
59
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
60
-		header( "Expires: 0" );
58
+		header('Content-Type: text/csv; charset=utf-8');
59
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
60
+		header("Expires: 0");
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function csv_cols() {
71 71
 		$cols = array(
72
-			'id'   => __( 'ID', 'give' ),
73
-			'date' => __( 'Date', 'give' )
72
+			'id'   => __('ID', 'give'),
73
+			'date' => __('Date', 'give')
74 74
 		);
75 75
 
76 76
 		return $cols;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function get_csv_cols() {
87 87
 		$cols = $this->csv_cols();
88 88
 
89
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
89
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	public function csv_cols_out() {
101 101
 		$cols = $this->get_csv_cols();
102 102
 		$i    = 1;
103
-		foreach ( $cols as $col_id => $column ) {
104
-			echo '"' . addslashes( $column ) . '"';
105
-			echo $i == count( $cols ) ? '' : ',';
106
-			$i ++;
103
+		foreach ($cols as $col_id => $column) {
104
+			echo '"'.addslashes($column).'"';
105
+			echo $i == count($cols) ? '' : ',';
106
+			$i++;
107 107
 		}
108 108
 		echo "\r\n";
109 109
 	}
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 		$data = array(
121 121
 			0 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			),
125 125
 			1 => array(
126 126
 				'id'   => '',
127
-				'data' => date( 'F j, Y' )
127
+				'data' => date('F j, Y')
128 128
 			)
129 129
 		);
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		$cols = $this->get_csv_cols();
148 148
 
149 149
 		// Output each row
150
-		foreach ( $data as $row ) {
150
+		foreach ($data as $row) {
151 151
 			$i = 1;
152
-			foreach ( $row as $col_id => $column ) {
152
+			foreach ($row as $col_id => $column) {
153 153
 				// Make sure the column is valid
154
-				if ( array_key_exists( $col_id, $cols ) ) {
155
-					echo '"' . addslashes( $column ) . '"';
156
-					echo $i == count( $cols ) ? '' : ',';
157
-					$i ++;
154
+				if (array_key_exists($col_id, $cols)) {
155
+					echo '"'.addslashes($column).'"';
156
+					echo $i == count($cols) ? '' : ',';
157
+					$i++;
158 158
 				}
159 159
 			}
160 160
 			echo "\r\n";
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function export() {
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-export.php 1 patch
Spacing   +16 added lines, -16 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_Export' ) ) :
16
+if ( ! class_exists('Give_Settings_Export')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Export.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'export';
46
-			$this->label = __( 'Export', 'give' );
46
+			$this->label = __('Export', 'give');
47 47
 
48
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 );
48
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_tools_export', array($this, 'render_export_field'), 10, 2);
51 51
 
52 52
 			// Do not use main donor for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-tools_open_form', '__return_empty_string' );
55
-				add_action( 'give-tools_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-tools_open_form', '__return_empty_string');
55
+				add_action('give-tools_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_tools_export',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'export',
98
-						'name' => __( 'Export', 'give' ),
98
+						'name' => __('Export', 'give'),
99 99
 						'type' => 'tools_export',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_export_field( $field, $option_value ) {
135
-			include_once( 'views/html-admin-page-exports.php' );
134
+		public function render_export_field($field, $option_value) {
135
+			include_once('views/html-admin-page-exports.php');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -254,8 +254,8 @@
 block discarded – undo
254 254
 		$args = array(
255 255
 		  'id' => 'give-api-user-search',
256 256
 		  'name' => 'user_id',
257
-        );
258
-        echo Give()->html->ajax_user_search($args); ?>
257
+		);
258
+		echo Give()->html->ajax_user_search($args); ?>
259 259
 		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
260 260
 		<?php
261 261
 		$give_api_is_bottom = true;
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
59
-			'ajax'     => false,// Does this table support ajax?
60
-		) );
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59
+			'ajax'     => false, // Does this table support ajax?
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place.
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250
-		<?php wp_nonce_field( 'give-api-nonce' );
250
+		<?php wp_nonce_field('give-api-nonce');
251 251
 		/**
252 252
 		 * API Key user search.
253 253
 		 */
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		  'name' => 'user_id',
257 257
         );
258 258
         echo Give()->html->ajax_user_search($args); ?>
259
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
259
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
260 260
 		<?php
261 261
 		$give_api_is_bottom = true;
262 262
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * @return int Current page number
270 270
 	 */
271 271
 	public function get_paged() {
272
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
272
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
273 273
 	}
274 274
 
275 275
 	/**
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 	 * @return array
281 281
 	 */
282 282
 	public function query() {
283
-		$users = get_users( array(
283
+		$users = get_users(array(
284 284
 			'meta_value' => 'give_user_secret_key',
285 285
 			'number'     => $this->per_page,
286
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
287
-		) );
288
-		$keys  = array();
289
-
290
-		foreach ( $users as $user ) {
291
-			$keys[ $user->ID ]['id']    = $user->ID;
292
-			$keys[ $user->ID ]['email'] = $user->user_email;
293
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
294
-
295
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
296
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
297
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
286
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
287
+		));
288
+		$keys = array();
289
+
290
+		foreach ($users as $user) {
291
+			$keys[$user->ID]['id']    = $user->ID;
292
+			$keys[$user->ID]['email'] = $user->user_email;
293
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
294
+
295
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
296
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
297
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
298 298
 		}
299 299
 
300 300
 		return $keys;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	public function total_items() {
312 312
 		global $wpdb;
313 313
 
314
-		if ( ! ( $total_items = Give_Cache::get( 'give_total_api_keys', true ) ) ) {
314
+		if ( ! ($total_items = Give_Cache::get('give_total_api_keys', true))) {
315 315
 			$total_items = $wpdb->get_var(
316 316
 				$wpdb->prepare(
317 317
 					"SELECT count(user_id)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				)
321 321
 			);
322 322
 
323
-			Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true );
323
+			Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true);
324 324
 		}
325 325
 
326 326
 		return $total_items;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		$hidden   = array(); // No hidden columns
340 340
 		$sortable = array(); // Not sortable... for now
341 341
 
342
-		$this->_column_headers = array( $columns, $hidden, $sortable );
342
+		$this->_column_headers = array($columns, $hidden, $sortable);
343 343
 
344 344
 		$data = $this->query();
345 345
 
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
 
348 348
 		$this->items = $data;
349 349
 
350
-		$this->set_pagination_args( array(
350
+		$this->set_pagination_args(array(
351 351
 				'total_items' => $total_items,
352 352
 				'per_page'    => $this->per_page,
353
-				'total_pages' => ceil( $total_items / $this->per_page ),
353
+				'total_pages' => ceil($total_items / $this->per_page),
354 354
 			)
355 355
 		);
356 356
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 		)
48 48
 	);
49 49
 
50
-    $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
51
-    $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
50
+	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
51
+	$tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
52 52
 
53 53
 	$pdf = new give_pdf();
54 54
 	$pdf->AddPage( 'L', 'A4' );
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
81 81
 	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
82 82
 
83
-    // Display Categories Heading only, if user has opted for it.
84
-    if ( $categories_enabled ) {
83
+	// Display Categories Heading only, if user has opted for it.
84
+	if ( $categories_enabled ) {
85 85
 	   $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
86
-    }
86
+	}
87 87
 
88
-    // Display Tags Heading only, if user has opted for it.
89
-    if ( $tags_enabled ) {
88
+	// Display Tags Heading only, if user has opted for it.
89
+	if ( $tags_enabled ) {
90 90
 	   $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
91
-    }
91
+	}
92 92
 
93 93
 	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
94 94
 	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 				$price = give_currency_filter( give_get_form_price( $form->ID ), '', true );
126 126
 			}
127 127
 
128
-            // Display Categories Data only, if user has opted for it.
129
-            if ( $categories_enabled ) {
130
-                $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
131
-                $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
132
-            }
128
+			// Display Categories Data only, if user has opted for it.
129
+			if ( $categories_enabled ) {
130
+				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
131
+				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
132
+			}
133 133
 
134
-            // Display Tags Data only, if user has opted for it.
135
-            if ( $tags_enabled ) {
136
-                $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
137
-                $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
138
-            }
134
+			// Display Tags Data only, if user has opted for it.
135
+			if ( $tags_enabled ) {
136
+				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
137
+				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
138
+			}
139 139
 
140 140
 			$sales    = give_get_form_sales_stats( $form->ID );
141 141
 			$link     = get_permalink( $form->ID );
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
148 148
 			}
149 149
 
150
-            // This will help filter data before appending it to PDF Receipt.
151
-            $prepare_pdf_data = array();
152
-            $prepare_pdf_data[] = $title;
153
-            $prepare_pdf_data[] = $price;
150
+			// This will help filter data before appending it to PDF Receipt.
151
+			$prepare_pdf_data = array();
152
+			$prepare_pdf_data[] = $title;
153
+			$prepare_pdf_data[] = $price;
154 154
 
155
-            // Append Categories Data only, if user has opted for it.
156
-            if ( $categories_enabled ) {
157
-                $prepare_pdf_data[] = $categories;
158
-            }
155
+			// Append Categories Data only, if user has opted for it.
156
+			if ( $categories_enabled ) {
157
+				$prepare_pdf_data[] = $categories;
158
+			}
159 159
 
160
-            // Append Tags Data only, if user has opted for it.
161
-            if ( $tags_enabled ) {
162
-                $prepare_pdf_data[] = $tags;
163
-            }
160
+			// Append Tags Data only, if user has opted for it.
161
+			if ( $tags_enabled ) {
162
+				$prepare_pdf_data[] = $tags;
163
+			}
164 164
 
165
-            $prepare_pdf_data[] = $sales;
166
-            $prepare_pdf_data[] = $earnings;
165
+			$prepare_pdf_data[] = $sales;
166
+			$prepare_pdf_data[] = $earnings;
167 167
 
168 168
 			$pdf->Row( $prepare_pdf_data );
169 169
 		endforeach;
170 170
 	} else {
171 171
 
172
-        // Fix: Minor Styling Alignment Issue for PDF
173
-        if( $categories_enabled && $tags_enabled ) {
174
-            $pdf->SetWidths( array( 280 ) );
175
-        } elseif( $categories_enabled || $tags_enabled ) {
176
-            $pdf->SetWidths( array( 235 ) );
177
-        } else {
178
-            $pdf->SetWidths( array( 190 ) );
179
-        }
172
+		// Fix: Minor Styling Alignment Issue for PDF
173
+		if( $categories_enabled && $tags_enabled ) {
174
+			$pdf->SetWidths( array( 280 ) );
175
+		} elseif( $categories_enabled || $tags_enabled ) {
176
+			$pdf->SetWidths( array( 235 ) );
177
+		} else {
178
+			$pdf->SetWidths( array( 190 ) );
179
+		}
180 180
 
181
-        $title = utf8_decode( __( 'No forms found.', 'give' ) );
181
+		$title = utf8_decode( __( 'No forms found.', 'give' ) );
182 182
 		$pdf->Row( array( $title ) );
183 183
 	}
184 184
 
Please login to merge, or discard this patch.
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly..
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,94 +25,94 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
39
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php';
38
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php';
39
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php';
40 40
 
41 41
 	$daterange = utf8_decode(
42 42
 		sprintf(
43 43
 		/* translators: 1: start date 2: end date */
44
-			__( '%1$s to %2$s', 'give' ),
45
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
46
-			date_i18n( give_date_format() )
44
+			__('%1$s to %2$s', 'give'),
45
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
46
+			date_i18n(give_date_format())
47 47
 		)
48 48
 	);
49 49
 
50
-    $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
51
-    $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
50
+    $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
51
+    $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled'));
52 52
 
53 53
 	$pdf = new give_pdf();
54
-	$pdf->AddPage( 'L', 'A4' );
54
+	$pdf->AddPage('L', 'A4');
55 55
 
56
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
57
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
58
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
56
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
57
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
58
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
59 59
 
60
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
60
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
61 61
 
62
-	$pdf->SetMargins( 8, 8, 8 );
63
-	$pdf->SetX( 8 );
62
+	$pdf->SetMargins(8, 8, 8);
63
+	$pdf->SetX(8);
64 64
 
65
-	$pdf->SetFont( 'Helvetica', '', 16 );
66
-	$pdf->SetTextColor( 50, 50, 50 );
67
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
65
+	$pdf->SetFont('Helvetica', '', 16);
66
+	$pdf->SetTextColor(50, 50, 50);
67
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
68 68
 
69
-	$pdf->SetFont( 'Helvetica', '', 13 );
69
+	$pdf->SetFont('Helvetica', '', 13);
70 70
 	$pdf->Ln();
71
-	$pdf->SetTextColor( 150, 150, 150 );
72
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
71
+	$pdf->SetTextColor(150, 150, 150);
72
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
73 73
 	$pdf->Ln();
74
-	$pdf->SetTextColor( 50, 50, 50 );
75
-	$pdf->SetFont( 'Helvetica', '', 14 );
76
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
77
-	$pdf->SetFont( 'Helvetica', '', 12 );
74
+	$pdf->SetTextColor(50, 50, 50);
75
+	$pdf->SetFont('Helvetica', '', 14);
76
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
77
+	$pdf->SetFont('Helvetica', '', 12);
78 78
 
79
-	$pdf->SetFillColor( 238, 238, 238 );
80
-	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
81
-	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
79
+	$pdf->SetFillColor(238, 238, 238);
80
+	$pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
81
+	$pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
82 82
 
83 83
     // Display Categories Heading only, if user has opted for it.
84
-    if ( $categories_enabled ) {
85
-	   $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
84
+    if ($categories_enabled) {
85
+	   $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
86 86
     }
87 87
 
88 88
     // Display Tags Heading only, if user has opted for it.
89
-    if ( $tags_enabled ) {
90
-	   $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
89
+    if ($tags_enabled) {
90
+	   $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
91 91
     }
92 92
 
93
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
94
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
93
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
94
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
95 95
 
96
-	$year       = date( 'Y' );
97
-	$give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) );
96
+	$year       = date('Y');
97
+	$give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
98 98
 
99
-	if ( $give_forms ) {
100
-		$pdf->SetWidths( array( 70, 30, 45, 45, 45, 45 ) );
99
+	if ($give_forms) {
100
+		$pdf->SetWidths(array(70, 30, 45, 45, 45, 45));
101 101
 
102
-		foreach ( $give_forms as $form ):
103
-			$pdf->SetFillColor( 255, 255, 255 );
102
+		foreach ($give_forms as $form):
103
+			$pdf->SetFillColor(255, 255, 255);
104 104
 
105 105
 			$title = $form->post_title;
106 106
 
107
-			if ( give_has_variable_prices( $form->ID ) ) {
107
+			if (give_has_variable_prices($form->ID)) {
108 108
 
109
-				$prices = give_get_variable_prices( $form->ID );
109
+				$prices = give_get_variable_prices($form->ID);
110 110
 
111 111
 				$first = $prices[0]['_give_amount'];
112
-				$last  = array_pop( $prices );
112
+				$last  = array_pop($prices);
113 113
 				$last  = $last['_give_amount'];
114 114
 
115
-				if ( $first < $last ) {
115
+				if ($first < $last) {
116 116
 					$min = $first;
117 117
 					$max = $last;
118 118
 				} else {
@@ -120,31 +120,31 @@  discard block
 block discarded – undo
120 120
 					$max = $first;
121 121
 				}
122 122
 
123
-				$price = give_currency_filter( give_format_amount( $min, array( 'sanitize' => false ) ), '', true ) . ' - ' . give_currency_filter( give_format_amount( $max ), '', true );
123
+				$price = give_currency_filter(give_format_amount($min, array('sanitize' => false)), '', true).' - '.give_currency_filter(give_format_amount($max), '', true);
124 124
 			} else {
125
-				$price = give_currency_filter( give_get_form_price( $form->ID ), '', true );
125
+				$price = give_currency_filter(give_get_form_price($form->ID), '', true);
126 126
 			}
127 127
 
128 128
             // Display Categories Data only, if user has opted for it.
129
-            if ( $categories_enabled ) {
130
-                $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
131
-                $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
129
+            if ($categories_enabled) {
130
+                $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
131
+                $categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
132 132
             }
133 133
 
134 134
             // Display Tags Data only, if user has opted for it.
135
-            if ( $tags_enabled ) {
136
-                $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
137
-                $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
135
+            if ($tags_enabled) {
136
+                $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
137
+                $tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
138 138
             }
139 139
 
140
-			$sales    = give_get_form_sales_stats( $form->ID );
141
-			$link     = get_permalink( $form->ID );
142
-			$earnings = give_currency_filter( give_get_form_earnings_stats( $form->ID ), '', true );
140
+			$sales    = give_get_form_sales_stats($form->ID);
141
+			$link     = get_permalink($form->ID);
142
+			$earnings = give_currency_filter(give_get_form_earnings_stats($form->ID), '', true);
143 143
 
144
-			if ( function_exists( 'iconv' ) ) {
144
+			if (function_exists('iconv')) {
145 145
 				// Ensure characters like euro; are properly converted.
146
-				$price    = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) );
147
-				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
146
+				$price    = iconv('UTF-8', 'windows-1252', utf8_encode($price));
147
+				$earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
148 148
 			}
149 149
 
150 150
             // This will help filter data before appending it to PDF Receipt.
@@ -153,51 +153,51 @@  discard block
 block discarded – undo
153 153
             $prepare_pdf_data[] = $price;
154 154
 
155 155
             // Append Categories Data only, if user has opted for it.
156
-            if ( $categories_enabled ) {
156
+            if ($categories_enabled) {
157 157
                 $prepare_pdf_data[] = $categories;
158 158
             }
159 159
 
160 160
             // Append Tags Data only, if user has opted for it.
161
-            if ( $tags_enabled ) {
161
+            if ($tags_enabled) {
162 162
                 $prepare_pdf_data[] = $tags;
163 163
             }
164 164
 
165 165
             $prepare_pdf_data[] = $sales;
166 166
             $prepare_pdf_data[] = $earnings;
167 167
 
168
-			$pdf->Row( $prepare_pdf_data );
168
+			$pdf->Row($prepare_pdf_data);
169 169
 		endforeach;
170 170
 	} else {
171 171
 
172 172
         // Fix: Minor Styling Alignment Issue for PDF
173
-        if( $categories_enabled && $tags_enabled ) {
174
-            $pdf->SetWidths( array( 280 ) );
175
-        } elseif( $categories_enabled || $tags_enabled ) {
176
-            $pdf->SetWidths( array( 235 ) );
173
+        if ($categories_enabled && $tags_enabled) {
174
+            $pdf->SetWidths(array(280));
175
+        } elseif ($categories_enabled || $tags_enabled) {
176
+            $pdf->SetWidths(array(235));
177 177
         } else {
178
-            $pdf->SetWidths( array( 190 ) );
178
+            $pdf->SetWidths(array(190));
179 179
         }
180 180
 
181
-        $title = utf8_decode( __( 'No forms found.', 'give' ) );
182
-		$pdf->Row( array( $title ) );
181
+        $title = utf8_decode(__('No forms found.', 'give'));
182
+		$pdf->Row(array($title));
183 183
 	}
184 184
 
185 185
 	$pdf->Ln();
186
-	$pdf->SetTextColor( 50, 50, 50 );
187
-	$pdf->SetFont( 'Helvetica', '', 14 );
188
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
189
-	$pdf->SetFont( 'Helvetica', '', 12 );
190
-
191
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
192
-	$image = str_replace( ' ', '%20', $image );
193
-
194
-	$pdf->SetX( 25 );
195
-	$pdf->Image( $image . '&file=.png' );
196
-	$pdf->Ln( 7 );
197
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
186
+	$pdf->SetTextColor(50, 50, 50);
187
+	$pdf->SetFont('Helvetica', '', 14);
188
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
189
+	$pdf->SetFont('Helvetica', '', 12);
190
+
191
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
192
+	$image = str_replace(' ', '%20', $image);
193
+
194
+	$pdf->SetX(25);
195
+	$pdf->Image($image.'&file=.png');
196
+	$pdf->Ln(7);
197
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
198 198
 }
199 199
 
200
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
200
+add_action('give_generate_pdf', 'give_generate_pdf');
201 201
 
202 202
 /**
203 203
  * Draws Chart for PDF Report.
@@ -214,38 +214,38 @@  discard block
 block discarded – undo
214 214
  * @return string $chart->getUrl() URL for the Google Chart
215 215
  */
216 216
 function give_draw_chart_image() {
217
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
218
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
219
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
217
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
218
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
219
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
220 220
 
221
-	$chart = new GoogleChart( 'lc', 900, 330 );
221
+	$chart = new GoogleChart('lc', 900, 330);
222 222
 
223 223
 	$i        = 1;
224 224
 	$earnings = "";
225 225
 	$sales    = "";
226 226
 
227
-	while ( $i <= 12 ) :
228
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
229
-		$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
230
-		$i ++;
227
+	while ($i <= 12) :
228
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
229
+		$sales .= give_get_sales_by_date(null, $i, date('Y')).",";
230
+		$i++;
231 231
 	endwhile;
232 232
 
233
-	$earnings_array = explode( ",", $earnings );
234
-	$sales_array    = explode( ",", $sales );
233
+	$earnings_array = explode(",", $earnings);
234
+	$sales_array    = explode(",", $sales);
235 235
 
236 236
 	$i = 0;
237
-	while ( $i <= 11 ) {
238
-		if ( empty( $sales_array[ $i ] ) ) {
239
-			$sales_array[ $i ] = 0;
237
+	while ($i <= 11) {
238
+		if (empty($sales_array[$i])) {
239
+			$sales_array[$i] = 0;
240 240
 		}
241
-		$i ++;
241
+		$i++;
242 242
 	}
243 243
 
244 244
 	$min_earnings   = 0;
245
-	$max_earnings   = max( $earnings_array );
246
-	$earnings_scale = round( $max_earnings, - 1 );
245
+	$max_earnings   = max($earnings_array);
246
+	$earnings_scale = round($max_earnings, - 1);
247 247
 
248
-	$data = new GoogleChartData( array(
248
+	$data = new GoogleChartData(array(
249 249
 		$earnings_array[0],
250 250
 		$earnings_array[1],
251 251
 		$earnings_array[2],
@@ -258,25 +258,25 @@  discard block
 block discarded – undo
258 258
 		$earnings_array[9],
259 259
 		$earnings_array[10],
260 260
 		$earnings_array[11]
261
-	) );
261
+	));
262 262
 
263
-	$data->setLegend( __( 'Income', 'give' ) );
264
-	$data->setColor( '1b58a3' );
265
-	$chart->addData( $data );
263
+	$data->setLegend(__('Income', 'give'));
264
+	$data->setColor('1b58a3');
265
+	$chart->addData($data);
266 266
 
267
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
268
-	$shape_marker->setColor( '000000' );
269
-	$shape_marker->setSize( 7 );
270
-	$shape_marker->setBorder( 2 );
271
-	$shape_marker->setData( $data );
272
-	$chart->addMarker( $shape_marker );
267
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
268
+	$shape_marker->setColor('000000');
269
+	$shape_marker->setSize(7);
270
+	$shape_marker->setBorder(2);
271
+	$shape_marker->setData($data);
272
+	$chart->addMarker($shape_marker);
273 273
 
274
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
275
-	$value_marker->setColor( '000000' );
276
-	$value_marker->setData( $data );
277
-	$chart->addMarker( $value_marker );
274
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
275
+	$value_marker->setColor('000000');
276
+	$value_marker->setData($data);
277
+	$chart->addMarker($value_marker);
278 278
 
279
-	$data = new GoogleChartData( array(
279
+	$data = new GoogleChartData(array(
280 280
 		$sales_array[0],
281 281
 		$sales_array[1],
282 282
 		$sales_array[2],
@@ -289,46 +289,46 @@  discard block
 block discarded – undo
289 289
 		$sales_array[9],
290 290
 		$sales_array[10],
291 291
 		$sales_array[11]
292
-	) );
293
-	$data->setLegend( __( 'Donations', 'give' ) );
294
-	$data->setColor( 'ff6c1c' );
295
-	$chart->addData( $data );
296
-
297
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
298
-
299
-	$chart->setScale( 0, $max_earnings );
300
-
301
-	$y_axis = new GoogleChartAxis( 'y' );
302
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
303
-	$chart->addAxis( $y_axis );
304
-
305
-	$x_axis = new GoogleChartAxis( 'x' );
306
-	$x_axis->setTickMarks( 5 );
307
-	$x_axis->setLabels( array(
308
-		__( 'Jan', 'give' ),
309
-		__( 'Feb', 'give' ),
310
-		__( 'Mar', 'give' ),
311
-		__( 'Apr', 'give' ),
312
-		__( 'May', 'give' ),
313
-		__( 'June', 'give' ),
314
-		__( 'July', 'give' ),
315
-		__( 'Aug', 'give' ),
316
-		__( 'Sept', 'give' ),
317
-		__( 'Oct', 'give' ),
318
-		__( 'Nov', 'give' ),
319
-		__( 'Dec', 'give' )
320
-	) );
321
-	$chart->addAxis( $x_axis );
322
-
323
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
324
-	$shape_marker->setSize( 6 );
325
-	$shape_marker->setBorder( 2 );
326
-	$shape_marker->setData( $data );
327
-	$chart->addMarker( $shape_marker );
328
-
329
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
330
-	$value_marker->setData( $data );
331
-	$chart->addMarker( $value_marker );
292
+	));
293
+	$data->setLegend(__('Donations', 'give'));
294
+	$data->setColor('ff6c1c');
295
+	$chart->addData($data);
296
+
297
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
298
+
299
+	$chart->setScale(0, $max_earnings);
300
+
301
+	$y_axis = new GoogleChartAxis('y');
302
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
303
+	$chart->addAxis($y_axis);
304
+
305
+	$x_axis = new GoogleChartAxis('x');
306
+	$x_axis->setTickMarks(5);
307
+	$x_axis->setLabels(array(
308
+		__('Jan', 'give'),
309
+		__('Feb', 'give'),
310
+		__('Mar', 'give'),
311
+		__('Apr', 'give'),
312
+		__('May', 'give'),
313
+		__('June', 'give'),
314
+		__('July', 'give'),
315
+		__('Aug', 'give'),
316
+		__('Sept', 'give'),
317
+		__('Oct', 'give'),
318
+		__('Nov', 'give'),
319
+		__('Dec', 'give')
320
+	));
321
+	$chart->addAxis($x_axis);
322
+
323
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
324
+	$shape_marker->setSize(6);
325
+	$shape_marker->setBorder(2);
326
+	$shape_marker->setData($data);
327
+	$chart->addMarker($shape_marker);
328
+
329
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
330
+	$value_marker->setData($data);
331
+	$chart->addMarker($value_marker);
332 332
 
333 333
 	return $chart->getUrl();
334 334
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-forms.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	public function csv_cols() {
42 42
 
43 43
 		$cols = array(
44
-			'ID'                      => __( 'ID', 'give' ),
45
-			'post_name'               => __( 'Slug', 'give' ),
46
-			'post_title'              => __( 'Name', 'give' ),
47
-			'post_date'               => __( 'Date Created', 'give' ),
48
-			'post_author'             => __( 'Author', 'give' ),
49
-			'post_content'            => __( 'Description', 'give' ),
50
-			'post_excerpt'            => __( 'Excerpt', 'give' ),
51
-			'post_status'             => __( 'Status', 'give' ),
52
-			'categories'              => __( 'Categories', 'give' ),
53
-			'tags'                    => __( 'Tags', 'give' ),
54
-			'give_price'              => __( 'Price', 'give' ),
55
-			'_thumbnail_id'           => __( 'Featured Image', 'give' ),
56
-			'_give_form_sales'        => __( 'Donations', 'give' ),
57
-			'_give_download_earnings' => __( 'Income', 'give' ),
44
+			'ID'                      => __('ID', 'give'),
45
+			'post_name'               => __('Slug', 'give'),
46
+			'post_title'              => __('Name', 'give'),
47
+			'post_date'               => __('Date Created', 'give'),
48
+			'post_author'             => __('Author', 'give'),
49
+			'post_content'            => __('Description', 'give'),
50
+			'post_excerpt'            => __('Excerpt', 'give'),
51
+			'post_status'             => __('Status', 'give'),
52
+			'categories'              => __('Categories', 'give'),
53
+			'tags'                    => __('Tags', 'give'),
54
+			'give_price'              => __('Price', 'give'),
55
+			'_thumbnail_id'           => __('Featured Image', 'give'),
56
+			'_give_form_sales'        => __('Donations', 'give'),
57
+			'_give_download_earnings' => __('Income', 'give'),
58 58
 		);
59 59
 
60 60
 		return $cols;
@@ -84,43 +84,43 @@  discard block
 block discarded – undo
84 84
 			'paged'          => $this->step
85 85
 		);
86 86
 
87
-		$forms = new WP_Query( $args );
87
+		$forms = new WP_Query($args);
88 88
 
89
-		if ( $forms->posts ) {
90
-			foreach ( $forms->posts as $form ) {
89
+		if ($forms->posts) {
90
+			foreach ($forms->posts as $form) {
91 91
 
92 92
 				$row = [];
93 93
 
94
-				foreach ( $this->csv_cols() as $key => $value ) {
94
+				foreach ($this->csv_cols() as $key => $value) {
95 95
 
96 96
 					// Setup default value/
97
-					$row[ $key ] = '';
97
+					$row[$key] = '';
98 98
 
99
-					if ( in_array( $key, $meta ) ) {
99
+					if (in_array($key, $meta)) {
100 100
 
101
-						switch ( $key ) {
101
+						switch ($key) {
102 102
 
103 103
 							case '_thumbnail_id' :
104 104
 
105
-								$image_id    = get_post_thumbnail_id( $form->ID );
106
-								$row[ $key ] = wp_get_attachment_url( $image_id );
105
+								$image_id    = get_post_thumbnail_id($form->ID);
106
+								$row[$key] = wp_get_attachment_url($image_id);
107 107
 
108 108
 								break;
109 109
 
110 110
 							case 'give_price' :
111 111
 
112
-								if ( give_has_variable_prices( $form->ID ) ) {
112
+								if (give_has_variable_prices($form->ID)) {
113 113
 
114 114
 									$prices = [];
115
-									foreach ( give_get_variable_prices( $form->ID ) as $price ) {
116
-										$prices[] = $price['name'] . ': ' . $price['amount'];
115
+									foreach (give_get_variable_prices($form->ID) as $price) {
116
+										$prices[] = $price['name'].': '.$price['amount'];
117 117
 									}
118 118
 
119
-									$row[ $key ] = implode( ' | ', $prices );
119
+									$row[$key] = implode(' | ', $prices);
120 120
 
121 121
 								} else {
122 122
 
123
-									$row[ $key ] = give_get_form_price( $form->ID );
123
+									$row[$key] = give_get_form_price($form->ID);
124 124
 
125 125
 								}
126 126
 
@@ -128,44 +128,44 @@  discard block
 block discarded – undo
128 128
 
129 129
 							default :
130 130
 
131
-								$row[ $key ] = give_get_meta( $form->ID, $key, TRUE );
131
+								$row[$key] = give_get_meta($form->ID, $key, TRUE);
132 132
 
133 133
 								break;
134 134
 
135 135
 						}
136 136
 
137
-					} elseif ( isset( $form->$key ) ) {
137
+					} elseif (isset($form->$key)) {
138 138
 
139
-						switch ( $key ) {
139
+						switch ($key) {
140 140
 
141 141
 							case 'post_author' :
142 142
 
143
-								$row[ $key ] = get_the_author_meta( 'user_login', $form->post_author );
143
+								$row[$key] = get_the_author_meta('user_login', $form->post_author);
144 144
 
145 145
 								break;
146 146
 
147 147
 							default :
148 148
 
149
-								$row[ $key ] = $form->$key;
149
+								$row[$key] = $form->$key;
150 150
 
151 151
 								break;
152 152
 						}
153 153
 
154
-					} elseif ( 'tags' == $key ) {
154
+					} elseif ('tags' == $key) {
155 155
 
156
-						$terms = get_the_terms( $form->ID, 'form_tag' );
157
-						if ( $terms ) {
158
-							$terms       = wp_list_pluck( $terms, 'name' );
159
-							$row[ $key ] = implode( ' | ', $terms );
156
+						$terms = get_the_terms($form->ID, 'form_tag');
157
+						if ($terms) {
158
+							$terms       = wp_list_pluck($terms, 'name');
159
+							$row[$key] = implode(' | ', $terms);
160 160
 						}
161 161
 
162 162
 
163
-					} elseif ( 'categories' == $key ) {
163
+					} elseif ('categories' == $key) {
164 164
 
165
-						$terms = get_the_terms( $form->ID, 'form_category' );
166
-						if ( $terms ) {
167
-							$terms       = wp_list_pluck( $terms, 'name' );
168
-							$row[ $key ] = implode( ' | ', $terms );
165
+						$terms = get_the_terms($form->ID, 'form_category');
166
+						if ($terms) {
167
+							$terms       = wp_list_pluck($terms, 'name');
168
+							$row[$key] = implode(' | ', $terms);
169 169
 						}
170 170
 
171 171
 					}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
 			}
178 178
 
179
-			$data = apply_filters( 'give_export_get_data', $data );
180
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
179
+			$data = apply_filters('give_export_get_data', $data);
180
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
181 181
 
182 182
 			return $data;
183 183
 
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$args = array(
199 199
 			'post_type'      => 'give_forms',
200
-			'posts_per_page' => - 1,
200
+			'posts_per_page' => -1,
201 201
 			'post_status'    => 'any',
202 202
 			'fields'         => 'ids',
203 203
 		);
204 204
 
205
-		$forms  = new WP_Query( $args );
205
+		$forms = new WP_Query($args);
206 206
 		$total      = (int) $forms->post_count;
207 207
 		$percentage = 100;
208 208
 
209
-		if ( $total > 0 ) {
210
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
209
+		if ($total > 0) {
210
+			$percentage = ((30 * $this->step) / $total) * 100;
211 211
 		}
212 212
 
213
-		if ( $percentage > 100 ) {
213
+		if ($percentage > 100) {
214 214
 			$percentage = 100;
215 215
 		}
216 216
 
Please login to merge, or discard this patch.
includes/actions.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,6 @@
 block discarded – undo
216 216
 /**
217 217
  * Set Donation Amount for Multi Level Donation Forms
218 218
  *
219
- * @param int    $form_id
220 219
  * @param object $form
221 220
  *
222 221
  * @since 1.8.9
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_get_actions() {
27 27
 
28
-	$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;
28
+	$_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null;
29 29
 
30 30
 	// Add backward compatibility to give-action param ( $_GET )
31
-	if(  empty( $_get_action ) ) {
32
-		$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
31
+	if (empty($_get_action)) {
32
+		$_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null;
33 33
 	}
34 34
 
35
-	if ( isset( $_get_action ) ) {
35
+	if (isset($_get_action)) {
36 36
 		/**
37 37
 		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
38 38
 		 *
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $_GET Array of HTTP GET variables.
42 42
 		 */
43
-		do_action( "give_{$_get_action}", $_GET );
43
+		do_action("give_{$_get_action}", $_GET);
44 44
 	}
45 45
 
46 46
 }
47 47
 
48
-add_action( 'init', 'give_get_actions' );
48
+add_action('init', 'give_get_actions');
49 49
 
50 50
 /**
51 51
  * Hooks Give actions, when present in the $_POST super global. Every give_action
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function give_post_actions() {
60 60
 
61
-	$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;
61
+	$_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null;
62 62
 
63 63
 
64 64
 	// Add backward compatibility to give-action param ( $_POST ).
65
-	if(  empty( $_post_action ) ) {
66
-		$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
65
+	if (empty($_post_action)) {
66
+		$_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null;
67 67
 	}
68 68
 
69
-	if ( isset( $_post_action ) ) {
69
+	if (isset($_post_action)) {
70 70
 		/**
71 71
 		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
72 72
 		 *
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 		 *
75 75
 		 * @param array $_POST Array of HTTP POST variables.
76 76
 		 */
77
-		do_action( "give_{$_post_action}", $_POST );
77
+		do_action("give_{$_post_action}", $_POST);
78 78
 	}
79 79
 
80 80
 }
81 81
 
82
-add_action( 'init', 'give_post_actions' );
82
+add_action('init', 'give_post_actions');
83 83
 
84 84
 /**
85 85
  * Connect WordPress user with Donor.
@@ -89,28 +89,28 @@  discard block
 block discarded – undo
89 89
  * @param  array $user_data User Data
90 90
  * @return void
91 91
  */
92
-function give_connect_donor_to_wpuser( $user_id, $user_data ){
92
+function give_connect_donor_to_wpuser($user_id, $user_data) {
93 93
 	/* @var Give_Donor $donor */
94
-	$donor = new Give_Donor( $user_data['user_email'] );
94
+	$donor = new Give_Donor($user_data['user_email']);
95 95
 
96 96
 	// Validate donor id and check if do nor is already connect to wp user or not.
97
-	if( $donor->id && ! $donor->user_id ) {
97
+	if ($donor->id && ! $donor->user_id) {
98 98
 
99 99
 		// Update donor user_id.
100
-		if( $donor->update( array( 'user_id' => $user_id ) ) ) {
101
-			$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
102
-			$donor->add_note( $donor_note );
100
+		if ($donor->update(array('user_id' => $user_id))) {
101
+			$donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id);
102
+			$donor->add_note($donor_note);
103 103
 
104 104
 			// Update user_id meta in payments.
105
-			if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
106
-				foreach ( $donations as $donation  ) {
107
-					give_update_meta( $donation, '_give_payment_user_id', $user_id );
105
+			if ( ! empty($donor->payment_ids) && ($donations = explode(',', $donor->payment_ids))) {
106
+				foreach ($donations as $donation) {
107
+					give_update_meta($donation, '_give_payment_user_id', $user_id);
108 108
 				}
109 109
 			}
110 110
 		}
111 111
 	}
112 112
 }
113
-add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );
113
+add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2);
114 114
 
115 115
 
116 116
 /**
@@ -124,24 +124,24 @@  discard block
 block discarded – undo
124 124
 function give_validate_license_when_site_migrated() {
125 125
 	// Store current site address if not already stored.
126 126
 	$homeurl = home_url();
127
-	if( ! get_option( 'give_site_address_before_migrate' ) ) {
127
+	if ( ! get_option('give_site_address_before_migrate')) {
128 128
 		// Update site address.
129
-		update_option( 'give_site_address_before_migrate', $homeurl );
129
+		update_option('give_site_address_before_migrate', $homeurl);
130 130
 
131 131
 		return;
132 132
 	}
133 133
 
134
-	if( $homeurl !== get_option( 'give_site_address_before_migrate' ) ) {
134
+	if ($homeurl !== get_option('give_site_address_before_migrate')) {
135 135
 		// Immediately run cron.
136
-		wp_schedule_single_event( time() , 'give_validate_license_when_site_migrated' );
136
+		wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated');
137 137
 
138 138
 		// Update site address.
139
-		update_option( 'give_site_address_before_migrate', home_url() );
139
+		update_option('give_site_address_before_migrate', home_url());
140 140
 	}
141 141
 
142 142
 }
143
-add_action( 'init', 'give_validate_license_when_site_migrated' );
144
-add_action( 'admin_init', 'give_validate_license_when_site_migrated' );
143
+add_action('init', 'give_validate_license_when_site_migrated');
144
+add_action('admin_init', 'give_validate_license_when_site_migrated');
145 145
 
146 146
 
147 147
 /**
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
  * @since 1.8
151 151
  * @param $data
152 152
  */
153
-function give_donor_batch_export_complete( $data ) {
153
+function give_donor_batch_export_complete($data) {
154 154
 	// Remove donor ids cache.
155
-	if(
156
-		isset( $data['class'] )
155
+	if (
156
+		isset($data['class'])
157 157
 		&& 'Give_Batch_Donors_Export' === $data['class']
158
-		&& ! empty( $data['forms'] )
159
-		&& isset( $data['give_export_option']['query_id'] )
158
+		&& ! empty($data['forms'])
159
+		&& isset($data['give_export_option']['query_id'])
160 160
 	) {
161
-		Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
161
+		Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id']));
162 162
 	}
163 163
 }
164
-add_action('give_file_export_complete', 'give_donor_batch_export_complete' );
164
+add_action('give_file_export_complete', 'give_donor_batch_export_complete');
165 165
 
166 166
 /**
167 167
  * Print css for wordpress setting pages.
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 	/* @var WP_Screen $screen */
173 173
 	$screen = get_current_screen();
174 174
 
175
-	if( ! ( $screen instanceof WP_Screen ) ) {
175
+	if ( ! ($screen instanceof WP_Screen)) {
176 176
 		return false;
177 177
 	}
178 178
 
179
-	switch ( true ) {
180
-		case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ):
179
+	switch (true) {
180
+		case ('plugins' === $screen->base || 'plugins-network' === $screen->base):
181 181
 			?>
182 182
 			<style>
183 183
 				tr.active.update + tr.give-addon-notice-tr td{
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			<?php
211 211
 	}
212 212
 }
213
-add_action( 'admin_head', 'give_admin_quick_css' );
213
+add_action('admin_head', 'give_admin_quick_css');
214 214
 
215 215
 
216 216
 /**
@@ -223,28 +223,28 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return void
225 225
  */
226
-function give_set_donation_levels_max_min_amount( $form_id ) {
226
+function give_set_donation_levels_max_min_amount($form_id) {
227 227
 	if (
228
-		( 'set' === $_POST['_give_price_option'] ) ||
229
-		( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) ||
230
-		! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) )
228
+		('set' === $_POST['_give_price_option']) ||
229
+		(in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) ||
230
+		! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount'))
231 231
 	) {
232 232
 		// Delete old meta.
233
-		give_delete_meta( $form_id, '_give_levels_minimum_amount' );
234
-		give_delete_meta( $form_id, '_give_levels_maximum_amount' );
233
+		give_delete_meta($form_id, '_give_levels_minimum_amount');
234
+		give_delete_meta($form_id, '_give_levels_maximum_amount');
235 235
 
236 236
 		return;
237 237
 	}
238 238
 
239 239
 	// Sanitize donation level amounts.
240
-	$donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts );
240
+	$donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts);
241 241
 
242
-	$min_amount = min( $donation_levels_amounts );
243
-	$max_amount = max( $donation_levels_amounts );
242
+	$min_amount = min($donation_levels_amounts);
243
+	$max_amount = max($donation_levels_amounts);
244 244
 
245 245
 	// Set Minimum and Maximum amount for Multi Level Donation Forms
246
-	give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 );
247
-	give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount? give_sanitize_amount_for_db( $max_amount ) : 0 );
246
+	give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0);
247
+	give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0);
248 248
 }
249 249
 
250
-add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 );
251 250
\ No newline at end of file
251
+add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30);
252 252
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/donors/class-donor-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -253,7 +253,7 @@
 block discarded – undo
253 253
 	 *
254 254
 	 * @access public
255 255
 	 * @since  1.0
256
-	 * @return mixed string If search is present, false otherwise.
256
+	 * @return string|false string If search is present, false otherwise.
257 257
 	 */
258 258
 	public function get_search() {
259 259
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 // Load WP_List_Table if not loaded
20
-if ( ! class_exists( 'WP_List_Table' ) ) {
21
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
20
+if ( ! class_exists('WP_List_Table')) {
21
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
22 22
 }
23 23
 
24 24
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults
64
-		parent::__construct( array(
65
-			'singular' => __( 'Donor', 'give' ),     // Singular name of the listed records.
66
-			'plural'   => __( 'Donors', 'give' ),    // Plural name of the listed records.
67
-			'ajax'     => false,// Does this table support ajax?.
68
-		) );
64
+		parent::__construct(array(
65
+			'singular' => __('Donor', 'give'), // Singular name of the listed records.
66
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records.
67
+			'ajax'     => false, // Does this table support ajax?.
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
88 88
 		}
89
-		if ( ! empty( $_REQUEST['order'] ) ) {
90
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
89
+		if ( ! empty($_REQUEST['order'])) {
90
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
91 91
 		}
92 92
 		?>
93 93
 		<p class="search-box" role="search">
94 94
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
95 95
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
96
-			<?php submit_button( $text, 'button', false, false, array(
96
+			<?php submit_button($text, 'button', false, false, array(
97 97
 				'ID' => 'search-submit',
98
-			) ); ?>
98
+			)); ?>
99 99
 		</p>
100 100
 		<?php
101 101
 	}
@@ -111,31 +111,31 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return string Column Name.
113 113
 	 */
114
-	public function column_default( $donor, $column_name ) {
115
-		switch ( $column_name ) {
114
+	public function column_default($donor, $column_name) {
115
+		switch ($column_name) {
116 116
 
117 117
 			case 'num_donations' :
118 118
 				$value = sprintf(
119 119
 					'<a href="%s">%s</a>',
120
-					admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor['id'] ) ),
121
-					esc_html( $donor['num_donations'] )
120
+					admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor['id'])),
121
+					esc_html($donor['num_donations'])
122 122
 				);
123 123
 				break;
124 124
 
125 125
 			case 'amount_spent' :
126
-				$value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) );
126
+				$value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false)));
127 127
 				break;
128 128
 
129 129
 			case 'date_created' :
130
-				$value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) );
130
+				$value = date_i18n(give_date_format(), strtotime($donor['date_created']));
131 131
 				break;
132 132
 
133 133
 			default:
134
-				$value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null;
134
+				$value = isset($donor[$column_name]) ? $donor[$column_name] : null;
135 135
 				break;
136 136
 		}
137 137
 
138
-		return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] );
138
+		return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']);
139 139
 
140 140
 	}
141 141
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return string
148 148
 	 */
149
-	public function column_name( $donor ) {
150
-		$name     = '#' . $donor['id'] . ' ';
151
-		$name     .= ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
152
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] );
153
-		$actions  = $this->get_row_actions( $donor );
149
+	public function column_name($donor) {
150
+		$name     = '#'.$donor['id'].' ';
151
+		$name .= ! empty($donor['name']) ? $donor['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
152
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']);
153
+		$actions  = $this->get_row_actions($donor);
154 154
 
155
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
155
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
156 156
 	}
157 157
 
158 158
 	/**
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public function get_columns() {
166 166
 		$columns = array(
167
-			'name'          => __( 'Name', 'give' ),
168
-			'email'         => __( 'Email', 'give' ),
169
-			'num_donations' => __( 'Donations', 'give' ),
170
-			'amount_spent'  => __( 'Total Donated', 'give' ),
171
-			'date_created'  => __( 'Date Created', 'give' ),
167
+			'name'          => __('Name', 'give'),
168
+			'email'         => __('Email', 'give'),
169
+			'num_donations' => __('Donations', 'give'),
170
+			'amount_spent'  => __('Total Donated', 'give'),
171
+			'date_created'  => __('Date Created', 'give'),
172 172
 		);
173 173
 
174
-		return apply_filters( 'give_list_donors_columns', $columns );
174
+		return apply_filters('give_list_donors_columns', $columns);
175 175
 
176 176
 	}
177 177
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 	public function get_sortable_columns() {
186 186
 
187 187
 		$columns = array(
188
-			'date_created'  => array( 'date_created', true ),
189
-			'name'          => array( 'name', true ),
190
-			'num_donations' => array( 'purchase_count', false ),
191
-			'amount_spent'  => array( 'purchase_value', false ),
188
+			'date_created'  => array('date_created', true),
189
+			'name'          => array('name', true),
190
+			'num_donations' => array('purchase_count', false),
191
+			'amount_spent'  => array('purchase_value', false),
192 192
 		);
193 193
 
194
-		return apply_filters( 'give_list_donors_sortable_columns', $columns );
194
+		return apply_filters('give_list_donors_sortable_columns', $columns);
195 195
 	}
196 196
 
197 197
 	/**
@@ -204,19 +204,19 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array An array of action links.
206 206
 	 */
207
-	public function get_row_actions( $donor ) {
207
+	public function get_row_actions($donor) {
208 208
 
209 209
 		$actions = array(
210 210
 
211
-			'view' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ),
211
+			'view' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')),
212 212
 
213
-			'notes' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ),
213
+			'notes' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')),
214 214
 
215
-			'delete' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor['id'] ), sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ),
215
+			'delete' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor['id']), sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')),
216 216
 
217 217
 		);
218 218
 
219
-		return apply_filters( 'give_donor_row_actions', $actions, $donor );
219
+		return apply_filters('give_donor_row_actions', $actions, $donor);
220 220
 
221 221
 	}
222 222
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @since  1.0
231 231
 	 * @return void
232 232
 	 */
233
-	public function bulk_actions( $which = '' ) {
233
+	public function bulk_actions($which = '') {
234 234
 		// These aren't really bulk actions but this outputs the markup in the right place.
235 235
 	}
236 236
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @return int Current page number.
243 243
 	 */
244 244
 	public function get_paged() {
245
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
245
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
246 246
 	}
247 247
 
248 248
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return mixed string If search is present, false otherwise.
254 254
 	 */
255 255
 	public function get_search() {
256
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
256
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
257 257
 	}
258 258
 
259 259
 	/**
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
 
271 271
 		// Get donor query.
272 272
 		$args   = $this->get_donor_query();
273
-		$donors = Give()->donors->get_donors( $args );
273
+		$donors = Give()->donors->get_donors($args);
274 274
 
275
-		if ( $donors ) {
275
+		if ($donors) {
276 276
 
277
-			foreach ( $donors as $donor ) {
277
+			foreach ($donors as $donor) {
278 278
 
279
-				$user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0;
279
+				$user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0;
280 280
 
281 281
 				$data[] = array(
282 282
 					'id'            => $donor->id,
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			}
291 291
 		}
292 292
 
293
-		return apply_filters( 'give_donors_column_query_data', $data );
293
+		return apply_filters('give_donors_column_query_data', $data);
294 294
 	}
295 295
 
296 296
 	/**
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 
306 306
 		$_donor_query['number'] = - 1;
307 307
 		$_donor_query['offset'] = 0;
308
-		$donors                 = Give()->donors->get_donors( $_donor_query );
308
+		$donors                 = Give()->donors->get_donors($_donor_query);
309 309
 
310
-		return count( $donors );
310
+		return count($donors);
311 311
 	}
312 312
 
313 313
 	/**
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	public function get_donor_query() {
321 321
 		$paged   = $this->get_paged();
322
-		$offset  = $this->per_page * ( $paged - 1 );
322
+		$offset  = $this->per_page * ($paged - 1);
323 323
 		$search  = $this->get_search();
324
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
325
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
324
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
325
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
326 326
 
327 327
 		$args = array(
328 328
 			'number'  => $this->per_page,
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 			'orderby' => $orderby,
332 332
 		);
333 333
 
334
-		if ( $search ) {
335
-			if ( is_email( $search ) ) {
334
+		if ($search) {
335
+			if (is_email($search)) {
336 336
 				$args['email'] = $search;
337
-			} elseif ( is_numeric( $search ) ) {
337
+			} elseif (is_numeric($search)) {
338 338
 				$args['id'] = $search;
339 339
 			} else {
340 340
 				$args['name'] = $search;
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 		$hidden   = array(); // No hidden columns.
358 358
 		$sortable = $this->get_sortable_columns();
359 359
 
360
-		$this->_column_headers = array( $columns, $hidden, $sortable );
360
+		$this->_column_headers = array($columns, $hidden, $sortable);
361 361
 
362 362
 		$this->items = $this->donor_data();
363 363
 
364 364
 		$this->total = $this->get_donor_count();
365 365
 
366
-		$this->set_pagination_args( array(
366
+		$this->set_pagination_args(array(
367 367
 			'total_items' => $this->total,
368 368
 			'per_page'    => $this->per_page,
369
-			'total_pages' => ceil( $this->total / $this->per_page ),
370
-		) );
369
+			'total_pages' => ceil($this->total / $this->per_page),
370
+		));
371 371
 	}
372 372
 }
Please login to merge, or discard this patch.
includes/admin/donors/donor-actions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
  *
273 273
  * @param  array $args The $_POST array being passed.
274 274
  *
275
- * @return int Whether it was a successful deletion.
275
+ * @return false|null Whether it was a successful deletion.
276 276
  */
277 277
 function give_donor_delete( $args ) {
278 278
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
  * Remove an email address to the donor from within the admin and log a donor note and redirect back to the donor interface for feedback.
547 547
  *
548 548
  * @since  1.7
549
- * @return bool|null
549
+ * @return false|null
550 550
  */
551 551
 function give_remove_donor_email() {
552 552
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
  * and redirect back to the donor interface for feedback
590 590
  *
591 591
  * @since  1.7
592
- * @return bool|null
592
+ * @return false|null
593 593
  */
594 594
 function give_set_donor_primary_email() {
595 595
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
Please login to merge, or discard this patch.
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array|bool $output Response messages
25 25
  */
26
-function give_edit_donor( $args ) {
26
+function give_edit_donor($args) {
27 27
 
28
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
28
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
31
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
30
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
31
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
32 32
 			'response' => 403,
33
-		) );
33
+		));
34 34
 	}
35 35
 
36
-	if ( empty( $args ) ) {
36
+	if (empty($args)) {
37 37
 		return false;
38 38
 	}
39 39
 
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	$donor_id   = (int) $args['customerinfo']['id'];
42 42
 	$nonce      = $args['_wpnonce'];
43 43
 
44
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
45
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
44
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
45
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
46 46
 			'response' => 400,
47
-		) );
47
+		));
48 48
 	}
49 49
 
50
-	$donor = new Give_Donor( $donor_id );
50
+	$donor = new Give_Donor($donor_id);
51 51
 
52
-	if ( empty( $donor->id ) ) {
52
+	if (empty($donor->id)) {
53 53
 		return false;
54 54
 	}
55 55
 
@@ -64,67 +64,67 @@  discard block
 block discarded – undo
64 64
 		'country' => '',
65 65
 	);
66 66
 
67
-	$donor_info = wp_parse_args( $donor_info, $defaults );
67
+	$donor_info = wp_parse_args($donor_info, $defaults);
68 68
 
69
-	if ( (int) $donor_info['user_id'] !== (int) $donor->user_id ) {
69
+	if ((int) $donor_info['user_id'] !== (int) $donor->user_id) {
70 70
 
71 71
 		// Make sure we don't already have this user attached to a donor.
72
-		if ( ! empty( $donor_info['user_id'] ) && false !== Give()->donors->get_donor_by( 'user_id', $donor_info['user_id'] ) ) {
73
-			give_set_error( 'give-invalid-donor-user_id', sprintf( __( 'The User ID #%d is already associated with a different donor.', 'give' ), $donor_info['user_id'] ) );
72
+		if ( ! empty($donor_info['user_id']) && false !== Give()->donors->get_donor_by('user_id', $donor_info['user_id'])) {
73
+			give_set_error('give-invalid-donor-user_id', sprintf(__('The User ID #%d is already associated with a different donor.', 'give'), $donor_info['user_id']));
74 74
 		}
75 75
 
76 76
 		// Make sure it's actually a user.
77
-		$user = get_user_by( 'id', $donor_info['user_id'] );
78
-		if ( ! empty( $donor_info['user_id'] ) && false === $user ) {
79
-			give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID #%d does not exist. Please assign an existing user.', 'give' ), $donor_info['user_id'] ) );
77
+		$user = get_user_by('id', $donor_info['user_id']);
78
+		if ( ! empty($donor_info['user_id']) && false === $user) {
79
+			give_set_error('give-invalid-user_id', sprintf(__('The User ID #%d does not exist. Please assign an existing user.', 'give'), $donor_info['user_id']));
80 80
 		}
81 81
 	}
82 82
 
83
-	if ( give_get_errors() ) {
83
+	if (give_get_errors()) {
84 84
 		return false;
85 85
 	}
86 86
 
87 87
 	// Setup the donor address, if present.
88 88
 	$address = array();
89
-	if ( intval( $donor_info['user_id'] ) > 0 ) {
90
-
91
-		$current_address = (array) get_user_meta( $donor_info['user_id'], '_give_user_address', true );
92
-
93
-		if ( is_array( $current_address ) && 0 < count( $current_address ) ) {
94
-			$current_address    = wp_parse_args( $current_address, $defaults );
95
-			$address['line1']   = ! empty( $donor_info['line1'] ) ? $donor_info['line1'] : $current_address['line1'];
96
-			$address['line2']   = ! empty( $donor_info['line2'] ) ? $donor_info['line2'] : $current_address['line2'];
97
-			$address['city']    = ! empty( $donor_info['city'] ) ? $donor_info['city'] : $current_address['city'];
98
-			$address['country'] = ! empty( $donor_info['country'] ) ? $donor_info['country'] : $current_address['country'];
99
-			$address['zip']     = ! empty( $donor_info['zip'] ) ? $donor_info['zip'] : $current_address['zip'];
100
-			$address['state']   = ! empty( $donor_info['state'] ) ? $donor_info['state'] : $current_address['state'];
89
+	if (intval($donor_info['user_id']) > 0) {
90
+
91
+		$current_address = (array) get_user_meta($donor_info['user_id'], '_give_user_address', true);
92
+
93
+		if (is_array($current_address) && 0 < count($current_address)) {
94
+			$current_address    = wp_parse_args($current_address, $defaults);
95
+			$address['line1']   = ! empty($donor_info['line1']) ? $donor_info['line1'] : $current_address['line1'];
96
+			$address['line2']   = ! empty($donor_info['line2']) ? $donor_info['line2'] : $current_address['line2'];
97
+			$address['city']    = ! empty($donor_info['city']) ? $donor_info['city'] : $current_address['city'];
98
+			$address['country'] = ! empty($donor_info['country']) ? $donor_info['country'] : $current_address['country'];
99
+			$address['zip']     = ! empty($donor_info['zip']) ? $donor_info['zip'] : $current_address['zip'];
100
+			$address['state']   = ! empty($donor_info['state']) ? $donor_info['state'] : $current_address['state'];
101 101
 		} else {
102
-			$address['line1']   = ! empty( $donor_info['line1'] ) ? $donor_info['line1'] : '';
103
-			$address['line2']   = ! empty( $donor_info['line2'] ) ? $donor_info['line2'] : '';
104
-			$address['city']    = ! empty( $donor_info['city'] ) ? $donor_info['city'] : '';
105
-			$address['country'] = ! empty( $donor_info['country'] ) ? $donor_info['country'] : '';
106
-			$address['zip']     = ! empty( $donor_info['zip'] ) ? $donor_info['zip'] : '';
107
-			$address['state']   = ! empty( $donor_info['state'] ) ? $donor_info['state'] : '';
102
+			$address['line1']   = ! empty($donor_info['line1']) ? $donor_info['line1'] : '';
103
+			$address['line2']   = ! empty($donor_info['line2']) ? $donor_info['line2'] : '';
104
+			$address['city']    = ! empty($donor_info['city']) ? $donor_info['city'] : '';
105
+			$address['country'] = ! empty($donor_info['country']) ? $donor_info['country'] : '';
106
+			$address['zip']     = ! empty($donor_info['zip']) ? $donor_info['zip'] : '';
107
+			$address['state']   = ! empty($donor_info['state']) ? $donor_info['state'] : '';
108 108
 		}
109 109
 
110 110
 	}
111 111
 
112 112
 	// Sanitize the inputs.
113 113
 	$donor_data            = array();
114
-	$donor_data['name']    = strip_tags( stripslashes( $donor_info['name'] ) );
114
+	$donor_data['name']    = strip_tags(stripslashes($donor_info['name']));
115 115
 	$donor_data['user_id'] = $donor_info['user_id'];
116 116
 
117
-	$donor_data = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id );
118
-	$address    = apply_filters( 'give_edit_donor_address', $address, $donor_id );
117
+	$donor_data = apply_filters('give_edit_donor_info', $donor_data, $donor_id);
118
+	$address    = apply_filters('give_edit_donor_address', $address, $donor_id);
119 119
 
120
-	$donor_data = array_map( 'sanitize_text_field', $donor_data );
121
-	$address    = array_map( 'sanitize_text_field', $address );
120
+	$donor_data = array_map('sanitize_text_field', $donor_data);
121
+	$address    = array_map('sanitize_text_field', $address);
122 122
 
123
-	$output = give_connect_user_donor_profile( $donor, $donor_data, $address );
123
+	$output = give_connect_user_donor_profile($donor, $donor_data, $address);
124 124
 
125
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
126
-		header( 'Content-Type: application/json' );
127
-		echo json_encode( $output );
125
+	if (defined('DOING_AJAX') && DOING_AJAX) {
126
+		header('Content-Type: application/json');
127
+		echo json_encode($output);
128 128
 		wp_die();
129 129
 	}
130 130
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 }
134 134
 
135
-add_action( 'give_edit-donor', 'give_edit_donor', 10, 1 );
135
+add_action('give_edit-donor', 'give_edit_donor', 10, 1);
136 136
 
137 137
 /**
138 138
  * Save a donor note.
@@ -143,40 +143,40 @@  discard block
 block discarded – undo
143 143
  *
144 144
  * @return int         The Note ID that was saved, or 0 if nothing was saved.
145 145
  */
146
-function give_donor_save_note( $args ) {
146
+function give_donor_save_note($args) {
147 147
 
148
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
148
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
149 149
 
150
-	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
151
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
150
+	if ( ! is_admin() || ! current_user_can($donor_view_role)) {
151
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
152 152
 			'response' => 403,
153
-		) );
153
+		));
154 154
 	}
155 155
 
156
-	if ( empty( $args ) ) {
156
+	if (empty($args)) {
157 157
 		return false;
158 158
 	}
159 159
 
160
-	$donor_note = trim( sanitize_text_field( $args['donor_note'] ) );
160
+	$donor_note = trim(sanitize_text_field($args['donor_note']));
161 161
 	$donor_id   = (int) $args['customer_id'];
162 162
 	$nonce      = $args['add_donor_note_nonce'];
163 163
 
164
-	if ( ! wp_verify_nonce( $nonce, 'add-donor-note' ) ) {
165
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
164
+	if ( ! wp_verify_nonce($nonce, 'add-donor-note')) {
165
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
166 166
 			'response' => 400,
167
-		) );
167
+		));
168 168
 	}
169 169
 
170
-	if ( empty( $donor_note ) ) {
171
-		give_set_error( 'empty-donor-note', __( 'A note is required.', 'give' ) );
170
+	if (empty($donor_note)) {
171
+		give_set_error('empty-donor-note', __('A note is required.', 'give'));
172 172
 	}
173 173
 
174
-	if ( give_get_errors() ) {
174
+	if (give_get_errors()) {
175 175
 		return false;
176 176
 	}
177 177
 
178
-	$donor    = new Give_Donor( $donor_id );
179
-	$new_note = $donor->add_note( $donor_note );
178
+	$donor    = new Give_Donor($donor_id);
179
+	$new_note = $donor->add_note($donor_note);
180 180
 
181 181
 	/**
182 182
 	 * Fires before inserting donor note.
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
 	 * @param int    $donor_id The ID of the donor.
187 187
 	 * @param string $new_note Note content.
188 188
 	 */
189
-	do_action( 'give_pre_insert_donor_note', $donor_id, $new_note );
189
+	do_action('give_pre_insert_donor_note', $donor_id, $new_note);
190 190
 
191
-	if ( ! empty( $new_note ) && ! empty( $donor->id ) ) {
191
+	if ( ! empty($new_note) && ! empty($donor->id)) {
192 192
 
193 193
 		ob_start();
194 194
 		?>
195 195
 		<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
196 196
 			<span class="note-content-wrap">
197
-				<?php echo stripslashes( $new_note ); ?>
197
+				<?php echo stripslashes($new_note); ?>
198 198
 			</span>
199 199
 		</div>
200 200
 		<?php
201 201
 		$output = ob_get_contents();
202 202
 		ob_end_clean();
203 203
 
204
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
204
+		if (defined('DOING_AJAX') && DOING_AJAX) {
205 205
 			echo $output;
206 206
 			exit;
207 207
 		}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 }
216 216
 
217
-add_action( 'give_add-donor-note', 'give_donor_save_note', 10, 1 );
217
+add_action('give_add-donor-note', 'give_donor_save_note', 10, 1);
218 218
 
219 219
 /**
220 220
  * Delete a donor.
@@ -225,41 +225,41 @@  discard block
 block discarded – undo
225 225
  *
226 226
  * @return int Whether it was a successful deletion.
227 227
  */
228
-function give_donor_delete( $args ) {
228
+function give_donor_delete($args) {
229 229
 
230
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
230
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
231 231
 
232
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
233
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
232
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
233
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
234 234
 			'response' => 403,
235
-		) );
235
+		));
236 236
 	}
237 237
 
238
-	if ( empty( $args ) ) {
238
+	if (empty($args)) {
239 239
 		return false;
240 240
 	}
241 241
 
242 242
 	$donor_id    = (int) $args['customer_id'];
243
-	$confirm     = ! empty( $args['give-donor-delete-confirm'] ) ? true : false;
244
-	$remove_data = ! empty( $args['give-donor-delete-records'] ) ? true : false;
243
+	$confirm     = ! empty($args['give-donor-delete-confirm']) ? true : false;
244
+	$remove_data = ! empty($args['give-donor-delete-records']) ? true : false;
245 245
 	$nonce       = $args['_wpnonce'];
246 246
 
247
-	if ( ! wp_verify_nonce( $nonce, 'delete-donor' ) ) {
248
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
247
+	if ( ! wp_verify_nonce($nonce, 'delete-donor')) {
248
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
249 249
 			'response' => 400,
250
-		) );
250
+		));
251 251
 	}
252 252
 
253
-	if ( ! $confirm ) {
254
-		give_set_error( 'donor-delete-no-confirm', __( 'Please confirm you want to delete this donor.', 'give' ) );
253
+	if ( ! $confirm) {
254
+		give_set_error('donor-delete-no-confirm', __('Please confirm you want to delete this donor.', 'give'));
255 255
 	}
256 256
 
257
-	if ( give_get_errors() ) {
258
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id ) );
257
+	if (give_get_errors()) {
258
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id));
259 259
 		exit;
260 260
 	}
261 261
 
262
-	$donor = new Give_Donor( $donor_id );
262
+	$donor = new Give_Donor($donor_id);
263 263
 
264 264
 	/**
265 265
 	 * Fires before deleting donor.
@@ -270,50 +270,50 @@  discard block
 block discarded – undo
270 270
 	 * @param bool $confirm     Delete confirmation.
271 271
 	 * @param bool $remove_data Records delete confirmation.
272 272
 	 */
273
-	do_action( 'give_pre_delete_donor', $donor_id, $confirm, $remove_data );
273
+	do_action('give_pre_delete_donor', $donor_id, $confirm, $remove_data);
274 274
 
275
-	if ( $donor->id > 0 ) {
275
+	if ($donor->id > 0) {
276 276
 
277
-		$payments_array = explode( ',', $donor->payment_ids );
278
-		$success        = Give()->donors->delete( $donor->id );
277
+		$payments_array = explode(',', $donor->payment_ids);
278
+		$success        = Give()->donors->delete($donor->id);
279 279
 
280
-		if ( $success ) {
280
+		if ($success) {
281 281
 
282
-			if ( $remove_data ) {
282
+			if ($remove_data) {
283 283
 
284 284
 				// Remove all donations, logs, etc.
285
-				foreach ( $payments_array as $payment_id ) {
286
-					give_delete_donation( $payment_id );
285
+				foreach ($payments_array as $payment_id) {
286
+					give_delete_donation($payment_id);
287 287
 				}
288 288
 			} else {
289 289
 
290 290
 				// Just set the donations to customer_id of 0.
291
-				foreach ( $payments_array as $payment_id ) {
292
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
291
+				foreach ($payments_array as $payment_id) {
292
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
293 293
 				}
294 294
 			}
295 295
 
296
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted' );
296
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted');
297 297
 
298 298
 		} else {
299 299
 
300
-			give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor.', 'give' ) );
301
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor_id );
300
+			give_set_error('give-donor-delete-failed', __('Error deleting donor.', 'give'));
301
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor_id);
302 302
 
303 303
 		}
304 304
 	} else {
305 305
 
306
-		give_set_error( 'give-donor-delete-invalid-id', __( 'Invalid Donor ID.', 'give' ) );
307
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
306
+		give_set_error('give-donor-delete-invalid-id', __('Invalid Donor ID.', 'give'));
307
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
308 308
 
309 309
 	}
310 310
 
311
-	wp_redirect( $redirect );
311
+	wp_redirect($redirect);
312 312
 	exit;
313 313
 
314 314
 }
315 315
 
316
-add_action( 'give_delete-donor', 'give_donor_delete', 10, 1 );
316
+add_action('give_delete-donor', 'give_donor_delete', 10, 1);
317 317
 
318 318
 /**
319 319
  * Disconnect a user ID from a donor
@@ -324,17 +324,17 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @return bool|array        If the disconnect was successful.
326 326
  */
327
-function give_disconnect_donor_user_id( $args ) {
327
+function give_disconnect_donor_user_id($args) {
328 328
 
329
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
329
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
330 330
 
331
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
332
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
331
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
332
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
333 333
 			'response' => 403,
334
-		) );
334
+		));
335 335
 	}
336 336
 
337
-	if ( empty( $args ) ) {
337
+	if (empty($args)) {
338 338
 		return false;
339 339
 	}
340 340
 
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 
343 343
 	$nonce = $args['_wpnonce'];
344 344
 
345
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
346
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
345
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
346
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
347 347
 			'response' => 400,
348
-		) );
348
+		));
349 349
 	}
350 350
 
351
-	$donor = new Give_Donor( $donor_id );
352
-	if ( empty( $donor->id ) ) {
351
+	$donor = new Give_Donor($donor_id);
352
+	if (empty($donor->id)) {
353 353
 		return false;
354 354
 	}
355 355
 
@@ -363,34 +363,34 @@  discard block
 block discarded – undo
363 363
 	 * @param int $donor_id The ID of the donor.
364 364
 	 * @param int $user_id  The ID of the user.
365 365
 	 */
366
-	do_action( 'give_pre_donor_disconnect_user_id', $donor_id, $user_id );
366
+	do_action('give_pre_donor_disconnect_user_id', $donor_id, $user_id);
367 367
 
368 368
 	$output     = array();
369 369
 	$donor_args = array(
370 370
 		'user_id' => 0,
371 371
 	);
372 372
 
373
-	if ( $donor->update( $donor_args ) ) {
373
+	if ($donor->update($donor_args)) {
374 374
 		global $wpdb;
375 375
 
376
-		if ( ! empty( $donor->payment_ids ) ) {
377
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $donor->payment_ids )" );
376
+		if ( ! empty($donor->payment_ids)) {
377
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $donor->payment_ids )");
378 378
 		}
379 379
 
380 380
 		// Set Donor Disconnection status true, if user and donor are disconnected with each other.
381
-		update_user_meta( $user_id, '_give_is_donor_disconnected', true );
382
-		update_user_meta( $user_id, '_give_disconnected_donor_id', $donor->id );
383
-		$donor->update_meta( '_give_disconnected_user_id', $user_id );
381
+		update_user_meta($user_id, '_give_is_donor_disconnected', true);
382
+		update_user_meta($user_id, '_give_disconnected_donor_id', $donor->id);
383
+		$donor->update_meta('_give_disconnected_user_id', $user_id);
384 384
 
385 385
 		$output['success'] = true;
386 386
 
387 387
 	} else {
388 388
 
389 389
 		$output['success'] = false;
390
-		give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor.', 'give' ) );
390
+		give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor.', 'give'));
391 391
 	}
392 392
 
393
-	$output['redirect'] = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' ) . $donor_id;
393
+	$output['redirect'] = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=').$donor_id;
394 394
 
395 395
 	/**
396 396
 	 * Fires after disconnecting user ID from a donor.
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
 	 *
400 400
 	 * @param int $donor_id The ID of the donor.
401 401
 	 */
402
-	do_action( 'give_post_donor_disconnect_user_id', $donor_id );
402
+	do_action('give_post_donor_disconnect_user_id', $donor_id);
403 403
 
404
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
405
-		header( 'Content-Type: application/json' );
406
-		echo json_encode( $output );
404
+	if (defined('DOING_AJAX') && DOING_AJAX) {
405
+		header('Content-Type: application/json');
406
+		echo json_encode($output);
407 407
 		wp_die();
408 408
 	}
409 409
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 
412 412
 }
413 413
 
414
-add_action( 'give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1 );
414
+add_action('give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1);
415 415
 
416 416
 /**
417 417
  * Add an email address to the donor from within the admin and log a donor note.
@@ -422,90 +422,90 @@  discard block
 block discarded – undo
422 422
  *
423 423
  * @return mixed        If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string).
424 424
  */
425
-function give_add_donor_email( $args ) {
425
+function give_add_donor_email($args) {
426 426
 	/**
427 427
 	 * Define variable
428 428
 	 *
429 429
 	 * @since 1.8.14
430 430
 	 */
431 431
 	$donor_id = '';
432
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
432
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
433 433
 
434
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
435
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
434
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
435
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
436 436
 			'response' => 403,
437
-		) );
437
+		));
438 438
 	}
439 439
 
440 440
 	$output = array();
441
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
441
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
442 442
 		$output['success'] = false;
443
-		if ( empty( $args['email'] ) ) {
444
-			$output['message'] = __( 'Email address is required.', 'give' );
445
-		} elseif ( empty( $args['customer_id'] ) ) {
446
-			$output['message'] = __( 'Donor ID is required.', 'give' );
443
+		if (empty($args['email'])) {
444
+			$output['message'] = __('Email address is required.', 'give');
445
+		} elseif (empty($args['customer_id'])) {
446
+			$output['message'] = __('Donor ID is required.', 'give');
447 447
 		} else {
448
-			$output['message'] = __( 'An error has occurred. Please try again.', 'give' );
448
+			$output['message'] = __('An error has occurred. Please try again.', 'give');
449 449
 		}
450
-	} elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
450
+	} elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
451 451
 		$output = array(
452 452
 			'success' => false,
453
-			'message' => __( 'Nonce verification failed.', 'give' ),
453
+			'message' => __('Nonce verification failed.', 'give'),
454 454
 		);
455
-	} elseif ( ! is_email( $args['email'] ) ) {
455
+	} elseif ( ! is_email($args['email'])) {
456 456
 		$output = array(
457 457
 			'success' => false,
458
-			'message' => __( 'Invalid email.', 'give' ),
458
+			'message' => __('Invalid email.', 'give'),
459 459
 		);
460 460
 	} else {
461
-		$email    = sanitize_email( $args['email'] );
461
+		$email    = sanitize_email($args['email']);
462 462
 		$donor_id = (int) $args['customer_id'];
463 463
 		$primary  = 'true' === $args['primary'] ? true : false;
464
-		$donor    = new Give_Donor( $donor_id );
465
-		if ( false === $donor->add_email( $email, $primary ) ) {
466
-			if ( in_array( $email, $donor->emails ) ) {
464
+		$donor    = new Give_Donor($donor_id);
465
+		if (false === $donor->add_email($email, $primary)) {
466
+			if (in_array($email, $donor->emails)) {
467 467
 				$output = array(
468 468
 					'success' => false,
469
-					'message' => __( 'Email already associated with this donor.', 'give' ),
469
+					'message' => __('Email already associated with this donor.', 'give'),
470 470
 				);
471 471
 			} else {
472 472
 				$output = array(
473 473
 					'success' => false,
474
-					'message' => __( 'Email address is already associated with another donor.', 'give' ),
474
+					'message' => __('Email address is already associated with another donor.', 'give'),
475 475
 				);
476 476
 			}
477 477
 		} else {
478
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&give-message=email-added' );
478
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&give-message=email-added');
479 479
 			$output   = array(
480 480
 				'success'  => true,
481
-				'message'  => __( 'Email successfully added to donor.', 'give' ),
481
+				'message'  => __('Email successfully added to donor.', 'give'),
482 482
 				'redirect' => $redirect,
483 483
 			);
484 484
 
485 485
 			$user       = wp_get_current_user();
486
-			$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
487
-			$donor_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login );
488
-			$donor->add_note( $donor_note );
486
+			$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
487
+			$donor_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login);
488
+			$donor->add_note($donor_note);
489 489
 
490
-			if ( $primary ) {
491
-				$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login );
492
-				$donor->add_note( $donor_note );
490
+			if ($primary) {
491
+				$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login);
492
+				$donor->add_note($donor_note);
493 493
 			}
494 494
 		}
495 495
 	}// End if().
496 496
 
497
-	do_action( 'give_post_add_donor_email', $donor_id, $args );
497
+	do_action('give_post_add_donor_email', $donor_id, $args);
498 498
 
499
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
500
-		header( 'Content-Type: application/json' );
501
-		echo json_encode( $output );
499
+	if (defined('DOING_AJAX') && DOING_AJAX) {
500
+		header('Content-Type: application/json');
501
+		echo json_encode($output);
502 502
 		wp_die();
503 503
 	}
504 504
 
505 505
 	return $output;
506 506
 }
507 507
 
508
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
508
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
509 509
 
510 510
 
511 511
 /**
@@ -515,39 +515,39 @@  discard block
 block discarded – undo
515 515
  * @return bool|null
516 516
  */
517 517
 function give_remove_donor_email() {
518
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
518
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
519 519
 		return false;
520 520
 	}
521
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
521
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
522 522
 		return false;
523 523
 	}
524
-	if ( empty( $_GET['_wpnonce'] ) ) {
524
+	if (empty($_GET['_wpnonce'])) {
525 525
 		return false;
526 526
 	}
527 527
 
528 528
 	$nonce = $_GET['_wpnonce'];
529
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
530
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
529
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
530
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
531 531
 			'response' => 403,
532
-		) );
532
+		));
533 533
 	}
534 534
 
535
-	$donor = new Give_Donor( $_GET['id'] );
536
-	if ( $donor->remove_email( $_GET['email'] ) ) {
537
-		$url        = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
535
+	$donor = new Give_Donor($_GET['id']);
536
+	if ($donor->remove_email($_GET['email'])) {
537
+		$url        = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
538 538
 		$user       = wp_get_current_user();
539
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
540
-		$donor_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login );
541
-		$donor->add_note( $donor_note );
539
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
540
+		$donor_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login);
541
+		$donor->add_note($donor_note);
542 542
 	} else {
543
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
543
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
544 544
 	}
545 545
 
546
-	wp_safe_redirect( $url );
546
+	wp_safe_redirect($url);
547 547
 	exit;
548 548
 }
549 549
 
550
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
550
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
551 551
 
552 552
 
553 553
 /**
@@ -558,41 +558,41 @@  discard block
 block discarded – undo
558 558
  * @return bool|null
559 559
  */
560 560
 function give_set_donor_primary_email() {
561
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
561
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
562 562
 		return false;
563 563
 	}
564 564
 
565
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
565
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
566 566
 		return false;
567 567
 	}
568 568
 
569
-	if ( empty( $_GET['_wpnonce'] ) ) {
569
+	if (empty($_GET['_wpnonce'])) {
570 570
 		return false;
571 571
 	}
572 572
 
573 573
 	$nonce = $_GET['_wpnonce'];
574 574
 
575
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
576
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
575
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
576
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
577 577
 			'response' => 403,
578
-		) );
578
+		));
579 579
 	}
580 580
 
581
-	$donor = new Give_Donor( $_GET['id'] );
581
+	$donor = new Give_Donor($_GET['id']);
582 582
 
583
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
584
-		$url        = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
583
+	if ($donor->set_primary_email($_GET['email'])) {
584
+		$url        = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
585 585
 		$user       = wp_get_current_user();
586
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
587
-		$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login );
586
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
587
+		$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login);
588 588
 
589
-		$donor->add_note( $donor_note );
589
+		$donor->add_note($donor_note);
590 590
 	} else {
591
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
591
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
592 592
 	}
593 593
 
594
-	wp_safe_redirect( $url );
594
+	wp_safe_redirect($url);
595 595
 	exit;
596 596
 }
597 597
 
598
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
598
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
Please login to merge, or discard this patch.