/**
  * Return an instance of this class.
  *
  * @since     1.0.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function includes()
 {
     parent::includes();
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-licenses.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-shortcode-tracker.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-functions.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-admin.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-system-status.php';
 }
 /**
  * Include required files (admin and frontend).
  */
 public function includes()
 {
     parent::includes();
     // Shortcode tracker not needed in Lite, but IS shared with Subscriptions add-on.
     require_once SC_DIR_PATH_PRO . 'classes/class-mm-shortcode-tracker.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-functions.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-scripts.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-settings-extended.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-shortcodes.php';
     // Admin side
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-admin.php';
     require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro-licenses.php';
 }
示例#4
0
/**
 *  Main function to register all of the plugin settings
 *
 * @since 1.0.0
 */
function sc_register_settings()
{
    global $sc_options;
    $sc_options = array();
    $sc_settings = array('default' => array('note' => array('id' => 'settings_note', 'name' => '', 'desc' => '<a href="' . sc_ga_campaign_url(SC_WEBSITE_BASE_URL . 'docs/shortcodes/stripe-checkout/', 'stripe_checkout', 'settings', 'docs') . '" target="_blank">' . __('See shortcode options and examples', 'sc') . '</a> ' . __('for', 'sc') . ' ' . Stripe_Checkout::get_plugin_title() . '<p class="description">' . __('Shortcode attributes take precedence and will always override site-wide default settings.', 'sc') . '</p>', 'type' => 'section'), 'name' => array('id' => 'name', 'name' => __('Site Name', 'sc'), 'desc' => __('The name of your store or website. Defaults to Site Name.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'currency' => array('id' => 'currency', 'name' => __('Currency Code', 'sc'), 'desc' => __('Specify a currency using it\'s ', 'sc') . sprintf('<a href="%s" target="_blank">%s</a>', 'https://support.stripe.com/questions/which-currencies-does-stripe-support', __('3-letter ISO Code', 'sc')) . '. ' . __('Defaults to USD.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'image_url' => array('id' => 'image_url', 'name' => __('Image URL', 'sc'), 'desc' => __('A URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'checkout_button_label' => array('id' => 'checkout_button_label', 'name' => __('Checkout Button Label', 'sc'), 'desc' => __('The label of the payment button in the checkout form. You can use {{amount}} to display the amount.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'payment_button_label' => array('id' => 'payment_button_label', 'name' => __('Payment Button Label', 'sc'), 'desc' => __('Text to display on the default blue button that users click to initiate a checkout process.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'success_redirect_url' => array('id' => 'success_redirect_url', 'name' => __('Success Redirect URL', 'sc'), 'desc' => __('The URL that the user should be redirected to after a successful payment.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'disable_success_message' => array('id' => 'disable_success_message', 'name' => __('Disable Success Message', 'sc'), 'desc' => __('Disable default success message. Useful if you are redirecting to your own success page.', 'sc'), 'type' => 'checkbox'), 'failure_redirect_url' => array('id' => 'failure_redirect_url', 'name' => __('Failure Redirect URL', 'sc'), 'desc' => __('The URL that the user should be redirected to after a failed payment.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'billing' => array('id' => 'billing', 'name' => __('Enable Billing Address', 'sc'), 'desc' => __('Require the user to enter their billing address during checkout.', 'sc') . (class_exists('Stripe_Checkout_Pro') ? '<br><em>' . __('See below if you also need to require a shipping address.', 'sc') . '</em>' : ''), 'type' => 'checkbox'), 'verify_zip' => array('id' => 'verify_zip', 'name' => __('Verify Zip Code', 'sc'), 'desc' => __('Verifies the zip code of the card.', 'sc'), 'type' => 'checkbox'), 'enable_remember' => array('id' => 'enable_remember', 'name' => __('Enable "Remember Me"', 'sc'), 'desc' => __('Adds a "Remember Me" option to the checkout form to allow the user to store their credit card for future use with other sites using Stripe. ', 'sc') . sprintf('<a href="%s" target="_blank">%s</a>', 'https://stripe.com/checkout/info', __('See how it works', 'sc')) . '.', 'type' => 'checkbox'), 'disable_css' => array('id' => 'disable_css', 'name' => __('Disable Form CSS', 'sc'), 'desc' => __('Disable the plugin from ouputting the default form CSS.', 'sc'), 'type' => 'checkbox'), 'uninstall_save_settings' => array('id' => 'uninstall_save_settings', 'name' => __('Save Settings', 'sc'), 'desc' => __('Save your settings when uninstalling this plugin. Useful when upgrading or re-installing.', 'sc'), 'type' => 'checkbox')), 'keys' => array('enable_live_key' => array('id' => 'enable_live_key', 'name' => __('Test or Live Mode', 'sc'), 'desc' => '<p class="description">' . __('Toggle between using your Test or Live API keys.', 'sc') . '</p>', 'type' => 'toggle_control'), 'test_secret_key' => array('id' => 'test_secret_key', 'name' => __('Test Secret Key', 'sc'), 'desc' => __('Enter your test secret key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'test_publish_key' => array('id' => 'test_publish_key', 'name' => __('Test Publishable Key', 'sc'), 'desc' => __('Enter your test publishable key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'live_secret_key' => array('id' => 'live_secret_key', 'name' => __('Live Secret Key', 'sc'), 'desc' => __('Enter your live secret key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'live_publish_key' => array('id' => 'live_publish_key', 'name' => __('Live Publishable Key', 'sc'), 'desc' => __('Enter your live publishable key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text')));
    $sc_settings = apply_filters('sc_settings', $sc_settings);
    $sc_settings_title = '';
    foreach ($sc_settings as $setting => $option) {
        if (false == get_option('sc_settings_' . $setting)) {
            add_option('sc_settings_' . $setting);
        }
        add_settings_section('sc_settings_' . $setting, apply_filters('sc_settings_' . $setting . '_title', $sc_settings_title), '__return_false', 'sc_settings_' . $setting);
        foreach ($sc_settings[$setting] as $option) {
            add_settings_field('sc_settings_' . $setting . '[' . $option['id'] . ']', $option['name'], function_exists('sc_' . $option['type'] . '_callback') ? 'sc_' . $option['type'] . '_callback' : 'sc_missing_callback', 'sc_settings_' . $setting, 'sc_settings_' . $setting, sc_get_settings_field_args($option, $setting));
        }
        register_setting('sc_settings_' . $setting, 'sc_settings_' . $setting, 'sc_settings_sanitize');
        $sc_options = array_merge($sc_options, is_array(get_option('sc_settings_' . $setting)) ? get_option('sc_settings_' . $setting) : array());
    }
    update_option('sc_settings_master', $sc_options);
}
示例#5
0
 * @wordpress-plugin
 * Plugin Name: Simple Stripe Checkout
 * Plugin URI: http://wpstripe.net
 * Description: Add a Stripe Checkout form overlay to your site in minutes using shortcodes.
 * Version: 1.2.9
 * Author: Phil Derksen
 * Author URI: http://philderksen.com
 * License: GPL-2.0+
 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
 * GitHub Plugin URI: https://github.com/pderksen/WP-Stripe-Checkout
 * Text Domain: sc
 * Domain Path: /languages/
 */
// Exit if accessed directly.
if (!defined('ABSPATH')) {
    exit;
}
if (!defined('SC_MAIN_FILE')) {
    define('SC_MAIN_FILE', __FILE__);
}
if (!defined('SC_PATH')) {
    define('SC_PATH', plugin_dir_path(__FILE__));
}
if (!defined('SC_URL')) {
    define('SC_URL', plugins_url('', __FILE__) . '/');
}
require_once plugin_dir_path(__FILE__) . 'class-stripe-checkout.php';
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
register_activation_hook(__FILE__, array('Stripe_Checkout', 'activate'));
Stripe_Checkout::get_instance();
示例#6
0
}
// Admin notice and stop execution if Pro plugin found.
add_action('plugins_loaded', 'simpay_pro_plugin_check');
function simpay_pro_plugin_check()
{
    if (class_exists('Stripe_Checkout_Pro') || class_exists('Simple_Pay_Pro')) {
        add_action('admin_notices', 'simpay_pro_active_notice');
        return;
    }
}
function simpay_pro_active_notice()
{
    echo '<div class="error"><p>' . __('Simple Pay Lite and Pro cannot be active simultaneously. Please deactivate one of them to proceed.', 'stripe') . '</p></div>';
}
// Plugin requirements class.
require_once 'classes/wp-requirements.php';
// Check plugin requirements before loading plugin.
$this_plugin_checks = new SimPay_WP_Requirements('WP Simple Pay Lite for Stripe', plugin_basename(__FILE__), array('PHP' => '5.3.3', 'WordPress' => '4.2', 'Extensions' => array('curl', 'json', 'mbstring')));
if ($this_plugin_checks->pass() === false) {
    $this_plugin_checks->halt();
    return;
}
// Load the plugin main class.
require_once SC_DIR_PATH . 'classes/class-stripe-checkout-shared.php';
// Register hook that is fired when the plugin is activated.
register_activation_hook(SC_PLUGIN_FILE, array('Stripe_Checkout', 'activate'));
// Create a global instance of our main class for this plugin so we can use it throughout all the other classes.
global $base_class;
// Let's get going finally!
$base_class = Stripe_Checkout::get_instance();
示例#7
0
/**
 * Disables opengraph tags to avoid conflicts with WP SEO by Yoast
 *
 * @since 1.2.0
 */
function sc_disable_seo_og()
{
    $sc_payment_details = Stripe_Checkout::get_instance()->session->get('sc_payment_details');
    if ($sc_payment_details['show'] == true) {
        remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
    }
}
示例#8
0
}
?>

<!-- Use some built-in WP admin theme styles. -->

<div class="sidebar-container metabox-holder">
	<div class="postbox">
		<h3 class="wp-ui-primary"><span><?php 
_e('Need More Options?', 'stripe');
?>
</span></h3>
		<div class="inside">
			<div class="main">
				<p class="last-blurb centered">
					<?php 
printf(__("Additional perks you'll get with %s", 'stripe'), Stripe_Checkout::get_pro_plugin_title());
?>
				</p>

				<ul>
					<li><div class="dashicons dashicons-yes"></div> <?php 
_e('Let customers enter an amount', 'stripe');
?>
</li>
					<li><div class="dashicons dashicons-yes"></div> <?php 
_e('Collect data with custom fields', 'stripe');
?>
</li>
					<li><div class="dashicons dashicons-yes"></div> <?php 
_e('Offer discounts with coupon codes', 'stripe');
?>
<?php

/**
 * Show admin license key notice if Lite or the old legacy plugins are detected.
 */
// Exit if accessed directly.
if (!defined('ABSPATH')) {
    exit;
}
?>

<style>
	#sc-lite-legacy-notice .button-primary,
	#sc-lite-legacy-notice .button-secondary {
		margin: 2px 0;
	}
</style>

<div id="sc-lite-legacy-notice" class="error">
	<p>
		<?php 
// Check for empty key first.
echo '<strong>' . sprintf(__('Notice: You have %1$s or a legacy add-on installed. Please deactivate the plugin(s) to avoid conflicts with %2$s.', 'sc'), Stripe_Checkout::get_plugin_title(), Stripe_Checkout_Pro::get_plugin_title()) . '</strong>' . "\n";
?>
	</p>
</div>