WordPress.org

Making WordPress.org

Ticket #470: official-wordpress-events.diff

File official-wordpress-events.diff, 1.4 KB (added by utkarshd_42, 5 years ago)

Diff for official-wordpress-events.php

Line 
114,15d13
2<
3<
428a27
5>               add_action( 'wp_ajax_nopriv_infinite_scroll' ,  array( $this, 'infinite_scroll_func' ) );
637d35
7<               
849a48
9>
1053a53,71
11>       /**
12>       * Infinite Scroll functionality added
13>       */
14>
15>       public function infinite_scroll_func() {
16>               $off =  $_POST[ 'off' ];
17>               $off = $off + 1;
18>               if ( $tempEvents = $this->get_meetup_events( $off ) ) {
19>                       usort( $tempEvents, array( $this, 'sort_events' ) );
20>                       foreach ( $tempEvents as $event ) :
21>                       echo( '
22>                       <li>
23>                               <a href="' . esc_attr( esc_url( $event->url ) ) . '">' . esc_html( $event->title ) . '</a><br />' .
24>                               esc_html( date( "l, F jS | g:i a", (int) $event->start_timestamp ) ).'<br />'.
25>                               esc_html( $event->location ) . '</li>' );
26>                       endforeach;
27>               }
28>               wp_die();
29>       }
3079a98
31>       
32107c126
33<        *
34---
35>        * @param $offset
36110c129
37<       protected function get_meetup_events() {
38---
39>       protected function get_meetup_events( $offset = 0 ) {
40112d130
41<
42116d133
43<               
44118c135
45<                       '%s2/events?group_id=%s&time=0,1m&page=%d&key=%s',
46---
47>                       '%s2/events?group_id=%s&time=0,1m&page=%d&offset=%d&key=%s',
48121a139
49>                       $offset,
50179d196
51<       
52246,248c263,264
53<
54< require_once( __DIR__ . DIRECTORY_SEPARATOR . 'official-wordpress-event.php' );
55< $GLOBALS['Official_WordPress_Events'] = new Official_WordPress_Events();
56---
57>       require_once( __DIR__ . DIRECTORY_SEPARATOR . 'official-wordpress-event.php' );
58>       $GLOBALS['Official_WordPress_Events'] = new Official_WordPress_Events();