Plugin Directory

Changeset 2442010


Ignore:
Timestamp:
12/18/2020 05:44:06 AM (5 years ago)
Author:
wpconcierges
Message:

updating to ver 1.0.3

Location:
order-postback-woo/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • order-postback-woo/trunk/README.txt

    r2438116 r2442010  
    55Requires at least: 3.1
    66Tested up to: 5.6
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88Requires PHP: 5.6 or above
    99License: GPLv2 or later
     
    1717This plugin is great if you need to send data to a third party, such as an affiliate network without having to place the pixels on your thank you page.
    1818
    19 Great for server 2 server post back pixel firing, or breaking up the image url from the affiliate pixel image.  The free version will fire on every order
    20 the pro version you can control when the pixel sends its postback.
     19Great for server 2 server post back pixel firing, or breaking up the image url from the affiliate pixel image.  You can choose to send the order information only when the clickid exists or send the data on every order.
     20You can set the incoming and outgoing clickid on the free version for your order postback.
     21
     22Works with most affiliate networks:
     23Maxbounty
     24Rakuten
     25CJ
     26Pepperjam
     27Clickbooth
     28TrafficRoots
     29Commissionsoup
     30HasOffers
     31Clixgalore
     32Miva
     33AdStage
     34Nativo
     35Outbrain
     36Taboola
     37Anynetwork that supports image or server 2 server postback calls.
     38
    2139
    2240If you need to post/get more than 1 url check out the Pro version.   
     
    26441.)  Allows you to post/get to any number or URLs.
    2745
    28 2.) Configure an incoming and outgoing click id per url.
     462.) Will send order data on order status change to pending to processing.  Great for subscription orders that need to be sent to a third party script
    2947
    30483.) Sets a Cookie for all incoming querystring variables that can be used in the postback url parameters on firing.
     
    6280
    6381== Changelog ==
     82= 1.0.3 =
     83added can fire when clickid is set for affiliate networks
     84added incoming and outgoing clickid fields
     85
    6486= 1.0.2 =
    6587complete rewrite no uses a custom post and not the admin options
  • order-postback-woo/trunk/admin/class-order-postback-woo-admin.php

    r2438086 r2442010  
    381381        $datas = $_POST['form_data'];
    382382        $pure_datas = $datas;
    383         $fields = array('opw_name','opw_url','opw_method','opw_fire','opw_incoming_click_id','opw_outgoing_click_id','opw_outgoing_retarget','opw_key_values_number','opw_key_values_number_old','opw_link_id','opw_headers');
     383        $fields = array('opw_name','opw_url','opw_method','opw_fire','opw_incoming_click_id','opw_outgoing_click_id','opw_key_values_number','opw_key_values_number_old','opw_link_id');
    384384      $form_data = array();
    385385        $meta_data = array();
  • order-postback-woo/trunk/admin/partials/order-postback-woo-admin-tools.php

    r2438104 r2442010  
    2121          $sel_method_get = "selected='selected'"; 
    2222        }
     23         
     24         if(isset($opw['opw_fire']) && $opw['opw_fire']=='yes'){
     25           $sel_fire_yes = "selected='selected'";   
     26        }
    2327       
     28        if(isset($opw['opw_fire']) && $opw['opw_fire']=='no'){
     29           $sel_fire_no = "selected='selected'";   
     30        }
    2431       
    2532 }else{
     
    4148        <tr><td>Url to Post To</td><td><input type="text" class="widefat" name="opw_url" id="opw_url" value="<?php echo $opw['opw_url'];?>"></td></tr>
    4249        <tr><td>Method</td><td><select aria-label="This will be the type of POST or GET that you send." class="widefat" id="opw_method" name="opw_method"><option value="post" <?php echo $sel_method_post;?>>post</option><option value="get" <?php echo $sel_method_get;?>>get</option></select></td></tr>
     50        <tr><td>Fireonly when click id is present</td><td><select aria-label="Fire only when click id is present." class="widefat" id="opw_fire" name="opw_fire"><option value="yes" <?php echo $sel_fire_yes;?>>yes</option><option value="no" <?php echo $sel_fire_no;?>>no</option></select></td></tr>
     51        <tr><td>Incoming Click Id Key</td><td><input type="text" class="wide" name="opw_incoming_click_id" id="opw_incoming_click_id" value="<?php echo $opw['opw_incoming_click_id'];?>"></td></tr>
     52        <tr><td>Outgoing Click Id Key</td><td><input type="text" class="wide" name="opw_outgoing_click_id" id="opw_outgoing_click_id" value="<?php echo $opw['opw_outgoing_click_id'];?>"></td></tr>
    4353        <tr><td></td><td>
    4454            <div id="opw_key_value_div">
  • order-postback-woo/trunk/includes/class-order-postback-woo-links.php

    r2438104 r2442010  
    235235        global $wpdb;
    236236    $link = array();
    237     $fields = array('opw_method','opw_key_values_number','opw_key_values_number_old');
     237    $fields = array('opw_method','opw_fire','opw_incoming_click_id','opw_outgoing_click_id','opw_key_values_number','opw_key_values_number_old');
    238238    $link['key_values'] = array();
    239239   
     
    243243        $post = current($posts);
    244244       
    245     $link['opw_name'] = $post['post_title'];
    246     $link['opw_url'] = $post['post_content'];
    247    
    248    
    249     $sql = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}postmeta WHERE post_id=%d",array($ID));
     245        $link['opw_name'] = $post['post_title'];
     246        $link['opw_url'] = $post['post_content'];
     247   
     248   
     249        $sql = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}postmeta WHERE post_id=%d",array($ID));
    250250        $metas = $wpdb->get_results( $sql, 'ARRAY_A');
    251251       
  • order-postback-woo/trunk/includes/class-order-postback-woo.php

    r2438086 r2442010  
    7171            $this->version = ORDER_POSTBACK_WOO_VERSION;
    7272        } else {
    73             $this->version = '1.0.2';
     73            $this->version = '1.0.3';
    7474        }
    7575        $this->plugin_name = $this->order_postback_woo = 'order-postback-woo';
     
    179179
    180180        $plugin_public = new order_postback_woo_Public( $this->get_order_postback_woo(), $this->get_version() );
    181 
    182      $this->loader->add_action( 'woocommerce_thankyou', $plugin_public, 'send_woo_thankyou_order' );
    183      $this->loader->add_action( 'woocommerce_order_status_changed', $plugin_public, 'action_woocommerce_order_status_changed',10,3);
     181        $this->loader->add_action( 'init', $plugin_public, 'set_click_id' );   
     182        $this->loader->add_action( 'woocommerce_thankyou', $plugin_public, 'send_woo_thankyou_order' );
    184183    }
    185184
  • order-postback-woo/trunk/order-postback-woo.php

    r2438104 r2442010  
    1616 * Plugin Name:       Order Postback for Woocommerce
    1717 * Plugin URI:        https://www.wpconcierges.com/plugins/order_postback_woo/
    18  * Description:       This plugin sends your order information from your Woocomerce store as a json object to any url of your choice, using either a POST or GET.  This is useful if you would like to store your orders or process orders outside of your Woocommerce store.
    19  * Version:           1.0.2
     18 * Description:       This plugin sends your order information from your Woocomerce store as a key/value pair to any url of your choice, using either a POST or GET.  This is useful if you would like to store your orders or process orders outside of your Woocommerce store.
     19 * Version:           1.0.3
    2020 * Author:            WpConcierges
    2121 * Author URI:        https://www.wpconcierges.com/
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 define( 'ORDER_POSTBACK_WOO_VERSION', '1.0.2' );
     40define( 'ORDER_POSTBACK_WOO_VERSION', '1.0.3' );
    4141
    4242/**
  • order-postback-woo/trunk/public/class-order-postback-woo-public.php

    r2438086 r2442010  
    6767     */
    6868    private $postback_params;
    69 
     69    private $can_fire;
    7070    /**
    7171     * Initialize the class and set its properties.
     
    127127
    128128    }
    129 
    130   function action_woocommerce_order_status_changed($order_id, $old_status, $new_status) {
    131     // make action magic happen here...
    132    
    133     if($new_status =="wc-processing"){
    134         $this->send_woo_thankyou_order($order_id);
    135     }
    136   }
    137129
    138130    public function send_woo_thankyou_order($order_id){
     
    293285    }
    294286   
     287    public function set_click_id(){
     288       
     289        $cookie_keys = array();   
     290        $links = $this->get_all_links();
     291   
     292        foreach($links as $link){
     293         
     294        $opw = $this->get_postback_link($link,'opw_incoming_click_id');
     295       
     296        $click_id = $opw['opw_incoming_click_id'];
     297       
     298            if(isset($_GET[$click_id])){
     299                array_push($cookie_keys,$click_id);
     300                $get_click_id = $_GET[$click_id];
     301                    if(strlen($click_id) && strlen($get_click_id)){
     302                         $expiry = strtotime('+1 month');
     303                         $host = parse_url(get_option('siteurl'), PHP_URL_HOST);
     304                         setcookie($click_id,$get_click_id, $expiry,"/",$host);
     305                     }
     306            }
     307       }
     308       
     309   
     310   }
     311
     312   private function can_fire_check($params){
     313    if($params['opw_fire']=="no"){
     314          $this->can_fire = true;
     315      }else{
     316          $this->can_fire = false;
     317      }
     318      $click_id = $params['opw_incoming_click_id'];
     319      $out_click_id = $params['opw_outgoing_click_id'];
     320     
     321      if(isset($_COOKIE[$click_id])){
     322     $this->postback_params[$out_click_id] = $_COOKIE[$click_id];
     323           
     324     if(($params['opw_fire'] == "yes") && strlen($this->postback_params[$out_click_id])){
     325        $this->can_fire = true;
     326     }
     327      }
     328   }   
     329
    295330    private function get_postback_link($link,$field_to_get=''){
    296331        $fields = array();
     
    383418        $opw = $this->get_postback_link($link);
    384419     
    385        
     420           $this->can_fire_check($opw);   
     421           if($this->can_fire){
    386422            $this->postback_url = $opw['opw_url'];
    387           $this->postback_params = $this->get_postback_params($opw);
     423            $this->postback_params = $this->get_postback_params($opw);
    388424         
    389           $args = array();
     425            $args = array();
    390426       
    391427             
    392           if($opw['opw_method'] == "get"){
    393             if(strpos($this->postback_url,"?")>0){
     428            if($opw['opw_method'] == "get"){
     429              if(strpos($this->postback_url,"?")>0){
    394430                $this->postback_url = $this->postback_url."&".http_build_query($this->postback_params);
    395             }else{
     431              }else{
    396432                $this->postback_url = $this->postback_url."?".http_build_query($this->postback_params);
    397             }
     433              }
    398434               
    399             $response = wp_remote_get($this->postback_url,$args);
     435              $response = wp_remote_get($this->postback_url,$args);
    400436     
    401           }else{
    402             $args = array("body"=>array($this->postback_params));
     437            }else{
     438              $args = array("body"=>array($this->postback_params));
    403439           
    404             if(count($headers)){
     440              if(count($headers)){
    405441                $args['headers'] = $headers;
    406             }
     442              }
    407443            $response = wp_remote_post($this->postback_url,$args); 
    408444             
    409         }
     445          }
     446       }
    410447         
    411448    }
Note: See TracChangeset for help on using the changeset viewer.