Changeset 3437688
- Timestamp:
- 01/12/2026 12:09:40 PM (3 months ago)
- Location:
- houzez-property-feed/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
houzez-property-feed.php (modified) (2 diffs)
-
includes/export-formats/class-houzez-property-feed-format-rtdf.php (modified) (2 diffs)
-
includes/format-functions.php (modified) (1 diff)
-
includes/import-formats/class-houzez-property-feed-format-wp-rest-api-houzez.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
houzez-property-feed/trunk/README.txt
r3428872 r3437688 4 4 Requires at least: 3.8 5 5 Tested up to: 6.9 6 Stable tag: 2.5.3 77 Version: 2.5.3 76 Stable tag: 2.5.38 7 Version: 2.5.38 8 8 Homepage: https://houzezpropertyfeed.com 9 9 License: GPLv3 … … 146 146 == Changelog == 147 147 148 = 2.5.38 - 2026-01-12 = 149 * Added area/size to RTDF (Used in feeds to Rightmove and OnTheMarket) requests for UK properties 150 * Added ability to map agents and agencies under 'Contact Information' settings tab when importing from another Houzez site 151 148 152 = 2.5.37 - 2025-12-29 = 149 153 * Added support for importing properties from PropConnect -
houzez-property-feed/trunk/houzez-property-feed.php
r3428872 r3437688 4 4 * Plugin Uri: https://houzezpropertyfeed.com 5 5 * Description: Automatically import properties to Houzez from estate agency CRMs and export to portals 6 * Version: 2.5.3 76 * Version: 2.5.38 7 7 * Author: PropertyHive 8 8 * Author URI: https://wp-property-hive.com … … 20 20 * @var string 21 21 */ 22 public $version = '2.5.3 7';22 public $version = '2.5.38'; 23 23 24 24 /** -
houzez-property-feed/trunk/includes/export-formats/class-houzez-property-feed-format-rtdf.php
r3389596 r3437688 266 266 }*/ 267 267 } 268 269 270 268 } 271 269 } … … 597 595 $request_data['property']['details']['features'] = $features; 598 596 599 if ( $overseas ) 600 { 601 if ( 602 get_post_meta( $post_id, 'fave_property_size', TRUE ) != '' && 603 is_numeric(get_post_meta( $post_id, 'fave_property_size', TRUE )) && 604 get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ) != '' 605 ) 606 { 607 $request_data['property']['details']['internal_area'] = get_post_meta( $post_id, 'fave_property_size', TRUE ); 608 609 $unit = null; 610 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'ft') !== false ) 611 { 612 $unit = 1; 613 } 614 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'm') !== false ) 615 { 616 $unit = 2; 617 } 618 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'acre') !== false ) 619 { 620 $unit = 3; 621 } 622 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'hectares') !== false ) 623 { 624 $unit = 4; 625 } 626 $request_data['property']['details']['internal_area_unit'] = $unit; 627 } 628 629 if ( 630 get_post_meta( $post_id, 'fave_property_land', TRUE ) != '' && 631 is_numeric(get_post_meta( $post_id, 'fave_property_land', TRUE )) && 632 get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ) != '' 633 ) 634 { 635 $request_data['property']['details']['land_area'] = get_post_meta( $post_id, 'fave_property_land', TRUE ); 636 637 $unit = null; 638 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'ft') !== false ) 639 { 640 $unit = 1; 641 } 642 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'm') !== false ) 643 { 644 $unit = 2; 645 } 646 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'acre') !== false ) 647 { 648 $unit = 3; 649 } 650 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'hectares') !== false ) 651 { 652 $unit = 4; 653 } 654 $request_data['property']['details']['land_area_unit'] = $unit; 655 } 597 if ( 598 get_post_meta( $post_id, 'fave_property_size', TRUE ) != '' && 599 is_numeric(get_post_meta( $post_id, 'fave_property_size', TRUE )) && 600 get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ) != '' 601 ) 602 { 603 $request_data['property']['details']['internal_area'] = get_post_meta( $post_id, 'fave_property_size', TRUE ); 604 605 $unit = null; 606 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'ft') !== false ) 607 { 608 $unit = 1; 609 } 610 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'm') !== false ) 611 { 612 $unit = 2; 613 } 614 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'acre') !== false ) 615 { 616 $unit = 3; 617 } 618 if ( stripos(get_post_meta( $post_id, 'fave_property_size_prefix', TRUE ), 'hectares') !== false ) 619 { 620 $unit = 4; 621 } 622 $request_data['property']['details']['internal_area_unit'] = $unit; 623 } 624 625 if ( 626 get_post_meta( $post_id, 'fave_property_land', TRUE ) != '' && 627 is_numeric(get_post_meta( $post_id, 'fave_property_land', TRUE )) && 628 get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ) != '' 629 ) 630 { 631 $request_data['property']['details']['land_area'] = get_post_meta( $post_id, 'fave_property_land', TRUE ); 632 633 $unit = null; 634 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'ft') !== false ) 635 { 636 $unit = 1; 637 } 638 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'm') !== false ) 639 { 640 $unit = 2; 641 } 642 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'acre') !== false ) 643 { 644 $unit = 3; 645 } 646 if ( stripos(get_post_meta( $post_id, 'fave_property_land_postfix', TRUE ), 'hectares') !== false ) 647 { 648 $unit = 4; 649 } 650 $request_data['property']['details']['land_area_unit'] = $unit; 656 651 } 657 652 -
houzez-property-feed/trunk/includes/format-functions.php
r3428872 r3437688 3178 3178 'taxonomy_values' => array(), 3179 3179 'contact_information_fields' => array( 3180 //'fave_agents', 3180 'agent_id', 3181 'agent_name', 3182 'agency_id', 3183 'agency_name', 3181 3184 ), 3182 3185 'help_url' => 'https://houzezpropertyfeed.com/documentation/managing-imports/formats/wp-rest-api-houzez/', -
houzez-property-feed/trunk/includes/import-formats/class-houzez-property-feed-format-wp-rest-api-houzez.php
r3389596 r3437688 48 48 */ 49 49 private $property_label; 50 51 /** 52 * @var array 53 */ 54 private $agent; 55 56 /** 57 * @var array 58 */ 59 private $agency; 50 60 51 61 public function __construct( $instance_id = '', $import_id = '' ) … … 506 516 } 507 517 518 private function get_other_site_property_agents() 519 { 520 $this->log("Obtaining agents"); 521 522 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id ); 523 524 $url = ( isset($import_settings['url']) && !empty($import_settings['url']) ) ? rtrim($import_settings['url'], '/') : ''; 525 $url .= '/wp-json/wp/v2/agents?per_page=100'; 526 527 $url = apply_filters( 'houzez_property_feed_wp_rest_api_houzez_agents_url', $url, $this->import_id ); 528 529 $response = wp_remote_request( 530 $url, 531 array( 532 'method' => 'GET', 533 'timeout' => 120, 534 ) 535 ); 536 537 if ( is_wp_error( $response ) ) 538 { 539 $this->log_error( 'Response: ' . $response->get_error_message() ); 540 541 return false; 542 } 543 544 if ( wp_remote_retrieve_response_code( $response ) != 200 ) 545 { 546 $this->log_error( 'Received an invalid response when requesting agents. ' . print_r($response, true) ); 547 548 return false; 549 } 550 551 $json = json_decode( $response['body'], TRUE ); 552 553 if ($json !== FALSE) 554 { 555 foreach ( $json as $agent ) 556 { 557 $this->agent[] = array( 558 'id' => $agent['id'], 559 'name' => $agent['title']['rendered'], 560 ); 561 } 562 } 563 else 564 { 565 // Failed to parse XML 566 $this->log_error( 'Failed to parse agents JSON.' ); 567 568 return false; 569 } 570 } 571 572 private function get_other_site_property_agencies() 573 { 574 $this->log("Obtaining agencies"); 575 576 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id ); 577 578 $url = ( isset($import_settings['url']) && !empty($import_settings['url']) ) ? rtrim($import_settings['url'], '/') : ''; 579 $url .= '/wp-json/wp/v2/agencies?per_page=100'; 580 581 $url = apply_filters( 'houzez_property_feed_wp_rest_api_houzez_agencies_url', $url, $this->import_id ); 582 583 $response = wp_remote_request( 584 $url, 585 array( 586 'method' => 'GET', 587 'timeout' => 120, 588 ) 589 ); 590 591 if ( is_wp_error( $response ) ) 592 { 593 $this->log_error( 'Response: ' . $response->get_error_message() ); 594 595 return false; 596 } 597 598 if ( wp_remote_retrieve_response_code( $response ) != 200 ) 599 { 600 $this->log_error( 'Received an invalid response when requesting agencies. ' . print_r($response, true) ); 601 602 return false; 603 } 604 605 $json = json_decode( $response['body'], TRUE ); 606 607 if ($json !== FALSE) 608 { 609 foreach ( $json as $agency ) 610 { 611 $this->agency[] = array( 612 'id' => $agency['id'], 613 'name' => $agency['title']['rendered'], 614 ); 615 } 616 } 617 else 618 { 619 // Failed to parse XML 620 $this->log_error( 'Failed to parse agencies JSON.' ); 621 622 return false; 623 } 624 } 625 508 626 public function parse() 509 627 { … … 517 635 518 636 $format = $import_settings['format']; 637 638 $this->get_other_site_property_agents(); 639 $this->get_other_site_property_agencies(); 519 640 520 641 $format_details = houzez_property_feed_get_import_format($format); … … 720 841 $property['attachment_urls'] = $attachment_urls; 721 842 843 if (isset($property['property_meta']['fave_agent_display_option']) && !empty($property['property_meta']['fave_agent_display_option'])) 844 { 845 switch ( $property['property_meta']['fave_agent_display_option'][0] ) 846 { 847 case "agent_info": 848 { 849 if ( isset($property['property_meta']['fave_agents'][0]) && !empty($property['property_meta']['fave_agents'][0]) ) 850 { 851 $third_party_agent_id = (int)$property['property_meta']['fave_agents'][0]; 852 853 // get agent name 854 if ( !empty($this->agent) ) 855 { 856 foreach ( $this->agent as $agent ) 857 { 858 if ( $third_party_agent_id == $agent['id'] ) 859 { 860 $property['property_meta']['agent_name'] = array($agent['name']); 861 } 862 } 863 } 864 } 865 break; 866 } 867 case "agency_info": 868 { 869 if ( isset($property['property_meta']['fave_property_agency'][0]) && !empty($property['property_meta']['fave_property_agency'][0]) ) 870 { 871 $third_party_agency_id = (int)$property['property_meta']['fave_property_agency'][0]; 872 873 // get agency name 874 if ( !empty($this->agency) ) 875 { 876 foreach ( $this->agency as $agency ) 877 { 878 if ( $third_party_agency_id == $agency['id'] ) 879 { 880 $property['property_meta']['agency_name'] = array($agency['name']); 881 } 882 } 883 } 884 } 885 break; 886 } 887 888 } 889 } 890 722 891 $this->properties[] = $property; 723 892 … … 953 1122 'fave_agent_display_option', 954 1123 'fave_agents', 1124 'agent_name', 955 1125 'fave_property_agency', 1126 'agency_name', 956 1127 'fave_attachments', 957 1128 'fave_property_images', … … 996 1167 } 997 1168 998 /*update_post_meta( $post_id, 'fave_agent_display_option', ( isset($import_settings['agent_display_option']) ? $import_settings['agent_display_option'] : 'none' ) );1169 update_post_meta( $post_id, 'fave_agent_display_option', ( isset($import_settings['agent_display_option']) ? $import_settings['agent_display_option'] : 'none' ) ); 999 1170 1000 1171 if ( … … 1009 1180 case "author_info": 1010 1181 { 1011 foreach ( $import_settings['agent_display_option_rules'] as $rule ) 1012 { 1013 $value_in_feed_to_check = ''; 1014 switch ( $rule['field'] ) 1015 { 1016 case "branch_uuid": 1017 { 1018 $value_in_feed_to_check = $property['attributes']['branch_uuid']; 1019 break; 1020 } 1021 } 1022 1023 if ( $value_in_feed_to_check == $rule['equal'] || $rule['equal'] == '*' ) 1024 { 1025 // set post author 1026 $my_post = array( 1027 'ID' => $post_id, 1028 'post_author' => $rule['result'], 1029 ); 1030 1031 // Update the post into the database 1032 wp_update_post( $my_post, true ); 1033 1034 break; // Rule matched. Lets not do anymore 1035 } 1036 } 1182 1037 1183 break; 1038 1184 } … … 1044 1190 switch ( $rule['field'] ) 1045 1191 { 1046 case " branch_uuid":1192 case "agent_id": 1047 1193 { 1048 $value_in_feed_to_check = $property['attributes']['branch_uuid']; 1194 $value_in_feed_to_check = isset($property['property_meta']['fave_agents'][0]) ? $property['property_meta']['fave_agents'][0] : ''; 1195 break; 1196 } 1197 case "agent_name": 1198 { 1199 $value_in_feed_to_check = isset($property['property_meta']['agent_name'][0]) ? $property['property_meta']['agent_name'][0] : ''; 1049 1200 break; 1050 1201 } … … 1066 1217 switch ( $rule['field'] ) 1067 1218 { 1068 case " branch_uuid":1219 case "agency_id": 1069 1220 { 1070 $value_in_feed_to_check = $property['attributes']['branch_uuid']; 1221 $value_in_feed_to_check = isset($property['property_meta']['fave_property_agency'][0]) ? $property['property_meta']['fave_property_agency'][0] : ''; 1222 break; 1223 } 1224 case "agency_name": 1225 { 1226 $value_in_feed_to_check = isset($property['property_meta']['agency_name'][0]) ? $property['property_meta']['agency_name'][0] : ''; 1071 1227 break; 1072 1228 } … … 1082 1238 } 1083 1239 } 1084 } */1240 } 1085 1241 1086 1242 $taxonomies = array( … … 1460 1616 $this->log( 'Imported ' . count($media_ids) . ' attachments (' . $new . ' new, ' . $existing . ' existing, ' . $deleted . ' deleted)', $property['id'], $post_id ); 1461 1617 1462 1463 1618 do_action( "houzez_property_feed_property_imported", $post_id, $property, $this->import_id, $this->instance_id ); 1464 1619 do_action( "houzez_property_feed_property_imported_wp_rest_api_houzez", $post_id, $property, $this->import_id, $this->instance_id );
Note: See TracChangeset
for help on using the changeset viewer.