Completed
Push — release/2.1 ( c669cb...a27eea )
by Ravinder
995:32 queued 989:33
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 anyone. Open
29
 * source software is made by many people, and distributed under licenses that comply with the Open Source Definition."
30
 *
31
 * -- The Open Source Initiative
32
 *
33
 * Give is a tribute to the spirit and philosophy of Open Source. We at WordImpress gladly embrace the Open Source philosophy both
34
 * in how Give itself was developed, and how we hope to see others build more from our code base.
35
 *
36
 * Give would not have been possible without the tireless efforts of WordPress and the surrounding Open Source projects and their talented developers. Thank you all for your contribution to WordPress.
37
 *
38
 * - The WordImpress Team
39
 */
40
41
// Exit if accessed directly.
42
if ( ! defined( 'ABSPATH' ) ) {
43
	exit;
44
}
45
46
if ( ! class_exists( 'Give' ) ) :
47
48
	/**
49
	 * Main Give Class
50
	 *
51
	 * @since 1.0
52
	 */
53
	final class Give {
54
55
		/** Singleton *************************************************************/
56
57
		/**
58
		 * Give Instance
59
		 *
60
		 * @since  1.0
61
		 * @access private
62
		 *
63
		 * @var    Give() The one true Give
64
		 */
65
		protected static $_instance;
66
67
		/**
68
		 * Give Roles Object
69
		 *
70
		 * @since  1.0
71
		 * @access public
72
		 *
73
		 * @var    Give_Roles object
74
		 */
75
		public $roles;
76
77
		/**
78
		 * Give Settings Object
79
		 *
80
		 * @since  1.0
81
		 * @access public
82
		 *
83
		 * @var    Give_Admin_Settings object
84
		 */
85
		public $give_settings;
86
87
		/**
88
		 * Give Session Object
89
		 *
90
		 * This holds donation data for user's session.
91
		 *
92
		 * @since  1.0
93
		 * @access public
94
		 *
95
		 * @var    Give_Session object
96
		 */
97
		public $session;
98
99
		/**
100
		 * Give HTML Element Helper Object
101
		 *
102
		 * @since  1.0
103
		 * @access public
104
		 *
105
		 * @var    Give_HTML_Elements object
106
		 */
107
		public $html;
108
109
		/**
110
		 * Give Emails Object
111
		 *
112
		 * @since  1.0
113
		 * @access public
114
		 *
115
		 * @var    Give_Emails object
116
		 */
117
		public $emails;
118
119
		/**
120
		 * Give Email Template Tags Object
121
		 *
122
		 * @since  1.0
123
		 * @access public
124
		 *
125
		 * @var    Give_Email_Template_Tags object
126
		 */
127
		public $email_tags;
128
129
		/**
130
		 * Give Donors DB Object
131
		 *
132
		 * @since  1.0
133
		 * @access public
134
		 *
135
		 * @var    Give_DB_Donors object
136
		 */
137
		public $donors;
138
139
		/**
140
		 * Give Donor meta DB Object
141
		 *
142
		 * @since  1.6
143
		 * @access public
144
		 *
145
		 * @var    Give_DB_Donor_Meta object
146
		 */
147
		public $donor_meta;
148
149
		/**
150
		 * Give Sequential Donation DB Object
151
		 *
152
		 * @since  2.1.0
153
		 * @access public
154
		 *
155
		 * @var    Give_DB_Sequential_Ordering object
156
		 */
157
		public $sequential_donation_db;
158
159
		/**
160
		 * Give API Object
161
		 *
162
		 * @since  1.0
163
		 * @access public
164
		 *
165
		 * @var    Give_API object
166
		 */
167
		public $api;
168
169
		/**
170
		 * Give Template Loader Object
171
		 *
172
		 * @since  1.0
173
		 * @access public
174
		 *
175
		 * @var    Give_Template_Loader object
176
		 */
177
		public $template_loader;
178
179
		/**
180
		 * Give No Login Object
181
		 *
182
		 * @since  1.0
183
		 * @access public
184
		 *
185
		 * @var    Give_Email_Access object
186
		 */
187
		public $email_access;
188
189
		/**
190
		 * Give_tooltips Object
191
		 *
192
		 * @since  1.8.9
193
		 * @access public
194
		 *
195
		 * @var    Give_Tooltips object
196
		 */
197
		public $tooltips;
198
199
		/**
200
		 * Give notices Object
201
		 *
202
		 * @var    Give_Notices $notices
203
		 */
204
		public $notices;
205
206
207
		/**
208
		 * Give logging Object
209
		 *
210
		 * @var    Give_Logging $logs
211
		 */
212
		public $logs;
213
214
		/**
215
		 * Give payment Object
216
		 *
217
		 * @var    Give_DB_Payment_Meta $payment_meta
218
		 */
219
		public $payment_meta;
220
221
		/**
222
		 * Give form Object
223
		 *
224
		 * @var    Give_DB_Form_Meta $form_meta
225
		 */
226
		public $form_meta;
227
228
		/**
229
		 * Give form Object
230
		 *
231
		 * @var    Give_Async_Process $async_process
232
		 */
233
		public $async_process;
234
235
		/**
236
		 * Give scripts Object.
237
		 *
238
		 * @var Give_Scripts
239
		 */
240
		public $scripts;
241
242
		/**
243
		 * Give_Seq_Donation_Number Object.
244
		 *
245
		 * @var Give_Sequential_Donation_Number
246
		 */
247
		public $seq_donation_number;
248
249
		/**
250
		 * Main Give Instance
251
		 *
252
		 * Ensures that only one instance of Give exists in memory at any one
253
		 * time. Also prevents needing to define globals all over the place.
254
		 *
255
		 * @since     1.0
256
		 * @access    public
257
		 *
258
		 * @static
259
		 * @see       Give()
260
		 *
261
		 * @return    Give
262
		 */
263
		public static function instance() {
264
			if ( is_null( self::$_instance ) ) {
265
				self::$_instance = new self();
266
			}
267
268
			return self::$_instance;
269
		}
270
271
		/**
272
		 * Give Constructor.
273
		 */
274
		public function __construct() {
275
			// PHP version
276
			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
277
				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
278
			}
279
280
			// Bailout: Need minimum php version to load plugin.
281
			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
282
				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
283
284
				return;
285
			}
286
287
			$this->setup_constants();
288
			$this->includes();
289
			$this->init_hooks();
290
291
			do_action( 'give_loaded' );
292
		}
293
294
		/**
295
		 * Hook into actions and filters.
296
		 *
297
		 * @since  1.8.9
298
		 */
299
		private function init_hooks() {
300
			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
301
			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
302
303
			// Set up localization on init Hook.
304
			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
305
		}
306
307
308
		/**
309
		 * Init Give when WordPress Initializes.
310
		 *
311
		 * @since 1.8.9
312
		 */
313
		public function init() {
314
315
			/**
316
			 * Fires before the Give core is initialized.
317
			 *
318
			 * @since 1.8.9
319
			 */
320
			do_action( 'before_give_init' );
321
322
			// Set up localization.
323
			$this->load_textdomain();
324
325
			$this->roles                  = new Give_Roles();
326
			$this->api                    = new Give_API();
327
			$this->give_settings          = new Give_Admin_Settings();
328
			$this->session                = new Give_Session();
329
			$this->html                   = new Give_HTML_Elements();
330
			$this->emails                 = new Give_Emails();
331
			$this->email_tags             = new Give_Email_Template_Tags();
332
			$this->donors                 = new Give_DB_Donors();
333
			$this->donor_meta             = new Give_DB_Donor_Meta();
334
			$this->template_loader        = new Give_Template_Loader();
335
			$this->email_access           = new Give_Email_Access();
336
			$this->tooltips               = new Give_Tooltips();
337
			$this->notices                = new Give_Notices();
338
			$this->payment_meta           = new Give_DB_Payment_Meta();
339
			$this->logs                   = new Give_Logging();
340
			$this->form_meta              = new Give_DB_Form_Meta();
341
			$this->sequential_donation_db = new Give_DB_Sequential_Ordering();
342
			$this->async_process          = new Give_Async_Process();
343
			$this->scripts                = new Give_Scripts();
344
			$this->seq_donation_number    = Give_Sequential_Donation_Number::get_instance();
345
346
			/**
347
			 * Fire the action after Give core loads.
348
			 *
349
			 * @param Give class instance.
350
			 *
351
			 * @since 1.8.7
352
			 */
353
			do_action( 'give_init', $this );
354
355
		}
356
357
		/**
358
		 * Throw error on object clone
359
		 *
360
		 * The whole idea of the singleton design pattern is that there is a single
361
		 * object, therefore we don't want the object to be cloned.
362
		 *
363
		 * @since  1.0
364
		 * @access protected
365
		 *
366
		 * @return void
367
		 */
368
		public function __clone() {
369
			// Cloning instances of the class is forbidden.
370
			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
371
		}
372
373
		/**
374
		 * Disable unserializing of the class
375
		 *
376
		 * @since  1.0
377
		 * @access protected
378
		 *
379
		 * @return void
380
		 */
381
		public function __wakeup() {
382
			// Unserializing instances of the class is forbidden.
383
			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
384
		}
385
386
		/**
387
		 * Setup plugin constants
388
		 *
389
		 * @since  1.0
390
		 * @access private
391
		 *
392
		 * @return void
393
		 */
394
		private function setup_constants() {
395
396
			// Plugin version
397
			if ( ! defined( 'GIVE_VERSION' ) ) {
398
				define( 'GIVE_VERSION', '2.1.0' );
399
			}
400
401
			// Plugin Root File
402
			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
403
				define( 'GIVE_PLUGIN_FILE', __FILE__ );
404
			}
405
406
			// Plugin Folder Path
407
			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
408
				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
409
			}
410
411
			// Plugin Folder URL
412
			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
413
				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
414
			}
415
416
			// Plugin Basename aka: "give/give.php"
417
			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
418
				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
419
			}
420
421
			// Make sure CAL_GREGORIAN is defined
422
			if ( ! defined( 'CAL_GREGORIAN' ) ) {
423
				define( 'CAL_GREGORIAN', 1 );
424
			}
425
		}
426
427
		/**
428
		 * Include required files
429
		 *
430
		 * @since  1.0
431
		 * @access private
432
		 *
433
		 * @return void
434
		 */
435
		private function includes() {
436
			global $give_options;
437
438
			/**
439
			 * Load libraries.
440
			 */
441
			if ( ! class_exists( 'WP_Async_Request' ) ) {
442
				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
443
			}
444
445
			if ( ! class_exists( 'WP_Background_Process' ) ) {
446
				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
447
			}
448
449
			/**
450
			 * Load plugin files
451
			 */
452
			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
453
			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
454
			$give_options = give_get_settings();
455
456
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
457
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
458
			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
459
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
460
			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
461
			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
462
			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
463
			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
464
			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
465
			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.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-ordering.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-sequential-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 . 'blocks/load.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
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
572
573
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
574
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
575
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
576
577
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
578
579
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
580
581
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
582
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
583
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
584
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
585
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
586
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
587
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
588
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
589
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
590
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
591
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
592
			}// End if().
593
594
			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
595
596
		}
597
598
		/**
599
		 * Loads the plugin language files.
600
		 *
601
		 * @since  1.0
602
		 * @access public
603
		 *
604
		 * @return void
605
		 */
606
		public function load_textdomain() {
607
608
			// Set filter for Give's languages directory
609
			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
610
			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
611
612
			// Traditional WordPress plugin locale filter.
613
			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
614
			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
615
616
			unload_textdomain( 'give' );
617
			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
618
			load_plugin_textdomain( 'give', false, $give_lang_dir );
619
620
		}
621
622
623
		/**
624
		 *  Show minimum PHP version notice.
625
		 *
626
		 * @since  1.8.12
627
		 * @access public
628
		 */
629
		public function minimum_phpversion_notice() {
630
			// Bailout.
631
			if ( ! is_admin() ) {
632
				return;
633
			}
634
635
			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
636
			$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>';
637
			$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>';
638
			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
639
			$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>';
640
			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
641
			$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>';
642
643
			echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
644
				'<div class="notice notice-error">%1$s</div>',
645
				wp_kses_post( $notice_desc )
646
			);
647
		}
648
649
	}
650
651
endif; // End if class_exists check
652
653
654
/**
655
 * Start Give
656
 *
657
 * The main function responsible for returning the one true Give instance to functions everywhere.
658
 *
659
 * Use this function like you would a global variable, except without needing
660
 * to declare the global.
661
 *
662
 * Example: <?php $give = Give(); ?>
663
 *
664
 * @since 1.0
665
 * @return object|Give
666
 */
667
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...
668
	return Give::instance();
669
}
670
671
Give();
672