Parse meetup.com event locations with USA suffix
Now the event location parser can parse the addresses with USA suffix, and removes backslashes in address normalization. Change-Id: Idc66f04395104540a13b888d4d9e2a91d9033448
This commit is contained in:
parent
8b4e819a46
commit
75d4303d31
@ -97,4 +97,13 @@ class MeetupLocationParserTest extends DrupalUnitTestCase {
|
||||
$this->assertEqual('Blue Box Group', $result['venue']);
|
||||
}
|
||||
|
||||
function testAddressPartWithSlash() {
|
||||
$location = 'Redapt Systems (12226 134th Ct Ne\, Redmond\, WA\, USA)';
|
||||
$result = _parse_meetup_location($location);
|
||||
$this->assertEqual('Redapt Systems', $result['venue']);
|
||||
$this->assertEqual('12226 134th Ct Ne', $result['address']);
|
||||
$this->assertEqual('Redmond, WA', $result['city']);
|
||||
$this->assertEqual('United States', $result['country']);
|
||||
}
|
||||
|
||||
}
|
@ -210,6 +210,9 @@ function _us_states_get_predefined_list() {
|
||||
function _match_us_location($elements) {
|
||||
$us_states = _us_states_get_predefined_list();
|
||||
$state_part = array_shift($elements);
|
||||
if ($state_part == 'USA') {
|
||||
$state_part = array_shift($elements);
|
||||
}
|
||||
if (strlen($state_part == 2)) {
|
||||
$state_code = $state_part;
|
||||
} else {
|
||||
@ -250,6 +253,7 @@ function _match_location_by_country($elements) {
|
||||
* address parts as array elements
|
||||
*/
|
||||
function _normalize_address_elements($address_part) {
|
||||
$address_part = stripslashes($address_part);
|
||||
$address_elements = explode(', ', rtrim($address_part, ')'));
|
||||
foreach ($address_elements as $k => $v) {
|
||||
$address_elements[$k] = trim($v);
|
||||
|
Loading…
Reference in New Issue
Block a user