PluginProbe
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings / 6.3.8
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings v6.3.8
7.2.1 7.2 7.1.2 7.1.1 7.1 7.0.4 7.0.6 7.0.7 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 6.3.1 trunk 5.7.3 5.7.5 5.8.1 5.8.2 5.8.3 5.8.4 5.8.6 6.0.4 6.0.5 All 36 releases
mlsimport / includes / mlsimport-provider-map.php

mlsimport-provider-map.php in MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings 6.3.8, at includes/mlsimport-provider-map.php

47 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Provider identification helpers.
4 *
5 * MLS providers are allocated by numeric mls_id range. These are pure functions
6 * (no WordPress dependency) so they can be unit tested in isolation.
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 /**
14 * Whether an mls_id belongs to a PropTx / AMPRE RESO Web API board (e.g. TRREB).
15 *
16 * PropTx boards are allocated the 9000-9999 id block, consistent with the
17 * exclusive-upper 1000-wide blocks used by the other providers.
18 *
19 * @param int|string $mls_id
20 * @return bool
21 */
22 function mlsimport_is_proptx_provider( $mls_id ) {
23 $mls_id_int = (int) $mls_id;
24 return $mls_id_int >= 9000 && $mls_id_int < 10000;
25 }
26
27 /**
28 * Normalise a stored last-import date into a full OData DateTimeOffset literal.
29 *
30 * The plugin stores the last-import marker as 'Y-m-d\TH:i' (e.g. 2026-07-01T00:00),
31 * which RESO Web API providers such as AMPRE reject in a
32 * $filter=ModificationTimestamp comparison. This produces a UTC literal with a Z
33 * offset (e.g. 2026-07-01T00:00:00.000Z). An empty input is returned unchanged so
34 * callers can keep treating '' as "no incremental marker".
35 *
36 * @param string $last_date
37 * @return string
38 */
39 function mlsimport_format_odata_modification_time( $last_date ) {
40 if ( '' === $last_date ) {
41 return '';
42 }
43
44 $date_time = new DateTime( $last_date, new DateTimeZone( 'UTC' ) );
45 return $date_time->format( 'Y-m-d\TH:i:s.000\Z' );
46 }
47