Created
October 9, 2019 20:04
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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