Plugin Directory

Changeset 3030379


Ignore:
Timestamp:
02/02/2024 01:55:18 AM (2 years ago)
Author:
SimplyRETS
Message:

v2.10.5 release

Location:
simply-rets
Files:
5 edited
4 copied

Legend:

Unmodified
Added
Removed
  • simply-rets/tags/2.10.5/readme.txt

    r3013517 r3030379  
    44Tags: idx, rets, reso web api, mls, idx plugin, mls listings, reso, real estate, realtor, rets feed, idx feed
    55Requires at least: 3.0.1
    6 Tested up to: 6.4.2
     6Tested up to: 6.4.3
    77Stable tag: 2.10.4
    88License: GPLv3
     
    237237
    238238== Changelog ==
     239
     240= 2.10.5 =
     241* FIX: Prefer list agent "cell" field over "office" field
     242* FIX: Fix warning when listing remarks doesn't exist
     243* UPDATE: Use case-insensitive header lookup for HTTP/2 support
    239244
    240245= 2.10.4 =
  • simply-rets/tags/2.10.5/simply-rets-api-helper.php

    r2972401 r3030379  
    125125        $site_url = get_site_url();
    126126
    127         $ua_string     = "SimplyRETSWP/2.10.4 Wordpress/{$wp_version} PHP/{$php_version}";
     127        $ua_string     = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}";
    128128        $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json";
    129129
     
    236236        $php_version = phpversion();
    237237
    238         $ua_string     = "SimplyRETSWP/2.10.4 Wordpress/{$wp_version} PHP/{$php_version}";
     238        $ua_string     = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}";
    239239        $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json";
    240240
     
    261261            $body   = substr( $request, $header_size );
    262262
    263             $pag_links = SimplyRetsApiHelper::srPaginationParser($header);
    264             $last_update = SimplyRetsApiHelper::srLastUpdateHeaderParser($header);
     263            $headers = http_parse_headers($header);
     264            $pag_links = SimplyRetsApiHelper::srPaginationParser($headers);
     265            $last_update = SimplyRetsApiHelper::srLastUpdateHeaderParser($headers);
    265266
    266267            // decode the reponse body
     
    313314    // and return the value
    314315    public static function srLastUpdateHeaderParser($headers) {
    315         $parsed_headers = http_parse_headers($headers);
    316         $last_update_hdr = 'X-SimplyRETS-LastUpdate';
     316        $last_update = SrUtils::getHeader($headers, 'X-SimplyRETS-LastUpdate');
    317317
    318318        // Use current timestamp if API doesn't have one
    319         if (empty($parsed_headers[$last_update_hdr])) {
     319        if (empty($last_update)) {
    320320            return date(DATE_ATOM, time());
    321321        }
    322322
    323         // Get LastUpdate header value and format the date/time
    324         $last_update = $parsed_headers[$last_update_hdr];
    325323        return $last_update;
    326324    }
    327325
    328326
    329     public static function srPaginationParser( $linkHeader ) {
     327    public static function srPaginationParser($headers) {
     328        $link_header = SrUtils::getHeader($headers, "Link");
    330329
    331330        // get link val from header
    332331        $pag_links = array();
    333         preg_match('/^Link: ([^\r\n]*)[\r\n]*$/m', $linkHeader, $matches);
     332        preg_match('/^([^\r\n]*)[\r\n]*$/m', $link_header, $matches);
    334333        unset($matches[0]);
    335334
     
    964963
    965964        if( get_option('sr_show_listing_remarks') ) {
    966             $show_remarks = false;
     965            $remarks_markup = "";
    967966        } else {
    968             $show_remarks = true;
    969967            $remarks = $listing->remarks;
    970968            $remarks_markup = <<<HTML
     
    10391037        $agent = SimplyRetsApiHelper::srDetailsTable($listing_agent_name, "Listing Agent");
    10401038
    1041         $listing_agent_phone = $has_agent_contact_info ? $listing->agent->contact->office : '';
     1039        $listing_agent_cell_phone = $has_agent_contact_info ? $listing->agent->contact->cell : '';
     1040        $listing_agent_office_phone = $has_agent_contact_info ? $listing->agent->contact->office: '';
     1041        $listing_agent_phone = $listing_agent_cell_phone
     1042                             ? $listing_agent_cell_phone
     1043                             : $listing_agent_office_phone;
    10421044        $agent_phone = SimplyRetsApiHelper::srDetailsTable($listing_agent_phone, "Listing Agent Phone");
    10431045
  • simply-rets/tags/2.10.5/simply-rets-utils.php

    r2889422 r3030379  
    286286        }
    287287        return $arr;
     288    }
     289
     290    /**
     291     * Lookup header value from array.
     292     * This helper function ensures a case insensitive lookup.
     293     */
     294    public static function getHeader($headers, $header_name) {
     295        $header_name = strtolower($header_name);
     296        $header_list = array_change_key_case($headers, CASE_LOWER);
     297
     298        if (array_key_exists($header_name, $header_list)) {
     299            return $header_list[$header_name];
     300        } else {
     301            return NULL;
     302        }
    288303    }
    289304
  • simply-rets/tags/2.10.5/simply-rets.php

    r2972401 r3030379  
    55Description: Show your Real Estate listings on your Wordpress site. SimplyRETS provides a very simple set up and full control over your listings.
    66Author: SimplyRETS
    7 Version: 2.10.4
     7Version: 2.10.5
    88License: GNU General Public License v3 or later
    99
  • simply-rets/trunk/readme.txt

    r3013517 r3030379  
    44Tags: idx, rets, reso web api, mls, idx plugin, mls listings, reso, real estate, realtor, rets feed, idx feed
    55Requires at least: 3.0.1
    6 Tested up to: 6.4.2
     6Tested up to: 6.4.3
    77Stable tag: 2.10.4
    88License: GPLv3
     
    237237
    238238== Changelog ==
     239
     240= 2.10.5 =
     241* FIX: Prefer list agent "cell" field over "office" field
     242* FIX: Fix warning when listing remarks doesn't exist
     243* UPDATE: Use case-insensitive header lookup for HTTP/2 support
    239244
    240245= 2.10.4 =
  • simply-rets/trunk/simply-rets-api-helper.php

    r2972401 r3030379  
    125125        $site_url = get_site_url();
    126126
    127         $ua_string     = "SimplyRETSWP/2.10.4 Wordpress/{$wp_version} PHP/{$php_version}";
     127        $ua_string     = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}";
    128128        $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json";
    129129
     
    236236        $php_version = phpversion();
    237237
    238         $ua_string     = "SimplyRETSWP/2.10.4 Wordpress/{$wp_version} PHP/{$php_version}";
     238        $ua_string     = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}";
    239239        $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json";
    240240
     
    261261            $body   = substr( $request, $header_size );
    262262
    263             $pag_links = SimplyRetsApiHelper::srPaginationParser($header);
    264             $last_update = SimplyRetsApiHelper::srLastUpdateHeaderParser($header);
     263            $headers = http_parse_headers($header);
     264            $pag_links = SimplyRetsApiHelper::srPaginationParser($headers);
     265            $last_update = SimplyRetsApiHelper::srLastUpdateHeaderParser($headers);
    265266
    266267            // decode the reponse body
     
    313314    // and return the value
    314315    public static function srLastUpdateHeaderParser($headers) {
    315         $parsed_headers = http_parse_headers($headers);
    316         $last_update_hdr = 'X-SimplyRETS-LastUpdate';
     316        $last_update = SrUtils::getHeader($headers, 'X-SimplyRETS-LastUpdate');
    317317
    318318        // Use current timestamp if API doesn't have one
    319         if (empty($parsed_headers[$last_update_hdr])) {
     319        if (empty($last_update)) {
    320320            return date(DATE_ATOM, time());
    321321        }
    322322
    323         // Get LastUpdate header value and format the date/time
    324         $last_update = $parsed_headers[$last_update_hdr];
    325323        return $last_update;
    326324    }
    327325
    328326
    329     public static function srPaginationParser( $linkHeader ) {
     327    public static function srPaginationParser($headers) {
     328        $link_header = SrUtils::getHeader($headers, "Link");
    330329
    331330        // get link val from header
    332331        $pag_links = array();
    333         preg_match('/^Link: ([^\r\n]*)[\r\n]*$/m', $linkHeader, $matches);
     332        preg_match('/^([^\r\n]*)[\r\n]*$/m', $link_header, $matches);
    334333        unset($matches[0]);
    335334
     
    964963
    965964        if( get_option('sr_show_listing_remarks') ) {
    966             $show_remarks = false;
     965            $remarks_markup = "";
    967966        } else {
    968             $show_remarks = true;
    969967            $remarks = $listing->remarks;
    970968            $remarks_markup = <<<HTML
     
    10391037        $agent = SimplyRetsApiHelper::srDetailsTable($listing_agent_name, "Listing Agent");
    10401038
    1041         $listing_agent_phone = $has_agent_contact_info ? $listing->agent->contact->office : '';
     1039        $listing_agent_cell_phone = $has_agent_contact_info ? $listing->agent->contact->cell : '';
     1040        $listing_agent_office_phone = $has_agent_contact_info ? $listing->agent->contact->office: '';
     1041        $listing_agent_phone = $listing_agent_cell_phone
     1042                             ? $listing_agent_cell_phone
     1043                             : $listing_agent_office_phone;
    10421044        $agent_phone = SimplyRetsApiHelper::srDetailsTable($listing_agent_phone, "Listing Agent Phone");
    10431045
  • simply-rets/trunk/simply-rets-utils.php

    r2889422 r3030379  
    286286        }
    287287        return $arr;
     288    }
     289
     290    /**
     291     * Lookup header value from array.
     292     * This helper function ensures a case insensitive lookup.
     293     */
     294    public static function getHeader($headers, $header_name) {
     295        $header_name = strtolower($header_name);
     296        $header_list = array_change_key_case($headers, CASE_LOWER);
     297
     298        if (array_key_exists($header_name, $header_list)) {
     299            return $header_list[$header_name];
     300        } else {
     301            return NULL;
     302        }
    288303    }
    289304
  • simply-rets/trunk/simply-rets.php

    r2972401 r3030379  
    55Description: Show your Real Estate listings on your Wordpress site. SimplyRETS provides a very simple set up and full control over your listings.
    66Author: SimplyRETS
    7 Version: 2.10.4
     7Version: 2.10.5
    88License: GNU General Public License v3 or later
    99
Note: See TracChangeset for help on using the changeset viewer.