Skip to content
Permalink
Browse files

support for partial matching of US ZIP+4 codes

  • Loading branch information...
lonvia committed Jun 19, 2013
1 parent 1fb5964 commit d5e9fc4a0390493361dd3bc58991dd75dc6ed28e
Showing with 22 additions and 0 deletions.
  1. +22 −0 website/search.php
@@ -447,6 +447,28 @@
$aValidTokens[$sToken] = $aGBPostcodeLocation;
}
}
// US ZIP+4 codes - if there is no token,
// merge in the 5-digit ZIP code
else if (!isset($aValidTokens[$sToken]) && preg_match('/^([0-9]{5}) [0-9]{4}$/', $sToken, $aData))
{
if (isset($aValidTokens[$aData[1]]))
{
foreach($aValidTokens[$aData[1]] as $aToken)
{
if (!$aToken['class'])
{
if (isset($aValidTokens[$sToken]))
{
$aValidTokens[$sToken][] = $aToken;
}
else
{
$aValidTokens[$sToken] = array($aToken);
}
}
}
}
}
}
foreach($aTokens as $sToken)

0 comments on commit d5e9fc4

Please sign in to comment.
You can’t perform that action at this time.