registry()->get( $class_key ); } /** * Returns the Charitable_Notices class instance. * * @since 1.0.0 * * @return Charitable_Notices */ function charitable_get_notices() { return charitable()->registry()->get( 'notices' ); } /** * Returns the Charitable_Donation_Processor class instance. * * @since 1.0.0 * * @return Charitable_Donation_Processor */ function charitable_get_donation_processor() { $registry = charitable()->registry(); if ( ! $registry->has( 'donation_processor' ) ) { $registry->register_object( Charitable_Donation_Processor::get_instance() ); } return $registry->get( 'donation_processor' ); } /** * Return Charitable_Locations helper class. * * @since 1.0.0 * * @return Charitable_Locations */ function charitable_get_location_helper() { return charitable()->registry()->get( 'locations' ); } /** * Returns the current user's session object. * * @since 1.0.0 * * @return Charitable_Session */ function charitable_get_session() { return charitable()->registry()->get( 'session' ); } /** * Returns the current request helper object. * * @since 1.0.0 * * @return Charitable_Request */ function charitable_get_request() { $registry = charitable()->registry(); if ( ! $registry->has( 'request' ) ) { $registry->register_object( Charitable_Request::get_instance() ); } return $registry->get( 'request' ); } /** * Returns the Charitable_User_Dashboard object. * * @since 1.0.0 * * @return Charitable_User_Dashboard */ function charitable_get_user_dashboard() { return charitable()->registry()->get( 'user_dashboard' ); } /** * Return the database table helper object. * * @since 1.0.0 * * @param string $table The table key. * @return mixed|null A child class of Charitable_DB if table exists. null otherwise. */ function charitable_get_table( $table ) { return charitable()->get_db_table( $table ); } /** * Returns the current donation form. * * @since 1.0.0 * * @return Charitable_Donation_Form_Interface|false */ function charitable_get_current_donation_form() { $campaign = charitable_get_current_campaign(); return false === $campaign ? false : $campaign->get_donation_form(); } /** * Returns the provided array as a HTML element attribute. * * @since 1.0.0 * * @param array $args Arguments to be added. * @return string */ function charitable_get_action_args( $args ) { return sprintf( "data-charitable-args='%s'", json_encode( $args ) ); } /** * Returns the Charitable_Deprecated class, loading the file if required. * * @since 1.4.0 * * @return Charitable_Deprecated */ function charitable_get_deprecated() { $registry = charitable()->registry(); if ( ! $registry->has( 'deprecated' ) ) { $registry->register_object( Charitable_Deprecated::get_instance() ); } return $registry->get( 'deprecated' ); } /** * Returns if the check (license check or otherwise) determines if the install is "pro". * * @since 1.7.0 * * @return boolean */ function charitable_is_pro() { if ( charitable_get_helper( 'licenses' )->is_pro() ) { return true; } return false; } /** * Returns if Charitable is currently using built-in Stripe Connect * * @since 1.7.0 * * @return boolean */ function charitable_using_stripe_connect() { // the option gets written when the stripe connect in the core plugin (starting in v1.7.0) is connected in gateway settings in the admin. // the option is removed when, after the stripe connect is connected, the user clicks on the "disconnect" link is clicked in the settings. $charitable_stripe_connect = get_option( 'charitable_using_stripe_connect' ); if ( $charitable_stripe_connect ) { return true; } return false; } /** * Returns if should load the core stripe functionality. * * @since 1.7.0 * * @return boolean */ function charitable_load_core_stripe() { if ( false !== ( defined( 'USE_NEW_STRIPE' ) && USE_NEW_STRIPE ) ) { return true; } // check for stripe addon if ( in_array('charitable-stripe/charitable-stripe.php', apply_filters( 'active_plugins', get_option('active_plugins' ) ) ) ) { return false; } if ( class_exists( 'Charitable_Stripe' ) ) { return false; } return true; } /** * Returns if charitable debug should be on for an admin screen, even if the constant isn't defined/false. * * @since 1.7.0.2 * * @return boolean */ function charitable_is_admin_debug() { if ( isset( $_GET['charitable_debug'] ) && 'true' == $_GET['charitable_debug'] ) { return true; } return false; }