Changeset 2442010
- Timestamp:
- 12/18/2020 05:44:06 AM (5 years ago)
- Location:
- order-postback-woo/trunk
- Files:
-
- 7 edited
-
README.txt (modified) (4 diffs)
-
admin/class-order-postback-woo-admin.php (modified) (1 diff)
-
admin/partials/order-postback-woo-admin-tools.php (modified) (2 diffs)
-
includes/class-order-postback-woo-links.php (modified) (2 diffs)
-
includes/class-order-postback-woo.php (modified) (2 diffs)
-
order-postback-woo.php (modified) (2 diffs)
-
public/class-order-postback-woo-public.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
order-postback-woo/trunk/README.txt
r2438116 r2442010 5 5 Requires at least: 3.1 6 6 Tested up to: 5.6 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 Requires PHP: 5.6 or above 9 9 License: GPLv2 or later … … 17 17 This 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. 18 18 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. 19 Great 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. 20 You can set the incoming and outgoing clickid on the free version for your order postback. 21 22 Works with most affiliate networks: 23 Maxbounty 24 Rakuten 25 CJ 26 Pepperjam 27 Clickbooth 28 TrafficRoots 29 Commissionsoup 30 HasOffers 31 Clixgalore 32 Miva 33 AdStage 34 Nativo 35 Outbrain 36 Taboola 37 Anynetwork that supports image or server 2 server postback calls. 38 21 39 22 40 If you need to post/get more than 1 url check out the Pro version. … … 26 44 1.) Allows you to post/get to any number or URLs. 27 45 28 2.) Configure an incoming and outgoing click id per url.46 2.) 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 29 47 30 48 3.) Sets a Cookie for all incoming querystring variables that can be used in the postback url parameters on firing. … … 62 80 63 81 == Changelog == 82 = 1.0.3 = 83 added can fire when clickid is set for affiliate networks 84 added incoming and outgoing clickid fields 85 64 86 = 1.0.2 = 65 87 complete rewrite no uses a custom post and not the admin options -
order-postback-woo/trunk/admin/class-order-postback-woo-admin.php
r2438086 r2442010 381 381 $datas = $_POST['form_data']; 382 382 $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'); 384 384 $form_data = array(); 385 385 $meta_data = array(); -
order-postback-woo/trunk/admin/partials/order-postback-woo-admin-tools.php
r2438104 r2442010 21 21 $sel_method_get = "selected='selected'"; 22 22 } 23 24 if(isset($opw['opw_fire']) && $opw['opw_fire']=='yes'){ 25 $sel_fire_yes = "selected='selected'"; 26 } 23 27 28 if(isset($opw['opw_fire']) && $opw['opw_fire']=='no'){ 29 $sel_fire_no = "selected='selected'"; 30 } 24 31 25 32 }else{ … … 41 48 <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> 42 49 <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> 43 53 <tr><td></td><td> 44 54 <div id="opw_key_value_div"> -
order-postback-woo/trunk/includes/class-order-postback-woo-links.php
r2438104 r2442010 235 235 global $wpdb; 236 236 $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'); 238 238 $link['key_values'] = array(); 239 239 … … 243 243 $post = current($posts); 244 244 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)); 250 250 $metas = $wpdb->get_results( $sql, 'ARRAY_A'); 251 251 -
order-postback-woo/trunk/includes/class-order-postback-woo.php
r2438086 r2442010 71 71 $this->version = ORDER_POSTBACK_WOO_VERSION; 72 72 } else { 73 $this->version = '1.0. 2';73 $this->version = '1.0.3'; 74 74 } 75 75 $this->plugin_name = $this->order_postback_woo = 'order-postback-woo'; … … 179 179 180 180 $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' ); 184 183 } 185 184 -
order-postback-woo/trunk/order-postback-woo.php
r2438104 r2442010 16 16 * Plugin Name: Order Postback for Woocommerce 17 17 * 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 objectto 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. 218 * 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 20 20 * Author: WpConcierges 21 21 * Author URI: https://www.wpconcierges.com/ … … 38 38 * Rename this for your plugin and update it as you release new versions. 39 39 */ 40 define( 'ORDER_POSTBACK_WOO_VERSION', '1.0. 2' );40 define( 'ORDER_POSTBACK_WOO_VERSION', '1.0.3' ); 41 41 42 42 /** -
order-postback-woo/trunk/public/class-order-postback-woo-public.php
r2438086 r2442010 67 67 */ 68 68 private $postback_params; 69 69 private $can_fire; 70 70 /** 71 71 * Initialize the class and set its properties. … … 127 127 128 128 } 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 }137 129 138 130 public function send_woo_thankyou_order($order_id){ … … 293 285 } 294 286 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 295 330 private function get_postback_link($link,$field_to_get=''){ 296 331 $fields = array(); … … 383 418 $opw = $this->get_postback_link($link); 384 419 385 420 $this->can_fire_check($opw); 421 if($this->can_fire){ 386 422 $this->postback_url = $opw['opw_url']; 387 $this->postback_params = $this->get_postback_params($opw);423 $this->postback_params = $this->get_postback_params($opw); 388 424 389 $args = array();425 $args = array(); 390 426 391 427 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){ 394 430 $this->postback_url = $this->postback_url."&".http_build_query($this->postback_params); 395 }else{431 }else{ 396 432 $this->postback_url = $this->postback_url."?".http_build_query($this->postback_params); 397 }433 } 398 434 399 $response = wp_remote_get($this->postback_url,$args);435 $response = wp_remote_get($this->postback_url,$args); 400 436 401 }else{402 $args = array("body"=>array($this->postback_params));437 }else{ 438 $args = array("body"=>array($this->postback_params)); 403 439 404 if(count($headers)){440 if(count($headers)){ 405 441 $args['headers'] = $headers; 406 }442 } 407 443 $response = wp_remote_post($this->postback_url,$args); 408 444 409 } 445 } 446 } 410 447 411 448 }
Note: See TracChangeset
for help on using the changeset viewer.