PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.4
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.4
1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 1.8.0 All 210 releases
charitable / charitable.php

charitable.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.6.4, at charitable.php

958 lines 24.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Charitable
4 * Plugin URI: https://www.wpcharitable.com
5 * Description: The WordPress fundraising alternative for non-profits, created to help non-profits raise money on their own website.
6 * Version: 1.6.4
7 * Author: WP Charitable
8 * Author URI: https://wpcharitable.com
9 * Requires at least: 4.1
10 * Tested up to: 4.9.6
11 *
12 * Text Domain: charitable
13 * Domain Path: /i18n/languages/
14 *
15 * @package Charitable
16 * @author Eric Daams
17 * @copyright Copyright (c) 2018, Studio 164a
18 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
19 */
20
21 // Exit if accessed directly.
22 if ( ! defined( 'ABSPATH' ) ) {
23 exit;
24 }
25
26 if ( ! class_exists( 'Charitable' ) ) :
27
28 /**
29 * Main Charitable class
30 *
31 * @version 1.6.2
32 */
33 class Charitable {
34
35 /**
36 * Plugin version.
37 *
38 * @var string
39 */
40 const VERSION = '1.6.4';
41
42 /**
43 * Version of database schema.
44 *
45 * @var string A date in the format: YYYYMMDD
46 */
47 const DB_VERSION = '20180522';
48
49 /**
50 * Campaign post type.
51 *
52 * @var string
53 */
54 const CAMPAIGN_POST_TYPE = 'campaign';
55
56 /**
57 * Donation post type.
58 *
59 * @var string
60 */
61 const DONATION_POST_TYPE = 'donation';
62
63 /**
64 * Single instance of this class.
65 *
66 * @since 1.0.0
67 *
68 * @var Charitable
69 */
70 private static $instance = null;
71
72 /**
73 * The absolute path to this plugin's directory.
74 *
75 * @since 1.0.0
76 *
77 * @var string
78 */
79 private $directory_path;
80
81 /**
82 * The URL of this plugin's directory.
83 *
84 * @since 1.0.0
85 *
86 * @var string
87 */
88 private $directory_url;
89
90 /**
91 * Directory path for the includes folder of the plugin.
92 *
93 * @since 1.0.0
94 *
95 * @var string
96 */
97 private $includes_path;
98
99 /**
100 * Store of registered objects.
101 *
102 * @since 1.0.0
103 * @since 1.5.0 Changed to Charitable_Registry object. Previously it was an array.
104 *
105 * @var Charitable_Registry
106 */
107 private $registry;
108
109 /**
110 * Classmap.
111 *
112 * @since 1.5.0
113 *
114 * @var array
115 */
116 private $classmap;
117
118 /**
119 * Create class instance.
120 *
121 * @since 1.0.0
122 */
123 public function __construct() {
124 $this->directory_path = plugin_dir_path( __FILE__ );
125 $this->directory_url = plugin_dir_url( __FILE__ );
126 $this->includes_path = $this->directory_path . 'includes/';
127
128 spl_autoload_register( array( $this, 'autoloader' ) );
129
130 $this->load_dependencies();
131
132 register_activation_hook( __FILE__, array( $this, 'activate' ) );
133 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
134
135 add_action( 'plugins_loaded', array( $this, 'start' ), 1 );
136 }
137
138 /**
139 * Returns the original instance of this class.
140 *
141 * @since 1.0.0
142 *
143 * @return Charitable
144 */
145 public static function get_instance() {
146 return self::$instance;
147 }
148
149 /**
150 * Run the startup sequence.
151 *
152 * This is only ever executed once.
153 *
154 * @since 1.0.0
155 *
156 * @return void
157 */
158 public function start() {
159 /* If we've already started (i.e. run this function once before), do not pass go. */
160 if ( $this->started() ) {
161 return;
162 }
163
164 /* Set static instance. */
165 self::$instance = $this;
166
167 /* Set up the registry and instantiate objects we need straight away. */
168 $this->registry();
169
170 $this->maybe_start_ajax();
171
172 $this->attach_hooks_and_filters();
173
174 $this->maybe_start_admin();
175
176 $this->maybe_start_public();
177
178 Charitable_Addons::load( $this );
179 }
180
181 /**
182 * Include necessary files.
183 *
184 * @since 1.0.0
185 *
186 * @return void
187 */
188 private function load_dependencies() {
189 $includes_path = $this->get_path( 'includes' );
190
191 /* Load files with hooks & functions. Classes are autoloaded. */
192 require_once( $includes_path . 'charitable-core-functions.php' );
193 require_once( $includes_path . 'api/charitable-api-functions.php' );
194 require_once( $includes_path . 'campaigns/charitable-campaign-functions.php' );
195 require_once( $includes_path . 'campaigns/charitable-campaign-hooks.php' );
196 require_once( $includes_path . 'compat/charitable-compat-functions.php' );
197 require_once( $includes_path . 'currency/charitable-currency-functions.php' );
198 require_once( $includes_path . 'deprecated/charitable-deprecated-functions.php' );
199 require_once( $includes_path . 'donations/charitable-donation-hooks.php' );
200 require_once( $includes_path . 'donations/charitable-donation-functions.php' );
201 require_once( $includes_path . 'emails/charitable-email-hooks.php' );
202 require_once( $includes_path . 'endpoints/charitable-endpoints-functions.php' );
203 require_once( $includes_path . 'privacy/charitable-privacy-functions.php' );
204 require_once( $includes_path . 'public/charitable-template-helpers.php' );
205 require_once( $includes_path . 'shortcodes/charitable-shortcodes-hooks.php' );
206 require_once( $includes_path . 'upgrades/charitable-upgrade-hooks.php' );
207 require_once( $includes_path . 'users/charitable-user-functions.php' );
208 require_once( $includes_path . 'user-management/charitable-user-management-hooks.php' );
209 require_once( $includes_path . 'utilities/charitable-utility-functions.php' );
210 }
211
212 /**
213 * Dynamically loads the class attempting to be instantiated elsewhere in the
214 * plugin by looking at the $class_name parameter being passed as an argument.
215 *
216 * @since 1.5.0
217 *
218 * @param string $class_name The fully-qualified name of the class to load.
219 * @return boolean
220 */
221 public function autoloader( $class_name ) {
222 /* If the specified $class_name already exists, bail. */
223 if ( class_exists( $class_name ) ) {
224 return false;
225 }
226
227 /* If the specified $class_name does not include our namespace, duck out. */
228 if ( false === strpos( $class_name, 'Charitable_' ) ) {
229 return false;
230 }
231
232 /* Autogenerated class map. */
233 if ( ! isset( $this->classmap ) ) {
234 $this->classmap = include( 'includes/autoloader/charitable-class-map.php' );
235 }
236
237 $file_path = isset( $this->classmap[ $class_name ] ) ? $this->get_path( 'includes' ) . $this->classmap[ $class_name ] : false;
238
239 if ( false !== $file_path && file_exists( $file_path ) && is_file( $file_path ) ) {
240 require_once( $file_path );
241 return true;
242 }
243
244 return false;
245 }
246
247 /**
248 * Returns a registered class object.
249 *
250 * @since 1.5.0
251 *
252 * @return Charitable_Registry
253 */
254 public function registry() {
255 if ( ! isset( $this->registry ) ) {
256 $this->registry = new Charitable_Registry();
257 $this->registry->register_object( Charitable_Emails::get_instance() );
258 $this->registry->register_object( Charitable_Request::get_instance() );
259 $this->registry->register_object( Charitable_Gateways::get_instance() );
260 $this->registry->register_object( Charitable_i18n::get_instance() );
261 $this->registry->register_object( Charitable_Post_Types::get_instance() );
262 $this->registry->register_object( Charitable_Cron::get_instance() );
263 $this->registry->register_object( Charitable_Widgets::get_instance() );
264 $this->registry->register_object( Charitable_Licenses::get_instance() );
265 $this->registry->register_object( Charitable_User_Dashboard::get_instance() );
266 $this->registry->register_object( Charitable_Locations::get_instance() );
267
268 $this->registry->register_object( new Charitable_Privacy );
269 }
270
271 return $this->registry;
272 }
273
274 /**
275 * Set up hook and filter callback functions.
276 *
277 * @since 1.0.0
278 *
279 * @return void
280 */
281 private function attach_hooks_and_filters() {
282 add_action( 'wpmu_new_blog', array( $this, 'maybe_activate_charitable_on_new_site' ) );
283 add_action( 'plugins_loaded', array( $this, 'charitable_install' ), 100 );
284 add_action( 'plugins_loaded', array( $this, 'charitable_start' ), 100 );
285 add_action( 'plugins_loaded', array( $this, 'endpoints' ), 100 );
286 add_action( 'plugins_loaded', array( $this, 'donation_fields' ), 100 );
287 add_action( 'plugins_loaded', array( $this, 'campaign_fields' ), 100 );
288 add_action( 'plugins_loaded', array( $this, 'register_donormeta_table' ) );
289 add_action( 'plugins_loaded', 'charitable_load_compat_functions' );
290 add_action( 'setup_theme', array( 'Charitable_Customizer', 'start' ) );
291 add_action( 'wp_enqueue_scripts', array( $this, 'maybe_start_qunit' ), 100 );
292 add_action( 'rest_api_init', 'charitable_register_api_routes' );
293
294 /**
295 * We do this on priority 20 so that any functionality that is loaded on init (such
296 * as addons) has a chance to run before the event.
297 */
298 add_action( 'init', array( $this, 'do_charitable_actions' ), 20 );
299 }
300
301 /**
302 * Checks whether we're in the admin area and if so, loads the admin-only functionality.
303 *
304 * @since 1.0.0
305 *
306 * @return Charitable_Admin|false
307 */
308 private function maybe_start_admin() {
309 if ( ! is_admin() ) {
310 return false;
311 }
312
313 require_once( $this->get_path( 'admin' ) . 'class-charitable-admin.php' );
314 require_once( $this->get_path( 'admin' ) . 'charitable-admin-hooks.php' );
315
316 $admin = Charitable_Admin::get_instance();
317
318 $this->registry->register_object( $admin );
319
320 return $admin;
321 }
322
323 /**
324 * Checks whether we're on the public-facing side and if so, loads the public-facing functionality.
325 *
326 * @since 1.0.0
327 *
328 * @return Charitable_Public|false
329 */
330 private function maybe_start_public() {
331 if ( is_admin() && ! $this->is_ajax() ) {
332 return false;
333 }
334
335 require_once( $this->get_path( 'public' ) . 'class-charitable-public.php' );
336
337 $public = Charitable_Public::get_instance();
338
339 $this->registry->register_object( $public );
340
341 return $public;
342 }
343
344 /**
345 * Load the QUnit tests if ?qunit is appended to the request.
346 *
347 * @since 1.4.17
348 *
349 * @return boolean
350 */
351 public function maybe_start_qunit() {
352 /* Skip out early if ?qunit isn't included in the request. */
353 if ( ! array_key_exists( 'qunit', $_GET ) ) {
354 return false;
355 }
356
357 /* The unit tests have to exist. */
358 if ( ! file_exists( $this->get_path( 'directory' ) . 'tests/qunit/tests.js' ) ) {
359 return false;
360 }
361
362 wp_register_script( 'qunit', 'https://code.jquery.com/qunit/qunit-2.3.3.js', array(), '2.3.3', true );
363 /* Version: '20170615-15:44' */
364 wp_register_script( 'qunit-tests', $this->get_path( 'directory', false ) . 'tests/qunit/tests.js', array( 'jquery-core', 'qunit' ), time(), true );
365 wp_enqueue_script( 'qunit-tests' );
366
367 wp_register_style( 'qunit', 'https://code.jquery.com/qunit/qunit-2.3.3.css', array(), '2.3.3', 'all' );
368 wp_enqueue_style( 'qunit' );
369 }
370
371 /**
372 * Checks whether the current request is an AJAX request.
373 *
374 * @since 1.5.0
375 *
376 * @return boolean
377 */
378 private function is_ajax() {
379 return false !== ( defined( 'DOING_AJAX' ) && DOING_AJAX );
380 }
381
382 /**
383 * Checks whether we're executing an AJAX hook and if so, loads some AJAX functionality.
384 *
385 * @since 1.0.0
386 *
387 * @return void
388 */
389 private function maybe_start_ajax() {
390 if ( ! $this->is_ajax() ) {
391 return;
392 }
393
394 require_once( $this->get_path( 'includes' ) . 'ajax/charitable-ajax-functions.php' );
395 require_once( $this->get_path( 'includes' ) . 'ajax/charitable-ajax-hooks.php' );
396 }
397
398 /**
399 * This method is fired after all plugins are loaded and simply fires the charitable_start hook.
400 *
401 * Extensions can use the charitable_start event to load their own functionality.
402 *
403 * @since 1.0.0
404 *
405 * @return void
406 */
407 public function charitable_start() {
408 do_action( 'charitable_start', $this );
409 }
410
411 /**
412 * Fires off an action right after Charitable is installed, allowing other
413 * plugins/themes to do something at this point.
414 *
415 * @since 1.0.1
416 *
417 * @return void
418 */
419 public function charitable_install() {
420 $install = get_transient( 'charitable_install' );
421
422 if ( ! $install ) {
423 return;
424 }
425
426 require_once( $this->get_path( 'includes' ) . 'class-charitable-install.php' );
427
428 Charitable_Install::finish_installing();
429
430 do_action( 'charitable_install' );
431
432 delete_transient( 'charitable_install' );
433 }
434
435 /**
436 * Returns whether we are currently in the start phase of the plugin.
437 *
438 * @since 1.0.0
439 *
440 * @return boolean
441 */
442 public function is_start() {
443 return current_filter() == 'charitable_start';
444 }
445
446 /**
447 * Returns whether the plugin has already started.
448 *
449 * @since 1.0.0
450 *
451 * @return boolean
452 */
453 public function started() {
454 return did_action( 'charitable_start' ) || current_filter() == 'charitable_start';
455 }
456
457 /**
458 * Returns whether the plugin is being activated.
459 *
460 * @since 1.0.0
461 *
462 * @return boolean
463 */
464 public function is_activation() {
465 return current_filter() == 'activate_charitable/charitable.php';
466 }
467
468 /**
469 * Returns whether the plugin is being deactivated.
470 *
471 * @since 1.0.0
472 *
473 * @return boolean
474 */
475 public function is_deactivation() {
476 return current_filter() == 'deactivate_charitable/charitable.php';
477 }
478
479 /**
480 * Returns plugin paths.
481 *
482 * @since 1.0.0
483 *
484 * @param string $type If empty, returns the path to the plugin.
485 * @param boolean $absolute_path If true, returns the file system path. If false, returns it as a URL.
486 * @return string
487 */
488 public function get_path( $type = '', $absolute_path = true ) {
489 $base = $absolute_path ? $this->directory_path : $this->directory_url;
490
491 switch ( $type ) {
492 case 'includes':
493 $path = $base . 'includes/';
494 break;
495
496 case 'admin':
497 $path = $base . 'includes/admin/';
498 break;
499
500 case 'public':
501 $path = $base . 'includes/public/';
502 break;
503
504 case 'assets':
505 $path = $base . 'assets/';
506 break;
507
508 case 'templates':
509 $path = $base . 'templates/';
510 break;
511
512 case 'directory':
513 $path = $base;
514 break;
515
516 default:
517 $path = __FILE__;
518
519 }//end switch
520
521 return $path;
522 }
523
524 /**
525 * Returns the plugin's version number.
526 *
527 * @since 1.0.0
528 *
529 * @return string
530 */
531 public function get_version() {
532 $version = self::VERSION;
533
534 if ( false !== strpos( $version, '-' ) ) {
535 $parts = explode( '-', $version );
536 $version = $parts[0];
537 }
538
539 return $version;
540 }
541
542 /**
543 * Get the campaign fields registry
544 *
545 * If the registry has not been set up yet, this will also
546 * perform the task of setting it up initially.
547 *
548 * This method is called on the plugins_loaded hook.
549 *
550 * @since 1.6.0
551 *
552 * @return Charitable_Campaign_Field_Registry
553 */
554 public function campaign_fields() {
555 if ( ! $this->registry->has( 'campaign_field_registry' ) ) {
556 $campaign_fields = new Charitable_Campaign_Field_Registry();
557
558 /* Register it immediately to avoid endless recursion. */
559 $this->registry->register_object( $campaign_fields );
560
561 $fields = include( $this->get_path( 'includes' ) . 'fields/default-fields/campaign-fields.php' );
562
563 foreach ( $fields as $key => $args ) {
564 $campaign_fields->register_field( new Charitable_Campaign_Field( $key, $args ) );
565 }
566 }
567
568 return $this->registry->get( 'campaign_field_registry' );
569 }
570
571 /**
572 * Get the donation fields registry
573 *
574 * If the registry has not been set up yet, this will also
575 * perform the task of setting it up initially.
576 *
577 * This method is called on the plugins_loaded hook.
578 *
579 * @since 1.5.0
580 *
581 * @return Charitable_Donation_Field_Registry
582 */
583 public function donation_fields() {
584 if ( ! $this->registry->has( 'donation_field_registry' ) ) {
585 $donation_fields = new Charitable_Donation_Field_Registry();
586
587 /* Register it immediately to avoid endless recursion. */
588 $this->registry->register_object( $donation_fields );
589
590 $fields = include( $this->get_path( 'includes' ) . 'fields/default-fields/donation-fields.php' );
591
592 foreach ( $fields as $key => $args ) {
593 $donation_fields->register_field( new Charitable_Donation_Field( $key, $args ) );
594 }
595 }
596
597 return $this->registry->get( 'donation_field_registry' );
598 }
599
600 /**
601 * Return the Endpoints API object.
602 *
603 * If the Endpoints API has not been set up yet, this will also
604 * perform the task of setting it up initially.
605 *
606 * This method is called on the plugins_loaded hook.
607 *
608 * @since 1.5.0
609 *
610 * @return Charitable_Endpoints
611 */
612 public function endpoints() {
613 if ( ! $this->registry->has( 'endpoints' ) ) {
614 /**
615 * The order in which we register endpoints is important, because
616 * it determines the order in which the endpoints are checked to
617 * find whether they are the current page.
618 *
619 * Any endpoint that builds on another endpoint should be registered
620 * BEFORE the endpoint it builds on. In other words, move from
621 * most specific to least specific.
622 */
623 $endpoints = new Charitable_Endpoints();
624 $endpoints->register( new Charitable_Campaign_Donation_Endpoint );
625 $endpoints->register( new Charitable_Campaign_Widget_Endpoint );
626 $endpoints->register( new Charitable_Campaign_Endpoint );
627 $endpoints->register( new Charitable_Donation_Cancellation_Endpoint );
628 $endpoints->register( new Charitable_Donation_Processing_Endpoint );
629 $endpoints->register( new Charitable_Donation_Receipt_Endpoint );
630 $endpoints->register( new Charitable_Email_Preview_Endpoint );
631 $endpoints->register( new Charitable_Email_Verification_Endpoint );
632 $endpoints->register( new Charitable_Forgot_Password_Endpoint );
633 $endpoints->register( new Charitable_Reset_Password_Endpoint );
634 $endpoints->register( new Charitable_Registration_Endpoint );
635 $endpoints->register( new Charitable_Login_Endpoint );
636 $endpoints->register( new Charitable_Profile_Endpoint );
637
638 $this->registry->register_object( $endpoints );
639 }
640
641 return $this->registry->get( 'endpoints' );
642 }
643
644 /**
645 * Returns a registered object.
646 *
647 * @since 1.0.0
648 *
649 * @param string $class The type of class to be retrieved.
650 * @return object
651 */
652 public function get_registered_object( $class ) {
653 return $this->registry->get( $class );
654 }
655
656 /**
657 * Registers our donormeta table as a meta data table.
658 *
659 * @since 1.6.0
660 *
661 * @global WPDB $wpdb
662 * @return void
663 */
664 public function register_donormeta_table() {
665 global $wpdb;
666
667 $wpdb->donormeta = $wpdb->prefix . 'charitable_donormeta';
668 }
669
670 /**
671 * Returns the model for one of Charitable's database tables.
672 *
673 * @since 1.0.0
674 *
675 * @param string $table The database table to retrieve.
676 * @return Charitable_DB
677 */
678 public function get_db_table( $table ) {
679 $tables = $this->get_tables();
680
681 if ( ! isset( $tables[ $table ] ) ) {
682 charitable_get_deprecated()->doing_it_wrong(
683 __METHOD__,
684 sprintf( 'Invalid table %s passed', $table ),
685 '1.0.0'
686 );
687 return null;
688 }
689
690 return $this->registry->get( $tables[ $table ] );
691 }
692
693 /**
694 * Return the filtered list of registered tables.
695 *
696 * @since 1.0.0
697 *
698 * @return string[]
699 */
700 private function get_tables() {
701 /**
702 * Filter the array of available Charitable table classes.
703 *
704 * @since 1.0.0
705 *
706 * @param array $tables List of tables as a key=>value array.
707 */
708 return apply_filters( 'charitable_db_tables', array(
709 'campaign_donations' => 'Charitable_Campaign_Donations_DB',
710 'donors' => 'Charitable_Donors_DB',
711 'donormeta' => 'Charitable_Donormeta_DB',
712 ) );
713 }
714
715 /**
716 * Maybe activate Charitable when a new site is added in a multisite network.
717 *
718 * @since 1.4.6
719 *
720 * @param int $blog_id The blog to activate Charitable on.
721 * @return void
722 */
723 public function maybe_activate_charitable_on_new_site( $blog_id ) {
724 if ( is_plugin_active_for_network( basename( $this->directory_path ) . '/charitable.php' ) ) {
725 switch_to_blog( $blog_id );
726 $this->activate( false );
727 restore_current_blog();
728 }
729 }
730
731 /**
732 * Runs on plugin activation.
733 *
734 * @see register_activation_hook
735 *
736 * @since 1.0.0
737 *
738 * @param boolean $network_wide Whether to enable the plugin for all sites in the network
739 * or just the current site. Multisite only. Default is false.
740 * @return void
741 */
742 public function activate( $network_wide = false ) {
743 require_once( $this->get_path( 'includes' ) . 'class-charitable-install.php' );
744
745 if ( is_multisite() && $network_wide ) {
746 global $wpdb;
747
748 foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) {
749 switch_to_blog( $blog_id );
750 new Charitable_Install();
751 restore_current_blog();
752 }
753 } else {
754 new Charitable_Install();
755 }
756 }
757
758 /**
759 * Runs on plugin deactivation.
760 *
761 * @see register_deactivation_hook
762 *
763 * @since 1.0.0
764 *
765 * @return void
766 */
767 public function deactivate() {
768 require_once( $this->get_path( 'includes' ) . 'class-charitable-uninstall.php' );
769 new Charitable_Uninstall();
770 }
771
772 /**
773 * If a charitable_action event is triggered, delegate the event using do_action.
774 *
775 * @since 1.0.0
776 *
777 * @return void
778 */
779 public function do_charitable_actions() {
780 if ( isset( $_REQUEST['charitable_action'] ) ) {
781
782 $action = $_REQUEST['charitable_action'];
783
784 /**
785 * Handle Charitable action.
786 *
787 * @since 1.0.0
788 */
789 do_action( 'charitable_' . $action );
790 }
791 }
792
793 /**
794 * Throw error on object clone.
795 *
796 * This class is specifically designed to be instantiated once. You can retrieve the instance using charitable()
797 *
798 * @since 1.0.0
799 *
800 * @return void
801 */
802 public function __clone() {
803 charitable_get_deprecated()->doing_it_wrong(
804 __FUNCTION__,
805 __( 'Cloning this object is forbidden.', 'charitable' ),
806 '1.0.0'
807 );
808 }
809
810 /**
811 * Disable unserializing of the class.
812 *
813 * @since 1.0.0
814 *
815 * @return void
816 */
817 public function __wakeup() {
818 charitable_get_deprecated()->doing_it_wrong(
819 __FUNCTION__,
820 __( 'Unserializing instances of this class is forbidden.', 'charitable' ),
821 '1.0.0'
822 );
823 }
824
825 /**
826 * DEPRECATED METHODS
827 */
828
829 /**
830 * Load plugin compatibility files on plugins_loaded hook.
831 *
832 * @deprecated 1.8.0
833 *
834 * @since 1.4.18
835 * @since 1.5.0 Deprecated.
836 *
837 * @return void
838 */
839 public function load_plugin_compat_files() {
840 charitable_get_deprecated()->deprecated_function(
841 __METHOD__,
842 '1.5.0.',
843 'charitable_load_compat_functions'
844 );
845
846 charitable_load_compat_functions();
847 }
848
849 /**
850 * Stores an object in the plugin's registry.
851 *
852 * @deprecated 1.8.0
853 *
854 * @since 1.0.0
855 * @since 1.5.0 Deprecated.
856 *
857 * @param mixed $object Object to be registered.
858 * @return void
859 */
860 public function register_object( $object ) {
861 charitable_get_deprecated()->deprecated_function(
862 __METHOD__,
863 '1.5.0',
864 'charitable()->registry()->register_object()'
865 );
866
867 $this->registry->register_object( $object );
868 }
869
870 /**
871 * Returns the public class.
872 *
873 * @deprecated 1.8.0
874 *
875 * @since 1.0.0
876 * @since 1.5.0 Deprecated.
877 *
878 * @return Charitable_Public
879 */
880 public function get_public() {
881 charitable_get_deprecated()->deprecated_function(
882 __METHOD__,
883 '1.5.0',
884 'charitable_get_helper'
885 );
886
887 return $this->registry->get( 'Charitable_Public' );
888 }
889
890 /**
891 * Returns the admin class.
892 *
893 * @deprecated 1.8.0
894 *
895 * @since 1.0.0
896 * @since 1.5.0 Deprecated.
897 *
898 * @return Charitable_Admin
899 */
900 public function get_admin() {
901 charitable_get_deprecated()->deprecated_function(
902 __METHOD__,
903 '1.5.0',
904 'charitable_get_helper'
905 );
906
907 return $this->registry->get( 'Charitable_Admin' );
908 }
909
910 /**
911 * Return the current request object.
912 *
913 * @deprecated 1.8.0
914 *
915 * @since 1.0.0
916 * @since 1.5.0 Deprecated.
917 *
918 * @return Charitable_Request
919 */
920 public function get_request() {
921 charitable_get_deprecated()->deprecated_function(
922 __METHOD__,
923 '1.5.0',
924 'charitable_get_helper'
925 );
926
927 return $this->registry->get( 'Charitable_Request' );
928 }
929
930 /**
931 * Returns the instance of Charitable_Currency.
932 *
933 * @deprecated 1.7.0
934 *
935 * @since 1.4.0 Deprecated.
936 */
937 public function get_currency_helper() {
938 charitable_get_deprecated()->deprecated_function( __METHOD__, '1.4.0', 'charitable_get_currency_helper' );
939 return charitable_get_currency_helper();
940 }
941
942 /**
943 * Returns the instance of Charitable_Locations.
944 *
945 * @deprecated 1.6.0
946 *
947 * @since 1.2.0 Deprecated.
948 */
949 public function get_location_helper() {
950 charitable_get_deprecated()->deprecated_function( __METHOD__, '1.2.0', 'charitable_get_location_helper' );
951 return charitable_get_location_helper();
952 }
953 }
954
955 $charitable = new Charitable();
956
957 endif;
958