Making WordPress.org


Ignore:
Timestamp:
09/16/2020 06:17:05 PM (6 years ago)
Author:
iandunn
Message:

Events: Apply coding standards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r10270 r10271  
    101101    $base_dir = dirname( dirname( __DIR__ ) );
    102102
    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';
    106106
    107107    if ( ! defined( 'RUNNING_TESTS' ) || ! RUNNING_TESTS ) {
    108         include( $base_dir . '/includes/object-cache.php' );
     108        include $base_dir . '/includes/object-cache.php';
    109109    }
    110110}
     
    125125
    126126    if ( isset( $_GET['country'] ) ) {
    127         $location_args['country'] = $_GET['country'];
     127        $location_args['country']             = $_GET['country'];
    128128        $location_args['restrict_by_country'] = true;
    129129    }
     
    346346
    347347    // Exact match
    348     $query = "
     348    $query = '
    349349        SELECT name, latitude, longitude, country
    350350        FROM geoname_summary
     
    355355            population DESC,
    356356            BINARY LOWER( %s ) = BINARY LOWER( name ) DESC
    357         LIMIT 1";
     357        LIMIT 1';
    358358
    359359    $prepared_query = $wpdb->prepare( $query, $location_name, $country, $timezone, $location_name );
     
    366366    // Wildcard match
    367367    if ( ! $row && $wildcard && 'ASCII' !== mb_detect_encoding( $location_name ) ) {
    368         $query = "
     368        $query = '
    369369            SELECT name, latitude, longitude, country
    370370            FROM geoname_summary
     
    375375                population DESC,
    376376                BINARY LOWER( %s ) = BINARY LOWER( LEFT( name, %d ) ) DESC
    377             LIMIT 1";
     377            LIMIT 1';
    378378
    379379        $prepared_query = $wpdb->prepare( $query, $wpdb->esc_like( $location_name ) . '%', $country, $timezone, $location_name, mb_strlen( $location_name ) );
     
    432432        $from    = 'ip2location';
    433433        $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 ) ) {
    435435        $long_ip = _ip2long_v6( $dotted_ip );
    436436        $from    = 'ipv62location';
    437         $where   = "ip_to >= CAST( %s AS DECIMAL( 39, 0 ) )";
     437        $where   = 'ip_to >= CAST( %s AS DECIMAL( 39, 0 ) )';
    438438    }
    439439
     
    496496
    497497    while ( $bits >= 0 ) {
    498         $bin = sprintf( "%08b", ( ord( $int[ $bits ] ) ) );
     498        $bin = sprintf( '%08b', ( ord( $int[ $bits ] ) ) );
    499499
    500500        if ( $ipv6long ) {
     
    541541            'description' => false,
    542542            'latitude'    => $args['latitude'],
    543             'longitude'   => $args['longitude']
     543            'longitude'   => $args['longitude'],
    544544        );
    545545    }
     
    685685            $location_name_parts[ $location_word_count - 1 ]
    686686        );
    687         $country = get_country_from_name( $country_name );
     687        $country      = get_country_from_name( $country_name );
    688688    }
    689689
     
    696696            $location_name_parts[ $location_word_count - 1 ]
    697697        );
    698         $country = get_country_from_name( $country_name );
     698        $country      = get_country_from_name( $country_name );
    699699    }
    700700
     
    783783         * in the future if that's desired. If we do that, the Codex documentation should be updated.
    784784         */
    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/' ) ",
    786786    );
    787787
     
    881881            'end_unix_timestamp'    => strtotime( $event->end_date ) - $event->date_utc_offset,
    882882
    883 
    884883            'location'   => array(
    885884                // Capitalize it for use in presentation contexts, like the Events Widget.
     
    888887                'latitude'  => (float) $event->latitude,
    889888                'longitude' => (float) $event->longitude,
    890             )
     889            ),
    891890        );
    892891    }
     
    10061005            `date_utc` <= %s
    10071006        ORDER BY `date_utc` ASC
    1008         LIMIT 1"
    1009     ;
     1007        LIMIT 1";
    10101008
    10111009    $values[] = gmdate( 'Y-m-d', time() - DAY_IN_SECONDS );
     
    13171315        'wp15', '15 year', '15 ano', '15 año', '15 candeline', 'wordt 15',
    13181316        'anniversary', 'aniversário', 'aniversario', 'birthday', 'cumpleaños',
    1319         'Tanti auguri'
     1317        'Tanti auguri',
    13201318    );
    13211319
     
    13881386                    'latitude'  => (float) $raw_camp->latitude,
    13891387                    'longitude' => (float) $raw_camp->longitude,
    1390                 )
     1388                ),
    13911389            );
    13921390
     
    14681466                    'latitude'  => (float) $raw_discussion_group->latitude,
    14691467                    'longitude' => (float) $raw_discussion_group->longitude,
    1470                 )
     1468                ),
    14711469            );
    14721470        }
     
    15681566        'latitude' => array(
    15691567            'min' => rad2deg( $minimum_lat ),
    1570             'max' => rad2deg( $maximum_lat )
     1568            'max' => rad2deg( $maximum_lat ),
    15711569        ),
    15721570        'longitude' => array(
    15731571            'min' => rad2deg( $minimum_lon ),
    1574             'max' => rad2deg( $maximum_lon )
    1575         )
     1572            'max' => rad2deg( $maximum_lon ),
     1573        ),
    15761574    );
    15771575}
Note: See TracChangeset for help on using the changeset viewer.