Changed the action hook for Stripe Checkout
This commit is contained in:
parent
20fdf3e3b4
commit
4ab2b76550
1 changed files with 20 additions and 12 deletions
|
|
@ -7,21 +7,29 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function log_to_file($message, $data = false){
|
function log_to_file($message, $data = false){
|
||||||
|
// Only proceed if a message is provided
|
||||||
if ($message) {
|
if ($message) {
|
||||||
$log_File = CUSTOM_DEBUG_LOG;
|
// Check if the custom log file constant is defined
|
||||||
|
if (defined('CUSTOM_DEBUG_LOG') && CUSTOM_DEBUG_LOG) {
|
||||||
|
$log_File = CUSTOM_DEBUG_LOG;
|
||||||
|
|
||||||
$date = new DateTime();
|
$date = new DateTime();
|
||||||
$date = $date->format("Y/m/d h:i:s");
|
$date = $date->format("Y/m/d h:i:s");
|
||||||
|
|
||||||
// Convert arrays and objects to JSON format
|
// Convert arrays and objects to JSON format
|
||||||
if (is_array($data) || is_object($data)) {
|
if (is_array($data) || is_object($data)) {
|
||||||
$data = json_encode($data, JSON_PRETTY_PRINT);
|
$data = json_encode($data, JSON_PRETTY_PRINT);
|
||||||
$message = $message . "\r\n" . $data;
|
$message = $message . "\r\n" . $data;
|
||||||
} else if ($data) {
|
} else if ($data) {
|
||||||
$message = $message . " " . $data;
|
$message = $message . " " . $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the message to the specified file
|
||||||
|
error_log("[$date] " . $message ."\r\n", 3, $log_File);
|
||||||
}
|
}
|
||||||
|
// If CUSTOM_DEBUG_LOG is not defined, do nothing (fail silently)
|
||||||
error_log("[$date] " . $message ."\r\n",3,$log_File);
|
// Alternatively, could log to default PHP error log:
|
||||||
|
// else { error_log("Quiztech Debug: " . $message); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -463,4 +471,4 @@ function quiztech_ajax_save_question() {
|
||||||
}
|
}
|
||||||
add_action( 'wp_ajax_quiztech_save_question', 'quiztech_ajax_save_question' );
|
add_action( 'wp_ajax_quiztech_save_question', 'quiztech_ajax_save_question' );
|
||||||
|
|
||||||
add_action( 'init', 'quiztech_handle_credit_purchase_submission' ); // Hook into init
|
add_action( 'template_redirect', 'quiztech_handle_credit_purchase_submission' ); // Hook into template_redirect
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue