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

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