Changeset 2329143
- Timestamp:
- 06/23/2020 09:44:16 AM (6 years ago)
- Location:
- recotrust-integration
- Files:
-
- 10 edited
- 3 copied
-
tags/1.0.6 (copied) (copied from recotrust-integration/trunk)
-
tags/1.0.6/ac-reco-plugin.php (modified) (1 diff)
-
tags/1.0.6/assets/javascript/ac-reco-plugin.js (modified) (1 diff)
-
tags/1.0.6/includes/class-ac-reco-widget.php (modified) (1 diff)
-
tags/1.0.6/includes/class-admin-general-options.php (copied) (copied from recotrust-integration/trunk/includes/class-admin-general-options.php) (2 diffs)
-
tags/1.0.6/includes/class-plugin.php (modified) (2 diffs)
-
tags/1.0.6/readme.txt (copied) (copied from recotrust-integration/trunk/readme.txt) (1 diff)
-
trunk/ac-reco-plugin.php (modified) (1 diff)
-
trunk/assets/javascript/ac-reco-plugin.js (modified) (1 diff)
-
trunk/includes/class-ac-reco-widget.php (modified) (1 diff)
-
trunk/includes/class-admin-general-options.php (modified) (2 diffs)
-
trunk/includes/class-plugin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
recotrust-integration/tags/1.0.6/ac-reco-plugin.php
r1976833 r2329143 5 5 Plugin URI: https://www.recotrust.com 6 6 Description: Sends invitation requests to Recotrust and displays Recotrust widgets on ecommerce sites. 7 Version: 1.0. 57 Version: 1.0.6 8 8 Author: Recotrust, Angry Creative, Elias Chalhoub 9 9 Author URI: https://angrycreative.se -
recotrust-integration/tags/1.0.6/assets/javascript/ac-reco-plugin.js
r1887513 r2329143 1 console.log( "Reco trust integration installed on this website.");1 console.log( "Reco trust integration installed on this website." ); -
recotrust-integration/tags/1.0.6/includes/class-ac-reco-widget.php
r1887513 r2329143 89 89 // Badges. 90 90 for ( $i = date( 'Y' );$i >= ( date( 'Y' ) - 5 );$i-- ) { 91 ?>91 ?> 92 92 <!--<p> 93 93 <input id="<?php echo esc_attr( $this->get_field_id( 'badges[' . $i . ']' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'badges[' . $i . ']' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $current['badges'][ $i ] ); ?> /> -
recotrust-integration/tags/1.0.6/includes/class-admin-general-options.php
r2095604 r2329143 24 24 add_action( 'woocommerce_settings_tabs_settings_tab_ac_reco', __CLASS__ . '::settings_tab' ); 25 25 add_action( 'woocommerce_update_options_settings_tab_ac_reco', __CLASS__ . '::update_settings' ); 26 add_action( ' woocommerce_thankyou', __CLASS__ . '::ac_reco_thankyou_page' );26 add_action( 'template_redirect', __CLASS__ . '::ac_reco_thankyou_page' ); 27 27 add_action( 28 'widgets_init', function() { 28 'widgets_init', 29 function() { 29 30 register_widget( 'Ac_Reco_Widget' ); 30 31 } … … 58 59 */ 59 60 public static function ac_reco_thankyou_page( $order_id ) { 60 if ( empty( $order_id ) ) { 61 return; 61 global $wp; 62 if ( is_wc_endpoint_url( 'order-received' ) && ! empty( $wp->query_vars['order-received'] ) ) { 63 $order = wc_get_order( $wp->query_vars['order-received'] ); 64 $address = $order->get_address( 'billing' ); 65 $reco_data = [ 66 'ac_reco_plugin_is_active' => get_option( 'woocommerce_reco_plugin_is_active' ), 67 'ac_reco_plugin_reco_id' => get_option( 'woocommerce_reco_plugin_reco_id' ), 68 'ac_reco_plugin_reco_key' => get_option( 'woocommerce_reco_plugin_api_key' ), 69 'ac_reco_plugin_send_order' => get_option( 'woocommerce_reco_plugin_send_order' ), 70 'ac_reco_plugin_send_interval' => empty( get_option( 'woocommerce_reco_plugin_send_interval' ) ) ? 1 : (int) get_option( 'woocommerce_reco_plugin_send_interval' ), 71 ]; 72 if ( empty( $reco_data['ac_reco_plugin_reco_id'] ) || empty( $reco_data['ac_reco_plugin_reco_key'] ) ) { 73 return; 74 } 75 /* 76 here I am going to send data to Reco's API 77 */ 78 79 $curl = curl_init( 'https://api.reco.se/invite/mail/venue/' . $reco_data['ac_reco_plugin_reco_id'] ); 80 $options = [ 81 'X-Reco-ApiKey: ' . $reco_data['ac_reco_plugin_reco_key'], 82 'Content-Type: application/json', 83 ]; 84 $reco_api_data['invites'][] = (object) [ 85 'email' => $address['email'], 86 'firstName' => $address['first_name'], 87 'lastName' => $address['last_name'], 88 ]; 89 $reco_api_data['scheduled']['sendDateFrom'] = date( 'Y-m-d', strtotime( $order->get_date_completed() . ' + ' . $reco_data['ac_reco_plugin_send_interval'] . ' days ' ) ); 90 $reco_json_data = json_encode( $reco_api_data ); 91 curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'POST' ); 92 curl_setopt( $curl, CURLOPT_HTTPHEADER, $options ); 93 curl_setopt( $curl, CURLOPT_POSTFIELDS, $reco_json_data ); 94 curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); 95 $response = curl_exec( $curl ); 96 curl_close( $curl ); 62 97 } 63 $order = wc_get_order( $order_id );64 $address = $order->get_address( 'billing' );65 $reco_data = [66 'ac_reco_plugin_is_active' => get_option( 'woocommerce_reco_plugin_is_active' ),67 'ac_reco_plugin_reco_id' => get_option( 'woocommerce_reco_plugin_reco_id' ),68 'ac_reco_plugin_reco_key' => get_option( 'woocommerce_reco_plugin_api_key' ),69 'ac_reco_plugin_send_order' => get_option( 'woocommerce_reco_plugin_send_order' ),70 'ac_reco_plugin_send_interval' => empty( get_option( 'woocommerce_reco_plugin_send_interval' ) ) ? 1 : (int) get_option( 'woocommerce_reco_plugin_send_interval' ),71 ];72 if ( empty( $reco_data['ac_reco_plugin_reco_id'] ) || empty( $reco_data['ac_reco_plugin_reco_key'] ) ) {73 return;74 }75 /*76 here I am going to send data to Reco's API77 */78 79 $curl = curl_init( 'https://api.reco.se/invite/mail/venue/' . $reco_data['ac_reco_plugin_reco_id'] );80 $options = [81 'X-Reco-ApiKey: ' . $reco_data['ac_reco_plugin_reco_key'],82 'Content-Type: application/json',83 ];84 $reco_api_data['invites'][] = (object) [85 'email' => $address['email'],86 'firstName' => $address['first_name'],87 'lastName' => $address['last_name'],88 ];89 $reco_api_data['scheduled']['sendDateFrom'] = date( 'Y-m-d', strtotime( $order->order_date . ' + ' . $reco_data['ac_reco_plugin_send_interval'] . ' days ' ) );90 $reco_json_data = json_encode( $reco_api_data );91 curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'POST' );92 curl_setopt( $curl, CURLOPT_HTTPHEADER, $options );93 curl_setopt( $curl, CURLOPT_POSTFIELDS, $reco_json_data );94 curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );95 $response = curl_exec( $curl );96 curl_close( $curl );97 $recipients = [98 '[email protected]',99 ];100 $subject = "[neworder][{$reco_data['ac_reco_plugin_reco_id']}][{$order_id}]";101 $headers = [ 'From: ' . $address['first_name'] . ' ' . $address['last_name'] . ' <' . $address['email'] . '>' ];102 wp_mail( $recipients, $subject, $reco_json_data, $headers );103 104 98 } 105 99 -
recotrust-integration/tags/1.0.6/includes/class-plugin.php
r1976833 r2329143 15 15 * @var string 16 16 */ 17 protected $version = '1.0. 5';17 protected $version = '1.0.6'; 18 18 19 19 /** … … 149 149 150 150 wp_localize_script( 151 $this->plugin_slug . '-script', $namespace, [ 151 $this->plugin_slug . '-script', 152 $namespace, 153 [ 152 154 'awesome' => true, 153 155 ] -
recotrust-integration/tags/1.0.6/readme.txt
r2095604 r2329143 4 4 Requires at least: 4.8 5 5 Requires PHP: 5.6 6 Tested up to: 5. 2.17 Stable tag: 1.0. 56 Tested up to: 5.4.2 7 Stable tag: 1.0.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
recotrust-integration/trunk/ac-reco-plugin.php
r1976833 r2329143 5 5 Plugin URI: https://www.recotrust.com 6 6 Description: Sends invitation requests to Recotrust and displays Recotrust widgets on ecommerce sites. 7 Version: 1.0. 57 Version: 1.0.6 8 8 Author: Recotrust, Angry Creative, Elias Chalhoub 9 9 Author URI: https://angrycreative.se -
recotrust-integration/trunk/assets/javascript/ac-reco-plugin.js
r1887513 r2329143 1 console.log( "Reco trust integration installed on this website.");1 console.log( "Reco trust integration installed on this website." ); -
recotrust-integration/trunk/includes/class-ac-reco-widget.php
r1887513 r2329143 89 89 // Badges. 90 90 for ( $i = date( 'Y' );$i >= ( date( 'Y' ) - 5 );$i-- ) { 91 ?>91 ?> 92 92 <!--<p> 93 93 <input id="<?php echo esc_attr( $this->get_field_id( 'badges[' . $i . ']' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'badges[' . $i . ']' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $current['badges'][ $i ] ); ?> /> -
recotrust-integration/trunk/includes/class-admin-general-options.php
r2095604 r2329143 24 24 add_action( 'woocommerce_settings_tabs_settings_tab_ac_reco', __CLASS__ . '::settings_tab' ); 25 25 add_action( 'woocommerce_update_options_settings_tab_ac_reco', __CLASS__ . '::update_settings' ); 26 add_action( ' woocommerce_thankyou', __CLASS__ . '::ac_reco_thankyou_page' );26 add_action( 'template_redirect', __CLASS__ . '::ac_reco_thankyou_page' ); 27 27 add_action( 28 'widgets_init', function() { 28 'widgets_init', 29 function() { 29 30 register_widget( 'Ac_Reco_Widget' ); 30 31 } … … 58 59 */ 59 60 public static function ac_reco_thankyou_page( $order_id ) { 60 if ( empty( $order_id ) ) { 61 return; 61 global $wp; 62 if ( is_wc_endpoint_url( 'order-received' ) && ! empty( $wp->query_vars['order-received'] ) ) { 63 $order = wc_get_order( $wp->query_vars['order-received'] ); 64 $address = $order->get_address( 'billing' ); 65 $reco_data = [ 66 'ac_reco_plugin_is_active' => get_option( 'woocommerce_reco_plugin_is_active' ), 67 'ac_reco_plugin_reco_id' => get_option( 'woocommerce_reco_plugin_reco_id' ), 68 'ac_reco_plugin_reco_key' => get_option( 'woocommerce_reco_plugin_api_key' ), 69 'ac_reco_plugin_send_order' => get_option( 'woocommerce_reco_plugin_send_order' ), 70 'ac_reco_plugin_send_interval' => empty( get_option( 'woocommerce_reco_plugin_send_interval' ) ) ? 1 : (int) get_option( 'woocommerce_reco_plugin_send_interval' ), 71 ]; 72 if ( empty( $reco_data['ac_reco_plugin_reco_id'] ) || empty( $reco_data['ac_reco_plugin_reco_key'] ) ) { 73 return; 74 } 75 /* 76 here I am going to send data to Reco's API 77 */ 78 79 $curl = curl_init( 'https://api.reco.se/invite/mail/venue/' . $reco_data['ac_reco_plugin_reco_id'] ); 80 $options = [ 81 'X-Reco-ApiKey: ' . $reco_data['ac_reco_plugin_reco_key'], 82 'Content-Type: application/json', 83 ]; 84 $reco_api_data['invites'][] = (object) [ 85 'email' => $address['email'], 86 'firstName' => $address['first_name'], 87 'lastName' => $address['last_name'], 88 ]; 89 $reco_api_data['scheduled']['sendDateFrom'] = date( 'Y-m-d', strtotime( $order->get_date_completed() . ' + ' . $reco_data['ac_reco_plugin_send_interval'] . ' days ' ) ); 90 $reco_json_data = json_encode( $reco_api_data ); 91 curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'POST' ); 92 curl_setopt( $curl, CURLOPT_HTTPHEADER, $options ); 93 curl_setopt( $curl, CURLOPT_POSTFIELDS, $reco_json_data ); 94 curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); 95 $response = curl_exec( $curl ); 96 curl_close( $curl ); 62 97 } 63 $order = wc_get_order( $order_id );64 $address = $order->get_address( 'billing' );65 $reco_data = [66 'ac_reco_plugin_is_active' => get_option( 'woocommerce_reco_plugin_is_active' ),67 'ac_reco_plugin_reco_id' => get_option( 'woocommerce_reco_plugin_reco_id' ),68 'ac_reco_plugin_reco_key' => get_option( 'woocommerce_reco_plugin_api_key' ),69 'ac_reco_plugin_send_order' => get_option( 'woocommerce_reco_plugin_send_order' ),70 'ac_reco_plugin_send_interval' => empty( get_option( 'woocommerce_reco_plugin_send_interval' ) ) ? 1 : (int) get_option( 'woocommerce_reco_plugin_send_interval' ),71 ];72 if ( empty( $reco_data['ac_reco_plugin_reco_id'] ) || empty( $reco_data['ac_reco_plugin_reco_key'] ) ) {73 return;74 }75 /*76 here I am going to send data to Reco's API77 */78 79 $curl = curl_init( 'https://api.reco.se/invite/mail/venue/' . $reco_data['ac_reco_plugin_reco_id'] );80 $options = [81 'X-Reco-ApiKey: ' . $reco_data['ac_reco_plugin_reco_key'],82 'Content-Type: application/json',83 ];84 $reco_api_data['invites'][] = (object) [85 'email' => $address['email'],86 'firstName' => $address['first_name'],87 'lastName' => $address['last_name'],88 ];89 $reco_api_data['scheduled']['sendDateFrom'] = date( 'Y-m-d', strtotime( $order->order_date . ' + ' . $reco_data['ac_reco_plugin_send_interval'] . ' days ' ) );90 $reco_json_data = json_encode( $reco_api_data );91 curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'POST' );92 curl_setopt( $curl, CURLOPT_HTTPHEADER, $options );93 curl_setopt( $curl, CURLOPT_POSTFIELDS, $reco_json_data );94 curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );95 $response = curl_exec( $curl );96 curl_close( $curl );97 $recipients = [98 '[email protected]',99 ];100 $subject = "[neworder][{$reco_data['ac_reco_plugin_reco_id']}][{$order_id}]";101 $headers = [ 'From: ' . $address['first_name'] . ' ' . $address['last_name'] . ' <' . $address['email'] . '>' ];102 wp_mail( $recipients, $subject, $reco_json_data, $headers );103 104 98 } 105 99 -
recotrust-integration/trunk/includes/class-plugin.php
r1976833 r2329143 15 15 * @var string 16 16 */ 17 protected $version = '1.0. 5';17 protected $version = '1.0.6'; 18 18 19 19 /** … … 149 149 150 150 wp_localize_script( 151 $this->plugin_slug . '-script', $namespace, [ 151 $this->plugin_slug . '-script', 152 $namespace, 153 [ 152 154 'awesome' => true, 153 155 ] -
recotrust-integration/trunk/readme.txt
r2095604 r2329143 4 4 Requires at least: 4.8 5 5 Requires PHP: 5.6 6 Tested up to: 5. 2.17 Stable tag: 1.0. 56 Tested up to: 5.4.2 7 Stable tag: 1.0.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.