- Timestamp:
- 09/16/2020 06:17:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/index.php
r10270 r10271 101 101 $base_dir = dirname( dirname( __DIR__ ) ); 102 102 103 require ( $base_dir . '/init.php' );104 require ( $base_dir . '/includes/hyperdb/bb-10-hyper-db.php' );105 include ( $base_dir . '/includes/wp-json-encode.php' );103 require $base_dir . '/init.php'; 104 require $base_dir . '/includes/hyperdb/bb-10-hyper-db.php'; 105 include $base_dir . '/includes/wp-json-encode.php'; 106 106 107 107 if ( ! defined( 'RUNNING_TESTS' ) || ! RUNNING_TESTS ) { 108 include ( $base_dir . '/includes/object-cache.php' );108 include $base_dir . '/includes/object-cache.php'; 109 109 } 110 110 } … … 125 125 126 126 if ( isset( $_GET['country'] ) ) { 127 $location_args['country'] = $_GET['country'];127 $location_args['country'] = $_GET['country']; 128 128 $location_args['restrict_by_country'] = true; 129 129 } … … 346 346 347 347 // Exact match 348 $query = "348 $query = ' 349 349 SELECT name, latitude, longitude, country 350 350 FROM geoname_summary … … 355 355 population DESC, 356 356 BINARY LOWER( %s ) = BINARY LOWER( name ) DESC 357 LIMIT 1 ";357 LIMIT 1'; 358 358 359 359 $prepared_query = $wpdb->prepare( $query, $location_name, $country, $timezone, $location_name ); … … 366 366 // Wildcard match 367 367 if ( ! $row && $wildcard && 'ASCII' !== mb_detect_encoding( $location_name ) ) { 368 $query = "368 $query = ' 369 369 SELECT name, latitude, longitude, country 370 370 FROM geoname_summary … … 375 375 population DESC, 376 376 BINARY LOWER( %s ) = BINARY LOWER( LEFT( name, %d ) ) DESC 377 LIMIT 1 ";377 LIMIT 1'; 378 378 379 379 $prepared_query = $wpdb->prepare( $query, $wpdb->esc_like( $location_name ) . '%', $country, $timezone, $location_name, mb_strlen( $location_name ) ); … … 432 432 $from = 'ip2location'; 433 433 $where = 'ip_to >= %d'; 434 } else if ( filter_var( $dotted_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {434 } elseif ( filter_var( $dotted_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) { 435 435 $long_ip = _ip2long_v6( $dotted_ip ); 436 436 $from = 'ipv62location'; 437 $where = "ip_to >= CAST( %s AS DECIMAL( 39, 0 ) )";437 $where = 'ip_to >= CAST( %s AS DECIMAL( 39, 0 ) )'; 438 438 } 439 439 … … 496 496 497 497 while ( $bits >= 0 ) { 498 $bin = sprintf( "%08b", ( ord( $int[ $bits ] ) ) );498 $bin = sprintf( '%08b', ( ord( $int[ $bits ] ) ) ); 499 499 500 500 if ( $ipv6long ) { … … 541 541 'description' => false, 542 542 'latitude' => $args['latitude'], 543 'longitude' => $args['longitude'] 543 'longitude' => $args['longitude'], 544 544 ); 545 545 } … … 685 685 $location_name_parts[ $location_word_count - 1 ] 686 686 ); 687 $country = get_country_from_name( $country_name );687 $country = get_country_from_name( $country_name ); 688 688 } 689 689 … … 696 696 $location_name_parts[ $location_word_count - 1 ] 697 697 ); 698 $country = get_country_from_name( $country_name );698 $country = get_country_from_name( $country_name ); 699 699 } 700 700 … … 783 783 * in the future if that's desired. If we do that, the Codex documentation should be updated. 784 784 */ 785 "( `meetup_url` IS NULL OR `meetup_url` <> 'https://www.meetup.com/learn-wordpress-discussions/' ) " 785 "( `meetup_url` IS NULL OR `meetup_url` <> 'https://www.meetup.com/learn-wordpress-discussions/' ) ", 786 786 ); 787 787 … … 881 881 'end_unix_timestamp' => strtotime( $event->end_date ) - $event->date_utc_offset, 882 882 883 884 883 'location' => array( 885 884 // Capitalize it for use in presentation contexts, like the Events Widget. … … 888 887 'latitude' => (float) $event->latitude, 889 888 'longitude' => (float) $event->longitude, 890 ) 889 ), 891 890 ); 892 891 } … … 1006 1005 `date_utc` <= %s 1007 1006 ORDER BY `date_utc` ASC 1008 LIMIT 1" 1009 ; 1007 LIMIT 1"; 1010 1008 1011 1009 $values[] = gmdate( 'Y-m-d', time() - DAY_IN_SECONDS ); … … 1317 1315 'wp15', '15 year', '15 ano', '15 año', '15 candeline', 'wordt 15', 1318 1316 'anniversary', 'aniversário', 'aniversario', 'birthday', 'cumpleaños', 1319 'Tanti auguri' 1317 'Tanti auguri', 1320 1318 ); 1321 1319 … … 1388 1386 'latitude' => (float) $raw_camp->latitude, 1389 1387 'longitude' => (float) $raw_camp->longitude, 1390 ) 1388 ), 1391 1389 ); 1392 1390 … … 1468 1466 'latitude' => (float) $raw_discussion_group->latitude, 1469 1467 'longitude' => (float) $raw_discussion_group->longitude, 1470 ) 1468 ), 1471 1469 ); 1472 1470 } … … 1568 1566 'latitude' => array( 1569 1567 'min' => rad2deg( $minimum_lat ), 1570 'max' => rad2deg( $maximum_lat ) 1568 'max' => rad2deg( $maximum_lat ), 1571 1569 ), 1572 1570 'longitude' => array( 1573 1571 'min' => rad2deg( $minimum_lon ), 1574 'max' => rad2deg( $maximum_lon ) 1575 ) 1572 'max' => rad2deg( $maximum_lon ), 1573 ), 1576 1574 ); 1577 1575 }
Note: See TracChangeset
for help on using the changeset viewer.