Test Failed
Push — issues/2912 ( 47fdf9...1e5343 )
by Ravinder
09:11
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Plugin Name: Give - Donation Plugin
4
 * Plugin URI: https://givewp.com
5
 * Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
6
 * Author: WordImpress
7
 * Author URI: https://wordimpress.com
8
 * Version: 2.1.0
9
 * Text Domain: give
10
 * Domain Path: /languages
11
 * GitHub Plugin URI: https://github.com/WordImpress/Give
12
 *
13
 * Give is free software: you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation, either version 3 of the License, or
16
 * any later version.
17
 *
18
 * Give is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with Give. If not, see <https://www.gnu.org/licenses/>.
25
 *
26
 * A Tribute to Open Source:
27
 *
28
 * "Open source software is software that can be freely used, changed, and shared (in modified or unmodified form) by
29
 * anyone. Open source software is made by many people, and distributed under licenses that comply with the Open Source
30
 * Definition."
31
 *
32
 * -- The Open Source Initiative
33
 *
34
 * Give is a tribute to the spirit and philosophy of Open Source. We at WordImpress gladly embrace the Open Source
35
 * philosophy both in how Give itself was developed, and how we hope to see others build more from our code base.
36
 *
37
 * Give would not have been possible without the tireless efforts of WordPress and the surrounding Open Source projects
38
 * and their talented developers. Thank you all for your contribution to WordPress.
39
 *
40
 * - The WordImpress Team
41
 */
42
43
// Exit if accessed directly.
44
if ( ! defined( 'ABSPATH' ) ) {
45
	exit;
46
}
47
48
if ( ! class_exists( 'Give' ) ) :
49
50
	/**
51
	 * Main Give Class
52
	 *
53
	 * @since 1.0
54
	 */
55
	final class Give {
56
57
		/** Singleton *************************************************************/
58
59
		/**
60
		 * Give Instance
61
		 *
62
		 * @since  1.0
63
		 * @access private
64
		 *
65
		 * @var    Give() The one true Give
66
		 */
67
		protected static $_instance;
68
69
		/**
70
		 * Give Roles Object
71
		 *
72
		 * @since  1.0
73
		 * @access public
74
		 *
75
		 * @var    Give_Roles object
76
		 */
77
		public $roles;
78
79
		/**
80
		 * Give Settings Object
81
		 *
82
		 * @since  1.0
83
		 * @access public
84
		 *
85
		 * @var    Give_Admin_Settings object
86
		 */
87
		public $give_settings;
88
89
		/**
90
		 * Give Session Object
91
		 *
92
		 * This holds donation data for user's session.
93
		 *
94
		 * @since  1.0
95
		 * @access public
96
		 *
97
		 * @var    Give_Session object
98
		 */
99
		public $session;
100
101
		/**
102
		 * Give HTML Element Helper Object
103
		 *
104
		 * @since  1.0
105
		 * @access public
106
		 *
107
		 * @var    Give_HTML_Elements object
108
		 */
109
		public $html;
110
111
		/**
112
		 * Give Emails Object
113
		 *
114
		 * @since  1.0
115
		 * @access public
116
		 *
117
		 * @var    Give_Emails object
118
		 */
119
		public $emails;
120
121
		/**
122
		 * Give Email Template Tags Object
123
		 *
124
		 * @since  1.0
125
		 * @access public
126
		 *
127
		 * @var    Give_Email_Template_Tags object
128
		 */
129
		public $email_tags;
130
131
		/**
132
		 * Give Donors DB Object
133
		 *
134
		 * @since  1.0
135
		 * @access public
136
		 *
137
		 * @var    Give_DB_Donors object
138
		 */
139
		public $donors;
140
141
		/**
142
		 * Give Donor meta DB Object
143
		 *
144
		 * @since  1.6
145
		 * @access public
146
		 *
147
		 * @var    Give_DB_Donor_Meta object
148
		 */
149
		public $donor_meta;
150
151
		/**
152
		 * Give Sequential Donation DB Object
153
		 *
154
		 * @since  2.1.0
155
		 * @access public
156
		 *
157
		 * @var    Give_DB_Sequential_Donations object
158
		 */
159
		public $sequential_donation_db;
160
161
		/**
162
		 * Give API Object
163
		 *
164
		 * @since  1.0
165
		 * @access public
166
		 *
167
		 * @var    Give_API object
168
		 */
169
		public $api;
170
171
		/**
172
		 * Give Template Loader Object
173
		 *
174
		 * @since  1.0
175
		 * @access public
176
		 *
177
		 * @var    Give_Template_Loader object
178
		 */
179
		public $template_loader;
180
181
		/**
182
		 * Give No Login Object
183
		 *
184
		 * @since  1.0
185
		 * @access public
186
		 *
187
		 * @var    Give_Email_Access object
188
		 */
189
		public $email_access;
190
191
		/**
192
		 * Give_tooltips Object
193
		 *
194
		 * @since  1.8.9
195
		 * @access public
196
		 *
197
		 * @var    Give_Tooltips object
198
		 */
199
		public $tooltips;
200
201
		/**
202
		 * Give notices Object
203
		 *
204
		 * @var    Give_Notices $notices
205
		 */
206
		public $notices;
207
208
209
		/**
210
		 * Give logging Object
211
		 *
212
		 * @var    Give_Logging $logs
213
		 */
214
		public $logs;
215
216
		/**
217
		 * Give payment Object
218
		 *
219
		 * @var    Give_DB_Payment_Meta $payment_meta
220
		 */
221
		public $payment_meta;
222
223
		/**
224
		 * Give form Object
225
		 *
226
		 * @var    Give_DB_Form_Meta $form_meta
227
		 */
228
		public $form_meta;
229
230
		/**
231
		 * Give form Object
232
		 *
233
		 * @var    Give_Async_Process $async_process
234
		 */
235
		public $async_process;
236
237
		/**
238
		 * Give scripts Object.
239
		 *
240
		 * @var Give_Scripts
241
		 */
242
		public $scripts;
243
244
		/**
245
		 * Giv_Seq_Donation_Number Object.
246
		 *
247
		 * @var Give_Seq_Donation_Number
248
		 */
249
		public $seq_donation_number;
250
251
		/**
252
		 * Main Give Instance
253
		 *
254
		 * Ensures that only one instance of Give exists in memory at any one
255
		 * time. Also prevents needing to define globals all over the place.
256
		 *
257
		 * @since     1.0
258
		 * @access    public
259
		 *
260
		 * @static
261
		 * @see       Give()
262
		 *
263
		 * @return    Give
264
		 */
265
		public static function instance() {
266
			if ( is_null( self::$_instance ) ) {
267
				self::$_instance = new self();
268
			}
269
270
			return self::$_instance;
271
		}
272
273
		/**
274
		 * Give Constructor.
275
		 */
276
		public function __construct() {
277
			// PHP version
278
			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
279
				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
280
			}
281
282
			// Bailout: Need minimum php version to load plugin.
283
			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
284
				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
285
286
				return;
287
			}
288
289
			$this->setup_constants();
290
			$this->includes();
291
			$this->init_hooks();
292
293
			do_action( 'give_loaded' );
294
		}
295
296
		/**
297
		 * Hook into actions and filters.
298
		 *
299
		 * @since  1.8.9
300
		 */
301
		private function init_hooks() {
302
			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
303
			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
304
305
			// Set up localization on init Hook.
306
			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
307
		}
308
309
		/**
310
		 * Init Give when WordPress Initializes.
311
		 *
312
		 * @since 1.8.9
313
		 */
314
		public function init() {
315
316
			/**
317
			 * Fires before the Give core is initialized.
318
			 *
319
			 * @since 1.8.9
320
			 */
321
			do_action( 'before_give_init' );
322
323
			// Set up localization.
324
			$this->load_textdomain();
325
326
			$this->roles                  = new Give_Roles();
327
			$this->api                    = new Give_API();
328
			$this->give_settings          = new Give_Admin_Settings();
329
			$this->session                = new Give_Session();
330
			$this->html                   = new Give_HTML_Elements();
331
			$this->emails                 = new Give_Emails();
332
			$this->email_tags             = new Give_Email_Template_Tags();
333
			$this->donors                 = new Give_DB_Donors();
334
			$this->donor_meta             = new Give_DB_Donor_Meta();
335
			$this->template_loader        = new Give_Template_Loader();
336
			$this->email_access           = new Give_Email_Access();
337
			$this->tooltips               = new Give_Tooltips();
338
			$this->notices                = new Give_Notices();
339
			$this->payment_meta           = new Give_DB_Payment_Meta();
340
			$this->logs                   = new Give_Logging();
341
			$this->form_meta              = new Give_DB_Form_Meta();
342
			$this->sequential_donation_db = new Give_DB_Sequential_Donations();
343
			$this->async_process          = new Give_Async_Process();
344
			$this->scripts                = new Give_Scripts();
345
			$this->seq_donation_number    = Give_Seq_Donation_Number::get_instance();
346
347
			/**
348
			 * Fire the action after Give core loads.
349
			 *
350
			 * @param Give class instance.
351
			 *
352
			 * @since 1.8.7
353
			 */
354
			do_action( 'give_init', $this );
355
356
		}
357
358
		/**
359
		 * Throw error on object clone
360
		 *
361
		 * The whole idea of the singleton design pattern is that there is a single
362
		 * object, therefore we don't want the object to be cloned.
363
		 *
364
		 * @since  1.0
365
		 * @access protected
366
		 *
367
		 * @return void
368
		 */
369
		public function __clone() {
370
			// Cloning instances of the class is forbidden.
371
			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
372
		}
373
374
		/**
375
		 * Disable unserializing of the class
376
		 *
377
		 * @since  1.0
378
		 * @access protected
379
		 *
380
		 * @return void
381
		 */
382
		public function __wakeup() {
383
			// Unserializing instances of the class is forbidden.
384
			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
385
		}
386
387
		/**
388
		 * Setup plugin constants
389
		 *
390
		 * @since  1.0
391
		 * @access private
392
		 *
393
		 * @return void
394
		 */
395
		private function setup_constants() {
396
397
			// Plugin version
398
			if ( ! defined( 'GIVE_VERSION' ) ) {
399
				define( 'GIVE_VERSION', '2.1.0' );
400
			}
401
402
			// Plugin Root File
403
			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
404
				define( 'GIVE_PLUGIN_FILE', __FILE__ );
405
			}
406
407
			// Plugin Folder Path
408
			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
409
				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
410
			}
411
412
			// Plugin Folder URL
413
			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
414
				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
415
			}
416
417
			// Plugin Basename aka: "give/give.php"
418
			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
419
				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
420
			}
421
422
			// Make sure CAL_GREGORIAN is defined
423
			if ( ! defined( 'CAL_GREGORIAN' ) ) {
424
				define( 'CAL_GREGORIAN', 1 );
425
			}
426
		}
427
428
		/**
429
		 * Include required files
430
		 *
431
		 * @since  1.0
432
		 * @access private
433
		 *
434
		 * @return void
435
		 */
436
		private function includes() {
437
			global $give_options;
438
439
			/**
440
			 * Load libraries.
441
			 */
442
			if ( ! class_exists( 'WP_Async_Request' ) ) {
443
				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
444
			}
445
446
			if ( ! class_exists( 'WP_Background_Process' ) ) {
447
				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
448
			}
449
450
			/**
451
			 * Load plugin files
452
			 */
453
			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
454
			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
455
			$give_options = give_get_settings();
456
457
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
458
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
459
			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
460
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
461
			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
462
			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
463
			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
464
			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
465
			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
466
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
467
			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
468
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
469
470
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
471
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
472
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
473
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
474
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
475
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
476
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
477
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
478
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
479
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
480
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
481
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
482
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
483
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
484
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
485
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
486
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
487
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-donations.php';
488
489
			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
490
			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
491
			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
492
			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
493
			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
494
			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
495
			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
496
			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
497
			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
498
			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
499
			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
500
			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
501
			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
502
			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
503
			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
504
			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
505
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
506
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
507
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
508
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
509
510
			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
511
			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
512
			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
513
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
514
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
515
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
516
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-seq-donation-number.php';
517
518
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
519
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
520
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
521
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
522
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
523
524
			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
525
			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
526
			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
527
			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
528
			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
529
			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
530
531
			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
532
			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
533
534
			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
535
536
			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
537
538
			if ( defined( 'WP_CLI' ) && WP_CLI ) {
539
				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
540
			}
541
542
			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
543
544
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
545
				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
546
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
547
				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
548
				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
549
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
550
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
551
				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
552
				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
553
				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
554
				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
555
556
				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
557
				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
558
559
				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
560
				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
561
				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
562
563
				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
564
				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
565
				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
566
567
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
568
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
569
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
570
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
571
572
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
573
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
574
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
575
576
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
577
578
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
579
580
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
581
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
582
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
583
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
584
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
585
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
586
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
587
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
588
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
589
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
590
			}// End if().
591
592
			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
593
594
		}
595
596
		/**
597
		 * Loads the plugin language files.
598
		 *
599
		 * @since  1.0
600
		 * @access public
601
		 *
602
		 * @return void
603
		 */
604
		public function load_textdomain() {
605
606
			// Set filter for Give's languages directory
607
			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
608
			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
609
610
			// Traditional WordPress plugin locale filter.
611
			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
612
			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
613
614
			unload_textdomain( 'give' );
615
			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
616
			load_plugin_textdomain( 'give', false, $give_lang_dir );
617
618
		}
619
620
621
		/**
622
		 *  Show minimum PHP version notice.
623
		 *
624
		 * @since  1.8.12
625
		 * @access public
626
		 */
627
		public function minimum_phpversion_notice() {
628
			// Bailout.
629
			if ( ! is_admin() ) {
630
				return;
631
			}
632
633
			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
634
			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
635
			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
636
			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
637
			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
638
			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
639
			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
640
641
			echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
642
				'<div class="notice notice-error">%1$s</div>',
643
				$notice_desc
644
			);
645
		}
646
647
	}
648
649
endif; // End if class_exists check
650
651
652
/**
653
 * Start Give
654
 *
655
 * The main function responsible for returning the one true Give instance to functions everywhere.
656
 *
657
 * Use this function like you would a global variable, except without needing
658
 * to declare the global.
659
 *
660
 * Example: <?php $give = Give(); ?>
661
 *
662
 * @since 1.0
663
 * @return object|Give
664
 */
665
function Give() {
0 ignored issues
show
The function name Give is in camel caps, but expected _give instead as per the coding standard.
Loading history...
666
	return Give::instance();
667
}
668
669
Give();
670