Completed
Push — issue/339 ( c16360 )
by Ravinder
511:00 queued 502:28
created

Give::minimum_phpversion_notice()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
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.0.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
37
 * contribution to WordPress.
38
 *
39
 * - The WordImpress Team
40
 */
41
42
// Exit if accessed directly.
43
if ( ! defined( 'ABSPATH' ) ) {
44
	exit;
45
}
46
47
if ( ! class_exists( 'Give' ) ) :
48
49
	/**
50
	 * Main Give Class
51
	 *
52
	 * @since 1.0
53
	 */
54
	final class Give {
55
56
		/** Singleton *************************************************************/
57
58
		/**
59
		 * Give Instance
60
		 *
61
		 * @since  1.0
62
		 * @access private
63
		 *
64
		 * @var    Give() The one true Give
65
		 */
66
		protected static $_instance;
67
68
		/**
69
		 * Give Roles Object
70
		 *
71
		 * @since  1.0
72
		 * @access public
73
		 *
74
		 * @var    Give_Roles object
75
		 */
76
		public $roles;
77
78
		/**
79
		 * Give Settings Object
80
		 *
81
		 * @since  1.0
82
		 * @access public
83
		 *
84
		 * @var    Give_Plugin_Settings object
85
		 */
86
		public $give_settings;
87
88
		/**
89
		 * Give Session Object
90
		 *
91
		 * This holds donation data for user's session.
92
		 *
93
		 * @since  1.0
94
		 * @access public
95
		 *
96
		 * @var    Give_Session object
97
		 */
98
		public $session;
99
100
		/**
101
		 * Give HTML Element Helper Object
102
		 *
103
		 * @since  1.0
104
		 * @access public
105
		 *
106
		 * @var    Give_HTML_Elements object
107
		 */
108
		public $html;
109
110
		/**
111
		 * Give Emails Object
112
		 *
113
		 * @since  1.0
114
		 * @access public
115
		 *
116
		 * @var    Give_Emails object
117
		 */
118
		public $emails;
119
120
		/**
121
		 * Give Email Template Tags Object
122
		 *
123
		 * @since  1.0
124
		 * @access public
125
		 *
126
		 * @var    Give_Email_Template_Tags object
127
		 */
128
		public $email_tags;
129
130
		/**
131
		 * Give Donors DB Object
132
		 *
133
		 * @since  1.0
134
		 * @access public
135
		 *
136
		 * @var    Give_DB_Donors object
137
		 */
138
		public $donors;
139
140
		/**
141
		 * Give Donor meta DB Object
142
		 *
143
		 * @since  1.6
144
		 * @access public
145
		 *
146
		 * @var    Give_DB_Donor_Meta object
147
		 */
148
		public $donor_meta;
149
150
		/**
151
		 * Give API Object
152
		 *
153
		 * @since  1.0
154
		 * @access public
155
		 *
156
		 * @var    Give_API object
157
		 */
158
		public $api;
159
160
		/**
161
		 * Give Template Loader Object
162
		 *
163
		 * @since  1.0
164
		 * @access public
165
		 *
166
		 * @var    Give_Template_Loader object
167
		 */
168
		public $template_loader;
169
170
		/**
171
		 * Give No Login Object
172
		 *
173
		 * @since  1.0
174
		 * @access public
175
		 *
176
		 * @var    Give_Email_Access object
177
		 */
178
		public $email_access;
179
180
		/**
181
		 * Give_tooltips Object
182
		 *
183
		 * @since  1.8.9
184
		 * @access public
185
		 *
186
		 * @var    Give_Tooltips object
187
		 */
188
		public $tooltips;
189
190
		/**
191
		 * Give notices Object
192
		 *
193
		 * @var    Give_Notices $notices
194
		 */
195
		public $notices;
196
197
198
		/**
199
		 * Give logging Object
200
		 *
201
		 * @var    Give_Logging $logs
202
		 */
203
		public $logs;
204
205
		/**
206
		 * Give payment Object
207
		 *
208
		 * @var    Give_DB_Payment_Meta $payment_meta
209
		 */
210
		public $payment_meta;
211
212
		/**
213
		 * Give form Object
214
		 *
215
		 * @var    Give_DB_Form_Meta $form_meta
216
		 */
217
		public $form_meta;
218
219
		/**
220
		 * Give form Object
221
		 *
222
		 * @var    Give_Async_Process $async_process
223
		 */
224
		public $async_process;
225
226
		/**
227
		 * Give scripts Object.
228
		 *
229
		 * @var Give_Scripts
230
		 */
231
		public $scripts;
232
233
		/**
234
		 * Main Give Instance
235
		 *
236
		 * Ensures that only one instance of Give exists in memory at any one
237
		 * time. Also prevents needing to define globals all over the place.
238
		 *
239
		 * @since     1.0
240
		 * @access    public
241
		 *
242
		 * @static
243
		 * @see       Give()
244
		 *
245
		 * @return    Give
246
		 */
247
		public static function instance() {
248
			if ( is_null( self::$_instance ) ) {
249
				self::$_instance = new self();
250
			}
251
252
			return self::$_instance;
253
		}
254
255
		/**
256
		 * Give Constructor.
257
		 */
258
		public function __construct() {
259
			// PHP version
260
			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
261
				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
262
			}
263
264
			// Bailout: Need minimum php version to load plugin.
265
			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
266
				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
267
268
				return;
269
			}
270
271
			$this->setup_constants();
272
			$this->includes();
273
			$this->init_hooks();
274
275
			do_action( 'give_loaded' );
276
		}
277
278
		/**
279
		 * Hook into actions and filters.
280
		 *
281
		 * @since  1.8.9
282
		 */
283
		private function init_hooks() {
284
			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
285
			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
286
		}
287
288
		/**
289
		 * Init Give when WordPress Initializes.
290
		 *
291
		 * @since 1.8.9
292
		 */
293
		public function init() {
294
295
			/**
296
			 * Fires before the Give core is initialized.
297
			 *
298
			 * @since 1.8.9
299
			 */
300
			do_action( 'before_give_init' );
301
302
			// Set up localization.
303
			$this->load_textdomain();
304
305
			$this->roles           = new Give_Roles();
306
			$this->api             = new Give_API();
307
			$this->give_settings   = new Give_Admin_Settings();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Give_Admin_Settings() of type object<Give_Admin_Settings> is incompatible with the declared type object<Give_Plugin_Settings> of property $give_settings.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
308
			$this->session         = new Give_Session();
309
			$this->html            = new Give_HTML_Elements();
310
			$this->emails          = new Give_Emails();
311
			$this->email_tags      = new Give_Email_Template_Tags();
312
			$this->donors          = new Give_DB_Donors();
313
			$this->donor_meta      = new Give_DB_Donor_Meta();
314
			$this->template_loader = new Give_Template_Loader();
315
			$this->email_access    = new Give_Email_Access();
316
			$this->tooltips        = new Give_Tooltips();
317
			$this->notices         = new Give_Notices();
318
			$this->payment_meta    = new Give_DB_Payment_Meta();
319
			$this->logs            = new Give_Logging();
320
			$this->form_meta       = new Give_DB_Form_Meta();
321
			$this->async_process   = new Give_Async_Process();
322
			$this->scripts         = new Give_Scripts();
323
324
			/**
325
			 * Fire the action after Give core loads.
326
			 *
327
			 * @param Give class instance.
328
			 *
329
			 * @since 1.8.7
330
			 */
331
			do_action( 'give_init', $this );
332
333
		}
334
335
		/**
336
		 * Throw error on object clone
337
		 *
338
		 * The whole idea of the singleton design pattern is that there is a single
339
		 * object, therefore we don't want the object to be cloned.
340
		 *
341
		 * @since  1.0
342
		 * @access protected
343
		 *
344
		 * @return void
345
		 */
346
		public function __clone() {
347
			// Cloning instances of the class is forbidden.
348
			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
349
		}
350
351
		/**
352
		 * Disable unserializing of the class
353
		 *
354
		 * @since  1.0
355
		 * @access protected
356
		 *
357
		 * @return void
358
		 */
359
		public function __wakeup() {
360
			// Unserializing instances of the class is forbidden.
361
			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
362
		}
363
364
		/**
365
		 * Setup plugin constants
366
		 *
367
		 * @since  1.0
368
		 * @access private
369
		 *
370
		 * @return void
371
		 */
372
		private function setup_constants() {
373
374
			// Plugin version
375
			if ( ! defined( 'GIVE_VERSION' ) ) {
376
				define( 'GIVE_VERSION', '2.0.0' );
377
			}
378
379
			// Plugin Root File
380
			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
381
				define( 'GIVE_PLUGIN_FILE', __FILE__ );
382
			}
383
384
			// Plugin Folder Path
385
			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
386
				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
387
			}
388
389
			// Plugin Folder URL
390
			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
391
				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
392
			}
393
394
			// Plugin Basename aka: "give/give.php"
395
			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
396
				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
397
			}
398
399
			// Make sure CAL_GREGORIAN is defined
400
			if ( ! defined( 'CAL_GREGORIAN' ) ) {
401
				define( 'CAL_GREGORIAN', 1 );
402
			}
403
		}
404
405
		/**
406
		 * Include required files
407
		 *
408
		 * @since  1.0
409
		 * @access private
410
		 *
411
		 * @return void
412
		 */
413
		private function includes() {
414
			global $give_options;
415
416
			/**
417
			 * Load libraries.
418
			 */
419
			if ( ! class_exists( 'WP_Async_Request' ) ) {
420
				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
421
			}
422
423
			if ( ! class_exists( 'WP_Background_Process' ) ) {
424
				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
425
			}
426
427
			/**
428
			 * Load plugin files
429
			 */
430
			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
431
			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
432
			$give_options = give_get_settings();
433
434
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
435
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
436
			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
437
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
438
			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
439
			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
440
			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
441
			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
442
			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
443
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
444
			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
445
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
446
447
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
448
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
449
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
450
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
451
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
452
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
453
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
454
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
455
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
456
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
457
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
458
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
459
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
460
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
461
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
462
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
463
			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
464
465
			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
466
			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
467
			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
468
			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
469
			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
470
			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
471
			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
472
			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
473
			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
474
			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
475
			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
476
			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
477
			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
478
			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
479
			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
480
			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
481
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
482
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
483
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
484
			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
485
486
			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
487
			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
488
			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
489
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
490
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
491
			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
492
493
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
494
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
495
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
496
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
497
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
498
499
			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
500
			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
501
			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
502
			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
503
			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
504
			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
505
506
			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
507
			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
508
509
			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
510
511
			if ( defined( 'WP_CLI' ) && WP_CLI ) {
512
				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
513
			}
514
515
			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
516
517
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
518
				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
519
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
520
				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
521
				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
522
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
523
				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
524
				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
525
				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
526
				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
527
				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
528
529
				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
530
				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
531
532
				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
533
				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
534
				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
535
536
				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
537
				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
538
				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
539
540
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
541
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
542
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
543
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
544
545
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
546
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
547
				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
548
549
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
550
551
				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
552
553
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
554
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
555
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
556
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
557
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
558
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
559
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
560
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
561
				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
562
			}// End if().
563
564
			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
565
566
		}
567
568
		/**
569
		 * Loads the plugin language files.
570
		 *
571
		 * @since  1.0
572
		 * @access public
573
		 *
574
		 * @return void
575
		 */
576
		public function load_textdomain() {
577
578
			// Set filter for Give's languages directory
579
			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
580
			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
581
582
			// Traditional WordPress plugin locale filter.
583
			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
584
			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
585
586
			unload_textdomain( 'give' );
587
			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
588
			load_plugin_textdomain( 'give', false, $give_lang_dir );
589
590
		}
591
592
593
		/**
594
		 *  Show minimum PHP version notice.
595
		 *
596
		 * @since  1.8.12
597
		 * @access public
598
		 */
599
		public function minimum_phpversion_notice() {
600
			// Bailout.
601
			if ( ! is_admin() ) {
602
				return;
603
			}
604
605
			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
606
			$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>';
607
			$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>';
608
			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
609
			$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>';
610
			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
611
			$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>';
612
613
			echo sprintf(
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
614
				'<div class="notice notice-error">%1$s</div>',
615
				$notice_desc
616
			);
617
		}
618
619
	}
620
621
endif; // End if class_exists check
622
623
624
/**
625
 * Start Give
626
 *
627
 * The main function responsible for returning the one true Give instance to functions everywhere.
628
 *
629
 * Use this function like you would a global variable, except without needing
630
 * to declare the global.
631
 *
632
 * Example: <?php $give = Give(); ?>
633
 *
634
 * @since 1.0
635
 * @return object|Give
636
 */
637
function Give() {
0 ignored issues
show
Coding Style introduced by
The function name Give is in camel caps, but expected _give instead as per the coding standard.
Loading history...
638
	return Give::instance();
639
}
640
641
Give();
642