function wpc_handle_paypal_ipn() { $debug_log = "ipn_handle_debug.log"; // Debug log file name $ipn_handler_instance = new paypal_ipn_handler(); $debug_enabled = false; $debug = get_option('wp_shopping_cart_enable_debug'); if ($debug) { $debug_enabled = true; } if ($debug_enabled) { echo 'Debug is enabled. Check the ' . $debug_log . ' file for debug output.'; $ipn_handler_instance->ipn_log = true; //$ipn_handler_instance->ipn_log_file = realpath(dirname(__FILE__)).'/'.$debug_log; } $sandbox = get_option('wp_shopping_cart_enable_sandbox'); if ($sandbox) { $ipn_handler_instance->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $ipn_handler_instance->sandbox_mode = true; } $ipn_handler_instance->debug_log('Paypal Class Initiated by ' . $_SERVER['REMOTE_ADDR'], true); // Validate the IPN if ($ipn_handler_instance->validate_ipn()) { $ipn_handler_instance->debug_log('Creating product Information to send.', true); if (!$ipn_handler_instance->validate_and_dispatch_product()) { $ipn_handler_instance->debug_log('IPN product validation failed.', false); } } $ipn_handler_instance->debug_log('Paypal class finished.', true, true); }
$text .= "\n------------------------------------------------------------------\n\n"; } // Write to log $fp = fopen($this->ipn_log_file, 'a'); fwrite($fp, $text); fclose($fp); } } // Start of IPN handling (script execution) $ipn_handler_instance = new paypal_ipn_handler(); $debug_enabled = get_option('eStore_cart_enable_debug'); if ($debug_enabled) { echo 'Debug is enabled. Check the ipn_handle_debug.log file for debug output.'; $ipn_handler_instance->ipn_log = true; if (empty($_POST)) { $ipn_handler_instance->debug_log('This debug line was generated because you entered the URL of the ipn handling script in the browser.', true, true); exit; } } $sandbox = get_option('eStore_cart_enable_sandbox'); if ($sandbox) { $ipn_handler_instance->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $ipn_handler_instance->sandbox_mode = true; } $ipn_handler_instance->debug_log('Paypal Class Initiated by ' . $_SERVER['REMOTE_ADDR'] . ' eStore Version: ' . WP_ESTORE_VERSION, true); if ($ipn_handler_instance->validate_ipn()) { $ipn_handler_instance->debug_log('Creating product Information to send.', true); if (!$ipn_handler_instance->validate_and_dispatch_product()) { $ipn_handler_instance->debug_log('IPN product validation failed.', false); $to_address = get_option('eStore_notify_email_address'); $subject = "WP eStore - Payment Verification Failed!";