コード例 #1
0
if (!defined('SC_DIR_URL')) {
    define('SC_DIR_URL', plugin_dir_url(__FILE__));
}
// Plugin root file
// TODO SIMPAY_PLUGIN_FILE
if (!defined('SC_PLUGIN_FILE')) {
    define('SC_PLUGIN_FILE', __FILE__);
}
// Base URL
// TODO SIMPAY_BASE_URL
if (!defined('SC_WEBSITE_BASE_URL')) {
    define('SC_WEBSITE_BASE_URL', 'https://wpsimplepay.com/');
}
// 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 Pro 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 (and base class before it).
require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-shared.php';
require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro.php';
// Register hook that is fired when the plugin is activated.
register_activation_hook(SC_PLUGIN_FILE, array('Stripe_Checkout_Pro', '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_Pro::get_instance();
コード例 #2
0
        function stripe_checkout_plugin_extensions()
        {
            $required = unserialize(SC_REQUIRES);
            $extensions = '<code>' . implode(', ', $required['ext']) . '</code>';
            echo '<div class="error"><p>' . sprintf(__('WP Simple Pay Pro requires the following PHP extensions to work: %s. Please make sure they are installed or contact your host.', 'sc'), $extensions) . '</p></div>';
        }
        add_action('admin_notices', 'stripe_checkout_plugin_extensions');
    }
    // Halt the rest of the plugin execution if PHP check fails or extensions not found.
    if (isset($stripe_checkout_fails['php']) || isset($stripe_checkout_fails['ext'])) {
        return;
    }
}
// Include main class files.
require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout.php';
require_once SC_DIR_PATH_PRO . 'classes/class-stripe-checkout-pro.php';
// Create a global instance of our main class for this plugin so we can use it throughout all the other classes
global $base_class;
$base_class = Stripe_Checkout_Pro::get_instance();
// Register hook that is fired when the plugin is activated.
register_activation_hook(SC_MAIN_FILE, array('Stripe_Checkout_Pro', 'activate'));
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if (is_plugin_active('stripe-subscriptions/stripe-subscriptions.php')) {
    // Plugin is activated.
    if (false === get_option('sc_sub_initialized')) {
        deactivate_plugins('stripe-subscriptions/stripe-subscriptions.php');
        wp_die(sprintf(__('There was an issue reactivating Stripe Subscriptions, please visit the <a href="%s">plugins page</a> to activate it manually.', 'sc'), get_admin_url('', 'plugins.php')));
    }
}
Stripe_Checkout_Pro::get_instance();