- Timestamp:
- 11/26/2020 08:44:56 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/index.php
r10469 r10470 312 312 */ 313 313 $location_name_parts = preg_split( '/\s+/u', $location_name ); 314 $location_word_count = is_array( $location_name_parts ) ? count( $location_name_parts ) : 1; 315 316 if ( ! $guess && $location_word_count >= 2 ) { 317 // Catch input like "Portland Maine" 318 $guess = guess_location_from_geonames( $location_name_parts[0], $timezone, $country_code, $wildcard = false ); 319 } 320 321 if ( ! $guess && $location_word_count >= 3 ) { 322 // Catch input like "Sao Paulo Brazil" 323 $city_name = sprintf( '%s %s', $location_name_parts[0], $location_name_parts[1] ); 324 $guess = guess_location_from_geonames( $city_name, $timezone, $country_code, $wildcard = false ); 314 $location_word_count = count( $location_name_parts ); 315 316 // Catch input like "Portland Maine" and "Sao Paulo Brazil" 317 if ( ! $guess && $location_word_count > 1 ) { 318 foreach ( range( $location_word_count - 1, 1 ) as $i ) { 319 $city_name = implode( ' ', array_slice( $location_name_parts, 0, $i ) ); 320 $guess = guess_location_from_geonames( $city_name, $timezone, $country_code, $wildcard = false ); 321 322 if ( $guess ) { 323 break; // end foreach 324 } 325 } 325 326 } 326 327 … … 386 387 mb_strlen( $location_name ) 387 388 ) ); 388 }389 390 // Strip off null bytes391 // @todo Modify geoname script to to this instead?392 if ( ! empty( $row->name ) ) {393 $row->name = trim( $row->name );394 389 } 395 390
Note: See TracChangeset
for help on using the changeset viewer.