- Timestamp:
- 11/30/2020 03:59:30 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/index.php
r10470 r10474 348 348 // Exact match 349 349 $query = ' 350 SELECT name, latitude, longitude, country 350 SELECT name, latitude, longitude, country, type 351 351 FROM geoname_summary 352 352 WHERE name = %s … … 354 354 FIELD( %s, country ) DESC, 355 355 FIELD( %s, timezone ) DESC, 356 LEFT( type, 1 ) = "P" DESC, 356 357 population DESC, 357 358 BINARY LOWER( %s ) = BINARY LOWER( name ) DESC … … 369 370 if ( ! $row && $wildcard && 'ASCII' !== mb_detect_encoding( $location_name ) ) { 370 371 $query = ' 371 SELECT name, latitude, longitude, country 372 SELECT name, latitude, longitude, country, type 372 373 FROM geoname_summary 373 374 WHERE name LIKE %s … … 375 376 FIELD( %s, country ) DESC, 376 377 FIELD( %s, timezone ) DESC, 378 LEFT( type, 1 ) = "P" DESC, 377 379 population DESC, 378 380 BINARY LOWER( %s ) = BINARY LOWER( LEFT( name, %d ) ) DESC … … 547 549 $guess = guess_location_from_city( $args['location_name'], $args['timezone'] ?? '', $country_code ); 548 550 549 if ( $guess ) { 551 $country_types = array( 552 // See http://download.geonames.org/export/dump/featureCodes_en.txt 553 554 'A.PCL', // political entity 555 'A.PCLD', // dependent political entity 556 'A.PCLF', // freely associated state 557 'A.PCLH', // historical political entity a former political entity 558 'A.PCLI', // independent political entity 559 'A.PCLIX', // section of independent political entity 560 'A.PCLS', // semi-independent political entity 561 'A.PRSH', // parish an ecclesiastical district 562 'A.TERR', // territory 563 'A.ZN', // zone 564 ); 565 566 if ( $guess && in_array( $guess->type, $country_types, true ) ) { 567 $location = array( 568 'country' => $guess->country, 569 'description' => $guess->name, 570 ); 571 } elseif ( $guess ) { 550 572 $location = array( 551 573 'description' => $guess->name,
Note: See TracChangeset
for help on using the changeset viewer.