Making WordPress.org

Changeset 4808


Ignore:
Timestamp:
01/27/2017 03:42:21 PM (5 years ago)
Author:
iandunn
Message:

Official WordPress Events: Clean up whitespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php

    r1799 r4808  
    11<?php
     2
    23/*
    34Plugin Name: Official WordPress Events
     
    5051    public function render_events() {
    5152        $events = $this->group_events_by_date( $this->get_all_events() );
    52        
     53
    5354        if ( $events ) {
    5455            require_once( __DIR__ . '/template-events.php' );
     
    5859    /**
    5960     * Get all official events
    60      * 
     61     *
    6162     * @return array
    6263     */
     
    6667
    6768        // todo Cache results here too, to avoid processing the raw data on each request? If so, then no longer need to cache API call results?
    68        
     69
    6970        return $events;
    7071    }
    7172
    7273    /**
    73      * Sort events based on start timestamp 
    74      * 
     74     * Sort events based on start timestamp
     75     *
    7576     * This is a callback for usort()
    76      * 
     77     *
    7778     * @param $a
    7879     * @param $b
     80     *
    7981     * @return int
    8082     */
     
    163165            }
    164166        }
    165        
     167
    166168        return $events;
    167169    }
     
    178180            return $events;
    179181        }
    180        
     182
    181183        $response = $this->remote_get( sprintf(
    182184            '%s2/events?group_id=%s&time=0,1m&page=%d&key=%s',
     
    201203                    $location = $this->format_reverse_geocode_address( $location->address_components );
    202204                }
    203                
     205
    204206                $events[] = new Official_WordPress_Event( array(
    205207                    'type'            => 'meetup',
     
    207209                    'url'             => $meetup->event_url,
    208210                    'start_timestamp' => $start_timestamp,
    209                     'end_timestamp'   => ( empty ( $meetup->duration ) ? $start_timestamp : $start_timestamp + ( $meetup->duration / 1000 ) ),  // convert to seconds
     211                    'end_timestamp'   => ( empty ( $meetup->duration ) ? $start_timestamp : $start_timestamp + ( $meetup->duration / 1000 ) ),      // convert to seconds
    210212                    'location'        => $location,
    211213                ) );
     
    215217        return $events;
    216218    }
    217    
     219
    218220    /*
    219221     * Gets the IDs of all of the meetup groups associated
     
    225227            return array();
    226228        }
    227        
     229
    228230        $response = $this->remote_get( sprintf(
    229231            '%s2/profiles?&member_id=%d&key=%s',
     
    234236
    235237        $group_ids = json_decode( wp_remote_retrieve_body( $response ) );
    236    
     238
    237239        if ( ! empty ( $group_ids->results ) ) {
    238240            $group_ids = wp_list_pluck( $group_ids->results, 'group' );
    239241            $group_ids = wp_list_pluck( $group_ids, 'id' );
    240242        }
    241        
     243
    242244        if ( ! isset( $group_ids ) || ! is_array( $group_ids ) ) {
    243245            $group_ids = array();
    244246        }
    245        
     247
    246248        return $group_ids;
    247249    }
     
    351353                } elseif ( 200 != $response['response']['code'] ) {
    352354                    // trigger_error() has a message limit of 1024 bytes, so we truncate $response['body'] to make sure that $body doesn't get truncated.
    353    
     355
    354356                    $error = sprintf(
    355357                        'Received HTTP code: %s and body: %s. Request was to: %s; Arguments were: %s',
     
    359361                        print_r( $args, true )
    360362                    );
    361                    
    362                     $response = new WP_Error( 'woe_invalid_http_response', 'Invalid HTTP response code', $response ); 
    363                 }
    364    
     363
     364                    $response = new WP_Error( 'woe_invalid_http_response', 'Invalid HTTP response code', $response );
     365                }
     366
    365367                if ( $error ) {
    366368                    $error = preg_replace( '/&key=[a-z0-9]+/i', '&key=[redacted]', $error );
    367369                    trigger_error( sprintf( '%s error for %s: %s', __METHOD__, parse_url( site_url(), PHP_URL_HOST ), sanitize_text_field( $error ) ), E_USER_WARNING );
    368    
     370
    369371                    if ( $to = apply_filters( 'owe_error_email_addresses', array() ) ) {
    370372                        wp_mail( $to, sprintf( '%s error for %s', __METHOD__, parse_url( site_url(), PHP_URL_HOST ) ), sanitize_text_field( $error ) );
Note: See TracChangeset for help on using the changeset viewer.