Simple Calendar – Google Calendar Plugin - Version 0.7.2

Version Description

  • Fixed a bug causing the "More details" Google Calendar information to be displayed in the wrong timezone
  • Fixed a bug that prevented setting the cache duration to 0 from working correctly
  • Fixed an issue that prevented Ajax from working with FORCE_SSL_ADMIN enabled
  • Now uses wp_enqueue_scripts
Download this release

Release Info

Developer rosshanney
Plugin Icon 128x128 Simple Calendar – Google Calendar Plugin
Version 0.7.2
Comparing to
See all releases

Code changes from version 0.7.1 to 0.7.2

google-calendar-events.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Google Calendar Events
4
  Plugin URI: http://www.rhanney.co.uk/plugins/google-calendar-events
5
  Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
6
- Version: 0.7.1
7
  Author: Ross Hanney
8
  Author URI: http://www.rhanney.co.uk
9
  License: GPL2
@@ -36,7 +36,7 @@ define( 'GCE_PLUGIN_NAME', str_replace( '.php', '', basename( __FILE__ ) ) );
36
  define( 'GCE_TEXT_DOMAIN', 'google-calendar-events' );
37
  define( 'GCE_OPTIONS_NAME', 'gce_options' );
38
  define( 'GCE_GENERAL_OPTIONS_NAME', 'gce_general' );
39
- define( 'GCE_VERSION', '0.7.1' );
40
 
41
  if ( ! class_exists( 'Google_Calendar_Events' ) ) {
42
  class Google_Calendar_Events {
@@ -51,8 +51,8 @@ if ( ! class_exists( 'Google_Calendar_Events' ) ) {
51
  if ( ! defined( 'DOING_AJAX' ) || !DOING_AJAX ) {
52
  add_action( 'admin_menu', array( $this, 'setup_admin' ) );
53
  add_action( 'admin_init', array( $this, 'init_admin' ) );
54
- add_action( 'wp_print_styles', array( $this, 'add_styles' ) );
55
- add_action( 'wp_print_scripts', array( $this, 'add_scripts' ) );
56
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
57
  add_shortcode( 'google-calendar-events', array( $this, 'shortcode_handler' ) );
58
  }
@@ -569,37 +569,31 @@ if ( ! class_exists( 'Google_Calendar_Events' ) ) {
569
 
570
  //Adds the required CSS
571
  function add_styles() {
572
- //Don't add styles if on admin screens
573
- if( ! is_admin() ) {
574
- wp_enqueue_style( 'gce_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-style.css' );
575
 
576
- $options = get_option( GCE_GENERAL_OPTIONS_NAME );
577
 
578
- //If old stylesheet option is enabled, enqueue old styles
579
- if ( $options['old_stylesheet'] )
580
- wp_enqueue_style( 'gce_old_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-old-style.css' );
581
 
582
- //If user has entered a URL to a custom stylesheet, enqueue it too
583
- if( '' != $options['stylesheet'] )
584
- wp_enqueue_style( 'gce_custom_styles', $options['stylesheet'] );
585
- }
586
  }
587
 
588
  //Adds the required scripts
589
  function add_scripts() {
590
- //Don't add scripts if on admin pages
591
- if ( ! is_admin() ) {
592
- $options = get_option( GCE_GENERAL_OPTIONS_NAME );
593
- $add_to_footer = (bool) $options['javascript'];
594
-
595
- wp_enqueue_script( 'jquery' );
596
- wp_enqueue_script( 'gce_jquery_qtip', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/jquery-qtip.js', array( 'jquery' ), null, $add_to_footer );
597
- wp_enqueue_script( 'gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-script.js', array( 'jquery' ), null, $add_to_footer );
598
- wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array(
599
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
600
- 'loading' => $options['loading']
601
- ) );
602
- }
603
  }
604
 
605
  //AJAX stuffs
3
  Plugin Name: Google Calendar Events
4
  Plugin URI: http://www.rhanney.co.uk/plugins/google-calendar-events
5
  Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
6
+ Version: 0.7.2
7
  Author: Ross Hanney
8
  Author URI: http://www.rhanney.co.uk
9
  License: GPL2
36
  define( 'GCE_TEXT_DOMAIN', 'google-calendar-events' );
37
  define( 'GCE_OPTIONS_NAME', 'gce_options' );
38
  define( 'GCE_GENERAL_OPTIONS_NAME', 'gce_general' );
39
+ define( 'GCE_VERSION', '0.7.2' );
40
 
41
  if ( ! class_exists( 'Google_Calendar_Events' ) ) {
42
  class Google_Calendar_Events {
51
  if ( ! defined( 'DOING_AJAX' ) || !DOING_AJAX ) {
52
  add_action( 'admin_menu', array( $this, 'setup_admin' ) );
53
  add_action( 'admin_init', array( $this, 'init_admin' ) );
54
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ) );
55
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts' ) );
56
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
57
  add_shortcode( 'google-calendar-events', array( $this, 'shortcode_handler' ) );
58
  }
569
 
570
  //Adds the required CSS
571
  function add_styles() {
572
+ wp_enqueue_style( 'gce_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-style.css' );
 
 
573
 
574
+ $options = get_option( GCE_GENERAL_OPTIONS_NAME );
575
 
576
+ //If old stylesheet option is enabled, enqueue old styles
577
+ if ( $options['old_stylesheet'] )
578
+ wp_enqueue_style( 'gce_old_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-old-style.css' );
579
 
580
+ //If user has entered a URL to a custom stylesheet, enqueue it too
581
+ if( '' != $options['stylesheet'] )
582
+ wp_enqueue_style( 'gce_custom_styles', $options['stylesheet'] );
 
583
  }
584
 
585
  //Adds the required scripts
586
  function add_scripts() {
587
+ $options = get_option( GCE_GENERAL_OPTIONS_NAME );
588
+ $add_to_footer = (bool) $options['javascript'];
589
+
590
+ wp_enqueue_script( 'jquery' );
591
+ wp_enqueue_script( 'gce_jquery_qtip', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/jquery-qtip.js', array( 'jquery' ), null, $add_to_footer );
592
+ wp_enqueue_script( 'gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-script.js', array( 'jquery' ), null, $add_to_footer );
593
+ wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array(
594
+ 'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ),
595
+ 'loading' => $options['loading']
596
+ ) );
 
 
 
597
  }
598
 
599
  //AJAX stuffs
inc/gce-event.php CHANGED
@@ -472,8 +472,8 @@ class GCE_Event{
472
  }
473
 
474
  //If link should be displayed add to $markup
475
- if ( isset($display_options['display_link'] ) ) //Below: add target="_blank" if required
476
- $markup .= '<p class="gce-' . $this->type . '-link"><a href="' . esc_url( $this->link ) . '&amp;ctz=' . esc_url( $this->feed->get_timezone() ) . '"' . ( ( isset( $display_options['display_link_target'] ) ) ? ' target="_blank"' : '' ) . '>' . esc_html( $display_options['display_link_text'] ) . '</a></p>';
477
 
478
  return $markup;
479
  }
472
  }
473
 
474
  //If link should be displayed add to $markup
475
+ if ( isset($display_options['display_link'] ) )
476
+ $markup .= '<p class="gce-' . $this->type . '-link"><a href="' . esc_url( $this->link ) . '&amp;ctz=' . esc_html( $this->feed->get_timezone() ) . '"' . ( ( isset( $display_options['display_link_target'] ) ) ? ' target="_blank"' : '' ) . '>' . esc_html( $display_options['display_link_text'] ) . '</a></p>';
477
 
478
  return $markup;
479
  }
inc/gce-feed.php CHANGED
@@ -53,7 +53,7 @@ class GCE_Feed{
53
  $this->events = get_transient( 'gce_feed_' . $this->feed_id );
54
 
55
  //If the cached feed data isn't valid any more (has expired), or the URL has changed (settings have changed), then the feed data needs to be retrieved and decoded again
56
- if ( false === $this->events || get_transient( 'gce_feed_' . $this->feed_id . '_url' ) != $url ) {
57
  $this->events = array();
58
 
59
  //Retrieve the feed data
@@ -88,9 +88,11 @@ class GCE_Feed{
88
  }
89
  }
90
 
91
- //Cache the feed data
92
- set_transient( 'gce_feed_' . $this->feed_id, $this->events, $this->cache_duration );
93
- set_transient( 'gce_feed_' . $this->feed_id . '_url', $url, $this->cache_duration );
 
 
94
  } else {
95
  //json_decode failed
96
  $this->error = __( 'Some data was retrieved, but could not be parsed successfully. Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN );
53
  $this->events = get_transient( 'gce_feed_' . $this->feed_id );
54
 
55
  //If the cached feed data isn't valid any more (has expired), or the URL has changed (settings have changed), then the feed data needs to be retrieved and decoded again
56
+ if ( false === $this->events || 0 == $this->cache_duration || get_transient( 'gce_feed_' . $this->feed_id . '_url' ) != $url ) {
57
  $this->events = array();
58
 
59
  //Retrieve the feed data
88
  }
89
  }
90
 
91
+ if ( 0 != $this->cache_duration ) {
92
+ //Cache the feed data
93
+ set_transient( 'gce_feed_' . $this->feed_id, $this->events, $this->cache_duration );
94
+ set_transient( 'gce_feed_' . $this->feed_id . '_url', $url, $this->cache_duration );
95
+ }
96
  } else {
97
  //json_decode failed
98
  $this->error = __( 'Some data was retrieved, but could not be parsed successfully. Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: rosshanney
3
  Donate link: http://www.rhanney.co.uk/plugins/google-calendar-events/#donate
4
  Tags: google, google calendar, calendar, event, events, ajax, widget
5
  Requires at least: 3.0
6
- Tested up to: 3.2
7
- Stable tag: 0.7.1
8
 
9
  Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
10
 
@@ -26,8 +26,6 @@ Please visit the [plugin homepage](http://www.rhanney.co.uk/plugins/google-calen
26
 
27
  There is also a [demonstration page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo) showing the plugin in action.
28
 
29
- [Changes in 0.7](http://www.rhanney.co.uk/2011/06/25/google-calendar-events-0-7).
30
-
31
  == Installation ==
32
 
33
  Use the automatic installer from within the WordPress admin, or:
@@ -50,6 +48,12 @@ You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.c
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
53
  = 0.7.1 =
54
  * Fixed bug causing AJAX enabled calendar grids to not function correctly
55
  * Fixed bug causing all-day events from outside required date range to be displayed
3
  Donate link: http://www.rhanney.co.uk/plugins/google-calendar-events/#donate
4
  Tags: google, google calendar, calendar, event, events, ajax, widget
5
  Requires at least: 3.0
6
+ Tested up to: 3.5
7
+ Stable tag: 0.7.2
8
 
9
  Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
10
 
26
 
27
  There is also a [demonstration page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo) showing the plugin in action.
28
 
 
 
29
  == Installation ==
30
 
31
  Use the automatic installer from within the WordPress admin, or:
48
 
49
  == Changelog ==
50
 
51
+ = 0.7.2 =
52
+ * Fixed a bug causing the "More details" Google Calendar information to be displayed in the wrong timezone
53
+ * Fixed a bug that prevented setting the cache duration to 0 from working correctly
54
+ * Fixed an issue that prevented Ajax from working with FORCE_SSL_ADMIN enabled
55
+ * Now uses [wp_enqueue_scripts](http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/)
56
+
57
  = 0.7.1 =
58
  * Fixed bug causing AJAX enabled calendar grids to not function correctly
59
  * Fixed bug causing all-day events from outside required date range to be displayed