| 1 |
<?php |
| 2 |
/** |
| 3 |
* Pure resolver for the taxonomy that holds a listing's MLS status. |
| 4 |
* |
| 5 |
* No WordPress calls — safe to unit-test in isolation. |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Return the taxonomy that holds a listing's MLS status. |
| 14 |
* |
| 15 |
* Honors the user's StandardStatus field mapping (the global |
| 16 |
* mls-fields-map-taxonomy array) and falls back to the theme default when |
| 17 |
* StandardStatus is not mapped. |
| 18 |
* |
| 19 |
* @param mixed $taxonomy_map The mls-fields-map-taxonomy array (anything else is treated as unmapped). |
| 20 |
* @param string $default_taxonomy The theme's default status taxonomy. |
| 21 |
* @return string |
| 22 |
*/ |
| 23 |
function mlsimport_status_taxonomy( $taxonomy_map, $default_taxonomy ) { |
| 24 |
if ( is_array( $taxonomy_map ) && isset( $taxonomy_map['StandardStatus'] ) ) { |
| 25 |
$mapped = trim( (string) $taxonomy_map['StandardStatus'] ); |
| 26 |
if ( '' !== $mapped ) { |
| 27 |
return $mapped; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
return $default_taxonomy; |
| 32 |
} |
| 33 |
|