PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.24
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.24
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.24, at charitable.php

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