Skip to content

Instantly share code, notes, and snippets.

@ideadude
Created October 9, 2019 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideadude/0d58176d8ad0084fd22133780ebbb0e6 to your computer and use it in GitHub Desktop.
Save ideadude/0d58176d8ad0084fd22133780ebbb0e6 to your computer and use it in GitHub Desktop.
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