/**
  * Returns and/or create the single instance of this class.  
  *
  * @return  Charitable_Gateways
  * @access  public
  * @since   1.2.0
  */
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Charitable_Gateways();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
<?php

/**
 * Display the Welcome page. 
 *
 * @author  Studio 164a
 * @package Charitable/Admin View/Welcome Page
 * @since   1.0.0
 */
wp_enqueue_style('charitable-admin-pages');
$gateways = Charitable_Gateways::get_instance()->get_active_gateways_names();
$campaigns = wp_count_posts('campaign');
$campaigns_count = $campaigns->publish + $campaigns->draft + $campaigns->future + $campaigns->pending + $campaigns->private;
$emails = charitable_get_helper('emails')->get_enabled_emails_names();
$install = isset($_GET['install']) && $_GET['install'];
?>
<div class="wrap about-wrap charitable-wrap">
    <h1>
        <strong>Charitable</strong>
        <sup class="version"><?php 
echo charitable()->get_version();
?>
</sup>
    </h1>
    <div class="badge">
        <a href="https://www.wpcharitable.com/?utm_source=welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=home&amp;utm_content=icon" target="_blank"><i class="icon-charitable"></i></a>
    </div>
    <div class="intro">
        <?php 
if ($install) {
    _e('Thank you for installing Charitable!', 'charitable');
Exemplo n.º 3
0
/**
 * The template used to display the default form.
 *
 * @author  Studio 164a
 * @package Charitable/Templates/Donation Form
 * @since   1.0.0
 * @version 1.3.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$form = $view_args['form'];
$user_fields = $form->get_user_fields();
$user = wp_get_current_user();
$use_ajax = 'make_donation' == $form->get_form_action() && (int) Charitable_Gateways::get_instance()->gateways_support_ajax();
$form_id = isset($view_args['form_id']) ? $view_args['form_id'] : 'charitable-donation-form';
if (!$form) {
    return;
}
?>
<form method="post" id="<?php 
echo esc_attr($form_id);
?>
" class="charitable-donation-form charitable-form" data-use-ajax="<?php 
echo esc_attr($use_ajax);
?>
">
	<?php 
/**
 * @hook    charitable_form_before_fields
 /**
  * Checks whether the submitted gateway is valid.
  *
  * @return  boolean
  * @access  public
  * @since   1.4.6
  */
 public function validate_gateway()
 {
     $ret = true;
     /* Validate the gateway. */
     if (!Charitable_Gateways::get_instance()->is_valid_gateway($_POST['gateway'])) {
         charitable_get_notices()->add_error(__('The gateway submitted is not valid.', 'charitable'));
         $ret = false;
     }
     return apply_filters('charitable_validate_donation_form_submission_gateway_check', $ret, $this);
 }
 /**
  * Checks whether the given gateway has been updated for compatibility with 1.3.
  *
  * @param   string $gateway
  * @return  boolean
  * @access  private
  * @since   1.3.0
  */
 private function gateway_is_130_compatible($gateway)
 {
     return Charitable_Gateways::get_instance()->get_gateway_object($gateway)->supports('1.3.0');
 }
 /**
  * Enqueues the donation form scripts.
  *
  * @return  void
  * @access  public
  * @since   1.4.6
  */
 public function enqueue_donation_form_scripts()
 {
     wp_enqueue_script('charitable-script');
     if (Charitable_Gateways::get_instance()->any_gateway_supports('credit-card')) {
         wp_enqueue_script('charitable-credit-card');
     }
 }
Exemplo n.º 7
0
 /**
  * Include necessary files.
  *
  * @return  void
  * @access  private
  * @since   1.0.0
  */
 private function load_dependencies()
 {
     $includes_path = $this->get_path('includes');
     /* Abstracts */
     require_once $includes_path . 'abstracts/class-charitable-form.php';
     require_once $includes_path . 'abstracts/class-charitable-query.php';
     require_once $includes_path . 'abstracts/class-charitable-start-object.php';
     /* Functions & Core Classes */
     require_once $includes_path . 'charitable-core-functions.php';
     require_once $includes_path . 'charitable-utility-functions.php';
     require_once $includes_path . 'class-charitable-locations.php';
     require_once $includes_path . 'class-charitable-notices.php';
     require_once $includes_path . 'class-charitable-post-types.php';
     require_once $includes_path . 'class-charitable-request.php';
     require_once $includes_path . 'class-charitable-cron.php';
     require_once $includes_path . 'class-charitable-i18n.php';
     /* Addons */
     require_once $includes_path . 'addons/class-charitable-addons.php';
     /* Campaigns */
     require_once $includes_path . 'campaigns/charitable-campaign-functions.php';
     require_once $includes_path . 'campaigns/class-charitable-campaign.php';
     require_once $includes_path . 'campaigns/class-charitable-campaigns.php';
     require_once $includes_path . 'campaigns/charitable-campaign-hooks.php';
     /* Currency */
     require_once $includes_path . 'currency/charitable-currency-functions.php';
     require_once $includes_path . 'currency/class-charitable-currency.php';
     /* Donations */
     require_once $includes_path . 'donations/abstract-charitable-donation.php';
     require_once $includes_path . 'donations/interface-charitable-donation-form.php';
     require_once $includes_path . 'donations/class-charitable-donation-processor.php';
     require_once $includes_path . 'donations/class-charitable-donation.php';
     require_once $includes_path . 'donations/class-charitable-donation-factory.php';
     require_once $includes_path . 'donations/class-charitable-donations.php';
     require_once $includes_path . 'donations/class-charitable-donations-query.php';
     require_once $includes_path . 'donations/class-charitable-donation-form.php';
     require_once $includes_path . 'donations/class-charitable-donation-amount-form.php';
     require_once $includes_path . 'donations/charitable-donation-hooks.php';
     require_once $includes_path . 'donations/charitable-donation-functions.php';
     /* Users */
     require_once $includes_path . 'users/charitable-user-functions.php';
     require_once $includes_path . 'users/class-charitable-user.php';
     require_once $includes_path . 'users/class-charitable-roles.php';
     require_once $includes_path . 'users/class-charitable-donor.php';
     require_once $includes_path . 'users/class-charitable-donor-query.php';
     /* Gateways */
     require_once $includes_path . 'gateways/interface-charitable-gateway.php';
     require_once $includes_path . 'gateways/class-charitable-gateways.php';
     require_once $includes_path . 'gateways/abstract-class-charitable-gateway.php';
     require_once $includes_path . 'gateways/class-charitable-gateway-offline.php';
     require_once $includes_path . 'gateways/class-charitable-gateway-paypal.php';
     /* Emails */
     require_once $includes_path . 'emails/interface-charitable-email.php';
     require_once $includes_path . 'emails/class-charitable-emails.php';
     require_once $includes_path . 'emails/abstract-class-charitable-email.php';
     require_once $includes_path . 'emails/class-charitable-email-new-donation.php';
     require_once $includes_path . 'emails/class-charitable-email-donation-receipt.php';
     require_once $includes_path . 'emails/class-charitable-email-campaign-end.php';
     require_once $includes_path . 'emails/class-charitable-email-password-reset.php';
     require_once $includes_path . 'emails/charitable-email-hooks.php';
     /* Database */
     require_once $includes_path . 'db/abstract-class-charitable-db.php';
     require_once $includes_path . 'db/class-charitable-campaign-donations-db.php';
     require_once $includes_path . 'db/class-charitable-donors-db.php';
     /* Licensing */
     require_once $includes_path . 'licensing/class-charitable-licenses.php';
     require_once $includes_path . 'licensing/class-charitable-plugin-updater.php';
     /* Public */
     require_once $includes_path . 'public/charitable-page-functions.php';
     require_once $includes_path . 'public/charitable-template-helpers.php';
     require_once $includes_path . 'public/class-charitable-session.php';
     require_once $includes_path . 'public/class-charitable-template.php';
     require_once $includes_path . 'public/class-charitable-template-part.php';
     require_once $includes_path . 'public/class-charitable-templates.php';
     require_once $includes_path . 'public/class-charitable-ghost-page.php';
     require_once $includes_path . 'public/class-charitable-user-dashboard.php';
     /* Shortcodes */
     require_once $includes_path . 'shortcodes/class-charitable-campaigns-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-my-donations-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-donation-receipt-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-login-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-registration-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-profile-shortcode.php';
     require_once $includes_path . 'shortcodes/charitable-shortcodes-hooks.php';
     /* Widgets */
     require_once $includes_path . 'widgets/class-charitable-widgets.php';
     require_once $includes_path . 'widgets/class-charitable-campaign-terms-widget.php';
     require_once $includes_path . 'widgets/class-charitable-campaigns-widget.php';
     require_once $includes_path . 'widgets/class-charitable-donors-widget.php';
     require_once $includes_path . 'widgets/class-charitable-donate-widget.php';
     require_once $includes_path . 'widgets/class-charitable-donation-stats-widget.php';
     /* User Management */
     require_once $includes_path . 'user-management/class-charitable-registration-form.php';
     require_once $includes_path . 'user-management/class-charitable-profile-form.php';
     require_once $includes_path . 'user-management/class-charitable-forgot-password-form.php';
     require_once $includes_path . 'user-management/class-charitable-reset-password-form.php';
     require_once $includes_path . 'user-management/class-charitable-user-management.php';
     require_once $includes_path . 'user-management/charitable-user-management-hooks.php';
     /* Customizer */
     require_once $includes_path . 'admin/customizer/class-charitable-customizer.php';
     /* Deprecated */
     require_once $includes_path . 'deprecated/charitable-deprecated-functions.php';
     /**
      * We are registering this object only for backwards compatibility. It
      * will be removed in or after Charitable 1.3.
      *
      * @deprecated
      */
     $this->register_object(Charitable_Emails::get_instance());
     $this->register_object(Charitable_Request::get_instance());
     $this->register_object(Charitable_Gateways::get_instance());
     $this->register_object(Charitable_i18n::get_instance());
     $this->register_object(Charitable_Post_Types::get_instance());
     $this->register_object(Charitable_Cron::get_instance());
     $this->register_object(Charitable_Widgets::get_instance());
     $this->register_object(Charitable_Licenses::get_instance());
     $this->register_object(Charitable_User_Dashboard::get_instance());
 }
 /**
  * Add version update notices to the dashboard.
  *
  * @return  void
  * @access  public
  * @since   1.4.6
  */
 public function add_version_update_notices()
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     $notices = array();
     $notices['release-140'] = sprintf(__("Thanks for upgrading to Charitable 1.4. <a href='%s'>Find out what's new in this release</a>.", 'charitable'), 'https://www.wpcharitable.com/charitable-1-4-features-responsive-campaign-grids-a-new-shortcode?utm_source=notice&utm_medium=wordpress-dashboard&utm_campaign=release-notes&utm_content=release-140');
     $notices['release-142'] = sprintf(__("In Charitable 1.4.2, we have improved the login and registration forms. <a href='%s'>Find out how</a>.", 'charitable'), 'https://www.wpcharitable.com/how-we-improved-logins-and-registrations-in-charitable/?utm_source=notice&utm_medium=wordpress-dashboard&utm_campaign=release-notes&utm_content=release-142');
     if (Charitable_Gateways::get_instance()->is_active_gateway('paypal')) {
         $notices['release-143-paypal'] = sprintf(__("PayPal is upgrading its SSL certificates. <a href='%s'>Test your integration now to avoid disruption.</a>", 'charitable'), esc_url(add_query_arg(array('page' => 'charitable-settings', 'tab' => 'gateways', 'group' => 'gateways_paypal'), admin_url('admin.php#paypal-sandbox-test'))));
     } else {
         delete_transient('charitable_release-143-paypal_notice');
     }
     $helper = charitable_get_admin_notices();
     foreach ($notices as $notice => $message) {
         if (!get_transient('charitable_' . $notice . '_notice')) {
             continue;
         }
         $helper->add_version_update($message, $notice);
     }
 }