Changeset 2454116
- Timestamp:
- 01/11/2021 07:37:59 PM (5 years ago)
- Location:
- order-postback-woo/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (3 diffs)
-
includes/class-order-postback-woo.php (modified) (1 diff)
-
order-postback-woo.php (modified) (2 diffs)
-
public/class-order-postback-woo-public.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
order-postback-woo/trunk/README.txt
r2452150 r2454116 5 5 Requires at least: 3.1 6 6 Tested up to: 5.6 7 Stable tag: 1.0. 47 Stable tag: 1.0.5 8 8 Requires PHP: 5.6 or above 9 9 License: GPLv2 or later … … 37 37 zapier webhooks 38 38 image url callback 39 CAKE 39 40 Any affiliate network that supports image or server 2 server postback calls 40 41 … … 82 83 83 84 == Changelog == 85 = 1.0.5 = 86 fixed incoming outgoing variable issues if on version 1.0.3 ore 1.0.4 87 84 88 = 1.0.4 = 85 89 fixed replacement variable offset issue if on version 1.0.3 -
order-postback-woo/trunk/includes/class-order-postback-woo.php
r2452150 r2454116 71 71 $this->version = ORDER_POSTBACK_WOO_VERSION; 72 72 } else { 73 $this->version = '1.0. 4';73 $this->version = '1.0.5'; 74 74 } 75 75 $this->plugin_name = $this->order_postback_woo = 'order-postback-woo'; -
order-postback-woo/trunk/order-postback-woo.php
r2452150 r2454116 17 17 * Plugin URI: https://www.wpconcierges.com/plugins/order_postback_woo/ 18 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. 419 * Version: 1.0.5 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. 4' );40 define( 'ORDER_POSTBACK_WOO_VERSION', '1.0.5' ); 41 41 42 42 /** -
order-postback-woo/trunk/public/class-order-postback-woo-public.php
r2452150 r2454116 245 245 246 246 private function set_parameters($metas){ 247 247 248 $params = array(); 248 249 $cookie_keys = array('opw_incoming_click_id','opw_outgoing_click_id'); … … 271 272 $params[$metas['opw_outgoing_click_id']] = $_COOKIE[$metas['opw_incoming_click_id']]; 272 273 } 273 274 print_r($params); 274 275 return $params; 275 276 } … … 311 312 312 313 private function can_fire_check($params){ 313 if($params['opw_fire']=="no"){314 if($params['opw_fire']=="no"){ 314 315 $this->can_fire = true; 315 316 }else{ … … 319 320 $out_click_id = $params['opw_outgoing_click_id']; 320 321 321 if(isset($_COOKIE[$click_id])){ 322 $this->postback_params[$out_click_id] = $_COOKIE[$click_id]; 322 323 if(isset($_COOKIE[$click_id])){ 324 $this->postback_params[$out_click_id] = $_COOKIE[$click_id]; 323 325 324 if(($params['opw_fire'] == "yes") && strlen($this->postback_params[$out_click_id])){325 $this->can_fire = true;326 }327 }326 if(($params['opw_fire'] == "yes") && strlen($this->postback_params[$out_click_id])){ 327 $this->can_fire = true; 328 } 329 } 328 330 } 329 331 … … 340 342 341 343 private function get_postback_link_field($link,$field_to_get){ 344 global $wpdb; 342 345 $field_check = array($field_to_get); 343 346 $fields = array(); 344 347 $post_id = $link['ID']; 345 348 346 $metas = get_post_meta($post_id); 349 $sql = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}postmeta WHERE post_id=%d",array($post_id)); 350 351 $metas = $wpdb->get_results( $sql, 'ARRAY_A'); 347 352 348 353 … … 358 363 } 359 364 365 366 360 367 private function get_postback_link_fields($link){ 361 $field_check = array('opw_url','opw_method','opw_key_values_number','opw_headers'); 362 $fields = array(); 363 $fields['opw_url'] = $link['post_content']; 364 $post_id = $link['ID']; 365 366 $metas = get_post_meta($post_id); 367 $datas = array(); 368 foreach($metas as $meta_key => $meta_value){ 369 if(in_array($meta_key,$field_check)){ 370 $fields[$meta_key]=current($meta_value); 371 }else{ 368 $field_check = array('opw_url','opw_method','opw_fire','opw_incoming_click_id','opw_outgoing_click_id','opw_key_values_number'); 369 $fields = array(); 370 $fields['opw_url'] = $link['post_content']; 371 $post_id = $link['ID']; 372 373 $metas = get_post_meta($post_id); 374 $datas = array(); 375 foreach($metas as $meta_key => $meta_value){ 376 if(in_array($meta_key,$field_check)){ 377 $fields[$meta_key]=current($meta_value); 378 }else{ 379 380 $tmp = explode("_",$meta_key); 372 381 373 374 $tmp = explode("_",$meta_key); 375 376 if(isset($tmp[2]) && in_array($tmp[1],array('key','value'))){ 377 $counter = $tmp[2]; 378 if(is_numeric($counter)){ 379 if((strpos($meta_key,"_key_"))>0){ 380 $datas['key_values'][$counter]['key'] = current($meta_value); 382 if(isset($tmp[2]) && in_array($tmp[1],array('key','value'))){ 383 $counter = $tmp[2]; 384 if(is_numeric($counter)){ 385 if((strpos($meta_key,"_key_"))>0){ 386 $datas['key_values'][$counter]['key'] = current($meta_value); 387 } 388 389 if((strpos($meta_key,"_value_"))>0){ 390 $datas['key_values'][$counter]['value'] = current($meta_value); 381 391 } 382 383 if((strpos($meta_key,"_value_"))>0){ 384 $datas['key_values'][$counter]['value'] = current($meta_value); 385 } 386 } 387 } 388 } 389 } 390 391 foreach($datas['key_values'] as $data){ 392 $fields[$data['key']]=$data['value']; 393 } 394 395 $fields = $this->set_parameters($fields); 396 397 return $fields; 392 } 393 } 394 } 395 } 396 397 foreach($datas['key_values'] as $data){ 398 $fields[$data['key']]=$data['value']; 399 } 400 401 $fields = $this->set_parameters($fields); 402 403 return $fields; 398 404 } 399 405 … … 418 424 $opw = $this->get_postback_link($link); 419 425 420 $this->can_fire_check($opw); 426 $this->can_fire_check($opw); 427 421 428 if($this->can_fire){ 422 429 $this->postback_url = $opw['opw_url']; 423 $this->postback_params = $this->get_postback_params($opw); 430 $this->postback_params = $this->get_postback_params($opw); 431 424 432 425 433 $args = array(); 426 427 434 428 435 if($opw['opw_method'] == "get"){ 429 436 if(strpos($this->postback_url,"?")>0){ … … 437 444 }else{ 438 445 $args = array("body"=>array($this->postback_params)); 439 440 if(count($headers)){ 441 $args['headers'] = $headers; 442 } 443 $response = wp_remote_post($this->postback_url,$args); 444 445 } 446 $response = wp_remote_post($this->postback_url,$args); 447 448 } 446 449 } 447 450
Note: See TracChangeset
for help on using the changeset viewer.