Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alternative loadStripeLibrary() method for the Stripe gateway class in PMPro. Used for debugging.
/**
* Alternative loadStripeLibrary() method that will die and output
* the location of the file that previously loaded a different version
* of the Stripe API library.
*
* THIS CODE IS FOR DEBUGGING PURPOSES ONLY
*
* Find the loadStripeLibrary() method of classes/gateways/class.pmprogateway_stripe.php
* and replace with this version. Then attempt to checkout and take note.
*/
function loadStripeLibrary() {
//load Stripe library if it hasn't been loaded already (usually by another plugin using Stripe)
if ( ! class_exists( "Stripe\Stripe" ) ) {
require_once( PMPRO_DIR . "/includes/lib/Stripe/init.php" );
} else {
$previously_loaded_class = new \ReflectionClass( 'Stripe\Stripe' );
echo "The Stripe API library has already been loaded.<br />";
echo "The file that loaded it may appear here:" . $previously_loaded_class->getFileName();
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.