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

908 lines 22.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.5.13
7 * Author: WP Charitable
8 * Author URI: https://wpcharitable.com
9 * Requires at least: 4.1
10 * Tested up to: 4.9.5
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.5.6
32 */
33 class Charitable {
34
35 /**
36 * Plugin version.
37 *
38 * @var string
39 */
40 const VERSION = '1.5.12';
41
42 /**
43 * Version of database schema.
44 *
45 * @var string A date in the format: YYYYMMDD
46 */
47 const DB_VERSION = '20150615';
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 . 'campaigns/charitable-campaign-functions.php' );
194 require_once( $includes_path . 'campaigns/charitable-campaign-hooks.php' );
195 require_once( $includes_path . 'compat/charitable-compat-functions.php' );
196 require_once( $includes_path . 'currency/charitable-currency-functions.php' );
197 require_once( $includes_path . 'deprecated/charitable-deprecated-functions.php' );
198 require_once( $includes_path . 'donations/charitable-donation-hooks.php' );
199 require_once( $includes_path . 'donations/charitable-donation-functions.php' );
200 require_once( $includes_path . 'emails/charitable-email-hooks.php' );
201 require_once( $includes_path . 'endpoints/charitable-endpoints-functions.php' );
202 require_once( $includes_path . 'public/charitable-template-helpers.php' );
203 require_once( $includes_path . 'shortcodes/charitable-shortcodes-hooks.php' );
204 require_once( $includes_path . 'upgrades/charitable-upgrade-hooks.php' );
205 require_once( $includes_path . 'users/charitable-user-functions.php' );
206 require_once( $includes_path . 'user-management/charitable-user-management-hooks.php' );
207 require_once( $includes_path . 'utilities/charitable-utility-functions.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
267 return $this->registry;
268 }
269
270 /**
271 * Set up hook and filter callback functions.
272 *
273 * @since 1.0.0
274 *
275 * @return void
276 */
277 private function attach_hooks_and_filters() {
278 add_action( 'wpmu_new_blog', array( $this, 'maybe_activate_charitable_on_new_site' ) );
279 add_action( 'plugins_loaded', array( $this, 'charitable_install' ), 100 );
280 add_action( 'plugins_loaded', array( $this, 'charitable_start' ), 100 );
281 add_action( 'plugins_loaded', array( $this, 'endpoints' ), 100 );
282 add_action( 'plugins_loaded', array( $this, 'donation_fields' ), 100 );
283 add_action( 'plugins_loaded', 'charitable_load_compat_functions' );
284 add_action( 'setup_theme', array( 'Charitable_Customizer', 'start' ) );
285 add_action( 'wp_enqueue_scripts', array( $this, 'maybe_start_qunit' ), 100 );
286
287 /**
288 * We do this on priority 20 so that any functionality that is loaded on init (such
289 * as addons) has a chance to run before the event.
290 */
291 add_action( 'init', array( $this, 'do_charitable_actions' ), 20 );
292 }
293
294 /**
295 * Checks whether we're in the admin area and if so, loads the admin-only functionality.
296 *
297 * @since 1.0.0
298 *
299 * @return Charitable_Admin|false
300 */
301 private function maybe_start_admin() {
302 if ( ! is_admin() ) {
303 return false;
304 }
305
306 require_once( $this->get_path( 'admin' ) . 'class-charitable-admin.php' );
307 require_once( $this->get_path( 'admin' ) . 'charitable-admin-hooks.php' );
308
309 $admin = Charitable_Admin::get_instance();
310
311 $this->registry->register_object( $admin );
312
313 return $admin;
314 }
315
316 /**
317 * Checks whether we're on the public-facing side and if so, loads the public-facing functionality.
318 *
319 * @since 1.0.0
320 *
321 * @return Charitable_Public|false
322 */
323 private function maybe_start_public() {
324 if ( is_admin() && ! $this->is_ajax() ) {
325 return false;
326 }
327
328 require_once( $this->get_path( 'public' ) . 'class-charitable-public.php' );
329
330 $public = Charitable_Public::get_instance();
331
332 $this->registry->register_object( $public );
333
334 return $public;
335 }
336
337 /**
338 * Load the QUnit tests if ?qunit is appended to the request.
339 *
340 * @since 1.4.17
341 *
342 * @return boolean
343 */
344 public function maybe_start_qunit() {
345 /* Skip out early if ?qunit isn't included in the request. */
346 if ( ! array_key_exists( 'qunit', $_GET ) ) {
347 return false;
348 }
349
350 /* The unit tests have to exist. */
351 if ( ! file_exists( $this->get_path( 'directory' ) . 'tests/qunit/tests.js' ) ) {
352 return false;
353 }
354
355 wp_register_script( 'qunit', 'https://code.jquery.com/qunit/qunit-2.3.3.js', array(), '2.3.3', true );
356 /* Version: '20170615-15:44' */
357 wp_register_script( 'qunit-tests', $this->get_path( 'directory', false ) . 'tests/qunit/tests.js', array( 'jquery-core', 'qunit' ), time(), true );
358 wp_enqueue_script( 'qunit-tests' );
359
360 wp_register_style( 'qunit', 'https://code.jquery.com/qunit/qunit-2.3.3.css', array(), '2.3.3', 'all' );
361 wp_enqueue_style( 'qunit' );
362 }
363
364 /**
365 * Checks whether the current request is an AJAX request.
366 *
367 * @since 1.5.0
368 *
369 * @return boolean
370 */
371 private function is_ajax() {
372 return false !== ( defined( 'DOING_AJAX' ) && DOING_AJAX );
373 }
374
375 /**
376 * Checks whether we're executing an AJAX hook and if so, loads some AJAX functionality.
377 *
378 * @since 1.0.0
379 *
380 * @return void
381 */
382 private function maybe_start_ajax() {
383 if ( ! $this->is_ajax() ) {
384 return;
385 }
386
387 require_once( $this->get_path( 'includes' ) . 'ajax/charitable-ajax-functions.php' );
388 require_once( $this->get_path( 'includes' ) . 'ajax/charitable-ajax-hooks.php' );
389 }
390
391 /**
392 * This method is fired after all plugins are loaded and simply fires the charitable_start hook.
393 *
394 * Extensions can use the charitable_start event to load their own functionality.
395 *
396 * @since 1.0.0
397 *
398 * @return void
399 */
400 public function charitable_start() {
401 do_action( 'charitable_start', $this );
402 }
403
404 /**
405 * Fires off an action right after Charitable is installed, allowing other
406 * plugins/themes to do something at this point.
407 *
408 * @since 1.0.1
409 *
410 * @return void
411 */
412 public function charitable_install() {
413 $install = get_transient( 'charitable_install' );
414
415 if ( ! $install ) {
416 return;
417 }
418
419 require_once( $this->get_path( 'includes' ) . 'class-charitable-install.php' );
420
421 Charitable_Install::finish_installing();
422
423 do_action( 'charitable_install' );
424
425 delete_transient( 'charitable_install' );
426 }
427
428 /**
429 * Returns whether we are currently in the start phase of the plugin.
430 *
431 * @since 1.0.0
432 *
433 * @return boolean
434 */
435 public function is_start() {
436 return current_filter() == 'charitable_start';
437 }
438
439 /**
440 * Returns whether the plugin has already started.
441 *
442 * @since 1.0.0
443 *
444 * @return boolean
445 */
446 public function started() {
447 return did_action( 'charitable_start' ) || current_filter() == 'charitable_start';
448 }
449
450 /**
451 * Returns whether the plugin is being activated.
452 *
453 * @since 1.0.0
454 *
455 * @return boolean
456 */
457 public function is_activation() {
458 return current_filter() == 'activate_charitable/charitable.php';
459 }
460
461 /**
462 * Returns whether the plugin is being deactivated.
463 *
464 * @since 1.0.0
465 *
466 * @return boolean
467 */
468 public function is_deactivation() {
469 return current_filter() == 'deactivate_charitable/charitable.php';
470 }
471
472 /**
473 * Returns plugin paths.
474 *
475 * @since 1.0.0
476 *
477 * @param string $type If empty, returns the path to the plugin.
478 * @param boolean $absolute_path If true, returns the file system path. If false, returns it as a URL.
479 * @return string
480 */
481 public function get_path( $type = '', $absolute_path = true ) {
482 $base = $absolute_path ? $this->directory_path : $this->directory_url;
483
484 switch ( $type ) {
485 case 'includes':
486 $path = $base . 'includes/';
487 break;
488
489 case 'admin':
490 $path = $base . 'includes/admin/';
491 break;
492
493 case 'public':
494 $path = $base . 'includes/public/';
495 break;
496
497 case 'assets':
498 $path = $base . 'assets/';
499 break;
500
501 case 'templates':
502 $path = $base . 'templates/';
503 break;
504
505 case 'directory':
506 $path = $base;
507 break;
508
509 default:
510 $path = __FILE__;
511
512 }//end switch
513
514 return $path;
515 }
516
517 /**
518 * Returns the plugin's version number.
519 *
520 * @since 1.0.0
521 *
522 * @return string
523 */
524 public function get_version() {
525 $version = self::VERSION;
526
527 if ( false !== strpos( $version, '-' ) ) {
528 $parts = explode( '-', $version );
529 $version = $parts[0];
530 }
531
532 return $version;
533 }
534
535 /**
536 * Get the donation fields registry
537 *
538 * If the registry has not been set up yet, this will also
539 * perform the task of setting it up initially.
540 *
541 * This method is called on the plugins_loaded hook.
542 *
543 * @since 1.5.0
544 *
545 * @return Charitable_Donation_Field_Registry
546 */
547 public function donation_fields() {
548 if ( ! $this->registry->has( 'donation_field_registry' ) ) {
549 $donation_fields = new Charitable_Donation_Field_Registry();
550 $donation_fields->set_default_section( 'user', 'public' );
551 $donation_fields->set_default_section( 'user', 'admin' );
552
553 $fields = include( $this->get_path( 'includes' ) . 'fields/default-fields/donation-fields.php' );
554
555 foreach ( $fields as $key => $args ) {
556 $donation_fields->register_field( new Charitable_Donation_Field( $key, $args ) );
557 }
558
559 $this->registry->register_object( $donation_fields );
560 }
561
562 return $this->registry->get( 'donation_field_registry' );
563 }
564
565 /**
566 * Return the Endpoints API object.
567 *
568 * If the Endpoints API has not been set up yet, this will also
569 * perform the task of setting it up initially.
570 *
571 * This method is called on the plugins_loaded hook.
572 *
573 * @since 1.5.0
574 *
575 * @return Charitable_Endpoints
576 */
577 public function endpoints() {
578 if ( ! $this->registry->has( 'endpoints' ) ) {
579 /**
580 * The order in which we register endpoints is important, because
581 * it determines the order in which the endpoints are checked to
582 * find whether they are the current page.
583 *
584 * Any endpoint that builds on another endpoint should be registered
585 * BEFORE the endpoint it builds on. In other words, move from
586 * most specific to least specific.
587 */
588 $endpoints = new Charitable_Endpoints();
589 $endpoints->register( new Charitable_Campaign_Donation_Endpoint );
590 $endpoints->register( new Charitable_Campaign_Widget_Endpoint );
591 $endpoints->register( new Charitable_Campaign_Endpoint );
592 $endpoints->register( new Charitable_Donation_Cancellation_Endpoint );
593 $endpoints->register( new Charitable_Donation_Processing_Endpoint );
594 $endpoints->register( new Charitable_Donation_Receipt_Endpoint );
595 $endpoints->register( new Charitable_Email_Preview_Endpoint );
596 $endpoints->register( new Charitable_Email_Verification_Endpoint );
597 $endpoints->register( new Charitable_Forgot_Password_Endpoint );
598 $endpoints->register( new Charitable_Reset_Password_Endpoint );
599 $endpoints->register( new Charitable_Registration_Endpoint );
600 $endpoints->register( new Charitable_Login_Endpoint );
601 $endpoints->register( new Charitable_Profile_Endpoint );
602
603 $this->registry->register_object( $endpoints );
604 }
605
606 return $this->registry->get( 'endpoints' );
607 }
608
609 /**
610 * Returns a registered object.
611 *
612 * @since 1.0.0
613 *
614 * @param string $class The type of class to be retrieved.
615 * @return object
616 */
617 public function get_registered_object( $class ) {
618 return $this->registry->get( $class );
619 }
620
621 /**
622 * Returns the model for one of Charitable's database tables.
623 *
624 * @since 1.0.0
625 *
626 * @param string $table The database table to retrieve.
627 * @return Charitable_DB
628 */
629 public function get_db_table( $table ) {
630 $tables = $this->get_tables();
631
632 if ( ! isset( $tables[ $table ] ) ) {
633 charitable_get_deprecated()->doing_it_wrong(
634 __METHOD__,
635 sprintf( 'Invalid table %s passed', $table ),
636 '1.0.0'
637 );
638 return null;
639 }
640
641 return $this->registry->get( $tables[ $table ] );
642 }
643
644 /**
645 * Return the filtered list of registered tables.
646 *
647 * @since 1.0.0
648 *
649 * @return string[]
650 */
651 private function get_tables() {
652 /**
653 * Filter the array of available Charitable table classes.
654 *
655 * @since 1.0.0
656 *
657 * @param array $tables List of tables as a key=>value array.
658 */
659 return apply_filters( 'charitable_db_tables', array(
660 'campaign_donations' => 'Charitable_Campaign_Donations_DB',
661 'donors' => 'Charitable_Donors_DB',
662 ) );
663 }
664
665 /**
666 * Maybe activate Charitable when a new site is added in a multisite network.
667 *
668 * @since 1.4.6
669 *
670 * @param int $blog_id The blog to activate Charitable on.
671 * @return void
672 */
673 public function maybe_activate_charitable_on_new_site( $blog_id ) {
674 if ( is_plugin_active_for_network( basename( $this->directory_path ) . '/charitable.php' ) ) {
675 switch_to_blog( $blog_id );
676 $this->activate( false );
677 restore_current_blog();
678 }
679 }
680
681 /**
682 * Runs on plugin activation.
683 *
684 * @see register_activation_hook
685 *
686 * @since 1.0.0
687 *
688 * @param boolean $network_wide Whether to enable the plugin for all sites in the network
689 * or just the current site. Multisite only. Default is false.
690 * @return void
691 */
692 public function activate( $network_wide = false ) {
693 require_once( $this->get_path( 'includes' ) . 'class-charitable-install.php' );
694
695 if ( is_multisite() && $network_wide ) {
696 global $wpdb;
697
698 foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) {
699 switch_to_blog( $blog_id );
700 new Charitable_Install();
701 restore_current_blog();
702 }
703 } else {
704 new Charitable_Install();
705 }
706 }
707
708 /**
709 * Runs on plugin deactivation.
710 *
711 * @see register_deactivation_hook
712 *
713 * @since 1.0.0
714 *
715 * @return void
716 */
717 public function deactivate() {
718 require_once( $this->get_path( 'includes' ) . 'class-charitable-uninstall.php' );
719 new Charitable_Uninstall();
720 }
721
722 /**
723 * If a charitable_action event is triggered, delegate the event using do_action.
724 *
725 * @since 1.0.0
726 *
727 * @return void
728 */
729 public function do_charitable_actions() {
730 if ( isset( $_REQUEST['charitable_action'] ) ) {
731
732 $action = $_REQUEST['charitable_action'];
733
734 /**
735 * Handle Charitable action.
736 *
737 * @since 1.0.0
738 */
739 do_action( 'charitable_' . $action );
740 }
741 }
742
743 /**
744 * Throw error on object clone.
745 *
746 * This class is specifically designed to be instantiated once. You can retrieve the instance using charitable()
747 *
748 * @since 1.0.0
749 *
750 * @return void
751 */
752 public function __clone() {
753 charitable_get_deprecated()->doing_it_wrong(
754 __FUNCTION__,
755 __( 'Cheatin&#8217; huh?', 'charitable' ),
756 '1.0.0'
757 );
758 }
759
760 /**
761 * Disable unserializing of the class.
762 *
763 * @since 1.0.0
764 *
765 * @return void
766 */
767 public function __wakeup() {
768 charitable_get_deprecated()->doing_it_wrong(
769 __FUNCTION__,
770 __( 'Cheatin&#8217; huh?', 'charitable' ),
771 '1.0.0'
772 );
773 }
774
775 /**
776 * DEPRECATED METHODS
777 */
778
779 /**
780 * Load plugin compatibility files on plugins_loaded hook.
781 *
782 * @deprecated 1.8.0
783 *
784 * @since 1.4.18
785 * @since 1.5.0 Deprecated.
786 *
787 * @return void
788 */
789 public function load_plugin_compat_files() {
790 charitable_get_deprecated()->deprecated_function(
791 __METHOD__,
792 '1.5.0.',
793 'charitable_load_compat_functions'
794 );
795
796 charitable_load_compat_functions();
797 }
798
799 /**
800 * Stores an object in the plugin's registry.
801 *
802 * @deprecated 1.8.0
803 *
804 * @since 1.0.0
805 * @since 1.5.0 Deprecated.
806 *
807 * @param mixed $object Object to be registered.
808 * @return void
809 */
810 public function register_object( $object ) {
811 charitable_get_deprecated()->deprecated_function(
812 __METHOD__,
813 '1.5.0',
814 'charitable()->registry()->register_object()'
815 );
816
817 $this->registry->register_object( $object );
818 }
819
820 /**
821 * Returns the public class.
822 *
823 * @deprecated 1.8.0
824 *
825 * @since 1.0.0
826 * @since 1.5.0 Deprecated.
827 *
828 * @return Charitable_Public
829 */
830 public function get_public() {
831 charitable_get_deprecated()->deprecated_function(
832 __METHOD__,
833 '1.5.0',
834 'charitable_get_helper'
835 );
836
837 return $this->registry->get( 'Charitable_Public' );
838 }
839
840 /**
841 * Returns the admin class.
842 *
843 * @deprecated 1.8.0
844 *
845 * @since 1.0.0
846 * @since 1.5.0 Deprecated.
847 *
848 * @return Charitable_Admin
849 */
850 public function get_admin() {
851 charitable_get_deprecated()->deprecated_function(
852 __METHOD__,
853 '1.5.0',
854 'charitable_get_helper'
855 );
856
857 return $this->registry->get( 'Charitable_Admin' );
858 }
859
860 /**
861 * Return the current request object.
862 *
863 * @deprecated 1.8.0
864 *
865 * @since 1.0.0
866 * @since 1.5.0 Deprecated.
867 *
868 * @return Charitable_Request
869 */
870 public function get_request() {
871 charitable_get_deprecated()->deprecated_function(
872 __METHOD__,
873 '1.5.0',
874 'charitable_get_helper'
875 );
876
877 return $this->registry->get( 'Charitable_Request' );
878 }
879
880 /**
881 * Returns the instance of Charitable_Currency.
882 *
883 * @deprecated 1.7.0
884 *
885 * @since 1.4.0 Deprecated.
886 */
887 public function get_currency_helper() {
888 charitable_get_deprecated()->deprecated_function( __METHOD__, '1.4.0', 'charitable_get_currency_helper' );
889 return charitable_get_currency_helper();
890 }
891
892 /**
893 * Returns the instance of Charitable_Locations.
894 *
895 * @deprecated 1.6.0
896 *
897 * @since 1.2.0 Deprecated.
898 */
899 public function get_location_helper() {
900 charitable_get_deprecated()->deprecated_function( __METHOD__, '1.2.0', 'charitable_get_location_helper' );
901 return charitable_get_location_helper();
902 }
903 }
904
905 $charitable = new Charitable();
906
907 endif;
908