Completed
Pull Request — master (#1637)
by Ravinder
16:50
created
includes/admin/admin-pages.php 1 patch
Spacing   +99 added lines, -99 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
 
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page;
34 34
 
35 35
 	//Payments
36
-	$give_payment       = get_post_type_object( 'give_payment' );
37
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
36
+	$give_payment       = get_post_type_object('give_payment');
37
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
38 38
 
39 39
 	//Donors
40
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' );
40
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page');
41 41
 
42 42
 	//Reports`
43 43
 	$give_reports_page = add_submenu_page(
44 44
 		'edit.php?post_type=give_forms',
45
-		esc_html__( 'Donation Reports', 'give' ),
46
-		esc_html__( 'Reports', 'give' ),
45
+		esc_html__('Donation Reports', 'give'),
46
+		esc_html__('Reports', 'give'),
47 47
 		'view_give_reports',
48 48
 		'give-reports',
49 49
 		array(
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	//Settings
56 56
 	$give_settings_page = add_submenu_page(
57 57
 		'edit.php?post_type=give_forms',
58
-		esc_html__( 'Give Settings', 'give' ),
59
-		esc_html__( 'Settings', 'give' ),
58
+		esc_html__('Give Settings', 'give'),
59
+		esc_html__('Settings', 'give'),
60 60
 		'manage_give_settings',
61 61
 		'give-settings',
62 62
 		array(
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	);
67 67
 
68 68
 	//Tools.
69
-	$give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array(
69
+	$give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array(
70 70
 		Give()->give_settings,
71 71
 		'output'
72
-	) );
72
+	));
73 73
 
74 74
 	//Add-ons
75
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
75
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
76 76
 
77 77
 	//Upgrades
78
-	$give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' );
78
+	$give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen');
79 79
 
80 80
 
81 81
 }
82 82
 
83
-add_action( 'admin_menu', 'give_add_options_links', 10 );
83
+add_action('admin_menu', 'give_add_options_links', 10);
84 84
 
85 85
 /**
86 86
  *  Determines whether the current admin page is a Give admin page.
@@ -95,224 +95,224 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @return bool True if Give admin page.
97 97
  */
98
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
98
+function give_is_admin_page($passed_page = '', $passed_view = '') {
99 99
 
100 100
 	global $pagenow, $typenow;
101 101
 
102 102
 	$found     = false;
103
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
104
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
105
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
106
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
107
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
108
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
109
-
110
-	switch ( $passed_page ) {
103
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
104
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
105
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
106
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
107
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
108
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
109
+
110
+	switch ($passed_page) {
111 111
 		case 'give_forms':
112
-			switch ( $passed_view ) {
112
+			switch ($passed_view) {
113 113
 				case 'list-table':
114
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
114
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
115 115
 						$found = true;
116 116
 					}
117 117
 					break;
118 118
 				case 'edit':
119
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
119
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
120 120
 						$found = true;
121 121
 					}
122 122
 					break;
123 123
 				case 'new':
124
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
124
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
125 125
 						$found = true;
126 126
 					}
127 127
 					break;
128 128
 				default:
129
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
129
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
130 130
 						$found = true;
131 131
 					}
132 132
 					break;
133 133
 			}
134 134
 			break;
135 135
 		case 'categories':
136
-			switch ( $passed_view ) {
136
+			switch ($passed_view) {
137 137
 				case 'list-table':
138 138
 				case 'new':
139
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
139
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
140 140
 						$found = true;
141 141
 					}
142 142
 					break;
143 143
 				case 'edit':
144
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
144
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
145 145
 						$found = true;
146 146
 					}
147 147
 					break;
148 148
 				default:
149
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
149
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
150 150
 						$found = true;
151 151
 					}
152 152
 					break;
153 153
 			}
154 154
 			break;
155 155
 		case 'tags':
156
-			switch ( $passed_view ) {
156
+			switch ($passed_view) {
157 157
 				case 'list-table':
158 158
 				case 'new':
159
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
159
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
160 160
 						$found = true;
161 161
 					}
162 162
 					break;
163 163
 				case 'edit':
164
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
164
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
165 165
 						$found = true;
166 166
 					}
167 167
 					break;
168 168
 				default:
169
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
169
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
170 170
 						$found = true;
171 171
 					}
172 172
 					break;
173 173
 			}
174 174
 			break;
175 175
 		case 'payments':
176
-			switch ( $passed_view ) {
176
+			switch ($passed_view) {
177 177
 				case 'list-table':
178
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
178
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
179 179
 						$found = true;
180 180
 					}
181 181
 					break;
182 182
 				case 'edit':
183
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) {
183
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) {
184 184
 						$found = true;
185 185
 					}
186 186
 					break;
187 187
 				default:
188
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
188
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
189 189
 						$found = true;
190 190
 					}
191 191
 					break;
192 192
 			}
193 193
 			break;
194 194
 		case 'reports':
195
-			switch ( $passed_view ) {
195
+			switch ($passed_view) {
196 196
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
197 197
 				case 'earnings':
198
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
198
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
199 199
 						$found = true;
200 200
 					}
201 201
 					break;
202 202
 				case 'donors':
203
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
203
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
204 204
 						$found = true;
205 205
 					}
206 206
 					break;
207 207
 				case 'gateways':
208
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
208
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
209 209
 						$found = true;
210 210
 					}
211 211
 					break;
212 212
 				case 'export':
213
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
213
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
214 214
 						$found = true;
215 215
 					}
216 216
 					break;
217 217
 				case 'logs':
218
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
218
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
219 219
 						$found = true;
220 220
 					}
221 221
 					break;
222 222
 				default:
223
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
223
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
224 224
 						$found = true;
225 225
 					}
226 226
 					break;
227 227
 			}
228 228
 			break;
229 229
 		case 'settings':
230
-			switch ( $passed_view ) {
230
+			switch ($passed_view) {
231 231
 				case 'general':
232
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
232
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
233 233
 						$found = true;
234 234
 					}
235 235
 					break;
236 236
 				case 'gateways':
237
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
237
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
238 238
 						$found = true;
239 239
 					}
240 240
 					break;
241 241
 				case 'emails':
242
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
242
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
243 243
 						$found = true;
244 244
 					}
245 245
 					break;
246 246
 				case 'display':
247
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
247
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
248 248
 						$found = true;
249 249
 					}
250 250
 					break;
251 251
 				case 'licenses':
252
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
252
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
253 253
 						$found = true;
254 254
 					}
255 255
 					break;
256 256
 				case 'api':
257
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
257
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
258 258
 						$found = true;
259 259
 					}
260 260
 					break;
261 261
 				case 'advanced':
262
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
262
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
263 263
 						$found = true;
264 264
 					}
265 265
 					break;
266 266
 				case 'system_info':
267
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
267
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
268 268
 						$found = true;
269 269
 					}
270 270
 					break;
271 271
 				default:
272
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
272
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
273 273
 						$found = true;
274 274
 					}
275 275
 					break;
276 276
 			}
277 277
 			break;
278 278
 		case 'addons':
279
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
279
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
280 280
 				$found = true;
281 281
 			}
282 282
 			break;
283 283
 		case 'donors':
284
-			switch ( $passed_view ) {
284
+			switch ($passed_view) {
285 285
 				case 'list-table':
286
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
286
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
287 287
 						$found = true;
288 288
 					}
289 289
 					break;
290 290
 				case 'overview':
291
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
291
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
292 292
 						$found = true;
293 293
 					}
294 294
 					break;
295 295
 				case 'notes':
296
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
296
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
297 297
 						$found = true;
298 298
 					}
299 299
 					break;
300 300
 				default:
301
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
301
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
302 302
 						$found = true;
303 303
 					}
304 304
 					break;
305 305
 			}
306 306
 			break;
307 307
 		case 'reports':
308
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
308
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
309 309
 				$found = true;
310 310
 			}
311 311
 			break;
312 312
 		default:
313 313
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page, $give_tools_page;
314 314
 
315
-			$admin_pages = apply_filters( 'give_admin_pages', array(
315
+			$admin_pages = apply_filters('give_admin_pages', array(
316 316
 				$give_payments_page,
317 317
 				$give_settings_page,
318 318
 				$give_reports_page,
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
 				$give_customers_page,
324 324
 				$give_tools_page,
325 325
 				'widgets.php'
326
-		) );
327
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
326
+		));
327
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
328 328
 				$found = true;
329
-				if ( 'give-upgrades' === $page ) {
329
+				if ('give-upgrades' === $page) {
330 330
 					$found = false;
331 331
 				}
332
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
332
+			} elseif (in_array($pagenow, $admin_pages)) {
333 333
 				$found = true;
334 334
 			}
335 335
 			break;
336 336
 	}
337 337
 
338
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
338
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
339 339
 
340 340
 }
341 341
 
@@ -347,37 +347,37 @@  discard block
 block discarded – undo
347 347
  * @param  array $settings
348 348
  * @return array
349 349
  */
350
-function give_settings_page_pages( $settings ) {
351
-	include( 'abstract-admin-settings-page.php' );
352
-	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
350
+function give_settings_page_pages($settings) {
351
+	include('abstract-admin-settings-page.php');
352
+	include('settings/class-settings-cmb2-backward-compatibility.php');
353 353
 
354 354
 	$settings = array(
355 355
 		// General settings.
356
-		include( 'settings/class-settings-general.php' ),
356
+		include('settings/class-settings-general.php'),
357 357
 
358 358
 		// Payment Gateways Settings.
359
-		include( 'settings/class-settings-gateways.php' ),
359
+		include('settings/class-settings-gateways.php'),
360 360
 
361 361
 		// Display settings.
362
-		include( 'settings/class-settings-display.php' ),
362
+		include('settings/class-settings-display.php'),
363 363
 
364 364
 		// Emails settings.
365
-		include( 'settings/class-settings-email.php' ),
365
+		include('settings/class-settings-email.php'),
366 366
 
367 367
 		// Addons settings.
368
-		include( 'settings/class-settings-addon.php' ),
368
+		include('settings/class-settings-addon.php'),
369 369
 
370 370
 		// License settings.
371
-		include( 'settings/class-settings-license.php' ),
371
+		include('settings/class-settings-license.php'),
372 372
 
373 373
 		// Advanced settinns.
374
-		include( 'settings/class-settings-advanced.php' )
374
+		include('settings/class-settings-advanced.php')
375 375
 	);
376 376
 
377 377
 	// Output.
378 378
 	return $settings;
379 379
 }
380
-add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
380
+add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1);
381 381
 
382 382
 
383 383
 /**
@@ -387,30 +387,30 @@  discard block
 block discarded – undo
387 387
  * @param  array $settings
388 388
  * @return array
389 389
  */
390
-function give_reports_page_pages( $settings ) {
391
-	include( 'abstract-admin-settings-page.php' );
390
+function give_reports_page_pages($settings) {
391
+	include('abstract-admin-settings-page.php');
392 392
 
393 393
 	$settings = array(
394 394
 		// Earnings.
395
-		include( 'reporting/class-settings-earnings.php' ),
395
+		include('reporting/class-settings-earnings.php'),
396 396
 
397 397
 		// Forms.
398
-		include( 'reporting/class-settings-forms.php' ),
398
+		include('reporting/class-settings-forms.php'),
399 399
 
400 400
 		// Donors.
401
-		include( 'reporting/class-settings-donors.php' ),
401
+		include('reporting/class-settings-donors.php'),
402 402
 
403 403
 		// Gateways.
404
-		include( 'reporting/class-settings-gateways.php' ),
404
+		include('reporting/class-settings-gateways.php'),
405 405
 
406 406
 		// Export.
407
-		include( 'reporting/class-settings-export.php' ),
407
+		include('reporting/class-settings-export.php'),
408 408
 	);
409 409
 
410 410
 	// Output.
411 411
 	return $settings;
412 412
 }
413
-add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 );
413
+add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1);
414 414
 
415 415
 /**
416 416
  * Add setting tab to give-settings page
@@ -419,27 +419,27 @@  discard block
 block discarded – undo
419 419
  * @param  array $settings
420 420
  * @return array
421 421
  */
422
-function give_tools_page_pages( $settings ) {
423
-	include( 'abstract-admin-settings-page.php' );
422
+function give_tools_page_pages($settings) {
423
+	include('abstract-admin-settings-page.php');
424 424
 
425 425
 	$settings = array(
426 426
 		// System Info.
427
-		include( 'tools/class-settings-system-info.php' ),
427
+		include('tools/class-settings-system-info.php'),
428 428
 
429 429
 		// Logs.
430
-		include( 'tools/class-settings-logs.php' ),
430
+		include('tools/class-settings-logs.php'),
431 431
 
432 432
 		// API.
433
-		include( 'tools/class-settings-api.php' ),
433
+		include('tools/class-settings-api.php'),
434 434
 
435 435
 		// Data.
436
-		include( 'tools/class-settings-data.php' ),
436
+		include('tools/class-settings-data.php'),
437 437
 	);
438 438
 
439 439
 	// Output.
440 440
 	return $settings;
441 441
 }
442
-add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
442
+add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1);
443 443
 
444 444
 /**
445 445
  * Set default tools page tab.
@@ -448,10 +448,10 @@  discard block
 block discarded – undo
448 448
  * @param  string $default_tab Default tab name.
449 449
  * @return string
450 450
  */
451
-function give_set_default_tab_form_tools_page( $default_tab ) {
451
+function give_set_default_tab_form_tools_page($default_tab) {
452 452
 	return 'system-info';
453 453
 }
454
-add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
454
+add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1);
455 455
 
456 456
 
457 457
 /**
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
  * @param  string $default_tab Default tab name.
462 462
  * @return string
463 463
  */
464
-function give_set_default_tab_form_reports_page( $default_tab ) {
464
+function give_set_default_tab_form_reports_page($default_tab) {
465 465
 	return 'earnings';
466 466
 }
467
-add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 );
468 467
\ No newline at end of file
468
+add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1);
469 469
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-advanced.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@
 block discarded – undo
87 87
 								'disabled' => __( 'Head', 'give' ),
88 88
 							)
89 89
 						),
90
-                        array(
91
-                            'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
92
-                            'id'    => 'advanced_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
-                            'title' => __( 'Advanced Settings', 'give' ),
95
-                            'type'  => 'give_docs_link',
96
-                        ),
90
+						array(
91
+							'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
92
+							'id'    => 'advanced_settings_docs_link',
93
+							'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
+							'title' => __( 'Advanced Settings', 'give' ),
95
+							'type'  => 'give_docs_link',
96
+						),
97 97
 						array(
98 98
 							'id'   => 'give_title_data_control_2',
99 99
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Advanced' ) ) :
16
+if ( ! class_exists('Give_Settings_Advanced')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Advanced.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'advanced';
30
-			$this->label = esc_html__( 'Advanced', 'give' );
30
+			$this->label = esc_html__('Advanced', 'give');
31 31
 
32 32
 			$this->default_tab = 'advanced-options';
33 33
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 			$current_section = give_get_current_setting_section();
47 47
 
48
-			switch ( $current_section ) {
48
+			switch ($current_section) {
49 49
 				case 'advanced-options':
50 50
 					$settings = array(
51 51
 						array(
@@ -53,45 +53,45 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => esc_html__( 'Remove Data on Uninstall', 'give' ),
57
-							'desc'    => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ),
56
+							'name'    => esc_html__('Remove Data on Uninstall', 'give'),
57
+							'desc'    => esc_html__('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'),
58 58
 							'id'      => 'uninstall_on_delete',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'disabled',
61 61
 							'options' => array(
62
-								'enabled'  => __( 'Yes, Remove all data', 'give' ),
63
-								'disabled' => __( 'No, keep my Give settings and donation data this time', 'give' ),
62
+								'enabled'  => __('Yes, Remove all data', 'give'),
63
+								'disabled' => __('No, keep my Give settings and donation data this time', 'give'),
64 64
 							)
65 65
 						),
66 66
 						array(
67 67
 							/* translators: %s: the_content */
68
-							'name'    => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ),
68
+							'name'    => sprintf(__('%s filter', 'give'), '<code>the_content</code>'),
69 69
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
70
-							'desc'    => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
70
+							'desc'    => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
71 71
 							'id'      => 'the_content_filter',
72 72
 							'default' => 'enabled',
73 73
 							'type'    => 'radio_inline',
74 74
 							'options' => array(
75
-								'enabled'  => __( 'Enabled', 'give' ),
76
-								'disabled' => __( 'Disabled', 'give' ),
75
+								'enabled'  => __('Enabled', 'give'),
76
+								'disabled' => __('Disabled', 'give'),
77 77
 							)
78 78
 						),
79 79
 						array(
80
-							'name'    => esc_html__( 'Script Loading Location', 'give' ),
81
-							'desc'    => __( 'This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give' ),
80
+							'name'    => esc_html__('Script Loading Location', 'give'),
81
+							'desc'    => __('This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give'),
82 82
 							'id'      => 'scripts_footer',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'disabled',
85 85
 							'options' => array(
86
-								'enabled'  => __( 'Footer', 'give' ),
87
-								'disabled' => __( 'Head', 'give' ),
86
+								'enabled'  => __('Footer', 'give'),
87
+								'disabled' => __('Head', 'give'),
88 88
 							)
89 89
 						),
90 90
                         array(
91
-                            'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
91
+                            'name'  => esc_html__('Advanced Settings Docs Link', 'give'),
92 92
                             'id'    => 'advanced_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
-                            'title' => __( 'Advanced Settings', 'give' ),
93
+                            'url'   => esc_url('http://docs.givewp.com/settings-advanced'),
94
+                            'title' => __('Advanced Settings', 'give'),
95 95
                             'type'  => 'give_docs_link',
96 96
                         ),
97 97
 						array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			 * Filter the advanced settings.
108 108
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
109 109
 			 */
110
-			$settings = apply_filters( 'give_settings_advanced', $settings );
110
+			$settings = apply_filters('give_settings_advanced', $settings);
111 111
 
112 112
 			/**
113 113
 			 * Filter the settings.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			 *
117 117
 			 * @param  array $settings
118 118
 			 */
119
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
119
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
120 120
 
121 121
 			// Output.
122 122
 			return $settings;
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 		 */
131 131
 		public function get_sections() {
132 132
 			$sections = array(
133
-				'advanced-options' => esc_html__( 'Advanced Options', 'give' )
133
+				'advanced-options' => esc_html__('Advanced Options', 'give')
134 134
 			);
135 135
 
136
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
136
+			return apply_filters('give_get_sections_'.$this->id, $sections);
137 137
 		}
138 138
 	}
139 139
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-general.php 2 patches
Spacing   +64 added lines, -64 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_General' ) ) :
16
+if ( ! class_exists('Give_Settings_General')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_General.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'general';
30
-			$this->label = esc_html__( 'General', 'give' );
30
+			$this->label = esc_html__('General', 'give');
31 31
 
32 32
 			$this->default_tab = 'general-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 'access-control':
49 49
 					$settings = array(
50 50
 						// Section 3: Access control.
@@ -54,47 +54,47 @@  discard block
 block discarded – undo
54 54
 						),
55 55
 						array(
56 56
 							'id'      => 'session_lifetime',
57
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
58
-							'desc'    => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
57
+							'name'    => esc_html__('Session Lifetime', 'give'),
58
+							'desc'    => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
59 59
 							'type'    => 'select',
60 60
 							'options' => array(
61
-								'86400'  => esc_html__( '24 Hours', 'give' ),
62
-								'172800' => esc_html__( '48 Hours', 'give' ),
63
-								'259200' => esc_html__( '72 Hours', 'give' ),
64
-								'604800' => esc_html__( '1 Week', 'give' ),
61
+								'86400'  => esc_html__('24 Hours', 'give'),
62
+								'172800' => esc_html__('48 Hours', 'give'),
63
+								'259200' => esc_html__('72 Hours', 'give'),
64
+								'604800' => esc_html__('1 Week', 'give'),
65 65
 							)
66 66
 						),
67 67
 						array(
68
-							'name'    => esc_html__( 'Email Access', 'give' ),
69
-							'desc'    => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
68
+							'name'    => esc_html__('Email Access', 'give'),
69
+							'desc'    => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
70 70
 							'id'      => 'email_access',
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 79
 							'id'      => 'recaptcha_key',
80
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
80
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
81 81
 							/* translators: %s: https://www.google.com/recaptcha/ */
82
-							'desc'    => sprintf( __( 'Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ),
82
+							'desc'    => sprintf(__('Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')),
83 83
 							'default' => '',
84 84
 							'type'    => 'text'
85 85
 						),
86 86
 						array(
87 87
 							'id'      => 'recaptcha_secret',
88
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
89
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give' ),
88
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
89
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give'),
90 90
 							'default' => '',
91 91
 							'type'    => 'text'
92 92
 						),
93 93
                         array(
94
-                            'name'  => esc_html__( 'Access Control Docs Link', 'give' ),
94
+                            'name'  => esc_html__('Access Control Docs Link', 'give'),
95 95
                             'id'    => 'access_control_docs_link',
96
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
97
-                            'title' => __( 'Access Control', 'give' ),
96
+                            'url'   => esc_url('http://docs.givewp.com/settings-access-control'),
97
+                            'title' => __('Access Control', 'give'),
98 98
                             'type'  => 'give_docs_link',
99 99
                         ),
100 100
 						array(
@@ -112,61 +112,61 @@  discard block
 block discarded – undo
112 112
 							'id'   => 'give_title_general_settings_2'
113 113
 						),
114 114
 						array(
115
-							'name' => esc_html__( 'Currency Settings', 'give' ),
115
+							'name' => esc_html__('Currency Settings', 'give'),
116 116
 							'desc' => '',
117 117
 							'type' => 'give_title',
118 118
 							'id'   => 'give_title_general_settings_2'
119 119
 						),
120 120
 						array(
121
-							'name'    => esc_html__( 'Currency', 'give' ),
122
-							'desc'    => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
121
+							'name'    => esc_html__('Currency', 'give'),
122
+							'desc'    => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
123 123
 							'id'      => 'currency',
124 124
 							'type'    => 'select',
125 125
 							'options' => give_get_currencies(),
126 126
 							'default' => 'USD',
127 127
 						),
128 128
 						array(
129
-							'name'    => esc_html__( 'Currency Position', 'give' ),
130
-							'desc'    => esc_html__( 'The position of the currency symbol.', 'give' ),
129
+							'name'    => esc_html__('Currency Position', 'give'),
130
+							'desc'    => esc_html__('The position of the currency symbol.', 'give'),
131 131
 							'id'      => 'currency_position',
132 132
 							'type'    => 'select',
133 133
 							'options' => array(
134 134
 								/* translators: %s: currency symbol */
135
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
135
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
136 136
 								/* translators: %s: currency symbol */
137
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
137
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
138 138
 							),
139 139
 							'default' => 'before',
140 140
 						),
141 141
 						array(
142
-							'name'    => esc_html__( 'Thousands Separator', 'give' ),
143
-							'desc'    => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
142
+							'name'    => esc_html__('Thousands Separator', 'give'),
143
+							'desc'    => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
144 144
 							'id'      => 'thousands_separator',
145 145
 							'type'    => 'text',
146 146
 							'default' => ',',
147 147
 							'css'     => 'width:12em;',
148 148
 						),
149 149
 						array(
150
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
151
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
150
+							'name'    => esc_html__('Decimal Separator', 'give'),
151
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
152 152
 							'id'      => 'decimal_separator',
153 153
 							'type'    => 'text',
154 154
 							'default' => '.',
155 155
 							'css'     => 'width:12em;',
156 156
 						),
157 157
 						array(
158
-							'name'            => __( 'Number of Decimals', 'give' ),
159
-							'desc'            => __( 'The number of decimal points displayed in amounts.', 'give' ),
158
+							'name'            => __('Number of Decimals', 'give'),
159
+							'desc'            => __('The number of decimal points displayed in amounts.', 'give'),
160 160
 							'id'              => 'number_decimals',
161 161
 							'type'            => 'text',
162 162
 							'default'         => 2,
163 163
 							'css'             => 'width:12em;',
164 164
 						),
165 165
                         array(
166
-                            'name'  => esc_html__( 'Currency Options Docs Link', 'give' ),
166
+                            'name'  => esc_html__('Currency Options Docs Link', 'give'),
167 167
                             'id'    => 'currency_settings_docs_link',
168
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
169
-                            'title' => __( 'Currency Settings', 'give' ),
168
+                            'url'   => esc_url('http://docs.givewp.com/settings-currency'),
169
+                            'title' => __('Currency Settings', 'give'),
170 170
                             'type'  => 'give_docs_link',
171 171
                         ),
172 172
 						array(
@@ -184,55 +184,55 @@  discard block
 block discarded – undo
184 184
 							'id'   => 'give_title_general_settings_1'
185 185
 						),
186 186
 						array(
187
-							'name' => esc_html__( 'General Settings', 'give' ),
187
+							'name' => esc_html__('General Settings', 'give'),
188 188
 							'desc' => '',
189 189
 							'type' => 'give_title',
190 190
 							'id'   => 'give_title_general_settings_1'
191 191
 						),
192 192
 						array(
193
-							'name'    => esc_html__( 'Success Page', 'give' ),
193
+							'name'    => esc_html__('Success Page', 'give'),
194 194
 							/* translators: %s: [give_receipt] */
195
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
195
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
196 196
 							'id'      => 'success_page',
197 197
 							'type'    => 'select',
198
-							'options' => give_cmb2_get_post_options( array(
198
+							'options' => give_cmb2_get_post_options(array(
199 199
 								'post_type'   => 'page',
200
-								'numberposts' => - 1
201
-							) ),
200
+								'numberposts' => -1
201
+							)),
202 202
 						),
203 203
 						array(
204
-							'name'    => esc_html__( 'Failed Donation Page', 'give' ),
205
-							'desc'    => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
204
+							'name'    => esc_html__('Failed Donation Page', 'give'),
205
+							'desc'    => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'),
206 206
 							'id'      => 'failure_page',
207 207
 							'type'    => 'select',
208
-							'options' => give_cmb2_get_post_options( array(
208
+							'options' => give_cmb2_get_post_options(array(
209 209
 								'post_type'   => 'page',
210
-								'numberposts' => - 1
211
-							) ),
210
+								'numberposts' => -1
211
+							)),
212 212
 						),
213 213
 						array(
214
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
214
+							'name'    => esc_html__('Donation History Page', 'give'),
215 215
 							/* translators: %s: [donation_history] */
216
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
216
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
217 217
 							'id'      => 'history_page',
218 218
 							'type'    => 'select',
219
-							'options' => give_cmb2_get_post_options( array(
219
+							'options' => give_cmb2_get_post_options(array(
220 220
 								'post_type'   => 'page',
221
-								'numberposts' => - 1
222
-							) ),
221
+								'numberposts' => -1
222
+							)),
223 223
 						),
224 224
 						array(
225
-							'name'    => esc_html__( 'Base Country', 'give' ),
226
-							'desc'    => esc_html__( 'The country your site operates from.', 'give' ),
225
+							'name'    => esc_html__('Base Country', 'give'),
226
+							'desc'    => esc_html__('The country your site operates from.', 'give'),
227 227
 							'id'      => 'base_country',
228 228
 							'type'    => 'select',
229 229
 							'options' => give_get_country_list(),
230 230
 						),
231 231
                         array(
232
-                            'name'  => esc_html__( 'General Options Docs Link', 'give' ),
232
+                            'name'  => esc_html__('General Options Docs Link', 'give'),
233 233
                             'id'    => 'general_options_docs_link',
234
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
235
-                            'title' => __( 'General Options', 'give' ),
234
+                            'url'   => esc_url('http://docs.givewp.com/settings-general'),
235
+                            'title' => __('General Options', 'give'),
236 236
                             'type'  => 'give_docs_link',
237 237
                         ),
238 238
 						array(
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			 * Filter the general settings.
248 248
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
249 249
 			 */
250
-			$settings = apply_filters( 'give_settings_general', $settings );
250
+			$settings = apply_filters('give_settings_general', $settings);
251 251
 
252 252
 			/**
253 253
 			 * Filter the settings.
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			 *
257 257
 			 * @param  array $settings
258 258
 			 */
259
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
259
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
260 260
 
261 261
 			// Output.
262 262
 			return $settings;
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 		 */
271 271
 		public function get_sections() {
272 272
 			$sections = array(
273
-				'general-settings'  => esc_html__( 'General', 'give' ),
274
-				'currency-settings' => esc_html__( 'Currency', 'give' ),
275
-				'access-control'    => esc_html__( 'Access Control', 'give' )
273
+				'general-settings'  => esc_html__('General', 'give'),
274
+				'currency-settings' => esc_html__('Currency', 'give'),
275
+				'access-control'    => esc_html__('Access Control', 'give')
276 276
 			);
277 277
 
278
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
278
+			return apply_filters('give_get_sections_'.$this->id, $sections);
279 279
 		}
280 280
 	}
281 281
 
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 							'default' => '',
91 91
 							'type'    => 'text'
92 92
 						),
93
-                        array(
94
-                            'name'  => esc_html__( 'Access Control Docs Link', 'give' ),
95
-                            'id'    => 'access_control_docs_link',
96
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
97
-                            'title' => __( 'Access Control', 'give' ),
98
-                            'type'  => 'give_docs_link',
99
-                        ),
93
+						array(
94
+							'name'  => esc_html__( 'Access Control Docs Link', 'give' ),
95
+							'id'    => 'access_control_docs_link',
96
+							'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
97
+							'title' => __( 'Access Control', 'give' ),
98
+							'type'  => 'give_docs_link',
99
+						),
100 100
 						array(
101 101
 							'id'   => 'give_title_session_control_1',
102 102
 							'type' => 'sectionend'
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 							'default'         => 2,
163 163
 							'css'             => 'width:12em;',
164 164
 						),
165
-                        array(
166
-                            'name'  => esc_html__( 'Currency Options Docs Link', 'give' ),
167
-                            'id'    => 'currency_settings_docs_link',
168
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
169
-                            'title' => __( 'Currency Settings', 'give' ),
170
-                            'type'  => 'give_docs_link',
171
-                        ),
165
+						array(
166
+							'name'  => esc_html__( 'Currency Options Docs Link', 'give' ),
167
+							'id'    => 'currency_settings_docs_link',
168
+							'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
169
+							'title' => __( 'Currency Settings', 'give' ),
170
+							'type'  => 'give_docs_link',
171
+						),
172 172
 						array(
173 173
 							'type' => 'sectionend',
174 174
 							'id'   => 'give_title_general_settings_2'
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 							'type'    => 'select',
229 229
 							'options' => give_get_country_list(),
230 230
 						),
231
-                        array(
232
-                            'name'  => esc_html__( 'General Options Docs Link', 'give' ),
233
-                            'id'    => 'general_options_docs_link',
234
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
235
-                            'title' => __( 'General Options', 'give' ),
236
-                            'type'  => 'give_docs_link',
237
-                        ),
231
+						array(
232
+							'name'  => esc_html__( 'General Options Docs Link', 'give' ),
233
+							'id'    => 'general_options_docs_link',
234
+							'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
235
+							'title' => __( 'General Options', 'give' ),
236
+							'type'  => 'give_docs_link',
237
+						),
238 238
 						array(
239 239
 							'type' => 'sectionend',
240 240
 							'id'   => 'give_title_general_settings_1'
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +104 added lines, -104 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
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,42 +56,42 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) );
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url()));
70 70
 	$receipt_link = sprintf(
71 71
 		'<a href="%1$s">%2$s</a>',
72 72
 		$receipt_link_url,
73
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
73
+		esc_html__('View the receipt in your browser &raquo;', 'give')
74 74
 	);
75 75
 
76 76
 	$user = wp_get_current_user();
77 77
 
78
-	$message = str_replace( '{name}', $user->display_name, $message );
79
-	$message = str_replace( '{fullname}', $user->display_name, $message );
80
-	$message = str_replace( '{username}', $user->user_login, $message );
81
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
82
-	$message = str_replace( '{amount}', $price, $message );
83
-	$message = str_replace( '{price}', $price, $message );
84
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
85
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
86
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
87
-	$message = str_replace( '{payment_method}', $gateway, $message );
88
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
89
-	$message = str_replace( '{payment_id}', $payment_id, $message );
90
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
91
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
92
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
93
-
94
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
78
+	$message = str_replace('{name}', $user->display_name, $message);
79
+	$message = str_replace('{fullname}', $user->display_name, $message);
80
+	$message = str_replace('{username}', $user->user_login, $message);
81
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
82
+	$message = str_replace('{amount}', $price, $message);
83
+	$message = str_replace('{price}', $price, $message);
84
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
85
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
86
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
87
+	$message = str_replace('{payment_method}', $gateway, $message);
88
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
89
+	$message = str_replace('{payment_id}', $payment_id, $message);
90
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
91
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
92
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
93
+
94
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
95 95
 }
96 96
 
97 97
 /**
@@ -103,23 +103,23 @@  discard block
 block discarded – undo
103 103
  * @since  1.0
104 104
  * @return array|bool
105 105
  */
106
-function give_email_template_preview( $array ) {
106
+function give_email_template_preview($array) {
107 107
 
108
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
108
+	if ( ! current_user_can('manage_give_settings')) {
109 109
 		return false;
110 110
 	}
111 111
 	$custom_field = array(
112
-		'name' => esc_html__( 'Preview Email', 'give' ),
113
-		'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ),
112
+		'name' => esc_html__('Preview Email', 'give'),
113
+		'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'),
114 114
 		'id'   => 'give_email_preview_buttons',
115 115
 		'type' => 'email_preview_buttons'
116 116
 	);
117 117
 
118
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
118
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
119 119
 
120 120
 }
121 121
 
122
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
122
+add_filter('give_settings_emails', 'give_email_template_preview');
123 123
 
124 124
 /**
125 125
  * Output Email Template Preview Buttons.
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 function give_email_preview_buttons_callback() {
132 132
 	ob_start();
133 133
 	?>
134
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
135
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
134
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
135
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
136 136
 		'give_action'  => 'send_test_email',
137 137
 		'give-message' => 'sent-test-email',
138 138
 		'tag'          => 'emails'
139
-	) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
139
+	)), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
140 140
 	<?php
141 141
 	echo ob_get_clean();
142 142
 }
@@ -149,46 +149,46 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function give_display_email_template_preview() {
151 151
 
152
-	if ( empty( $_GET['give_action'] ) ) {
152
+	if (empty($_GET['give_action'])) {
153 153
 		return;
154 154
 	}
155 155
 
156
-	if ( 'preview_email' !== $_GET['give_action'] ) {
156
+	if ('preview_email' !== $_GET['give_action']) {
157 157
 		return;
158 158
 	}
159 159
 
160
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
160
+	if ( ! current_user_can('manage_give_settings')) {
161 161
 		return;
162 162
 	}
163 163
 
164 164
 
165
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
165
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
166 166
 
167
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
167
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
168 168
 
169 169
 	echo give_get_preview_email_header();
170 170
 
171 171
 	//Are we previewing an actual payment?
172
-	if ( ! empty( $payment_id ) ) {
172
+	if ( ! empty($payment_id)) {
173 173
 
174
-		$content = give_get_email_body_content( $payment_id );
174
+		$content = give_get_email_body_content($payment_id);
175 175
 
176
-		$preview_content = give_do_email_tags( $content, $payment_id );
176
+		$preview_content = give_do_email_tags($content, $payment_id);
177 177
 
178 178
 	} else {
179 179
 
180 180
 		//No payment ID, use sample preview content
181
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
181
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
182 182
 	}
183 183
 
184 184
 
185
-	echo Give()->emails->build_email( $preview_content );
185
+	echo Give()->emails->build_email($preview_content);
186 186
 
187 187
 	exit;
188 188
 
189 189
 }
190 190
 
191
-add_action( 'init', 'give_display_email_template_preview' );
191
+add_action('init', 'give_display_email_template_preview');
192 192
 
193 193
 /**
194 194
  * Email Template Body.
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return string $email_body Body of the email
202 202
  */
203
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
203
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
204 204
 
205 205
 	$default_email_body = give_get_default_donation_receipt_email();
206 206
 
207
-	$email_content = give_get_option( 'donation_receipt' );
208
-	$email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
207
+	$email_content = give_get_option('donation_receipt');
208
+	$email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body;
209 209
 
210
-	$email_body = wpautop( $email_content );
210
+	$email_body = wpautop($email_content);
211 211
 
212
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
212
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
213 213
 
214
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
214
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
215 215
 }
216 216
 
217 217
 /**
@@ -224,36 +224,36 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @return string $email_body Body of the email
226 226
  */
227
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
227
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
228 228
 
229
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
230
-	$email     = give_get_payment_user_email( $payment_id );
229
+	$user_info = maybe_unserialize($payment_data['user_info']);
230
+	$email     = give_get_payment_user_email($payment_id);
231 231
 
232
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
233
-		$user_data = get_userdata( $user_info['id'] );
232
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
233
+		$user_data = get_userdata($user_info['id']);
234 234
 		$name      = $user_data->display_name;
235
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
236
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
235
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
236
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
237 237
 	} else {
238 238
 		$name = $email;
239 239
 	}
240 240
 
241
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
241
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
242 242
 
243
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
244
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
245
-	$default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n";
246
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
247
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
248
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
249
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
243
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
244
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
245
+	$default_email_body .= esc_html__('Donation:', 'give')."\n\n";
246
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
247
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
248
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
249
+	$default_email_body .= esc_html__('Thank you', 'give');
250 250
 
251
-	$email = give_get_option( 'donation_notification' );
252
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
251
+	$email = give_get_option('donation_notification');
252
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
253 253
 
254
-	$email_body = give_do_email_tags( $email, $payment_id );
254
+	$email_body = give_do_email_tags($email, $payment_id);
255 255
 
256
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
256
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
257 257
 }
258 258
 
259 259
 /**
@@ -266,19 +266,19 @@  discard block
 block discarded – undo
266 266
  * @since  1.0
267 267
  */
268 268
 function give_render_receipt_in_browser() {
269
-	if ( ! isset( $_GET['payment_key'] ) ) {
270
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
269
+	if ( ! isset($_GET['payment_key'])) {
270
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
271 271
 	}
272 272
 
273
-	$key = urlencode( $_GET['payment_key'] );
273
+	$key = urlencode($_GET['payment_key']);
274 274
 
275 275
 	ob_start();
276 276
 	//Disallows caching of the page
277
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
278
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
279
-	header( "Cache-Control: post-check=0, pre-check=0", false );
280
-	header( "Pragma: no-cache" ); // HTTP/1.0
281
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
277
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
278
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
279
+	header("Cache-Control: post-check=0, pre-check=0", false);
280
+	header("Pragma: no-cache"); // HTTP/1.0
281
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
282 282
 	?>
283 283
 	<!DOCTYPE html>
284 284
 	<html lang="en">
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 		 *
290 290
 		 * @since 1.0
291 291
 		 */
292
-		do_action( 'give_receipt_head' );
292
+		do_action('give_receipt_head');
293 293
 		?>
294 294
 	</head>
295
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
295
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
296 296
 
297 297
 	<div id="give_receipt_wrapper">
298 298
 		<?php
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @since 1.0
303 303
 		 */
304
-		do_action( 'give_render_receipt_in_browser_before' );
304
+		do_action('give_render_receipt_in_browser_before');
305 305
 
306
-		echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );
306
+		echo do_shortcode('[give_receipt payment_key='.$key.']');
307 307
 
308 308
 		/**
309 309
 		 * Fires in the receipt template after the content.
310 310
 		 *
311 311
 		 * @since 1.0
312 312
 		 */
313
-		do_action( 'give_render_receipt_in_browser_after' );
313
+		do_action('give_render_receipt_in_browser_after');
314 314
 		?>
315 315
 	</div>
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 *
321 321
 	 * @since 1.0
322 322
 	 */
323
-	do_action( 'give_receipt_footer' );
323
+	do_action('give_receipt_footer');
324 324
 	?>
325 325
 	</body>
326 326
 	</html>
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	die();
330 330
 }
331 331
 
332
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
332
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
333 333
 
334 334
 
335 335
 /**
@@ -344,29 +344,29 @@  discard block
 block discarded – undo
344 344
 
345 345
 	//Payment receipt switcher
346 346
 	$payment_count = give_count_payments()->publish;
347
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
347
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
348 348
 
349
-	if ( $payment_count <= 0 ) {
349
+	if ($payment_count <= 0) {
350 350
 		return false;
351 351
 	}
352 352
 
353 353
 	//Get payments.
354
-	$payments = new Give_Payments_Query( array(
354
+	$payments = new Give_Payments_Query(array(
355 355
 		'number' => 100
356
-	) );
356
+	));
357 357
 	$payments = $payments->get_payments();
358 358
 	$options  = array();
359 359
 
360 360
 	//Provide nice human readable options.
361
-	if ( $payments ) {
362
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
363
-		foreach ( $payments as $payment ) {
361
+	if ($payments) {
362
+		$options[0] = esc_html__('- Select a donation -', 'give');
363
+		foreach ($payments as $payment) {
364 364
 
365
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
365
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
366 366
 
367 367
 		}
368 368
 	} else {
369
-		$options[0] = esc_html__( 'No donations found.', 'give' );
369
+		$options[0] = esc_html__('No donations found.', 'give');
370 370
 	}
371 371
 
372 372
 	//Start constructing HTML output.
@@ -379,16 +379,16 @@  discard block
 block discarded – undo
379 379
 			        var selected_trans = transactions.options[transactions.selectedIndex];
380 380
 				        console.log(selected_trans);
381 381
 				        if (selected_trans){
382
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
382
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
383 383
 				                window.location = url_string;
384 384
 				        }
385 385
 				    }
386 386
 			    </script>';
387 387
 
388
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
388
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
389 389
 
390 390
 	//The select field with 100 latest transactions
391
-	$transaction_header .= Give()->html->select( array(
391
+	$transaction_header .= Give()->html->select(array(
392 392
 		'name'             => 'preview_email_payment_id',
393 393
 		'selected'         => $payment_id,
394 394
 		'id'               => 'give_preview_email_payment_id',
@@ -398,12 +398,12 @@  discard block
 block discarded – undo
398 398
 		'select_atts'      => 'onchange="change_preview()">',
399 399
 		'show_option_all'  => false,
400 400
 		'show_option_none' => false
401
-	) );
401
+	));
402 402
 
403 403
 	//Closing tag
404 404
 	$transaction_header .= '</div>';
405 405
 
406
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
406
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
407 407
 
408 408
 }
409 409
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 function give_receipt_head_content() {
418 418
 
419 419
 	//Title.
420
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
420
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
421 421
 
422 422
 	//Meta.
423 423
 	$output .= '<meta charset="utf-8"/>
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 		<meta name="robots" content="noindex, nofollow"/>';
432 432
 
433 433
 	//CSS
434
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
434
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
435 435
 
436
-	echo apply_filters( 'give_receipt_head_content', $output );
436
+	echo apply_filters('give_receipt_head_content', $output);
437 437
 
438 438
 }
439 439
 
440
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
441 440
\ No newline at end of file
441
+add_action('give_receipt_head', 'give_receipt_head_content');
442 442
\ No newline at end of file
Please login to merge, or discard this patch.
includes/login-register.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -137,31 +137,31 @@
 block discarded – undo
137 137
  * @return void
138 138
  */
139 139
 function give_process_user_logout( $data ) {
140
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
140
+	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
141 141
 
142
-        // Prevent occurring of any custom action on wp_logout.
143
-        remove_all_actions( 'wp_logout' );
142
+		// Prevent occurring of any custom action on wp_logout.
143
+		remove_all_actions( 'wp_logout' );
144 144
 
145 145
 		/**
146 146
 		 * Fires before processing user logout.
147 147
 		 *
148 148
 		 * @since 1.0
149 149
 		 */
150
-        do_action( 'give_before_user_logout' );
150
+		do_action( 'give_before_user_logout' );
151 151
 
152
-        // Logout user.
153
-        wp_logout();
152
+		// Logout user.
153
+		wp_logout();
154 154
 
155 155
 		/**
156 156
 		 * Fires after processing user logout.
157 157
 		 *
158 158
 		 * @since 1.0
159 159
 		 */
160
-        do_action( 'give_after_user_logout' );
160
+		do_action( 'give_after_user_logout' );
161 161
 
162
-        wp_redirect( $data['give_logout_redirect'] );
163
-        give_die();
164
-    }
162
+		wp_redirect( $data['give_logout_redirect'] );
163
+		give_die();
164
+	}
165 165
 }
166 166
 
167 167
 add_action( 'give_user_logout', 'give_process_user_logout' );
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
30
-	if ( empty( $login_redirect ) ) {
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30
+	if (empty($login_redirect)) {
31 31
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
32 32
 	}
33 33
 
34
-	if ( empty( $logout_redirect ) ) {
35
-		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
34
+	if (empty($logout_redirect)) {
35
+		$logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
36 36
 	}
37 37
 
38 38
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	$logout_redirect = add_query_arg(
41 41
 		array(
42 42
 			'give_action'          => 'user_logout',
43
-			'give_logout_nonce'    => wp_create_nonce( 'give-logout-nonce' ),
44
-			'give_logout_redirect' => urlencode( $logout_redirect ),
43
+			'give_logout_nonce'    => wp_create_nonce('give-logout-nonce'),
44
+			'give_logout_redirect' => urlencode($logout_redirect),
45 45
 		),
46
-		home_url( '/' )
46
+		home_url('/')
47 47
 	);
48 48
 
49 49
 	ob_start();
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		)
57 57
 	);
58 58
 
59
-	return apply_filters( 'give_login_form', ob_get_clean() );
59
+	return apply_filters('give_login_form', ob_get_clean());
60 60
 }
61 61
 
62 62
 /**
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @return string Register form
71 71
  */
72
-function give_register_form( $redirect = '' ) {
73
-	if ( empty( $redirect ) ) {
72
+function give_register_form($redirect = '') {
73
+	if (empty($redirect)) {
74 74
 		$redirect = give_get_current_page_url();
75 75
 	}
76 76
 
77 77
 	ob_start();
78 78
 
79
-	if ( ! is_user_logged_in() ) {
79
+	if ( ! is_user_logged_in()) {
80 80
 		give_get_template(
81 81
 			'shortcode-register',
82 82
 			array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		);
86 86
 	}
87 87
 
88
-	return apply_filters( 'give_register_form', ob_get_clean() );
88
+	return apply_filters('give_register_form', ob_get_clean());
89 89
 }
90 90
 
91 91
 /**
@@ -97,34 +97,34 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @return void
99 99
  */
100
-function give_process_login_form( $data ) {
101
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
102
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
103
-		if ( ! $user_data ) {
104
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
100
+function give_process_login_form($data) {
101
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
102
+		$user_data = get_user_by('login', $data['give_user_login']);
103
+		if ( ! $user_data) {
104
+			$user_data = get_user_by('email', $data['give_user_login']);
105 105
 		}
106
-		if ( $user_data ) {
106
+		if ($user_data) {
107 107
 			$user_ID    = $user_data->ID;
108 108
 			$user_email = $user_data->user_email;
109
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
110
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
109
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
110
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
111 111
 			} else {
112
-				give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) );
112
+				give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give'));
113 113
 			}
114 114
 		} else {
115
-			give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
115
+			give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
116 116
 		}
117 117
 		// Check for errors and redirect if none present
118 118
 		$errors = give_get_errors();
119
-		if ( ! $errors ) {
120
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
121
-			wp_redirect( $redirect );
119
+		if ( ! $errors) {
120
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
121
+			wp_redirect($redirect);
122 122
 			give_die();
123 123
 		}
124 124
 	}
125 125
 }
126 126
 
127
-add_action( 'give_user_login', 'give_process_login_form' );
127
+add_action('give_user_login', 'give_process_login_form');
128 128
 
129 129
 
130 130
 /**
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return void
138 138
  */
139
-function give_process_user_logout( $data ) {
140
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
139
+function give_process_user_logout($data) {
140
+    if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
141 141
 
142 142
         // Prevent occurring of any custom action on wp_logout.
143
-        remove_all_actions( 'wp_logout' );
143
+        remove_all_actions('wp_logout');
144 144
 
145 145
 		/**
146 146
 		 * Fires before processing user logout.
147 147
 		 *
148 148
 		 * @since 1.0
149 149
 		 */
150
-        do_action( 'give_before_user_logout' );
150
+        do_action('give_before_user_logout');
151 151
 
152 152
         // Logout user.
153 153
         wp_logout();
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 		 *
158 158
 		 * @since 1.0
159 159
 		 */
160
-        do_action( 'give_after_user_logout' );
160
+        do_action('give_after_user_logout');
161 161
 
162
-        wp_redirect( $data['give_logout_redirect'] );
162
+        wp_redirect($data['give_logout_redirect']);
163 163
         give_die();
164 164
     }
165 165
 }
166 166
 
167
-add_action( 'give_user_logout', 'give_process_user_logout' );
167
+add_action('give_user_logout', 'give_process_user_logout');
168 168
 
169 169
 /**
170 170
  * Log User In
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return void
179 179
  */
180
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
181
-	if ( $user_id < 1 ) {
180
+function give_log_user_in($user_id, $user_login, $user_pass) {
181
+	if ($user_id < 1) {
182 182
 		return;
183 183
 	}
184 184
 
185
-	wp_set_auth_cookie( $user_id );
186
-	wp_set_current_user( $user_id, $user_login );
185
+	wp_set_auth_cookie($user_id);
186
+	wp_set_current_user($user_id, $user_login);
187 187
 
188 188
 	/**
189 189
 	 * Fires after the user has successfully logged in.
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @param string  $user_login Username.
194 194
 	 * @param WP_User $$user      WP_User object of the logged-in user.
195 195
 	 */
196
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
196
+	do_action('wp_login', $user_login, get_userdata($user_id));
197 197
 
198 198
 	/**
199 199
 	 * Fires after give user has successfully logged in.
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @param string $user_login Username.
205 205
 	 * @param string $user_pass  User password.
206 206
 	 */
207
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
207
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
208 208
 }
209 209
 
210 210
 
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return void
219 219
  */
220
-function give_process_register_form( $data ) {
220
+function give_process_register_form($data) {
221 221
 
222
-	if ( is_user_logged_in() ) {
222
+	if (is_user_logged_in()) {
223 223
 		return;
224 224
 	}
225 225
 
226
-	if ( empty( $_POST['give_register_submit'] ) ) {
226
+	if (empty($_POST['give_register_submit'])) {
227 227
 		return;
228 228
 	}
229 229
 
@@ -232,38 +232,38 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @since 1.0
234 234
 	 */
235
-	do_action( 'give_pre_process_register_form' );
235
+	do_action('give_pre_process_register_form');
236 236
 
237
-	if ( empty( $data['give_user_login'] ) ) {
238
-		give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) );
237
+	if (empty($data['give_user_login'])) {
238
+		give_set_error('empty_username', esc_html__('Invalid username.', 'give'));
239 239
 	}
240 240
 
241
-	if ( username_exists( $data['give_user_login'] ) ) {
242
-		give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
241
+	if (username_exists($data['give_user_login'])) {
242
+		give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
243 243
 	}
244 244
 
245
-	if ( ! validate_username( $data['give_user_login'] ) ) {
246
-		give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
245
+	if ( ! validate_username($data['give_user_login'])) {
246
+		give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
247 247
 	}
248 248
 
249
-	if ( email_exists( $data['give_user_email'] ) ) {
250
-		give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) );
249
+	if (email_exists($data['give_user_email'])) {
250
+		give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give'));
251 251
 	}
252 252
 
253
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
254
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
253
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
254
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
255 255
 	}
256 256
 
257
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
258
-		give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) );
257
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
258
+		give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give'));
259 259
 	}
260 260
 
261
-	if ( empty( $_POST['give_user_pass'] ) ) {
262
-		give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) );
261
+	if (empty($_POST['give_user_pass'])) {
262
+		give_set_error('empty_password', esc_html__('Please enter a password.', 'give'));
263 263
 	}
264 264
 
265
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
266
-		give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
265
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
266
+		give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
267 267
 	}
268 268
 
269 269
 	/**
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @since 1.0
273 273
 	 */
274
-	do_action( 'give_process_register_form' );
274
+	do_action('give_process_register_form');
275 275
 
276 276
 	// Check for errors and redirect if none present
277 277
 	$errors = give_get_errors();
278 278
 
279
-	if ( empty( $errors ) ) {
279
+	if (empty($errors)) {
280 280
 
281
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
281
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
282 282
 
283
-		give_register_and_login_new_user( array(
283
+		give_register_and_login_new_user(array(
284 284
 			'user_login'      => $data['give_user_login'],
285 285
 			'user_pass'       => $data['give_user_pass'],
286 286
 			'user_email'      => $data['give_user_email'],
287
-			'user_registered' => date( 'Y-m-d H:i:s' ),
288
-			'role'            => get_option( 'default_role' )
289
-		) );
287
+			'user_registered' => date('Y-m-d H:i:s'),
288
+			'role'            => get_option('default_role')
289
+		));
290 290
 
291
-		wp_redirect( $redirect );
291
+		wp_redirect($redirect);
292 292
 		give_die();
293 293
 	}
294 294
 }
295 295
 
296
-add_action( 'give_user_register', 'give_process_register_form' );
297 296
\ No newline at end of file
297
+add_action('give_user_register', 'give_process_register_form');
298 298
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/class-customer-table.php 3 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.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,8 +185,8 @@
 block discarded – undo
185 185
 				
186 186
 			case 'num_donations' :
187 187
 				$value = '<a href="' .
188
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
188
+						 admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
+						 ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
190 190
 				break;
191 191
 
192 192
 			case 'amount_spent' :
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 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
 /**
@@ -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' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
66
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
64
+		parent::__construct(array(
65
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
66
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
67 67
 			'ajax'     => false                       // Does this table support ajax?
68
-		) );
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,20 +80,20 @@  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( 'ID' => 'search-submit' ) ); ?>
96
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
97 97
         </p>
98 98
 		<?php
99 99
 	}
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string Column Name.
111 111
 	 */
112
-	public function column_default( $item, $column_name ) {
113
-		switch ( $column_name ) {
112
+	public function column_default($item, $column_name) {
113
+		switch ($column_name) {
114 114
 
115 115
 			case 'num_donations' :
116
-				$value = '<a href="' .
117
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
118
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
116
+				$value = '<a href="'.
117
+				         admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
118
+				         ).'">'.esc_html($item['num_donations']).'</a>';
119 119
 				break;
120 120
 
121 121
 			case 'amount_spent' :
122
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
122
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
123 123
 				break;
124 124
 
125 125
 			case 'date_created' :
126
-				$value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) );
126
+				$value = date_i18n(give_date_format(), strtotime($item['date_created']));
127 127
 				break;
128 128
 
129 129
 			default:
130
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
130
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
131 131
 				break;
132 132
 		}
133 133
 
134
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
134
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
135 135
 
136 136
 	}
137 137
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string
144 144
 	 */
145
-	public function column_name( $item ) {
146
-		$name = '#' . $item['id'] . ' ';
147
-		$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
148
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
149
-		$actions  = $this->get_row_actions( $item );
145
+	public function column_name($item) {
146
+		$name = '#'.$item['id'].' ';
147
+		$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
148
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
149
+		$actions  = $this->get_row_actions($item);
150 150
 
151
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
151
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
152 152
 	}
153 153
 
154 154
 	/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_columns() {
162 162
 		$columns = array(
163
-			'name'          => esc_html__( 'Name', 'give' ),
164
-			'email'         => esc_html__( 'Email', 'give' ),
165
-			'num_donations' => esc_html__( 'Donations', 'give' ),
166
-			'amount_spent'  => esc_html__( 'Total Donated', 'give' ),
167
-			'date_created'  => esc_html__( 'Date Created', 'give' )
163
+			'name'          => esc_html__('Name', 'give'),
164
+			'email'         => esc_html__('Email', 'give'),
165
+			'num_donations' => esc_html__('Donations', 'give'),
166
+			'amount_spent'  => esc_html__('Total Donated', 'give'),
167
+			'date_created'  => esc_html__('Date Created', 'give')
168 168
 		);
169 169
 
170
-		return apply_filters( 'give_report_customer_columns', $columns );
170
+		return apply_filters('give_report_customer_columns', $columns);
171 171
 
172 172
 	}
173 173
 
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 	public function get_sortable_columns() {
182 182
 
183 183
 		$columns = array(
184
-			'date_created'  => array( 'date_created', true ),
185
-			'name'          => array( 'name', true ),
186
-			'num_donations' => array( 'purchase_count', false ),
187
-			'amount_spent'  => array( 'purchase_value', false ),
184
+			'date_created'  => array('date_created', true),
185
+			'name'          => array('name', true),
186
+			'num_donations' => array('purchase_count', false),
187
+			'amount_spent'  => array('purchase_value', false),
188 188
 		);
189 189
 
190
-		return apply_filters( 'give_report_sortable_customer_columns', $columns );
190
+		return apply_filters('give_report_sortable_customer_columns', $columns);
191 191
 	}
192 192
 
193 193
 	/**
@@ -200,34 +200,34 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return array An array of action links.
202 202
 	 */
203
-	public function get_row_actions( $item ) {
203
+	public function get_row_actions($item) {
204 204
 
205 205
 		$actions = array(
206 206
 
207 207
 			'view' => sprintf(
208 208
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
209
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ),
210
-				sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ),
211
-				esc_html__( 'View Donor', 'give' )
209
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']),
210
+				sprintf(esc_attr__('View "%s"', 'give'), $item['name']),
211
+				esc_html__('View Donor', 'give')
212 212
 			),
213 213
 
214 214
 			'notes' => sprintf(
215 215
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
216
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ),
217
-				sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ),
218
-				esc_html__( 'Notes', 'give' )
216
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']),
217
+				sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']),
218
+				esc_html__('Notes', 'give')
219 219
 			),
220 220
 
221 221
 			'delete' => sprintf(
222 222
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
223
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ),
224
-				sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ),
225
-				esc_html__( 'Delete', 'give' )
223
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']),
224
+				sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']),
225
+				esc_html__('Delete', 'give')
226 226
 			)
227 227
 
228 228
 		);
229 229
 
230
-		return apply_filters( 'give_donor_row_actions', $actions, $item );
230
+		return apply_filters('give_donor_row_actions', $actions, $item);
231 231
 
232 232
 	}
233 233
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @since  1.0
242 242
 	 * @return void
243 243
 	 */
244
-	public function bulk_actions( $which = '' ) {
244
+	public function bulk_actions($which = '') {
245 245
 		// These aren't really bulk actions but this outputs the markup in the right place.
246 246
 	}
247 247
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return int Current page number.
254 254
 	 */
255 255
 	public function get_paged() {
256
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
256
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
257 257
 	}
258 258
 
259 259
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return mixed string If search is present, false otherwise.
265 265
 	 */
266 266
 	public function get_search() {
267
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
267
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
268 268
 	}
269 269
 
270 270
 	/**
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 
282 282
 		// Get donor query.
283 283
 		$args      = $this->get_donor_query();
284
-		$customers = Give()->customers->get_customers( $args );
284
+		$customers = Give()->customers->get_customers($args);
285 285
 
286
-		if ( $customers ) {
286
+		if ($customers) {
287 287
 
288
-			foreach ( $customers as $customer ) {
288
+			foreach ($customers as $customer) {
289 289
 
290
-				$user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0;
290
+				$user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0;
291 291
 
292 292
 				$data[] = array(
293 293
 					'id'            => $customer->id,
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			}
302 302
 		}
303 303
 
304
-		return apply_filters( 'give_donors_column_query_data', $data );
304
+		return apply_filters('give_donors_column_query_data', $data);
305 305
 	}
306 306
 
307 307
 	/**
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 		$_donor_query = $this->get_donor_query();
316 316
 
317 317
 		$_donor_query['number'] = - 1;
318
-		$donors                 = Give()->customers->get_customers( $_donor_query );
318
+		$donors                 = Give()->customers->get_customers($_donor_query);
319 319
 
320
-		return count( $donors );
320
+		return count($donors);
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 	 */
330 330
 	public function get_donor_query() {
331 331
 		$paged   = $this->get_paged();
332
-		$offset  = $this->per_page * ( $paged - 1 );
332
+		$offset  = $this->per_page * ($paged - 1);
333 333
 		$search  = $this->get_search();
334
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
335
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
334
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
335
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
336 336
 
337 337
 		$args = array(
338 338
 			'number'  => $this->per_page,
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 			'orderby' => $orderby,
342 342
 		);
343 343
 
344
-		if ( $search ) {
345
-			if ( is_email( $search ) ) {
344
+		if ($search) {
345
+			if (is_email($search)) {
346 346
 				$args['email'] = $search;
347
-			} elseif ( is_numeric( $search ) ) {
347
+			} elseif (is_numeric($search)) {
348 348
 				$args['id'] = $search;
349 349
 			} else {
350 350
 				$args['name'] = $search;
@@ -371,16 +371,16 @@  discard block
 block discarded – undo
371 371
 		$hidden   = array(); // No hidden columns
372 372
 		$sortable = $this->get_sortable_columns();
373 373
 
374
-		$this->_column_headers = array( $columns, $hidden, $sortable );
374
+		$this->_column_headers = array($columns, $hidden, $sortable);
375 375
 
376 376
 		$this->items = $this->donor_data();
377 377
 
378 378
 		$this->total = $this->get_donor_count();
379 379
 
380
-		$this->set_pagination_args( array(
380
+		$this->set_pagination_args(array(
381 381
 			'total_items' => $this->total,
382 382
 			'per_page'    => $this->per_page,
383
-			'total_pages' => ceil( $this->total / $this->per_page )
384
-		) );
383
+			'total_pages' => ceil($this->total / $this->per_page)
384
+		));
385 385
 	}
386 386
 }
387 387
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 1 patch
Spacing   +119 added lines, -119 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
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param  bool  $_id   Post id. Default is false.
338 338
 	 * @param  array $_args Arguments passed.
339 339
 	 */
340
-	public function __construct( $_id = false, $_args = array() ) {
340
+	public function __construct($_id = false, $_args = array()) {
341 341
 
342
-		$donation_form = WP_Post::get_instance( $_id );
342
+		$donation_form = WP_Post::get_instance($_id);
343 343
 
344
-		return $this->setup_donation_form( $donation_form );
344
+		return $this->setup_donation_form($donation_form);
345 345
 	}
346 346
 
347 347
 	/**
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool                   If the setup was successful or not.
356 356
 	 */
357
-	private function setup_donation_form( $donation_form ) {
357
+	private function setup_donation_form($donation_form) {
358 358
 
359
-		if ( ! is_object( $donation_form ) ) {
359
+		if ( ! is_object($donation_form)) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
363
+		if ( ! is_a($donation_form, 'WP_Post')) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		if ( 'give_forms' !== $donation_form->post_type ) {
367
+		if ('give_forms' !== $donation_form->post_type) {
368 368
 			return false;
369 369
 		}
370 370
 
371
-		foreach ( $donation_form as $key => $value ) {
371
+		foreach ($donation_form as $key => $value) {
372 372
 
373
-			switch ( $key ) {
373
+			switch ($key) {
374 374
 
375 375
 				default:
376 376
 					$this->$key = $value;
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed
396 396
 	 */
397
-	public function __get( $key ) {
397
+	public function __get($key) {
398 398
 
399
-		if ( method_exists( $this, 'get_' . $key ) ) {
399
+		if (method_exists($this, 'get_'.$key)) {
400 400
 
401
-			return call_user_func( array( $this, 'get_' . $key ) );
401
+			return call_user_func(array($this, 'get_'.$key));
402 402
 
403 403
 		} else {
404 404
 
405 405
 			/* translators: %s: property key */
406
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
406
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
407 407
 
408 408
 		}
409 409
 
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
421 421
 	 */
422
-	public function create( $data = array() ) {
422
+	public function create($data = array()) {
423 423
 
424
-		if ( $this->id != 0 ) {
424
+		if ($this->id != 0) {
425 425
 			return false;
426 426
 		}
427 427
 
428 428
 		$defaults = array(
429 429
 			'post_type'   => 'give_forms',
430 430
 			'post_status' => 'draft',
431
-			'post_title'  => __( 'New Donation Form', 'give' ),
431
+			'post_title'  => __('New Donation Form', 'give'),
432 432
 		);
433 433
 
434
-		$args = wp_parse_args( $data, $defaults );
434
+		$args = wp_parse_args($data, $defaults);
435 435
 
436 436
 		/**
437 437
 		 * Fired before a donation form is created
438 438
 		 *
439 439
 		 * @param array $args The post object arguments used for creation.
440 440
 		 */
441
-		do_action( 'give_form_pre_create', $args );
441
+		do_action('give_form_pre_create', $args);
442 442
 
443
-		$id = wp_insert_post( $args, true );
443
+		$id = wp_insert_post($args, true);
444 444
 
445
-		$donation_form = WP_Post::get_instance( $id );
445
+		$donation_form = WP_Post::get_instance($id);
446 446
 
447 447
 		/**
448 448
 		 * Fired after a donation form is created
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $id   The post ID of the created item.
451 451
 		 * @param array $args The post object arguments used for creation.
452 452
 		 */
453
-		do_action( 'give_form_post_create', $id, $args );
453
+		do_action('give_form_post_create', $id, $args);
454 454
 
455
-		return $this->setup_donation_form( $donation_form );
455
+		return $this->setup_donation_form($donation_form);
456 456
 
457 457
 	}
458 458
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return string Donation form name.
478 478
 	 */
479 479
 	public function get_name() {
480
-		return get_the_title( $this->ID );
480
+		return get_the_title($this->ID);
481 481
 	}
482 482
 
483 483
 	/**
@@ -490,13 +490,13 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function get_price() {
492 492
 
493
-		if ( ! isset( $this->price ) ) {
493
+		if ( ! isset($this->price)) {
494 494
 
495
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
495
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
496 496
 
497
-			if ( $this->price ) {
497
+			if ($this->price) {
498 498
 
499
-				$this->price = give_sanitize_amount( $this->price );
499
+				$this->price = give_sanitize_amount($this->price);
500 500
 
501 501
 			} else {
502 502
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param string     $price The donation form price.
515 515
 		 * @param string|int $id    The form ID.
516 516
 		 */
517
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
517
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function get_minimum_price() {
529 529
 
530
-		if ( ! isset( $this->minimum_price ) ) {
530
+		if ( ! isset($this->minimum_price)) {
531 531
 
532
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
533
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
532
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
533
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
534 534
 
535
-			if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) {
535
+			if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) {
536 536
 
537
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
537
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
538 538
 
539 539
 			} else {
540 540
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
 		}
546 546
 
547
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
547
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
548 548
 	}
549 549
 
550 550
 	/**
@@ -557,9 +557,9 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	public function get_prices() {
559 559
 
560
-		if ( ! isset( $this->prices ) ) {
560
+		if ( ! isset($this->prices)) {
561 561
 
562
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
562
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
563 563
 
564 564
 		}
565 565
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		 * @param array      $prices The array of mulit-level prices.
572 572
 		 * @param int|string $ID     The ID of the form.
573 573
 		 */
574
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
574
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
575 575
 
576 576
 	}
577 577
 
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	public function get_goal() {
587 587
 
588
-		if ( ! isset( $this->goal ) ) {
588
+		if ( ! isset($this->goal)) {
589 589
 
590
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
590
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
591 591
 
592
-			if ( $this->goal ) {
592
+			if ($this->goal) {
593 593
 
594
-				$this->goal = give_sanitize_amount( $this->goal );
594
+				$this->goal = give_sanitize_amount($this->goal);
595 595
 
596 596
 			} else {
597 597
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 		}
603 603
 
604
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
604
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
605 605
 
606 606
 	}
607 607
 
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 	 */
616 616
 	public function is_single_price_mode() {
617 617
 
618
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
618
+		$option = get_post_meta($this->ID, '_give_price_option', true);
619 619
 		$ret    = 0;
620 620
 
621
-		if ( empty( $option ) || $option === 'set' ) {
621
+		if (empty($option) || $option === 'set') {
622 622
 			$ret = 1;
623 623
 		}
624 624
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		 * @param bool       $ret Is donation form in single price mode?
631 631
 		 * @param int|string $ID The ID of the donation form.
632 632
 		 */
633
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
633
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
634 634
 
635 635
 	}
636 636
 
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 	 */
645 645
 	public function is_custom_price_mode() {
646 646
 
647
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
647
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
648 648
 		$ret    = 0;
649 649
 
650
-		if ( give_is_setting_enabled( $option ) ) {
650
+		if (give_is_setting_enabled($option)) {
651 651
 			$ret = 1;
652 652
 		}
653 653
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		 * @param bool       $ret Is donation form in custom price mode?
660 660
 		 * @param int|string $ID  The ID of the donation form.
661 661
 		 */
662
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
662
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
663 663
 
664 664
 	}
665 665
 
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 	 */
676 676
 	public function has_variable_prices() {
677 677
 
678
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
678
+		$option = get_post_meta($this->ID, '_give_price_option', true);
679 679
 		$ret    = 0;
680 680
 
681
-		if ( $option === 'multi' ) {
681
+		if ($option === 'multi') {
682 682
 			$ret = 1;
683 683
 		}
684 684
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		 * @param bool       $ret Does donation form have variable prices?
689 689
 		 * @param int|string $ID  The ID of the donation form.
690 690
 		 */
691
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
691
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
692 692
 
693 693
 	}
694 694
 
@@ -702,17 +702,17 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function get_type() {
704 704
 
705
-		if ( ! isset( $this->type ) ) {
705
+		if ( ! isset($this->type)) {
706 706
 
707
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
707
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
708 708
 
709
-			if ( empty( $this->type ) ) {
709
+			if (empty($this->type)) {
710 710
 				$this->type = 'set';
711 711
 			}
712 712
 
713 713
 		}
714 714
 
715
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
715
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
716 716
 
717 717
 	}
718 718
 
@@ -728,23 +728,23 @@  discard block
 block discarded – undo
728 728
 	 *
729 729
 	 * @return string
730 730
 	 */
731
-	public function get_form_classes( $args ) {
731
+	public function get_form_classes($args) {
732 732
 
733
-		$float_labels_option = give_is_float_labels_enabled( $args )
733
+		$float_labels_option = give_is_float_labels_enabled($args)
734 734
 			? 'float-labels-enabled'
735 735
 			: '';
736 736
 
737
-		$form_classes_array = apply_filters( 'give_form_classes', array(
737
+		$form_classes_array = apply_filters('give_form_classes', array(
738 738
 			'give-form',
739
-			'give-form-' . $this->ID,
740
-			'give-form-type-' . $this->get_type(),
739
+			'give-form-'.$this->ID,
740
+			'give-form-type-'.$this->get_type(),
741 741
 			$float_labels_option,
742
-		), $this->ID, $args );
742
+		), $this->ID, $args);
743 743
 
744 744
 		// Remove empty class names.
745
-		$form_classes_array = array_filter( $form_classes_array );
745
+		$form_classes_array = array_filter($form_classes_array);
746 746
 
747
-		return implode( ' ', $form_classes_array );
747
+		return implode(' ', $form_classes_array);
748 748
 
749 749
 	}
750 750
 
@@ -759,24 +759,24 @@  discard block
 block discarded – undo
759 759
 	 *
760 760
 	 * @return string
761 761
 	 */
762
-	public function get_form_wrap_classes( $args ) {
762
+	public function get_form_wrap_classes($args) {
763 763
 
764
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
764
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
765 765
 			? $args['display_style']
766
-			: get_post_meta( $this->ID, '_give_payment_display', true );
766
+			: get_post_meta($this->ID, '_give_payment_display', true);
767 767
 
768 768
 		// If admin want to show only button for form then user inbuilt modal functionality.
769
-		if( 'button' === $display_option ) {
769
+		if ('button' === $display_option) {
770 770
 			$display_option = 'modal give-display-button-only';
771 771
 		}
772 772
 
773
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
773
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
774 774
 			'give-form-wrap',
775
-			'give-display-' . $display_option,
776
-		), $this->ID, $args );
775
+			'give-display-'.$display_option,
776
+		), $this->ID, $args);
777 777
 
778 778
 
779
-		return implode( ' ', $form_wrap_classes_array );
779
+		return implode(' ', $form_wrap_classes_array);
780 780
 
781 781
 	}
782 782
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	public function is_set_type_donation_form() {
792 792
 		$form_type = $this->get_type();
793 793
 
794
-		return ( 'set' === $form_type ? true : false );
794
+		return ('set' === $form_type ? true : false);
795 795
 	}
796 796
 
797 797
 	/**
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	public function is_multi_type_donation_form() {
806 806
 		$form_type = $this->get_type();
807 807
 
808
-		return ( 'multi' === $form_type ? true : false );
808
+		return ('multi' === $form_type ? true : false);
809 809
 
810 810
 	}
811 811
 
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 	 */
820 820
 	public function get_sales() {
821 821
 
822
-		if ( ! isset( $this->sales ) ) {
822
+		if ( ! isset($this->sales)) {
823 823
 
824
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
825
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
824
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
825
+				add_post_meta($this->ID, '_give_form_sales', 0);
826 826
 			} // End if
827 827
 
828
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
828
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
829 829
 
830
-			if ( $this->sales < 0 ) {
830
+			if ($this->sales < 0) {
831 831
 				// Never let sales be less than zero
832 832
 				$this->sales = 0;
833 833
 			}
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @return int|false     New number of total sales.
850 850
 	 */
851
-	public function increase_sales( $quantity = 1 ) {
851
+	public function increase_sales($quantity = 1) {
852 852
 
853
-		$sales       = give_get_form_sales_stats( $this->ID );
854
-		$quantity    = absint( $quantity );
853
+		$sales       = give_get_form_sales_stats($this->ID);
854
+		$quantity    = absint($quantity);
855 855
 		$total_sales = $sales + $quantity;
856 856
 
857
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
857
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
858 858
 
859 859
 			$this->sales = $total_sales;
860 860
 
@@ -875,17 +875,17 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @return int|false     New number of total sales.
877 877
 	 */
878
-	public function decrease_sales( $quantity = 1 ) {
878
+	public function decrease_sales($quantity = 1) {
879 879
 
880
-		$sales = give_get_form_sales_stats( $this->ID );
880
+		$sales = give_get_form_sales_stats($this->ID);
881 881
 
882 882
 		// Only decrease if not already zero
883
-		if ( $sales > 0 ) {
883
+		if ($sales > 0) {
884 884
 
885
-			$quantity    = absint( $quantity );
885
+			$quantity    = absint($quantity);
886 886
 			$total_sales = $sales - $quantity;
887 887
 
888
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
888
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
889 889
 
890 890
 				$this->sales = $sales;
891 891
 
@@ -909,15 +909,15 @@  discard block
 block discarded – undo
909 909
 	 */
910 910
 	public function get_earnings() {
911 911
 
912
-		if ( ! isset( $this->earnings ) ) {
912
+		if ( ! isset($this->earnings)) {
913 913
 
914
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
915
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
914
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
915
+				add_post_meta($this->ID, '_give_form_earnings', 0);
916 916
 			}
917 917
 
918
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
918
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
919 919
 
920
-			if ( $this->earnings < 0 ) {
920
+			if ($this->earnings < 0) {
921 921
 				// Never let earnings be less than zero
922 922
 				$this->earnings = 0;
923 923
 			}
@@ -938,12 +938,12 @@  discard block
 block discarded – undo
938 938
 	 *
939 939
 	 * @return float|false
940 940
 	 */
941
-	public function increase_earnings( $amount = 0 ) {
941
+	public function increase_earnings($amount = 0) {
942 942
 
943
-		$earnings   = give_get_form_earnings_stats( $this->ID );
943
+		$earnings   = give_get_form_earnings_stats($this->ID);
944 944
 		$new_amount = $earnings + (float) $amount;
945 945
 
946
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
946
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
947 947
 
948 948
 			$this->earnings = $new_amount;
949 949
 
@@ -965,16 +965,16 @@  discard block
 block discarded – undo
965 965
 	 *
966 966
 	 * @return float|false
967 967
 	 */
968
-	public function decrease_earnings( $amount ) {
968
+	public function decrease_earnings($amount) {
969 969
 
970
-		$earnings = give_get_form_earnings_stats( $this->ID );
970
+		$earnings = give_get_form_earnings_stats($this->ID);
971 971
 
972
-		if ( $earnings > 0 ) {
972
+		if ($earnings > 0) {
973 973
 			// Only decrease if greater than zero
974 974
 			$new_amount = $earnings - (float) $amount;
975 975
 
976 976
 
977
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
977
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
978 978
 
979 979
 				$this->earnings = $new_amount;
980 980
 
@@ -998,22 +998,22 @@  discard block
 block discarded – undo
998 998
 	 *
999 999
 	 * @return bool
1000 1000
 	 */
1001
-	public function is_free( $price_id = false ) {
1001
+	public function is_free($price_id = false) {
1002 1002
 
1003 1003
 		$is_free          = false;
1004
-		$variable_pricing = give_has_variable_prices( $this->ID );
1004
+		$variable_pricing = give_has_variable_prices($this->ID);
1005 1005
 
1006
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
1007
-			$price = give_get_price_option_amount( $this->ID, $price_id );
1008
-		} elseif ( ! $variable_pricing ) {
1009
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
1006
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
1007
+			$price = give_get_price_option_amount($this->ID, $price_id);
1008
+		} elseif ( ! $variable_pricing) {
1009
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1010 1010
 		}
1011 1011
 
1012
-		if ( isset( $price ) && (float) $price == 0 ) {
1012
+		if (isset($price) && (float) $price == 0) {
1013 1013
 			$is_free = true;
1014 1014
 		}
1015 1015
 
1016
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1016
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1017 1017
 
1018 1018
 	}
1019 1019
 
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
 		$is_close_form = apply_filters(
1041 1041
 			'give_is_close_donation_form',
1042 1042
 			(
1043
-			give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) )
1044
-			&& give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1045
-			&& ( $this->get_goal() <= $this->get_earnings()
1043
+			give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) )
1044
+			&& give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1045
+			&& ($this->get_goal() <= $this->get_earnings()
1046 1046
 			),
1047 1047
 			$this->ID
1048 1048
 		);
@@ -1061,29 +1061,29 @@  discard block
 block discarded – undo
1061 1061
 	 *
1062 1062
 	 * @return bool                            The result of the update query.
1063 1063
 	 */
1064
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1064
+	private function update_meta($meta_key = '', $meta_value = '') {
1065 1065
 
1066 1066
 		/* @var WPDB $wpdb */
1067 1067
 		global $wpdb;
1068 1068
 
1069
-		if ( empty( $meta_key ) ) {
1069
+		if (empty($meta_key)) {
1070 1070
 			return false;
1071 1071
 		}
1072 1072
 
1073 1073
 		// Make sure if it needs to be serialized, we do
1074
-		$meta_value = maybe_serialize( $meta_value );
1074
+		$meta_value = maybe_serialize($meta_value);
1075 1075
 
1076
-		if ( is_numeric( $meta_value ) ) {
1077
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1076
+		if (is_numeric($meta_value)) {
1077
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1078 1078
 		} else {
1079 1079
 			$value_type = "'%s'";
1080 1080
 		}
1081 1081
 
1082
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1082
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1083 1083
 
1084
-		if ( $wpdb->query( $sql ) ) {
1084
+		if ($wpdb->query($sql)) {
1085 1085
 
1086
-			clean_post_cache( $this->ID );
1086
+			clean_post_cache($this->ID);
1087 1087
 
1088 1088
 			return true;
1089 1089
 
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +140 added lines, -140 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,36 +23,36 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	// Give Forms single post and archive options.
26
-	$give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) );
27
-	$give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) );
26
+	$give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular'));
27
+	$give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives'));
28 28
 
29
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
29
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
30 30
 	// Support for old 'GIVE_FORMS_SLUG' constant
31
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
31
+	if (defined('GIVE_FORMS_SLUG')) {
32 32
 		$give_forms_slug = GIVE_FORMS_SLUG;
33 33
 	}
34 34
 
35
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
35
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36 36
 		'slug'       => $give_forms_slug,
37 37
 		'with_front' => false,
38 38
 	);
39 39
 
40
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
41
-		'name'               => esc_html__( 'Donation Forms', 'give' ),
42
-		'singular_name'      => esc_html__( 'Form', 'give' ),
43
-		'add_new'            => esc_html__( 'Add Form', 'give' ),
44
-		'add_new_item'       => esc_html__( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => esc_html__( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => esc_html__( 'New Form', 'give' ),
47
-		'all_items'          => esc_html__( 'All Forms', 'give' ),
48
-		'view_item'          => esc_html__( 'View Form', 'give' ),
49
-		'search_items'       => esc_html__( 'Search Forms', 'give' ),
50
-		'not_found'          => esc_html__( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => esc_html__('Donation Forms', 'give'),
42
+		'singular_name'      => esc_html__('Form', 'give'),
43
+		'add_new'            => esc_html__('Add Form', 'give'),
44
+		'add_new_item'       => esc_html__('Add New Donation Form', 'give'),
45
+		'edit_item'          => esc_html__('Edit Donation Form', 'give'),
46
+		'new_item'           => esc_html__('New Form', 'give'),
47
+		'all_items'          => esc_html__('All Forms', 'give'),
48
+		'view_item'          => esc_html__('View Form', 'give'),
49
+		'search_items'       => esc_html__('Search Forms', 'give'),
50
+		'not_found'          => esc_html__('No forms found.', 'give'),
51
+		'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) ),
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give')),
55
+	));
56 56
 
57 57
 	// Default give_forms supports.
58 58
 	$give_form_supports = array(
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 
66 66
 	// Has the user disabled the excerpt?
67
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
68
-		unset( $give_form_supports[2] );
67
+	if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) {
68
+		unset($give_form_supports[2]);
69 69
 	}
70 70
 
71 71
 	// Has user disabled the featured image?
72
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
73
-		unset( $give_form_supports[1] );
74
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
72
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
73
+		unset($give_form_supports[1]);
74
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
75 75
 	}
76 76
 
77 77
 	$give_forms_args = array(
@@ -87,42 +87,42 @@  discard block
 block discarded – undo
87 87
 		'has_archive'        => $give_forms_archives,
88 88
 		'menu_icon'          => 'dashicons-give',
89 89
 		'hierarchical'       => false,
90
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
90
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
91 91
 	);
92
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
92
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
93 93
 
94 94
 	/** Donation Post Type */
95 95
 	$payment_labels = array(
96
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
97
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
98
-		'add_new'            => esc_html__( 'Add New', 'give' ),
99
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
100
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
101
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
102
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
103
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
104
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
105
-		'not_found'          => esc_html__( 'No donations found.', 'give' ),
106
-		'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ),
96
+		'name'               => _x('Donations', 'post type general name', 'give'),
97
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
98
+		'add_new'            => esc_html__('Add New', 'give'),
99
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
100
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
101
+		'new_item'           => esc_html__('New Donation', 'give'),
102
+		'all_items'          => esc_html__('All Donations', 'give'),
103
+		'view_item'          => esc_html__('View Donation', 'give'),
104
+		'search_items'       => esc_html__('Search Donations', 'give'),
105
+		'not_found'          => esc_html__('No donations found.', 'give'),
106
+		'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'),
107 107
 		'parent_item_colon'  => '',
108
-		'menu_name'          => esc_html__( 'Donations', 'give' ),
108
+		'menu_name'          => esc_html__('Donations', 'give'),
109 109
 	);
110 110
 
111 111
 	$payment_args = array(
112
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
112
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
113 113
 		'public'          => false,
114 114
 		'query_var'       => false,
115 115
 		'rewrite'         => false,
116 116
 		'map_meta_cap'    => true,
117 117
 		'capability_type' => 'give_payment',
118
-		'supports'        => array( 'title' ),
118
+		'supports'        => array('title'),
119 119
 		'can_export'      => true,
120 120
 	);
121
-	register_post_type( 'give_payment', $payment_args );
121
+	register_post_type('give_payment', $payment_args);
122 122
 
123 123
 }
124 124
 
125
-add_action( 'init', 'give_setup_post_types', 1 );
125
+add_action('init', 'give_setup_post_types', 1);
126 126
 
127 127
 
128 128
 /**
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_setup_taxonomies() {
137 137
 
138
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
138
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
139 139
 
140 140
 	/** Categories */
141 141
 	$category_labels = array(
142
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
143
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
144
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
145
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
146
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
147
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
148
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
149
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
150
-		'add_new_item'      => esc_html__( 'Add New Category', 'give' ),
151
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
152
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
142
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
143
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
144
+		'search_items'      => esc_html__('Search Categories', 'give'),
145
+		'all_items'         => esc_html__('All Categories', 'give'),
146
+		'parent_item'       => esc_html__('Parent Category', 'give'),
147
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
148
+		'edit_item'         => esc_html__('Edit Category', 'give'),
149
+		'update_item'       => esc_html__('Update Category', 'give'),
150
+		'add_new_item'      => esc_html__('Add New Category', 'give'),
151
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
152
+		'menu_name'         => esc_html__('Categories', 'give'),
153 153
 	);
154 154
 
155
-	$category_args = apply_filters( 'give_forms_category_args', array(
155
+	$category_args = apply_filters('give_forms_category_args', array(
156 156
 			'hierarchical' => true,
157
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
157
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
158 158
 			'show_ui'      => true,
159 159
 			'query_var'    => 'give_forms_category',
160 160
 			'rewrite'      => array(
161
-				'slug'         => $slug . '/category',
161
+				'slug'         => $slug.'/category',
162 162
 				'with_front'   => false,
163 163
 				'hierarchical' => true,
164 164
 			),
@@ -172,33 +172,33 @@  discard block
 block discarded – undo
172 172
 	);
173 173
 
174 174
 	// Does the user want categories?
175
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
176
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
177
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
175
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
176
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
177
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
178 178
 	}
179 179
 
180 180
 	/** Tags */
181 181
 	$tag_labels = array(
182
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
183
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
184
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
185
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
186
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
187
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
188
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
189
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
190
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
191
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
192
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
193
-		'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ),
182
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
183
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
184
+		'search_items'          => esc_html__('Search Tags', 'give'),
185
+		'all_items'             => esc_html__('All Tags', 'give'),
186
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
187
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
188
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
189
+		'update_item'           => esc_html__('Update Tag', 'give'),
190
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
191
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
192
+		'menu_name'             => esc_html__('Tags', 'give'),
193
+		'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'),
194 194
 	);
195 195
 
196
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
196
+	$tag_args = apply_filters('give_forms_tag_args', array(
197 197
 			'hierarchical' => false,
198
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
198
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
199 199
 			'show_ui'      => true,
200 200
 			'query_var'    => 'give_forms_tag',
201
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
201
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
202 202
 			'capabilities' => array(
203 203
 				'manage_terms' => 'manage_give_form_terms',
204 204
 				'edit_terms'   => 'edit_give_form_terms',
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 		)
209 209
 	);
210 210
 
211
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
212
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
213
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
211
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
212
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
213
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
214 214
 	}
215 215
 
216 216
 }
217 217
 
218
-add_action( 'init', 'give_setup_taxonomies', 0 );
218
+add_action('init', 'give_setup_taxonomies', 0);
219 219
 
220 220
 
221 221
 /**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function give_get_default_form_labels() {
228 228
 	$defaults = array(
229
-		'singular' => esc_html__( 'Form', 'give' ),
230
-		'plural'   => esc_html__( 'Forms', 'give' ),
229
+		'singular' => esc_html__('Form', 'give'),
230
+		'plural'   => esc_html__('Forms', 'give'),
231 231
 	);
232 232
 
233
-	return apply_filters( 'give_default_form_name', $defaults );
233
+	return apply_filters('give_default_form_name', $defaults);
234 234
 }
235 235
 
236 236
 /**
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return string $defaults['singular'] Singular label
244 244
  */
245
-function give_get_forms_label_singular( $lowercase = false ) {
245
+function give_get_forms_label_singular($lowercase = false) {
246 246
 	$defaults = give_get_default_form_labels();
247 247
 
248
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
248
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
249 249
 }
250 250
 
251 251
 /**
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
  * @since 1.0
255 255
  * @return string $defaults['plural'] Plural label
256 256
  */
257
-function give_get_forms_label_plural( $lowercase = false ) {
257
+function give_get_forms_label_plural($lowercase = false) {
258 258
 	$defaults = give_get_default_form_labels();
259 259
 
260
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
260
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
261 261
 }
262 262
 
263 263
 /**
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return string $title New placeholder text
271 271
  */
272
-function give_change_default_title( $title ) {
272
+function give_change_default_title($title) {
273 273
 	// If a frontend plugin uses this filter (check extensions before changing this function)
274
-	if ( ! is_admin() ) {
275
-		$title = esc_html__( 'Enter form title here', 'give' );
274
+	if ( ! is_admin()) {
275
+		$title = esc_html__('Enter form title here', 'give');
276 276
 
277 277
 		return $title;
278 278
 	}
279 279
 
280 280
 	$screen = get_current_screen();
281 281
 
282
-	if ( 'give_forms' == $screen->post_type ) {
283
-		$title = esc_html__( 'Enter form title here', 'give' );
282
+	if ('give_forms' == $screen->post_type) {
283
+		$title = esc_html__('Enter form title here', 'give');
284 284
 	}
285 285
 
286 286
 	return $title;
287 287
 }
288 288
 
289
-add_filter( 'enter_title_here', 'give_change_default_title' );
289
+add_filter('enter_title_here', 'give_change_default_title');
290 290
 
291 291
 /**
292 292
  * Registers Custom Post Statuses which are used by the Payments
@@ -296,50 +296,50 @@  discard block
 block discarded – undo
296 296
  */
297 297
 function give_register_post_type_statuses() {
298 298
 	// Payment Statuses
299
-	register_post_status( 'refunded', array(
300
-		'label'                     => esc_html__( 'Refunded', 'give' ),
299
+	register_post_status('refunded', array(
300
+		'label'                     => esc_html__('Refunded', 'give'),
301 301
 		'public'                    => true,
302 302
 		'exclude_from_search'       => false,
303 303
 		'show_in_admin_all_list'    => true,
304 304
 		'show_in_admin_status_list' => true,
305
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
306
-	) );
307
-	register_post_status( 'failed', array(
308
-		'label'                     => esc_html__( 'Failed', 'give' ),
305
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'),
306
+	));
307
+	register_post_status('failed', array(
308
+		'label'                     => esc_html__('Failed', 'give'),
309 309
 		'public'                    => true,
310 310
 		'exclude_from_search'       => false,
311 311
 		'show_in_admin_all_list'    => true,
312 312
 		'show_in_admin_status_list' => true,
313
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
314
-	) );
315
-	register_post_status( 'revoked', array(
316
-		'label'                     => esc_html__( 'Revoked', 'give' ),
313
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'),
314
+	));
315
+	register_post_status('revoked', array(
316
+		'label'                     => esc_html__('Revoked', 'give'),
317 317
 		'public'                    => true,
318 318
 		'exclude_from_search'       => false,
319 319
 		'show_in_admin_all_list'    => true,
320 320
 		'show_in_admin_status_list' => true,
321
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
322
-	) );
323
-	register_post_status( 'cancelled', array(
324
-		'label'                     => esc_html__( 'Cancelled', 'give' ),
321
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'),
322
+	));
323
+	register_post_status('cancelled', array(
324
+		'label'                     => esc_html__('Cancelled', 'give'),
325 325
 		'public'                    => true,
326 326
 		'exclude_from_search'       => false,
327 327
 		'show_in_admin_all_list'    => true,
328 328
 		'show_in_admin_status_list' => true,
329
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
330
-	) );
331
-	register_post_status( 'abandoned', array(
332
-		'label'                     => esc_html__( 'Abandoned', 'give' ),
329
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'),
330
+	));
331
+	register_post_status('abandoned', array(
332
+		'label'                     => esc_html__('Abandoned', 'give'),
333 333
 		'public'                    => true,
334 334
 		'exclude_from_search'       => false,
335 335
 		'show_in_admin_all_list'    => true,
336 336
 		'show_in_admin_status_list' => true,
337
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
338
-	) );
337
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'),
338
+	));
339 339
 
340 340
 }
341 341
 
342
-add_action( 'init', 'give_register_post_type_statuses' );
342
+add_action('init', 'give_register_post_type_statuses');
343 343
 
344 344
 /**
345 345
  * Updated Messages
@@ -352,27 +352,27 @@  discard block
 block discarded – undo
352 352
  *
353 353
  * @return array $messages New post updated messages
354 354
  */
355
-function give_updated_messages( $messages ) {
355
+function give_updated_messages($messages) {
356 356
 	global $post, $post_ID;
357 357
 
358
-	if ( give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) {
358
+	if (give_is_setting_enabled(give_get_option('forms_singular'))) {
359 359
 
360 360
 		$messages['give_forms'] = array(
361
-			1 => esc_html__( 'Form updated.', 'give' ),
362
-			4 => esc_html__( 'Form updated.', 'give' ),
363
-			6 => esc_html__( 'Form published.', 'give' ),
364
-			7 => esc_html__( 'Form saved.', 'give' ),
365
-			8 => esc_html__( 'Form submitted.', 'give' ),
361
+			1 => esc_html__('Form updated.', 'give'),
362
+			4 => esc_html__('Form updated.', 'give'),
363
+			6 => esc_html__('Form published.', 'give'),
364
+			7 => esc_html__('Form saved.', 'give'),
365
+			8 => esc_html__('Form submitted.', 'give'),
366 366
 		);
367 367
 
368 368
 	} else {
369 369
 
370 370
 		$messages['give_forms'] = array(
371
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
372
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
373
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
374
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
375
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
371
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
372
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
373
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
374
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
375
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
376 376
 		);
377 377
 
378 378
 	}
@@ -380,27 +380,27 @@  discard block
 block discarded – undo
380 380
 	return $messages;
381 381
 }
382 382
 
383
-add_filter( 'post_updated_messages', 'give_updated_messages' );
383
+add_filter('post_updated_messages', 'give_updated_messages');
384 384
 
385 385
 
386 386
 /**
387 387
  * Setup Post Type Images
388 388
  */
389
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
389
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
390 390
 
391 391
 /**
392 392
  * Ensure post thumbnail support is turned on
393 393
  */
394 394
 function give_add_thumbnail_support() {
395
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
395
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
396 396
 		return;
397 397
 	}
398 398
 
399
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
400
-		add_theme_support( 'post-thumbnails' );
399
+	if ( ! current_theme_supports('post-thumbnails')) {
400
+		add_theme_support('post-thumbnails');
401 401
 	}
402 402
 
403
-	add_post_type_support( 'give_forms', 'thumbnail' );
403
+	add_post_type_support('give_forms', 'thumbnail');
404 404
 }
405 405
 
406 406
 /**
@@ -412,21 +412,21 @@  discard block
 block discarded – undo
412 412
 
413 413
 	// Single Give Forms (disabled if single turned off in settings)
414 414
 	if (
415
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) )
416
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
415
+		give_is_setting_enabled(give_get_option('forms_singular'))
416
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
417 417
 	) {
418 418
 
419
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
420
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
419
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
420
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
421 421
 			'id'            => 'give-forms-sidebar',
422
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
422
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
423 423
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
424 424
 			'after_widget'  => '</div>',
425 425
 			'before_title'  => '<h3 class="widgettitle widget-title">',
426 426
 			'after_title'   => '</h3>',
427
-		) ) );
427
+		)));
428 428
 
429 429
 	}
430 430
 }
431 431
 
432
-add_action( 'widgets_init', 'give_widgets_init', 999 );
432
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 3 patches
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -641,9 +641,12 @@  discard block
 block discarded – undo
641 641
 							<a href="#<?php echo $form_data_tab['id']; ?>">
642 642
 								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
643 643
 									<?php echo $form_data_tab['icon-html']; ?>
644
-								<?php else : ?>
644
+								<?php else {
645
+	: ?>
645 646
 									<span class="give-icon give-icon-default"></span>
646
-								<?php endif; ?>
647
+								<?php endif;
648
+}
649
+?>
647 650
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
648 651
 							</a>
649 652
 							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
@@ -653,9 +656,12 @@  discard block
 block discarded – undo
653 656
 											<a href="#<?php echo $sub_tab['id']; ?>">
654 657
 												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
655 658
 													<?php echo $sub_tab['icon-html']; ?>
656
-												<?php else : ?>
659
+												<?php else {
660
+	: ?>
657 661
 													<span class="give-icon give-icon-default"></span>
658
-												<?php endif; ?>
662
+												<?php endif;
663
+}
664
+?>
659 665
 												<span class="give-label"><?php echo $sub_tab['label']; ?></span>
660 666
 											</a>
661 667
 										</li>
@@ -682,11 +688,14 @@  discard block
 block discarded – undo
682 688
 						</div>
683 689
 
684 690
 						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
685
-					<?php else: ?>
691
+					<?php else {
692
+	: ?>
686 693
 						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
687 694
 							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
688 695
 								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
689
-									<div id="<?php echo $sub_fields['id']; ?>"
696
+									<div id="<?php echo $sub_fields['id'];
697
+}
698
+?>"
690 699
 										 class="panel give_options_panel give-hidden">
691 700
 										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
692 701
 											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 						'desc'       => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
400 400
 						'id'         => $prefix . 'form_goal_achieved_message',
401 401
 						'type'       => 'wysiwyg',
402
-                        'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
402
+						'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
403 403
 					),
404 404
 					array(
405 405
 						'name'  => 'donation_goal_docs',
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 
672 672
 						<div id="<?php echo $setting['id']; ?>"
673 673
 							 class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
674
-						     $show_first_tab_content = false; ?>">
674
+							 $show_first_tab_content = false; ?>">
675 675
 							<?php if ( ! empty( $setting['fields'] ) ) : ?>
676 676
 								<?php foreach ( $setting['fields'] as $field ) : ?>
677 677
 									<?php give_render_field( $field ); ?>
Please login to merge, or discard this patch.
Spacing   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = esc_html__( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = esc_html__('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 30 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 30);
56 56
 
57 57
 		// Save form meta.
58
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
58
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
59 59
 
60 60
 		// cmb2 old setting loaders.
61 61
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
62 62
 		// Add offline donations options.
63
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
63
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
64 64
 	}
65 65
 
66 66
 
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	function get_settings() {
85 85
 		$post_id               = give_get_admin_post_id();
86
-		$price                 = give_get_form_price( $post_id );
87
-		$custom_amount_minimum = give_get_form_minimum_price( $post_id );
88
-		$goal                  = give_get_form_goal( $post_id );
86
+		$price                 = give_get_form_price($post_id);
87
+		$custom_amount_minimum = give_get_form_minimum_price($post_id);
88
+		$goal                  = give_get_form_goal($post_id);
89 89
 
90 90
 		// No empty prices - min. 1.00 for new forms
91
-		if ( empty( $price ) && is_null( $post_id ) ) {
92
-			$price = esc_attr( give_format_decimal( '1.00' ) );
91
+		if (empty($price) && is_null($post_id)) {
92
+			$price = esc_attr(give_format_decimal('1.00'));
93 93
 		}
94 94
 
95 95
 		// Min. $1.00 for new forms
96
-		if ( empty( $custom_amount_minimum ) ) {
97
-			$custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) );
96
+		if (empty($custom_amount_minimum)) {
97
+			$custom_amount_minimum = esc_attr(give_format_decimal('1.00'));
98 98
 		}
99 99
 
100 100
 		// Start with an underscore to hide fields from custom fields list
@@ -104,215 +104,215 @@  discard block
 block discarded – undo
104 104
 			/**
105 105
 			 * Repeatable Field Groups
106 106
 			 */
107
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
107
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
108 108
 				'id'        => 'form_field_options',
109
-				'title'     => esc_html__( 'Donation Options', 'give' ),
109
+				'title'     => esc_html__('Donation Options', 'give'),
110 110
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
111
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
111
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
112 112
 					// Donation Option
113 113
 					array(
114
-						'name'        => esc_html__( 'Donation Option', 'give' ),
115
-						'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
116
-						'id'          => $prefix . 'price_option',
114
+						'name'        => esc_html__('Donation Option', 'give'),
115
+						'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
116
+						'id'          => $prefix.'price_option',
117 117
 						'type'        => 'radio_inline',
118 118
 						'default'     => 'set',
119
-						'options'     => apply_filters( 'give_forms_price_options', array(
120
-							'set'   => esc_html__( 'Set Donation', 'give' ),
121
-							'multi' => esc_html__( 'Multi-level Donation', 'give' ),
122
-						) ),
119
+						'options'     => apply_filters('give_forms_price_options', array(
120
+							'set'   => esc_html__('Set Donation', 'give'),
121
+							'multi' => esc_html__('Multi-level Donation', 'give'),
122
+						)),
123 123
 					),
124 124
 					array(
125
-						'name'        => esc_html__( 'Set Donation', 'give' ),
126
-						'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
127
-						'id'          => $prefix . 'set_price',
125
+						'name'        => esc_html__('Set Donation', 'give'),
126
+						'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
127
+						'id'          => $prefix.'set_price',
128 128
 						'type'        => 'text_small',
129 129
 						'data_type'   => 'price',
130 130
 						'attributes'  => array(
131
-							'placeholder' => give_format_decimal( '1.00' ),
132
-							'value'       => give_format_decimal( $price ),
131
+							'placeholder' => give_format_decimal('1.00'),
132
+							'value'       => give_format_decimal($price),
133 133
 							'class'       => 'give-money-field',
134 134
 						),
135 135
 					),
136 136
 					// Display Style
137 137
 					array(
138
-						'name'        => esc_html__( 'Display Style', 'give' ),
139
-						'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
140
-						'id'          => $prefix . 'display_style',
138
+						'name'        => esc_html__('Display Style', 'give'),
139
+						'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
140
+						'id'          => $prefix.'display_style',
141 141
 						'type'        => 'radio_inline',
142 142
 						'default'     => 'buttons',
143 143
 						'options'     => array(
144
-							'buttons'  => esc_html__( 'Buttons', 'give' ),
145
-							'radios'   => esc_html__( 'Radios', 'give' ),
146
-							'dropdown' => esc_html__( 'Dropdown', 'give' ),
144
+							'buttons'  => esc_html__('Buttons', 'give'),
145
+							'radios'   => esc_html__('Radios', 'give'),
146
+							'dropdown' => esc_html__('Dropdown', 'give'),
147 147
 						),
148 148
 					),
149 149
 					// Custom Amount
150 150
 					array(
151
-						'name'        => esc_html__( 'Custom Amount', 'give' ),
152
-						'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
153
-						'id'          => $prefix . 'custom_amount',
151
+						'name'        => esc_html__('Custom Amount', 'give'),
152
+						'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
153
+						'id'          => $prefix.'custom_amount',
154 154
 						'type'        => 'radio_inline',
155 155
 						'default'     => 'disabled',
156 156
 						'options'     => array(
157
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
158
-							'disabled' => esc_html__( 'Disabled', 'give' ),
157
+							'enabled'  => esc_html__('Enabled', 'give'),
158
+							'disabled' => esc_html__('Disabled', 'give'),
159 159
 						),
160 160
 					),
161 161
 					array(
162
-						'name'        => esc_html__( 'Minimum Amount', 'give' ),
163
-						'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ),
164
-						'id'          => $prefix . 'custom_amount_minimum',
162
+						'name'        => esc_html__('Minimum Amount', 'give'),
163
+						'description' => esc_html__('Enter the minimum custom donation amount.', 'give'),
164
+						'id'          => $prefix.'custom_amount_minimum',
165 165
 						'type'        => 'text_small',
166 166
 						'data_type'   => 'price',
167 167
 						'attributes'  => array(
168
-							'placeholder' => give_format_decimal( '1.00' ),
169
-							'value'       => give_format_decimal( $custom_amount_minimum ),
168
+							'placeholder' => give_format_decimal('1.00'),
169
+							'value'       => give_format_decimal($custom_amount_minimum),
170 170
 							'class'       => 'give-money-field',
171 171
 						),
172 172
 					),
173 173
 					array(
174
-						'name'        => esc_html__( 'Custom Amount Text', 'give' ),
175
-						'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
176
-						'id'          => $prefix . 'custom_amount_text',
174
+						'name'        => esc_html__('Custom Amount Text', 'give'),
175
+						'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
176
+						'id'          => $prefix.'custom_amount_text',
177 177
 						'type'        => 'text_medium',
178 178
 						'attributes'  => array(
179 179
 							'rows'        => 3,
180
-							'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
180
+							'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
181 181
 						),
182 182
 					),
183 183
 					// Donation Levels: Repeatable CMB2 Group
184 184
 					array(
185
-						'id'      => $prefix . 'donation_levels',
185
+						'id'      => $prefix.'donation_levels',
186 186
 						'type'    => 'group',
187 187
 						'options' => array(
188
-							'add_button'    => esc_html__( 'Add Level', 'give' ),
189
-							'header_title'  => esc_html__( 'Donation Level', 'give' ),
188
+							'add_button'    => esc_html__('Add Level', 'give'),
189
+							'header_title'  => esc_html__('Donation Level', 'give'),
190 190
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
191 191
 						),
192 192
 						// Fields array works the same, except id's only need to be unique for this group.
193 193
 						// Prefix is not needed.
194
-						'fields'  => apply_filters( 'give_donation_levels_table_row', array(
194
+						'fields'  => apply_filters('give_donation_levels_table_row', array(
195 195
 							array(
196
-								'name' => esc_html__( 'ID', 'give' ),
197
-								'id'   => $prefix . 'id',
196
+								'name' => esc_html__('ID', 'give'),
197
+								'id'   => $prefix.'id',
198 198
 								'type' => 'levels_id',
199 199
 							),
200 200
 							array(
201
-								'name'       => esc_html__( 'Amount', 'give' ),
202
-								'id'         => $prefix . 'amount',
201
+								'name'       => esc_html__('Amount', 'give'),
202
+								'id'         => $prefix.'amount',
203 203
 								'type'       => 'text_small',
204 204
 								'data_type'  => 'price',
205 205
 								'attributes' => array(
206
-									'placeholder' => give_format_decimal( '1.00' ),
206
+									'placeholder' => give_format_decimal('1.00'),
207 207
 									'class'       => 'give-money-field',
208 208
 								),
209 209
 							),
210 210
 							array(
211
-								'name'       => esc_html__( 'Text', 'give' ),
212
-								'id'         => $prefix . 'text',
211
+								'name'       => esc_html__('Text', 'give'),
212
+								'id'         => $prefix.'text',
213 213
 								'type'       => 'text',
214 214
 								'attributes' => array(
215
-									'placeholder' => esc_html__( 'Donation Level', 'give' ),
215
+									'placeholder' => esc_html__('Donation Level', 'give'),
216 216
 									'class'       => 'give-multilevel-text-field',
217 217
 								),
218 218
 							),
219 219
 							array(
220
-								'name' => esc_html__( 'Default', 'give' ),
221
-								'id'   => $prefix . 'default',
220
+								'name' => esc_html__('Default', 'give'),
221
+								'id'   => $prefix.'default',
222 222
 								'type' => 'give_default_radio_inline',
223 223
 							),
224
-						) ),
224
+						)),
225 225
 					),
226 226
 					array(
227 227
 						'name'  => 'donation_options_docs',
228 228
 						'type'  => 'docs_link',
229 229
 						'url'   => 'http://docs.givewp.com/form-donation-options',
230
-						'title' => esc_html__( 'Donation Options', 'give' ),
230
+						'title' => esc_html__('Donation Options', 'give'),
231 231
 					),
232 232
 				),
233 233
 					$post_id
234 234
 				),
235
-			) ),
235
+			)),
236 236
 
237 237
 			/**
238 238
 			 * Display Options
239 239
 			 */
240
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
240
+			'form_display_options'  => apply_filters('give_form_display_options', array(
241 241
 					'id'        => 'form_display_options',
242
-					'title'     => esc_html__( 'Form Display', 'give' ),
242
+					'title'     => esc_html__('Form Display', 'give'),
243 243
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
244
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
244
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
245 245
 						array(
246
-							'name'    => esc_html__( 'Display Options', 'give' ),
247
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
248
-							'id'      => $prefix . 'payment_display',
246
+							'name'    => esc_html__('Display Options', 'give'),
247
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
248
+							'id'      => $prefix.'payment_display',
249 249
 							'type'    => 'radio_inline',
250 250
 							'options' => array(
251
-								'onpage' => esc_html__( 'All Fields', 'give' ),
252
-								'modal'  => esc_html__( 'Modal', 'give' ),
253
-								'reveal' => esc_html__( 'Reveal', 'give' ),
254
-								'button' => esc_html__( 'Button', 'give' ),
251
+								'onpage' => esc_html__('All Fields', 'give'),
252
+								'modal'  => esc_html__('Modal', 'give'),
253
+								'reveal' => esc_html__('Reveal', 'give'),
254
+								'button' => esc_html__('Button', 'give'),
255 255
 							),
256 256
 							'default' => 'onpage',
257 257
 						),
258 258
 						array(
259
-							'id'         => $prefix . 'reveal_label',
260
-							'name'       => esc_html__( 'Continue Button', 'give' ),
261
-							'desc'       => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ),
259
+							'id'         => $prefix.'reveal_label',
260
+							'name'       => esc_html__('Continue Button', 'give'),
261
+							'desc'       => esc_html__('The button label for displaying the additional payment fields.', 'give'),
262 262
 							'type'       => 'text_small',
263 263
 							'attributes' => array(
264
-								'placeholder' => esc_attr__( 'Donate Now', 'give' ),
264
+								'placeholder' => esc_attr__('Donate Now', 'give'),
265 265
 							),
266 266
 						),
267 267
 						array(
268
-							'id'         => $prefix . 'checkout_label',
269
-							'name'       => esc_html__( 'Submit Button', 'give' ),
270
-							'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
268
+							'id'         => $prefix.'checkout_label',
269
+							'name'       => esc_html__('Submit Button', 'give'),
270
+							'desc'       => esc_html__('The button label for completing a donation.', 'give'),
271 271
 							'type'       => 'text_small',
272 272
 							'attributes' => array(
273
-								'placeholder' => esc_html__( 'Donate Now', 'give' ),
273
+								'placeholder' => esc_html__('Donate Now', 'give'),
274 274
 							),
275 275
 						),
276 276
 						array(
277
-							'name' => esc_html__( 'Default Gateway', 'give' ),
278
-							'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
279
-							'id'   => $prefix . 'default_gateway',
277
+							'name' => esc_html__('Default Gateway', 'give'),
278
+							'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
279
+							'id'   => $prefix.'default_gateway',
280 280
 							'type' => 'default_gateway',
281 281
 						),
282 282
 						array(
283
-							'name'    => esc_html__( 'Guest Donations', 'give' ),
284
-							'desc'    => esc_html__( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
285
-							'id'      => $prefix . 'logged_in_only',
283
+							'name'    => esc_html__('Guest Donations', 'give'),
284
+							'desc'    => esc_html__('Do you want to allow non-logged-in users to make donations?', 'give'),
285
+							'id'      => $prefix.'logged_in_only',
286 286
 							'type'    => 'radio_inline',
287 287
 							'default' => 'enabled',
288 288
 							'options' => array(
289
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
290
-								'disabled' => esc_html__( 'Disabled', 'give' ),
289
+								'enabled'  => esc_html__('Enabled', 'give'),
290
+								'disabled' => esc_html__('Disabled', 'give'),
291 291
 							),
292 292
 						),
293 293
 						array(
294
-							'name'    => esc_html__( 'Registration', 'give' ),
295
-							'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
296
-							'id'      => $prefix . 'show_register_form',
294
+							'name'    => esc_html__('Registration', 'give'),
295
+							'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
296
+							'id'      => $prefix.'show_register_form',
297 297
 							'type'    => 'radio',
298 298
 							'options' => array(
299
-								'none'         => esc_html__( 'None', 'give' ),
300
-								'registration' => esc_html__( 'Registration', 'give' ),
301
-								'login'        => esc_html__( 'Login', 'give' ),
302
-								'both'         => esc_html__( 'Registration + Login', 'give' ),
299
+								'none'         => esc_html__('None', 'give'),
300
+								'registration' => esc_html__('Registration', 'give'),
301
+								'login'        => esc_html__('Login', 'give'),
302
+								'both'         => esc_html__('Registration + Login', 'give'),
303 303
 							),
304 304
 							'default' => 'none',
305 305
 						),
306 306
 						array(
307
-							'name'    => esc_html__( 'Floating Labels', 'give' ),
307
+							'name'    => esc_html__('Floating Labels', 'give'),
308 308
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
309
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
310
-							'id'      => $prefix . 'form_floating_labels',
309
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
310
+							'id'      => $prefix.'form_floating_labels',
311 311
 							'type'    => 'radio_inline',
312 312
 							'options' => array(
313
-								'global'   => esc_html__( 'Global Option', 'give' ),
314
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
315
-								'disabled' => esc_html__( 'Disabled', 'give' ),
313
+								'global'   => esc_html__('Global Option', 'give'),
314
+								'enabled'  => esc_html__('Enabled', 'give'),
315
+								'disabled' => esc_html__('Disabled', 'give'),
316 316
 							),
317 317
 							'default' => 'global',
318 318
 						),
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 							'name'  => 'form_display_docs',
321 321
 							'type'  => 'docs_link',
322 322
 							'url'   => 'http://docs.givewp.com/form-display-options',
323
-							'title' => esc_html__( 'Form Display', 'give' ),
323
+							'title' => esc_html__('Form Display', 'give'),
324 324
 						),
325 325
 					),
326 326
 						$post_id
@@ -331,191 +331,191 @@  discard block
 block discarded – undo
331 331
 			/**
332 332
 			 * Donation Goals
333 333
 			 */
334
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
334
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
335 335
 				'id'        => 'donation_goal_options',
336
-				'title'     => esc_html__( 'Donation Goal', 'give' ),
336
+				'title'     => esc_html__('Donation Goal', 'give'),
337 337
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
338
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
338
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
339 339
 					// Goals
340 340
 					array(
341
-						'name'        => esc_html__( 'Donation Goal', 'give' ),
342
-						'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
343
-						'id'          => $prefix . 'goal_option',
341
+						'name'        => esc_html__('Donation Goal', 'give'),
342
+						'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
343
+						'id'          => $prefix.'goal_option',
344 344
 						'type'        => 'radio_inline',
345 345
 						'default'     => 'disabled',
346 346
 						'options'     => array(
347
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
348
-							'disabled' => esc_html__( 'Disabled', 'give' ),
347
+							'enabled'  => esc_html__('Enabled', 'give'),
348
+							'disabled' => esc_html__('Disabled', 'give'),
349 349
 						),
350 350
 					),
351 351
 					array(
352
-						'name'        => esc_html__( 'Goal Amount', 'give' ),
353
-						'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
354
-						'id'          => $prefix . 'set_goal',
352
+						'name'        => esc_html__('Goal Amount', 'give'),
353
+						'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'),
354
+						'id'          => $prefix.'set_goal',
355 355
 						'type'        => 'text_small',
356 356
 						'data_type'   => 'price',
357 357
 						'attributes'  => array(
358
-							'placeholder' => give_format_decimal( '0.00' ),
359
-							'value'       => give_format_decimal( $goal ),
358
+							'placeholder' => give_format_decimal('0.00'),
359
+							'value'       => give_format_decimal($goal),
360 360
 							'class'       => 'give-money-field',
361 361
 						),
362 362
 					),
363 363
 
364 364
 					array(
365
-						'name'        => esc_html__( 'Goal Format', 'give' ),
366
-						'description' => esc_html__( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
367
-						'id'          => $prefix . 'goal_format',
365
+						'name'        => esc_html__('Goal Format', 'give'),
366
+						'description' => esc_html__('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
367
+						'id'          => $prefix.'goal_format',
368 368
 						'type'        => 'radio_inline',
369 369
 						'default'     => 'amount',
370 370
 						'options'     => array(
371
-							'amount'     => esc_html__( 'Amount', 'give' ),
372
-							'percentage' => esc_html__( 'Percentage', 'give' ),
371
+							'amount'     => esc_html__('Amount', 'give'),
372
+							'percentage' => esc_html__('Percentage', 'give'),
373 373
 						),
374 374
 					),
375 375
 					array(
376
-						'name'    => esc_html__( 'Progress Bar Color', 'give' ),
377
-						'desc'    => esc_html__( 'Customize the color of the goal progress bar.', 'give' ),
378
-						'id'      => $prefix . 'goal_color',
376
+						'name'    => esc_html__('Progress Bar Color', 'give'),
377
+						'desc'    => esc_html__('Customize the color of the goal progress bar.', 'give'),
378
+						'id'      => $prefix.'goal_color',
379 379
 						'type'    => 'colorpicker',
380 380
 						'default' => '#2bc253',
381 381
 					),
382 382
 
383 383
 					array(
384
-						'name'    => esc_html__( 'Close Form', 'give' ),
385
-						'desc'    => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
386
-						'id'      => $prefix . 'close_form_when_goal_achieved',
384
+						'name'    => esc_html__('Close Form', 'give'),
385
+						'desc'    => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
386
+						'id'      => $prefix.'close_form_when_goal_achieved',
387 387
 						'type'    => 'radio_inline',
388 388
 						'default' => 'disabled',
389 389
 						'options' => array(
390
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
391
-							'disabled' => esc_html__( 'Disabled', 'give' ),
390
+							'enabled'  => esc_html__('Enabled', 'give'),
391
+							'disabled' => esc_html__('Disabled', 'give'),
392 392
 						),
393 393
 					),
394 394
 					array(
395
-						'name'       => __( 'Goal Achieved Message', 'give' ),
396
-						'desc'       => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
397
-						'id'         => $prefix . 'form_goal_achieved_message',
395
+						'name'       => __('Goal Achieved Message', 'give'),
396
+						'desc'       => __('Do you want to display a custom message when the goal is closed?', 'give'),
397
+						'id'         => $prefix.'form_goal_achieved_message',
398 398
 						'type'       => 'wysiwyg',
399
-                        'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
399
+                        'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
400 400
 					),
401 401
 					array(
402 402
 						'name'  => 'donation_goal_docs',
403 403
 						'type'  => 'docs_link',
404 404
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
405
-						'title' => esc_html__( 'Donation Goal', 'give' ),
405
+						'title' => esc_html__('Donation Goal', 'give'),
406 406
 					),
407 407
 				),
408 408
 					$post_id
409 409
 				),
410
-			) ),
410
+			)),
411 411
 
412 412
 			/**
413 413
 			 * Content Field
414 414
 			 */
415
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
415
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
416 416
 				'id'        => 'form_content_options',
417
-				'title'     => esc_html__( 'Form Content', 'give' ),
417
+				'title'     => esc_html__('Form Content', 'give'),
418 418
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
419
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
419
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
420 420
 
421 421
 					// Donation content.
422 422
 					array(
423
-						'name'        => esc_html__( 'Display Content', 'give' ),
424
-						'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ),
425
-						'id'          => $prefix . 'display_content',
423
+						'name'        => esc_html__('Display Content', 'give'),
424
+						'description' => esc_html__('Do you want to add custom content to this form?', 'give'),
425
+						'id'          => $prefix.'display_content',
426 426
 						'type'        => 'radio_inline',
427 427
 						'options'     => array(
428
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
429
-							'disabled' => esc_html__( 'Disabled', 'give' ),
428
+							'enabled'  => esc_html__('Enabled', 'give'),
429
+							'disabled' => esc_html__('Disabled', 'give'),
430 430
 						),
431 431
 						'default'     => 'disabled',
432 432
 					),
433 433
 
434 434
 					// Content placement.
435 435
 					array(
436
-						'name'        => esc_html__( 'Content Placement', 'give' ),
437
-						'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ),
438
-						'id'          => $prefix . 'content_placement',
436
+						'name'        => esc_html__('Content Placement', 'give'),
437
+						'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'),
438
+						'id'          => $prefix.'content_placement',
439 439
 						'type'        => 'radio_inline',
440
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
441
-								'give_pre_form'  => esc_html__( 'Above fields', 'give' ),
442
-								'give_post_form' => esc_html__( 'Below fields', 'give' ),
440
+						'options'     => apply_filters('give_forms_content_options_select', array(
441
+								'give_pre_form'  => esc_html__('Above fields', 'give'),
442
+								'give_post_form' => esc_html__('Below fields', 'give'),
443 443
 							)
444 444
 						),
445 445
 						'default'     => 'give_pre_form',
446 446
 					),
447 447
 					array(
448
-						'name'        => esc_html__( 'Content', 'give' ),
449
-						'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
450
-						'id'          => $prefix . 'form_content',
448
+						'name'        => esc_html__('Content', 'give'),
449
+						'description' => esc_html__('This content will display on the single give form page.', 'give'),
450
+						'id'          => $prefix.'form_content',
451 451
 						'type'        => 'wysiwyg',
452 452
 					),
453 453
 					array(
454 454
 						'name'  => 'form_content_docs',
455 455
 						'type'  => 'docs_link',
456 456
 						'url'   => 'http://docs.givewp.com/form-content',
457
-						'title' => esc_html__( 'Form Content', 'give' ),
457
+						'title' => esc_html__('Form Content', 'give'),
458 458
 					),
459 459
 				),
460 460
 					$post_id
461 461
 				),
462
-			) ),
462
+			)),
463 463
 
464 464
 			/**
465 465
 			 * Terms & Conditions
466 466
 			 */
467
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
467
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
468 468
 				'id'        => 'form_terms_options',
469
-				'title'     => esc_html__( 'Terms & Conditions', 'give' ),
469
+				'title'     => esc_html__('Terms & Conditions', 'give'),
470 470
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
471
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
471
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
472 472
 					// Donation Option
473 473
 					array(
474
-						'name'        => esc_html__( 'Terms and Conditions', 'give' ),
475
-						'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
476
-						'id'          => $prefix . 'terms_option',
474
+						'name'        => esc_html__('Terms and Conditions', 'give'),
475
+						'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
476
+						'id'          => $prefix.'terms_option',
477 477
 						'type'        => 'radio_inline',
478
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
479
-								'global'   => esc_html__( 'Global Option', 'give' ),
480
-								'enabled'  => esc_html__( 'Customize', 'give' ),
481
-								'disabled' => esc_html__( 'Disable', 'give' ),
478
+						'options'     => apply_filters('give_forms_content_options_select', array(
479
+								'global'   => esc_html__('Global Option', 'give'),
480
+								'enabled'  => esc_html__('Customize', 'give'),
481
+								'disabled' => esc_html__('Disable', 'give'),
482 482
 							)
483 483
 						),
484 484
 						'default'     => 'global',
485 485
 					),
486 486
 					array(
487
-						'id'         => $prefix . 'agree_label',
488
-						'name'       => esc_html__( 'Agreement Label', 'give' ),
489
-						'desc'       => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
487
+						'id'         => $prefix.'agree_label',
488
+						'name'       => esc_html__('Agreement Label', 'give'),
489
+						'desc'       => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
490 490
 						'type'       => 'text',
491 491
 						'size'       => 'regular',
492 492
 						'attributes' => array(
493
-							'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
493
+							'placeholder' => esc_attr__('Agree to Terms?', 'give'),
494 494
 						),
495 495
 					),
496 496
 					array(
497
-						'id'   => $prefix . 'agree_text',
498
-						'name' => esc_html__( 'Agreement Text', 'give' ),
499
-						'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
497
+						'id'   => $prefix.'agree_text',
498
+						'name' => esc_html__('Agreement Text', 'give'),
499
+						'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
500 500
 						'type' => 'wysiwyg',
501 501
 					),
502 502
 					array(
503 503
 						'name'  => 'terms_docs',
504 504
 						'type'  => 'docs_link',
505 505
 						'url'   => 'http://docs.givewp.com/form-terms',
506
-						'title' => esc_html__( 'Terms and Conditions', 'give' ),
506
+						'title' => esc_html__('Terms and Conditions', 'give'),
507 507
 					),
508 508
 				),
509 509
 					$post_id
510 510
 				),
511
-			) ),
511
+			)),
512 512
 		);
513 513
 
514 514
 
515 515
 		/**
516 516
 		 * Filter the metabox tabbed panel settings.
517 517
 		 */
518
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
518
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
519 519
 
520 520
 		// Output.
521 521
 		return $settings;
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
 		add_meta_box(
532 532
 			$this->get_metabox_ID(),
533 533
 			$this->get_metabox_label(),
534
-			array( $this, 'output' ),
535
-			array( 'give_forms' ),
534
+			array($this, 'output'),
535
+			array('give_forms'),
536 536
 			'normal',
537 537
 			'high'
538 538
 		);
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	function enqueue_script() {
549 549
 		global $post;
550 550
 
551
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
551
+		if (is_object($post) && 'give_forms' === $post->post_type) {
552 552
 
553 553
 		}
554 554
 	}
@@ -583,32 +583,32 @@  discard block
 block discarded – undo
583 583
 	public function get_tabs() {
584 584
 		$tabs = array();
585 585
 
586
-		if ( ! empty( $this->settings ) ) {
587
-			foreach ( $this->settings as $setting ) {
588
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
586
+		if ( ! empty($this->settings)) {
587
+			foreach ($this->settings as $setting) {
588
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
589 589
 					continue;
590 590
 				}
591 591
 				$tab = array(
592 592
 					'id'        => $setting['id'],
593 593
 					'label'     => $setting['title'],
594
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
594
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
595 595
 				);
596 596
 
597
-				if ( $this->has_sub_tab( $setting ) ) {
598
-					if ( empty( $setting['sub-fields'] ) ) {
597
+				if ($this->has_sub_tab($setting)) {
598
+					if (empty($setting['sub-fields'])) {
599 599
 						$tab = array();
600 600
 					} else {
601
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
601
+						foreach ($setting['sub-fields'] as $sub_fields) {
602 602
 							$tab['sub-fields'][] = array(
603 603
 								'id'        => $sub_fields['id'],
604 604
 								'label'     => $sub_fields['title'],
605
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
605
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
606 606
 							);
607 607
 						}
608 608
 					}
609 609
 				}
610 610
 
611
-				if ( ! empty( $tab ) ) {
611
+				if ( ! empty($tab)) {
612 612
 					$tabs[] = $tab;
613 613
 				}
614 614
 			}
@@ -625,27 +625,27 @@  discard block
 block discarded – undo
625 625
 	 */
626 626
 	public function output() {
627 627
 		// Bailout.
628
-		if ( $form_data_tabs = $this->get_tabs() ) {
629
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
628
+		if ($form_data_tabs = $this->get_tabs()) {
629
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
630 630
 			?>
631 631
 			<div class="give-metabox-panel-wrap">
632 632
 				<ul class="give-form-data-tabs give-metabox-tabs">
633
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
634
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
633
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
634
+						<li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
635 635
 							<a href="#<?php echo $form_data_tab['id']; ?>">
636
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
636
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
637 637
 									<?php echo $form_data_tab['icon-html']; ?>
638 638
 								<?php else : ?>
639 639
 									<span class="give-icon give-icon-default"></span>
640 640
 								<?php endif; ?>
641 641
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
642 642
 							</a>
643
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
643
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
644 644
 								<ul class="give-metabox-sub-tabs give-hidden">
645
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
645
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
646 646
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
647 647
 											<a href="#<?php echo $sub_tab['id']; ?>">
648
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
648
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
649 649
 													<?php echo $sub_tab['icon-html']; ?>
650 650
 												<?php else : ?>
651 651
 													<span class="give-icon give-icon-default"></span>
@@ -661,30 +661,30 @@  discard block
 block discarded – undo
661 661
 				</ul>
662 662
 
663 663
 				<?php $show_first_tab_content = true; ?>
664
-				<?php foreach ( $this->settings as $setting ) : ?>
665
-					<?php if ( ! $this->has_sub_tab( $setting ) ) : ?>
666
-						<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
664
+				<?php foreach ($this->settings as $setting) : ?>
665
+					<?php if ( ! $this->has_sub_tab($setting)) : ?>
666
+						<?php do_action("give_before_{$setting['id']}_settings"); ?>
667 667
 
668 668
 						<div id="<?php echo $setting['id']; ?>"
669
-							 class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
669
+							 class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden');
670 670
 						     $show_first_tab_content = false; ?>">
671
-							<?php if ( ! empty( $setting['fields'] ) ) : ?>
672
-								<?php foreach ( $setting['fields'] as $field ) : ?>
673
-									<?php give_render_field( $field ); ?>
671
+							<?php if ( ! empty($setting['fields'])) : ?>
672
+								<?php foreach ($setting['fields'] as $field) : ?>
673
+									<?php give_render_field($field); ?>
674 674
 								<?php endforeach; ?>
675 675
 							<?php endif; ?>
676 676
 						</div>
677 677
 
678
-						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
678
+						<?php do_action("give_after_{$setting['id']}_settings"); ?>
679 679
 					<?php else: ?>
680
-						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
681
-							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
682
-								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
680
+						<?php if ($this->has_sub_tab($setting)) : ?>
681
+							<?php if ( ! empty($setting['sub-fields'])) : ?>
682
+								<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
683 683
 									<div id="<?php echo $sub_fields['id']; ?>"
684 684
 										 class="panel give_options_panel give-hidden">
685
-										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
686
-											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
687
-												<?php give_render_field( $sub_field ); ?>
685
+										<?php if ( ! empty($sub_fields['fields'])) : ?>
686
+											<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
687
+												<?php give_render_field($sub_field); ?>
688 688
 											<?php endforeach; ?>
689 689
 										<?php endif; ?>
690 690
 									</div>
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 	 *
709 709
 	 * @return bool
710 710
 	 */
711
-	private function has_sub_tab( $field_setting ) {
711
+	private function has_sub_tab($field_setting) {
712 712
 		$has_sub_tab = false;
713
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
713
+		if (array_key_exists('sub-fields', $field_setting)) {
714 714
 			$has_sub_tab = true;
715 715
 		}
716 716
 
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
 	 * @return array
725 725
 	 */
726 726
 	function cmb2_metabox_settings() {
727
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
727
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
728 728
 		$give_forms_settings = $all_cmb2_settings;
729 729
 
730 730
 		// Filter settings: Use only give forms related settings.
731
-		foreach ( $all_cmb2_settings as $index => $setting ) {
732
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
733
-				unset( $give_forms_settings[ $index ] );
731
+		foreach ($all_cmb2_settings as $index => $setting) {
732
+			if ( ! in_array('give_forms', $setting['object_types'])) {
733
+				unset($give_forms_settings[$index]);
734 734
 			}
735 735
 		}
736 736
 
@@ -748,114 +748,114 @@  discard block
 block discarded – undo
748 748
 	 *
749 749
 	 * @return void
750 750
 	 */
751
-	public function save( $post_id, $post ) {
751
+	public function save($post_id, $post) {
752 752
 
753 753
 		// $post_id and $post are required.
754
-		if ( empty( $post_id ) || empty( $post ) ) {
754
+		if (empty($post_id) || empty($post)) {
755 755
 			return;
756 756
 		}
757 757
 
758 758
 		// Don't save meta boxes for revisions or autosaves.
759
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
759
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
760 760
 			return;
761 761
 		}
762 762
 
763 763
 		// Check the nonce.
764
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
764
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
765 765
 			return;
766 766
 		}
767 767
 
768 768
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
769
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
769
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
770 770
 			return;
771 771
 		}
772 772
 
773 773
 		// Check user has permission to edit.
774
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
774
+		if ( ! current_user_can('edit_post', $post_id)) {
775 775
 			return;
776 776
 		}
777 777
 
778 778
 		// Fire action before saving form meta.
779
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
779
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
780 780
 
781 781
 		/**
782 782
 		 * Filter the meta key to save.
783 783
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
784 784
 		 */
785
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
785
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
786 786
 
787 787
 		// Save form meta data.
788
-		if ( ! empty( $form_meta_keys ) ) {
789
-			foreach ( $form_meta_keys as $form_meta_key ) {
788
+		if ( ! empty($form_meta_keys)) {
789
+			foreach ($form_meta_keys as $form_meta_key) {
790 790
 
791 791
 				// Set default value for checkbox fields.
792 792
 				if (
793
-					! isset( $_POST[ $form_meta_key ] )
794
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
793
+					! isset($_POST[$form_meta_key])
794
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
795 795
 				) {
796
-					$_POST[ $form_meta_key ] = '';
796
+					$_POST[$form_meta_key] = '';
797 797
 				}
798 798
 
799
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
800
-					if ( $field_type = $this->get_field_type( $form_meta_key ) ) {
801
-						switch ( $field_type ) {
799
+				if (isset($_POST[$form_meta_key])) {
800
+					if ($field_type = $this->get_field_type($form_meta_key)) {
801
+						switch ($field_type) {
802 802
 							case 'textarea':
803 803
 							case 'wysiwyg':
804
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
805
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
804
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
805
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
806 806
 								break;
807 807
 
808 808
 							case 'group':
809 809
 								$form_meta_value = array();
810 810
 
811
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
811
+								foreach ($_POST[$form_meta_key] as $index => $group) {
812 812
 
813 813
 									// Do not save template input field values.
814
-									if ( '{{row-count-placeholder}}' === $index ) {
814
+									if ('{{row-count-placeholder}}' === $index) {
815 815
 										continue;
816 816
 									}
817 817
 
818 818
 									$group_meta_value = array();
819
-									foreach ( $group as $field_id => $field_value ) {
820
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
819
+									foreach ($group as $field_id => $field_value) {
820
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
821 821
 											case 'wysiwyg':
822
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
822
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
823 823
 												break;
824 824
 
825 825
 											default:
826
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
826
+												$group_meta_value[$field_id] = give_clean($field_value);
827 827
 										}
828 828
 									}
829 829
 
830
-									if ( ! empty( $group_meta_value ) ) {
831
-										$form_meta_value[ $index ] = $group_meta_value;
830
+									if ( ! empty($group_meta_value)) {
831
+										$form_meta_value[$index] = $group_meta_value;
832 832
 									}
833 833
 								}
834 834
 
835 835
 
836 836
 								// Arrange repeater field keys in order.
837
-								$form_meta_value = array_values( $form_meta_value );
837
+								$form_meta_value = array_values($form_meta_value);
838 838
 
839 839
 								// Save data.
840
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
840
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
841 841
 								break;
842 842
 
843 843
 							default:
844
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
844
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
845 845
 
846 846
 								// Save data.
847
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
847
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
848 848
 						}
849 849
 
850 850
 						// Fire after saving form meta key.
851
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
851
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
852 852
 					}
853 853
 				}
854 854
 			}
855 855
 		}
856 856
 
857 857
 		// Fire action after saving form meta.
858
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
858
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
859 859
 	}
860 860
 
861 861
 
@@ -868,10 +868,10 @@  discard block
 block discarded – undo
868 868
 	 *
869 869
 	 * @return string
870 870
 	 */
871
-	private function get_field_id( $field ) {
871
+	private function get_field_id($field) {
872 872
 		$field_id = '';
873 873
 
874
-		if ( array_key_exists( 'id', $field ) ) {
874
+		if (array_key_exists('id', $field)) {
875 875
 			$field_id = $field['id'];
876 876
 
877 877
 		}
@@ -888,12 +888,12 @@  discard block
 block discarded – undo
888 888
 	 *
889 889
 	 * @return array
890 890
 	 */
891
-	private function get_fields_id( $setting ) {
891
+	private function get_fields_id($setting) {
892 892
 		$meta_keys = array();
893 893
 
894
-		if ( ! empty( $setting ) ) {
895
-			foreach ( $setting['fields'] as $field ) {
896
-				if ( $field_id = $this->get_field_id( $field ) ) {
894
+		if ( ! empty($setting)) {
895
+			foreach ($setting['fields'] as $field) {
896
+				if ($field_id = $this->get_field_id($field)) {
897 897
 					$meta_keys[] = $field_id;
898 898
 				}
899 899
 			}
@@ -911,14 +911,14 @@  discard block
 block discarded – undo
911 911
 	 *
912 912
 	 * @return array
913 913
 	 */
914
-	private function get_sub_fields_id( $setting ) {
914
+	private function get_sub_fields_id($setting) {
915 915
 		$meta_keys = array();
916 916
 
917
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
918
-			foreach ( $setting['sub-fields'] as $fields ) {
919
-				if ( ! empty( $fields['fields'] ) ) {
920
-					foreach ( $fields['fields'] as $field ) {
921
-						if ( $field_id = $this->get_field_id( $field ) ) {
917
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
918
+			foreach ($setting['sub-fields'] as $fields) {
919
+				if ( ! empty($fields['fields'])) {
920
+					foreach ($fields['fields'] as $field) {
921
+						if ($field_id = $this->get_field_id($field)) {
922 922
 							$meta_keys[] = $field_id;
923 923
 						}
924 924
 					}
@@ -939,14 +939,14 @@  discard block
 block discarded – undo
939 939
 	private function get_meta_keys_from_settings() {
940 940
 		$meta_keys = array();
941 941
 
942
-		foreach ( $this->settings as $setting ) {
943
-			if ( $this->has_sub_tab( $setting ) ) {
944
-				$meta_key = $this->get_sub_fields_id( $setting );
942
+		foreach ($this->settings as $setting) {
943
+			if ($this->has_sub_tab($setting)) {
944
+				$meta_key = $this->get_sub_fields_id($setting);
945 945
 			} else {
946
-				$meta_key = $this->get_fields_id( $setting );
946
+				$meta_key = $this->get_fields_id($setting);
947 947
 			}
948 948
 
949
-			$meta_keys = array_merge( $meta_keys, $meta_key );
949
+			$meta_keys = array_merge($meta_keys, $meta_key);
950 950
 		}
951 951
 
952 952
 		return $meta_keys;
@@ -963,10 +963,10 @@  discard block
 block discarded – undo
963 963
 	 *
964 964
 	 * @return string
965 965
 	 */
966
-	function get_field_type( $field_id, $group_id = '' ) {
967
-		$field = $this->get_setting_field( $field_id, $group_id );
966
+	function get_field_type($field_id, $group_id = '') {
967
+		$field = $this->get_setting_field($field_id, $group_id);
968 968
 
969
-		$type = array_key_exists( 'type', $field )
969
+		$type = array_key_exists('type', $field)
970 970
 			? $field['type']
971 971
 			: '';
972 972
 
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
 	 *
985 985
 	 * @return array
986 986
 	 */
987
-	private function get_field( $setting, $field_id ) {
987
+	private function get_field($setting, $field_id) {
988 988
 		$setting_field = array();
989 989
 
990
-		if ( ! empty( $setting['fields'] ) ) {
991
-			foreach ( $setting['fields'] as $field ) {
992
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
990
+		if ( ! empty($setting['fields'])) {
991
+			foreach ($setting['fields'] as $field) {
992
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
993 993
 					$setting_field = $field;
994 994
 					break;
995 995
 				}
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 	 *
1010 1010
 	 * @return array
1011 1011
 	 */
1012
-	private function get_sub_field( $setting, $field_id ) {
1012
+	private function get_sub_field($setting, $field_id) {
1013 1013
 		$setting_field = array();
1014 1014
 
1015
-		if ( ! empty( $setting['sub-fields'] ) ) {
1016
-			foreach ( $setting['sub-fields'] as $fields ) {
1017
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1015
+		if ( ! empty($setting['sub-fields'])) {
1016
+			foreach ($setting['sub-fields'] as $fields) {
1017
+				if ($field = $this->get_field($fields, $field_id)) {
1018 1018
 					$setting_field = $field;
1019 1019
 					break;
1020 1020
 				}
@@ -1034,17 +1034,17 @@  discard block
 block discarded – undo
1034 1034
 	 *
1035 1035
 	 * @return array
1036 1036
 	 */
1037
-	function get_setting_field( $field_id, $group_id = '' ) {
1037
+	function get_setting_field($field_id, $group_id = '') {
1038 1038
 		$setting_field = array();
1039 1039
 
1040 1040
 		$_field_id = $field_id;
1041
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1041
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1042 1042
 
1043
-		if ( ! empty( $this->settings ) ) {
1044
-			foreach ( $this->settings as $setting ) {
1043
+		if ( ! empty($this->settings)) {
1044
+			foreach ($this->settings as $setting) {
1045 1045
 				if (
1046
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1047
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1046
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1047
+					|| ($setting_field = $this->get_field($setting, $field_id))
1048 1048
 				) {
1049 1049
 					break;
1050 1050
 				}
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
 
1054 1054
 
1055 1055
 		// Get field from group.
1056
-		if ( ! empty( $group_id ) ) {
1057
-			foreach ( $setting_field['fields'] as $field ) {
1058
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1056
+		if ( ! empty($group_id)) {
1057
+			foreach ($setting_field['fields'] as $field) {
1058
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1059 1059
 					$setting_field = $field;
1060 1060
 				}
1061 1061
 			}
@@ -1074,14 +1074,14 @@  discard block
 block discarded – undo
1074 1074
 	 *
1075 1075
 	 * @return mixed
1076 1076
 	 */
1077
-	function add_offline_donations_setting_tab( $settings ) {
1078
-		if ( give_is_gateway_active( 'offline' ) ) {
1079
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1077
+	function add_offline_donations_setting_tab($settings) {
1078
+		if (give_is_gateway_active('offline')) {
1079
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1080 1080
 				'id'        => 'offline_donations_options',
1081
-				'title'     => esc_html__( 'Offline Donations', 'give' ),
1081
+				'title'     => esc_html__('Offline Donations', 'give'),
1082 1082
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1083
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1084
-			) );
1083
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1084
+			));
1085 1085
 		}
1086 1086
 
1087 1087
 		return $settings;
Please login to merge, or discard this patch.