Changeset 3485383
- Timestamp:
- 03/18/2026 08:25:33 AM (3 weeks ago)
- Location:
- coinsnap-for-contact-form-7
- Files:
-
- 63 added
- 3 edited
-
tags/1.5.1 (added)
-
tags/1.5.1/assets (added)
-
tags/1.5.1/assets/css (added)
-
tags/1.5.1/assets/css/coinsnapcf7-backend-style.css (added)
-
tags/1.5.1/assets/css/index.php (added)
-
tags/1.5.1/assets/index.php (added)
-
tags/1.5.1/assets/js (added)
-
tags/1.5.1/assets/js/adminFields.js (added)
-
tags/1.5.1/assets/js/connectionCheck.js (added)
-
tags/1.5.1/assets/js/index.php (added)
-
tags/1.5.1/coinsnap-for-contact-form-7.php (added)
-
tags/1.5.1/coinsnapcf7-class.php (added)
-
tags/1.5.1/index.php (added)
-
tags/1.5.1/languages (added)
-
tags/1.5.1/languages/index.php (added)
-
tags/1.5.1/library (added)
-
tags/1.5.1/library/Client (added)
-
tags/1.5.1/library/Client/AbstractClient.php (added)
-
tags/1.5.1/library/Client/BTCPayApiAuthorization.php (added)
-
tags/1.5.1/library/Client/BTCPayApiKey.php (added)
-
tags/1.5.1/library/Client/Invoice.php (added)
-
tags/1.5.1/library/Client/InvoiceCheckoutOptions.php (added)
-
tags/1.5.1/library/Client/Server.php (added)
-
tags/1.5.1/library/Client/Store.php (added)
-
tags/1.5.1/library/Client/User.php (added)
-
tags/1.5.1/library/Client/Webhook.php (added)
-
tags/1.5.1/library/Client/index.php (added)
-
tags/1.5.1/library/Exception (added)
-
tags/1.5.1/library/Exception/BadRequestException.php (added)
-
tags/1.5.1/library/Exception/CSException.php (added)
-
tags/1.5.1/library/Exception/ConnectException.php (added)
-
tags/1.5.1/library/Exception/ForbiddenException.php (added)
-
tags/1.5.1/library/Exception/RequestException.php (added)
-
tags/1.5.1/library/Exception/index.php (added)
-
tags/1.5.1/library/Http (added)
-
tags/1.5.1/library/Http/ClientInterface.php (added)
-
tags/1.5.1/library/Http/Response.php (added)
-
tags/1.5.1/library/Http/ResponseInterface.php (added)
-
tags/1.5.1/library/Http/WPRemoteClient.php (added)
-
tags/1.5.1/library/Http/index.php (added)
-
tags/1.5.1/library/Result (added)
-
tags/1.5.1/library/Result/AbstractResult.php (added)
-
tags/1.5.1/library/Result/ApiKey.php (added)
-
tags/1.5.1/library/Result/Invoice.php (added)
-
tags/1.5.1/library/Result/InvoiceCheckoutHTML.php (added)
-
tags/1.5.1/library/Result/InvoiceList.php (added)
-
tags/1.5.1/library/Result/InvoicePayment.php (added)
-
tags/1.5.1/library/Result/InvoicePaymentMethod.php (added)
-
tags/1.5.1/library/Result/ServerInfo.php (added)
-
tags/1.5.1/library/Result/Store.php (added)
-
tags/1.5.1/library/Result/User.php (added)
-
tags/1.5.1/library/Result/Webhook.php (added)
-
tags/1.5.1/library/Result/WebhookAuthorizedEvents.php (added)
-
tags/1.5.1/library/Result/WebhookCreated.php (added)
-
tags/1.5.1/library/Result/index.php (added)
-
tags/1.5.1/library/Util (added)
-
tags/1.5.1/library/Util/Notice.php (added)
-
tags/1.5.1/library/Util/PreciseNumber.php (added)
-
tags/1.5.1/library/Util/index.php (added)
-
tags/1.5.1/library/index.php (added)
-
tags/1.5.1/library/loader.php (added)
-
tags/1.5.1/license.txt (added)
-
tags/1.5.1/readme.txt (added)
-
trunk/coinsnap-for-contact-form-7.php (modified) (3 diffs)
-
trunk/coinsnapcf7-class.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coinsnap-for-contact-form-7/trunk/coinsnap-for-contact-form-7.php
r3485057 r3485383 4 4 * Plugin URI: https://coinsnap.io/wp-add-ons/contact-form-7/ 5 5 * Description: With this Bitcoin payment plugin for Contact Form 7 you can now offer products, downloads, bookings or get donations in Bitcoin right in your forms! 6 * Version: 1.5. 06 * Version: 1.5.1 7 7 * Author: Coinsnap 8 8 * Author URI: https://coinsnap.io/ … … 23 23 24 24 if(!defined('COINSNAPCF7_REFERRAL_CODE' )){define( 'COINSNAPCF7_REFERRAL_CODE', 'D19827' );} 25 if(!defined('COINSNAPCF7_VERSION' )){define( 'COINSNAPCF7_VERSION', '1.5. 0' );}25 if(!defined('COINSNAPCF7_VERSION' )){define( 'COINSNAPCF7_VERSION', '1.5.1' );} 26 26 if(!defined('COINSNAP_SERVER_URL')){define( 'COINSNAP_SERVER_URL', 'https://app.coinsnap.io' );} 27 27 if(!defined('COINSNAP_API_PATH')){define( 'COINSNAP_API_PATH', '/api/v1/');} … … 61 61 `status` varchar(20) NOT NULL DEFAULT 'Pending', 62 62 `message` TEXT NOT NULL, 63 `form_sent` INT(11) NOT NULL DEFAULT 0, 63 64 PRIMARY KEY (`id`) 64 65 ) DEFAULT COLLATE=utf8_general_ci"; -
coinsnap-for-contact-form-7/trunk/coinsnapcf7-class.php
r3485057 r3485383 833 833 $invoice_no = $wpdb->insert_id; 834 834 835 836 837 //print_r($uploaded_files);838 //exit();839 840 841 835 if(is_array($uploaded_files) && count($uploaded_files) > 0 && $paymentFirst){ 842 836 $upload_dir = wp_upload_dir(); … … 846 840 foreach ($uploaded_files as $field => $path) { 847 841 848 if (! file_exists($path[0])){ continue; }842 if (!isset($path[0]) || !file_exists($path[0])){ continue; } 849 843 $new_path = $dir . '/' . basename($path[0]); 850 844 copy($path[0], $new_path); … … 1016 1010 unset( $payment_res['qrCodes'] ); 1017 1011 unset( $payment_res['lightningInvoice'] ); 1012 1018 1013 $table_name = $this->get_tablename(); 1019 1014 1015 $wpdb->update( $table_name, 1016 [ 1017 'payment_details' => wp_json_encode( $payment_res, true ), 1018 'status' => $status 1019 ], array( 'id' => $order_id ), array( '%s', '%s' ), array( '%d' )); 1020 1020 1021 $paymentFirst = get_post_meta( $form_id, "_cf7_coinsnap_paymentfirst", true ); 1021 1022 1022 //$message = 'Test '. gmdate('Y-m-d H:i:s',time()) .': '; 1023 1024 if($status === 'Settled' && $paymentFirst > 0){ 1023 if($paymentFirst > 0 && $status === 'Settled'){ 1025 1024 1026 1025 $order_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM %i WHERE id=%d", $table_name, $order_id ), ARRAY_A ); 1027 $currentStatus = $order_data['status']; 1028 1029 if($currentStatus !== 'Settled'){ 1030 1031 $contact_form = WPCF7_ContactForm::get_instance($form_id); 1032 $body = json_decode($order_data['field_values'],true); 1033 1034 $mail = $contact_form->prop('mail'); 1035 1036 foreach($body as $bkey => $bvalue){ 1037 $mail['body'] = str_replace("[".$bkey."]", $bvalue, $mail['body']); 1038 $mail['subject'] = str_replace("[".$bkey."]", $bvalue, $mail['subject']); 1039 $mail['sender'] = str_replace("[".$bkey."]", $bvalue, $mail['sender']); 1040 $mail['recipient'] = str_replace("[".$bkey."]", $bvalue, $mail['recipient']); 1041 $mail['additional_headers'] = str_replace("[".$bkey."]", $bvalue, $mail['additional_headers']); 1042 } 1043 1044 $files_array = json_decode($order_data['files'],true); 1045 1046 if(count($files_array) > 0){ 1047 $attachments = array(); 1048 foreach($files_array as $_file){ 1049 $attachments[] = $_file; 1050 } 1051 $mail['attachments'] = implode("\n", $attachments); 1052 } 1053 1054 //$message .= ' --------------------------------------- '. print_r($mail,true); 1055 1056 // Run submission 1057 $result = WPCF7_Mail::send($mail,'mail'); 1058 1059 //$message .= ' --------------------------------------- '. print_r($result,true); 1060 } 1061 } 1062 1063 $wpdb->update( $table_name, array( 1064 'payment_details' => wp_json_encode( $payment_res, true ), 1065 'status' => $status, 1066 //'message' => $message 1067 ), 1068 array( 'id' => $order_id ), array( '%s', '%s' ), array( '%d' ) 1069 ); 1026 1027 $mail_send_result = $this->cf7_mail_send($form_id,$order_data); 1028 $update_array = [ 1029 'message' => $mail_send_result['message'], 1030 'form_sent' => ($mail_send_result['result'] > 0)? 1 : 0 1031 ]; 1032 $wpdb->update( $table_name, $update_array, array( 'id' => $order_id ), array( '%s', '%s' ), array( '%d' )); 1033 } 1070 1034 1071 1035 echo "OK"; … … 1081 1045 wp_die('Internal server error', '', ['response' => 500]); 1082 1046 } 1047 } 1048 1049 public function cf7_mail_send($form_id,$order_data){ 1050 1051 $contact_form = WPCF7_ContactForm::get_instance($form_id); 1052 $mail = $contact_form->prop('mail'); 1053 1054 // Sent values 1055 $body = json_decode($order_data['field_values'],true); 1056 1057 // Template with sent values replace 1058 foreach($body as $bkey => $bvalue){ 1059 $mail['body'] = str_replace("[".$bkey."]", $bvalue, $mail['body']); 1060 $mail['subject'] = str_replace("[".$bkey."]", $bvalue, $mail['subject']); 1061 $mail['sender'] = str_replace("[".$bkey."]", $bvalue, $mail['sender']); 1062 $mail['recipient'] = str_replace("[".$bkey."]", $bvalue, $mail['recipient']); 1063 $mail['additional_headers'] = str_replace("[".$bkey."]", $bvalue, $mail['additional_headers']); 1064 } 1065 1066 // Sent files 1067 $files_array = json_decode($order_data['files'],true); 1068 1069 if(count($files_array) > 0){ 1070 $attachments = array(); 1071 foreach($files_array as $_file){ $attachments[] = $_file; } 1072 $mail['attachments'] = implode("\n", $attachments); 1073 } 1074 1075 // Submission message 1076 $message = 'Submission after payment '. gmdate('Y-m-d H:i:s',time()).' --------------------------------------- '. wp_json_encode($mail,true); 1077 1078 // Run submission 1079 $result = WPCF7_Mail::send($mail,'mail'); 1080 $result_array = array('result' => $result,'message' => $message); 1081 1082 return $result_array; 1083 1083 } 1084 1084 -
coinsnap-for-contact-form-7/trunk/readme.txt
r3485057 r3485383 3 3 Tags: Coinsnap, Contact Form 7, Bitcoin, Lightning 4 4 Tested up to: 6.9 5 Stable tag: 1.5. 05 Stable tag: 1.5.1 6 6 License: GPLv2 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 232 232 * Updated plugin description. 233 233 234 235 234 = 1.5.1 :: 2026-03-18 = 235 * Update: added form submission after payment status in payments table 236 237
Note: See TracChangeset
for help on using the changeset viewer.