Completed
Pull Request — master (#682)
by Devin
04:17
created
give.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 	/**
49 49
 	 * Main Give Class
50 50
 	 *
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 		 * @return    Give
160 160
 		 */
161 161
 		public static function instance() {
162
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
162
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
163 163
 				self::$instance = new Give;
164 164
 				self::$instance->setup_constants();
165 165
 
166
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
166
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
167 167
 
168 168
 				self::$instance->includes();
169 169
 				self::$instance->roles           = new Give_Roles();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 */
196 196
 		public function __clone() {
197 197
 			// Cloning instances of the class is forbidden
198
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
198
+			_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
199 199
 		}
200 200
 
201 201
 		/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 */
208 208
 		public function __wakeup() {
209 209
 			// Unserializing instances of the class is forbidden
210
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
210
+			_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
211 211
 		}
212 212
 
213 213
 		/**
@@ -220,33 +220,33 @@  discard block
 block discarded – undo
220 220
 		private function setup_constants() {
221 221
 
222 222
 			// Plugin version
223
-			if ( ! defined( 'GIVE_VERSION' ) ) {
224
-				define( 'GIVE_VERSION', '1.5.2' );
223
+			if ( ! defined('GIVE_VERSION')) {
224
+				define('GIVE_VERSION', '1.5.2');
225 225
 			}
226 226
 
227 227
 			// Plugin Folder Path
228
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
229
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
228
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
229
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
230 230
 			}
231 231
 
232 232
 			// Plugin Folder URL
233
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
234
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
233
+			if ( ! defined('GIVE_PLUGIN_URL')) {
234
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
235 235
 			}
236 236
 
237 237
 			// Plugin Basename aka: "give/give.php"
238
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
239
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
238
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
239
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
240 240
 			}
241 241
 
242 242
 			// Plugin Root File
243
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
244
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
243
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
244
+				define('GIVE_PLUGIN_FILE', __FILE__);
245 245
 			}
246 246
 
247 247
 			// Make sure CAL_GREGORIAN is defined
248
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
249
-				define( 'CAL_GREGORIAN', 1 );
248
+			if ( ! defined('CAL_GREGORIAN')) {
249
+				define('CAL_GREGORIAN', 1);
250 250
 			}
251 251
 		}
252 252
 
@@ -260,109 +260,109 @@  discard block
 block discarded – undo
260 260
 		private function includes() {
261 261
 			global $give_options;
262 262
 
263
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
263
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
264 264
 			$give_options = give_get_settings();
265 265
 
266
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
267
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
268
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
269
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
270
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
271
-
272
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
273
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
274
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
275
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
276
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
277
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
278
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
279
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
280
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
281
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
282
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
283
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
284
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
285
-
286
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
287
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
288
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
289
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
290
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
291
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
292
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
293
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
294
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
295
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
296
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
297
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
298
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
299
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
300
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
301
-
302
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
303
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
305
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
306
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
307
-
308
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
311
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
313
-
314
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
319
-
320
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
321
-
322
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
323
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
324
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
325
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
326
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
327
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
328
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
329
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
330
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
331
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
332
-
333
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
334
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
335
-
336
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
337
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
338
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
339
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
340
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
341
-
342
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
343
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
344
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
345
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
346
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
347
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
348
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
349
-
350
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
352
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
353
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
354
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
355
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
356
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
359
-
360
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
361
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
266
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
267
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
268
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
269
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
270
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
271
+
272
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
273
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
274
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
275
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
276
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
277
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
278
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
279
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
280
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
281
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
282
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
283
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
284
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
285
+
286
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
287
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
288
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
289
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
290
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
291
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
292
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
293
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
294
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
295
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
296
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
297
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
298
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
299
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
300
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
301
+
302
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
305
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
307
+
308
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
311
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
313
+
314
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
319
+
320
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
321
+
322
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
323
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
324
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
325
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
326
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
327
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
328
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
329
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
330
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
331
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
332
+
333
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
334
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
335
+
336
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
337
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
338
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
339
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
340
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
341
+
342
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
343
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
344
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
345
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
346
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
347
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
348
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
349
+
350
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
352
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
353
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
354
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
355
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
356
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
359
+
360
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
361
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
362 362
 
363 363
 			}
364 364
 
365
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
365
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
366 366
 
367 367
 		}
368 368
 
@@ -375,26 +375,26 @@  discard block
 block discarded – undo
375 375
 		 */
376 376
 		public function load_textdomain() {
377 377
 			// Set filter for Give's languages directory
378
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
379
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
378
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
379
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
380 380
 
381 381
 			// Traditional WordPress plugin locale filter
382
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
383
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
382
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
383
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
384 384
 
385 385
 			// Setup paths to current locale file
386
-			$mofile_local  = $give_lang_dir . $mofile;
387
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
386
+			$mofile_local  = $give_lang_dir.$mofile;
387
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
388 388
 
389
-			if ( file_exists( $mofile_global ) ) {
389
+			if (file_exists($mofile_global)) {
390 390
 				// Look in global /wp-content/languages/give folder
391
-				load_textdomain( 'give', $mofile_global );
392
-			} elseif ( file_exists( $mofile_local ) ) {
391
+				load_textdomain('give', $mofile_global);
392
+			} elseif (file_exists($mofile_local)) {
393 393
 				// Look in local location from filter `give_languages_directory`
394
-				load_textdomain( 'give', $mofile_local );
394
+				load_textdomain('give', $mofile_local);
395 395
 			} else {
396 396
 				// Load the default language files packaged up w/ Give
397
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
397
+				load_plugin_textdomain('give', false, $give_lang_dir);
398 398
 			}
399 399
 		}
400 400
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_show_upgrade_notices() {
27 27
 
28
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
28
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
29 29
 		return;
30 30
 	} // Don't show notices on the upgrades page
31 31
 
32
-	$give_version = get_option( 'give_version' );
32
+	$give_version = get_option('give_version');
33 33
 
34
-	if ( ! $give_version ) {
34
+	if ( ! $give_version) {
35 35
 		// 1.0 is the first version to use this option so we must add it
36 36
 		$give_version = '1.0';
37 37
 	}
38 38
 
39
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
39
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
40 40
 
41 41
 	/*
42 42
 	 *  NOTICE:
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 
49 49
 	//v1.3.2 Upgrades
50
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
50
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
51 51
 		printf(
52
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
53
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
52
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
53
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
54 54
 		);
55 55
 	}
56 56
 
57 57
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
58
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
58
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
59 59
 		printf(
60
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
61
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
60
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
61
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
62 62
 		);
63 63
 	}
64 64
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 }
70 70
 
71
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
71
+add_action('admin_notices', 'give_show_upgrade_notices');
72 72
 
73 73
 /**
74 74
  * Triggers all upgrade functions
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function give_trigger_upgrades() {
82 82
 
83
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
84
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
83
+	if ( ! current_user_can('manage_give_settings')) {
84
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
85 85
 	}
86 86
 
87
-	$give_version = get_option( 'give_version' );
87
+	$give_version = get_option('give_version');
88 88
 
89
-	if ( ! $give_version ) {
89
+	if ( ! $give_version) {
90 90
 		// 1.0 is the first version to use this option so we must add it
91 91
 		$give_version = '1.0';
92
-		add_option( 'give_version', $give_version );
92
+		add_option('give_version', $give_version);
93 93
 	}
94 94
 
95
-	update_option( 'give_version', GIVE_VERSION );
95
+	update_option('give_version', GIVE_VERSION);
96 96
 
97
-	if ( DOING_AJAX ) {
98
-		die( 'complete' );
97
+	if (DOING_AJAX) {
98
+		die('complete');
99 99
 	} // Let AJAX know that the upgrade is complete
100 100
 }
101 101
 
102
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
102
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
103 103
 
104 104
 /**
105 105
  * Check if the upgrade routine has been run for a specific action
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
  *
111 111
  * @return bool                   If the action has been added to the completed actions array
112 112
  */
113
-function give_has_upgrade_completed( $upgrade_action = '' ) {
113
+function give_has_upgrade_completed($upgrade_action = '') {
114 114
 
115
-	if ( empty( $upgrade_action ) ) {
115
+	if (empty($upgrade_action)) {
116 116
 		return false;
117 117
 	}
118 118
 
119 119
 	$completed_upgrades = give_get_completed_upgrades();
120 120
 
121
-	return in_array( $upgrade_action, $completed_upgrades );
121
+	return in_array($upgrade_action, $completed_upgrades);
122 122
 
123 123
 }
124 124
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @return bool                   If the function was successfully added
133 133
  */
134
-function give_set_upgrade_complete( $upgrade_action = '' ) {
134
+function give_set_upgrade_complete($upgrade_action = '') {
135 135
 
136
-	if ( empty( $upgrade_action ) ) {
136
+	if (empty($upgrade_action)) {
137 137
 		return false;
138 138
 	}
139 139
 
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	$completed_upgrades[] = $upgrade_action;
142 142
 
143 143
 	// Remove any blanks, and only show uniques
144
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
144
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
145 145
 
146
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
146
+	return update_option('give_completed_upgrades', $completed_upgrades);
147 147
 }
148 148
 
149 149
 /**
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  */
155 155
 function give_get_completed_upgrades() {
156 156
 
157
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
157
+	$completed_upgrades = get_option('give_completed_upgrades');
158 158
 
159
-	if ( false === $completed_upgrades ) {
159
+	if (false === $completed_upgrades) {
160 160
 		$completed_upgrades = array();
161 161
 	}
162 162
 
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function give_v132_upgrade_give_payment_customer_id() {
177 177
 	global $wpdb;
178
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
179
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
178
+	if ( ! current_user_can('manage_give_settings')) {
179
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
180 180
 	}
181 181
 
182
-	ignore_user_abort( true );
182
+	ignore_user_abort(true);
183 183
 
184
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
185
-		@set_time_limit( 0 );
184
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
185
+		@set_time_limit(0);
186 186
 	}
187 187
 
188 188
 	//UPDATE DB METAKEYS
189 189
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
190
-	$query = $wpdb->query( $sql );
190
+	$query = $wpdb->query($sql);
191 191
 
192
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
193
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
194
-	delete_option( 'give_doing_upgrade' );
195
-	wp_redirect( admin_url() );
192
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
193
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
194
+	delete_option('give_doing_upgrade');
195
+	wp_redirect(admin_url());
196 196
 	exit;
197 197
 
198 198
 
199 199
 }
200 200
 
201
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
201
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
202 202
 
203 203
 /**
204 204
  * Upgrades the Offline Status
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 
213 213
 	global $wpdb;
214 214
 
215
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
216
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
215
+	if ( ! current_user_can('manage_give_settings')) {
216
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
217 217
 	}
218 218
 
219
-	ignore_user_abort( true );
219
+	ignore_user_abort(true);
220 220
 
221
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
222
-		@set_time_limit( 0 );
221
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
222
+		@set_time_limit(0);
223 223
 	}
224 224
 
225 225
 	// Get abandoned offline payments
@@ -229,35 +229,35 @@  discard block
 block discarded – undo
229 229
 	$where .= "AND ( p.post_status = 'abandoned' )";
230 230
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
231 231
 
232
-	$sql            = $select . $join . $where;
233
-	$found_payments = $wpdb->get_col( $sql );
232
+	$sql            = $select.$join.$where;
233
+	$found_payments = $wpdb->get_col($sql);
234 234
 
235 235
 
236
-	foreach ( $found_payments as $payment ) {
236
+	foreach ($found_payments as $payment) {
237 237
 
238 238
 		//Only change ones marked abandoned since our release last week
239 239
 		//because the admin may have marked some abandoned themselves
240
-		$modified_time = get_post_modified_time( 'U', false, $payment );
240
+		$modified_time = get_post_modified_time('U', false, $payment);
241 241
 
242 242
 		//1450124863 =  12/10/2015 20:42:25
243
-		if ( $modified_time >= 1450124863 ) {
243
+		if ($modified_time >= 1450124863) {
244 244
 
245
-			give_update_payment_status( $payment, 'pending' );
245
+			give_update_payment_status($payment, 'pending');
246 246
 
247 247
 		}
248 248
 
249 249
 	}
250 250
 
251
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
252
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
253
-	delete_option( 'give_doing_upgrade' );
254
-	wp_redirect( admin_url() );
251
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
252
+	give_set_upgrade_complete('upgrade_give_offline_status');
253
+	delete_option('give_doing_upgrade');
254
+	wp_redirect(admin_url());
255 255
 	exit;
256 256
 
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
260
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
261 261
 
262 262
 
263 263
 /**
@@ -269,17 +269,17 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function give_v152_cleanup_users() {
271 271
 
272
-	$give_version = get_option( 'give_version' );
272
+	$give_version = get_option('give_version');
273 273
 
274
-	if ( ! $give_version ) {
274
+	if ( ! $give_version) {
275 275
 		// 1.0 is the first version to use this option so we must add it
276 276
 		$give_version = '1.0';
277 277
 	}
278 278
 
279
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
279
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
280 280
 
281 281
 	//v1.5.2 Upgrades
282
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
282
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
283 283
 
284 284
 		//Delete all caps with "ss"
285 285
 		//Also delete all unused "campaign" roles
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 		);
327 327
 	
328 328
 		global $wp_roles;
329
-		foreach ( $delete_caps as $cap ) {
330
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
331
-				$wp_roles->remove_cap( $role, $cap );
329
+		foreach ($delete_caps as $cap) {
330
+			foreach (array_keys($wp_roles->roles) as $role) {
331
+				$wp_roles->remove_cap($role, $cap);
332 332
 			}
333 333
 		}
334 334
 	
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 		$roles->add_caps();
339 339
 		
340 340
 		//The Update Ran
341
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
342
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
343
-		delete_option( 'give_doing_upgrade' );
341
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
342
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
343
+		delete_option('give_doing_upgrade');
344 344
 
345 345
 	}
346 346
 
347 347
 }
348 348
 
349
-add_action( 'admin_init', 'give_v152_cleanup_users' );
350 349
\ No newline at end of file
350
+add_action('admin_init', 'give_v152_cleanup_users');
351 351
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct() {
30 30
 
31
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
31
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
32 32
 	}
33 33
 
34 34
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @return void
40 40
 	 */
41 41
 	public function add_roles() {
42
-		add_role( 'give_manager', __( 'Give Manager', 'give' ), array(
42
+		add_role('give_manager', __('Give Manager', 'give'), array(
43 43
 			'read'                   => true,
44 44
 			'edit_posts'             => true,
45 45
 			'delete_posts'           => true,
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
 			'publish_posts'          => true,
69 69
 			'read_private_pages'     => true,
70 70
 			'read_private_posts'     => true
71
-		) );
71
+		));
72 72
 
73
-		add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array(
73
+		add_role('give_accountant', __('Give Accountant', 'give'), array(
74 74
 		    'read'                   => true,
75 75
 		    'edit_posts'             => false,
76 76
 		    'delete_posts'           => false
77
-		) );
77
+		));
78 78
 
79
-		add_role( 'give_worker', __( 'Give Worker', 'give' ), array(
79
+		add_role('give_worker', __('Give Worker', 'give'), array(
80 80
 			'read'                   => true,
81 81
 			'edit_posts'             => false,
82 82
 			'upload_files'           => true,
83 83
 			'delete_posts'           => false
84
-		) );
84
+		));
85 85
 
86 86
 	}
87 87
 
@@ -96,38 +96,38 @@  discard block
 block discarded – undo
96 96
 	public function add_caps() {
97 97
 		global $wp_roles;
98 98
 
99
-		if ( class_exists('WP_Roles') ) {
100
-			if ( ! isset( $wp_roles ) ) {
99
+		if (class_exists('WP_Roles')) {
100
+			if ( ! isset($wp_roles)) {
101 101
 				$wp_roles = new WP_Roles();
102 102
 			}
103 103
 		}
104 104
 
105
-		if ( is_object( $wp_roles ) ) {
106
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
107
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
108
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
109
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
105
+		if (is_object($wp_roles)) {
106
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
107
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
108
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
109
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
110 110
 
111
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
112
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
113
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
114
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
111
+			$wp_roles->add_cap('administrator', 'view_give_reports');
112
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
113
+			$wp_roles->add_cap('administrator', 'export_give_reports');
114
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
115 115
 
116 116
 			// Add the main post type capabilities
117 117
 			$capabilities = $this->get_core_caps();
118
-			foreach ( $capabilities as $cap_group ) {
119
-				foreach ( $cap_group as $cap ) {
120
-					$wp_roles->add_cap( 'administrator', $cap );
121
-					$wp_roles->add_cap( 'give_manager', $cap );
122
-					$wp_roles->add_cap( 'give_worker', $cap );
118
+			foreach ($capabilities as $cap_group) {
119
+				foreach ($cap_group as $cap) {
120
+					$wp_roles->add_cap('administrator', $cap);
121
+					$wp_roles->add_cap('give_manager', $cap);
122
+					$wp_roles->add_cap('give_worker', $cap);
123 123
 				}
124 124
 			}
125 125
 
126
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
127
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
128
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
129
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
130
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
126
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
127
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
128
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
129
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
130
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
131 131
 
132 132
 		}
133 133
 	}
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 	public function get_core_caps() {
143 143
 		$capabilities = array();
144 144
 
145
-		$capability_types = array( 'give_form', 'give_payment' );
145
+		$capability_types = array('give_form', 'give_payment');
146 146
 
147
-		foreach ( $capability_types as $capability_type ) {
148
-			$capabilities[ $capability_type ] = array(
147
+		foreach ($capability_types as $capability_type) {
148
+			$capabilities[$capability_type] = array(
149 149
 				// Post type
150 150
 				"edit_{$capability_type}",
151 151
 				"read_{$capability_type}",
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 	 * @since  1.0
183 183
 	 * @return array $caps
184 184
 	 */
185
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
185
+	public function meta_caps($caps, $cap, $user_id, $args) {
186 186
 
187
-		switch( $cap ) {
187
+		switch ($cap) {
188 188
 
189 189
 			case 'view_give_forms_stats' :
190 190
 				
191
-				if( empty( $args[0] ) ) {
191
+				if (empty($args[0])) {
192 192
 					break;
193 193
 				}
194 194
 				
195
-				$form = get_post( $args[0] );
196
-				if ( empty( $form ) ) {
195
+				$form = get_post($args[0]);
196
+				if (empty($form)) {
197 197
 					break;
198 198
 				}
199 199
 
200
-				if( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
200
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
201 201
 					$caps = array();
202 202
 				}
203 203
 
@@ -219,41 +219,41 @@  discard block
 block discarded – undo
219 219
 		
220 220
 		global $wp_roles;
221 221
 
222
-		if ( class_exists( 'WP_Roles' ) ) {
223
-			if ( ! isset( $wp_roles ) ) {
222
+		if (class_exists('WP_Roles')) {
223
+			if ( ! isset($wp_roles)) {
224 224
 				$wp_roles = new WP_Roles();
225 225
 			}
226 226
 		}
227 227
 
228
-		if ( is_object( $wp_roles ) ) {
228
+		if (is_object($wp_roles)) {
229 229
 			/** Give Manager Capabilities */
230
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
231
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
232
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
233
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
230
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
231
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
232
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
233
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
234 234
 
235 235
 			/** Site Administrator Capabilities */
236
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
237
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
238
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
239
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
236
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
237
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
238
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
239
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
240 240
 
241 241
 			/** Remove the Main Post Type Capabilities */
242 242
 			$capabilities = $this->get_core_caps();
243 243
 
244
-			foreach ( $capabilities as $cap_group ) {
245
-				foreach ( $cap_group as $cap ) {
246
-					$wp_roles->remove_cap( 'give_manager', $cap );
247
-					$wp_roles->remove_cap( 'administrator', $cap );
248
-					$wp_roles->remove_cap( 'give_worker', $cap );
244
+			foreach ($capabilities as $cap_group) {
245
+				foreach ($cap_group as $cap) {
246
+					$wp_roles->remove_cap('give_manager', $cap);
247
+					$wp_roles->remove_cap('administrator', $cap);
248
+					$wp_roles->remove_cap('give_worker', $cap);
249 249
 				}
250 250
 			}
251 251
 
252 252
 			/** Give Accountant Capabilities */
253
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
254
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
255
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
256
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
253
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
254
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
255
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
256
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
257 257
 
258 258
 		}
259 259
 	}
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +135 added lines, -135 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,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => __( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => __('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => __( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => __( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => __( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => __( 'New %1$s', 'give' ),
48
-		'all_items'          => __( 'All %2$s', 'give' ),
49
-		'view_item'          => __( 'View %1$s', 'give' ),
50
-		'search_items'       => __( 'Search %2$s', 'give' ),
51
-		'not_found'          => __( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => __('Add %1$s', 'give'),
45
+		'add_new_item'       => __('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => __('Edit Donation %1$s', 'give'),
47
+		'new_item'           => __('New %1$s', 'give'),
48
+		'all_items'          => __('All %2$s', 'give'),
49
+		'view_item'          => __('View %1$s', 'give'),
50
+		'search_items'       => __('Search %2$s', 'give'),
51
+		'not_found'          => __('No %2$s found', 'give'),
52
+		'not_found_in_trash' => __('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', __('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,42 +92,42 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 	
99 99
 	/** Payment Post Type */
100 100
 	$payment_labels = array(
101
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
102
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
103
-		'add_new'            => __( 'Add New', 'give' ),
104
-		'add_new_item'       => __( 'Add New Donation', 'give' ),
105
-		'edit_item'          => __( 'Edit Donation', 'give' ),
106
-		'new_item'           => __( 'New Donation', 'give' ),
107
-		'all_items'          => __( 'All Donations', 'give' ),
108
-		'view_item'          => __( 'View Donation', 'give' ),
109
-		'search_items'       => __( 'Search Donations', 'give' ),
110
-		'not_found'          => __( 'No Donations found', 'give' ),
111
-		'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ),
101
+		'name'               => _x('Donations', 'post type general name', 'give'),
102
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
103
+		'add_new'            => __('Add New', 'give'),
104
+		'add_new_item'       => __('Add New Donation', 'give'),
105
+		'edit_item'          => __('Edit Donation', 'give'),
106
+		'new_item'           => __('New Donation', 'give'),
107
+		'all_items'          => __('All Donations', 'give'),
108
+		'view_item'          => __('View Donation', 'give'),
109
+		'search_items'       => __('Search Donations', 'give'),
110
+		'not_found'          => __('No Donations found', 'give'),
111
+		'not_found_in_trash' => __('No Donations found in Trash', 'give'),
112 112
 		'parent_item_colon'  => '',
113
-		'menu_name'          => __( 'Transactions', 'give' )
113
+		'menu_name'          => __('Transactions', 'give')
114 114
 	);
115 115
 
116 116
 	$payment_args = array(
117
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
117
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
118 118
 		'public'          => false,
119 119
 		'query_var'       => false,
120 120
 		'rewrite'         => false,
121 121
 		'map_meta_cap'    => true,
122 122
 		'capability_type' => 'give_payment',
123
-		'supports'        => array( 'title' ),
123
+		'supports'        => array('title'),
124 124
 		'can_export'      => true
125 125
 	);
126
-	register_post_type( 'give_payment', $payment_args );
126
+	register_post_type('give_payment', $payment_args);
127 127
 
128 128
 }
129 129
 
130
-add_action( 'init', 'give_setup_post_types', 1 );
130
+add_action('init', 'give_setup_post_types', 1);
131 131
 
132 132
 
133 133
 /**
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_setup_taxonomies() {
142 142
 
143
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
143
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
144 144
 
145 145
 	/** Categories */
146 146
 	$category_labels = array(
147
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
148
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
149
-		'search_items'      => __( 'Search Categories', 'give' ),
150
-		'all_items'         => __( 'All Categories', 'give' ),
151
-		'parent_item'       => __( 'Parent Category', 'give' ),
152
-		'parent_item_colon' => __( 'Parent Category:', 'give' ),
153
-		'edit_item'         => __( 'Edit Category', 'give' ),
154
-		'update_item'       => __( 'Update Category', 'give' ),
155
-		'add_new_item'      => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
156
-		'new_item_name'     => __( 'New Category Name', 'give' ),
157
-		'menu_name'         => __( 'Categories', 'give' ),
147
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
148
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
149
+		'search_items'      => __('Search Categories', 'give'),
150
+		'all_items'         => __('All Categories', 'give'),
151
+		'parent_item'       => __('Parent Category', 'give'),
152
+		'parent_item_colon' => __('Parent Category:', 'give'),
153
+		'edit_item'         => __('Edit Category', 'give'),
154
+		'update_item'       => __('Update Category', 'give'),
155
+		'add_new_item'      => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()),
156
+		'new_item_name'     => __('New Category Name', 'give'),
157
+		'menu_name'         => __('Categories', 'give'),
158 158
 	);
159 159
 
160
-	$category_args = apply_filters( 'give_forms_category_args', array(
160
+	$category_args = apply_filters('give_forms_category_args', array(
161 161
 			'hierarchical' => true,
162
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
162
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
163 163
 			'show_ui'      => true,
164 164
 			'query_var'    => 'give_forms_category',
165 165
 			'rewrite'      => array(
166
-				'slug'         => $slug . '/category',
166
+				'slug'         => $slug.'/category',
167 167
 				'with_front'   => false,
168 168
 				'hierarchical' => true
169 169
 			),
@@ -177,34 +177,34 @@  discard block
 block discarded – undo
177 177
 	);
178 178
 
179 179
 	//Does the user want categories?
180
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
181
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
182
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
180
+	if (give_get_option('enable_categories') == 'on') {
181
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
182
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
183 183
 	}
184 184
 
185 185
 
186 186
 	/** Tags */
187 187
 	$tag_labels = array(
188
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
189
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
190
-		'search_items'          => __( 'Search Tags', 'give' ),
191
-		'all_items'             => __( 'All Tags', 'give' ),
192
-		'parent_item'           => __( 'Parent Tag', 'give' ),
193
-		'parent_item_colon'     => __( 'Parent Tag:', 'give' ),
194
-		'edit_item'             => __( 'Edit Tag', 'give' ),
195
-		'update_item'           => __( 'Update Tag', 'give' ),
196
-		'add_new_item'          => __( 'Add New Tag', 'give' ),
197
-		'new_item_name'         => __( 'New Tag Name', 'give' ),
198
-		'menu_name'             => __( 'Tags', 'give' ),
199
-		'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'give' ), give_get_forms_label_singular() ),
188
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
189
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
190
+		'search_items'          => __('Search Tags', 'give'),
191
+		'all_items'             => __('All Tags', 'give'),
192
+		'parent_item'           => __('Parent Tag', 'give'),
193
+		'parent_item_colon'     => __('Parent Tag:', 'give'),
194
+		'edit_item'             => __('Edit Tag', 'give'),
195
+		'update_item'           => __('Update Tag', 'give'),
196
+		'add_new_item'          => __('Add New Tag', 'give'),
197
+		'new_item_name'         => __('New Tag Name', 'give'),
198
+		'menu_name'             => __('Tags', 'give'),
199
+		'choose_from_most_used' => sprintf(__('Choose from most used %s tags', 'give'), give_get_forms_label_singular()),
200 200
 	);
201 201
 
202
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
202
+	$tag_args = apply_filters('give_forms_tag_args', array(
203 203
 			'hierarchical' => false,
204
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
204
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
205 205
 			'show_ui'      => true,
206 206
 			'query_var'    => 'give_forms_tag',
207
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
207
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
208 208
 			'capabilities' => array(
209 209
 				'manage_terms' => 'manage_give_forms_terms',
210 210
 				'edit_terms'   => 'edit_give_forms_terms',
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 		)
216 216
 	);
217 217
 
218
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
219
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
220
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
218
+	if (give_get_option('enable_tags') == 'on') {
219
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
220
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
221 221
 	}
222 222
 
223 223
 
224 224
 }
225 225
 
226
-add_action( 'init', 'give_setup_taxonomies', 0 );
226
+add_action('init', 'give_setup_taxonomies', 0);
227 227
 
228 228
 
229 229
 /**
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
  */
235 235
 function give_get_default_form_labels() {
236 236
 	$defaults = array(
237
-		'singular' => __( 'Form', 'give' ),
238
-		'plural'   => __( 'Forms', 'give' )
237
+		'singular' => __('Form', 'give'),
238
+		'plural'   => __('Forms', 'give')
239 239
 	);
240 240
 
241
-	return apply_filters( 'give_default_form_name', $defaults );
241
+	return apply_filters('give_default_form_name', $defaults);
242 242
 }
243 243
 
244 244
 /**
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return string $defaults['singular'] Singular label
252 252
  */
253
-function give_get_forms_label_singular( $lowercase = false ) {
253
+function give_get_forms_label_singular($lowercase = false) {
254 254
 	$defaults = give_get_default_form_labels();
255 255
 
256
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
256
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
257 257
 }
258 258
 
259 259
 /**
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
  * @since 1.0
263 263
  * @return string $defaults['plural'] Plural label
264 264
  */
265
-function give_get_forms_label_plural( $lowercase = false ) {
265
+function give_get_forms_label_plural($lowercase = false) {
266 266
 	$defaults = give_get_default_form_labels();
267 267
 
268
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
268
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
269 269
 }
270 270
 
271 271
 /**
@@ -277,26 +277,26 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return string $title New placeholder text
279 279
  */
280
-function give_change_default_title( $title ) {
280
+function give_change_default_title($title) {
281 281
 	// If a frontend plugin uses this filter (check extensions before changing this function)
282
-	if ( ! is_admin() ) {
282
+	if ( ! is_admin()) {
283 283
 		$label = give_get_forms_label_singular();
284
-		$title = sprintf( __( 'Enter %s title here', 'give' ), $label );
284
+		$title = sprintf(__('Enter %s title here', 'give'), $label);
285 285
 
286 286
 		return $title;
287 287
 	}
288 288
 
289 289
 	$screen = get_current_screen();
290 290
 
291
-	if ( 'give_forms' == $screen->post_type ) {
291
+	if ('give_forms' == $screen->post_type) {
292 292
 		$label = give_get_forms_label_singular();
293
-		$title = sprintf( __( 'Enter %s title here', 'give' ), $label );
293
+		$title = sprintf(__('Enter %s title here', 'give'), $label);
294 294
 	}
295 295
 
296 296
 	return $title;
297 297
 }
298 298
 
299
-add_filter( 'enter_title_here', 'give_change_default_title' );
299
+add_filter('enter_title_here', 'give_change_default_title');
300 300
 
301 301
 /**
302 302
  * Registers Custom Post Statuses which are used by the Payments
@@ -306,50 +306,50 @@  discard block
 block discarded – undo
306 306
  */
307 307
 function give_register_post_type_statuses() {
308 308
 	// Payment Statuses
309
-	register_post_status( 'refunded', array(
310
-		'label'                     => _x( 'Refunded', 'Refunded payment status', 'give' ),
309
+	register_post_status('refunded', array(
310
+		'label'                     => _x('Refunded', 'Refunded payment status', 'give'),
311 311
 		'public'                    => true,
312 312
 		'exclude_from_search'       => false,
313 313
 		'show_in_admin_all_list'    => true,
314 314
 		'show_in_admin_status_list' => true,
315
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
316
-	) );
317
-	register_post_status( 'failed', array(
318
-		'label'                     => _x( 'Failed', 'Failed payment status', 'give' ),
315
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
316
+	));
317
+	register_post_status('failed', array(
318
+		'label'                     => _x('Failed', 'Failed payment status', 'give'),
319 319
 		'public'                    => true,
320 320
 		'exclude_from_search'       => false,
321 321
 		'show_in_admin_all_list'    => true,
322 322
 		'show_in_admin_status_list' => true,
323
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
324
-	) );
325
-	register_post_status( 'revoked', array(
326
-		'label'                     => _x( 'Revoked', 'Revoked payment status', 'give' ),
323
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
324
+	));
325
+	register_post_status('revoked', array(
326
+		'label'                     => _x('Revoked', 'Revoked payment status', 'give'),
327 327
 		'public'                    => true,
328 328
 		'exclude_from_search'       => false,
329 329
 		'show_in_admin_all_list'    => true,
330 330
 		'show_in_admin_status_list' => true,
331
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
332
-	) );
333
-	register_post_status( 'cancelled', array(
334
-		'label'                     => _x( 'Cancelled', 'Cancelled payment status', 'give' ),
331
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
332
+	));
333
+	register_post_status('cancelled', array(
334
+		'label'                     => _x('Cancelled', 'Cancelled payment status', 'give'),
335 335
 		'public'                    => true,
336 336
 		'exclude_from_search'       => false,
337 337
 		'show_in_admin_all_list'    => true,
338 338
 		'show_in_admin_status_list' => true,
339
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
340
-	) );
341
-	register_post_status( 'abandoned', array(
342
-		'label'                     => _x( 'Abandoned', 'Abandoned payment status', 'give' ),
339
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
340
+	));
341
+	register_post_status('abandoned', array(
342
+		'label'                     => _x('Abandoned', 'Abandoned payment status', 'give'),
343 343
 		'public'                    => true,
344 344
 		'exclude_from_search'       => false,
345 345
 		'show_in_admin_all_list'    => true,
346 346
 		'show_in_admin_status_list' => true,
347
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
348
-	) );
347
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
348
+	));
349 349
 
350 350
 }
351 351
 
352
-add_action( 'init', 'give_register_post_type_statuses' );
352
+add_action('init', 'give_register_post_type_statuses');
353 353
 
354 354
 /**
355 355
  * Updated Messages
@@ -362,43 +362,43 @@  discard block
 block discarded – undo
362 362
  *
363 363
  * @return array $messages New post updated messages
364 364
  */
365
-function give_updated_messages( $messages ) {
365
+function give_updated_messages($messages) {
366 366
 	global $post, $post_ID;
367 367
 
368
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
368
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
369 369
 	$url2 = give_get_forms_label_singular();
370 370
 	$url3 = '</a>';
371 371
 
372 372
 	$messages['give_forms'] = array(
373
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
374
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
375
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
376
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
377
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
373
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
374
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
375
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
376
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
377
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
378 378
 	);
379 379
 
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_get_option( 'disable_form_featured_img' ) === 'on' ) {
395
+	if (give_get_option('disable_form_featured_img') === 'on') {
396 396
 		return;
397 397
 	}
398
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
399
-		add_theme_support( 'post-thumbnails' );
398
+	if ( ! current_theme_supports('post-thumbnails')) {
399
+		add_theme_support('post-thumbnails');
400 400
 	}
401
-	add_post_type_support( 'give_forms', 'thumbnail' );
401
+	add_post_type_support('give_forms', 'thumbnail');
402 402
 }
403 403
 
404 404
 /**
@@ -410,19 +410,19 @@  discard block
 block discarded – undo
410 410
 function give_widgets_init() {
411 411
 
412 412
 	//Single Give Forms (disabled if single turned off in settings)
413
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
413
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
414 414
 
415
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
416
-			'name'          => __( 'Give Single Form Sidebar', 'give' ),
415
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
416
+			'name'          => __('Give Single Form Sidebar', 'give'),
417 417
 			'id'            => 'give-forms-sidebar',
418
-			'description'   => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
418
+			'description'   => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
419 419
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
420 420
 			'after_widget'  => '</div>',
421 421
 			'before_title'  => '<h3 class="widgettitle widget-title">',
422 422
 			'after_title'   => '</h3>',
423
-		) ) );
423
+		)));
424 424
 
425 425
 	}
426 426
 }
427 427
 
428
-add_action( 'widgets_init', 'give_widgets_init', 999 );
428
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/forms/functions.php 1 patch
Spacing   +183 added lines, -183 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,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) ) {
75
-		$float_labels = give_get_option( 'enable_floatlabels' ) ? 'enabled' : 'disabled';
74
+	if (empty($float_labels)) {
75
+		$float_labels = give_get_option('enable_floatlabels') ? 'enabled' : 'disabled';
76 76
 	}
77 77
 
78
-	return ( $float_labels == 'enabled' ) ? true : false;
78
+	return ($float_labels == 'enabled') ? true : false;
79 79
 }
80 80
 
81 81
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 	$can_checkout = true;
92 92
 
93
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
93
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
94 94
 }
95 95
 
96 96
 /**
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 function give_get_success_page_uri() {
104 104
 	global $give_options;
105 105
 
106
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
106
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
107 107
 
108
-	return apply_filters( 'give_get_success_page_uri', $success_page );
108
+	return apply_filters('give_get_success_page_uri', $success_page);
109 109
 }
110 110
 
111 111
 /**
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function give_is_success_page() {
118 118
 	global $give_options;
119
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
119
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
120 120
 
121
-	return apply_filters( 'give_is_success_page', $is_success_page );
121
+	return apply_filters('give_is_success_page', $is_success_page);
122 122
 }
123 123
 
124 124
 /**
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
  * @since       1.0
133 133
  * @return      void
134 134
  */
135
-function give_send_to_success_page( $query_string = null ) {
135
+function give_send_to_success_page($query_string = null) {
136 136
 
137 137
 	$redirect = give_get_success_page_uri();
138 138
 
139
-	if ( $query_string ) {
139
+	if ($query_string) {
140 140
 		$redirect .= $query_string;
141 141
 	}
142 142
 
143
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
143
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
144 144
 
145
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
145
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
146 146
 	give_die();
147 147
 }
148 148
 
@@ -159,25 +159,25 @@  discard block
 block discarded – undo
159 159
  * @since  1.0
160 160
  * @return Void
161 161
  */
162
-function give_send_back_to_checkout( $args = array() ) {
162
+function give_send_back_to_checkout($args = array()) {
163 163
 
164
-	$redirect = ( isset( $_POST['give-current-url'] ) ) ? $_POST['give-current-url'] : '';
165
-	$form_id  = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : 0;
164
+	$redirect = (isset($_POST['give-current-url'])) ? $_POST['give-current-url'] : '';
165
+	$form_id  = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : 0;
166 166
 
167 167
 	$defaults = array(
168 168
 		'form-id' => (int) $form_id
169 169
 	);
170 170
 
171 171
 	// Check for backward compatibility
172
-	if ( is_string( $args ) ) {
173
-		$args = str_replace( '?', '', $args );
172
+	if (is_string($args)) {
173
+		$args = str_replace('?', '', $args);
174 174
 	}
175 175
 
176
-	$args = wp_parse_args( $args, $defaults );
176
+	$args = wp_parse_args($args, $defaults);
177 177
 
178
-	$redirect = add_query_arg( $args, $redirect ) . '#give-form-' . $form_id . '-wrap';
178
+	$redirect = add_query_arg($args, $redirect).'#give-form-'.$form_id.'-wrap';
179 179
 
180
-	wp_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
180
+	wp_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
181 181
 	give_die();
182 182
 }
183 183
 
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
  * @since       1.0
193 193
  * @return      string
194 194
  */
195
-function give_get_success_page_url( $query_string = null ) {
195
+function give_get_success_page_url($query_string = null) {
196 196
 
197
-	$success_page = give_get_option( 'success_page', 0 );
198
-	$success_page = get_permalink( $success_page );
197
+	$success_page = give_get_option('success_page', 0);
198
+	$success_page = get_permalink($success_page);
199 199
 
200
-	if ( $query_string ) {
200
+	if ($query_string) {
201 201
 		$success_page .= $query_string;
202 202
 	}
203 203
 
204
-	return apply_filters( 'give_success_page_url', $success_page );
204
+	return apply_filters('give_success_page_url', $success_page);
205 205
 
206 206
 }
207 207
 
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
  *
216 216
  * @return mixed|void Full URL to the Transaction Failed page, if present, home page if it doesn't exist
217 217
  */
218
-function give_get_failed_transaction_uri( $extras = false ) {
218
+function give_get_failed_transaction_uri($extras = false) {
219 219
 	global $give_options;
220 220
 
221
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
222
-	if ( $extras ) {
221
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
222
+	if ($extras) {
223 223
 		$uri .= $extras;
224 224
 	}
225 225
 
226
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
226
+	return apply_filters('give_get_failed_transaction_uri', $uri);
227 227
 }
228 228
 
229 229
 /**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
  */
235 235
 function give_is_failed_transaction_page() {
236 236
 	global $give_options;
237
-	$ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
237
+	$ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
238 238
 
239
-	return apply_filters( 'give_is_failure_page', $ret );
239
+	return apply_filters('give_is_failure_page', $ret);
240 240
 }
241 241
 
242 242
 /**
@@ -248,18 +248,18 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function give_listen_for_failed_payments() {
250 250
 
251
-	$failed_page = give_get_option( 'failure_page', 0 );
251
+	$failed_page = give_get_option('failure_page', 0);
252 252
 
253
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
253
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
254 254
 
255
-		$payment_id = absint( $_GET['payment-id'] );
256
-		give_update_payment_status( $payment_id, 'failed' );
255
+		$payment_id = absint($_GET['payment-id']);
256
+		give_update_payment_status($payment_id, 'failed');
257 257
 
258 258
 	}
259 259
 
260 260
 }
261 261
 
262
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
262
+add_action('template_redirect', 'give_listen_for_failed_payments');
263 263
 
264 264
 
265 265
 /**
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
  * @since       1.0
273 273
  * @return      bool
274 274
  */
275
-function give_field_is_required( $field = '', $form_id ) {
275
+function give_field_is_required($field = '', $form_id) {
276 276
 
277
-	$required_fields = give_purchase_form_required_fields( $form_id );
277
+	$required_fields = give_purchase_form_required_fields($form_id);
278 278
 
279
-	return array_key_exists( $field, $required_fields );
279
+	return array_key_exists($field, $required_fields);
280 280
 }
281 281
 
282 282
 /**
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
  *
295 295
  * @return void
296 296
  */
297
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
297
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
298 298
 	global $give_logs;
299 299
 
300 300
 	$log_data = array(
301 301
 		'post_parent'   => $give_form_id,
302 302
 		'log_type'      => 'sale',
303
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
304
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null
303
+		'post_date'     => isset($sale_date) ? $sale_date : null,
304
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null
305 305
 	);
306 306
 
307 307
 	$log_meta = array(
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		'price_id'   => (int) $price_id
310 310
 	);
311 311
 
312
-	$give_logs->insert_log( $log_data, $log_meta );
312
+	$give_logs->insert_log($log_data, $log_meta);
313 313
 }
314 314
 
315 315
 
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
  *
324 324
  * @return bool|int
325 325
  */
326
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
326
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
327 327
 	$quantity = (int) $quantity;
328
-	$form     = new Give_Donate_Form( $form_id );
328
+	$form     = new Give_Donate_Form($form_id);
329 329
 
330
-	return $form->increase_sales( $quantity );
330
+	return $form->increase_sales($quantity);
331 331
 }
332 332
 
333 333
 /**
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
  *
341 341
  * @return bool|int
342 342
  */
343
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
343
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
344 344
 	$quantity = (int) $quantity;
345
-	$form     = new Give_Donate_Form( $form_id );
345
+	$form     = new Give_Donate_Form($form_id);
346 346
 
347
-	return $form->decrease_sales( $quantity );
347
+	return $form->decrease_sales($quantity);
348 348
 }
349 349
 
350 350
 /**
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
  *
358 358
  * @return bool|int
359 359
  */
360
-function give_increase_earnings( $give_form_id = 0, $amount ) {
361
-	$form = new Give_Donate_Form( $give_form_id );
360
+function give_increase_earnings($give_form_id = 0, $amount) {
361
+	$form = new Give_Donate_Form($give_form_id);
362 362
 
363
-	return $form->increase_earnings( $amount );
363
+	return $form->increase_earnings($amount);
364 364
 }
365 365
 
366 366
 /**
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return bool|int
375 375
  */
376
-function give_decrease_earnings( $form_id = 0, $amount ) {
377
-	$form = new Give_Donate_Form( $form_id );
376
+function give_decrease_earnings($form_id = 0, $amount) {
377
+	$form = new Give_Donate_Form($form_id);
378 378
 
379
-	return $form->decrease_earnings( $amount );
379
+	return $form->decrease_earnings($amount);
380 380
 }
381 381
 
382 382
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
  *
390 390
  * @return int $earnings Earnings for a certain form
391 391
  */
392
-function give_get_form_earnings_stats( $form_id = 0 ) {
393
-	$give_form = new Give_Donate_Form( $form_id );
392
+function give_get_form_earnings_stats($form_id = 0) {
393
+	$give_form = new Give_Donate_Form($form_id);
394 394
 
395 395
 	return $give_form->earnings;
396 396
 }
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
  *
406 406
  * @return int $sales Amount of sales for a certain form
407 407
  */
408
-function give_get_form_sales_stats( $give_form_id = 0 ) {
409
-	$give_form = new Give_Donate_Form( $give_form_id );
408
+function give_get_form_sales_stats($give_form_id = 0) {
409
+	$give_form = new Give_Donate_Form($give_form_id);
410 410
 
411 411
 	return $give_form->sales;
412 412
 }
@@ -421,16 +421,16 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return float $sales Average monthly sales
423 423
  */
424
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
425
-	$sales        = give_get_form_sales_stats( $form_id );
426
-	$release_date = get_post_field( 'post_date', $form_id );
424
+function give_get_average_monthly_form_sales($form_id = 0) {
425
+	$sales        = give_get_form_sales_stats($form_id);
426
+	$release_date = get_post_field('post_date', $form_id);
427 427
 
428
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
428
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
429 429
 
430
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
430
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
431 431
 
432
-	if ( $months > 0 ) {
433
-		$sales = ( $sales / $months );
432
+	if ($months > 0) {
433
+		$sales = ($sales / $months);
434 434
 	}
435 435
 
436 436
 	return $sales;
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
  *
447 447
  * @return float $earnings Average monthly earnings
448 448
  */
449
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
450
-	$earnings     = give_get_form_earnings_stats( $form_id );
451
-	$release_date = get_post_field( 'post_date', $form_id );
449
+function give_get_average_monthly_form_earnings($form_id = 0) {
450
+	$earnings     = give_get_form_earnings_stats($form_id);
451
+	$release_date = get_post_field('post_date', $form_id);
452 452
 
453
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
453
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
454 454
 
455
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
455
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
456 456
 
457
-	if ( $months > 0 ) {
458
-		$earnings = ( $earnings / $months );
457
+	if ($months > 0) {
458
+		$earnings = ($earnings / $months);
459 459
 	}
460 460
 
461 461
 	return $earnings < 0 ? 0 : $earnings;
@@ -475,25 +475,25 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return string $price_name Name of the price option
477 477
  */
478
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
478
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
479 479
 
480
-	$prices     = give_get_variable_prices( $form_id );
480
+	$prices     = give_get_variable_prices($form_id);
481 481
 	$price_name = '';
482 482
 
483
-	foreach ( $prices as $price ) {
483
+	foreach ($prices as $price) {
484 484
 
485
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
485
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
486 486
 
487
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
488
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
489
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
487
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
488
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
489
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
490 490
 
491 491
 		}
492 492
 
493 493
 	}
494 494
 
495 495
 
496
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
496
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
497 497
 }
498 498
 
499 499
 
@@ -506,14 +506,14 @@  discard block
 block discarded – undo
506 506
  *
507 507
  * @return string $range A fully formatted price range
508 508
  */
509
-function give_price_range( $form_id = 0 ) {
510
-	$low   = give_get_lowest_price_option( $form_id );
511
-	$high  = give_get_highest_price_option( $form_id );
512
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
509
+function give_price_range($form_id = 0) {
510
+	$low   = give_get_lowest_price_option($form_id);
511
+	$high  = give_get_highest_price_option($form_id);
512
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
513 513
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
514
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
514
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
515 515
 
516
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
516
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
517 517
 }
518 518
 
519 519
 
@@ -528,36 +528,36 @@  discard block
 block discarded – undo
528 528
  *
529 529
  * @return int ID of the lowest price
530 530
  */
531
-function give_get_lowest_price_id( $form_id = 0 ) {
531
+function give_get_lowest_price_id($form_id = 0) {
532 532
 
533
-	if ( empty( $form_id ) ) {
533
+	if (empty($form_id)) {
534 534
 		$form_id = get_the_ID();
535 535
 	}
536 536
 
537
-	if ( ! give_has_variable_prices( $form_id ) ) {
538
-		return give_get_form_price( $form_id );
537
+	if ( ! give_has_variable_prices($form_id)) {
538
+		return give_get_form_price($form_id);
539 539
 	}
540 540
 
541
-	$prices = give_get_variable_prices( $form_id );
541
+	$prices = give_get_variable_prices($form_id);
542 542
 
543 543
 	$low    = 0.00;
544 544
 	$min_id = 1;
545 545
 
546
-	if ( ! empty( $prices ) ) {
546
+	if ( ! empty($prices)) {
547 547
 
548
-		foreach ( $prices as $key => $price ) {
548
+		foreach ($prices as $key => $price) {
549 549
 
550
-			if ( empty( $price['_give_amount'] ) ) {
550
+			if (empty($price['_give_amount'])) {
551 551
 				continue;
552 552
 			}
553 553
 
554
-			if ( ! isset( $min ) ) {
554
+			if ( ! isset($min)) {
555 555
 				$min = $price['_give_amount'];
556 556
 			} else {
557
-				$min = min( $min, $price['_give_amount'] );
557
+				$min = min($min, $price['_give_amount']);
558 558
 			}
559 559
 
560
-			if ( $price['_give_amount'] == $min ) {
560
+			if ($price['_give_amount'] == $min) {
561 561
 				$min_id = $price['_give_id']['level_id'];
562 562
 			}
563 563
 		}
@@ -575,43 +575,43 @@  discard block
 block discarded – undo
575 575
  *
576 576
  * @return float Amount of the lowest price
577 577
  */
578
-function give_get_lowest_price_option( $form_id = 0 ) {
579
-	if ( empty( $form_id ) ) {
578
+function give_get_lowest_price_option($form_id = 0) {
579
+	if (empty($form_id)) {
580 580
 		$form_id = get_the_ID();
581 581
 	}
582 582
 
583
-	if ( ! give_has_variable_prices( $form_id ) ) {
584
-		return give_get_form_price( $form_id );
583
+	if ( ! give_has_variable_prices($form_id)) {
584
+		return give_get_form_price($form_id);
585 585
 	}
586 586
 
587
-	$prices = give_get_variable_prices( $form_id );
587
+	$prices = give_get_variable_prices($form_id);
588 588
 
589 589
 	$low = 0.00;
590 590
 
591
-	if ( ! empty( $prices ) ) {
591
+	if ( ! empty($prices)) {
592 592
 
593
-		foreach ( $prices as $key => $price ) {
593
+		foreach ($prices as $key => $price) {
594 594
 
595
-			if ( empty( $price['_give_amount'] ) ) {
595
+			if (empty($price['_give_amount'])) {
596 596
 				continue;
597 597
 			}
598 598
 
599
-			if ( ! isset( $min ) ) {
599
+			if ( ! isset($min)) {
600 600
 				$min = $price['_give_amount'];
601 601
 			} else {
602
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
602
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
603 603
 			}
604 604
 
605
-			if ( $price['_give_amount'] == $min ) {
605
+			if ($price['_give_amount'] == $min) {
606 606
 				$min_id = $key;
607 607
 			}
608 608
 		}
609 609
 
610
-		$low = $prices[ $min_id ]['_give_amount'];
610
+		$low = $prices[$min_id]['_give_amount'];
611 611
 
612 612
 	}
613 613
 
614
-	return give_sanitize_amount( $low );
614
+	return give_sanitize_amount($low);
615 615
 }
616 616
 
617 617
 /**
@@ -623,41 +623,41 @@  discard block
 block discarded – undo
623 623
  *
624 624
  * @return float Amount of the highest price
625 625
  */
626
-function give_get_highest_price_option( $form_id = 0 ) {
626
+function give_get_highest_price_option($form_id = 0) {
627 627
 
628
-	if ( empty( $form_id ) ) {
628
+	if (empty($form_id)) {
629 629
 		$form_id = get_the_ID();
630 630
 	}
631 631
 
632
-	if ( ! give_has_variable_prices( $form_id ) ) {
633
-		return give_get_form_price( $form_id );
632
+	if ( ! give_has_variable_prices($form_id)) {
633
+		return give_get_form_price($form_id);
634 634
 	}
635 635
 
636
-	$prices = give_get_variable_prices( $form_id );
636
+	$prices = give_get_variable_prices($form_id);
637 637
 
638 638
 	$high = 0.00;
639 639
 
640
-	if ( ! empty( $prices ) ) {
640
+	if ( ! empty($prices)) {
641 641
 
642 642
 		$max = 0;
643 643
 
644
-		foreach ( $prices as $key => $price ) {
645
-			if ( empty( $price['_give_amount'] ) ) {
644
+		foreach ($prices as $key => $price) {
645
+			if (empty($price['_give_amount'])) {
646 646
 				continue;
647 647
 			}
648
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
648
+			$give_amount = give_sanitize_amount($price['_give_amount']);
649 649
 
650
-			$max = max( $max, $give_amount );
650
+			$max = max($max, $give_amount);
651 651
 
652
-			if ( $give_amount == $max ) {
652
+			if ($give_amount == $max) {
653 653
 				$max_id = $key;
654 654
 			}
655 655
 		}
656 656
 
657
-		$high = $prices[ $max_id ]['_give_amount'];
657
+		$high = $prices[$max_id]['_give_amount'];
658 658
 	}
659 659
 
660
-	return give_sanitize_amount( $high );
660
+	return give_sanitize_amount($high);
661 661
 }
662 662
 
663 663
 /**
@@ -669,15 +669,15 @@  discard block
 block discarded – undo
669 669
  *
670 670
  * @return mixed string|int Price of the form
671 671
  */
672
-function give_get_form_price( $form_id = 0 ) {
672
+function give_get_form_price($form_id = 0) {
673 673
 
674
-	if ( empty( $form_id ) ) {
674
+	if (empty($form_id)) {
675 675
 		return false;
676 676
 	}
677 677
 
678
-	$form = new Give_Donate_Form( $form_id );
678
+	$form = new Give_Donate_Form($form_id);
679 679
 
680
-	return $form->__get( 'price' );
680
+	return $form->__get('price');
681 681
 }
682 682
 
683 683
 /**
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
  *
690 690
  * @return mixed string|int Minimum price of the form
691 691
  */
692
-function give_get_form_minimum_price( $form_id = 0 ) {
692
+function give_get_form_minimum_price($form_id = 0) {
693 693
 
694
-	if ( empty( $form_id ) ) {
694
+	if (empty($form_id)) {
695 695
 		return false;
696 696
 	}
697 697
 
698
-	$form = new Give_Donate_Form( $form_id );
698
+	$form = new Give_Donate_Form($form_id);
699 699
 
700
-	return $form->__get( 'minimum_price' );
700
+	return $form->__get('minimum_price');
701 701
 
702 702
 }
703 703
 
@@ -712,52 +712,52 @@  discard block
 block discarded – undo
712 712
  *
713 713
  * @return int $formatted_price
714 714
  */
715
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
715
+function give_price($form_id = 0, $echo = true, $price_id = false) {
716 716
 
717
-	if ( empty( $form_id ) ) {
717
+	if (empty($form_id)) {
718 718
 		$form_id = get_the_ID();
719 719
 	}
720 720
 
721
-	if ( give_has_variable_prices( $form_id ) ) {
721
+	if (give_has_variable_prices($form_id)) {
722 722
 
723
-		$prices = give_get_variable_prices( $form_id );
723
+		$prices = give_get_variable_prices($form_id);
724 724
 
725
-		if ( false !== $price_id ) {
725
+		if (false !== $price_id) {
726 726
 
727 727
 			//loop through multi-prices to see which is default
728
-			foreach ( $prices as $price ) {
728
+			foreach ($prices as $price) {
729 729
 				//this is the default price
730
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
730
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
731 731
 					$price = (float) $price['_give_amount'];
732 732
 				};
733 733
 			}
734 734
 
735 735
 		} else {
736 736
 
737
-			$price = give_get_lowest_price_option( $form_id );
737
+			$price = give_get_lowest_price_option($form_id);
738 738
 		}
739 739
 
740
-		$price = give_sanitize_amount( $price );
740
+		$price = give_sanitize_amount($price);
741 741
 
742 742
 	} else {
743 743
 
744
-		$price = give_get_form_price( $form_id );
744
+		$price = give_get_form_price($form_id);
745 745
 
746 746
 	}
747 747
 
748
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
749
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
750
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
748
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
749
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
750
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
751 751
 
752
-	if ( $echo ) {
752
+	if ($echo) {
753 753
 		echo $formatted_price;
754 754
 	} else {
755 755
 		return $formatted_price;
756 756
 	}
757 757
 }
758 758
 
759
-add_filter( 'give_form_price', 'give_format_amount', 10 );
760
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
759
+add_filter('give_form_price', 'give_format_amount', 10);
760
+add_filter('give_form_price', 'give_currency_filter', 20);
761 761
 
762 762
 
763 763
 /**
@@ -771,18 +771,18 @@  discard block
 block discarded – undo
771 771
  *
772 772
  * @return float $amount Amount of the price option
773 773
  */
774
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
775
-	$prices = give_get_variable_prices( $form_id );
774
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
775
+	$prices = give_get_variable_prices($form_id);
776 776
 
777 777
 	$amount = 0.00;
778 778
 
779
-	foreach ( $prices as $price ) {
780
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] === $price_id ) {
781
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
779
+	foreach ($prices as $price) {
780
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] === $price_id) {
781
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
782 782
 		};
783 783
 	}
784 784
 
785
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
785
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
786 786
 }
787 787
 
788 788
 /**
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
  *
795 795
  * @return mixed string|int Goal of the form
796 796
  */
797
-function give_get_form_goal( $form_id = 0 ) {
797
+function give_get_form_goal($form_id = 0) {
798 798
 
799
-	if ( empty( $form_id ) ) {
799
+	if (empty($form_id)) {
800 800
 		return false;
801 801
 	}
802 802
 
803
-	$form = new Give_Donate_Form( $form_id );
803
+	$form = new Give_Donate_Form($form_id);
804 804
 
805 805
 	return $form->goal;
806 806
 
@@ -816,27 +816,27 @@  discard block
 block discarded – undo
816 816
  *
817 817
  * @return string $formatted_goal
818 818
  */
819
-function give_goal( $form_id = 0, $echo = true ) {
819
+function give_goal($form_id = 0, $echo = true) {
820 820
 
821
-	if ( empty( $form_id ) ) {
821
+	if (empty($form_id)) {
822 822
 		$form_id = get_the_ID();
823 823
 	}
824 824
 
825
-	$goal = give_get_form_goal( $form_id );
825
+	$goal = give_get_form_goal($form_id);
826 826
 
827
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
828
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
829
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
827
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
828
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
829
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
830 830
 
831
-	if ( $echo ) {
831
+	if ($echo) {
832 832
 		echo $formatted_goal;
833 833
 	} else {
834 834
 		return $formatted_goal;
835 835
 	}
836 836
 }
837 837
 
838
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
839
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
838
+add_filter('give_form_goal', 'give_format_amount', 10);
839
+add_filter('give_form_goal', 'give_currency_filter', 20);
840 840
 
841 841
 
842 842
 /**
@@ -846,13 +846,13 @@  discard block
 block discarded – undo
846 846
  * @global $give_options
847 847
  * @return bool $ret Whether or not the logged_in_only setting is set
848 848
  */
849
-function give_logged_in_only( $form_id ) {
849
+function give_logged_in_only($form_id) {
850 850
 
851
-	$form_option = get_post_meta( $form_id, '_give_logged_in_only', true );
851
+	$form_option = get_post_meta($form_id, '_give_logged_in_only', true);
852 852
 
853
-	$ret = ! empty( $form_option ) ? $form_option : false;
853
+	$ret = ! empty($form_option) ? $form_option : false;
854 854
 
855
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
855
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
856 856
 
857 857
 }
858 858
 
@@ -864,10 +864,10 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @param $form_id
866 866
  */
867
-function give_show_login_register_option( $form_id ) {
867
+function give_show_login_register_option($form_id) {
868 868
 
869
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
869
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
870 870
 
871
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
871
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
872 872
 
873 873
 }
874 874
\ No newline at end of file
Please login to merge, or discard this patch.