# mlsimport/7.2.1/includes/mlsimport-status-normalize.php

MLSImport: IDX Plugin &amp; MLS Plugin for Real Estate Listings, version 7.2.1. 33 lines.

- Page: https://pluginprobe.com/plugins/mlsimport/7.2.1/code/includes/mlsimport-status-normalize.php
- Raw: https://pluginprobe.com/plugins/mlsimport/7.2.1/raw/includes/mlsimport-status-normalize.php
- Modified: 2026-07-25T14:20:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/mlsimport/7.2.1/code/includes/mlsimport-status-normalize.php#L10-L20`.

```php
<?php
/**
 * Pure normalizer for MLS status enum values.
 *
 * Trestle's PrettyEnums=true returns spaced enum labels ("Active Under
 * Contract") while the plugin's status config and older imports store the raw
 * RESO enum ("ActiveUnderContract"). Both forms must compare equal, so every
 * status comparison funnels its operands through this normalizer: lowercase
 * and strip spaces, yielding a single stable key ("activeundercontract").
 *
 * No WordPress calls — safe to unit-test in isolation.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Reduce a status enum value to its comparison key.
 *
 * @param mixed $value Raw or PrettyEnums status value (anything non-string yields '').
 * @return string Lowercased, space-free comparison key.
 */
function mlsimport_normalize_status_enum( $value ) {
	// Non-string input has no comparable status; normalize to empty.
	if ( ! is_string( $value ) ) {
		return '';
	}

	// Trim, lowercase, then drop spaces so "Active Under Contract" == "ActiveUnderContract".
	return str_replace( ' ', '', strtolower( trim( $value ) ) );
}

```
