Making WordPress.org


Ignore:
Timestamp:
01/04/2021 11:41:00 PM (5 years ago)
Author:
iandunn
Message:

Events: Create permenant function for pinning one-off events.

This will make tasks like r10527 easier and quicker in the future.

File:
1 edited

Legend:

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

    r10546 r10548  
    236236
    237237        $events = pin_next_online_wordcamp( $events, $_SERVER['HTTP_USER_AGENT'], time() );
    238 
    239238        $events = pin_next_workshop_discussion_group( $events, $_SERVER['HTTP_USER_AGENT'] );
    240 
     239        $events = pin_one_off_events( $events, time() );
    241240        $events = remove_duplicate_events( $events );
    242 
    243         // tmp remove, only here b/c last minute
    244         if ( time() < strtotime( 'December 18, 2020' ) ) {
    245             array_unshift( $events, array(
    246                 'type'                 => 'wordcamp',
    247                 'title'                => 'State of the Word',
    248                 'url'                  => 'https://wordpress.org/news/2020/12/state-of-the-word-2020/',
    249                 'meetup'               => '',
    250                 'meetup_url'           => '',
    251                 'date'                 => '2020-12-17 00:00:00',
    252                 'end_date'             => '2020-12-17 23:00:00',
    253                 'start_unix_timestamp' => 1608195600,
    254                 'end_unix_timestamp'   => 1608267600,
    255 
    256                 'location' => array(
    257                     'location'  => 'Online',
    258                     'country'   => 'US',
    259                     'latitude'  => 29.768241024468665,
    260                     'longitude' => -95.36765276500797,
    261                 ),
    262             ) );
    263         }
    264241
    265242        // Internal location data cannot be exposed in the response, see get_location().
     
    15291506
    15301507/**
     1508 * Pin one-off events.
     1509 */
     1510function pin_one_off_events( $events, $current_time ) {
     1511    if ( $current_time < strtotime( 'December 18, 2020' ) ) {
     1512        array_unshift( $events, array(
     1513            'type'                 => 'wordcamp',
     1514            'title'                => 'State of the Word',
     1515            'url'                  => 'https://wordpress.org/news/2020/12/state-of-the-word-2020/',
     1516            'meetup'               => '',
     1517            'meetup_url'           => '',
     1518            'date'                 => '2020-12-17 00:00:00',
     1519            'end_date'             => '2020-12-17 23:00:00',
     1520            'start_unix_timestamp' => 1608195600,
     1521            'end_unix_timestamp'   => 1608267600,
     1522
     1523            'location' => array(
     1524                'location'  => 'Online',
     1525                'country'   => 'US',
     1526                'latitude'  => 29.768241024468665,
     1527                'longitude' => -95.36765276500797,
     1528            ),
     1529        ) );
     1530    }
     1531
     1532    return $events;
     1533}
     1534
     1535/**
    15311536 * Remove duplicate events, based on the URL.
    15321537 *
Note: See TracChangeset for help on using the changeset viewer.