Changeset 3030379
- Timestamp:
- 02/02/2024 01:55:18 AM (2 years ago)
- Location:
- simply-rets
- Files:
-
- 5 edited
- 4 copied
-
tags/2.10.5 (copied) (copied from simply-rets/trunk)
-
tags/2.10.5/readme.txt (copied) (copied from simply-rets/trunk/readme.txt) (2 diffs)
-
tags/2.10.5/simply-rets-api-helper.php (copied) (copied from simply-rets/trunk/simply-rets-api-helper.php) (6 diffs)
-
tags/2.10.5/simply-rets-utils.php (modified) (1 diff)
-
tags/2.10.5/simply-rets.php (copied) (copied from simply-rets/trunk/simply-rets.php) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/simply-rets-api-helper.php (modified) (6 diffs)
-
trunk/simply-rets-utils.php (modified) (1 diff)
-
trunk/simply-rets.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simply-rets/tags/2.10.5/readme.txt
r3013517 r3030379 4 4 Tags: idx, rets, reso web api, mls, idx plugin, mls listings, reso, real estate, realtor, rets feed, idx feed 5 5 Requires at least: 3.0.1 6 Tested up to: 6.4. 26 Tested up to: 6.4.3 7 7 Stable tag: 2.10.4 8 8 License: GPLv3 … … 237 237 238 238 == 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 239 244 240 245 = 2.10.4 = -
simply-rets/tags/2.10.5/simply-rets-api-helper.php
r2972401 r3030379 125 125 $site_url = get_site_url(); 126 126 127 $ua_string = "SimplyRETSWP/2.10. 4Wordpress/{$wp_version} PHP/{$php_version}";127 $ua_string = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}"; 128 128 $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json"; 129 129 … … 236 236 $php_version = phpversion(); 237 237 238 $ua_string = "SimplyRETSWP/2.10. 4Wordpress/{$wp_version} PHP/{$php_version}";238 $ua_string = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}"; 239 239 $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json"; 240 240 … … 261 261 $body = substr( $request, $header_size ); 262 262 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); 265 266 266 267 // decode the reponse body … … 313 314 // and return the value 314 315 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'); 317 317 318 318 // Use current timestamp if API doesn't have one 319 if (empty($ parsed_headers[$last_update_hdr])) {319 if (empty($last_update)) { 320 320 return date(DATE_ATOM, time()); 321 321 } 322 322 323 // Get LastUpdate header value and format the date/time324 $last_update = $parsed_headers[$last_update_hdr];325 323 return $last_update; 326 324 } 327 325 328 326 329 public static function srPaginationParser( $linkHeader ) { 327 public static function srPaginationParser($headers) { 328 $link_header = SrUtils::getHeader($headers, "Link"); 330 329 331 330 // get link val from header 332 331 $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); 334 333 unset($matches[0]); 335 334 … … 964 963 965 964 if( get_option('sr_show_listing_remarks') ) { 966 $ show_remarks = false;965 $remarks_markup = ""; 967 966 } else { 968 $show_remarks = true;969 967 $remarks = $listing->remarks; 970 968 $remarks_markup = <<<HTML … … 1039 1037 $agent = SimplyRetsApiHelper::srDetailsTable($listing_agent_name, "Listing Agent"); 1040 1038 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; 1042 1044 $agent_phone = SimplyRetsApiHelper::srDetailsTable($listing_agent_phone, "Listing Agent Phone"); 1043 1045 -
simply-rets/tags/2.10.5/simply-rets-utils.php
r2889422 r3030379 286 286 } 287 287 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 } 288 303 } 289 304 -
simply-rets/tags/2.10.5/simply-rets.php
r2972401 r3030379 5 5 Description: Show your Real Estate listings on your Wordpress site. SimplyRETS provides a very simple set up and full control over your listings. 6 6 Author: SimplyRETS 7 Version: 2.10. 47 Version: 2.10.5 8 8 License: GNU General Public License v3 or later 9 9 -
simply-rets/trunk/readme.txt
r3013517 r3030379 4 4 Tags: idx, rets, reso web api, mls, idx plugin, mls listings, reso, real estate, realtor, rets feed, idx feed 5 5 Requires at least: 3.0.1 6 Tested up to: 6.4. 26 Tested up to: 6.4.3 7 7 Stable tag: 2.10.4 8 8 License: GPLv3 … … 237 237 238 238 == 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 239 244 240 245 = 2.10.4 = -
simply-rets/trunk/simply-rets-api-helper.php
r2972401 r3030379 125 125 $site_url = get_site_url(); 126 126 127 $ua_string = "SimplyRETSWP/2.10. 4Wordpress/{$wp_version} PHP/{$php_version}";127 $ua_string = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}"; 128 128 $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json"; 129 129 … … 236 236 $php_version = phpversion(); 237 237 238 $ua_string = "SimplyRETSWP/2.10. 4Wordpress/{$wp_version} PHP/{$php_version}";238 $ua_string = "SimplyRETSWP/2.10.5 Wordpress/{$wp_version} PHP/{$php_version}"; 239 239 $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json"; 240 240 … … 261 261 $body = substr( $request, $header_size ); 262 262 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); 265 266 266 267 // decode the reponse body … … 313 314 // and return the value 314 315 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'); 317 317 318 318 // Use current timestamp if API doesn't have one 319 if (empty($ parsed_headers[$last_update_hdr])) {319 if (empty($last_update)) { 320 320 return date(DATE_ATOM, time()); 321 321 } 322 322 323 // Get LastUpdate header value and format the date/time324 $last_update = $parsed_headers[$last_update_hdr];325 323 return $last_update; 326 324 } 327 325 328 326 329 public static function srPaginationParser( $linkHeader ) { 327 public static function srPaginationParser($headers) { 328 $link_header = SrUtils::getHeader($headers, "Link"); 330 329 331 330 // get link val from header 332 331 $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); 334 333 unset($matches[0]); 335 334 … … 964 963 965 964 if( get_option('sr_show_listing_remarks') ) { 966 $ show_remarks = false;965 $remarks_markup = ""; 967 966 } else { 968 $show_remarks = true;969 967 $remarks = $listing->remarks; 970 968 $remarks_markup = <<<HTML … … 1039 1037 $agent = SimplyRetsApiHelper::srDetailsTable($listing_agent_name, "Listing Agent"); 1040 1038 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; 1042 1044 $agent_phone = SimplyRetsApiHelper::srDetailsTable($listing_agent_phone, "Listing Agent Phone"); 1043 1045 -
simply-rets/trunk/simply-rets-utils.php
r2889422 r3030379 286 286 } 287 287 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 } 288 303 } 289 304 -
simply-rets/trunk/simply-rets.php
r2972401 r3030379 5 5 Description: Show your Real Estate listings on your Wordpress site. SimplyRETS provides a very simple set up and full control over your listings. 6 6 Author: SimplyRETS 7 Version: 2.10. 47 Version: 2.10.5 8 8 License: GNU General Public License v3 or later 9 9
Note: See TracChangeset
for help on using the changeset viewer.