Simple Calendar – Google Calendar Plugin - Version 3.0.16

Version Description

  • March 30, 2016 =

  • Fix: Multiple events at the same time on a grouped calendar should now show correctly.

  • Fix: PHP notice when adding a new calendar should no longer appear.

  • Fix: Issues with Carbon fatal error should not happen.

Download this release

Release Info

Developer nickyoung87
Plugin Icon 128x128 Simple Calendar – Google Calendar Plugin
Version 3.0.16
Comparing to
See all releases

Code changes from version 3.0.15 to 3.0.16

assets/css/admin-activation.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/css/admin-add-calendar.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/css/admin.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/css/default-calendar-grid.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/css/default-calendar-list.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/js/admin-add-calendar.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/js/admin.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
assets/js/default-calendar.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.0.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.0.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2016
4
  * Licensed GPLv2+ */
google-calendar-events.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Calendar
4
  * Plugin URI: https://simplecalendar.io
5
  * Description: Add Google Calendar events to your WordPress site in minutes. Beautiful calendar displays. Fully responsive.
6
- * Version: 3.0.15
7
  * Author: Moonstone Media
8
  * Author URI: https://simplecalendar.io
9
  * Text Domain: google-calendar-events
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  $this_plugin_path = trailingslashit( dirname( __FILE__ ) );
23
  $this_plugin_dir = plugin_dir_url( __FILE__ );
24
  $this_plugin_constants = array(
25
- 'SIMPLE_CALENDAR_VERSION' => '3.0.15',
26
  'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
27
  'SIMPLE_CALENDAR_URL' => $this_plugin_dir,
28
  'SIMPLE_CALENDAR_ASSETS' => $this_plugin_dir . 'assets/',
3
  * Plugin Name: Simple Calendar
4
  * Plugin URI: https://simplecalendar.io
5
  * Description: Add Google Calendar events to your WordPress site in minutes. Beautiful calendar displays. Fully responsive.
6
+ * Version: 3.0.16
7
  * Author: Moonstone Media
8
  * Author URI: https://simplecalendar.io
9
  * Text Domain: google-calendar-events
22
  $this_plugin_path = trailingslashit( dirname( __FILE__ ) );
23
  $this_plugin_dir = plugin_dir_url( __FILE__ );
24
  $this_plugin_constants = array(
25
+ 'SIMPLE_CALENDAR_VERSION' => '3.0.16',
26
  'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
27
  'SIMPLE_CALENDAR_URL' => $this_plugin_dir,
28
  'SIMPLE_CALENDAR_ASSETS' => $this_plugin_dir . 'assets/',
includes/admin/metaboxes/settings.php CHANGED
@@ -238,193 +238,193 @@ class Settings implements Meta_Box {
238
  ?>
239
  <table>
240
  <thead>
241
- <tr><th colspan="2"><?php _e( 'Events setting', 'google-calendar-events' ); ?></th></tr>
242
  </thead>
243
  <tbody class="simcal-panel-section simcal-panel-section-events-range">
244
- <tr class="simcal-panel-field">
245
- <th><label for="_calendar_begins"><?php _e( 'Calendar start', 'google-calendar-events' ); ?></label></th>
246
- <td>
247
- <?php
248
-
249
- $calendar_begins = esc_attr( get_post_meta( $post->ID, '_calendar_begins', true ) );
250
- $calendar_begins_nth = max( absint( get_post_meta( $post->ID, '_calendar_begins_nth', true ) ), 1 );
251
- $calendar_begins_nth_show = in_array( $calendar_begins, array(
252
- 'days_before',
253
- 'days_after',
254
- 'weeks_before',
255
- 'weeks_after',
256
- 'months_before',
257
- 'months_after',
258
- 'years_before',
259
- 'years_after',
260
- ) );
261
-
262
- simcal_print_field( array(
263
- 'type' => 'standard',
264
- 'subtype' => 'number',
265
- 'name' => '_calendar_begins_nth',
266
- 'id' => '_calendar_begins_nth',
267
- 'value' => strval( $calendar_begins_nth ),
268
- 'attributes' => array(
269
- 'min' => '1',
270
- ),
271
- 'class' => array(
272
- 'simcal-field-inline',
273
- 'simcal-field-tiny',
274
- ),
275
- 'style' => ! $calendar_begins_nth_show ? array( 'display' => 'none' ) : '',
276
- ) );
277
-
278
- ?>
279
- <select name="_calendar_begins"
280
- id="_calendar_begins"
281
- class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
282
- <optgroup label="<?php _e( 'Days', 'google-calendar-events' ); ?>">
283
- <option value="today"
284
- data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
285
- <?php selected( 'today', $calendar_begins, true ); ?>><?php _e( 'Today', 'google-calendar-events' ); ?></option>
286
- <option value="now"
287
- data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
288
- <?php selected( 'now', $calendar_begins, true ); ?>><?php _e( 'Now', 'google-calendar-events' ); ?></option>
289
- <option value="days_before"
290
- data-hide-field="_calendar_begins_custom_date"
291
- data-show-field="_calendar_begins_nth" <?php selected( 'days_before', $calendar_begins, true ); ?>><?php _e( 'Day(s) before today', 'google-calendar-events' ); ?></option>
292
- <option value="days_after"
293
- data-hide-field="_calendar_begins_custom_date"
294
- data-show-field="_calendar_begins_nth" <?php selected( 'days_after', $calendar_begins, true ); ?>><?php _e( 'Day(s) after today', 'google-calendar-events' ); ?></option>
295
- </optgroup>
296
- <optgroup label="<?php _e( 'Weeks', 'google-calendar-events' ); ?>">
297
- <option value="this_week"
298
- data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
299
- <?php selected( 'this_week', $calendar_begins, true ); ?>><?php _e( 'This week', 'google-calendar-events' ); ?></option>
300
- <option value="weeks_before"
301
- data-hide-field="_calendar_begins_custom_date"
302
- data-show-field="_calendar_begins_nth" <?php selected( 'weeks_before', $calendar_begins, true ); ?>><?php _e( 'Week(s) before current', 'google-calendar-events' ); ?></option>
303
- <option value="weeks_after"
304
- data-hide-field="_calendar_begins_custom_date"
305
- data-show-field="_calendar_begins_nth" <?php selected( 'weeks_after', $calendar_begins, true ); ?>><?php _e( 'Week(s) after current', 'google-calendar-events' ); ?></option>
306
- </optgroup>
307
- <optgroup label="<?php _e( 'Months', 'google-calendar-events' ); ?>">
308
- <option value="this_month"
309
- data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
310
- <?php selected( 'this_month', $calendar_begins, true ); ?>><?php _e( 'This month', 'google-calendar-events' ); ?></option>
311
- <option value="months_before"
312
- data-hide-field="_calendar_begins_custom_date"
313
- data-show-field="_calendar_begins_nth" <?php selected( 'months_before', $calendar_begins, true ); ?>><?php _e( 'Month(s) before current', 'google-calendar-events' ); ?></option>
314
- <option value="months_after"
315
- data-hide-field="_calendar_begins_custom_date"
316
- data-show-field="_calendar_begins_nth" <?php selected( 'months_after', $calendar_begins, true ); ?>><?php _e( 'Month(s) after current', 'google-calendar-events' ); ?></option>
317
- </optgroup>
318
- <optgroup label="<?php _e( 'Years', 'google-calendar-events' ); ?>">
319
- <option value="this_year"
320
- data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
321
- <?php selected( 'this_year', $calendar_begins, true ); ?>><?php _e( 'This year', 'google-calendar-events' ); ?></option>
322
- <option value="years_before"
323
- data-show-field="_calendar_begins_nth" <?php selected( 'years_before', $calendar_begins, true ); ?>><?php _e( 'Year(s) before current', 'google-calendar-events' ); ?></option>
324
- <option value="years_after"
325
- data-hide-field="_calendar_begins_custom_date"
326
- data-show-field="_calendar_begins_nth" <?php selected( 'years_after', $calendar_begins, true ); ?>><?php _e( 'Year(s) after current', 'google-calendar-events' ); ?></option>
327
- </optgroup>
328
- <optgroup label="<?php _e( 'Other', 'google-calendar-events' ); ?>">
329
- <option value="custom_date"
330
- data-hide-field="_calendar_begins_nth"
331
- data-show-field="_calendar_begins_custom_date" <?php selected( 'custom_date', $calendar_begins, true ); ?>><?php _e( 'Specific date', 'google-calendar-events' ); ?></option>
332
- </optgroup>
333
- </select>
334
- <?php
335
-
336
- simcal_print_field( array(
337
- 'type' => 'date-picker',
338
- 'name' => '_calendar_begins_custom_date',
339
- 'id' => '_calendar_begins_custom_date',
340
- 'value' => get_post_meta( $post->ID, '_calendar_begins_custom_date', true ),
341
- 'class' => array(
342
- 'simcal-field-inline',
343
- ),
344
- 'style' => 'custom_date' != $calendar_begins ? array( 'display' => 'none' ) : '',
345
- ) );
346
-
347
- ?>
348
- <i class="simcal-icon-help simcal-help-tip"
349
- data-tip="<?php _e( 'The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events' ); ?>"></i>
350
- </td>
351
- </tr>
352
- <tr class="simcal-panel-field">
353
- <th><label for="_feed_earliest_event_date"><?php _e( 'Earliest event', 'google-calendar-events' ); ?></label></th>
354
- <td>
355
- <?php
356
-
357
- $earliest_event_saved = get_post_meta( $post->ID, '_feed_earliest_event_date', true );
358
- $earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr( $earliest_event_saved );
359
-
360
- simcal_print_field( array(
361
- 'type' => 'standard',
362
- 'subtype' => 'number',
363
- 'name' => '_feed_earliest_event_date_range',
364
- 'id' => '_feed_earliest_event_date_range',
365
- 'value' => strval( max( absint( get_post_meta( $post->ID, '_feed_earliest_event_date_range', true ) ), 1 ) ),
366
- 'attributes' => array(
367
- 'min' => '1',
368
- ),
369
- 'class' => array(
370
- 'simcal-field-inline',
371
- 'simcal-field-tiny',
372
- ),
373
- 'style' => ( 'now' != $earliest_event ) && ( 'today' != $earliest_event ) ? array( 'display' => 'none' ) : '',
374
- ) );
375
-
376
- ?>
377
- <select name="_feed_earliest_event_date"
378
- id="_feed_earliest_event_date"
379
- class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
380
- <option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Same as start date', 'google-calendar-events' ); ?></option>
381
- <option value="days_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'days_before', $earliest_event, true ); ?>><?php _e( 'Day(s) before start date', 'google-calendar-events' ); ?></option>
382
- <option value="weeks_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'weeks_before', $earliest_event, true ); ?>><?php _e( 'Week(s) before start date', 'google-calendar-events' ); ?></option>
383
- <option value="months_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'months_before', $earliest_event, true ); ?>><?php _e( 'Month(s) before start date', 'google-calendar-events' ); ?></option>
384
- <option value="years_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'years_before', $earliest_event, true ); ?>><?php _e( 'Year(s) before start date', 'google-calendar-events' ); ?></option>
385
- </select>
386
- <i class="simcal-icon-help simcal-help-tip"
387
- data-tip="<?php _e( 'Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events' ); ?>"></i>
388
- </td>
389
- </tr>
390
- <tr class="simcal-panel-field">
391
- <th><label for="_feed_latest_event_date"><?php _e( 'Latest event', 'google-calendar-events' ); ?></label></th>
392
- <td>
393
- <?php
394
-
395
- $latest_event_saved = get_post_meta( $post->ID, '_feed_latest_event_date', true );
396
- $latest_event = false == $latest_event_saved ? 'years_after' : esc_attr( $latest_event_saved );
397
-
398
- simcal_print_field( array(
399
- 'type' => 'standard',
400
- 'subtype' => 'number',
401
- 'name' => '_feed_latest_event_date_range',
402
- 'id' => '_feed_latest_event_date_range',
403
- 'value' => strval( max( absint( get_post_meta( $post->ID, '_feed_latest_event_date_range', true ) ), 1 ) ),
404
- 'attributes' => array(
405
- 'min' => '1',
406
- ),
407
- 'class' => array(
408
- 'simcal-field-inline',
409
- 'simcal-field-tiny',
410
- ),
411
- 'style' => 'indefinite' != $latest_event ? array( 'display' => 'none' ) : '',
412
- ) );
413
-
414
- ?>
415
- <select name="_feed_latest_event_date"
416
- id="_feed_latest_event_date"
417
- class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
418
- <option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Day end of start date', 'google-calendar-events' ); ?></option>
419
- <option value="days_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'days_after', $latest_event, true ); ?>><?php _e( 'Day(s) after start date', 'google-calendar-events' ); ?></option>
420
- <option value="weeks_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'weeks_after', $latest_event, true ); ?>><?php _e( 'Weeks(s) after start date', 'google-calendar-events' ); ?></option>
421
- <option value="months_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'months_after', $latest_event, true ); ?>><?php _e( 'Month(s) after start date', 'google-calendar-events' ); ?></option>
422
- <option value="years_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'years_after', $latest_event, true ); ?>><?php _e( 'Year(s) after start date', 'google-calendar-events' ); ?></option>
423
- </select>
424
- <i class="simcal-icon-help simcal-help-tip"
425
- data-tip="<?php _e( 'Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events' ); ?>"></i>
426
- </td>
427
- </tr>
428
  </tbody>
429
  </table>
430
  <?php
@@ -444,67 +444,67 @@ class Settings implements Meta_Box {
444
  ?>
445
  <table>
446
  <thead>
447
- <tr><th colspan="2"><?php _e( 'Miscellaneous', 'google-calendar-events' ); ?></th></tr>
448
  </thead>
449
  <tbody class="simcal-panel-section">
450
- <tr class="simcal-panel-field">
451
- <th><label for="_calendar_is_static"><?php _e( 'Static calendar', 'google-calendar-events' ); ?></label></th>
452
- <td>
453
- <?php
454
-
455
- $fixed = get_post_meta( $post->ID, '_calendar_is_static', true );
456
-
457
- simcal_print_field( array(
458
- 'type' => 'checkbox',
459
- 'name' => '_calendar_is_static',
460
- 'id' => '_calendar_is_static',
461
- 'tooltip' => __( 'Remove the navigation arrows and fix the calendar view to its initial state.', 'google-calendar-events' ),
462
- 'value' => 'yes' == $fixed ? 'yes' : 'no',
463
- ) );
464
-
465
- ?>
466
- </td>
467
- </tr>
468
- <tr class="simcal-panel-field">
469
- <th><label for="_no_events_message"><?php _e( 'No events message', 'google-calendar-events' ); ?></label></th>
470
- <td>
471
- <?php
472
-
473
- simcal_print_field( array(
474
- 'type' => 'textarea',
475
- 'name' => '_no_events_message',
476
- 'id' => '_no_events_message',
477
- 'tooltip' => __( 'Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events' ),
478
- 'value' => get_post_meta( $post->ID, '_no_events_message', true ),
479
- ) );
480
-
481
- ?>
482
- </td>
483
- </tr>
484
- <tr class="simcal-panel-field">
485
- <th><label for="_event_formatting"><?php _e( 'Event Formatting', 'google-calendar-events' ); ?></label></th>
486
- <td>
487
- <?php
488
-
489
- $event_formatting = get_post_meta( $post->ID, '_event_formatting', true );
490
-
491
- simcal_print_field( array(
492
- 'type' => 'select',
493
- 'name' => '_event_formatting',
494
- 'id' => '_event_formatting',
495
- 'tooltip' => __( 'How to preserve line breaks and paragraphs in the event template builder.', 'google-calendar-events' ),
496
- 'value' => $event_formatting,
497
- 'default' => 'preserve_linebreaks',
498
- 'options' => array(
499
- 'preserve_linebreaks' => __( 'Preserve line breaks, auto paragraphs (default)', 'google-calendar-events' ),
500
- 'no_linebreaks' => __( 'No line breaks, auto paragraphs', 'google-calendar-events' ),
501
- 'none' => __( 'No line breaks, no auto paragraphs', 'google-calendar-events' ),
502
- ),
503
- ) );
504
-
505
- ?>
506
- </td>
507
- </tr>
508
  </tbody>
509
  </table>
510
  <?php
@@ -524,232 +524,238 @@ class Settings implements Meta_Box {
524
  ?>
525
  <table>
526
  <thead>
527
- <tr><th colspan="2"><?php _e( 'Date and Time', 'google-calendar-events' ); ?></th></tr>
528
  </thead>
529
  <tbody class="simcal-panel-section simcal-panel-datetime-formatting">
530
- <tr class="simcal-panel-field">
531
- <th><label for="_calendar_timezone_setting"><?php _e( 'Timezone', 'google-calendar-events' ); ?></label></th>
532
- <td>
533
- <?php
534
-
535
- $timezone_wordpress = simcal_get_wp_timezone();
536
- $timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC';
537
- $timezone_setting = esc_attr( get_post_meta( $post->ID, '_feed_timezone_setting', true ) );
538
- $timezone = esc_attr( get_post_meta( $post->ID, '_feed_timezone', true ) );
539
- $timezone = $timezone ? $timezone : $timezone_default;
540
- $show_use_calendar = simcal_get_feed( $post )->type !== 'grouped-calendars';
541
-
542
- ?>
543
- <select name="_feed_timezone_setting"
544
- id="_feed_timezone_setting"
545
- class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-other"
546
- data-show-field-on-choice="true">
547
- <option value="use_site" <?php selected( 'use_site', $timezone_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', $timezone_default ); ?></option>
548
- <?php if ( $show_use_calendar ) { ?>
549
- <option id="use_calendar" value="use_calendar" <?php selected( 'use_calendar', $timezone_setting, true ); ?>><?php _ex( 'Event source default', 'Use the calendar default setting', 'google-calendar-events' ); ?></option>
550
- <?php } ?>
551
- <option value="use_custom" data-show-field="_feed_timezone" <?php selected( 'use_custom', $timezone_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
552
- </select>
553
- <select name="_feed_timezone"
554
- id="_feed_timezone"
555
- class="simcal-field simcal-field-select simcal-field-inline"
556
- <?php echo 'use_custom' != $timezone_setting ? 'style="display: none;"' : ''; ?>>
557
- <?php echo wp_timezone_choice( $timezone ); ?>
558
- </select>
559
- <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Using a different timezone may alter the date and time display of your calendar events. It is recommended to use the site default option.', 'google-calendar-events' ); ?>"></i>
560
- <p id="_use_calendar_warning" class="simcal-field">
561
- <?php printf( __( '<strong>Note:</strong> Timezone settings can be changed in several places within your Google calendars. <a href="%s" target="_blank">See details here</a>', 'google-calendar-events' ), 'http://docs.simplecalendar.io/timezone-settings/' ); ?>
562
- </p>
563
- </td>
564
- </tr>
565
- <tr class="simcal-panel-field">
566
- <th><label for="_calendar_date_format_setting"><?php _e( 'Date format', 'google-calendar-events' ); ?></label></th>
567
- <td>
568
- <?php
569
-
570
- $date_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_setting', true ) );
571
- $date_format_default = esc_attr( get_option( 'date_format' ) );
572
- $date_format = esc_attr( get_post_meta( $post->ID, '_calendar_date_format', true ) );
573
- $date_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_php', true ) );
574
- $date_format_php = $date_format_php ? $date_format_php : $date_format_default;
575
-
576
- ?>
577
- <select name="_calendar_date_format_setting"
578
- id="_calendar_date_format_setting"
579
- class="simcal-field simcal-field-select simcal-field-show-other">
580
- <option value="use_site" data-show-field="_calendar_date_format_default" <?php selected( 'use_site', $date_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
581
- <option value="use_custom" data-show-field="_calendar_date_format" <?php selected( 'use_custom', $date_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
582
- <option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected( 'use_custom_php', $date_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
583
- </select>
584
- <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
585
- <p id="_calendar_date_format_default" style="<?php echo $date_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
586
  <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
587
- <code><?php echo date_i18n( $date_format_default, time() ); ?></code>
588
  </p>
589
- <?php simcal_print_field( array(
590
- 'type' => 'datetime-format',
591
- 'subtype' => 'date',
592
- 'name' => '_calendar_date_format',
593
- 'id' => '_calendar_date_format',
594
- 'value' => $date_format,
595
- 'style' => $date_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
596
- ) ); ?>
597
- <div class="simcal-field-datetime-format-php" id="_calendar_date_format_php_field" style="<?php echo $date_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
598
- <br>
599
- <label for="_calendar_date_format_php">
600
- <input type="text"
601
- name="_calendar_date_format_php"
602
- id="_calendar_date_format_php"
603
- class="simcal-field simcal-field-text simcal-field-small"
604
- value="<?php echo $date_format_php; ?>" />
605
- <?php printf( __( 'Enter a date format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
606
- </label>
607
- <p>
608
- <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
609
- <code><?php echo date_i18n( $date_format_php, time() ); ?></code>
610
- </p>
611
- </div>
612
- </td>
613
- </tr>
614
- <tr class="simcal-panel-field">
615
- <th><label for="_calendar_datetime_separator"><?php _e( 'Separator', 'google-calendar-events' ); ?></label></th>
616
- <td>
617
- <?php
618
-
619
- $separator = get_post_meta( $post->ID, '_calendar_datetime_separator', true );
620
- $separator = false == $separator ? '@' : $separator;
621
-
622
- simcal_print_field( array(
623
- 'type' => 'standard',
624
- 'subtype' => 'text',
625
- 'name' => '_calendar_datetime_separator',
626
- 'id' => '_calendar_datetime_separator',
627
- 'value' => $separator,
628
- 'tooltip' => __( 'Used to divide date and time when both are shown.', 'google-calendar-events' ),
629
- 'class' => array(
630
- 'simcal-field-tiny',
631
- ),
632
- ) );
633
-
634
- ?>
635
- </td>
636
- </tr>
637
- <tr class="simcal-panel-field">
638
- <th><label for="_calendar_time_format_setting"><?php _e( 'Time format', 'google-calendar-events' ); ?></label></th>
639
- <td>
640
- <?php
641
-
642
- $time_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_setting', true ) );
643
- $time_format_default = esc_attr( get_option( 'time_format' ) );
644
- $time_format = esc_attr( get_post_meta( $post->ID, '_calendar_time_format', true ) );
645
- $time_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_php', true ) );
646
- $time_format_php = $time_format_php ? $time_format_php : $time_format_default;
647
-
648
- ?>
649
- <select name="_calendar_time_format_setting"
650
- id="_calendar_time_format_setting"
651
- class="simcal-field simcal-field-select simcal-field-show-other">
652
- <option value="use_site" data-show-field="_calendar_time_format_default" <?php selected( 'use_site', $time_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
653
- <option value="use_custom" data-show-field="_calendar_time_format" <?php selected( 'use_custom', $time_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
654
- <option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected( 'use_custom_php', $time_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
655
- </select>
656
- <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
657
- <p id="_calendar_time_format_default" style="<?php echo $time_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
658
  <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
659
- <code><?php echo date_i18n( $time_format_default, time() ); ?></code>
660
  </p>
661
- <?php simcal_print_field( array(
662
- 'type' => 'datetime-format',
663
- 'subtype' => 'time',
664
- 'name' => '_calendar_time_format',
665
- 'id' => '_calendar_time_format',
666
- 'value' => $time_format,
667
- 'style' => $time_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
668
- ) ); ?>
669
- <div class="simcal-field-datetime-format-php" id="_calendar_time_format_php_field" style="<?php echo $time_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
670
- <br>
671
- <label for="_calendar_date_format_php">
672
- <input type="text"
673
- name="_calendar_time_format_php"
674
- id="_calendar_time_format_php"
675
- class="simcal-field simcal-field-text simcal-field-small"
676
- value="<?php echo $time_format_php; ?>"/>
677
- <?php printf( __( 'Enter a time format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
678
- </label>
679
- <p>
680
- <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
681
- <code><?php echo date_i18n( $time_format_php, time() ); ?></code>
682
- </p>
683
- </div>
684
- </td>
685
- </tr>
686
- <tr class="simcal-panel-field">
687
- <th><label for="_calendar_week_starts_on_setting"><?php _e( 'Week starts on', 'google-calendar-events' ); ?></label></th>
688
- <td>
689
- <?php
690
-
691
- $week_starts_setting = esc_attr( get_post_meta( $post->ID, '_calendar_week_starts_on_setting', true ) );
692
- $week_starts_default = esc_attr( get_option( 'start_of_week' ) );
693
- $week_starts = intval( get_post_meta( $post->ID, '_calendar_week_starts_on', true ) );
694
- $week_starts = is_numeric( $week_starts ) ? strval( $week_starts ) : $week_starts_default;
695
-
696
- ?>
697
- <select
698
- name="_calendar_week_starts_on_setting"
699
- id="_calendar_week_starts_on_setting"
700
- class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
701
- data-show-next-if-value="use_custom">
702
- <option value="use_site" <?php selected( 'use_site', $week_starts_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', date_i18n( 'l', strtotime( "Sunday + $week_starts_default Days" ) ) ); ?></option>
703
- <option value="use_custom" <?php selected( 'use_custom', $week_starts_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
704
- </select>
705
- <select
706
- name="_calendar_week_starts_on"
707
- id="_calendar_week_starts_on"
708
- class="simcal-field simcal-field-select simcal-field-inline"
709
- <?php echo 'use_custom' != $week_starts_setting ? 'style="display: none;"' : ''; ?>>
710
- <?php $day_names = simcal_get_calendar_names_i18n( 'day', 'full' ); ?>
711
- <?php for ( $i = 0; $i <= 6; $i++ ) : ?>
712
- <option value="<?php echo $i; ?>" <?php selected( $i, $week_starts, true ); ?>><?php echo $day_names[ $i ]; ?></option>
713
- <?php endfor; ?>
714
- </select>
715
- <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events' ); ?>"></i>
716
- </td>
717
- </tr>
718
  </tbody>
719
  </table>
720
  <table>
721
  <thead>
722
- <tr><th colspan="2"><?php _e( 'Cache', 'google-calendar-events' ); ?></th></tr>
723
  </thead>
724
  <tbody class="simcal-panel-section simcal-panel-section-cache">
725
- <?php
726
 
727
- $cache_freq = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_amount', true ) );
728
- $cache_unit = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_unit', true ) );
729
- $cache_freq = is_int( $cache_freq ) && $cache_freq >= 0 ? $cache_freq : '2';
730
- $cache_unit = $cache_unit ? $cache_unit : '3600';
731
 
732
- ?>
733
- <tr class="simcal-panel-field">
734
- <th><label for="_feed_cache_user_amount"><?php _ex( 'Refresh interval', 'Cache maximum interval', 'google-calendar-events' ); ?></label></th>
735
- <td>
736
- <input type="number"
737
- name="_feed_cache_user_amount"
738
- id="_feed_cache_user_amount"
739
- class="simcal-field simcal-field-number simcal-field-tiny simcal-field-inline"
740
- value="<?php echo $cache_freq; ?>"
741
- min="0" />
742
- <select name="_feed_cache_user_unit"
743
- id="_feed_cache_user_unit"
744
- class="simcal-field simcalfield-select simcal-field-inline">
745
- <option value="60" <?php selected( '60', $cache_unit, true ); ?>><?php _e( 'Minute(s)', 'google-calendar-events' ); ?></option>
746
- <option value="3600" <?php selected( '3600', $cache_unit, true ); ?>><?php _e( 'Hour(s)', 'google-calendar-events' ); ?></option>
747
- <option value="86400" <?php selected( '86400', $cache_unit, true ); ?>><?php _e( 'Day(s)', 'google-calendar-events' ); ?></option>
748
- <option value="604800" <?php selected( '604800', $cache_unit, true ); ?>><?php _e( 'Week(s)', 'google-calendar-events' ); ?></option>
749
- </select>
750
- <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events' ); ?>"></i>
751
- </td>
752
- </tr>
753
  </tbody>
754
  </table>
755
  <?php
@@ -774,20 +780,20 @@ class Settings implements Meta_Box {
774
 
775
  ?>
776
  <tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr( $section ); ?>">
777
- <?php foreach ( $fields as $key => $field ) :
778
 
779
- $value = get_post_meta( $post_id, $key, true );
780
- $field['value'] = $value ? $value : ( isset( $field['default'] ) ? $field['default'] : '' );
781
- $the_field = simcal_get_field( $field ); ?>
782
 
783
- <?php if ( $the_field instanceof Field ) : ?>
784
- <tr class="simcal-panel-field">
785
- <th><label for="<?php echo $the_field->id ?>"><?php echo $the_field->title; ?></label></th>
786
- <td><?php $the_field->html(); ?></td>
787
- </tr>
788
- <?php endif; ?>
789
 
790
- <?php endforeach; ?>
791
  </tbody>
792
  <?php
793
 
238
  ?>
239
  <table>
240
  <thead>
241
+ <tr><th colspan="2"><?php _e( 'Events setting', 'google-calendar-events' ); ?></th></tr>
242
  </thead>
243
  <tbody class="simcal-panel-section simcal-panel-section-events-range">
244
+ <tr class="simcal-panel-field">
245
+ <th><label for="_calendar_begins"><?php _e( 'Calendar start', 'google-calendar-events' ); ?></label></th>
246
+ <td>
247
+ <?php
248
+
249
+ $calendar_begins = esc_attr( get_post_meta( $post->ID, '_calendar_begins', true ) );
250
+ $calendar_begins_nth = max( absint( get_post_meta( $post->ID, '_calendar_begins_nth', true ) ), 1 );
251
+ $calendar_begins_nth_show = in_array( $calendar_begins, array(
252
+ 'days_before',
253
+ 'days_after',
254
+ 'weeks_before',
255
+ 'weeks_after',
256
+ 'months_before',
257
+ 'months_after',
258
+ 'years_before',
259
+ 'years_after',
260
+ ) );
261
+
262
+ simcal_print_field( array(
263
+ 'type' => 'standard',
264
+ 'subtype' => 'number',
265
+ 'name' => '_calendar_begins_nth',
266
+ 'id' => '_calendar_begins_nth',
267
+ 'value' => strval( $calendar_begins_nth ),
268
+ 'attributes' => array(
269
+ 'min' => '1',
270
+ ),
271
+ 'class' => array(
272
+ 'simcal-field-inline',
273
+ 'simcal-field-tiny',
274
+ ),
275
+ 'style' => ! $calendar_begins_nth_show ? array( 'display' => 'none' ) : '',
276
+ ) );
277
+
278
+ ?>
279
+ <select name="_calendar_begins"
280
+ id="_calendar_begins"
281
+ class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
282
+ <optgroup label="<?php _e( 'Days', 'google-calendar-events' ); ?>">
283
+ <option value="today"
284
+ data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
285
+ <?php selected( 'today', $calendar_begins, true ); ?>><?php _e( 'Today', 'google-calendar-events' ); ?></option>
286
+ <option value="now"
287
+ data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
288
+ <?php selected( 'now', $calendar_begins, true ); ?>><?php _e( 'Now', 'google-calendar-events' ); ?></option>
289
+ <option value="days_before"
290
+ data-hide-field="_calendar_begins_custom_date"
291
+ data-show-field="_calendar_begins_nth" <?php selected( 'days_before', $calendar_begins, true ); ?>><?php _e( 'Day(s) before today', 'google-calendar-events' ); ?></option>
292
+ <option value="days_after"
293
+ data-hide-field="_calendar_begins_custom_date"
294
+ data-show-field="_calendar_begins_nth" <?php selected( 'days_after', $calendar_begins, true ); ?>><?php _e( 'Day(s) after today', 'google-calendar-events' ); ?></option>
295
+ </optgroup>
296
+ <optgroup label="<?php _e( 'Weeks', 'google-calendar-events' ); ?>">
297
+ <option value="this_week"
298
+ data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
299
+ <?php selected( 'this_week', $calendar_begins, true ); ?>><?php _e( 'This week', 'google-calendar-events' ); ?></option>
300
+ <option value="weeks_before"
301
+ data-hide-field="_calendar_begins_custom_date"
302
+ data-show-field="_calendar_begins_nth" <?php selected( 'weeks_before', $calendar_begins, true ); ?>><?php _e( 'Week(s) before current', 'google-calendar-events' ); ?></option>
303
+ <option value="weeks_after"
304
+ data-hide-field="_calendar_begins_custom_date"
305
+ data-show-field="_calendar_begins_nth" <?php selected( 'weeks_after', $calendar_begins, true ); ?>><?php _e( 'Week(s) after current', 'google-calendar-events' ); ?></option>
306
+ </optgroup>
307
+ <optgroup label="<?php _e( 'Months', 'google-calendar-events' ); ?>">
308
+ <option value="this_month"
309
+ data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
310
+ <?php selected( 'this_month', $calendar_begins, true ); ?>><?php _e( 'This month', 'google-calendar-events' ); ?></option>
311
+ <option value="months_before"
312
+ data-hide-field="_calendar_begins_custom_date"
313
+ data-show-field="_calendar_begins_nth" <?php selected( 'months_before', $calendar_begins, true ); ?>><?php _e( 'Month(s) before current', 'google-calendar-events' ); ?></option>
314
+ <option value="months_after"
315
+ data-hide-field="_calendar_begins_custom_date"
316
+ data-show-field="_calendar_begins_nth" <?php selected( 'months_after', $calendar_begins, true ); ?>><?php _e( 'Month(s) after current', 'google-calendar-events' ); ?></option>
317
+ </optgroup>
318
+ <optgroup label="<?php _e( 'Years', 'google-calendar-events' ); ?>">
319
+ <option value="this_year"
320
+ data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
321
+ <?php selected( 'this_year', $calendar_begins, true ); ?>><?php _e( 'This year', 'google-calendar-events' ); ?></option>
322
+ <option value="years_before"
323
+ data-show-field="_calendar_begins_nth" <?php selected( 'years_before', $calendar_begins, true ); ?>><?php _e( 'Year(s) before current', 'google-calendar-events' ); ?></option>
324
+ <option value="years_after"
325
+ data-hide-field="_calendar_begins_custom_date"
326
+ data-show-field="_calendar_begins_nth" <?php selected( 'years_after', $calendar_begins, true ); ?>><?php _e( 'Year(s) after current', 'google-calendar-events' ); ?></option>
327
+ </optgroup>
328
+ <optgroup label="<?php _e( 'Other', 'google-calendar-events' ); ?>">
329
+ <option value="custom_date"
330
+ data-hide-field="_calendar_begins_nth"
331
+ data-show-field="_calendar_begins_custom_date" <?php selected( 'custom_date', $calendar_begins, true ); ?>><?php _e( 'Specific date', 'google-calendar-events' ); ?></option>
332
+ </optgroup>
333
+ </select>
334
+ <?php
335
+
336
+ simcal_print_field( array(
337
+ 'type' => 'date-picker',
338
+ 'name' => '_calendar_begins_custom_date',
339
+ 'id' => '_calendar_begins_custom_date',
340
+ 'value' => get_post_meta( $post->ID, '_calendar_begins_custom_date', true ),
341
+ 'class' => array(
342
+ 'simcal-field-inline',
343
+ ),
344
+ 'style' => 'custom_date' != $calendar_begins ? array( 'display' => 'none' ) : '',
345
+ ) );
346
+
347
+ ?>
348
+ <i class="simcal-icon-help simcal-help-tip"
349
+ data-tip="<?php _e( 'The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events' ); ?>"></i>
350
+ </td>
351
+ </tr>
352
+ <tr class="simcal-panel-field">
353
+ <th><label for="_feed_earliest_event_date"><?php _e( 'Earliest event', 'google-calendar-events' ); ?></label></th>
354
+ <td>
355
+ <?php
356
+
357
+ $earliest_event_saved = get_post_meta( $post->ID, '_feed_earliest_event_date', true );
358
+ $earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr( $earliest_event_saved );
359
+
360
+ simcal_print_field( array(
361
+ 'type' => 'standard',
362
+ 'subtype' => 'number',
363
+ 'name' => '_feed_earliest_event_date_range',
364
+ 'id' => '_feed_earliest_event_date_range',
365
+ 'value' => strval( max( absint( get_post_meta( $post->ID, '_feed_earliest_event_date_range', true ) ), 1 ) ),
366
+ 'attributes' => array(
367
+ 'min' => '1',
368
+ ),
369
+ 'class' => array(
370
+ 'simcal-field-inline',
371
+ 'simcal-field-tiny',
372
+ ),
373
+ 'style' => ( 'now' != $earliest_event ) && ( 'today' != $earliest_event ) ? array( 'display' => 'none' ) : '',
374
+ ) );
375
+
376
+ ?>
377
+ <select name="_feed_earliest_event_date"
378
+ id="_feed_earliest_event_date"
379
+ class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
380
+ <option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Same as start date', 'google-calendar-events' ); ?></option>
381
+ <option value="days_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'days_before', $earliest_event, true ); ?>><?php _e( 'Day(s) before start date', 'google-calendar-events' ); ?></option>
382
+ <option value="weeks_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'weeks_before', $earliest_event, true ); ?>><?php _e( 'Week(s) before start date', 'google-calendar-events' ); ?></option>
383
+ <option value="months_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'months_before', $earliest_event, true ); ?>><?php _e( 'Month(s) before start date', 'google-calendar-events' ); ?></option>
384
+ <option value="years_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'years_before', $earliest_event, true ); ?>><?php _e( 'Year(s) before start date', 'google-calendar-events' ); ?></option>
385
+ </select>
386
+ <i class="simcal-icon-help simcal-help-tip"
387
+ data-tip="<?php _e( 'Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events' ); ?>"></i>
388
+ </td>
389
+ </tr>
390
+ <tr class="simcal-panel-field">
391
+ <th><label for="_feed_latest_event_date"><?php _e( 'Latest event', 'google-calendar-events' ); ?></label></th>
392
+ <td>
393
+ <?php
394
+
395
+ $latest_event_saved = get_post_meta( $post->ID, '_feed_latest_event_date', true );
396
+ $latest_event = false == $latest_event_saved ? 'years_after' : esc_attr( $latest_event_saved );
397
+
398
+ simcal_print_field( array(
399
+ 'type' => 'standard',
400
+ 'subtype' => 'number',
401
+ 'name' => '_feed_latest_event_date_range',
402
+ 'id' => '_feed_latest_event_date_range',
403
+ 'value' => strval( max( absint( get_post_meta( $post->ID, '_feed_latest_event_date_range', true ) ), 1 ) ),
404
+ 'attributes' => array(
405
+ 'min' => '1',
406
+ ),
407
+ 'class' => array(
408
+ 'simcal-field-inline',
409
+ 'simcal-field-tiny',
410
+ ),
411
+ 'style' => 'indefinite' != $latest_event ? array( 'display' => 'none' ) : '',
412
+ ) );
413
+
414
+ ?>
415
+ <select name="_feed_latest_event_date"
416
+ id="_feed_latest_event_date"
417
+ class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
418
+ <option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Day end of start date', 'google-calendar-events' ); ?></option>
419
+ <option value="days_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'days_after', $latest_event, true ); ?>><?php _e( 'Day(s) after start date', 'google-calendar-events' ); ?></option>
420
+ <option value="weeks_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'weeks_after', $latest_event, true ); ?>><?php _e( 'Weeks(s) after start date', 'google-calendar-events' ); ?></option>
421
+ <option value="months_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'months_after', $latest_event, true ); ?>><?php _e( 'Month(s) after start date', 'google-calendar-events' ); ?></option>
422
+ <option value="years_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'years_after', $latest_event, true ); ?>><?php _e( 'Year(s) after start date', 'google-calendar-events' ); ?></option>
423
+ </select>
424
+ <i class="simcal-icon-help simcal-help-tip"
425
+ data-tip="<?php _e( 'Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events' ); ?>"></i>
426
+ </td>
427
+ </tr>
428
  </tbody>
429
  </table>
430
  <?php
444
  ?>
445
  <table>
446
  <thead>
447
+ <tr><th colspan="2"><?php _e( 'Miscellaneous', 'google-calendar-events' ); ?></th></tr>
448
  </thead>
449
  <tbody class="simcal-panel-section">
450
+ <tr class="simcal-panel-field">
451
+ <th><label for="_calendar_is_static"><?php _e( 'Static calendar', 'google-calendar-events' ); ?></label></th>
452
+ <td>
453
+ <?php
454
+
455
+ $fixed = get_post_meta( $post->ID, '_calendar_is_static', true );
456
+
457
+ simcal_print_field( array(
458
+ 'type' => 'checkbox',
459
+ 'name' => '_calendar_is_static',
460
+ 'id' => '_calendar_is_static',
461
+ 'tooltip' => __( 'Remove the navigation arrows and fix the calendar view to its initial state.', 'google-calendar-events' ),
462
+ 'value' => 'yes' == $fixed ? 'yes' : 'no',
463
+ ) );
464
+
465
+ ?>
466
+ </td>
467
+ </tr>
468
+ <tr class="simcal-panel-field">
469
+ <th><label for="_no_events_message"><?php _e( 'No events message', 'google-calendar-events' ); ?></label></th>
470
+ <td>
471
+ <?php
472
+
473
+ simcal_print_field( array(
474
+ 'type' => 'textarea',
475
+ 'name' => '_no_events_message',
476
+ 'id' => '_no_events_message',
477
+ 'tooltip' => __( 'Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events' ),
478
+ 'value' => get_post_meta( $post->ID, '_no_events_message', true ),
479
+ ) );
480
+
481
+ ?>
482
+ </td>
483
+ </tr>
484
+ <tr class="simcal-panel-field">
485
+ <th><label for="_event_formatting"><?php _e( 'Event Formatting', 'google-calendar-events' ); ?></label></th>
486
+ <td>
487
+ <?php
488
+
489
+ $event_formatting = get_post_meta( $post->ID, '_event_formatting', true );
490
+
491
+ simcal_print_field( array(
492
+ 'type' => 'select',
493
+ 'name' => '_event_formatting',
494
+ 'id' => '_event_formatting',
495
+ 'tooltip' => __( 'How to preserve line breaks and paragraphs in the event template builder.', 'google-calendar-events' ),
496
+ 'value' => $event_formatting,
497
+ 'default' => 'preserve_linebreaks',
498
+ 'options' => array(
499
+ 'preserve_linebreaks' => __( 'Preserve line breaks, auto paragraphs (default)', 'google-calendar-events' ),
500
+ 'no_linebreaks' => __( 'No line breaks, auto paragraphs', 'google-calendar-events' ),
501
+ 'none' => __( 'No line breaks, no auto paragraphs', 'google-calendar-events' ),
502
+ ),
503
+ ) );
504
+
505
+ ?>
506
+ </td>
507
+ </tr>
508
  </tbody>
509
  </table>
510
  <?php
524
  ?>
525
  <table>
526
  <thead>
527
+ <tr><th colspan="2"><?php _e( 'Date and Time', 'google-calendar-events' ); ?></th></tr>
528
  </thead>
529
  <tbody class="simcal-panel-section simcal-panel-datetime-formatting">
530
+ <tr class="simcal-panel-field">
531
+ <th><label for="_calendar_timezone_setting"><?php _e( 'Timezone', 'google-calendar-events' ); ?></label></th>
532
+ <td>
533
+ <?php
534
+
535
+ $timezone_wordpress = simcal_get_wp_timezone();
536
+ $timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC';
537
+ $timezone_setting = esc_attr( get_post_meta( $post->ID, '_feed_timezone_setting', true ) );
538
+ $timezone = esc_attr( get_post_meta( $post->ID, '_feed_timezone', true ) );
539
+ $timezone = $timezone ? $timezone : $timezone_default;
540
+ $show_use_calendar = isset( simcal_get_feed( $post )->type );
541
+
542
+ if ( $show_use_calendar ) {
543
+ $show_use_calendar = ( simcal_get_feed( $post )->type !== 'grouped-calendars' ? 1 : 0 );
544
+ } else {
545
+ $show_use_calendar = true;
546
+ }
547
+
548
+ ?>
549
+ <select name="_feed_timezone_setting"
550
+ id="_feed_timezone_setting"
551
+ class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-other"
552
+ data-show-field-on-choice="true">
553
+ <option value="use_site" <?php selected( 'use_site', $timezone_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', $timezone_default ); ?></option>
554
+ <?php if ( $show_use_calendar ) { ?>
555
+ <option id="use_calendar" value="use_calendar" data-show-field="_use_calendar_warning" <?php selected( 'use_calendar', $timezone_setting, true ); ?>><?php _ex( 'Events source default', 'Use the calendar default setting', 'google-calendar-events' ); ?></option>
556
+ <?php } ?>
557
+ <option value="use_custom" data-show-field="_feed_timezone" <?php selected( 'use_custom', $timezone_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
558
+ </select>
559
+ <select name="_feed_timezone"
560
+ id="_feed_timezone"
561
+ class="simcal-field simcal-field-select simcal-field-inline"
562
+ <?php echo 'use_custom' != $timezone_setting ? 'style="display: none;"' : ''; ?>>
563
+ <?php echo wp_timezone_choice( $timezone ); ?>
564
+ </select>
565
+ <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events' ); ?>"></i>
566
+ <p id="_use_calendar_warning" style="display: none;" class="simcal-field">
567
+ <?php printf( __( '<strong>Warning:</strong> Using this option can return unexpected results if you have specified <a href="%s" target="_blank">event level</a> timezones.', 'google-calendar-events' ), 'http://docs.simplecalendar.io/timezone-settings/' ); ?>
568
+ </p>
569
+ </td>
570
+ </tr>
571
+ <tr class="simcal-panel-field">
572
+ <th><label for="_calendar_date_format_setting"><?php _e( 'Date format', 'google-calendar-events' ); ?></label></th>
573
+ <td>
574
+ <?php
575
+
576
+ $date_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_setting', true ) );
577
+ $date_format_default = esc_attr( get_option( 'date_format' ) );
578
+ $date_format = esc_attr( get_post_meta( $post->ID, '_calendar_date_format', true ) );
579
+ $date_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_php', true ) );
580
+ $date_format_php = $date_format_php ? $date_format_php : $date_format_default;
581
+
582
+ ?>
583
+ <select name="_calendar_date_format_setting"
584
+ id="_calendar_date_format_setting"
585
+ class="simcal-field simcal-field-select simcal-field-show-other">
586
+ <option value="use_site" data-show-field="_calendar_date_format_default" <?php selected( 'use_site', $date_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
587
+ <option value="use_custom" data-show-field="_calendar_date_format" <?php selected( 'use_custom', $date_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
588
+ <option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected( 'use_custom_php', $date_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
589
+ </select>
590
+ <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
591
+ <p id="_calendar_date_format_default" style="<?php echo $date_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
592
+ <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
593
+ <code><?php echo date_i18n( $date_format_default, time() ); ?></code>
594
+ </p>
595
+ <?php simcal_print_field( array(
596
+ 'type' => 'datetime-format',
597
+ 'subtype' => 'date',
598
+ 'name' => '_calendar_date_format',
599
+ 'id' => '_calendar_date_format',
600
+ 'value' => $date_format,
601
+ 'style' => $date_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
602
+ ) ); ?>
603
+ <div class="simcal-field-datetime-format-php" id="_calendar_date_format_php_field" style="<?php echo $date_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
604
+ <br>
605
+ <label for="_calendar_date_format_php">
606
+ <input type="text"
607
+ name="_calendar_date_format_php"
608
+ id="_calendar_date_format_php"
609
+ class="simcal-field simcal-field-text simcal-field-small"
610
+ value="<?php echo $date_format_php; ?>" />
611
+ <?php printf( __( 'Enter a date format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
612
+ </label>
613
+ <p>
614
  <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
615
+ <code><?php echo date_i18n( $date_format_php, time() ); ?></code>
616
  </p>
617
+ </div>
618
+ </td>
619
+ </tr>
620
+ <tr class="simcal-panel-field">
621
+ <th><label for="_calendar_datetime_separator"><?php _e( 'Separator', 'google-calendar-events' ); ?></label></th>
622
+ <td>
623
+ <?php
624
+
625
+ $separator = get_post_meta( $post->ID, '_calendar_datetime_separator', true );
626
+ $separator = false == $separator ? '@' : $separator;
627
+
628
+ simcal_print_field( array(
629
+ 'type' => 'standard',
630
+ 'subtype' => 'text',
631
+ 'name' => '_calendar_datetime_separator',
632
+ 'id' => '_calendar_datetime_separator',
633
+ 'value' => $separator,
634
+ 'tooltip' => __( 'Used to divide date and time when both are shown.', 'google-calendar-events' ),
635
+ 'class' => array(
636
+ 'simcal-field-tiny',
637
+ ),
638
+ ) );
639
+
640
+ ?>
641
+ </td>
642
+ </tr>
643
+ <tr class="simcal-panel-field">
644
+ <th><label for="_calendar_time_format_setting"><?php _e( 'Time format', 'google-calendar-events' ); ?></label></th>
645
+ <td>
646
+ <?php
647
+
648
+ $time_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_setting', true ) );
649
+ $time_format_default = esc_attr( get_option( 'time_format' ) );
650
+ $time_format = esc_attr( get_post_meta( $post->ID, '_calendar_time_format', true ) );
651
+ $time_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_php', true ) );
652
+ $time_format_php = $time_format_php ? $time_format_php : $time_format_default;
653
+
654
+ ?>
655
+ <select name="_calendar_time_format_setting"
656
+ id="_calendar_time_format_setting"
657
+ class="simcal-field simcal-field-select simcal-field-show-other">
658
+ <option value="use_site" data-show-field="_calendar_time_format_default" <?php selected( 'use_site', $time_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
659
+ <option value="use_custom" data-show-field="_calendar_time_format" <?php selected( 'use_custom', $time_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
660
+ <option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected( 'use_custom_php', $time_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
661
+ </select>
662
+ <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
663
+ <p id="_calendar_time_format_default" style="<?php echo $time_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
664
+ <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
665
+ <code><?php echo date_i18n( $time_format_default, time() ); ?></code>
666
+ </p>
667
+ <?php simcal_print_field( array(
668
+ 'type' => 'datetime-format',
669
+ 'subtype' => 'time',
670
+ 'name' => '_calendar_time_format',
671
+ 'id' => '_calendar_time_format',
672
+ 'value' => $time_format,
673
+ 'style' => $time_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
674
+ ) ); ?>
675
+ <div class="simcal-field-datetime-format-php" id="_calendar_time_format_php_field" style="<?php echo $time_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
676
+ <br>
677
+ <label for="_calendar_date_format_php">
678
+ <input type="text"
679
+ name="_calendar_time_format_php"
680
+ id="_calendar_time_format_php"
681
+ class="simcal-field simcal-field-text simcal-field-small"
682
+ value="<?php echo $time_format_php; ?>"/>
683
+ <?php printf( __( 'Enter a time format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
684
+ </label>
685
+ <p>
686
  <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
687
+ <code><?php echo date_i18n( $time_format_php, time() ); ?></code>
688
  </p>
689
+ </div>
690
+ </td>
691
+ </tr>
692
+ <tr class="simcal-panel-field">
693
+ <th><label for="_calendar_week_starts_on_setting"><?php _e( 'Week starts on', 'google-calendar-events' ); ?></label></th>
694
+ <td>
695
+ <?php
696
+
697
+ $week_starts_setting = esc_attr( get_post_meta( $post->ID, '_calendar_week_starts_on_setting', true ) );
698
+ $week_starts_default = esc_attr( get_option( 'start_of_week' ) );
699
+ $week_starts = intval( get_post_meta( $post->ID, '_calendar_week_starts_on', true ) );
700
+ $week_starts = is_numeric( $week_starts ) ? strval( $week_starts ) : $week_starts_default;
701
+
702
+ ?>
703
+ <select
704
+ name="_calendar_week_starts_on_setting"
705
+ id="_calendar_week_starts_on_setting"
706
+ class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
707
+ data-show-next-if-value="use_custom">
708
+ <option value="use_site" <?php selected( 'use_site', $week_starts_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', date_i18n( 'l', strtotime( "Sunday + $week_starts_default Days" ) ) ); ?></option>
709
+ <option value="use_custom" <?php selected( 'use_custom', $week_starts_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
710
+ </select>
711
+ <select
712
+ name="_calendar_week_starts_on"
713
+ id="_calendar_week_starts_on"
714
+ class="simcal-field simcal-field-select simcal-field-inline"
715
+ <?php echo 'use_custom' != $week_starts_setting ? 'style="display: none;"' : ''; ?>>
716
+ <?php $day_names = simcal_get_calendar_names_i18n( 'day', 'full' ); ?>
717
+ <?php for ( $i = 0; $i <= 6; $i++ ) : ?>
718
+ <option value="<?php echo $i; ?>" <?php selected( $i, $week_starts, true ); ?>><?php echo $day_names[ $i ]; ?></option>
719
+ <?php endfor; ?>
720
+ </select>
721
+ <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events' ); ?>"></i>
722
+ </td>
723
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  </tbody>
725
  </table>
726
  <table>
727
  <thead>
728
+ <tr><th colspan="2"><?php _e( 'Cache', 'google-calendar-events' ); ?></th></tr>
729
  </thead>
730
  <tbody class="simcal-panel-section simcal-panel-section-cache">
731
+ <?php
732
 
733
+ $cache_freq = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_amount', true ) );
734
+ $cache_unit = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_unit', true ) );
735
+ $cache_freq = is_int( $cache_freq ) && $cache_freq >= 0 ? $cache_freq : '2';
736
+ $cache_unit = $cache_unit ? $cache_unit : '3600';
737
 
738
+ ?>
739
+ <tr class="simcal-panel-field">
740
+ <th><label for="_feed_cache_user_amount"><?php _ex( 'Refresh interval', 'Cache maximum interval', 'google-calendar-events' ); ?></label></th>
741
+ <td>
742
+ <input type="number"
743
+ name="_feed_cache_user_amount"
744
+ id="_feed_cache_user_amount"
745
+ class="simcal-field simcal-field-number simcal-field-tiny simcal-field-inline"
746
+ value="<?php echo $cache_freq; ?>"
747
+ min="0" />
748
+ <select name="_feed_cache_user_unit"
749
+ id="_feed_cache_user_unit"
750
+ class="simcal-field simcalfield-select simcal-field-inline">
751
+ <option value="60" <?php selected( '60', $cache_unit, true ); ?>><?php _e( 'Minute(s)', 'google-calendar-events' ); ?></option>
752
+ <option value="3600" <?php selected( '3600', $cache_unit, true ); ?>><?php _e( 'Hour(s)', 'google-calendar-events' ); ?></option>
753
+ <option value="86400" <?php selected( '86400', $cache_unit, true ); ?>><?php _e( 'Day(s)', 'google-calendar-events' ); ?></option>
754
+ <option value="604800" <?php selected( '604800', $cache_unit, true ); ?>><?php _e( 'Week(s)', 'google-calendar-events' ); ?></option>
755
+ </select>
756
+ <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events' ); ?>"></i>
757
+ </td>
758
+ </tr>
759
  </tbody>
760
  </table>
761
  <?php
780
 
781
  ?>
782
  <tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr( $section ); ?>">
783
+ <?php foreach ( $fields as $key => $field ) :
784
 
785
+ $value = get_post_meta( $post_id, $key, true );
786
+ $field['value'] = $value ? $value : ( isset( $field['default'] ) ? $field['default'] : '' );
787
+ $the_field = simcal_get_field( $field ); ?>
788
 
789
+ <?php if ( $the_field instanceof Field ) : ?>
790
+ <tr class="simcal-panel-field">
791
+ <th><label for="<?php echo $the_field->id ?>"><?php echo $the_field->title; ?></label></th>
792
+ <td><?php $the_field->html(); ?></td>
793
+ </tr>
794
+ <?php endif; ?>
795
 
796
+ <?php endforeach; ?>
797
  </tbody>
798
  <?php
799
 
includes/feeds/grouped-calendars.php CHANGED
@@ -129,10 +129,7 @@ class Grouped_Calendars extends Feed {
129
  // When merging the arrays together some of the events will be lost because the keys are the same and one will overwrite the other
130
  // This snippet checks if the key already exists in the master events array and if it does it subtracts 1 from it to make the key unique and then unsets the original key.
131
  foreach( $calendar->events as $k => $v ) {
132
- if ( array_key_exists( $k, $events ) ) {
133
- $calendar->events[ $k - 1 ] = $v;
134
- unset( $k );
135
- }
136
  }
137
 
138
  $events = is_array( $calendar->events ) ? $events + $calendar->events : $events;
@@ -169,6 +166,18 @@ class Grouped_Calendars extends Feed {
169
  return $events;
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /**
173
  * uasort helper to sort events by start time.
174
  *
129
  // When merging the arrays together some of the events will be lost because the keys are the same and one will overwrite the other
130
  // This snippet checks if the key already exists in the master events array and if it does it subtracts 1 from it to make the key unique and then unsets the original key.
131
  foreach( $calendar->events as $k => $v ) {
132
+ $calendar->events[ $this->update_array_timestamp( $events, $k ) ] = $v;
 
 
 
133
  }
134
 
135
  $events = is_array( $calendar->events ) ? $events + $calendar->events : $events;
166
  return $events;
167
  }
168
 
169
+ /*
170
+ * Recursive function to adjust the timestamp array indices that are the same.
171
+ */
172
+ public function update_array_timestamp( $arr, $i ) {
173
+
174
+ if ( array_key_exists( $i, $arr ) ) {
175
+ $i = $this->update_array_timestamp( $arr, $i - 1 );
176
+ }
177
+
178
+ return $i;
179
+ }
180
+
181
  /**
182
  * uasort helper to sort events by start time.
183
  *
includes/functions/shared.php CHANGED
@@ -227,7 +227,7 @@ function simcal_get_calendar_names_i18n( $group, $style = 'full' ) {
227
  $format = '';
228
  $length = 0;
229
 
230
- $date = Carbon\Carbon::now();
231
 
232
  if ( 'month' == $group ) {
233
  $date->month( 0 )->startOfMonth();
227
  $format = '';
228
  $length = 0;
229
 
230
+ $date = \Carbon\Carbon::now();
231
 
232
  if ( 'month' == $group ) {
233
  $date->month( 0 )->startOfMonth();
includes/objects.php CHANGED
@@ -204,7 +204,14 @@ class Objects {
204
  return $this->get_object( $feed_name, 'feed', $object );
205
  } elseif ( $object instanceof \WP_Post ) {
206
  $calendar = $this->get_calendar( $object );
207
- return $this->get_object( $calendar->feed, 'feed', $calendar );
 
 
 
 
 
 
 
208
  } elseif ( isset( $object->feed ) && isset( $object->id ) ) {
209
  return $this->get_object( $object->feed, 'feed', $object );
210
  }
204
  return $this->get_object( $feed_name, 'feed', $object );
205
  } elseif ( $object instanceof \WP_Post ) {
206
  $calendar = $this->get_calendar( $object );
207
+
208
+ if ( isset( $calendar->feed ) ) {
209
+ return $this->get_object( $calendar->feed, 'feed', $calendar );
210
+ } else {
211
+ return null;
212
+ }
213
+
214
+
215
  } elseif ( isset( $object->feed ) && isset( $object->id ) ) {
216
  return $this->get_object( $object->feed, 'feed', $object );
217
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: moonstonemedia, pderksen, nickyoung87, nekojira, rosshanney
3
  Tags: calendar, calendars, calendar manager, custom calendar, custom calendars, event, events, events feed, google calendar, google
4
  Requires at least: 4.1
5
  Tested up to: 4.5
6
- Stable tag: 3.0.15
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -82,6 +82,12 @@ We'd love your help! Here's a few things you can do:
82
 
83
  == Changelog ==
84
 
 
 
 
 
 
 
85
  = 3.0.15 - March 19, 2016 =
86
 
87
  * Fix: Timezone issues with event source option should now work correctly.
3
  Tags: calendar, calendars, calendar manager, custom calendar, custom calendars, event, events, events feed, google calendar, google
4
  Requires at least: 4.1
5
  Tested up to: 4.5
6
+ Stable tag: 3.0.16
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
82
 
83
  == Changelog ==
84
 
85
+ = 3.0.16 - March 30, 2016 =
86
+
87
+ * Fix: Multiple events at the same time on a grouped calendar should now show correctly.
88
+ * Fix: PHP notice when adding a new calendar should no longer appear.
89
+ * Fix: Issues with Carbon fatal error should not happen.
90
+
91
  = 3.0.15 - March 19, 2016 =
92
 
93
  * Fix: Timezone issues with event source option should now work correctly.
vendor/composer/installed.json CHANGED
@@ -347,17 +347,17 @@
347
  },
348
  {
349
  "name": "symfony/translation",
350
- "version": "v3.0.3",
351
- "version_normalized": "3.0.3.0",
352
  "source": {
353
  "type": "git",
354
  "url": "https://github.com/symfony/translation.git",
355
- "reference": "2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91"
356
  },
357
  "dist": {
358
  "type": "zip",
359
- "url": "https://api.github.com/repos/symfony/translation/zipball/2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91",
360
- "reference": "2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91",
361
  "shasum": ""
362
  },
363
  "require": {
@@ -378,7 +378,7 @@
378
  "symfony/config": "",
379
  "symfony/yaml": ""
380
  },
381
- "time": "2016-02-02 13:44:19",
382
  "type": "library",
383
  "extra": {
384
  "branch-alias": {
347
  },
348
  {
349
  "name": "symfony/translation",
350
+ "version": "v3.0.4",
351
+ "version_normalized": "3.0.4.0",
352
  "source": {
353
  "type": "git",
354
  "url": "https://github.com/symfony/translation.git",
355
+ "reference": "f7a07af51ea067745a521dab1e3152044a2fb1f2"
356
  },
357
  "dist": {
358
  "type": "zip",
359
+ "url": "https://api.github.com/repos/symfony/translation/zipball/f7a07af51ea067745a521dab1e3152044a2fb1f2",
360
+ "reference": "f7a07af51ea067745a521dab1e3152044a2fb1f2",
361
  "shasum": ""
362
  },
363
  "require": {
378
  "symfony/config": "",
379
  "symfony/yaml": ""
380
  },
381
+ "time": "2016-03-25 01:41:20",
382
  "type": "library",
383
  "extra": {
384
  "branch-alias": {
vendor/symfony/translation/Loader/PoFileLoader.php CHANGED
@@ -71,14 +71,20 @@ class PoFileLoader extends FileLoader
71
 
72
  $messages = array();
73
  $item = $defaults;
 
74
 
75
  while ($line = fgets($stream)) {
76
  $line = trim($line);
77
 
78
  if ($line === '') {
79
  // Whitespace indicated current item is done
80
- $this->addMessage($messages, $item);
 
 
81
  $item = $defaults;
 
 
 
82
  } elseif (substr($line, 0, 7) === 'msgid "') {
83
  // We start a new msg so save previous
84
  // TODO: this fails when comments or contexts are added
@@ -104,7 +110,9 @@ class PoFileLoader extends FileLoader
104
  }
105
  }
106
  // save last item
107
- $this->addMessage($messages, $item);
 
 
108
  fclose($stream);
109
 
110
  return $messages;
71
 
72
  $messages = array();
73
  $item = $defaults;
74
+ $flags = array();
75
 
76
  while ($line = fgets($stream)) {
77
  $line = trim($line);
78
 
79
  if ($line === '') {
80
  // Whitespace indicated current item is done
81
+ if (!in_array('fuzzy', $flags)) {
82
+ $this->addMessage($messages, $item);
83
+ }
84
  $item = $defaults;
85
+ $flags = array();
86
+ } elseif (substr($line, 0, 2) === '#,') {
87
+ $flags = array_map('trim', explode(',', substr($line, 2)));
88
  } elseif (substr($line, 0, 7) === 'msgid "') {
89
  // We start a new msg so save previous
90
  // TODO: this fails when comments or contexts are added
110
  }
111
  }
112
  // save last item
113
+ if (!in_array('fuzzy', $flags)) {
114
+ $this->addMessage($messages, $item);
115
+ }
116
  fclose($stream);
117
 
118
  return $messages;
vendor/symfony/translation/README.md CHANGED
@@ -1,37 +1,13 @@
1
  Translation Component
2
  =====================
3
 
4
- Translation provides tools for loading translation files and generating
5
- translated strings from these including support for pluralization.
6
-
7
- ```php
8
- use Symfony\Component\Translation\Translator;
9
- use Symfony\Component\Translation\MessageSelector;
10
- use Symfony\Component\Translation\Loader\ArrayLoader;
11
-
12
- $translator = new Translator('fr_FR', new MessageSelector());
13
- $translator->setFallbackLocales(array('fr'));
14
- $translator->addLoader('array', new ArrayLoader());
15
- $translator->addResource('array', array(
16
- 'Hello World!' => 'Bonjour',
17
- ), 'fr');
18
-
19
- echo $translator->trans('Hello World!')."\n";
20
- ```
21
 
22
  Resources
23
  ---------
24
 
25
- Silex integration:
26
-
27
- https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php
28
-
29
- Documentation:
30
-
31
- https://symfony.com/doc/3.0/book/translation.html
32
-
33
- You can run the unit tests with the following command:
34
-
35
- $ cd path/to/Symfony/Component/Translation/
36
- $ composer install
37
- $ phpunit
1
  Translation Component
2
  =====================
3
 
4
+ The Translation component provides tools to internationalize your application.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  Resources
7
  ---------
8
 
9
+ * [Documentation](https://symfony.com/doc/current/components/translation/index.html)
10
+ * [Contributing](https://symfony.com/doc/current/contributing/index.html)
11
+ * [Report issues](https://github.com/symfony/symfony/issues) and
12
+ [send Pull Requests](https://github.com/symfony/symfony/pulls)
13
+ in the [main Symfony repository](https://github.com/symfony/symfony)
 
 
 
 
 
 
 
 
vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php CHANGED
@@ -93,4 +93,16 @@ class PoFileLoaderTest extends \PHPUnit_Framework_TestCase
93
  $this->assertEquals('escaped "bar"', $messages['escaped "foo"']);
94
  $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foos"']);
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
93
  $this->assertEquals('escaped "bar"', $messages['escaped "foo"']);
94
  $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foos"']);
95
  }
96
+
97
+ public function testSkipFuzzyTranslations()
98
+ {
99
+ $loader = new PoFileLoader();
100
+ $resource = __DIR__.'/../fixtures/fuzzy-translations.po';
101
+ $catalogue = $loader->load($resource, 'en', 'domain1');
102
+
103
+ $messages = $catalogue->all('domain1');
104
+ $this->assertArrayHasKey('foo1', $messages);
105
+ $this->assertArrayNotHasKey('foo2', $messages);
106
+ $this->assertArrayHasKey('foo3', $messages);
107
+ }
108
  }
vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php CHANGED
@@ -11,6 +11,7 @@
11
 
12
  namespace Symfony\Component\Translation\Tests\Writer;
13
 
 
14
  use Symfony\Component\Translation\MessageCatalogue;
15
  use Symfony\Component\Translation\Writer\TranslationWriter;
16
 
@@ -30,18 +31,35 @@ class TranslationWriterTest extends \PHPUnit_Framework_TestCase
30
 
31
  public function testDisableBackup()
32
  {
33
- $dumper = $this->getMock('Symfony\Component\Translation\Dumper\DumperInterface');
34
- $dumper
35
- ->expects($this->never())
36
- ->method('setBackup');
37
- $phpDumper = $this->getMock('Symfony\Component\Translation\Dumper\PhpFileDumper');
38
- $phpDumper
39
- ->expects($this->once())
40
- ->method('setBackup');
41
 
42
  $writer = new TranslationWriter();
43
- $writer->addDumper('test', $dumper);
44
- $writer->addDumper('php', $phpDumper);
45
  $writer->disableBackup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  }
11
 
12
  namespace Symfony\Component\Translation\Tests\Writer;
13
 
14
+ use Symfony\Component\Translation\Dumper\DumperInterface;
15
  use Symfony\Component\Translation\MessageCatalogue;
16
  use Symfony\Component\Translation\Writer\TranslationWriter;
17
 
31
 
32
  public function testDisableBackup()
33
  {
34
+ $nonBackupDumper = new NonBackupDumper();
35
+ $backupDumper = new BackupDumper();
 
 
 
 
 
 
36
 
37
  $writer = new TranslationWriter();
38
+ $writer->addDumper('non_backup', $nonBackupDumper);
39
+ $writer->addDumper('backup', $backupDumper);
40
  $writer->disableBackup();
41
+
42
+ $this->assertFalse($backupDumper->backup, 'backup can be disabled if setBackup() method does exist');
43
+ }
44
+ }
45
+
46
+ class NonBackupDumper implements DumperInterface
47
+ {
48
+ public function dump(MessageCatalogue $messages, $options = array())
49
+ {
50
+ }
51
+ }
52
+
53
+ class BackupDumper implements DumperInterface
54
+ {
55
+ public $backup = true;
56
+
57
+ public function dump(MessageCatalogue $messages, $options = array())
58
+ {
59
+ }
60
+
61
+ public function setBackup($backup)
62
+ {
63
+ $this->backup = $backup;
64
  }
65
  }
vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ #, php-format
2
+ msgid "foo1"
3
+ msgstr "bar1"
4
+
5
+ #, fuzzy, php-format
6
+ msgid "foo2"
7
+ msgstr "fuzzy bar2"
8
+
9
+ msgid "foo3"
10
+ msgstr "bar3"