Simple Calendar – Google Calendar Plugin - Version 2.1.2

Version Description

  • Fixed bug with quick edit clearing out feed settings.
  • Fix bug with pagination creating extra DOM elements.
  • Localization string fixes - Pull Request by @Jojaba
  • Added HTML to group events of the same day semantically - Pull Request by @martinburchell
  • Fixed bug with [cal-id] event builder code.
  • Add in post data resets.
Download this release

Release Info

Developer pderksen
Plugin Icon 128x128 Simple Calendar – Google Calendar Plugin
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

README.txt CHANGED
@@ -87,6 +87,15 @@ There are three ways to install this plugin.
87
 
88
  == Changelog ==
89
 
 
 
 
 
 
 
 
 
 
90
  = 2.1.1 =
91
 
92
  * Fixed bug with all day events not displaying.
87
 
88
  == Changelog ==
89
 
90
+ = 2.1.2 =
91
+
92
+ * Fixed bug with quick edit clearing out feed settings.
93
+ * Fix bug with pagination creating extra DOM elements.
94
+ * Localization string fixes - Pull Request by @Jojaba
95
+ * Added HTML to group events of the same day semantically - Pull Request by @martinburchell
96
+ * Fixed bug with [cal-id] event builder code.
97
+ * Add in post data resets.
98
+
99
  = 2.1.1 =
100
 
101
  * Fixed bug with all day events not displaying.
class-google-calendar-events.php CHANGED
@@ -18,7 +18,7 @@ class Google_Calendar_Events {
18
  *
19
  * @var string
20
  */
21
- protected $version = '2.1.1';
22
 
23
  /**
24
  * Unique identifier for the plugin.
18
  *
19
  * @var string
20
  */
21
+ protected $version = '2.1.2';
22
 
23
  /**
24
  * Unique identifier for the plugin.
google-calendar-events.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Google Calendar Events
13
  * Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events
14
  * Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
15
- * Version: 2.1.1
16
  * Author: Phil Derksen
17
  * Author URI: http://philderksen.com
18
  * License: GPL-2.0+
12
  * Plugin Name: Google Calendar Events
13
  * Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events
14
  * Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
15
+ * Version: 2.1.2
16
  * Author: Phil Derksen
17
  * Author URI: http://philderksen.com
18
  * License: GPL-2.0+
includes/admin/upgrade.php CHANGED
@@ -74,6 +74,8 @@ function gce_v210_upgrade() {
74
  update_post_meta( get_the_ID(), 'gce_feed_url', $url );
75
  }
76
  }
 
 
77
  }
78
 
79
  /*
@@ -96,6 +98,8 @@ function gce_v206_upgrade() {
96
  update_post_meta( get_the_ID(), 'gce_feed_end_interval', 'years' );
97
  }
98
  }
 
 
99
  }
100
 
101
  /*
@@ -120,6 +124,8 @@ function gce_v204_upgrade() {
120
  }
121
  }
122
 
 
 
123
 
124
  // Update widgets
125
  $widget = get_option( 'widget_gce_widget' );
@@ -348,6 +354,8 @@ function update_widget_feed_ids() {
348
  }
349
  }
350
 
 
 
351
  $widget[$a][$k] = substr( $new_ids, 0, -1 );
352
  } else {
353
 
@@ -359,6 +367,8 @@ function update_widget_feed_ids() {
359
  // Set our ID to the old ID if found
360
  $id = get_the_ID();
361
  }
 
 
362
 
363
  $widget[$a][$k] = $id;
364
  }
@@ -387,4 +397,6 @@ function gce_upgrade_clear_cache() {
387
  delete_transient( 'gce_feed_' . get_the_ID() );
388
  }
389
  }
 
 
390
  }
74
  update_post_meta( get_the_ID(), 'gce_feed_url', $url );
75
  }
76
  }
77
+
78
+ wp_reset_postdata();
79
  }
80
 
81
  /*
98
  update_post_meta( get_the_ID(), 'gce_feed_end_interval', 'years' );
99
  }
100
  }
101
+
102
+ wp_reset_postdata();
103
  }
104
 
105
  /*
124
  }
125
  }
126
 
127
+ wp_reset_postdata();
128
+
129
 
130
  // Update widgets
131
  $widget = get_option( 'widget_gce_widget' );
354
  }
355
  }
356
 
357
+ wp_reset_postdata();
358
+
359
  $widget[$a][$k] = substr( $new_ids, 0, -1 );
360
  } else {
361
 
367
  // Set our ID to the old ID if found
368
  $id = get_the_ID();
369
  }
370
+
371
+ wp_reset_postdata();
372
 
373
  $widget[$a][$k] = $id;
374
  }
397
  delete_transient( 'gce_feed_' . get_the_ID() );
398
  }
399
  }
400
+
401
+ wp_reset_postdata();
402
  }
includes/class-gce-display.php CHANGED
@@ -10,26 +10,26 @@
10
  */
11
 
12
  class GCE_Display {
13
-
14
  private $feeds, $merged_feeds;
15
-
16
  public function __construct( $ids, $title_text = null, $sort_order = 'asc' ) {
17
-
18
  $this->id = $ids;
19
  $this->title = $title_text;
20
  $this->sort = $sort_order;
21
-
22
  foreach( $ids as $id ) {
23
  $this->feeds[$id] = new GCE_Feed( $id );
24
  }
25
-
26
  $this->merged_feeds = array();
27
 
28
  //Merge the feeds together into one array of events
29
  foreach ( $this->feeds as $feed_id => $feed ) {
30
  $this->merged_feeds = array_merge( $this->merged_feeds, $feed->events );
31
  }
32
-
33
  // Sort the items into date order
34
  if ( ! empty( $this->merged_feeds ) ) {
35
  usort( $this->merged_feeds, array( $this, 'compare' ) );
@@ -38,7 +38,7 @@ class GCE_Display {
38
 
39
  /**
40
  * Comparison function for use when sorting merged feed data (with usort)
41
- *
42
  * @since 2.0.0
43
  */
44
  function compare( $event1, $event2 ) {
@@ -51,24 +51,24 @@ class GCE_Display {
51
 
52
  /**
53
  * Returns array of days with events, with sub-arrays of events for that day
54
- *
55
  * @since 2.0.0
56
  */
57
  private function get_event_days() {
58
  $event_days = array();
59
-
60
  foreach ( $this->merged_feeds as $event ) {
61
  foreach ( $event->get_days() as $day ) {
62
  $event_days[$day][] = $event;
63
  }
64
  }
65
-
66
  return $event_days;
67
  }
68
-
69
  /**
70
  * Return the markup for the 'Grid' display
71
- *
72
  * @since 2.0.0
73
  */
74
  public function get_grid ( $year = null, $month = null, $widget = false, $paging = null ) {
@@ -101,7 +101,7 @@ class GCE_Display {
101
 
102
  //Get events data
103
  $event_days = $this->get_event_days();
104
-
105
  //Array of previous and next link stuff for use in gce_generate_calendar (below)
106
  foreach( $event_days as $key => $event_day ) {
107
  if( $paging === null ) {
@@ -170,9 +170,9 @@ class GCE_Display {
170
  //Ensures that gce-today CSS class is added even if there are no events for 'today'. A bit messy :(
171
  if ( ! isset( $event_days[$start] ) )
172
  $event_days[$start] = array( null, 'gce-today gce-today-no-events', null );
173
-
174
  $pn = array();
175
-
176
  if( $paging ) {
177
  // Add previous / next functionality
178
  //If there are events to display in a previous month, add previous month link
@@ -182,44 +182,44 @@ class GCE_Display {
182
  //If there are events to display in a future month, add next month link
183
  $next_key = __( 'Next', 'gce' );
184
  $next = date( 'm-Y', mktime( 0, 0, 0, $month + 1, 1, $year ) );
185
-
186
  //Array of previous and next link stuff for use in gce_generate_calendar (below)
187
  $pn = array( $prev_key => $prev, $next_key => $next );
188
  }
189
-
190
  $start_day = get_option( 'start_of_week' );
191
-
192
  //Generate the calendar markup and return it
193
  return gce_generate_calendar( $year, $month, $event_days, 1, null, $start_day, $pn, $widget );
194
  }
195
-
196
  /**
197
  * Return the markup for the 'List' display
198
- *
199
  * @since 2.0.0
200
  */
201
  public function get_list( $grouped = false, $start = null, $paging = null, $paging_interval = null, $start_offset = null, $max_events = null, $paging_type = null ) {
202
  $paging_type = $paging_type;
203
-
204
  $max_length = null;
205
-
206
  if( $paging_type == 'events' ) {
207
  $max_length = 'events';
208
  }
209
-
210
  if( $start == null ) {
211
  $start = mktime( 0, 0, 0, date( 'm', current_time( 'timestamp' ) ), 1, date( 'Y', current_time( 'timestamp' ) ) );
212
- }
213
-
214
  // Get all the event days
215
  $event_days = $this->get_event_days();
216
-
217
  $an_event_feed_id = current( $event_days );
218
  $an_event_feed_id = $an_event_feed_id[0]->feed->id;
219
-
220
  if( $paging_interval == null ) {
221
  $max_num = get_post_meta( $an_event_feed_id, 'gce_list_max_num', true );
222
-
223
  if( $paging_type == null ) {
224
  $max_length = get_post_meta( $an_event_feed_id, 'gce_list_max_length', true );
225
  $paging_type = $max_length;
@@ -229,20 +229,20 @@ class GCE_Display {
229
  if( $paging === null ) {
230
  $paging = get_post_meta( $an_event_feed_id, 'gce_paging', true );
231
  }
232
-
233
  if( $start_offset === null ) {
234
  $start_offset_num = get_post_meta( $an_event_feed_id, 'gce_list_start_offset_num', true );
235
  $start_offset_direction = get_post_meta( $an_event_feed_id, 'gce_list_start_offset_direction', true );
236
  }
237
-
238
  if( empty( $max_num ) || $max_num == 0 ) {
239
  $max_num = 7;
240
  }
241
-
242
  if( $max_length == 'days' ) {
243
  $paging_interval = $max_num * 86400;
244
  }
245
-
246
  if( $start_offset === null ) {
247
  if( $start_offset_direction == 'back' ) {
248
  $start_offset_direction = -1;
@@ -251,31 +251,31 @@ class GCE_Display {
251
  }
252
 
253
  $start_offset = $start_offset_num * 86400 * $start_offset_direction;
254
-
255
  $start = $start + $start_offset;
256
  }
257
 
258
  $start = mktime( 0, 0, 0, date( 'm', $start ), date( 'd', $start ), date( 'Y', $start ) );
259
-
260
  $end_time = $start + $paging_interval;
261
-
262
  $i = 1;
263
-
264
  $feeds = implode( $this->id, '-' );
265
-
266
  $markup = '<div class="gce-list" data-gce-start-offset="' . $start_offset . '" data-gce-start="' . ( $start + $paging_interval ) . '" data-gce-paging-interval="' . $paging_interval . '" data-gce-paging="' . $paging . '" data-gce-feeds="' . $feeds . '" data-gce-title="' . stripslashes( $this->title ) . '" data-gce-grouped="' . $grouped . '" data-gce-sort="' . $this->sort . '">' . "\n";
267
 
268
  if( ( $paging != 0 ) && $max_length != 'events' ) {
269
-
270
  $prev_text = __( 'Back', 'gce' );
271
  $next_text = __( 'Next', 'gce' );
272
-
273
  $prev_text = apply_filters( 'gce_prev_text', $prev_text );
274
  $next_text = apply_filters( 'gce_next_text', $next_text );
275
-
276
  $p = '<div class="gce-prev"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Previous month', 'gce' ) . '" data-gce-paging-direction="back" data-gce-paging-type="' . $paging_type . '">'. $prev_text . '</a></div>';
277
  $n = '<div class="gce-next"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Next month', 'gce' ) . '" data-gce-paging-direction="forward" data-gce-paging-type="' . $paging_type . '">' . $next_text . '</a></div>';
278
-
279
  $markup .= '<caption class="gce-caption">' .
280
  '<div class="gce-navbar">' .
281
  $p .
@@ -287,42 +287,43 @@ class GCE_Display {
287
  $max_count = 1;
288
  $has_events = false;
289
  $event_counter = 0;
290
-
291
  if( $max_length == 'events' ) {
292
  if( $start_offset === null ) {
293
  $time_now = current_time( 'timestamp' );
294
  } else {
295
-
296
  $time_now = current_time( 'timestamp' );
297
-
298
  $time_now = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'j', $time_now ), date( 'Y', $time_now ) ) + $start_offset;
299
-
300
  }
301
-
302
-
303
  if( $max_events == null ) {
304
  $max_events = $max_num;
305
  }
306
  }
307
-
308
  if ( $grouped ) {
309
  $markup .=
310
  '<div class="gce-list-grouped">' ;
311
  }
312
-
313
  if( $max_length != 'events' ) {
314
  $max_events = INF;
315
  }
316
  else {
317
  $end_time = INF;
318
  }
319
-
320
  foreach ( $event_days as $key => $event_day ) {
321
-
 
322
 
323
  // If this is a grouped list, generate a per-date group title with date.
324
  if( $grouped && $key >= $start && $key < $end_time && $event_counter < $max_events ) {
325
- $markup .= '<div class="gce-list-title">' . stripslashes( $this->title ) . ' ' . date_i18n( $event_day[0]->feed->date_format, $key ) . '</div>';
326
  }
327
 
328
  foreach ( $event_day as $num_in_day => $event ) {
@@ -333,13 +334,13 @@ class GCE_Display {
333
  $event->start_time > $start &&
334
  $event->start_time < $end_time )
335
  )
336
- ) ||
337
  ( $max_length == 'events' && ( $event->end_time >= $time_now && // Condition for limited by events
338
  $event_counter < $max_events )
339
  )
340
  ) {
341
-
342
- $markup .=
343
  '<div class="gce-feed gce-feed-' . $event->feed->id . '">' .
344
  //If this isn't a grouped list, generate a per-event title with date.
345
  ( ( ! $grouped ) ? ( ( isset( $this->title ) && $this->title !== '' ) )
@@ -354,14 +355,18 @@ class GCE_Display {
354
  $event_counter++;
355
  }
356
  }
357
-
 
 
 
 
358
  $max_count++;
359
  }
360
-
361
  if ( $grouped ) {
362
  $markup .= '</div>';
363
  }
364
-
365
  if( ! $has_events ) {
366
  $markup .= __( 'No events to display.', 'gce' );
367
  }
10
  */
11
 
12
  class GCE_Display {
13
+
14
  private $feeds, $merged_feeds;
15
+
16
  public function __construct( $ids, $title_text = null, $sort_order = 'asc' ) {
17
+
18
  $this->id = $ids;
19
  $this->title = $title_text;
20
  $this->sort = $sort_order;
21
+
22
  foreach( $ids as $id ) {
23
  $this->feeds[$id] = new GCE_Feed( $id );
24
  }
25
+
26
  $this->merged_feeds = array();
27
 
28
  //Merge the feeds together into one array of events
29
  foreach ( $this->feeds as $feed_id => $feed ) {
30
  $this->merged_feeds = array_merge( $this->merged_feeds, $feed->events );
31
  }
32
+
33
  // Sort the items into date order
34
  if ( ! empty( $this->merged_feeds ) ) {
35
  usort( $this->merged_feeds, array( $this, 'compare' ) );
38
 
39
  /**
40
  * Comparison function for use when sorting merged feed data (with usort)
41
+ *
42
  * @since 2.0.0
43
  */
44
  function compare( $event1, $event2 ) {
51
 
52
  /**
53
  * Returns array of days with events, with sub-arrays of events for that day
54
+ *
55
  * @since 2.0.0
56
  */
57
  private function get_event_days() {
58
  $event_days = array();
59
+
60
  foreach ( $this->merged_feeds as $event ) {
61
  foreach ( $event->get_days() as $day ) {
62
  $event_days[$day][] = $event;
63
  }
64
  }
65
+
66
  return $event_days;
67
  }
68
+
69
  /**
70
  * Return the markup for the 'Grid' display
71
+ *
72
  * @since 2.0.0
73
  */
74
  public function get_grid ( $year = null, $month = null, $widget = false, $paging = null ) {
101
 
102
  //Get events data
103
  $event_days = $this->get_event_days();
104
+
105
  //Array of previous and next link stuff for use in gce_generate_calendar (below)
106
  foreach( $event_days as $key => $event_day ) {
107
  if( $paging === null ) {
170
  //Ensures that gce-today CSS class is added even if there are no events for 'today'. A bit messy :(
171
  if ( ! isset( $event_days[$start] ) )
172
  $event_days[$start] = array( null, 'gce-today gce-today-no-events', null );
173
+
174
  $pn = array();
175
+
176
  if( $paging ) {
177
  // Add previous / next functionality
178
  //If there are events to display in a previous month, add previous month link
182
  //If there are events to display in a future month, add next month link
183
  $next_key = __( 'Next', 'gce' );
184
  $next = date( 'm-Y', mktime( 0, 0, 0, $month + 1, 1, $year ) );
185
+
186
  //Array of previous and next link stuff for use in gce_generate_calendar (below)
187
  $pn = array( $prev_key => $prev, $next_key => $next );
188
  }
189
+
190
  $start_day = get_option( 'start_of_week' );
191
+
192
  //Generate the calendar markup and return it
193
  return gce_generate_calendar( $year, $month, $event_days, 1, null, $start_day, $pn, $widget );
194
  }
195
+
196
  /**
197
  * Return the markup for the 'List' display
198
+ *
199
  * @since 2.0.0
200
  */
201
  public function get_list( $grouped = false, $start = null, $paging = null, $paging_interval = null, $start_offset = null, $max_events = null, $paging_type = null ) {
202
  $paging_type = $paging_type;
203
+
204
  $max_length = null;
205
+
206
  if( $paging_type == 'events' ) {
207
  $max_length = 'events';
208
  }
209
+
210
  if( $start == null ) {
211
  $start = mktime( 0, 0, 0, date( 'm', current_time( 'timestamp' ) ), 1, date( 'Y', current_time( 'timestamp' ) ) );
212
+ }
213
+
214
  // Get all the event days
215
  $event_days = $this->get_event_days();
216
+
217
  $an_event_feed_id = current( $event_days );
218
  $an_event_feed_id = $an_event_feed_id[0]->feed->id;
219
+
220
  if( $paging_interval == null ) {
221
  $max_num = get_post_meta( $an_event_feed_id, 'gce_list_max_num', true );
222
+
223
  if( $paging_type == null ) {
224
  $max_length = get_post_meta( $an_event_feed_id, 'gce_list_max_length', true );
225
  $paging_type = $max_length;
229
  if( $paging === null ) {
230
  $paging = get_post_meta( $an_event_feed_id, 'gce_paging', true );
231
  }
232
+
233
  if( $start_offset === null ) {
234
  $start_offset_num = get_post_meta( $an_event_feed_id, 'gce_list_start_offset_num', true );
235
  $start_offset_direction = get_post_meta( $an_event_feed_id, 'gce_list_start_offset_direction', true );
236
  }
237
+
238
  if( empty( $max_num ) || $max_num == 0 ) {
239
  $max_num = 7;
240
  }
241
+
242
  if( $max_length == 'days' ) {
243
  $paging_interval = $max_num * 86400;
244
  }
245
+
246
  if( $start_offset === null ) {
247
  if( $start_offset_direction == 'back' ) {
248
  $start_offset_direction = -1;
251
  }
252
 
253
  $start_offset = $start_offset_num * 86400 * $start_offset_direction;
254
+
255
  $start = $start + $start_offset;
256
  }
257
 
258
  $start = mktime( 0, 0, 0, date( 'm', $start ), date( 'd', $start ), date( 'Y', $start ) );
259
+
260
  $end_time = $start + $paging_interval;
261
+
262
  $i = 1;
263
+
264
  $feeds = implode( $this->id, '-' );
265
+
266
  $markup = '<div class="gce-list" data-gce-start-offset="' . $start_offset . '" data-gce-start="' . ( $start + $paging_interval ) . '" data-gce-paging-interval="' . $paging_interval . '" data-gce-paging="' . $paging . '" data-gce-feeds="' . $feeds . '" data-gce-title="' . stripslashes( $this->title ) . '" data-gce-grouped="' . $grouped . '" data-gce-sort="' . $this->sort . '">' . "\n";
267
 
268
  if( ( $paging != 0 ) && $max_length != 'events' ) {
269
+
270
  $prev_text = __( 'Back', 'gce' );
271
  $next_text = __( 'Next', 'gce' );
272
+
273
  $prev_text = apply_filters( 'gce_prev_text', $prev_text );
274
  $next_text = apply_filters( 'gce_next_text', $next_text );
275
+
276
  $p = '<div class="gce-prev"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Previous month', 'gce' ) . '" data-gce-paging-direction="back" data-gce-paging-type="' . $paging_type . '">'. $prev_text . '</a></div>';
277
  $n = '<div class="gce-next"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Next month', 'gce' ) . '" data-gce-paging-direction="forward" data-gce-paging-type="' . $paging_type . '">' . $next_text . '</a></div>';
278
+
279
  $markup .= '<caption class="gce-caption">' .
280
  '<div class="gce-navbar">' .
281
  $p .
287
  $max_count = 1;
288
  $has_events = false;
289
  $event_counter = 0;
290
+
291
  if( $max_length == 'events' ) {
292
  if( $start_offset === null ) {
293
  $time_now = current_time( 'timestamp' );
294
  } else {
295
+
296
  $time_now = current_time( 'timestamp' );
297
+
298
  $time_now = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'j', $time_now ), date( 'Y', $time_now ) ) + $start_offset;
299
+
300
  }
301
+
302
+
303
  if( $max_events == null ) {
304
  $max_events = $max_num;
305
  }
306
  }
307
+
308
  if ( $grouped ) {
309
  $markup .=
310
  '<div class="gce-list-grouped">' ;
311
  }
312
+
313
  if( $max_length != 'events' ) {
314
  $max_events = INF;
315
  }
316
  else {
317
  $end_time = INF;
318
  }
319
+
320
  foreach ( $event_days as $key => $event_day ) {
321
+
322
+ $day_markup = '';
323
 
324
  // If this is a grouped list, generate a per-date group title with date.
325
  if( $grouped && $key >= $start && $key < $end_time && $event_counter < $max_events ) {
326
+ $day_markup .= '<div class="gce-list-title">' . stripslashes( $this->title ) . ' ' . date_i18n( $event_day[0]->feed->date_format, $key ) . '</div>';
327
  }
328
 
329
  foreach ( $event_day as $num_in_day => $event ) {
334
  $event->start_time > $start &&
335
  $event->start_time < $end_time )
336
  )
337
+ ) ||
338
  ( $max_length == 'events' && ( $event->end_time >= $time_now && // Condition for limited by events
339
  $event_counter < $max_events )
340
  )
341
  ) {
342
+
343
+ $day_markup .=
344
  '<div class="gce-feed gce-feed-' . $event->feed->id . '">' .
345
  //If this isn't a grouped list, generate a per-event title with date.
346
  ( ( ! $grouped ) ? ( ( isset( $this->title ) && $this->title !== '' ) )
355
  $event_counter++;
356
  }
357
  }
358
+
359
+ if ( $day_markup != '' ) {
360
+ $markup .= '<div class="gce-event-day">' . $day_markup . '</div>';
361
+ }
362
+
363
  $max_count++;
364
  }
365
+
366
  if ( $grouped ) {
367
  $markup .= '</div>';
368
  }
369
+
370
  if( ! $has_events ) {
371
  $markup .= __( 'No events to display.', 'gce' );
372
  }
includes/class-gce-event.php CHANGED
@@ -391,8 +391,8 @@ class GCE_Event {
391
  return $m[1] . esc_html( $this->id ) . $m[6];
392
 
393
  case 'cal-id':
394
- $cal_id = explode( '/', $this->feed->feed_url );
395
- return $m[1] . esc_html( $cal_id[5] ) . $m[6];
396
 
397
  case 'if-all-day':
398
  if ( 'SWD' == $this->day_type || 'MWD' == $this->day_type )
391
  return $m[1] . esc_html( $this->id ) . $m[6];
392
 
393
  case 'cal-id':
394
+ //$cal_id = explode( '/', $this->feed->feed_url );
395
+ return $m[1] . $this->feed->calendar_id . $m[6];
396
 
397
  case 'if-all-day':
398
  if ( 'SWD' == $this->day_type || 'MWD' == $this->day_type )
includes/class-gce-feed.php CHANGED
@@ -105,7 +105,6 @@ class GCE_Feed {
105
  // Set API key
106
  $query .= '?key=' . $api_key;
107
 
108
- $args['orderBy'] = 'startTime';
109
 
110
  $args['timeMin'] = urlencode( $this->get_feed_start() );
111
 
@@ -123,7 +122,9 @@ class GCE_Feed {
123
  $args['q'] = rawurlencode( $this->search_query );
124
  }
125
 
126
- $args['singleEvents'] = 'true';
 
 
127
 
128
  $query = add_query_arg( $args, $query );
129
 
@@ -136,7 +137,7 @@ class GCE_Feed {
136
  * @since 2.0.0
137
  */
138
  private function get_feed_data( $url ) {
139
-
140
  // First check for transient data to use
141
  if( false !== get_transient( 'gce_feed_' . $this->id ) ) {
142
  $this->events = get_transient( 'gce_feed_' . $this->id );
105
  // Set API key
106
  $query .= '?key=' . $api_key;
107
 
 
108
 
109
  $args['timeMin'] = urlencode( $this->get_feed_start() );
110
 
122
  $args['q'] = rawurlencode( $this->search_query );
123
  }
124
 
125
+ if( ! empty( $this->expand_recurring ) ) {
126
+ $args['singleEvents'] = 'true';
127
+ }
128
 
129
  $query = add_query_arg( $args, $query );
130
 
137
  * @since 2.0.0
138
  */
139
  private function get_feed_data( $url ) {
140
+
141
  // First check for transient data to use
142
  if( false !== get_transient( 'gce_feed_' . $this->id ) ) {
143
  $this->events = get_transient( 'gce_feed_' . $this->id );
includes/gce-feed-cpt.php CHANGED
@@ -91,12 +91,12 @@ add_filter( 'post_updated_messages', 'gce_feed_messages' );
91
  * @since 2.0.0
92
  */
93
  function gce_cpt_meta() {
94
- add_meta_box( 'gce_feed_meta', 'Feed Settings', 'gce_display_meta', 'gce_feed', 'advanced', 'core' );
95
 
96
  // Sidebar meta box below publish section.
97
  add_meta_box( 'gce_feed_sidebar_help', __( 'Helpful Links', 'gce' ), 'gce_feed_sidebar_help', 'gce_feed', 'side', 'core' );
98
 
99
- add_meta_box( 'gce_display_options_meta', 'Display Options', 'gce_display_options_meta', 'gce_feed', 'side', 'core' );
100
  }
101
  add_action( 'add_meta_boxes', 'gce_cpt_meta' );
102
 
@@ -133,7 +133,7 @@ function gce_display_options_meta() {
133
  * @since 2.0.0
134
  */
135
  function gce_save_meta( $post_id ) {
136
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
137
  return $post_id;
138
  }
139
 
91
  * @since 2.0.0
92
  */
93
  function gce_cpt_meta() {
94
+ add_meta_box( 'gce_feed_meta', __( 'Feed Settings', 'gce' ), 'gce_display_meta', 'gce_feed', 'advanced', 'core' );
95
 
96
  // Sidebar meta box below publish section.
97
  add_meta_box( 'gce_feed_sidebar_help', __( 'Helpful Links', 'gce' ), 'gce_feed_sidebar_help', 'gce_feed', 'side', 'core' );
98
 
99
+ add_meta_box( 'gce_display_options_meta', __( 'Display Options', 'gce' ), 'gce_display_options_meta', 'gce_feed', 'side', 'core' );
100
  }
101
  add_action( 'add_meta_boxes', 'gce_cpt_meta' );
102
 
133
  * @since 2.0.0
134
  */
135
  function gce_save_meta( $post_id ) {
136
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
137
  return $post_id;
138
  }
139
 
includes/shortcodes.php CHANGED
@@ -51,6 +51,8 @@ function gce_gcal_shortcode( $attr ) {
51
  $feed_ids[$k] = get_the_ID();
52
  $v = get_the_ID();
53
  }
 
 
54
 
55
  if( empty( $display ) ) {
56
  $display = get_post_meta( $v, 'gce_display_mode', true );
51
  $feed_ids[$k] = get_the_ID();
52
  $v = get_the_ID();
53
  }
54
+
55
+ wp_reset_postdata();
56
 
57
  if( empty( $display ) ) {
58
  $display = get_post_meta( $v, 'gce_display_mode', true );
js/gce-script.js CHANGED
@@ -86,7 +86,7 @@
86
  gce_paging_type: paging_type,
87
  gce_nonce: gce.ajaxnonce
88
  }, function(data){
89
- element.parent().parent().parent().html(data);
90
  });
91
  });
92
 
86
  gce_paging_type: paging_type,
87
  gce_nonce: gce.ajaxnonce
88
  }, function(data){
89
+ element.parents('.gce-list').replaceWith(data);
90
  });
91
  });
92
 
languages/gce.pot CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Google Calendar Events\n"
4
- "POT-Creation-Date: 2014-11-19 00:09-0700\n"
5
- "PO-Revision-Date: 2014-11-19 00:10-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
@@ -84,7 +84,7 @@ msgstr ""
84
  msgid "Next"
85
  msgstr ""
86
 
87
- #: google-calendar-events/includes/class-gce-display.php:366
88
  msgid "No events to display."
89
  msgstr ""
90
 
@@ -154,13 +154,13 @@ msgid ""
154
  "Feed settings."
155
  msgstr ""
156
 
157
- #: google-calendar-events/includes/class-gce-feed.php:165
158
  msgid ""
159
  "Some data was retrieved, but could not be parsed successfully. Please ensure "
160
  "your feed settings are correct."
161
  msgstr ""
162
 
163
- #: google-calendar-events/includes/class-gce-feed.php:169
164
  msgid " Please ensure your feed URL is correct."
165
  msgstr ""
166
 
@@ -244,10 +244,18 @@ msgstr ""
244
  msgid "%4$s draft updated. %1$sView %2$s%3$s"
245
  msgstr ""
246
 
 
 
 
 
247
  #: google-calendar-events/includes/gce-feed-cpt.php:97
248
  msgid "Helpful Links"
249
  msgstr ""
250
 
 
 
 
 
251
  #: google-calendar-events/includes/gce-feed-cpt.php:217
252
  msgid "Feed ID"
253
  msgstr ""
@@ -714,6 +722,14 @@ msgstr ""
714
  msgid "Add your first feed!"
715
  msgstr ""
716
 
 
 
 
 
 
 
 
 
717
  #: google-calendar-events/views/widgets.php:211
718
  msgid "Feeds to Display (comma separated list - i.e. 101,102,103):"
719
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Google Calendar Events\n"
4
+ "POT-Creation-Date: 2014-11-21 14:10-0700\n"
5
+ "PO-Revision-Date: 2014-11-21 14:10-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
84
  msgid "Next"
85
  msgstr ""
86
 
87
+ #: google-calendar-events/includes/class-gce-display.php:371
88
  msgid "No events to display."
89
  msgstr ""
90
 
154
  "Feed settings."
155
  msgstr ""
156
 
157
+ #: google-calendar-events/includes/class-gce-feed.php:187
158
  msgid ""
159
  "Some data was retrieved, but could not be parsed successfully. Please ensure "
160
  "your feed settings are correct."
161
  msgstr ""
162
 
163
+ #: google-calendar-events/includes/class-gce-feed.php:191
164
  msgid " Please ensure your feed URL is correct."
165
  msgstr ""
166
 
244
  msgid "%4$s draft updated. %1$sView %2$s%3$s"
245
  msgstr ""
246
 
247
+ #: google-calendar-events/includes/gce-feed-cpt.php:94
248
+ msgid "Feed Settings"
249
+ msgstr ""
250
+
251
  #: google-calendar-events/includes/gce-feed-cpt.php:97
252
  msgid "Helpful Links"
253
  msgstr ""
254
 
255
+ #: google-calendar-events/includes/gce-feed-cpt.php:99
256
+ msgid "Display Options"
257
+ msgstr ""
258
+
259
  #: google-calendar-events/includes/gce-feed-cpt.php:217
260
  msgid "Feed ID"
261
  msgstr ""
722
  msgid "Add your first feed!"
723
  msgstr ""
724
 
725
+ #: google-calendar-events/views/widgets.php:197
726
+ msgid "Events on"
727
+ msgstr ""
728
+
729
+ #: google-calendar-events/views/widgets.php:206
730
+ msgid "Title:"
731
+ msgstr ""
732
+
733
  #: google-calendar-events/views/widgets.php:211
734
  msgid "Feeds to Display (comma separated list - i.e. 101,102,103):"
735
  msgstr ""
views/widgets.php CHANGED
@@ -194,7 +194,7 @@ class GCE_Widget extends WP_Widget {
194
  $display_type = ( isset( $instance['display_type'] ) ) ? $instance['display_type'] : 'grid';
195
  $order = ( isset( $instance['order'] ) ) ? $instance['order'] : 'asc';
196
  $display_title = ( isset( $instance['display_title'] ) ) ? $instance['display_title'] : true;
197
- $title_text = ( isset( $instance['display_title_text'] ) ) ? $instance['display_title_text'] : 'Events on';
198
  $paging = ( isset( $instance['paging'] ) ? $instance['paging'] : 1 );
199
  $list_max_num = ( isset( $instance['list_max_num'] ) ? $instance['list_max_num'] : 7 );
200
  $list_max_length = ( isset( $instance['list_max_length'] ) ? $instance['list_max_length'] : 'days' );
@@ -203,7 +203,7 @@ class GCE_Widget extends WP_Widget {
203
 
204
  ?>
205
  <p>
206
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
207
  <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $title; ?>" class="widefat" />
208
  </p>
209
  <p>
@@ -228,7 +228,7 @@ class GCE_Widget extends WP_Widget {
228
  </p>
229
 
230
  <p>
231
- <label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Sort Order (List View only):' ); ?></label>
232
  <select id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" class="widefat">
233
  <option value="asc" <?php selected( $order, 'asc' ); ?>><?php _e( 'Ascending', 'gce' ); ?></option>
234
  <option value="desc" <?php selected( $order, 'desc' ); ?>><?php _e( 'Descending', 'gce' ); ?></option>
194
  $display_type = ( isset( $instance['display_type'] ) ) ? $instance['display_type'] : 'grid';
195
  $order = ( isset( $instance['order'] ) ) ? $instance['order'] : 'asc';
196
  $display_title = ( isset( $instance['display_title'] ) ) ? $instance['display_title'] : true;
197
+ $title_text = ( isset( $instance['display_title_text'] ) ) ? $instance['display_title_text'] : __( 'Events on', 'gce' );
198
  $paging = ( isset( $instance['paging'] ) ? $instance['paging'] : 1 );
199
  $list_max_num = ( isset( $instance['list_max_num'] ) ? $instance['list_max_num'] : 7 );
200
  $list_max_length = ( isset( $instance['list_max_length'] ) ? $instance['list_max_length'] : 'days' );
203
 
204
  ?>
205
  <p>
206
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gce' ); ?></label>
207
  <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $title; ?>" class="widefat" />
208
  </p>
209
  <p>
228
  </p>
229
 
230
  <p>
231
+ <label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Sort Order (List View only):', 'gce' ); ?></label>
232
  <select id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" class="widefat">
233
  <option value="asc" <?php selected( $order, 'asc' ); ?>><?php _e( 'Ascending', 'gce' ); ?></option>
234
  <option value="desc" <?php selected( $order, 'desc' ); ?>><?php _e( 'Descending', 'gce' ); ?></option>