Completed
Push — master ( de506e...2752f1 )
by Devin
102:59 queued 83:00
created
give.php 1 patch
Spacing   +125 added lines, -125 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();
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		 */
197 197
 		public function __clone() {
198 198
 			// Cloning instances of the class is forbidden
199
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
199
+			_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
200 200
 		}
201 201
 
202 202
 		/**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		 */
209 209
 		public function __wakeup() {
210 210
 			// Unserializing instances of the class is forbidden
211
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
211
+			_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
212 212
 		}
213 213
 
214 214
 		/**
@@ -221,33 +221,33 @@  discard block
 block discarded – undo
221 221
 		private function setup_constants() {
222 222
 
223 223
 			// Plugin version
224
-			if ( ! defined( 'GIVE_VERSION' ) ) {
225
-				define( 'GIVE_VERSION', '1.4' );
224
+			if ( ! defined('GIVE_VERSION')) {
225
+				define('GIVE_VERSION', '1.4');
226 226
 			}
227 227
 
228 228
 			// Plugin Folder Path
229
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
230
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
229
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
230
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
231 231
 			}
232 232
 
233 233
 			// Plugin Folder URL
234
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
235
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
234
+			if ( ! defined('GIVE_PLUGIN_URL')) {
235
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
236 236
 			}
237 237
 
238 238
 			// Plugin Basename aka: "give/give.php"
239
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
240
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
239
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
240
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
241 241
 			}
242 242
 
243 243
 			// Plugin Root File
244
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
245
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
244
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
245
+				define('GIVE_PLUGIN_FILE', __FILE__);
246 246
 			}
247 247
 
248 248
 			// Make sure CAL_GREGORIAN is defined
249
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
250
-				define( 'CAL_GREGORIAN', 1 );
249
+			if ( ! defined('CAL_GREGORIAN')) {
250
+				define('CAL_GREGORIAN', 1);
251 251
 			}
252 252
 		}
253 253
 
@@ -261,107 +261,107 @@  discard block
 block discarded – undo
261 261
 		private function includes() {
262 262
 			global $give_options;
263 263
 
264
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php';
264
+			require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php';
265 265
 			$give_options = give_get_settings();
266 266
 
267
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
268
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
269
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
270
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
271
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
272
-
273
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
274
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
275
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
276
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
277
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
278
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
279
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
280
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
281
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
282
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
283
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
284
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
285
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
286
-
287
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
288
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
289
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
290
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
291
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
292
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
293
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
294
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
295
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
296
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
297
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
298
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
299
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
300
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
301
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
302
-
303
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
305
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
306
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php';
308
-
309
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
311
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
314
-
315
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
320
-
321
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
322
-
323
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
324
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
325
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
326
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
327
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
328
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
329
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
330
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php';
331
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
332
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
333
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
334
-
335
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
336
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
337
-
338
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
339
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
340
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
341
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
342
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
343
-
344
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
345
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
346
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
347
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
348
-
349
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
350
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
351
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
352
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
353
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
354
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
355
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
356
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
357
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
358
-
359
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
360
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
267
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
268
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
269
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
270
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
271
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
272
+
273
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
274
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
275
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
276
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
277
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
278
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
279
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
280
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
281
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
282
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
283
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
284
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
285
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
286
+
287
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
288
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
289
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
290
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
291
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
292
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
293
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
294
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
295
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
296
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
297
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
298
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
299
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
300
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
301
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
302
+
303
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
305
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php';
308
+
309
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
311
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
314
+
315
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
320
+
321
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
322
+
323
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
324
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
325
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
326
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
327
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
328
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
329
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
330
+				require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php';
331
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
332
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
333
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
334
+
335
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
336
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
337
+
338
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
339
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
340
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
341
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
342
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
343
+
344
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
345
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
346
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
347
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
348
+
349
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
350
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
351
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
352
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
353
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
354
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
355
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
356
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
357
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
358
+
359
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
360
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
361 361
 
362 362
 			}
363 363
 
364
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
364
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
365 365
 
366 366
 		}
367 367
 
@@ -374,26 +374,26 @@  discard block
 block discarded – undo
374 374
 		 */
375 375
 		public function load_textdomain() {
376 376
 			// Set filter for Give's languages directory
377
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
378
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
377
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
378
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
379 379
 
380 380
 			// Traditional WordPress plugin locale filter
381
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
382
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
381
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
382
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
383 383
 
384 384
 			// Setup paths to current locale file
385
-			$mofile_local  = $give_lang_dir . $mofile;
386
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
385
+			$mofile_local  = $give_lang_dir.$mofile;
386
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
387 387
 
388
-			if ( file_exists( $mofile_global ) ) {
388
+			if (file_exists($mofile_global)) {
389 389
 				// Look in global /wp-content/languages/give folder
390
-				load_textdomain( 'give', $mofile_global );
391
-			} elseif ( file_exists( $mofile_local ) ) {
390
+				load_textdomain('give', $mofile_global);
391
+			} elseif (file_exists($mofile_local)) {
392 392
 				// Look in local location from filter `give_languages_directory`
393
-				load_textdomain( 'give', $mofile_local );
393
+				load_textdomain('give', $mofile_local);
394 394
 			} else {
395 395
 				// Load the default language files packaged up w/ Give
396
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
396
+				load_plugin_textdomain('give', false, $give_lang_dir);
397 397
 			}
398 398
 		}
399 399
 	}
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * AJAX Functions
4
- *
5
- * Process the front-end AJAX actions.
6
- *
7
- * @package     Give
8
- * @subpackage  Functions/AJAX
9
- * @copyright   Copyright (c) 2016, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.0
12
- */
3
+	 * AJAX Functions
4
+	 *
5
+	 * Process the front-end AJAX actions.
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Functions/AJAX
9
+	 * @copyright   Copyright (c) 2016, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.0
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if (!defined('ABSPATH')) {
16
-    exit;
16
+	exit;
17 17
 }
18 18
 
19 19
 /**
@@ -25,71 +25,71 @@  discard block
 block discarded – undo
25 25
 function give_test_ajax_works()
26 26
 {
27 27
 
28
-    // Check if the Airplane Mode plugin is installed
29
-    if (class_exists('Airplane_Mode_Core')) {
28
+	// Check if the Airplane Mode plugin is installed
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31
-        $airplane = Airplane_Mode_Core::getInstance();
31
+		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-        if (method_exists($airplane, 'enabled')) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-            if ($airplane->enabled()) {
36
-                return true;
37
-            }
35
+			if ($airplane->enabled()) {
36
+				return true;
37
+			}
38 38
 
39
-        } else {
39
+		} else {
40 40
 
41
-            if ($airplane->check_status() == 'on') {
42
-                return true;
43
-            }
44
-        }
45
-    }
41
+			if ($airplane->check_status() == 'on') {
42
+				return true;
43
+			}
44
+		}
45
+	}
46 46
 
47
-    add_filter('block_local_requests', '__return_false');
47
+	add_filter('block_local_requests', '__return_false');
48 48
 
49
-    if (get_transient('_give_ajax_works')) {
50
-        return true;
51
-    }
49
+	if (get_transient('_give_ajax_works')) {
50
+		return true;
51
+	}
52 52
 
53
-    $params = array(
54
-        'sslverify' => false,
55
-        'timeout' => 30,
56
-        'body' => array(
57
-            'action' => 'give_test_ajax'
58
-        )
59
-    );
53
+	$params = array(
54
+		'sslverify' => false,
55
+		'timeout' => 30,
56
+		'body' => array(
57
+			'action' => 'give_test_ajax'
58
+		)
59
+	);
60 60
 
61
-    $ajax = wp_remote_post(give_get_ajax_url(), $params);
62
-    $works = true;
61
+	$ajax = wp_remote_post(give_get_ajax_url(), $params);
62
+	$works = true;
63 63
 
64
-    if (is_wp_error($ajax)) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66
-        $works = false;
66
+		$works = false;
67 67
 
68
-    } else {
68
+	} else {
69 69
 
70
-        if (empty($ajax['response'])) {
71
-            $works = false;
72
-        }
70
+		if (empty($ajax['response'])) {
71
+			$works = false;
72
+		}
73 73
 
74
-        if (empty($ajax['response']['code']) || 200 !== (int)$ajax['response']['code']) {
75
-            $works = false;
76
-        }
74
+		if (empty($ajax['response']['code']) || 200 !== (int)$ajax['response']['code']) {
75
+			$works = false;
76
+		}
77 77
 
78
-        if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79
-            $works = false;
80
-        }
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79
+			$works = false;
80
+		}
81 81
 
82
-        if (!isset($ajax['body']) || 0 !== (int)$ajax['body']) {
83
-            $works = false;
84
-        }
82
+		if (!isset($ajax['body']) || 0 !== (int)$ajax['body']) {
83
+			$works = false;
84
+		}
85 85
 
86
-    }
86
+	}
87 87
 
88
-    if ($works) {
89
-        set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
90
-    }
88
+	if ($works) {
89
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
90
+	}
91 91
 
92
-    return $works;
92
+	return $works;
93 93
 }
94 94
 
95 95
 
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
  */
102 102
 function give_get_ajax_url()
103 103
 {
104
-    $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
104
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
105 105
 
106
-    $current_url = give_get_current_page_url();
107
-    $ajax_url = admin_url('admin-ajax.php', $scheme);
106
+	$current_url = give_get_current_page_url();
107
+	$ajax_url = admin_url('admin-ajax.php', $scheme);
108 108
 
109
-    if (preg_match('/^https/', $current_url) && !preg_match('/^https/', $ajax_url)) {
110
-        $ajax_url = preg_replace('/^http/', 'https', $ajax_url);
111
-    }
109
+	if (preg_match('/^https/', $current_url) && !preg_match('/^https/', $ajax_url)) {
110
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
111
+	}
112 112
 
113
-    return apply_filters('give_ajax_url', $ajax_url);
113
+	return apply_filters('give_ajax_url', $ajax_url);
114 114
 }
115 115
 
116 116
 /**
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
  */
122 122
 function give_load_checkout_login_fields()
123 123
 {
124
-    do_action('give_purchase_form_login_fields');
125
-    give_die();
124
+	do_action('give_purchase_form_login_fields');
125
+	give_die();
126 126
 }
127 127
 
128 128
 add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_load_checkout_fields()
137 137
 {
138
-    $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
138
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
139 139
 
140
-    ob_start();
140
+	ob_start();
141 141
 
142
-    do_action( 'give_purchase_form_register_login_fields', $form_id );
142
+	do_action( 'give_purchase_form_register_login_fields', $form_id );
143 143
 
144
-    $fields = ob_get_clean();
144
+	$fields = ob_get_clean();
145 145
 
146
-    wp_send_json( array(
147
-        'fields' => wp_json_encode( $fields ),
148
-        'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
149
-    ) );
146
+	wp_send_json( array(
147
+		'fields' => wp_json_encode( $fields ),
148
+		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
149
+	) );
150 150
 }
151 151
 
152 152
 add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
  */
161 161
 function give_ajax_get_form_title()
162 162
 {
163
-    if (isset($_POST['form_id'])) {
164
-        $title = get_the_title($_POST['form_id']);
165
-        if ($title) {
166
-            echo $title;
167
-        } else {
168
-            echo 'fail';
169
-        }
170
-    }
171
-    give_die();
163
+	if (isset($_POST['form_id'])) {
164
+		$title = get_the_title($_POST['form_id']);
165
+		if ($title) {
166
+			echo $title;
167
+		} else {
168
+			echo 'fail';
169
+		}
170
+	}
171
+	give_die();
172 172
 }
173 173
 
174 174
 add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
@@ -183,32 +183,32 @@  discard block
 block discarded – undo
183 183
 function give_ajax_get_states_field()
184 184
 {
185 185
 
186
-    if (empty($_POST['country'])) {
187
-        $_POST['country'] = give_get_country();
188
-    }
189
-    $states = give_get_states($_POST['country']);
186
+	if (empty($_POST['country'])) {
187
+		$_POST['country'] = give_get_country();
188
+	}
189
+	$states = give_get_states($_POST['country']);
190 190
 
191
-    if (!empty($states)) {
191
+	if (!empty($states)) {
192 192
 
193
-        $args = array(
194
-            'name' => $_POST['field_name'],
195
-            'id' => $_POST['field_name'],
196
-            'class' => $_POST['field_name'] . '  give-select',
197
-            'options' => give_get_states($_POST['country']),
198
-            'show_option_all' => false,
199
-            'show_option_none' => false
200
-        );
193
+		$args = array(
194
+			'name' => $_POST['field_name'],
195
+			'id' => $_POST['field_name'],
196
+			'class' => $_POST['field_name'] . '  give-select',
197
+			'options' => give_get_states($_POST['country']),
198
+			'show_option_all' => false,
199
+			'show_option_none' => false
200
+		);
201 201
 
202
-        $response = Give()->html->select($args);
202
+		$response = Give()->html->select($args);
203 203
 
204
-    } else {
204
+	} else {
205 205
 
206
-        $response = 'nostates';
207
-    }
206
+		$response = 'nostates';
207
+	}
208 208
 
209
-    echo $response;
209
+	echo $response;
210 210
 
211
-    give_die();
211
+	give_die();
212 212
 }
213 213
 
214 214
 add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
@@ -222,38 +222,38 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function give_ajax_form_search()
224 224
 {
225
-    global $wpdb;
225
+	global $wpdb;
226 226
 
227
-    $search = esc_sql(sanitize_text_field($_GET['s']));
228
-    $results = array();
229
-    if (current_user_can('edit_give_forms')) {
230
-        $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
231
-    } else {
232
-        $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
233
-    }
227
+	$search = esc_sql(sanitize_text_field($_GET['s']));
228
+	$results = array();
229
+	if (current_user_can('edit_give_forms')) {
230
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
231
+	} else {
232
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
233
+	}
234 234
 
235
-    if ($items) {
235
+	if ($items) {
236 236
 
237
-        foreach ($items as $item) {
237
+		foreach ($items as $item) {
238 238
 
239
-            $results[] = array(
240
-                'id' => $item->ID,
241
-                'name' => $item->post_title
242
-            );
243
-        }
239
+			$results[] = array(
240
+				'id' => $item->ID,
241
+				'name' => $item->post_title
242
+			);
243
+		}
244 244
 
245
-    } else {
245
+	} else {
246 246
 
247
-        $items[] = array(
248
-            'id' => 0,
249
-            'name' => __('No results found', 'give')
250
-        );
247
+		$items[] = array(
248
+			'id' => 0,
249
+			'name' => __('No results found', 'give')
250
+		);
251 251
 
252
-    }
252
+	}
253 253
 
254
-    echo json_encode($results);
254
+	echo json_encode($results);
255 255
 
256
-    give_die();
256
+	give_die();
257 257
 }
258 258
 
259 259
 add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
@@ -267,38 +267,38 @@  discard block
 block discarded – undo
267 267
  */
268 268
 function give_ajax_donor_search()
269 269
 {
270
-    global $wpdb;
270
+	global $wpdb;
271 271
 
272
-    $search = esc_sql(sanitize_text_field($_GET['s']));
273
-    $results = array();
274
-    if (!current_user_can('view_give_reports')) {
275
-        $donors = array();
276
-    } else {
277
-        $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
278
-    }
272
+	$search = esc_sql(sanitize_text_field($_GET['s']));
273
+	$results = array();
274
+	if (!current_user_can('view_give_reports')) {
275
+		$donors = array();
276
+	} else {
277
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
278
+	}
279 279
 
280
-    if ($donors) {
280
+	if ($donors) {
281 281
 
282
-        foreach ($donors as $donor) {
282
+		foreach ($donors as $donor) {
283 283
 
284
-            $results[] = array(
285
-                'id' => $donor->id,
286
-                'name' => $donor->name . '(' . $donor->email . ')'
287
-            );
288
-        }
284
+			$results[] = array(
285
+				'id' => $donor->id,
286
+				'name' => $donor->name . '(' . $donor->email . ')'
287
+			);
288
+		}
289 289
 
290
-    } else {
290
+	} else {
291 291
 
292
-        $donors[] = array(
293
-            'id' => 0,
294
-            'name' => __('No results found', 'give')
295
-        );
292
+		$donors[] = array(
293
+			'id' => 0,
294
+			'name' => __('No results found', 'give')
295
+		);
296 296
 
297
-    }
297
+	}
298 298
 
299
-    echo json_encode($results);
299
+	echo json_encode($results);
300 300
 
301
-    give_die();
301
+	give_die();
302 302
 }
303 303
 
304 304
 add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
@@ -313,30 +313,30 @@  discard block
 block discarded – undo
313 313
 function give_ajax_search_users()
314 314
 {
315 315
 
316
-    if (current_user_can('manage_give_settings')) {
316
+	if (current_user_can('manage_give_settings')) {
317 317
 
318
-        $search_query = trim($_POST['user_name']);
318
+		$search_query = trim($_POST['user_name']);
319 319
 
320
-        $found_users = get_users(array(
321
-                'number' => 9999,
322
-                'search' => $search_query . '*'
323
-            )
324
-        );
320
+		$found_users = get_users(array(
321
+				'number' => 9999,
322
+				'search' => $search_query . '*'
323
+			)
324
+		);
325 325
 
326
-        $user_list = '<ul>';
327
-        if ($found_users) {
328
-            foreach ($found_users as $user) {
329
-                $user_list .= '<li><a href="#" data-login="' . esc_attr($user->user_login) . '">' . esc_html($user->user_login) . '</a></li>';
330
-            }
331
-        } else {
332
-            $user_list .= '<li>' . __('No users found', 'give') . '</li>';
333
-        }
334
-        $user_list .= '</ul>';
326
+		$user_list = '<ul>';
327
+		if ($found_users) {
328
+			foreach ($found_users as $user) {
329
+				$user_list .= '<li><a href="#" data-login="' . esc_attr($user->user_login) . '">' . esc_html($user->user_login) . '</a></li>';
330
+			}
331
+		} else {
332
+			$user_list .= '<li>' . __('No users found', 'give') . '</li>';
333
+		}
334
+		$user_list .= '</ul>';
335 335
 
336
-        echo json_encode(array('results' => $user_list));
336
+		echo json_encode(array('results' => $user_list));
337 337
 
338
-    }
339
-    die();
338
+	}
339
+	die();
340 340
 }
341 341
 
342 342
 add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
343 343
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if (!defined('ABSPATH')) {
15
+if ( ! defined('ABSPATH')) {
16 16
     exit;
17 17
 }
18 18
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $works = false;
72 72
         }
73 73
 
74
-        if (empty($ajax['response']['code']) || 200 !== (int)$ajax['response']['code']) {
74
+        if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
             $works = false;
76 76
         }
77 77
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $works = false;
80 80
         }
81 81
 
82
-        if (!isset($ajax['body']) || 0 !== (int)$ajax['body']) {
82
+        if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
             $works = false;
84 84
         }
85 85
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     $current_url = give_get_current_page_url();
107 107
     $ajax_url = admin_url('admin-ajax.php', $scheme);
108 108
 
109
-    if (preg_match('/^https/', $current_url) && !preg_match('/^https/', $ajax_url)) {
109
+    if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
110 110
         $ajax_url = preg_replace('/^http/', 'https', $ajax_url);
111 111
     }
112 112
 
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 
140 140
     ob_start();
141 141
 
142
-    do_action( 'give_purchase_form_register_login_fields', $form_id );
142
+    do_action('give_purchase_form_register_login_fields', $form_id);
143 143
 
144 144
     $fields = ob_get_clean();
145 145
 
146
-    wp_send_json( array(
147
-        'fields' => wp_json_encode( $fields ),
148
-        'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
149
-    ) );
146
+    wp_send_json(array(
147
+        'fields' => wp_json_encode($fields),
148
+        'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
149
+    ));
150 150
 }
151 151
 
152 152
 add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
     }
189 189
     $states = give_get_states($_POST['country']);
190 190
 
191
-    if (!empty($states)) {
191
+    if ( ! empty($states)) {
192 192
 
193 193
         $args = array(
194 194
             'name' => $_POST['field_name'],
195 195
             'id' => $_POST['field_name'],
196
-            'class' => $_POST['field_name'] . '  give-select',
196
+            'class' => $_POST['field_name'].'  give-select',
197 197
             'options' => give_get_states($_POST['country']),
198 198
             'show_option_all' => false,
199 199
             'show_option_none' => false
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
     $search = esc_sql(sanitize_text_field($_GET['s']));
273 273
     $results = array();
274
-    if (!current_user_can('view_give_reports')) {
274
+    if ( ! current_user_can('view_give_reports')) {
275 275
         $donors = array();
276 276
     } else {
277 277
         $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
             $results[] = array(
285 285
                 'id' => $donor->id,
286
-                'name' => $donor->name . '(' . $donor->email . ')'
286
+                'name' => $donor->name.'('.$donor->email.')'
287 287
             );
288 288
         }
289 289
 
@@ -319,17 +319,17 @@  discard block
 block discarded – undo
319 319
 
320 320
         $found_users = get_users(array(
321 321
                 'number' => 9999,
322
-                'search' => $search_query . '*'
322
+                'search' => $search_query.'*'
323 323
             )
324 324
         );
325 325
 
326 326
         $user_list = '<ul>';
327 327
         if ($found_users) {
328 328
             foreach ($found_users as $user) {
329
-                $user_list .= '<li><a href="#" data-login="' . esc_attr($user->user_login) . '">' . esc_html($user->user_login) . '</a></li>';
329
+                $user_list .= '<li><a href="#" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
330 330
             }
331 331
         } else {
332
-            $user_list .= '<li>' . __('No users found', 'give') . '</li>';
332
+            $user_list .= '<li>'.__('No users found', 'give').'</li>';
333 333
         }
334 334
         $user_list .= '</ul>';
335 335
 
Please login to merge, or discard this patch.