Skip to content

Instantly share code, notes, and snippets.

@tribulant
Created May 7, 2015 20:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tribulant/eb07dd559a141701a00b to your computer and use it in GitHub Desktop.
Save tribulant/eb07dd559a141701a00b to your computer and use it in GitHub Desktop.
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 1
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 1
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
function gateway_activation_hook() {
require_once ABSPATH . 'wp-admin' . DS . 'admin-functions.php';
$path = 'wp-checkout' . DS . 'wp-checkout.php';
if (!is_plugin_active(plugin_basename($path))) {
_e('You must have the Shopping Cart plugin installed and activated in order to use this.', "checkout-gateway");
exit(); die();
} else {
$required = "X.X";
$plugin_data = get_plugin_data(WP_CONTENT_DIR . DS . 'plugins' . DS . $path);
$plugin_version = $plugin_data['Version'];
$versiongood = false;
if (version_compare($plugin_version, $required) >= 0) {
$versiongood = true;
}
if ($versiongood == true) {
add_option('wpcogateway_title', __('Credit and debit card payments with Gateway', "checkout-gateway"));
} else {
echo '<span style="font-family:sans-serif;">' . sprintf(__('The Gateway extension requires the Shopping Cart plugin v%s at least.', "checkout-gateway"), $required) . '</span>';
exit(); die();
}
}
return true;
}
register_activation_hook(__FILE__, 'gateway_activation_hook');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment