Simple Calendar – Google Calendar Plugin - Version 0.1.4

Version Description

  • More bug fixes.
Download this release

Release Info

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

Code changes from version 0.1.2 to 0.1.4

css/gce-style.css CHANGED
@@ -39,7 +39,7 @@
39
  }
40
 
41
  .gce-page-grid .gce-calendar .gce-today{ /* Table cell that represents today */
42
- background-color:#EEEEEE;
43
  }
44
 
45
  .gce-page-grid .gce-calendar .gce-next,
39
  }
40
 
41
  .gce-page-grid .gce-calendar .gce-today{ /* Table cell that represents today */
42
+ background-color:#DDDDDD;
43
  }
44
 
45
  .gce-page-grid .gce-calendar .gce-next,
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.1.2
7
  Author: Ross Hanney
8
  Author URI: http://www.rhanney.co.uk
9
  License: GPL2
@@ -43,7 +43,7 @@ if(!class_exists('Google_Calendar_Events')){
43
 
44
  //PHP 5 constructor
45
  function __construct(){
46
- //add_action('activate_google-calendar-events/google-calendar-events.php', array($this, 'get_options'));
47
  add_action('admin_menu', array($this, 'setup_admin'));
48
  add_action('admin_init', array($this, 'init_admin'));
49
 
@@ -55,10 +55,14 @@ if(!class_exists('Google_Calendar_Events')){
55
  add_action('wp_print_scripts', array($this, 'add_scripts'));
56
  }
57
 
 
 
 
 
58
  //Setup admin settings page
59
  function setup_admin(){
60
  if(function_exists('add_options_page')) add_options_page('Google Calendar Events', 'Google Calendar Events', 'manage_options', basename(__FILE__), array($this, 'admin_page'));
61
- add_option(GCE_OPTIONS_NAME);
62
  }
63
 
64
  //Prints admin settings page
@@ -206,21 +210,28 @@ if(!class_exists('Google_Calendar_Events')){
206
 
207
  //Handles the shortcode stuff
208
  function shortcode_handler($atts){
209
- extract(shortcode_atts(array(
210
- 'id' => '1',
211
- 'type' => 'grid'
212
- ), $atts));
213
-
214
- switch($type){
215
- case 'grid':
216
- return gce_print_grid($id);
217
- break;
218
- case 'ajax':
219
- return gce_print_grid($id, true);
220
- break;
221
- case 'list':
222
- return gce_print_list($id);
223
- break;
 
 
 
 
 
 
 
224
  }
225
  }
226
 
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.1.4
7
  Author: Ross Hanney
8
  Author URI: http://www.rhanney.co.uk
9
  License: GPL2
43
 
44
  //PHP 5 constructor
45
  function __construct(){
46
+ add_action('activate_google-calendar-events/google-calendar-events.php', array($this, 'init_plugin'));
47
  add_action('admin_menu', array($this, 'setup_admin'));
48
  add_action('admin_init', array($this, 'init_admin'));
49
 
55
  add_action('wp_print_scripts', array($this, 'add_scripts'));
56
  }
57
 
58
+ function init_plugin(){
59
+ add_option(GCE_OPTIONS_NAME);
60
+ }
61
+
62
  //Setup admin settings page
63
  function setup_admin(){
64
  if(function_exists('add_options_page')) add_options_page('Google Calendar Events', 'Google Calendar Events', 'manage_options', basename(__FILE__), array($this, 'admin_page'));
65
+
66
  }
67
 
68
  //Prints admin settings page
210
 
211
  //Handles the shortcode stuff
212
  function shortcode_handler($atts){
213
+ $options = get_option(GCE_OPTIONS_NAME);
214
+
215
+ //Check that any feeds have been added
216
+ if(is_array($options) && !empty($options)){
217
+ extract(shortcode_atts(array(
218
+ 'id' => '1',
219
+ 'type' => 'grid'
220
+ ), $atts));
221
+
222
+ switch($type){
223
+ case 'grid':
224
+ return gce_print_grid($id);
225
+ break;
226
+ case 'ajax':
227
+ return gce_print_grid($id, true);
228
+ break;
229
+ case 'list':
230
+ return gce_print_list($id);
231
+ break;
232
+ }
233
+ }else{
234
+ return 'No feeds have been added yet. You can add a feed in the Google Calendar Events settings.';
235
  }
236
  }
237
 
inc/gce-parser.php CHANGED
@@ -55,7 +55,8 @@ class GCE_Parser{
55
 
56
  if(!isset($event_days[$start_date])){
57
  //Create new array in $event_days for this date (only dates with events will go into array, so, for
58
- //example $event_days[26] will exist if 26th of month has events, but won't if it has no events
 
59
  $event_days[$start_date] = array();
60
  }
61
 
@@ -77,7 +78,7 @@ class GCE_Parser{
77
  $markup .=
78
  '<li>' .
79
  '<p class="gce-date-time">' .
80
- '<span class="gce-date">' . date($this->d_format, $key) . '</span>, ' .
81
  '<span class="gce-time">' . date($this->t_format, $event->get_start_date()) . '</span>' .
82
  '</p>' .
83
  '<p class="gce-event-text">' . $event->get_title() . '</p>' .
@@ -106,6 +107,8 @@ class GCE_Parser{
106
 
107
  $no_more_events = false;
108
 
 
 
109
  foreach($event_days as $key => $event_day){
110
  //If event day is in the month and year specified (by $month and $year)
111
  if(date('mY', $key) == $m_y){
@@ -119,9 +122,9 @@ class GCE_Parser{
119
  }
120
  $events_markup .= '</ul></div>';
121
 
122
- //If this event day is today, add gce-today class to $css_classes
123
  $css_classes = 'gce-has-events';
124
- if($key == mktime(0, 0, 0, date('m'), date('d'), date('Y'))) $css_classes .= ' gce-today';
125
 
126
  //Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below)
127
  $event_days[$key] = array(null, $css_classes, $events_markup);
@@ -131,6 +134,9 @@ class GCE_Parser{
131
  }
132
  }
133
 
 
 
 
134
  $pn = array();
135
 
136
  //Only add previous / next functionality if AJAX grid is enabled
55
 
56
  if(!isset($event_days[$start_date])){
57
  //Create new array in $event_days for this date (only dates with events will go into array, so, for
58
+ //example $event_days[26] will exist if 26th of month has events, but won't if it has no events)
59
+ //(Now uses unix timestamp rather than day number, but same concept applies).
60
  $event_days[$start_date] = array();
61
  }
62
 
78
  $markup .=
79
  '<li>' .
80
  '<p class="gce-date-time">' .
81
+ '<span class="gce-date">' . date($this->d_format, $key) . '</span> ' .
82
  '<span class="gce-time">' . date($this->t_format, $event->get_start_date()) . '</span>' .
83
  '</p>' .
84
  '<p class="gce-event-text">' . $event->get_title() . '</p>' .
107
 
108
  $no_more_events = false;
109
 
110
+ $today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
111
+
112
  foreach($event_days as $key => $event_day){
113
  //If event day is in the month and year specified (by $month and $year)
114
  if(date('mY', $key) == $m_y){
122
  }
123
  $events_markup .= '</ul></div>';
124
 
125
+ //If this event day is 'today', add gce-today class to $css_classes
126
  $css_classes = 'gce-has-events';
127
+ if($key == $today) $css_classes .= ' gce-today';
128
 
129
  //Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below)
130
  $event_days[$key] = array(null, $css_classes, $events_markup);
134
  }
135
  }
136
 
137
+ //Ensures that gce-today CSS class is added even if there are no events for 'today'. A bit messy :(
138
+ if(!isset($event_days[$today])) $event_days[$today] = array(null, 'gce-today', null);
139
+
140
  $pn = array();
141
 
142
  //Only add previous / next functionality if AJAX grid is enabled
js/gce-tooltip-script.js CHANGED
@@ -55,8 +55,8 @@ function gce_ajaxify(target, feed_id, type){
55
  jQuery.get('index.php', {gce_type:type, gce_feed_id:feed_id, gce_widget_id:target, gce_month:month_year[0], gce_year:month_year[1]}, function(data){
56
  //Replace existing data with returned AJAX data
57
  if(type == 'widget'){
58
- jQuery('#' + target).children('.gce-widget-grid').html(data);
59
- gce_simple_tooltip('.widget_gce_widget .gce-has-events');
60
  }else{
61
  jQuery('#' + target).replaceWith(data);
62
  gce_simple_tooltip('.gce-page-grid .gce-has-events');
@@ -66,6 +66,6 @@ function gce_ajaxify(target, feed_id, type){
66
  }
67
 
68
  jQuery(document).ready(function(){
69
- gce_simple_tooltip('.widget_gce_widget .gce-has-events');
70
  gce_simple_tooltip('.gce-page-grid .gce-has-events');
71
  });
55
  jQuery.get('index.php', {gce_type:type, gce_feed_id:feed_id, gce_widget_id:target, gce_month:month_year[0], gce_year:month_year[1]}, function(data){
56
  //Replace existing data with returned AJAX data
57
  if(type == 'widget'){
58
+ jQuery('#' + target).html(data);
59
+ gce_simple_tooltip('.gce-widget-grid .gce-has-events');
60
  }else{
61
  jQuery('#' + target).replaceWith(data);
62
  gce_simple_tooltip('.gce-page-grid .gce-has-events');
66
  }
67
 
68
  jQuery(document).ready(function(){
69
+ gce_simple_tooltip('.gce-widget-grid .gce-has-events');
70
  gce_simple_tooltip('.gce-page-grid .gce-has-events');
71
  });
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: rosshanney
3
  Tags: google, google calendar, calendar, events, ajax, widget
4
  Requires at least: 2.9.2
5
  Tested up to: 3.0
6
- Stable tag: 0.1.2
7
 
8
  Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
9
 
@@ -21,7 +21,11 @@ Parses Google Calendar feeds and displays the events as a calendar grid or list
21
 
22
  Please visit the plugin homepage for how to get started and other help:
23
 
24
- * [plugin homepage](http://www.rhanney.co.uk/plugins/google-calendar-events)
 
 
 
 
25
 
26
  == Installation ==
27
 
@@ -37,8 +41,22 @@ After activation a new Google Calendar Events options menu will appear under Set
37
 
38
  You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.co.uk/plugins/google-calendar-events) for a more in-depth guide on getting started.
39
 
 
 
 
 
 
 
 
 
40
  == Changelog ==
41
 
 
 
 
 
 
 
42
  = 0.1.2 =
43
  * Bug fixes.
44
 
@@ -51,8 +69,8 @@ You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.c
51
 
52
  == Upgrade Notice ==
53
 
54
- = 0.1.1 =
55
- Bug fix to prevent conflicts with other plugins.
56
 
57
  == Frequently Asked Questions ==
58
 
3
  Tags: google, google calendar, calendar, events, ajax, widget
4
  Requires at least: 2.9.2
5
  Tested up to: 3.0
6
+ Stable tag: 0.1.4
7
 
8
  Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
9
 
21
 
22
  Please visit the plugin homepage for how to get started and other help:
23
 
24
+ * [Plugin Homepage](http://www.rhanney.co.uk/plugins/google-calendar-events)
25
+
26
+ There is also a demonstration page showing the plugin in action:
27
+
28
+ * [Demo Page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo)
29
 
30
  == Installation ==
31
 
41
 
42
  You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.co.uk/plugins/google-calendar-events) for a more in-depth guide on getting started.
43
 
44
+ == Screenshots ==
45
+
46
+ There is also a [demo page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo) where you can see the plugin in action.
47
+
48
+ 1. The main plugin admin screen.
49
+ 1. The add feed admin screen.
50
+ 1. A page showing a full page calendar grid and various widgets.
51
+
52
  == Changelog ==
53
 
54
+ = 0.1.4 =
55
+ * More bug fixes.
56
+
57
+ = 0.1.3 =
58
+ * Several bug fixes, including fixing JavaScript problems that prevented tooltips appearing.
59
+
60
  = 0.1.2 =
61
  * Bug fixes.
62
 
69
 
70
  == Upgrade Notice ==
71
 
72
+ = 0.1.4 =
73
+ Bug fixes.
74
 
75
  == Frequently Asked Questions ==
76
 
screenshot-1.jpg ADDED
Binary file
screenshot-2.jpg ADDED
Binary file
screenshot-3.jpg ADDED
Binary file