Plugin Directory

Changeset 3167191


Ignore:
Timestamp:
10/11/2024 01:30:29 PM (18 months ago)
Author:
reportana
Message:

Updating to version 1.3

Location:
reportana
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • reportana/tags/1.3/readme.txt

    r3166911 r3167191  
    55Tested up to: 6.6
    66Requires PHP: 7.2
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7171== Changelog ==
    7272
     73= 1.3 =
     74* Added new features and improvements.
     75
    7376= 1.2 =
    7477* Fixed issue with API Key creation.
  • reportana/tags/1.3/reportana.php

    r3166911 r3167191  
    33Plugin Name: Reportana
    44Description: Reportana is a complete solution for e-commerce and digital businesses that want to increase their sales, optimize communication with their customers and manage their operations efficiently. With our platform, you can automate messages via email, WhatsApp, SMS and phone calls, as well as offer automatic support by creating your own chatbot and monitor the main metrics of your business.
    5 Version: 1.2
     5Version: 1.3
    66Author: Reportana
    77Author URI: https://reportana.com/
     
    241241
    242242                        // Get the shop URL
    243                         $shop_url = get_site_url(); // Retrieves the URL of the WordPress site
     243                        $shop_url = parse_url( get_site_url(), PHP_URL_HOST ); // Retrieves only the domain of the WordPress site
    244244
    245245                        // Make the POST request to the endpoint
     
    380380add_action( 'wp_enqueue_scripts', 'reportana_add_woocommerce_script' );
    381381
    382 // Function to send webhook on new order or order update events
    383 function reportana_send_order_webhook( $order_id ) {
    384     global $wpdb;
    385     $table_name = $wpdb->prefix . 'reportana_settings';
    386 
    387     // Retrieve shop_token from the reportana_settings table
    388     $settings   = $wpdb->get_row( "SELECT shop_token FROM $table_name LIMIT 1" );
    389     $shop_token = $settings ? $settings->shop_token : null;
    390 
    391     if ( $shop_token ) {
    392         // Retrieve order information
    393         $order = wc_get_order( $order_id );
    394         if ( $order ) {
    395             // Get all order data
    396             $order_data = $order->get_data();
    397 
    398             // Webhook URL
    399             $webhook_url = 'https://app.reportana.com/webhooks/woocommerce?token=' . esc_attr( $shop_token );
    400 
    401             // Send the POST request to the webhook with all order data
    402             $response = wp_remote_post( $webhook_url, array(
    403                 'method'  => 'POST',
    404                 'body'    => wp_json_encode( $order_data ),
    405                 'headers' => array(
    406                     'Content-Type' => 'application/json',
    407                 ),
    408             ) );
    409 
    410             // Check if there was an error sending the webhook
    411             if ( is_wp_error( $response ) ) {
    412                 error_log( 'Reportana webhook failed: ' . $response->get_error_message() );
    413             }
    414         }
    415     }
    416 }
    417 
    418 // Register new order hook
    419 add_action( 'woocommerce_new_order', 'reportana_send_order_webhook' );
    420 
    421 // Register order update hook
    422 add_action( 'woocommerce_update_order', 'reportana_send_order_webhook' );
    423 
    424382// Function to save or update abandoned cart
    425383function reportana_save_abandoned_checkout() {
     
    560518        global $wpdb;
    561519
    562         // Verify nonce for Ajax requests
    563         check_ajax_referer( 'reportana_nonce_action', 'security' );
    564 
    565520        // Get the cart identifier from the URL
    566521        $cart_token = sanitize_text_field( wp_unslash( $_GET['cart_token'] ) );
  • reportana/trunk/readme.txt

    r3166911 r3167191  
    55Tested up to: 6.6
    66Requires PHP: 7.2
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7171== Changelog ==
    7272
     73= 1.3 =
     74* Added new features and improvements.
     75
    7376= 1.2 =
    7477* Fixed issue with API Key creation.
  • reportana/trunk/reportana.php

    r3166911 r3167191  
    33Plugin Name: Reportana
    44Description: Reportana is a complete solution for e-commerce and digital businesses that want to increase their sales, optimize communication with their customers and manage their operations efficiently. With our platform, you can automate messages via email, WhatsApp, SMS and phone calls, as well as offer automatic support by creating your own chatbot and monitor the main metrics of your business.
    5 Version: 1.2
     5Version: 1.3
    66Author: Reportana
    77Author URI: https://reportana.com/
     
    241241
    242242                        // Get the shop URL
    243                         $shop_url = get_site_url(); // Retrieves the URL of the WordPress site
     243                        $shop_url = parse_url( get_site_url(), PHP_URL_HOST ); // Retrieves only the domain of the WordPress site
    244244
    245245                        // Make the POST request to the endpoint
     
    380380add_action( 'wp_enqueue_scripts', 'reportana_add_woocommerce_script' );
    381381
    382 // Function to send webhook on new order or order update events
    383 function reportana_send_order_webhook( $order_id ) {
    384     global $wpdb;
    385     $table_name = $wpdb->prefix . 'reportana_settings';
    386 
    387     // Retrieve shop_token from the reportana_settings table
    388     $settings   = $wpdb->get_row( "SELECT shop_token FROM $table_name LIMIT 1" );
    389     $shop_token = $settings ? $settings->shop_token : null;
    390 
    391     if ( $shop_token ) {
    392         // Retrieve order information
    393         $order = wc_get_order( $order_id );
    394         if ( $order ) {
    395             // Get all order data
    396             $order_data = $order->get_data();
    397 
    398             // Webhook URL
    399             $webhook_url = 'https://app.reportana.com/webhooks/woocommerce?token=' . esc_attr( $shop_token );
    400 
    401             // Send the POST request to the webhook with all order data
    402             $response = wp_remote_post( $webhook_url, array(
    403                 'method'  => 'POST',
    404                 'body'    => wp_json_encode( $order_data ),
    405                 'headers' => array(
    406                     'Content-Type' => 'application/json',
    407                 ),
    408             ) );
    409 
    410             // Check if there was an error sending the webhook
    411             if ( is_wp_error( $response ) ) {
    412                 error_log( 'Reportana webhook failed: ' . $response->get_error_message() );
    413             }
    414         }
    415     }
    416 }
    417 
    418 // Register new order hook
    419 add_action( 'woocommerce_new_order', 'reportana_send_order_webhook' );
    420 
    421 // Register order update hook
    422 add_action( 'woocommerce_update_order', 'reportana_send_order_webhook' );
    423 
    424382// Function to save or update abandoned cart
    425383function reportana_save_abandoned_checkout() {
     
    560518        global $wpdb;
    561519
    562         // Verify nonce for Ajax requests
    563         check_ajax_referer( 'reportana_nonce_action', 'security' );
    564 
    565520        // Get the cart identifier from the URL
    566521        $cart_token = sanitize_text_field( wp_unslash( $_GET['cart_token'] ) );
Note: See TracChangeset for help on using the changeset viewer.