Plugin Directory

Changeset 3437688


Ignore:
Timestamp:
01/12/2026 12:09:40 PM (3 months ago)
Author:
PropertyHive
Message:

Update to version 2.5.38

Location:
houzez-property-feed/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • houzez-property-feed/trunk/README.txt

    r3428872 r3437688  
    44Requires at least: 3.8
    55Tested up to: 6.9
    6 Stable tag: 2.5.37
    7 Version: 2.5.37
     6Stable tag: 2.5.38
     7Version: 2.5.38
    88Homepage: https://houzezpropertyfeed.com
    99License: GPLv3
     
    146146== Changelog ==
    147147
     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
    148152= 2.5.37 - 2025-12-29 =
    149153* Added support for importing properties from PropConnect
  • houzez-property-feed/trunk/houzez-property-feed.php

    r3428872 r3437688  
    44 * Plugin Uri: https://houzezpropertyfeed.com
    55 * Description: Automatically import properties to Houzez from estate agency CRMs and export to portals
    6  * Version: 2.5.37
     6 * Version: 2.5.38
    77 * Author: PropertyHive
    88 * Author URI: https://wp-property-hive.com
     
    2020     * @var string
    2121     */
    22     public $version = '2.5.37';
     22    public $version = '2.5.38';
    2323
    2424    /**
  • houzez-property-feed/trunk/includes/export-formats/class-houzez-property-feed-format-rtdf.php

    r3389596 r3437688  
    266266                }*/
    267267            }
    268 
    269            
    270268        }
    271269    }
     
    597595        $request_data['property']['details']['features'] = $features;
    598596
    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;
    656651        }
    657652
  • houzez-property-feed/trunk/includes/format-functions.php

    r3428872 r3437688  
    31783178            'taxonomy_values' => array(),
    31793179            'contact_information_fields' => array(
    3180                 //'fave_agents',
     3180                'agent_id',
     3181                'agent_name',
     3182                'agency_id',
     3183                'agency_name',
    31813184            ),
    31823185            '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  
    4848     */
    4949    private $property_label;
     50
     51    /**
     52     * @var array
     53     */
     54    private $agent;
     55
     56    /**
     57     * @var array
     58     */
     59    private $agency;
    5060
    5161    public function __construct( $instance_id = '', $import_id = '' )
     
    506516    }
    507517
     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
    508626    public function parse()
    509627    {
     
    517635
    518636        $format = $import_settings['format'];
     637
     638        $this->get_other_site_property_agents();
     639        $this->get_other_site_property_agencies();
    519640
    520641        $format_details = houzez_property_feed_get_import_format($format);
     
    720841                        $property['attachment_urls'] = $attachment_urls;
    721842
     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
    722891                        $this->properties[] = $property;
    723892
     
    9531122                    'fave_agent_display_option',
    9541123                    'fave_agents',
     1124                    'agent_name',
    9551125                    'fave_property_agency',
     1126                    'agency_name',
    9561127                    'fave_attachments',
    9571128                    'fave_property_images',
     
    9961167                }
    9971168
    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' ) );
    9991170
    10001171                if (
     
    10091180                        case "author_info":
    10101181                        {
    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                           
    10371183                            break;
    10381184                        }
     
    10441190                                switch ( $rule['field'] )
    10451191                                {
    1046                                     case "branch_uuid":
     1192                                    case "agent_id":
    10471193                                    {
    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] : '';
    10491200                                        break;
    10501201                                    }
     
    10661217                                switch ( $rule['field'] )
    10671218                                {
    1068                                     case "branch_uuid":
     1219                                    case "agency_id":
    10691220                                    {
    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] : '';
    10711227                                        break;
    10721228                                    }
     
    10821238                        }
    10831239                    }
    1084                 }*/
     1240                }
    10851241               
    10861242                $taxonomies = array(
     
    14601616                $this->log( 'Imported ' . count($media_ids) . ' attachments (' . $new . ' new, ' . $existing . ' existing, ' . $deleted . ' deleted)', $property['id'], $post_id );
    14611617               
    1462 
    14631618                do_action( "houzez_property_feed_property_imported", $post_id, $property, $this->import_id, $this->instance_id );
    14641619                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.