Simple Calendar – Google Calendar Plugin - Version 0.4

Version Description

  • More control over how start and end dates / times are displayed
  • Events can now be limited to a specified timeframe (number of days)
  • Events on the same day in lists can now be shown under a single date title
  • JavaScript can now be added to the footer rather than the header, via an option
  • The 'Loading...' text can now be customized
  • Description text can now be limited to a specified number of words
  • Multi-day events can be shown on each day that they span (sort of)
  • Bug fixes
  • i18n / l10n fixes
Download this release

Release Info

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

Code changes from version 0.3.1 to 0.4

admin/add.php CHANGED
@@ -7,23 +7,26 @@ if(isset($_GET['action'])){
7
  }
8
 
9
  add_settings_section('gce_add', __('Add a Feed', GCE_TEXT_DOMAIN), 'gce_add_main_text', 'add_feed');
10
- //Unique ID //Title //Function //Page //Section ID
11
- add_settings_field('gce_add_id_field', __('Feed ID', GCE_TEXT_DOMAIN), 'gce_add_id_field', 'add_feed', 'gce_add');
12
- add_settings_field('gce_add_title_field', __('Feed Title', GCE_TEXT_DOMAIN), 'gce_add_title_field', 'add_feed', 'gce_add');
13
- add_settings_field('gce_add_url_field', __('Feed URL', GCE_TEXT_DOMAIN), 'gce_add_url_field', 'add_feed', 'gce_add');
14
- add_settings_field('gce_add_show_past_events_field', __('Retrieve past events for current month?', GCE_TEXT_DOMAIN), 'gce_add_show_past_events_field', 'add_feed', 'gce_add');
15
- add_settings_field('gce_add_max_events_field', __('Maximum number of events to retrieve', GCE_TEXT_DOMAIN), 'gce_add_max_events_field', 'add_feed', 'gce_add');
16
- add_settings_field('gce_add_date_format_field', __('Date format', GCE_TEXT_DOMAIN), 'gce_add_date_format_field', 'add_feed', 'gce_add');
17
- add_settings_field('gce_add_time_format_field', __('Time format', GCE_TEXT_DOMAIN), 'gce_add_time_format_field', 'add_feed', 'gce_add');
18
- add_settings_field('gce_add_timezone_field', __('Timezone adjustment', GCE_TEXT_DOMAIN), 'gce_add_timezone_field', 'add_feed', 'gce_add');
19
- add_settings_field('gce_add_cache_duration_field', __('Cache duration', GCE_TEXT_DOMAIN), 'gce_add_cache_duration_field', 'add_feed', 'gce_add');
 
 
20
 
21
  add_settings_section('gce_add_display', __('Display Options', GCE_TEXT_DOMAIN), 'gce_add_display_main_text', 'add_display');
22
- add_settings_field('gce_add_display_start_field', __('Display start time?', GCE_TEXT_DOMAIN), 'gce_add_display_start_field', 'add_display', 'gce_add_display');
23
- add_settings_field('gce_add_display_end_field', __('Display end time and date?', GCE_TEXT_DOMAIN), 'gce_add_display_end_field', 'add_display', 'gce_add_display');
24
- add_settings_field('gce_add_display_location_field', __('Display location?', GCE_TEXT_DOMAIN), 'gce_add_display_location_field', 'add_display', 'gce_add_display');
25
- add_settings_field('gce_add_display_desc_field', __('Display description?', GCE_TEXT_DOMAIN), 'gce_add_display_desc_field', 'add_display', 'gce_add_display');
26
- add_settings_field('gce_add_display_link_field', __('Display link to event?', GCE_TEXT_DOMAIN), 'gce_add_display_link_field', 'add_display', 'gce_add_display');
 
27
 
28
  //Main text
29
  function gce_add_main_text(){
@@ -61,7 +64,7 @@ function gce_add_title_field(){
61
  //URL
62
  function gce_add_url_field(){
63
  ?>
64
- <span class="description"><?php _e('This will probably be something like: \'http://www.google.com/calendar/feeds/your-email@gmail.com/public/full\'.', GCE_TEXT_DOMAIN); ?></span>
65
  <br />
66
  <input type="text" name="gce_options[url]" size="100" class="required" />
67
  <?php
@@ -70,12 +73,9 @@ function gce_add_url_field(){
70
  //Show past events
71
  function gce_add_show_past_events_field(){
72
  ?>
73
- <span class="description"><?php _e('Select No to retrieve events from now onwards. Select Yes to retrieve events from the first of this month onwards.', GCE_TEXT_DOMAIN); ?></span>
74
- <fieldset>
75
- <label><input type="radio" name="gce_options[show_past_events]" value="false" checked="checked" /> <?php _e('No', GCE_TEXT_DOMAIN); ?></label>
76
- <br />
77
- <label><input type="radio" name="gce_options[show_past_events]" value="true" /> <?php _e('Yes', GCE_TEXT_DOMAIN); ?></label>
78
- </fieldset>
79
  <?php
80
  }
81
 
@@ -88,6 +88,15 @@ function gce_add_max_events_field(){
88
  <?php
89
  }
90
 
 
 
 
 
 
 
 
 
 
91
  //Date format
92
  function gce_add_date_format_field(){
93
  ?>
@@ -128,6 +137,16 @@ function gce_add_cache_duration_field(){
128
  <?php
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  //Display options
133
  function gce_add_display_main_text(){
@@ -139,21 +158,45 @@ function gce_add_display_main_text(){
139
 
140
  function gce_add_display_start_field(){
141
  ?>
142
- <input type="checkbox" name="gce_options[display_start]" value="on" checked="checked" />
143
- <span class="description"><?php _e('Show the start time of events?', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
 
144
  <br /><br />
145
- <input type="text" name="gce_options[display_start_text]" value="Starts:" />
146
  <span class="description"><?php _e('Text to display before the start time.', GCE_TEXT_DOMAIN); ?></span>
 
 
147
  <?php
148
  }
149
 
150
  function gce_add_display_end_field(){
151
  ?>
152
- <input type="checkbox" name="gce_options[display_end]" value="on" />
153
- <span class="description"><?php _e('Show the end time and date of events? (Date will be shown as well as time as events can span several days).', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
 
154
  <br /><br />
 
 
155
  <input type="text" name="gce_options[display_end_text]" value="Ends:" />
156
- <span class="description"><?php _e('Text to display before the end time / date.', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
 
157
  <?php
158
  }
159
 
@@ -162,8 +205,9 @@ function gce_add_display_location_field(){
162
  <input type="checkbox" name="gce_options[display_location]" value="on" />
163
  <span class="description"><?php _e('Show the location of events?', GCE_TEXT_DOMAIN); ?></span>
164
  <br /><br />
165
- <input type="text" name="gce_options[display_location_text]" value="Location:" />
166
  <span class="description"><?php _e('Text to display before the location.', GCE_TEXT_DOMAIN); ?></span>
 
 
167
  <?php
168
  }
169
 
@@ -172,8 +216,13 @@ function gce_add_display_desc_field(){
172
  <input type="checkbox" name="gce_options[display_desc]" value="on" />
173
  <span class="description"><?php _e('Show the description of events? (URLs in the description will be made into links).', GCE_TEXT_DOMAIN); ?></span>
174
  <br /><br />
175
- <input type="text" name="gce_options[display_desc_text]" value="Description:" />
176
  <span class="description"><?php _e('Text to display before the description.', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
177
  <?php
178
  }
179
 
@@ -185,8 +234,9 @@ function gce_add_display_link_field(){
185
  <input type="checkbox" name="gce_options[display_link_target]" value="on" />
186
  <span class="description"><?php _e('Links open in a new window / tab?', GCE_TEXT_DOMAIN); ?></span>
187
  <br /><br />
188
- <input type="text" name="gce_options[display_link_text]" value="More details" />
189
  <span class="description"><?php _e('The link text to be displayed.', GCE_TEXT_DOMAIN); ?></span>
 
 
190
  <?php
191
  }
192
  ?>
7
  }
8
 
9
  add_settings_section('gce_add', __('Add a Feed', GCE_TEXT_DOMAIN), 'gce_add_main_text', 'add_feed');
10
+ //Unique ID //Title //Function //Page //Section ID
11
+ add_settings_field('gce_add_id_field', __('Feed ID', GCE_TEXT_DOMAIN), 'gce_add_id_field', 'add_feed', 'gce_add');
12
+ add_settings_field('gce_add_title_field', __('Feed Title', GCE_TEXT_DOMAIN), 'gce_add_title_field', 'add_feed', 'gce_add');
13
+ add_settings_field('gce_add_url_field', __('Feed URL', GCE_TEXT_DOMAIN), 'gce_add_url_field', 'add_feed', 'gce_add');
14
+ add_settings_field('gce_add_show_past_events_field', __('Retrieve past events for current month?', GCE_TEXT_DOMAIN), 'gce_add_show_past_events_field', 'add_feed', 'gce_add');
15
+ add_settings_field('gce_add_max_events_field', __('Maximum number of events to retrieve', GCE_TEXT_DOMAIN), 'gce_add_max_events_field', 'add_feed', 'gce_add');
16
+ add_settings_field('gce_add_day_limit_field', __('Number of days in the future to retrieve events for', GCE_TEXT_DOMAIN), 'gce_add_day_limit_field', 'add_feed', 'gce_add');
17
+ add_settings_field('gce_add_date_format_field', __('Date format', GCE_TEXT_DOMAIN), 'gce_add_date_format_field', 'add_feed', 'gce_add');
18
+ add_settings_field('gce_add_time_format_field', __('Time format', GCE_TEXT_DOMAIN), 'gce_add_time_format_field', 'add_feed', 'gce_add');
19
+ add_settings_field('gce_add_timezone_field', __('Timezone adjustment', GCE_TEXT_DOMAIN), 'gce_add_timezone_field', 'add_feed', 'gce_add');
20
+ add_settings_field('gce_add_cache_duration_field', __('Cache duration', GCE_TEXT_DOMAIN), 'gce_add_cache_duration_field', 'add_feed', 'gce_add');
21
+ add_settings_field('gce_add_multiple_field', __('Show multiple day events on each day?', GCE_TEXT_DOMAIN), 'gce_add_multiple_field', 'add_feed', 'gce_add');
22
 
23
  add_settings_section('gce_add_display', __('Display Options', GCE_TEXT_DOMAIN), 'gce_add_display_main_text', 'add_display');
24
+ add_settings_field('gce_add_display_start_field', __('Display start time / date?', GCE_TEXT_DOMAIN), 'gce_add_display_start_field', 'add_display', 'gce_add_display');
25
+ add_settings_field('gce_add_display_end_field', __('Display end time / date?', GCE_TEXT_DOMAIN), 'gce_add_display_end_field', 'add_display', 'gce_add_display');
26
+ add_settings_field('gce_add_display_separator_field', __('Separator text / characters', GCE_TEXT_DOMAIN), 'gce_add_display_separator_field', 'add_display', 'gce_add_display');
27
+ add_settings_field('gce_add_display_location_field', __('Display location?', GCE_TEXT_DOMAIN), 'gce_add_display_location_field', 'add_display', 'gce_add_display');
28
+ add_settings_field('gce_add_display_desc_field', __('Display description?', GCE_TEXT_DOMAIN), 'gce_add_display_desc_field', 'add_display', 'gce_add_display');
29
+ add_settings_field('gce_add_display_link_field', __('Display link to event?', GCE_TEXT_DOMAIN), 'gce_add_display_link_field', 'add_display', 'gce_add_display');
30
 
31
  //Main text
32
  function gce_add_main_text(){
64
  //URL
65
  function gce_add_url_field(){
66
  ?>
67
+ <span class="description"><?php _e('This will probably be something like: <code>http://www.google.com/calendar/feeds/your-email@gmail.com/public/full</code>.', GCE_TEXT_DOMAIN); ?></span>
68
  <br />
69
  <input type="text" name="gce_options[url]" size="100" class="required" />
70
  <?php
73
  //Show past events
74
  function gce_add_show_past_events_field(){
75
  ?>
76
+ <span class="description"><?php _e('If checked, events will be retrieved from the first of this month onwards. If unchecked, events will be retrieved from today onwards.', GCE_TEXT_DOMAIN); ?></span>
77
+ <br />
78
+ <input type="checkbox" name="gce_options[show_past_events]" value="true" />
 
 
 
79
  <?php
80
  }
81
 
88
  <?php
89
  }
90
 
91
+ //Day limit
92
+ function gce_add_day_limit_field(){
93
+ ?>
94
+ <span class="description"><?php _e('The number of days in the future to retrieve events for (from 12:00am today). Leave blank for no day limit.', GCE_TEXT_DOMAIN); ?></span>
95
+ <br />
96
+ <input type="text" name="gce_options[day_limit]" size="3" />
97
+ <?php
98
+ }
99
+
100
  //Date format
101
  function gce_add_date_format_field(){
102
  ?>
137
  <?php
138
  }
139
 
140
+ //Multiple day events
141
+ function gce_add_multiple_field(){
142
+ ?>
143
+ <span class="description"><?php _e('Show events that span multiple days on each day that they span (There are some <a href="http://www.rhanney.co.uk/2010/08/19/google-calendar-events-0-4#multiday">limitations</a> of this feature to be aware of).', GCE_TEXT_DOMAIN); ?></span>
144
+ <br />
145
+ <input type="checkbox" name="gce_options[multiple_day]" value="true" />
146
+ <br /><br />
147
+ <?php
148
+ }
149
+
150
 
151
  //Display options
152
  function gce_add_display_main_text(){
158
 
159
  function gce_add_display_start_field(){
160
  ?>
161
+ <span class="description"><?php _e('Select how to display the start date / time.', GCE_TEXT_DOMAIN); ?></span>
162
+ <br />
163
+ <select name="gce_options[display_start]">
164
+ <option value="none"><?php _e('Don\'t display start time or date', GCE_TEXT_DOMAIN); ?></option>
165
+ <option value="time" selected="selected"><?php _e('Display start time', GCE_TEXT_DOMAIN); ?></option>
166
+ <option value="date"><?php _e('Display start date', GCE_TEXT_DOMAIN); ?></option>
167
+ <option value="time-date"><?php _e('Display start time and date (in that order)', GCE_TEXT_DOMAIN); ?></option>
168
+ <option value="date-time"><?php _e('Display start date and time (in that order)', GCE_TEXT_DOMAIN); ?></option>
169
+ </select>
170
  <br /><br />
 
171
  <span class="description"><?php _e('Text to display before the start time.', GCE_TEXT_DOMAIN); ?></span>
172
+ <br />
173
+ <input type="text" name="gce_options[display_start_text]" value="Starts:" />
174
  <?php
175
  }
176
 
177
  function gce_add_display_end_field(){
178
  ?>
179
+ <span class="description"><?php _e('Select how to display the end date / time.', GCE_TEXT_DOMAIN); ?></span>
180
+ <br />
181
+ <select name="gce_options[display_end]">
182
+ <option value="none"><?php _e('Don\'t display end time or date', GCE_TEXT_DOMAIN); ?></option>
183
+ <option value="time"><?php _e('Display end time', GCE_TEXT_DOMAIN); ?></option>
184
+ <option value="date"><?php _e('Display end date', GCE_TEXT_DOMAIN); ?></option>
185
+ <option value="time-date" selected="selected"><?php _e('Display end time and date (in that order)', GCE_TEXT_DOMAIN); ?></option>
186
+ <option value="date-time"><?php _e('Display end date and time (in that order)', GCE_TEXT_DOMAIN); ?></option>
187
+ </select>
188
  <br /><br />
189
+ <span class="description"><?php _e('Text to display before the end time.', GCE_TEXT_DOMAIN); ?></span>
190
+ <br />
191
  <input type="text" name="gce_options[display_end_text]" value="Ends:" />
192
+ <?php
193
+ }
194
+
195
+ function gce_add_display_separator_field(){
196
+ ?>
197
+ <span class="description"><?php _e('If you have chosen to display both the time and date above, enter the text / characters to display between the time and date here (including any spaces).', GCE_TEXT_DOMAIN); ?></span>
198
+ <br />
199
+ <input type="text" name="gce_options[display_separator]" value=", " />
200
  <?php
201
  }
202
 
205
  <input type="checkbox" name="gce_options[display_location]" value="on" />
206
  <span class="description"><?php _e('Show the location of events?', GCE_TEXT_DOMAIN); ?></span>
207
  <br /><br />
 
208
  <span class="description"><?php _e('Text to display before the location.', GCE_TEXT_DOMAIN); ?></span>
209
+ <br />
210
+ <input type="text" name="gce_options[display_location_text]" value="Location:" />
211
  <?php
212
  }
213
 
216
  <input type="checkbox" name="gce_options[display_desc]" value="on" />
217
  <span class="description"><?php _e('Show the description of events? (URLs in the description will be made into links).', GCE_TEXT_DOMAIN); ?></span>
218
  <br /><br />
 
219
  <span class="description"><?php _e('Text to display before the description.', GCE_TEXT_DOMAIN); ?></span>
220
+ <br />
221
+ <input type="text" name="gce_options[display_desc_text]" value="Description:" />
222
+ <br /><br />
223
+ <span class="description"><?php _e('Maximum number of words to show from description. Leave blank for no limit.', GCE_TEXT_DOMAIN); ?></span>
224
+ <br />
225
+ <input type="text" name="gce_options[display_desc_limit]" size="3" />
226
  <?php
227
  }
228
 
234
  <input type="checkbox" name="gce_options[display_link_target]" value="on" />
235
  <span class="description"><?php _e('Links open in a new window / tab?', GCE_TEXT_DOMAIN); ?></span>
236
  <br /><br />
 
237
  <span class="description"><?php _e('The link text to be displayed.', GCE_TEXT_DOMAIN); ?></span>
238
+ <br />
239
+ <input type="text" name="gce_options[display_link_text]" value="More details" />
240
  <?php
241
  }
242
  ?>
admin/edit.php CHANGED
@@ -7,23 +7,26 @@ if(isset($_GET['action'])){
7
  }
8
 
9
  add_settings_section('gce_edit', __('Edit Feed', GCE_TEXT_DOMAIN), 'gce_edit_main_text', 'edit_feed');
10
- //Unique ID //Title //Function //Page //Section ID
11
- add_settings_field('gce_edit_id_field', __('Feed ID', GCE_TEXT_DOMAIN), 'gce_edit_id_field', 'edit_feed', 'gce_edit');
12
- add_settings_field('gce_edit_title_field', __('Feed Title', GCE_TEXT_DOMAIN), 'gce_edit_title_field', 'edit_feed', 'gce_edit');
13
- add_settings_field('gce_edit_url_field', __('Feed URL', GCE_TEXT_DOMAIN), 'gce_edit_url_field', 'edit_feed', 'gce_edit');
14
- add_settings_field('gce_edit_show_past_events_field', __('Retrieve past events for current month?', GCE_TEXT_DOMAIN), 'gce_edit_show_past_events_field', 'edit_feed', 'gce_edit');
15
- add_settings_field('gce_edit_max_events_field', __('Maximum number of events to retrieve', GCE_TEXT_DOMAIN), 'gce_edit_max_events_field', 'edit_feed', 'gce_edit');
16
- add_settings_field('gce_edit_date_format_field', __('Date format', GCE_TEXT_DOMAIN), 'gce_edit_date_format_field', 'edit_feed', 'gce_edit');
17
- add_settings_field('gce_edit_time_format_field', __('Time format', GCE_TEXT_DOMAIN), 'gce_edit_time_format_field', 'edit_feed', 'gce_edit');
18
- add_settings_field('gce_edit_timezone_field', __('Timezone adjustment', GCE_TEXT_DOMAIN), 'gce_edit_timezone_field', 'edit_feed', 'gce_edit');
19
- add_settings_field('gce_edit_cache_duration_field', __('Cache duration', GCE_TEXT_DOMAIN), 'gce_edit_cache_duration_field', 'edit_feed', 'gce_edit');
 
 
20
 
21
  add_settings_section('gce_edit_display', __('Display Options', GCE_TEXT_DOMAIN), 'gce_edit_display_main_text', 'edit_display');
22
- add_settings_field('gce_edit_display_start_field', __('Display start time?', GCE_TEXT_DOMAIN), 'gce_edit_display_start_field', 'edit_display', 'gce_edit_display');
23
- add_settings_field('gce_edit_display_end_field', __('Display end time and date?', GCE_TEXT_DOMAIN), 'gce_edit_display_end_field', 'edit_display', 'gce_edit_display');
24
- add_settings_field('gce_edit_display_location_field', __('Display location?', GCE_TEXT_DOMAIN), 'gce_edit_display_location_field', 'edit_display', 'gce_edit_display');
25
- add_settings_field('gce_edit_display_desc_field', __('Display description?', GCE_TEXT_DOMAIN), 'gce_edit_display_desc_field', 'edit_display', 'gce_edit_display');
26
- add_settings_field('gce_edit_display_link_field', __('Display link to event?', GCE_TEXT_DOMAIN), 'gce_edit_display_link_field', 'edit_display', 'gce_edit_display');
 
27
 
28
  //Main text
29
  function gce_edit_main_text(){
@@ -58,7 +61,7 @@ function gce_edit_url_field(){
58
  $options = get_option(GCE_OPTIONS_NAME);
59
  $options = $options[$_GET['id']];
60
  ?>
61
- <span class="description"><?php _e('This will probably be something like: \'http://www.google.com/calendar/feeds/your-email@gmail.com/public/full\'.', GCE_TEXT_DOMAIN); ?></span>
62
  <br />
63
  <input type="text" name="gce_options[url]" value="<?php echo $options['url']; ?>" size="100" />
64
  <?php
@@ -69,12 +72,9 @@ function gce_edit_show_past_events_field(){
69
  $options = get_option(GCE_OPTIONS_NAME);
70
  $options = $options[$_GET['id']];
71
  ?>
72
- <span class="description"><?php _e('Select No to retrieve events from now onwards. Select Yes to retrieve events from the first of this month onwards.', GCE_TEXT_DOMAIN); ?></span>
73
- <fieldset>
74
- <label><input type="radio" name="gce_options[show_past_events]" value="false"<?php checked($options['show_past_events'], 'false'); ?> /> <?php _e('No', GCE_TEXT_DOMAIN); ?></label>
75
- <br />
76
- <label><input type="radio" name="gce_options[show_past_events]" value="true"<?php checked($options['show_past_events'], 'true'); ?> /> <?php _e('Yes', GCE_TEXT_DOMAIN); ?></label>
77
- </fieldset>
78
  <?php
79
  }
80
 
@@ -89,6 +89,17 @@ function gce_edit_max_events_field(){
89
  <?php
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
92
  //Date format
93
  function gce_edit_date_format_field(){
94
  $options = get_option(GCE_OPTIONS_NAME);
@@ -137,8 +148,20 @@ function gce_edit_cache_duration_field(){
137
  <?php
138
  }
139
 
140
- //display options
 
 
 
 
 
 
 
 
 
 
141
 
 
 
142
  function gce_edit_display_main_text(){
143
  ?>
144
  <p><?php _e('These settings control what information will be displayed for this feed in the tooltip (for grids), or in a list.', GCE_TEXT_DOMAIN); ?></p>
@@ -150,11 +173,19 @@ function gce_edit_display_start_field(){
150
  $options = get_option(GCE_OPTIONS_NAME);
151
  $options = $options[$_GET['id']];
152
  ?>
153
- <input type="checkbox" name="gce_options[display_start]"<?php checked($options['display_start'], 'on'); ?> value="on" />
154
- <span class="description"><?php _e('Show the start time of events?', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
 
155
  <br /><br />
156
- <input type="text" name="gce_options[display_start_text]" value="<?php echo stripslashes(esc_html($options['display_start_text'])); ?>" />
157
  <span class="description"><?php _e('Text to display before the start time.', GCE_TEXT_DOMAIN); ?></span>
 
 
158
  <?php
159
  }
160
 
@@ -162,11 +193,29 @@ function gce_edit_display_end_field(){
162
  $options = get_option(GCE_OPTIONS_NAME);
163
  $options = $options[$_GET['id']];
164
  ?>
165
- <input type="checkbox" name="gce_options[display_end]"<?php checked($options['display_end'], 'on'); ?> value="on" />
166
- <span class="description"><?php _e('Show the end time and date of events? (Date will be shown as well as time as events can span several days).', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
 
167
  <br /><br />
168
- <input type="text" name="gce_options[display_end_text]" value="<?php echo stripslashes(esc_html($options['display_end_text'])); ?>" />
169
- <span class="description"><?php _e('Text to display before the end time / date.', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
 
 
 
 
 
170
  <?php
171
  }
172
 
@@ -177,8 +226,9 @@ function gce_edit_display_location_field(){
177
  <input type="checkbox" name="gce_options[display_location]"<?php checked($options['display_location'], 'on'); ?> value="on" />
178
  <span class="description"><?php _e('Show the location of events?', GCE_TEXT_DOMAIN); ?></span>
179
  <br /><br />
180
- <input type="text" name="gce_options[display_location_text]" value="<?php echo stripslashes(esc_html($options['display_location_text'])); ?>" />
181
  <span class="description"><?php _e('Text to display before the location.', GCE_TEXT_DOMAIN); ?></span>
 
 
182
  <?php
183
  }
184
 
@@ -189,8 +239,13 @@ function gce_edit_display_desc_field(){
189
  <input type="checkbox" name="gce_options[display_desc]"<?php checked($options['display_desc'], 'on'); ?> value="on" />
190
  <span class="description"><?php _e('Show the description of events? (URLs in the description will be made into links).', GCE_TEXT_DOMAIN); ?></span>
191
  <br /><br />
192
- <input type="text" name="gce_options[display_desc_text]" value="<?php echo stripslashes(esc_html($options['display_desc_text'])); ?>" />
193
  <span class="description"><?php _e('Text to display before the description.', GCE_TEXT_DOMAIN); ?></span>
 
 
 
 
 
 
194
  <?php
195
  }
196
 
@@ -204,8 +259,9 @@ function gce_edit_display_link_field(){
204
  <input type="checkbox" name="gce_options[display_link_target]"<?php checked($options['display_link_target'], 'on'); ?> value="on" />
205
  <span class="description"><?php _e('Links open in a new window / tab?', GCE_TEXT_DOMAIN); ?></span>
206
  <br /><br />
207
- <input type="text" name="gce_options[display_link_text]" value="<?php echo stripslashes(esc_html($options['display_link_text'])); ?>" />
208
  <span class="description"><?php _e('The link text to be displayed.', GCE_TEXT_DOMAIN); ?></span>
 
 
209
  <?php
210
  }
211
  ?>
7
  }
8
 
9
  add_settings_section('gce_edit', __('Edit Feed', GCE_TEXT_DOMAIN), 'gce_edit_main_text', 'edit_feed');
10
+ //Unique ID //Title //Function //Page //Section ID
11
+ add_settings_field('gce_edit_id_field', __('Feed ID', GCE_TEXT_DOMAIN), 'gce_edit_id_field', 'edit_feed', 'gce_edit');
12
+ add_settings_field('gce_edit_title_field', __('Feed Title', GCE_TEXT_DOMAIN), 'gce_edit_title_field', 'edit_feed', 'gce_edit');
13
+ add_settings_field('gce_edit_url_field', __('Feed URL', GCE_TEXT_DOMAIN), 'gce_edit_url_field', 'edit_feed', 'gce_edit');
14
+ add_settings_field('gce_edit_show_past_events_field', __('Retrieve past events for current month?', GCE_TEXT_DOMAIN), 'gce_edit_show_past_events_field', 'edit_feed', 'gce_edit');
15
+ add_settings_field('gce_edit_max_events_field', __('Maximum number of events to retrieve', GCE_TEXT_DOMAIN), 'gce_edit_max_events_field', 'edit_feed', 'gce_edit');
16
+ add_settings_field('gce_edit_day_limit_field', __('Number of days in the future to retrieve events for', GCE_TEXT_DOMAIN), 'gce_edit_day_limit_field', 'edit_feed', 'gce_edit');
17
+ add_settings_field('gce_edit_date_format_field', __('Date format', GCE_TEXT_DOMAIN), 'gce_edit_date_format_field', 'edit_feed', 'gce_edit');
18
+ add_settings_field('gce_edit_time_format_field', __('Time format', GCE_TEXT_DOMAIN), 'gce_edit_time_format_field', 'edit_feed', 'gce_edit');
19
+ add_settings_field('gce_edit_timezone_field', __('Timezone adjustment', GCE_TEXT_DOMAIN), 'gce_edit_timezone_field', 'edit_feed', 'gce_edit');
20
+ add_settings_field('gce_edit_cache_duration_field', __('Cache duration', GCE_TEXT_DOMAIN), 'gce_edit_cache_duration_field', 'edit_feed', 'gce_edit');
21
+ add_settings_field('gce_edit_multiple_field', __('Show multiple day events on each day?', GCE_TEXT_DOMAIN), 'gce_edit_multiple_field', 'edit_feed', 'gce_edit');
22
 
23
  add_settings_section('gce_edit_display', __('Display Options', GCE_TEXT_DOMAIN), 'gce_edit_display_main_text', 'edit_display');
24
+ add_settings_field('gce_edit_display_start_field', __('Display start time / date?', GCE_TEXT_DOMAIN), 'gce_edit_display_start_field', 'edit_display', 'gce_edit_display');
25
+ add_settings_field('gce_edit_display_end_field', __('Display end time / date?', GCE_TEXT_DOMAIN), 'gce_edit_display_end_field', 'edit_display', 'gce_edit_display');
26
+ add_settings_field('gce_edit_display_separator_field', __('Separator text / characters', GCE_TEXT_DOMAIN), 'gce_edit_display_separator_field', 'edit_display', 'gce_edit_display');
27
+ add_settings_field('gce_edit_display_location_field', __('Display location?', GCE_TEXT_DOMAIN), 'gce_edit_display_location_field', 'edit_display', 'gce_edit_display');
28
+ add_settings_field('gce_edit_display_desc_field', __('Display description?', GCE_TEXT_DOMAIN), 'gce_edit_display_desc_field', 'edit_display', 'gce_edit_display');
29
+ add_settings_field('gce_edit_display_link_field', __('Display link to event?', GCE_TEXT_DOMAIN), 'gce_edit_display_link_field', 'edit_display', 'gce_edit_display');
30
 
31
  //Main text
32
  function gce_edit_main_text(){
61
  $options = get_option(GCE_OPTIONS_NAME);
62
  $options = $options[$_GET['id']];
63
  ?>
64
+ <span class="description"><?php _e('This will probably be something like: <code>http://www.google.com/calendar/feeds/your-email@gmail.com/public/full</code>.', GCE_TEXT_DOMAIN); ?></span>
65
  <br />
66
  <input type="text" name="gce_options[url]" value="<?php echo $options['url']; ?>" size="100" />
67
  <?php
72
  $options = get_option(GCE_OPTIONS_NAME);
73
  $options = $options[$_GET['id']];
74
  ?>
75
+ <span class="description"><?php _e('If checked, events will be retrieved from the first of this month onwards. If unchecked, events will be retrieved from today onwards.', GCE_TEXT_DOMAIN); ?></span>
76
+ <br />
77
+ <input type="checkbox" name="gce_options[show_past_events]" value="true"<?php checked($options['show_past_events'], 'true'); ?> />
 
 
 
78
  <?php
79
  }
80
 
89
  <?php
90
  }
91
 
92
+ //Day limit
93
+ function gce_edit_day_limit_field(){
94
+ $options = get_option(GCE_OPTIONS_NAME);
95
+ $options = $options[$_GET['id']];
96
+ ?>
97
+ <span class="description"><?php _e('The number of days in the future to retrieve events for (from 12:00am today). Leave blank for no day limit.', GCE_TEXT_DOMAIN); ?></span>
98
+ <br />
99
+ <input type="text" name="gce_options[day_limit]" value="<?php echo $options['day_limit']; ?>" size="3" />
100
+ <?php
101
+ }
102
+
103
  //Date format
104
  function gce_edit_date_format_field(){
105
  $options = get_option(GCE_OPTIONS_NAME);
148
  <?php
149
  }
150
 
151
+ //Multiple day events
152
+ function gce_edit_multiple_field(){
153
+ $options = get_option(GCE_OPTIONS_NAME);
154
+ $options = $options[$_GET['id']];
155
+ ?>
156
+ <span class="description"><?php _e('Show events that span multiple days on each day that they span (There are some <a href="http://www.rhanney.co.uk/2010/08/19/google-calendar-events-0-4#multiday">limitations</a> of this feature to be aware of).', GCE_TEXT_DOMAIN); ?></span>
157
+ <br />
158
+ <input type="checkbox" name="gce_options[multiple_day]" value="true"<?php checked($options['multiple_day'], 'true'); ?> />
159
+ <br /><br />
160
+ <?php
161
+ }
162
 
163
+
164
+ //Display options
165
  function gce_edit_display_main_text(){
166
  ?>
167
  <p><?php _e('These settings control what information will be displayed for this feed in the tooltip (for grids), or in a list.', GCE_TEXT_DOMAIN); ?></p>
173
  $options = get_option(GCE_OPTIONS_NAME);
174
  $options = $options[$_GET['id']];
175
  ?>
176
+ <span class="description"><?php _e('Select how to display the start date / time.', GCE_TEXT_DOMAIN); ?></span>
177
+ <br />
178
+ <select name="gce_options[display_start]">
179
+ <option value="none"<?php selected($options['display_start'], 'none'); ?>><?php _e('Don\'t display start time or date', GCE_TEXT_DOMAIN); ?></option>
180
+ <option value="time"<?php selected($options['display_start'], 'time'); ?>><?php _e('Display start time', GCE_TEXT_DOMAIN); ?></option>
181
+ <option value="date"<?php selected($options['display_start'], 'date'); ?>><?php _e('Display start date', GCE_TEXT_DOMAIN); ?></option>
182
+ <option value="time-date"<?php selected($options['display_start'], 'time-date'); ?>><?php _e('Display start time and date (in that order)', GCE_TEXT_DOMAIN); ?></option>
183
+ <option value="date-time"<?php selected($options['display_start'], 'date-time'); ?>><?php _e('Display start date and time (in that order)', GCE_TEXT_DOMAIN); ?></option>
184
+ </select>
185
  <br /><br />
 
186
  <span class="description"><?php _e('Text to display before the start time.', GCE_TEXT_DOMAIN); ?></span>
187
+ <br />
188
+ <input type="text" name="gce_options[display_start_text]" value="<?php echo $options['display_start_text']; ?>" />
189
  <?php
190
  }
191
 
193
  $options = get_option(GCE_OPTIONS_NAME);
194
  $options = $options[$_GET['id']];
195
  ?>
196
+ <span class="description"><?php _e('Select how to display the end date / time.', GCE_TEXT_DOMAIN); ?></span>
197
+ <br />
198
+ <select name="gce_options[display_end]">
199
+ <option value="none"<?php selected($options['display_end'], 'none'); ?>><?php _e('Don\'t display end time or date', GCE_TEXT_DOMAIN); ?></option>
200
+ <option value="time"<?php selected($options['display_end'], 'time'); ?>><?php _e('Display end time', GCE_TEXT_DOMAIN); ?></option>
201
+ <option value="date"<?php selected($options['display_end'], 'date'); ?>><?php _e('Display end date', GCE_TEXT_DOMAIN); ?></option>
202
+ <option value="time-date"<?php selected($options['display_end'], 'time-date'); ?>><?php _e('Display end time and date (in that order)', GCE_TEXT_DOMAIN); ?></option>
203
+ <option value="date-time"<?php selected($options['display_end'], 'date-time'); ?>><?php _e('Display end date and time (in that order)', GCE_TEXT_DOMAIN); ?></option>
204
+ </select>
205
  <br /><br />
206
+ <span class="description"><?php _e('Text to display before the end time.', GCE_TEXT_DOMAIN); ?></span>
207
+ <br />
208
+ <input type="text" name="gce_options[display_end_text]" value="<?php echo $options['display_end_text']; ?>" />
209
+ <?php
210
+ }
211
+
212
+ function gce_edit_display_separator_field(){
213
+ $options = get_option(GCE_OPTIONS_NAME);
214
+ $options = $options[$_GET['id']];
215
+ ?>
216
+ <span class="description"><?php _e('If you have chosen to display both the time and date above, enter the text / characters to display between the time and date here (including any spaces).', GCE_TEXT_DOMAIN); ?></span>
217
+ <br />
218
+ <input type="text" name="gce_options[display_separator]" value="<?php echo $options['display_separator']; ?>" />
219
  <?php
220
  }
221
 
226
  <input type="checkbox" name="gce_options[display_location]"<?php checked($options['display_location'], 'on'); ?> value="on" />
227
  <span class="description"><?php _e('Show the location of events?', GCE_TEXT_DOMAIN); ?></span>
228
  <br /><br />
 
229
  <span class="description"><?php _e('Text to display before the location.', GCE_TEXT_DOMAIN); ?></span>
230
+ <br />
231
+ <input type="text" name="gce_options[display_location_text]" value="<?php echo stripslashes(esc_html($options['display_location_text'])); ?>" />
232
  <?php
233
  }
234
 
239
  <input type="checkbox" name="gce_options[display_desc]"<?php checked($options['display_desc'], 'on'); ?> value="on" />
240
  <span class="description"><?php _e('Show the description of events? (URLs in the description will be made into links).', GCE_TEXT_DOMAIN); ?></span>
241
  <br /><br />
 
242
  <span class="description"><?php _e('Text to display before the description.', GCE_TEXT_DOMAIN); ?></span>
243
+ <br />
244
+ <input type="text" name="gce_options[display_desc_text]" value="<?php echo stripslashes(esc_html($options['display_desc_text'])); ?>" />
245
+ <br /><br />
246
+ <span class="description"><?php _e('Maximum number of words to show from description. Leave blank for no limit.', GCE_TEXT_DOMAIN); ?></span>
247
+ <br />
248
+ <input type="text" name="gce_options[display_desc_limit]" value="<?php echo $options['display_desc_limit']; ?>" size="3" />
249
  <?php
250
  }
251
 
259
  <input type="checkbox" name="gce_options[display_link_target]"<?php checked($options['display_link_target'], 'on'); ?> value="on" />
260
  <span class="description"><?php _e('Links open in a new window / tab?', GCE_TEXT_DOMAIN); ?></span>
261
  <br /><br />
 
262
  <span class="description"><?php _e('The link text to be displayed.', GCE_TEXT_DOMAIN); ?></span>
263
+ <br />
264
+ <input type="text" name="gce_options[display_link_text]" value="<?php echo stripslashes(esc_html($options['display_link_text'])); ?>" />
265
  <?php
266
  }
267
  ?>
admin/main.php CHANGED
@@ -7,8 +7,9 @@
7
  <h3><?php _e('Current Feeds', GCE_TEXT_DOMAIN); ?></h3>
8
 
9
  <?php
10
- //If there are no saved feeds
11
  $options = get_option(GCE_OPTIONS_NAME);
 
12
  if(empty($options)){
13
  ?>
14
 
@@ -43,9 +44,7 @@
43
  <td><?php echo $event['title']; ?></td>
44
  <td><?php echo $event['url']; ?></td>
45
  <td align="right">
46
- <a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=edit&id=' . $key); ?>"><?php _e('Edit', GCE_TEXT_DOMAIN); ?></a>
47
- |
48
- <a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=delete&id=' . $key); ?>"><?php _e('Delete', GCE_TEXT_DOMAIN); ?></a>
49
  </td>
50
  </tr>
51
  <?php } ?>
@@ -53,13 +52,41 @@
53
 
54
  </table>
55
 
56
- <?php } ?>
 
 
 
57
 
58
  <br />
59
- <h3><?php _e('Custom Stylesheet', GCE_TEXT_DOMAIN); ?></h3>
60
- <p><?php _e('If you would rather use a custom CSS stylesheet than the default, enter the stylesheet URL below. Leave blank to use the default.', GCE_TEXT_DOMAIN); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
- <p><input type="text" name="gce_stylesheet" value="<?php echo get_option('gce_stylesheet'); ?>" size="100" /></p>
63
 
64
- <input type="submit" class="button-primary" value="<?php esc_attr_e('Save URL', GCE_TEXT_DOMAIN); ?>" />
65
  </div>
7
  <h3><?php _e('Current Feeds', GCE_TEXT_DOMAIN); ?></h3>
8
 
9
  <?php
10
+ //Get saved feed options
11
  $options = get_option(GCE_OPTIONS_NAME);
12
+ //If there are no saved feeds
13
  if(empty($options)){
14
  ?>
15
 
44
  <td><?php echo $event['title']; ?></td>
45
  <td><?php echo $event['url']; ?></td>
46
  <td align="right">
47
+ <a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=edit&id=' . $key); ?>"><?php _e('Edit', GCE_TEXT_DOMAIN); ?></a>&nbsp;|&nbsp;<a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=delete&id=' . $key); ?>"><?php _e('Delete', GCE_TEXT_DOMAIN); ?></a>
 
 
48
  </td>
49
  </tr>
50
  <?php } ?>
52
 
53
  </table>
54
 
55
+ <?php }
56
+ //Get saved general options
57
+ $options = get_option(GCE_GENERAL_OPTIONS_NAME);
58
+ ?>
59
 
60
  <br />
61
+ <h3><?php _e('General Options', GCE_TEXT_DOMAIN); ?></h3>
62
+
63
+ <table class="form-table">
64
+ <tr>
65
+ <th scope="row"><?php _e('Custom stylesheet URL', GCE_TEXT_DOMAIN); ?></th>
66
+ <td>
67
+ <span class="description"><?php _e('If you want to make changes to the default CSS, make a copy of <code>google-calendar-events/css/gce-style.css</code> on your server. Make any
68
+ changes to the copy. Enter the URL to the copied file below.', GCE_TEXT_DOMAIN); ?></span>
69
+ <br />
70
+ <input type="text" name="gce_general[stylesheet]" value="<?php echo $options['stylesheet']; ?>" size="100" />
71
+ </td>
72
+ </tr><tr>
73
+ <th scope="row"><?php _e('Add JavaScript to footer?', GCE_TEXT_DOMAIN); ?></th>
74
+ <td>
75
+ <span class="description"><?php _e('If you are having issues with tooltips not appearing or the AJAX functionality not working, try ticking the checkbox below.', GCE_TEXT_DOMAIN); ?></span>
76
+ <br />
77
+ <input type="checkbox" name="gce_general[javascript]"<?php checked($options['javascript'], true); ?> value="on" />
78
+ </td>
79
+ </tr><tr>
80
+ <th scope="row"><?php _e('Loading text', GCE_TEXT_DOMAIN); ?></th>
81
+ <td>
82
+ <span class="description"><?php _e('Text to display while calendar data is loading (on AJAX requests)', GCE_TEXT_DOMAIN); ?></span>
83
+ <br />
84
+ <input type="text" name="gce_general[loading]" value="<?php echo $options['loading']; ?>" />
85
+ </td>
86
+ </tr>
87
+ </table>
88
 
89
+ <br />
90
 
91
+ <input type="submit" class="button-primary" value="<?php _e('Save', GCE_TEXT_DOMAIN); ?>" />
92
  </div>
css/gce-style.css CHANGED
@@ -43,17 +43,21 @@
43
  }
44
 
45
  .gce-page-grid .gce-calendar .gce-next,
46
- .gce-page-grid .gce-calendar .gce-prev{
47
  cursor:pointer;
48
  display:inline-block;
49
  width:3%;
50
  }
51
 
52
- .gce-page-grid .gce-calendar .gce-month-title{
53
  display:inline-block;
54
  width:90%;
55
  }
56
 
 
 
 
 
57
  /* PAGE LIST */
58
 
59
  .gce-page-list .gce-list{ /* The list itself */
@@ -81,6 +85,12 @@
81
  font-weight:bold;
82
  }
83
 
 
 
 
 
 
 
84
  /* Also available: .gce-list-start, .gce-list-end, .gce-list-loc, .gce-list-desc, .gce-list-link */
85
 
86
 
@@ -133,6 +143,10 @@
133
  width:80%;
134
  }
135
 
 
 
 
 
136
  /* WIDGET LIST */
137
 
138
  .gce-widget-list .gce-list{ /* The list itself */
@@ -152,13 +166,19 @@
152
  }
153
 
154
  .gce-widget-list .gce-list .gce-list-event{ /* The event title */
155
-
156
  }
157
 
158
  .gce-widget-list .gce-list .gce-list-title{ /* The title (not the same as event title) */
159
  font-weight:bold;
160
  }
161
 
 
 
 
 
 
 
162
  /* Also available: .gce-list-start, .gce-list-end, .gce-list-loc, .gce-list-desc, .gce-list-link */
163
 
164
 
43
  }
44
 
45
  .gce-page-grid .gce-calendar .gce-next,
46
+ .gce-page-grid .gce-calendar .gce-prev{ /* Previous and next month links */
47
  cursor:pointer;
48
  display:inline-block;
49
  width:3%;
50
  }
51
 
52
+ .gce-page-grid .gce-calendar .gce-month-title{ /* Month title */
53
  display:inline-block;
54
  width:90%;
55
  }
56
 
57
+ .gce-page-grid .gce-calendar th abbr{ /* Day letter abbreviation */
58
+ border-bottom:none !important;
59
+ }
60
+
61
  /* PAGE LIST */
62
 
63
  .gce-page-list .gce-list{ /* The list itself */
85
  font-weight:bold;
86
  }
87
 
88
+ .gce-page-list .gce-list ul{
89
+ list-style-type:none;
90
+ margin:0 !important;
91
+ padding:0 !important;
92
+ }
93
+
94
  /* Also available: .gce-list-start, .gce-list-end, .gce-list-loc, .gce-list-desc, .gce-list-link */
95
 
96
 
143
  width:80%;
144
  }
145
 
146
+ .gce-widget-grid .gce-calendar th abbr{ /* Day name abbreviations */
147
+ border-bottom:none !important;
148
+ }
149
+
150
  /* WIDGET LIST */
151
 
152
  .gce-widget-list .gce-list{ /* The list itself */
166
  }
167
 
168
  .gce-widget-list .gce-list .gce-list-event{ /* The event title */
169
+ background-color:#DDDDDD;
170
  }
171
 
172
  .gce-widget-list .gce-list .gce-list-title{ /* The title (not the same as event title) */
173
  font-weight:bold;
174
  }
175
 
176
+ .gce-widget-list .gce-list ul{
177
+ list-style-type:none;
178
+ margin:0 !important;
179
+ padding:0 !important;
180
+ }
181
+
182
  /* Also available: .gce-list-start, .gce-list-end, .gce-list-loc, .gce-list-desc, .gce-list-link */
183
 
184
 
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.3.1
7
  Author: Ross Hanney
8
  Author URI: http://www.rhanney.co.uk
9
  License: GPL2
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
  define('GCE_PLUGIN_NAME', str_replace('.php', '', basename(__FILE__)));
31
  define('GCE_TEXT_DOMAIN', 'google-calendar-events');
32
  define('GCE_OPTIONS_NAME', 'gce_options');
33
- define('GCE_GROUP_OPTIONS_NAME', 'gce_group_options');
34
 
35
  require_once 'widget/gce-widget.php';
36
  require_once 'inc/gce-parser.php';
@@ -53,13 +53,17 @@ if(!class_exists('Google_Calendar_Events')){
53
  add_action('widgets_init', create_function('', 'return register_widget("GCE_Widget");'));
54
  add_action('wp_ajax_gce_ajax', array($this, 'gce_ajax'));
55
  add_action('wp_ajax_nopriv_gce_ajax', array($this, 'gce_ajax'));
 
56
  add_shortcode('google-calendar-events', array($this, 'shortcode_handler'));
57
  }
58
 
59
  //If any new options have been added between versions, this will update any saved feeds with defaults for new options (shouldn't overwrite anything saved)
 
60
  function activate_plugin(){
61
  add_option(GCE_OPTIONS_NAME);
 
62
 
 
63
  $options = get_option(GCE_OPTIONS_NAME);
64
 
65
  if(!empty($options)){
@@ -70,12 +74,14 @@ if(!class_exists('Google_Calendar_Events')){
70
  'url' => '',
71
  'show_past_events' => 'false',
72
  'max_events' => 25,
 
73
  'date_format' => '',
74
  'time_format' => '',
75
  'timezone' => 'default',
76
  'cache_duration' => 43200,
77
- 'display_start' => 'on',
78
- 'display_end' => '',
 
79
  'display_location' => '',
80
  'display_desc' => '',
81
  'display_link' => 'on',
@@ -83,10 +89,16 @@ if(!class_exists('Google_Calendar_Events')){
83
  'display_end_text' => 'Ends:',
84
  'display_location_text' => 'Location:',
85
  'display_desc_text' => 'Description:',
 
86
  'display_link_text' => 'More details',
87
- 'display_link_target' => ''
 
88
  );
89
 
 
 
 
 
90
  //Merge saved options with defaults
91
  foreach($saved_feed_options as $option_name => $option){
92
  $defaults[$option_name] = $saved_feed_options[$option_name];
@@ -96,12 +108,45 @@ if(!class_exists('Google_Calendar_Events')){
96
  }
97
  }
98
 
 
99
  update_option(GCE_OPTIONS_NAME, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
 
102
  function init_plugin(){
103
  //Load text domain for i18n
104
  load_plugin_textdomain(GCE_TEXT_DOMAIN, false, 'languages');
 
 
 
 
 
 
 
105
  }
106
 
107
  //Setup admin settings page
@@ -146,19 +191,19 @@ if(!class_exists('Google_Calendar_Events')){
146
  settings_fields('gce_options');
147
  do_settings_sections('edit_feed');
148
  do_settings_sections('edit_display');
149
- ?><p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes', GCE_TEXT_DOMAIN); ?>" /></p>
150
  <p><a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php'); ?>" class="button-secondary"><?php _e('Cancel', GCE_TEXT_DOMAIN); ?></a></p><?php
151
  break;
152
  //Delete feed section
153
  case 'delete':
154
  settings_fields('gce_options');
155
  do_settings_sections('delete_feed');
156
- ?><p class="submit"><input type="submit" class="button-primary" name="gce_options[submit_delete]" value="<?php _e('Delete Feed', GCE_TEXT_DOMAIN); ?>" /></p>
157
  <p><a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php'); ?>" class="button-secondary"><?php _e('Cancel', GCE_TEXT_DOMAIN); ?></a></p><?php
158
  }
159
  }else{
160
  //Main admin section
161
- settings_fields('gce_stylesheet');
162
  require_once 'admin/main.php';
163
  }
164
  ?>
@@ -169,16 +214,16 @@ if(!class_exists('Google_Calendar_Events')){
169
 
170
  //Initialize admin stuff
171
  function init_admin(){
172
- register_setting('gce_options', 'gce_options', array($this, 'validate_options'));
173
- register_setting('gce_stylesheet', 'gce_stylesheet', 'esc_url');
174
 
175
  require_once 'admin/add.php';
176
  require_once 'admin/edit.php';
177
  require_once 'admin/delete.php';
178
  }
179
 
180
- //Check / validate submitted data before being stored
181
- function validate_options($input){
182
  //Get saved options
183
  $options = get_option(GCE_OPTIONS_NAME);
184
 
@@ -195,9 +240,11 @@ if(!class_exists('Google_Calendar_Events')){
195
  //Escape feed url
196
  $url = esc_url($input['url']);
197
  //Make sure show past events is either true of false
198
- $show_past_events = ($input['show_past_events'] == 'true' ? 'true' : 'false');
199
  //Check max events is a positive integer. If absint returns 0, reset to default (25)
200
  $max_events = (absint($input['max_events']) == 0 ? 25 : absint($input['max_events']));
 
 
201
 
202
  $date_format = wp_filter_kses($input['date_format']);
203
  $time_format = wp_filter_kses($input['time_format']);
@@ -207,17 +254,18 @@ if(!class_exists('Google_Calendar_Events')){
207
 
208
  //Make sure cache duration is a positive integer or 0. If user has typed 0, leave as 0 but if 0 is returned from absint, set to default (43200)
209
  $cache_duration = $input['cache_duration'];
210
- if($cache_duration != '0'){
211
- $cache_duration = (absint($cache_duration) == 0 ? 43200 : absint($cache_duration));
212
- }
213
 
214
- //Tooltip options must be 'on' or null
215
- $display_start = isset($input['display_start']) ? 'on' : null;
216
- $display_end = isset($input['display_end']) ? 'on' : null;
217
- $display_location = isset($input['display_location']) ? 'on' : null;
218
- $display_desc = isset($input['display_desc']) ? 'on' : null;
219
- $display_link = isset($input['display_link']) ? 'on' : null;
220
- $display_link_target = isset($input['display_link_target']) ? 'on' : null;
 
 
 
221
 
222
  //Filter display text
223
  $display_start_text = wp_filter_kses($input['display_start_text']);
@@ -226,6 +274,10 @@ if(!class_exists('Google_Calendar_Events')){
226
  $display_desc_text = wp_filter_kses($input['display_desc_text']);
227
  $display_link_text = wp_filter_kses($input['display_link_text']);
228
 
 
 
 
 
229
  //Fill options array with validated values
230
  $options[$id] = array(
231
  'id' => $id,
@@ -233,10 +285,12 @@ if(!class_exists('Google_Calendar_Events')){
233
  'url' => $url,
234
  'show_past_events' => $show_past_events,
235
  'max_events' => $max_events,
 
236
  'date_format' => $date_format,
237
  'time_format' => $time_format,
238
  'timezone' => $timezone,
239
  'cache_duration' => $cache_duration,
 
240
  'display_start' => $display_start,
241
  'display_end' => $display_end,
242
  'display_location' => $display_location,
@@ -246,14 +300,27 @@ if(!class_exists('Google_Calendar_Events')){
246
  'display_end_text' => $display_end_text,
247
  'display_location_text' => $display_location_text,
248
  'display_desc_text' => $display_desc_text,
 
249
  'display_link_text' => $display_link_text,
250
- 'display_link_target' => $display_link_target
 
251
  );
252
  }
253
 
254
  return $options;
255
  }
256
 
 
 
 
 
 
 
 
 
 
 
 
257
  //Handles the shortcode stuff
258
  function shortcode_handler($atts){
259
  $options = get_option(GCE_OPTIONS_NAME);
@@ -271,7 +338,6 @@ if(!class_exists('Google_Calendar_Events')){
271
 
272
  //Check each id is an integer, if not, remove it from the array
273
  foreach($feed_ids as $key => $feed_id){
274
- //$feed_ids[$key] = absint($feed_id);
275
  if(absint($feed_id) == 0) unset($feed_ids[$key]);
276
  }
277
 
@@ -296,6 +362,7 @@ if(!class_exists('Google_Calendar_Events')){
296
  case 'grid': return gce_print_grid($feed_ids, $title_text);
297
  case 'ajax': return gce_print_grid($feed_ids, $title_text, true);
298
  case 'list': return gce_print_list($feed_ids, $title_text);
 
299
  }
300
  }
301
  }else{
@@ -308,8 +375,9 @@ if(!class_exists('Google_Calendar_Events')){
308
  //Don't add styles if on admin screens
309
  if(!is_admin()){
310
  //If user has entered a URL to a custom stylesheet, use it. Otherwise use the default
311
- if((get_option('gce_stylesheet') != false) && (get_option('gce_stylesheet') != '')){
312
- wp_enqueue_style('gce_styles', get_option('gce_stylesheet'));
 
313
  }else{
314
  wp_enqueue_style('gce_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-style.css');
315
  }
@@ -320,10 +388,16 @@ if(!class_exists('Google_Calendar_Events')){
320
  function add_scripts(){
321
  //Don't add scripts if on admin screens
322
  if(!is_admin()){
 
 
 
323
  wp_enqueue_script('jquery');
324
- wp_enqueue_script('gce_jquery_qtip', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/jquery-qtip.js');
325
- wp_enqueue_script('gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-script.js');
326
- wp_localize_script('gce_scripts', 'GoogleCalendarEvents', array('ajaxurl' => admin_url('admin-ajax.php')));
 
 
 
327
  }
328
  }
329
 
@@ -343,13 +417,13 @@ if(!class_exists('Google_Calendar_Events')){
343
  }
344
  }
345
 
346
- function gce_print_list($feed_ids, $title_text){
347
  //Create new GCE_Parser object, passing array of feed id(s)
348
  $list = new GCE_Parser(explode('-', $feed_ids), $title_text);
349
 
350
  //If the feed(s) parsed ok, return the list markup, otherwise return an error message
351
  if(count($list->get_errors()) == 0){
352
- return '<div class="gce-page-list">' . $list->get_list() . '</div>';
353
  }else{
354
  return sprintf(__('The following feeds were not parsed successfully: %s. Please check that the feed URLs are correct and that the feeds have public sharing enabled.'), implode(', ', $list->get_errors()));
355
  }
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.4
7
  Author: Ross Hanney
8
  Author URI: http://www.rhanney.co.uk
9
  License: GPL2
30
  define('GCE_PLUGIN_NAME', str_replace('.php', '', basename(__FILE__)));
31
  define('GCE_TEXT_DOMAIN', 'google-calendar-events');
32
  define('GCE_OPTIONS_NAME', 'gce_options');
33
+ define('GCE_GENERAL_OPTIONS_NAME', 'gce_general');
34
 
35
  require_once 'widget/gce-widget.php';
36
  require_once 'inc/gce-parser.php';
53
  add_action('widgets_init', create_function('', 'return register_widget("GCE_Widget");'));
54
  add_action('wp_ajax_gce_ajax', array($this, 'gce_ajax'));
55
  add_action('wp_ajax_nopriv_gce_ajax', array($this, 'gce_ajax'));
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
  }
59
 
60
  //If any new options have been added between versions, this will update any saved feeds with defaults for new options (shouldn't overwrite anything saved)
61
+ //Will do the same for general options
62
  function activate_plugin(){
63
  add_option(GCE_OPTIONS_NAME);
64
+ add_option(GCE_GENERAL_OPTIONS_NAME);
65
 
66
+ //Get feed options
67
  $options = get_option(GCE_OPTIONS_NAME);
68
 
69
  if(!empty($options)){
74
  'url' => '',
75
  'show_past_events' => 'false',
76
  'max_events' => 25,
77
+ 'day_limit' => '',
78
  'date_format' => '',
79
  'time_format' => '',
80
  'timezone' => 'default',
81
  'cache_duration' => 43200,
82
+ 'multiple_day' => 'false',
83
+ 'display_start' => 'time',
84
+ 'display_end' => 'time-date',
85
  'display_location' => '',
86
  'display_desc' => '',
87
  'display_link' => 'on',
89
  'display_end_text' => 'Ends:',
90
  'display_location_text' => 'Location:',
91
  'display_desc_text' => 'Description:',
92
+ 'display_desc_limit' => '',
93
  'display_link_text' => 'More details',
94
+ 'display_link_target' => '',
95
+ 'display_separator' => ', '
96
  );
97
 
98
+ //Update old display_start / display_end values
99
+ $saved_feed_options['display_start'] = ($saved_feed_options['display_start'] == 'on' ? 'time' : 'none');
100
+ $saved_feed_options['display_end'] = ($saved_feed_options['display_end'] == 'on' ? 'time-date' : 'none');
101
+
102
  //Merge saved options with defaults
103
  foreach($saved_feed_options as $option_name => $option){
104
  $defaults[$option_name] = $saved_feed_options[$option_name];
108
  }
109
  }
110
 
111
+ //Save feed options
112
  update_option(GCE_OPTIONS_NAME, $options);
113
+
114
+ //Get general options
115
+ $options = get_option(GCE_GENERAL_OPTIONS_NAME);
116
+
117
+ $defaults = array(
118
+ 'stylesheet' => '',
119
+ 'javascript' => false,
120
+ 'loading' => 'Loading...'
121
+ );
122
+
123
+ $old_stylesheet_option = get_option('gce_stylesheet');
124
+
125
+ //If old custom stylesheet options was set, add it to general options, then delete old option
126
+ if($old_stylesheet_option !== false){
127
+ $defaults['stylesheet'] = $old_stylesheet_option;
128
+ delete_option('gce_stylesheet');
129
+ }elseif(isset($options['stylesheet'])){
130
+ $defaults['stylesheet'] = $options['stylesheet'];
131
+ }
132
+
133
+ if(isset($options['javascript'])) $defaults['javascript'] = $options['javascript'];
134
+ if(isset($options['loading'])) $defaults['loading'] = $options['loading'];
135
+
136
+ //Save general options
137
+ update_option(GCE_GENERAL_OPTIONS_NAME, $defaults);
138
  }
139
 
140
  function init_plugin(){
141
  //Load text domain for i18n
142
  load_plugin_textdomain(GCE_TEXT_DOMAIN, false, 'languages');
143
+ if(get_option('timezone_string') != '') date_default_timezone_set(get_option('timezone_string'));
144
+ }
145
+
146
+ //Adds 'Settings' link to main WordPress Plugins page
147
+ function add_settings_link($links){
148
+ array_unshift($links, '<a href="options-general.php?page=google-calendar-events.php">' . __('Settings', GCE_TEXT_DOMAIN) . '</a>');
149
+ return $links;
150
  }
151
 
152
  //Setup admin settings page
191
  settings_fields('gce_options');
192
  do_settings_sections('edit_feed');
193
  do_settings_sections('edit_display');
194
+ ?><p class="submit"><input type="submit" class="button-primary submit" value="<?php _e('Save Changes', GCE_TEXT_DOMAIN); ?>" /></p>
195
  <p><a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php'); ?>" class="button-secondary"><?php _e('Cancel', GCE_TEXT_DOMAIN); ?></a></p><?php
196
  break;
197
  //Delete feed section
198
  case 'delete':
199
  settings_fields('gce_options');
200
  do_settings_sections('delete_feed');
201
+ ?><p class="submit"><input type="submit" class="button-primary submit" name="gce_options[submit_delete]" value="<?php _e('Delete Feed', GCE_TEXT_DOMAIN); ?>" /></p>
202
  <p><a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php'); ?>" class="button-secondary"><?php _e('Cancel', GCE_TEXT_DOMAIN); ?></a></p><?php
203
  }
204
  }else{
205
  //Main admin section
206
+ settings_fields('gce_general');
207
  require_once 'admin/main.php';
208
  }
209
  ?>
214
 
215
  //Initialize admin stuff
216
  function init_admin(){
217
+ register_setting('gce_options', 'gce_options', array($this, 'validate_feed_options'));
218
+ register_setting('gce_general', 'gce_general', array($this, 'validate_general_options'));
219
 
220
  require_once 'admin/add.php';
221
  require_once 'admin/edit.php';
222
  require_once 'admin/delete.php';
223
  }
224
 
225
+ //Check / validate submitted feed options data before being stored
226
+ function validate_feed_options($input){
227
  //Get saved options
228
  $options = get_option(GCE_OPTIONS_NAME);
229
 
240
  //Escape feed url
241
  $url = esc_url($input['url']);
242
  //Make sure show past events is either true of false
243
+ $show_past_events = (isset($input['show_past_events']) ? 'true' : 'false');
244
  //Check max events is a positive integer. If absint returns 0, reset to default (25)
245
  $max_events = (absint($input['max_events']) == 0 ? 25 : absint($input['max_events']));
246
+ //Check day limit is a positive integer. If not (or 0) set to ''
247
+ $day_limit = absint($input['day_limit']) == 0 ? '' : absint($input['day_limit']);
248
 
249
  $date_format = wp_filter_kses($input['date_format']);
250
  $time_format = wp_filter_kses($input['time_format']);
254
 
255
  //Make sure cache duration is a positive integer or 0. If user has typed 0, leave as 0 but if 0 is returned from absint, set to default (43200)
256
  $cache_duration = $input['cache_duration'];
257
+ if($cache_duration != '0') $cache_duration = (absint($cache_duration) == 0 ? 43200 : absint($cache_duration));
 
 
258
 
259
+ $multiple_day = (isset($input['multiple_day']) ? 'true' : 'false');
260
+
261
+ $display_start = esc_html($input['display_start']);
262
+ $display_end = esc_html($input['display_end']);
263
+
264
+ //Display options must be 'on' or null
265
+ $display_location = (isset($input['display_location']) ? 'on' : null);
266
+ $display_desc = (isset($input['display_desc']) ? 'on' : null);
267
+ $display_link = (isset($input['display_link']) ? 'on' : null);
268
+ $display_link_target = (isset($input['display_link_target']) ? 'on' : null);
269
 
270
  //Filter display text
271
  $display_start_text = wp_filter_kses($input['display_start_text']);
274
  $display_desc_text = wp_filter_kses($input['display_desc_text']);
275
  $display_link_text = wp_filter_kses($input['display_link_text']);
276
 
277
+ $display_separator = wp_filter_kses($input['display_separator']);
278
+
279
+ $display_desc_limit = absint($input['display_desc_limit']) == 0 ? '' : absint($input['display_desc_limit']);
280
+
281
  //Fill options array with validated values
282
  $options[$id] = array(
283
  'id' => $id,
285
  'url' => $url,
286
  'show_past_events' => $show_past_events,
287
  'max_events' => $max_events,
288
+ 'day_limit' => $day_limit,
289
  'date_format' => $date_format,
290
  'time_format' => $time_format,
291
  'timezone' => $timezone,
292
  'cache_duration' => $cache_duration,
293
+ 'multiple_day' => $multiple_day,
294
  'display_start' => $display_start,
295
  'display_end' => $display_end,
296
  'display_location' => $display_location,
300
  'display_end_text' => $display_end_text,
301
  'display_location_text' => $display_location_text,
302
  'display_desc_text' => $display_desc_text,
303
+ 'display_desc_limit' => $display_desc_limit,
304
  'display_link_text' => $display_link_text,
305
+ 'display_link_target' => $display_link_target,
306
+ 'display_separator' => $display_separator
307
  );
308
  }
309
 
310
  return $options;
311
  }
312
 
313
+ //Validate submitted general options
314
+ function validate_general_options($input){
315
+ $options = get_option(GCE_GENERAL_OPTIONS_NAME);
316
+
317
+ $options['stylesheet'] = esc_url($input['stylesheet']);
318
+ $options['javascript'] = (isset($input['javascript']) ? true : false);
319
+ $options['loading'] = esc_html($input['loading']);
320
+
321
+ return $options;
322
+ }
323
+
324
  //Handles the shortcode stuff
325
  function shortcode_handler($atts){
326
  $options = get_option(GCE_OPTIONS_NAME);
338
 
339
  //Check each id is an integer, if not, remove it from the array
340
  foreach($feed_ids as $key => $feed_id){
 
341
  if(absint($feed_id) == 0) unset($feed_ids[$key]);
342
  }
343
 
362
  case 'grid': return gce_print_grid($feed_ids, $title_text);
363
  case 'ajax': return gce_print_grid($feed_ids, $title_text, true);
364
  case 'list': return gce_print_list($feed_ids, $title_text);
365
+ case 'list-grouped': return gce_print_list($feed_ids, $title_text, true);
366
  }
367
  }
368
  }else{
375
  //Don't add styles if on admin screens
376
  if(!is_admin()){
377
  //If user has entered a URL to a custom stylesheet, use it. Otherwise use the default
378
+ $options = get_option(GCE_GENERAL_OPTIONS_NAME);
379
+ if(isset($options['stylesheet']) && ($options['stylesheet'] != '')){
380
+ wp_enqueue_style('gce_styles', $options['stylesheet']);
381
  }else{
382
  wp_enqueue_style('gce_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-style.css');
383
  }
388
  function add_scripts(){
389
  //Don't add scripts if on admin screens
390
  if(!is_admin()){
391
+ $options = get_option(GCE_GENERAL_OPTIONS_NAME);
392
+ $add_to_footer = (bool)$options['javascript'];
393
+
394
  wp_enqueue_script('jquery');
395
+ wp_enqueue_script('gce_jquery_qtip', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/jquery-qtip.js', array('jquery'), null, $add_to_footer);
396
+ wp_enqueue_script('gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-script.js', array('jquery'), null, $add_to_footer);
397
+ wp_localize_script('gce_scripts', 'GoogleCalendarEvents', array(
398
+ 'ajaxurl' => admin_url('admin-ajax.php'),
399
+ 'loading' => $options['loading']
400
+ ));
401
  }
402
  }
403
 
417
  }
418
  }
419
 
420
+ function gce_print_list($feed_ids, $title_text, $grouped = false){
421
  //Create new GCE_Parser object, passing array of feed id(s)
422
  $list = new GCE_Parser(explode('-', $feed_ids), $title_text);
423
 
424
  //If the feed(s) parsed ok, return the list markup, otherwise return an error message
425
  if(count($list->get_errors()) == 0){
426
+ return '<div class="gce-page-list">' . $list->get_list($grouped) . '</div>';
427
  }else{
428
  return sprintf(__('The following feeds were not parsed successfully: %s. Please check that the feed URLs are correct and that the feeds have public sharing enabled.'), implode(', ', $list->get_errors()));
429
  }
inc/gce-feed.php CHANGED
@@ -7,6 +7,7 @@ class GCE_Feed extends SimplePie_GCalendar{
7
  var $d_format;
8
  var $t_format;
9
  var $display_opts;
 
10
 
11
  function GCE_Feed(){
12
  $this->__construct();
@@ -36,6 +37,10 @@ class GCE_Feed extends SimplePie_GCalendar{
36
  $this->display_opts = $display_options;
37
  }
38
 
 
 
 
 
39
  //Getters
40
 
41
  function get_feed_id(){
@@ -53,5 +58,9 @@ class GCE_Feed extends SimplePie_GCalendar{
53
  function get_display_options(){
54
  return $this->display_opts;
55
  }
 
 
 
 
56
  }
57
  ?>
7
  var $d_format;
8
  var $t_format;
9
  var $display_opts;
10
+ var $multi_day;
11
 
12
  function GCE_Feed(){
13
  $this->__construct();
37
  $this->display_opts = $display_options;
38
  }
39
 
40
+ function set_multi_day($multiple_day){
41
+ $this->multi_day = $multiple_day;
42
+ }
43
+
44
  //Getters
45
 
46
  function get_feed_id(){
58
  function get_display_options(){
59
  return $this->display_opts;
60
  }
61
+
62
+ function get_multi_day(){
63
+ return $this->multi_day;
64
+ }
65
  }
66
  ?>
inc/gce-parser.php CHANGED
@@ -26,14 +26,22 @@ class GCE_Parser{
26
  $feed->set_feed_id($feed_options['id']);
27
  $feed->set_feed_url($feed_options['url']);
28
  $feed->set_max_events($feed_options['max_events']);
 
 
29
  $feed->set_cache_duration($feed_options['cache_duration']);
30
  //Set the timezone if anything other than default
31
  if($feed_options['timezone'] != 'default') $feed->set_timezone($feed_options['timezone']);
32
- //If show past events is true, set start date to 1st of this month. Otherwise, start date is today
33
- if($feed_options['show_past_events'] == 'true') $feed->set_start_date(mktime(0, 0, 0, date('m'), 1, date('Y')));
 
 
 
 
34
  //Set date and time formats. If they have not been set by user, set to global WordPress formats
35
  $feed->set_date_format($feed_options['date_format'] == '' ? get_option('date_format') : $feed_options['date_format']);
36
  $feed->set_time_format($feed_options['time_format'] == '' ? get_option('time_format') : $feed_options['time_format']);
 
 
37
 
38
  //Sets all display options
39
  $feed->set_display_options(array(
@@ -46,8 +54,10 @@ class GCE_Parser{
46
  'display_end_text' => $feed_options['display_end_text'],
47
  'display_location_text' => $feed_options['display_location_text'],
48
  'display_desc_text' => $feed_options['display_desc_text'],
 
49
  'display_link_text' => $feed_options['display_link_text'],
50
- 'display_link_target' => $feed_options['display_link_target']
 
51
  ));
52
 
53
  //SimplePie does the hard work
@@ -70,6 +80,8 @@ class GCE_Parser{
70
  $errors = array();
71
 
72
  foreach($this->feeds as $feed){
 
 
73
  if($feed->error()) $errors[] = $feed->get_feed_id();
74
  }
75
 
@@ -86,15 +98,22 @@ class GCE_Parser{
86
  //Round start date to nearest day
87
  $start_date = mktime(0, 0, 0, date('m', $start_date), date('d', $start_date) , date('Y', $start_date));
88
 
89
- if(!isset($event_days[$start_date])){
90
- //Create new array in $event_days for this date (only dates with events will go into array, so, for
91
- //example $event_days[26] will exist if 26th of month has events, but won't if it has no events)
92
- //(Now uses unix timestamp rather than day number, but same concept applies).
93
- $event_days[$start_date] = array();
 
 
 
 
 
 
 
94
  }
95
 
96
- //Push event into array just created (may be another event for this date later in feed)
97
- array_push($event_days[$start_date], $item);
98
  }
99
 
100
  return $event_days;
@@ -113,6 +132,7 @@ class GCE_Parser{
113
 
114
  //Get events data
115
  $event_days = $this->get_event_days();
 
116
  //If event_days is empty, then there are no events in the feed(s), so set ajaxified to false (Prevents AJAX calendar from allowing to endlessly click through months with no events)
117
  if(count((array)$event_days) == 0) $ajaxified = false;
118
 
@@ -130,41 +150,26 @@ class GCE_Parser{
130
  $css_classes = array('gce-has-events');
131
 
132
  //Create markup for display
133
- $events_markup = '<div class="gce-event-info">';
134
 
135
  //If title option has been set for display, add it Below: this is rubbish, unsure of better alternative
136
- if(isset($this->title)) $events_markup .= '<p class="gce-tooltip-title">' . $this->title . ' ' . date_i18n($event_day[0]->get_feed()->get_date_format(), $key) . '</p>';
137
 
138
- $events_markup .= '<ul>';
139
 
140
  foreach($event_day as $event){
141
- $display_options = $event->get_feed()->get_display_options();
142
-
143
- //Get the various information from the event
144
- $event_start_time = date_i18n($event->get_feed()->get_time_format(), $event->get_start_date());
145
- $event_end_time = date_i18n($event->get_feed()->get_time_format(), $event->get_end_date());
146
- $event_location = $event->get_location();
147
- $event_desc = nl2br(make_clickable($event->get_description()));
148
- $event_link = $event->get_link() . '&ctz=' . $event->get_feed()->get_timezone();
149
- $event_link_target = (isset($display_options['display_link_target']) ? ' target="_blank"' : '');
150
-
151
- //Add event title
152
- $events_markup .= '<li class="gce-tooltip-feed-' . $event->get_feed()->get_feed_id() . '"><p class="gce-tooltip-event">' . $event->get_title() . '</p>';
153
-
154
- //Check whether to add each piece of info. If yes, add info (location and desc are also checked if empty, as they may not have been entered when event was created)
155
- if(isset($display_options['display_start'])) $events_markup .= '<p class="gce-tooltip-start"><span>' . $display_options['display_start_text'] . '</span> ' . $event_start_time . '</p>';
156
- if(isset($display_options['display_end'])) $events_markup .= '<p class="gce-tooltip-end"><span>' . $display_options['display_end_text'] . '</span> ' . $event_end_time . '</p>';
157
- if(isset($display_options['display_location']) && $event_location != '') $events_markup .= '<p class="gce-tooltip-loc"><span>' . $display_options['display_location_text'] . '</span> ' . $event_location . '</p>';
158
- if(isset($display_options['display_desc']) && $event_desc != '') $events_markup .= '<p class="gce-tooltip-desc"><span>' . $display_options['display_desc_text'] . '</span> ' . $event_desc . '</p>';
159
- if(isset($display_options['display_link'])) $events_markup .= '<p class="gce-tooltip-link"><a href="' . $event_link . '"' . $event_link_target . '>' . $display_options['display_link_text'] . '</a></p>';
160
-
161
- $events_markup .= '</li>';
162
 
163
  //Add CSS class for the feed from which this event comes. If there are multiple events from the same feed on the same day, the CSS class will only be added once.
164
  $css_classes['feed-' . $event->get_feed()->get_feed_id()] = 'gce-feed-' . $event->get_feed()->get_feed_id();
165
  }
166
 
167
- $events_markup .= '</ul></div>';
168
 
169
  //If number of CSS classes is greater than 2 ('gce-has-events' plus one specific feed class) then there must be events from multiple feeds on this day, so add gce-multiple CSS class
170
  if(count($css_classes) > 2) $css_classes[] = 'gce-multiple';
@@ -172,7 +177,7 @@ class GCE_Parser{
172
  if($key == $today) $css_classes[] = 'gce-today';
173
 
174
  //Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below)
175
- $event_days[$key] = array(null, implode(' ', $css_classes), $events_markup);
176
  }else{
177
  //Else if event day isn't in month and year specified, remove event day (and all associated events) from the array
178
  unset($event_days[$key]);
@@ -202,44 +207,112 @@ class GCE_Parser{
202
  return gce_generate_calendar($year, $month, $event_days, 1, null, get_option('start_of_week'), $pn);
203
  }
204
 
205
- //Returns list markup
206
- function get_list(){
207
  $event_days = $this->get_event_days();
208
  //If event_days is empty, there are no events in the feed(s), so return a message indicating this
209
- if(count((array)$event_days) == 0) return __('<p>There are currently no upcoming events.</p>', GCE_TEXT_DOMAIN);
 
 
210
 
211
  $markup = '<ul class="gce-list">';
212
 
213
  foreach($event_days as $key => $event_day){
 
 
 
 
 
 
 
 
214
  foreach($event_day as $event){
215
- $display_options = $event->get_feed()->get_display_options();
216
-
217
- //Get the various information from the event
218
- $event_start_time = date_i18n($event->get_feed()->get_time_format(), $event->get_start_date());
219
- $event_end_time = date_i18n($event->get_feed()->get_time_format() . ' ' . $event->get_feed()->get_date_format(), $event->get_end_date());
220
- $event_location = $event->get_location();
221
- $event_desc = nl2br(make_clickable($event->get_description()));
222
- $event_link = $event->get_link() . '&ctz=' . $event->get_feed()->get_timezone();
223
- $event_link_target = (isset($display_options['display_link_target']) ? ' target="_blank"' : '');
224
-
225
- $markup .= '<li class="gce-feed-' . $event->get_feed()->get_feed_id() . '">';
226
-
227
- //Check whether to add each piece of info. If yes, add info (location and desc are also checked if empty, as they may not have been entered when event was created)
228
- if(isset($this->title)) $markup .= '<p class="gce-list-title">' . $this->title . ' ' . date_i18n($event->get_feed()->get_date_format(), $key) . '</p>';
229
- $markup .= '<p class="gce-list-event">' . $event->get_title() . '</p>';
230
- if(isset($display_options['display_start'])) $markup .= '<p class="gce-list-start"><span>' . $display_options['display_start_text'] . '</span> ' . $event_start_time . '</p>';
231
- if(isset($display_options['display_end'])) $markup .= '<p class="gce-list-end"><span>' . $display_options['display_end_text'] . '</span> ' . $event_end_time . '</p>';
232
- if(isset($display_options['display_location']) && $event_location != '') $markup .= '<p class="gce-list-loc"><span>' . $display_options['display_location_text'] . '</span> ' . $event_location . '</p>';
233
- if(isset($display_options['display_desc']) && $event_desc != '') $markup .= '<p class="gce-list-desc"><span>' . $display_options['display_desc_text'] . '</span> ' . $event_desc . '</p>';
234
- if(isset($display_options['display_link'])) $markup .= '<p class="gce-list-link"><a href="' . $event_link . '"' . $event_link_target . '>' . $display_options['display_link_text'] . '</a></p>';
235
-
236
- $markup .= '</li>';
237
  }
 
 
 
238
  }
239
 
240
  $markup .= '</ul>';
241
 
242
  return $markup;
243
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  }
245
  ?>
26
  $feed->set_feed_id($feed_options['id']);
27
  $feed->set_feed_url($feed_options['url']);
28
  $feed->set_max_events($feed_options['max_events']);
29
+ //If day limit is not blank, set end date to specified number of days in the future, including today
30
+ if($feed_options['day_limit'] != '') $feed->set_end_date(mktime(0, 0, 0, date('n'), date('j'), date('Y')) + (86400 * $feed_options['day_limit']));
31
  $feed->set_cache_duration($feed_options['cache_duration']);
32
  //Set the timezone if anything other than default
33
  if($feed_options['timezone'] != 'default') $feed->set_timezone($feed_options['timezone']);
34
+ //If show past events is true, set start date to 1st of this month. Otherwise, set start date to today
35
+ if($feed_options['show_past_events'] == 'true'){
36
+ $feed->set_start_date(mktime(0, 0, 0, date('m'), 1, date('Y')));
37
+ }else{
38
+ $feed->set_start_date(mktime(0, 0, 0, date('m'), date('j'), date('Y')));
39
+ }
40
  //Set date and time formats. If they have not been set by user, set to global WordPress formats
41
  $feed->set_date_format($feed_options['date_format'] == '' ? get_option('date_format') : $feed_options['date_format']);
42
  $feed->set_time_format($feed_options['time_format'] == '' ? get_option('time_format') : $feed_options['time_format']);
43
+ //Set whether to handle multiple day events
44
+ $feed->set_multi_day($feed_options['multiple_day'] == 'true' ? true : false);
45
 
46
  //Sets all display options
47
  $feed->set_display_options(array(
54
  'display_end_text' => $feed_options['display_end_text'],
55
  'display_location_text' => $feed_options['display_location_text'],
56
  'display_desc_text' => $feed_options['display_desc_text'],
57
+ 'display_desc_limit' => $feed_options['display_desc_limit'],
58
  'display_link_text' => $feed_options['display_link_text'],
59
+ 'display_link_target' => $feed_options['display_link_target'],
60
+ 'display_separator' => $feed_options['display_separator']
61
  ));
62
 
63
  //SimplePie does the hard work
80
  $errors = array();
81
 
82
  foreach($this->feeds as $feed){
83
+ //Remove '//' on line below to see more error information
84
+ //echo $feed->error();
85
  if($feed->error()) $errors[] = $feed->get_feed_id();
86
  }
87
 
98
  //Round start date to nearest day
99
  $start_date = mktime(0, 0, 0, date('m', $start_date), date('d', $start_date) , date('Y', $start_date));
100
 
101
+ //If multiple day events should be handled, add multiple day event to required days
102
+ if($item->get_feed()->get_multi_day()){
103
+ $on_next_day = true;
104
+ $next_day = $start_date + 86400;
105
+ while($on_next_day){
106
+ if($item->get_end_date() > $next_day){
107
+ $event_days[$next_day][] = $item;
108
+ }else{
109
+ $on_next_day = false;
110
+ }
111
+ $next_day += 86400;
112
+ }
113
  }
114
 
115
+ //Add item into array of events for that day
116
+ $event_days[$start_date][] = $item;
117
  }
118
 
119
  return $event_days;
132
 
133
  //Get events data
134
  $event_days = $this->get_event_days();
135
+
136
  //If event_days is empty, then there are no events in the feed(s), so set ajaxified to false (Prevents AJAX calendar from allowing to endlessly click through months with no events)
137
  if(count((array)$event_days) == 0) $ajaxified = false;
138
 
150
  $css_classes = array('gce-has-events');
151
 
152
  //Create markup for display
153
+ $markup = '<div class="gce-event-info">';
154
 
155
  //If title option has been set for display, add it Below: this is rubbish, unsure of better alternative
156
+ if(isset($this->title)) $markup .= '<p class="gce-tooltip-title">' . $this->title . ' ' . date_i18n($event_day[0]->get_feed()->get_date_format(), $key) . '</p>';
157
 
158
+ $markup .= '<ul>';
159
 
160
  foreach($event_day as $event){
161
+ $markup .=
162
+ '<li class="gce-tooltip-feed-' . $event->get_feed()->get_feed_id() . '">' .
163
+ //Add the event title
164
+ '<p class="gce-tooltip-event">' . esc_html($event->get_title()) . '</p>' .
165
+ $this->get_event_info_markup($event, 'tooltip') .
166
+ '</li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
  //Add CSS class for the feed from which this event comes. If there are multiple events from the same feed on the same day, the CSS class will only be added once.
169
  $css_classes['feed-' . $event->get_feed()->get_feed_id()] = 'gce-feed-' . $event->get_feed()->get_feed_id();
170
  }
171
 
172
+ $markup .= '</ul></div>';
173
 
174
  //If number of CSS classes is greater than 2 ('gce-has-events' plus one specific feed class) then there must be events from multiple feeds on this day, so add gce-multiple CSS class
175
  if(count($css_classes) > 2) $css_classes[] = 'gce-multiple';
177
  if($key == $today) $css_classes[] = 'gce-today';
178
 
179
  //Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below)
180
+ $event_days[$key] = array(null, implode(' ', $css_classes), $markup);
181
  }else{
182
  //Else if event day isn't in month and year specified, remove event day (and all associated events) from the array
183
  unset($event_days[$key]);
207
  return gce_generate_calendar($year, $month, $event_days, 1, null, get_option('start_of_week'), $pn);
208
  }
209
 
210
+ function get_list($grouped = false){
 
211
  $event_days = $this->get_event_days();
212
  //If event_days is empty, there are no events in the feed(s), so return a message indicating this
213
+ if(count((array)$event_days) == 0) return '<p>' . __('There are currently no upcoming events.', GCE_TEXT_DOMAIN) . '</p>';
214
+
215
+ $today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
216
 
217
  $markup = '<ul class="gce-list">';
218
 
219
  foreach($event_days as $key => $event_day){
220
+ //If this is a grouped list, add the date title and begin the nested list for this day
221
+ if($grouped){
222
+ $markup .=
223
+ '<li' . ($key == $today ? ' class="gce-today"' : '') . '>' .
224
+ '<p class="gce-list-title">' . $this->title . ' ' . date_i18n($event_day[0]->get_feed()->get_date_format(), $key) . '</p>' .
225
+ '<ul>';
226
+ }
227
+
228
  foreach($event_day as $event){
229
+ //Create the markup for this event
230
+ $markup .=
231
+ '<li>' .
232
+ //If this isn't a grouped list and a date title should be displayed, add the date title
233
+ ((!$grouped && isset($this->title)) ? '<p class="gce-list-title">' . $this->title . ' ' . date_i18n($event->get_feed()->get_date_format(), $key) . '</p>' : '') .
234
+ //Add the event title
235
+ '<p class="gce-list-event">' . esc_html($event->get_title()) . '</p>' .
236
+ $this->get_event_info_markup($event, 'list') .
237
+ '</li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
+
240
+ //If this is a grouped list, close the nested list for this day
241
+ if($grouped) $markup .= '</ul></li>';
242
  }
243
 
244
  $markup .= '</ul>';
245
 
246
  return $markup;
247
  }
248
+
249
+ //Returns the event information markup for the specified event (type = tooltip or list)
250
+ function get_event_info_markup($event, $type){
251
+ //Get the feed from which this event comes
252
+ $feed = $event->get_feed();
253
+
254
+ $display_options = $feed->get_display_options();
255
+
256
+ $markup = '';
257
+
258
+ $start_end = array();
259
+
260
+ //If start date / time should be displayed, set up array of start date and time
261
+ if($display_options['display_start'] != 'none'){
262
+ $sd = $event->get_start_date();
263
+ $start_end['start'] = array('time' => date_i18n($feed->get_time_format(), $sd), 'date' => date_i18n($feed->get_date_format(), $sd));
264
+ }
265
+
266
+ //If end date / time should be displayed, set up array of end date and time
267
+ if($display_options['display_end'] != 'none'){
268
+ $ed = $event->get_end_date();
269
+ $start_end['end'] = array('time' => date_i18n($feed->get_time_format(), $ed), 'date' => date_i18n($feed->get_date_format(), $ed));
270
+ }
271
+
272
+ //Add the correct start / end, date / time information to $markup
273
+ foreach($start_end as $start_or_end => $info){
274
+ $markup .= '<p class="gce-' . $type . '-' . $start_or_end . '"><span>' . $display_options['display_' . $start_or_end . '_text'] . '</span> ';
275
+
276
+ switch($display_options['display_' . $start_or_end]){
277
+ case 'time': $markup .= $info['time'];
278
+ break;
279
+ case 'date': $markup .= $info['date'];
280
+ break;
281
+ case 'time-date': $markup .= $info['time'] . $display_options['display_separator'] . $info['date'];
282
+ break;
283
+ case 'date-time': $markup .= $info['date'] . $display_options['display_separator'] . $info['time'];
284
+ }
285
+
286
+ $markup .= '</p>';
287
+ }
288
+
289
+ //If location should be displayed (and is not empty) add to $markup
290
+ if(isset($display_options['display_location'])){
291
+ $event_location = $event->get_location();
292
+ if($event_location != '') $markup .= '<p class="gce-' . $type . '-loc"><span>' . $display_options['display_location_text'] . '</span> ' . esc_html($event_location) . '</p>';
293
+ }
294
+
295
+ //If description should be displayed (and is not empty) add to $markup
296
+ if(isset($display_options['display_desc'])){
297
+ $event_desc = $event->get_description();
298
+
299
+ if($event_desc != ''){
300
+ //Limit number of words of desc to display, if required
301
+ if($display_options['display_desc_limit'] != ''){
302
+ preg_match('/([\S]+\s*){0,' . $display_options['display_desc_limit'] . '}/', $event->get_description(), $event_desc);
303
+ $event_desc = trim($event_desc[0]);
304
+ }
305
+
306
+ $markup .= '<p class="gce-' . $type . '-desc"><span>' . $display_options['display_desc_text'] . '</span> ' . make_clickable(nl2br(esc_html($event_desc))) . '</p>';
307
+ }
308
+ }
309
+
310
+ //If link should be displayed add to $markup
311
+ if(isset($display_options['display_link'])){ //Below: add target="_blank" if required
312
+ $markup .= '<p class="gce-' . $type . '-link"><a href="' . $event->get_link() . '&amp;ctz=' . $feed->get_timezone() . '"' . (isset($display_options['display_link_target']) ? ' target="_blank"' : '') . '>' . $display_options['display_link_text'] . '</a></p>';
313
+ }
314
+
315
+ return $markup;
316
+ }
317
  }
318
  ?>
inc/php-calendar.php CHANGED
@@ -8,26 +8,32 @@
8
  Changes made to original PHP Calendar script by me (Ross Hanney):
9
 
10
  - Renamed CSS classes to fit with my plugin
11
- - Slight modification of lines 57-65 to use Unix timestamp rather than day number
12
- - Other small markup changes
13
  - Renamed function to prevent conflicts
14
- - Replaced strftime with date_i18n on lines 25 and 28 for localization
 
 
 
 
15
  */
16
 
17
  function gce_generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array()){
18
- $first_of_month = gmmktime(0, 0, 0, $month, 1, $year);
 
 
19
  #remember that mktime will automatically correct if invalid dates are entered
20
  # for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
21
  # this provides a built in "rounding" feature to generate_calendar()
22
 
23
  $day_names = array(); #generate all the day names according to the current locale
24
  for($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400){ #January 4, 1970 was a Sunday
25
- $day_names[$n] = ucfirst(date_i18n('l', $t));
 
26
  }
27
 
28
  list($month, $year, $month_name, $weekday) = explode(',', date_i18n('m, Y, F, w', $first_of_month));
29
  $weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
30
- $title = htmlentities(ucfirst($month_name)) . '&nbsp;' . $year; #note that some locales don't capitalize month and day names
31
 
32
  #Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
33
  @list($p, $pl) = each($pn);
@@ -36,19 +42,19 @@ function gce_generate_calendar($year, $month, $days = array(), $day_name_length
36
  if($p) $p = '<span class="gce-prev">' . ($pl ? '<a class="gce-change-month" title="Previous month" name="' . $pl . '">' . $p . '</a>' : $p) . '</span>&nbsp;';
37
  if($n) $n = '&nbsp;<span class="gce-next">' . ($nl ? '<a class="gce-change-month" title="Next month" name="' . $nl . '">' . $n . '</a>' : $n) . '</span>';
38
 
39
- $calendar = '<table class="gce-calendar">' . "\n" . '<caption class="gce-caption">' . $p . '<span class="gce-month-title">' . ($month_href ? '<a href="' . htmlspecialchars($month_href) . '">' . $title . '</a>' : $title) . '</span>' . $n . "</caption>\n<tr>";
40
 
41
  if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
42
  #if day_name_length is >3, the full name of the day will be printed
43
  foreach($day_names as $d){
44
- $calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities($day_name_length < 4 ? substr($d, 0, $day_name_length) : $d) . '</th>';
45
  }
46
 
47
  $calendar .= "</tr>\n<tr>";
48
  }
49
 
50
  if($weekday > 0) $calendar .= '<td colspan="' . $weekday . '">&nbsp;</td>'; #initial 'empty' days
51
- for($day = 1, $days_in_month = gmdate('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++){
52
  if($weekday == 7){
53
  $weekday = 0; #start a new week
54
  $calendar .= "</tr>\n<tr>";
@@ -58,7 +64,7 @@ function gce_generate_calendar($year, $month, $days = array(), $day_name_length
58
 
59
  if(isset($days[$timestamp]) and is_array($days[$timestamp])){
60
  @list($link, $classes, $content) = $days[$timestamp];
61
- $calendar .= '<td' . ($classes ? ' class="' . htmlspecialchars($classes) . '">' : '>') . ($link ? '<a href="' . htmlspecialchars($link) . '"><span class="gce-day-number">' . $day . '</span></a>' . $content : '<span class="gce-day-number">' . $day . '</span>' . $content) . '</td>';
62
  }else{
63
  $calendar .= '<td><span class="gce-day-number">' . $day . '</span></td>';
64
  }
8
  Changes made to original PHP Calendar script by me (Ross Hanney):
9
 
10
  - Renamed CSS classes to fit with my plugin
11
+ - Slight modification of lines 63-71 to use Unix timestamp rather than day number
 
12
  - Renamed function to prevent conflicts
13
+ - Replaced strftime with date_i18n
14
+ - Use of $wp_locale to get weekday initials
15
+ - Replaced htmlentities() with esc_attr() and esc_html()
16
+ - Other small markup changes
17
+ - Replaced gmmktime() with mktime()
18
  */
19
 
20
  function gce_generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array()){
21
+ global $wp_locale;
22
+
23
+ $first_of_month = mktime(0, 0, 0, $month, 1, $year);
24
  #remember that mktime will automatically correct if invalid dates are entered
25
  # for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
26
  # this provides a built in "rounding" feature to generate_calendar()
27
 
28
  $day_names = array(); #generate all the day names according to the current locale
29
  for($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400){ #January 4, 1970 was a Sunday
30
+ $day_names[$n]['full'] = date_i18n('l', $t, true);
31
+ $day_names[$n]['initial'] = $wp_locale->get_weekday_initial(date_i18n('l', $t, true));
32
  }
33
 
34
  list($month, $year, $month_name, $weekday) = explode(',', date_i18n('m, Y, F, w', $first_of_month));
35
  $weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
36
+ $title = esc_html($month_name) . '&nbsp;' . $year; #note that some locales don't capitalize month and day names
37
 
38
  #Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
39
  @list($p, $pl) = each($pn);
42
  if($p) $p = '<span class="gce-prev">' . ($pl ? '<a class="gce-change-month" title="Previous month" name="' . $pl . '">' . $p . '</a>' : $p) . '</span>&nbsp;';
43
  if($n) $n = '&nbsp;<span class="gce-next">' . ($nl ? '<a class="gce-change-month" title="Next month" name="' . $nl . '">' . $n . '</a>' : $n) . '</span>';
44
 
45
+ $calendar = '<table class="gce-calendar">' . "\n" . '<caption class="gce-caption">' . $p . '<span class="gce-month-title">' . ($month_href ? '<a href="' . esc_attr($month_href) . '">' . $title . '</a>' : $title) . '</span>' . $n . "</caption>\n<tr>";
46
 
47
  if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
48
  #if day_name_length is >3, the full name of the day will be printed
49
  foreach($day_names as $d){
50
+ $calendar .= '<th><abbr title="' . esc_attr($d['full']) . '">' . esc_html($d['initial']) . '</abbr></th>';
51
  }
52
 
53
  $calendar .= "</tr>\n<tr>";
54
  }
55
 
56
  if($weekday > 0) $calendar .= '<td colspan="' . $weekday . '">&nbsp;</td>'; #initial 'empty' days
57
+ for($day = 1, $days_in_month = date('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++){
58
  if($weekday == 7){
59
  $weekday = 0; #start a new week
60
  $calendar .= "</tr>\n<tr>";
64
 
65
  if(isset($days[$timestamp]) and is_array($days[$timestamp])){
66
  @list($link, $classes, $content) = $days[$timestamp];
67
+ $calendar .= '<td' . ($classes ? ' class="' . $classes . '">' : '>') . ($link ? '<a href="' . $link . '"><span class="gce-day-number">' . $day . '</span></a>' . $content : '<span class="gce-day-number">' . $day . '</span>' . $content) . '</td>';
68
  }else{
69
  $calendar .= '<td><span class="gce-day-number">' . $day . '</span></td>';
70
  }
js/gce-script.js CHANGED
@@ -4,7 +4,7 @@ function gce_ajaxify(target, feed_ids, title_text, type){
4
  //Extract month and year
5
  var month_year = jQuery(this).attr('name').split('-', 2);
6
  //Add loading text to table caption
7
- jQuery('#' + target + ' caption').html('Loading...');
8
  //Send AJAX request
9
  jQuery.get(GoogleCalendarEvents.ajaxurl,{
10
  action:'gce_ajax',
4
  //Extract month and year
5
  var month_year = jQuery(this).attr('name').split('-', 2);
6
  //Add loading text to table caption
7
+ jQuery('#' + target + ' caption').html(GoogleCalendarEvents.loading);
8
  //Send AJAX request
9
  jQuery.get(GoogleCalendarEvents.ajaxurl,{
10
  action:'gce_ajax',
languages/google-calendar-events.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Translation of the WordPress plugin Google Calendar Events 0.2.1 by Ross Hanney.
2
  # Copyright (C) 2010 Ross Hanney
3
  # This file is distributed under the same license as the Google Calendar Events package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: Google Calendar Events 0.2.1\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/google-calendar-events\n"
11
- "POT-Creation-Date: 2010-07-26 20:31+0000\n"
12
  "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -41,71 +41,75 @@ msgid "Maximum number of events to retrieve"
41
  msgstr ""
42
 
43
  #: admin/add.php:16 admin/edit.php:16
44
- msgid "Date format"
45
  msgstr ""
46
 
47
  #: admin/add.php:17 admin/edit.php:17
48
- msgid "Time format"
49
  msgstr ""
50
 
51
  #: admin/add.php:18 admin/edit.php:18
52
- msgid "Timezone adjustment"
53
  msgstr ""
54
 
55
  #: admin/add.php:19 admin/edit.php:19
 
 
 
 
56
  msgid "Cache duration"
57
  msgstr ""
58
 
59
  #: admin/add.php:21 admin/edit.php:21
 
 
 
 
60
  msgid "Display Options"
61
  msgstr ""
62
 
63
- #: admin/add.php:22 admin/edit.php:22
64
- msgid "Display start time?"
65
  msgstr ""
66
 
67
- #: admin/add.php:23 admin/edit.php:23
68
- msgid "Display end time and date?"
69
  msgstr ""
70
 
71
- #: admin/add.php:24 admin/edit.php:24
 
 
 
 
72
  msgid "Display location?"
73
  msgstr ""
74
 
75
- #: admin/add.php:25 admin/edit.php:25
76
  msgid "Display description?"
77
  msgstr ""
78
 
79
- #: admin/add.php:26 admin/edit.php:26
80
  msgid "Display link to event?"
81
  msgstr ""
82
 
83
- #: admin/add.php:31
84
  msgid "Enter the feed details below, then click the Add Feed button."
85
  msgstr ""
86
 
87
- #: admin/add.php:55 admin/edit.php:50
88
  msgid "Anything you like. 'Upcoming Club Events', for example."
89
  msgstr ""
90
 
91
- #: admin/add.php:64 admin/edit.php:61
92
  msgid ""
93
- "This will probably be something like: 'http://www.google.com/calendar/feeds/"
94
- "your-email@gmail.com/public/full'."
95
  msgstr ""
96
 
97
- #: admin/add.php:73 admin/edit.php:72
98
  msgid ""
99
- "Select No to retrieve events from now onwards. Select Yes to retrieve events "
100
- "from the first of this month onwards."
101
- msgstr ""
102
-
103
- #: admin/add.php:75 admin/edit.php:74
104
- msgid "No"
105
- msgstr ""
106
-
107
- #: admin/add.php:77 admin/edit.php:76
108
- msgid "Yes"
109
  msgstr ""
110
 
111
  #: admin/add.php:85 admin/edit.php:86
@@ -116,90 +120,151 @@ msgstr ""
116
 
117
  #: admin/add.php:94 admin/edit.php:97
118
  msgid ""
 
 
 
 
 
 
119
  "In <a href=\"http://php.net/manual/en/function.date.php\">PHP date format</"
120
  "a>. Leave this blank if you'd rather stick with the default format for your "
121
  "blog."
122
  msgstr ""
123
 
124
- #: admin/add.php:103 admin/edit.php:108
125
  msgid ""
126
  "In <a href=\"http://php.net/manual/en/function.date.php\">PHP date format</"
127
  "a>. Again, leave this blank to stick with the default."
128
  msgstr ""
129
 
130
- #: admin/add.php:116 admin/edit.php:123
131
  msgid ""
132
  "If you are having problems with dates and times displaying in the wrong "
133
  "timezone, select a city in your required timezone here."
134
  msgstr ""
135
 
136
- #: admin/add.php:125 admin/edit.php:134
137
  msgid ""
138
  "The length of time, in seconds, to cache the feed (43200 = 12 hours). If "
139
  "this feed changes regularly, you may want to reduce the cache duration."
140
  msgstr ""
141
 
142
- #: admin/add.php:135 admin/edit.php:144
 
 
 
 
 
 
143
  msgid ""
144
  "These settings control what information will be displayed for this feed in "
145
  "the tooltip (for grids), or in a list."
146
  msgstr ""
147
 
148
- #: admin/add.php:136 admin/edit.php:145
149
  msgid ""
150
  "You can use some HTML in the text fields, but ensure it is valid or things "
151
  "might go wonky. Text fields can be empty too."
152
  msgstr ""
153
 
154
- #: admin/add.php:143 admin/edit.php:154
155
- msgid "Show the start time of events?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  msgstr ""
157
 
158
- #: admin/add.php:146 admin/edit.php:157
159
  msgid "Text to display before the start time."
160
  msgstr ""
161
 
162
- #: admin/add.php:153 admin/edit.php:166
163
- msgid ""
164
- "Show the end time and date of events? (Date will be shown as well as time as "
165
- "events can span several days)."
 
 
166
  msgstr ""
167
 
168
- #: admin/add.php:156 admin/edit.php:169
169
- msgid "Text to display before the end time / date."
170
  msgstr ""
171
 
172
- #: admin/add.php:163 admin/edit.php:178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  msgid "Show the location of events?"
174
  msgstr ""
175
 
176
- #: admin/add.php:166 admin/edit.php:181
177
  msgid "Text to display before the location."
178
  msgstr ""
179
 
180
- #: admin/add.php:173
181
  msgid ""
182
  "Show the description of events? (URLs in the description will be made into "
183
  "links)."
184
  msgstr ""
185
 
186
- #: admin/add.php:176 admin/edit.php:193
187
  msgid "Text to display before the description."
188
  msgstr ""
189
 
190
- #: admin/add.php:183 admin/edit.php:202
 
 
 
 
 
191
  msgid "Show a link to the Google Calendar page for an event?"
192
  msgstr ""
193
 
194
- #: admin/add.php:186 admin/edit.php:205
195
  msgid "Links open in a new window / tab?"
196
  msgstr ""
197
 
198
- #: admin/add.php:189 admin/edit.php:208
199
  msgid "The link text to be displayed."
200
  msgstr ""
201
 
202
- #: admin/delete.php:9 google-calendar-events.php:154
203
  msgid "Delete Feed"
204
  msgstr ""
205
 
@@ -213,13 +278,13 @@ msgstr ""
213
  msgid "Edit Feed"
214
  msgstr ""
215
 
216
- #: admin/edit.php:31
217
  msgid ""
218
  "Make any changes you require to the feed details below, then click the Save "
219
  "Changes button."
220
  msgstr ""
221
 
222
- #: admin/edit.php:190
223
  msgid ""
224
  "Show the description of events? (URLs in the description will be made into "
225
  "links)."
@@ -233,7 +298,7 @@ msgstr ""
233
  msgid "Click here to add a new feed"
234
  msgstr ""
235
 
236
- #: admin/main.php:4 google-calendar-events.php:139
237
  msgid "Add Feed"
238
  msgstr ""
239
 
@@ -241,93 +306,120 @@ msgstr ""
241
  msgid "Current Feeds"
242
  msgstr ""
243
 
244
- #: admin/main.php:15
245
  msgid "You haven't added any Google Calendar feeds yet."
246
  msgstr ""
247
 
248
- #: admin/main.php:23 admin/main.php:31
249
  msgid "ID"
250
  msgstr ""
251
 
252
- #: admin/main.php:24 admin/main.php:32
253
  msgid "Title"
254
  msgstr ""
255
 
256
- #: admin/main.php:25 admin/main.php:33
257
  msgid "URL"
258
  msgstr ""
259
 
260
- #: admin/main.php:46
261
  msgid "Edit"
262
  msgstr ""
263
 
264
- #: admin/main.php:48
265
  msgid "Delete"
266
  msgstr ""
267
 
268
- #: admin/main.php:59
269
- msgid "Custom Stylesheet"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  msgstr ""
271
 
272
- #: admin/main.php:60
273
  msgid ""
274
- "If you would rather use a custom CSS stylesheet than the default, enter the "
275
- "stylesheet URL below. Leave blank to use the default."
276
  msgstr ""
277
 
278
- #: admin/main.php:64
279
- msgid "Save URL"
280
  msgstr ""
281
 
282
- #: google-calendar-events.php:116
 
 
 
 
 
 
 
 
 
 
 
 
283
  msgid "New Feed Added Successfully."
284
  msgstr ""
285
 
286
- #: google-calendar-events.php:119
287
  msgid "Feed Details Updated Successfully."
288
  msgstr ""
289
 
290
- #: google-calendar-events.php:122
291
  msgid "Feed Deleted Successfully."
292
  msgstr ""
293
 
294
- #. #-#-#-#-# plugin.pot (Google Calendar Events 0.2.1) #-#-#-#-#
295
  #. Plugin Name of the plugin/theme
296
- #: google-calendar-events.php:129 widget/gce-widget.php:6
297
  msgid "Google Calendar Events"
298
  msgstr ""
299
 
300
- #: google-calendar-events.php:140 google-calendar-events.php:148
301
- #: google-calendar-events.php:155
302
  msgid "Cancel"
303
  msgstr ""
304
 
305
- #: google-calendar-events.php:147
306
  msgid "Save Changes"
307
  msgstr ""
308
 
309
- #: google-calendar-events.php:285
310
  msgid ""
311
  "No valid Feed IDs have been entered for this shortcode. Please check that "
312
  "you have entered the IDs correctly and that the Feeds have not been deleted."
313
  msgstr ""
314
 
315
- #: google-calendar-events.php:300 widget/gce-widget.php:70
316
  msgid ""
317
  "No feeds have been added yet. You can add a feed in the Google Calendar "
318
  "Events settings."
319
  msgstr ""
320
 
321
- #: google-calendar-events.php:338 google-calendar-events.php:355
322
- #: widget/gce-widget.php:139 widget/gce-widget.php:151
323
  #, php-format
324
  msgid ""
325
  "The following feeds were not parsed successfully: %s. Please check that the "
326
  "feed URLs are correct and that the feeds have public sharing enabled."
327
  msgstr ""
328
 
329
- #: inc/gce-parser.php:209
330
- msgid "<p>There are currently no upcoming events.</p>"
331
  msgstr ""
332
 
333
  #: widget/gce-widget.php:6
@@ -342,32 +434,36 @@ msgid ""
342
  "have entered the IDs correctly and that the Feeds have not been deleted."
343
  msgstr ""
344
 
345
- #: widget/gce-widget.php:93
346
  msgid ""
347
  "No feeds have been added yet. You can add feeds in the Google Calendar "
348
  "Events settings."
349
  msgstr ""
350
 
351
- #: widget/gce-widget.php:107
352
  msgid "Feed IDs to display in this widget, separated by commas (e.g. 1, 2, 4):"
353
  msgstr ""
354
 
355
- #: widget/gce-widget.php:111
356
  msgid "Display as:"
357
  msgstr ""
358
 
359
- #: widget/gce-widget.php:113
360
  msgid "Calendar Grid"
361
  msgstr ""
362
 
363
- #: widget/gce-widget.php:114
364
  msgid "Calendar Grid - with AJAX"
365
  msgstr ""
366
 
367
- #: widget/gce-widget.php:115
368
  msgid "List"
369
  msgstr ""
370
 
 
 
 
 
371
  #. Plugin URI of the plugin/theme
372
  msgid "http://www.rhanney.co.uk/plugins/google-calendar-events"
373
  msgstr ""
1
+ # Translation of the WordPress plugin Google Calendar Events 0.4 by Ross Hanney.
2
  # Copyright (C) 2010 Ross Hanney
3
  # This file is distributed under the same license as the Google Calendar Events package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: Google Calendar Events 0.4\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/google-calendar-events\n"
11
+ "POT-Creation-Date: 2010-08-19 10:31+0000\n"
12
  "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
41
  msgstr ""
42
 
43
  #: admin/add.php:16 admin/edit.php:16
44
+ msgid "Number of days in the future to retrieve events for"
45
  msgstr ""
46
 
47
  #: admin/add.php:17 admin/edit.php:17
48
+ msgid "Date format"
49
  msgstr ""
50
 
51
  #: admin/add.php:18 admin/edit.php:18
52
+ msgid "Time format"
53
  msgstr ""
54
 
55
  #: admin/add.php:19 admin/edit.php:19
56
+ msgid "Timezone adjustment"
57
+ msgstr ""
58
+
59
+ #: admin/add.php:20 admin/edit.php:20
60
  msgid "Cache duration"
61
  msgstr ""
62
 
63
  #: admin/add.php:21 admin/edit.php:21
64
+ msgid "Show multiple day events on each day?"
65
+ msgstr ""
66
+
67
+ #: admin/add.php:23 admin/edit.php:23
68
  msgid "Display Options"
69
  msgstr ""
70
 
71
+ #: admin/add.php:24 admin/edit.php:24
72
+ msgid "Display start time / date?"
73
  msgstr ""
74
 
75
+ #: admin/add.php:25 admin/edit.php:25
76
+ msgid "Display end time / date?"
77
  msgstr ""
78
 
79
+ #: admin/add.php:26 admin/edit.php:26
80
+ msgid "Separator text / characters"
81
+ msgstr ""
82
+
83
+ #: admin/add.php:27 admin/edit.php:27
84
  msgid "Display location?"
85
  msgstr ""
86
 
87
+ #: admin/add.php:28 admin/edit.php:28
88
  msgid "Display description?"
89
  msgstr ""
90
 
91
+ #: admin/add.php:29 admin/edit.php:29
92
  msgid "Display link to event?"
93
  msgstr ""
94
 
95
+ #: admin/add.php:34
96
  msgid "Enter the feed details below, then click the Add Feed button."
97
  msgstr ""
98
 
99
+ #: admin/add.php:58 admin/edit.php:53
100
  msgid "Anything you like. 'Upcoming Club Events', for example."
101
  msgstr ""
102
 
103
+ #: admin/add.php:67 admin/edit.php:64
104
  msgid ""
105
+ "This will probably be something like: <code>http://www.google.com/calendar/"
106
+ "feeds/your-email@gmail.com/public/full</code>."
107
  msgstr ""
108
 
109
+ #: admin/add.php:76 admin/edit.php:75
110
  msgid ""
111
+ "If checked, events will be retrieved from the first of this month onwards. "
112
+ "If unchecked, events will be retrieved from today onwards."
 
 
 
 
 
 
 
 
113
  msgstr ""
114
 
115
  #: admin/add.php:85 admin/edit.php:86
120
 
121
  #: admin/add.php:94 admin/edit.php:97
122
  msgid ""
123
+ "The number of days in the future to retrieve events for (from 12:00am "
124
+ "today). Leave blank for no day limit."
125
+ msgstr ""
126
+
127
+ #: admin/add.php:103 admin/edit.php:108
128
+ msgid ""
129
  "In <a href=\"http://php.net/manual/en/function.date.php\">PHP date format</"
130
  "a>. Leave this blank if you'd rather stick with the default format for your "
131
  "blog."
132
  msgstr ""
133
 
134
+ #: admin/add.php:112 admin/edit.php:119
135
  msgid ""
136
  "In <a href=\"http://php.net/manual/en/function.date.php\">PHP date format</"
137
  "a>. Again, leave this blank to stick with the default."
138
  msgstr ""
139
 
140
+ #: admin/add.php:125 admin/edit.php:134
141
  msgid ""
142
  "If you are having problems with dates and times displaying in the wrong "
143
  "timezone, select a city in your required timezone here."
144
  msgstr ""
145
 
146
+ #: admin/add.php:134 admin/edit.php:145
147
  msgid ""
148
  "The length of time, in seconds, to cache the feed (43200 = 12 hours). If "
149
  "this feed changes regularly, you may want to reduce the cache duration."
150
  msgstr ""
151
 
152
+ #: admin/add.php:143 admin/edit.php:156
153
+ msgid ""
154
+ "Show events that span multiple days on each day that they span (There are "
155
+ "some limitations of this feature to be aware of)."
156
+ msgstr ""
157
+
158
+ #: admin/add.php:154 admin/edit.php:167
159
  msgid ""
160
  "These settings control what information will be displayed for this feed in "
161
  "the tooltip (for grids), or in a list."
162
  msgstr ""
163
 
164
+ #: admin/add.php:155 admin/edit.php:168
165
  msgid ""
166
  "You can use some HTML in the text fields, but ensure it is valid or things "
167
  "might go wonky. Text fields can be empty too."
168
  msgstr ""
169
 
170
+ #: admin/add.php:161 admin/edit.php:176
171
+ msgid "Select how to display the start date / time."
172
+ msgstr ""
173
+
174
+ #: admin/add.php:164 admin/edit.php:179
175
+ msgid "Don't display start time or date"
176
+ msgstr ""
177
+
178
+ #: admin/add.php:165 admin/edit.php:180
179
+ msgid "Display start time"
180
+ msgstr ""
181
+
182
+ #: admin/add.php:166 admin/edit.php:181
183
+ msgid "Display start date"
184
+ msgstr ""
185
+
186
+ #: admin/add.php:167 admin/edit.php:182
187
+ msgid "Display start time and date (in that order)"
188
+ msgstr ""
189
+
190
+ #: admin/add.php:168 admin/edit.php:183
191
+ msgid "Display start date and time (in that order)"
192
  msgstr ""
193
 
194
+ #: admin/add.php:171 admin/edit.php:186
195
  msgid "Text to display before the start time."
196
  msgstr ""
197
 
198
+ #: admin/add.php:179 admin/edit.php:196
199
+ msgid "Select how to display the end date / time."
200
+ msgstr ""
201
+
202
+ #: admin/add.php:182 admin/edit.php:199
203
+ msgid "Don't display end time or date"
204
  msgstr ""
205
 
206
+ #: admin/add.php:183 admin/edit.php:200
207
+ msgid "Display end time"
208
  msgstr ""
209
 
210
+ #: admin/add.php:184 admin/edit.php:201
211
+ msgid "Display end date"
212
+ msgstr ""
213
+
214
+ #: admin/add.php:185 admin/edit.php:202
215
+ msgid "Display end time and date (in that order)"
216
+ msgstr ""
217
+
218
+ #: admin/add.php:186 admin/edit.php:203
219
+ msgid "Display end date and time (in that order)"
220
+ msgstr ""
221
+
222
+ #: admin/add.php:189 admin/edit.php:206
223
+ msgid "Text to display before the end time."
224
+ msgstr ""
225
+
226
+ #: admin/add.php:197 admin/edit.php:216
227
+ msgid ""
228
+ "If you have chosen to display both the time and date above, enter the text / "
229
+ "characters to display between the time and date here (including any spaces)."
230
+ msgstr ""
231
+
232
+ #: admin/add.php:206 admin/edit.php:227
233
  msgid "Show the location of events?"
234
  msgstr ""
235
 
236
+ #: admin/add.php:208 admin/edit.php:229
237
  msgid "Text to display before the location."
238
  msgstr ""
239
 
240
+ #: admin/add.php:217
241
  msgid ""
242
  "Show the description of events? (URLs in the description will be made into "
243
  "links)."
244
  msgstr ""
245
 
246
+ #: admin/add.php:219 admin/edit.php:242
247
  msgid "Text to display before the description."
248
  msgstr ""
249
 
250
+ #: admin/add.php:223 admin/edit.php:246
251
+ msgid ""
252
+ "Maximum number of words to show from description. Leave blank for no limit."
253
+ msgstr ""
254
+
255
+ #: admin/add.php:232 admin/edit.php:257
256
  msgid "Show a link to the Google Calendar page for an event?"
257
  msgstr ""
258
 
259
+ #: admin/add.php:235 admin/edit.php:260
260
  msgid "Links open in a new window / tab?"
261
  msgstr ""
262
 
263
+ #: admin/add.php:237 admin/edit.php:262
264
  msgid "The link text to be displayed."
265
  msgstr ""
266
 
267
+ #: admin/delete.php:9 google-calendar-events.php:201
268
  msgid "Delete Feed"
269
  msgstr ""
270
 
278
  msgid "Edit Feed"
279
  msgstr ""
280
 
281
+ #: admin/edit.php:34
282
  msgid ""
283
  "Make any changes you require to the feed details below, then click the Save "
284
  "Changes button."
285
  msgstr ""
286
 
287
+ #: admin/edit.php:240
288
  msgid ""
289
  "Show the description of events? (URLs in the description will be made into "
290
  "links)."
298
  msgid "Click here to add a new feed"
299
  msgstr ""
300
 
301
+ #: admin/main.php:4 google-calendar-events.php:186
302
  msgid "Add Feed"
303
  msgstr ""
304
 
306
  msgid "Current Feeds"
307
  msgstr ""
308
 
309
+ #: admin/main.php:16
310
  msgid "You haven't added any Google Calendar feeds yet."
311
  msgstr ""
312
 
313
+ #: admin/main.php:24 admin/main.php:32
314
  msgid "ID"
315
  msgstr ""
316
 
317
+ #: admin/main.php:25 admin/main.php:33
318
  msgid "Title"
319
  msgstr ""
320
 
321
+ #: admin/main.php:26 admin/main.php:34
322
  msgid "URL"
323
  msgstr ""
324
 
325
+ #: admin/main.php:47
326
  msgid "Edit"
327
  msgstr ""
328
 
329
+ #: admin/main.php:47
330
  msgid "Delete"
331
  msgstr ""
332
 
333
+ #: admin/main.php:61
334
+ msgid "General Options"
335
+ msgstr ""
336
+
337
+ #: admin/main.php:65
338
+ msgid "Custom stylesheet URL"
339
+ msgstr ""
340
+
341
+ #: admin/main.php:67
342
+ msgid ""
343
+ "If you want to make changes to the default CSS, make a copy of <code>google-"
344
+ "calendar-events/css/gce-style.css</code> on your server. Make any \r\n"
345
+ "\t\t\t\tchanges to the copy. Enter the URL to the copied file below."
346
+ msgstr ""
347
+
348
+ #: admin/main.php:73
349
+ msgid "Add JavaScript to footer?"
350
  msgstr ""
351
 
352
+ #: admin/main.php:75
353
  msgid ""
354
+ "If you are having issues with tooltips not appearing or the AJAX "
355
+ "functionality not working, try ticking the checkbox below."
356
  msgstr ""
357
 
358
+ #: admin/main.php:80
359
+ msgid "Loading text"
360
  msgstr ""
361
 
362
+ #: admin/main.php:82
363
+ msgid "Text to display while calendar data is loading (on AJAX requests)"
364
+ msgstr ""
365
+
366
+ #: admin/main.php:91
367
+ msgid "Save"
368
+ msgstr ""
369
+
370
+ #: google-calendar-events.php:148
371
+ msgid "Settings"
372
+ msgstr ""
373
+
374
+ #: google-calendar-events.php:163
375
  msgid "New Feed Added Successfully."
376
  msgstr ""
377
 
378
+ #: google-calendar-events.php:166
379
  msgid "Feed Details Updated Successfully."
380
  msgstr ""
381
 
382
+ #: google-calendar-events.php:169
383
  msgid "Feed Deleted Successfully."
384
  msgstr ""
385
 
386
+ #. #-#-#-#-# plugin.pot (Google Calendar Events 0.3.1) #-#-#-#-#
387
  #. Plugin Name of the plugin/theme
388
+ #: google-calendar-events.php:176 widget/gce-widget.php:6
389
  msgid "Google Calendar Events"
390
  msgstr ""
391
 
392
+ #: google-calendar-events.php:187 google-calendar-events.php:195
393
+ #: google-calendar-events.php:202
394
  msgid "Cancel"
395
  msgstr ""
396
 
397
+ #: google-calendar-events.php:194
398
  msgid "Save Changes"
399
  msgstr ""
400
 
401
+ #: google-calendar-events.php:353
402
  msgid ""
403
  "No valid Feed IDs have been entered for this shortcode. Please check that "
404
  "you have entered the IDs correctly and that the Feeds have not been deleted."
405
  msgstr ""
406
 
407
+ #: google-calendar-events.php:369 widget/gce-widget.php:76
408
  msgid ""
409
  "No feeds have been added yet. You can add a feed in the Google Calendar "
410
  "Events settings."
411
  msgstr ""
412
 
413
+ #: google-calendar-events.php:428 google-calendar-events.php:445
414
+ #: widget/gce-widget.php:146 widget/gce-widget.php:158
415
  #, php-format
416
  msgid ""
417
  "The following feeds were not parsed successfully: %s. Please check that the "
418
  "feed URLs are correct and that the feeds have public sharing enabled."
419
  msgstr ""
420
 
421
+ #: inc/gce-parser.php:213
422
+ msgid "There are currently no upcoming events."
423
  msgstr ""
424
 
425
  #: widget/gce-widget.php:6
434
  "have entered the IDs correctly and that the Feeds have not been deleted."
435
  msgstr ""
436
 
437
+ #: widget/gce-widget.php:99
438
  msgid ""
439
  "No feeds have been added yet. You can add feeds in the Google Calendar "
440
  "Events settings."
441
  msgstr ""
442
 
443
+ #: widget/gce-widget.php:113
444
  msgid "Feed IDs to display in this widget, separated by commas (e.g. 1, 2, 4):"
445
  msgstr ""
446
 
447
+ #: widget/gce-widget.php:117
448
  msgid "Display as:"
449
  msgstr ""
450
 
451
+ #: widget/gce-widget.php:119
452
  msgid "Calendar Grid"
453
  msgstr ""
454
 
455
+ #: widget/gce-widget.php:120
456
  msgid "Calendar Grid - with AJAX"
457
  msgstr ""
458
 
459
+ #: widget/gce-widget.php:121
460
  msgid "List"
461
  msgstr ""
462
 
463
+ #: widget/gce-widget.php:122
464
+ msgid "List - grouped by date"
465
+ msgstr ""
466
+
467
  #. Plugin URI of the plugin/theme
468
  msgid "http://www.rhanney.co.uk/plugins/google-calendar-events"
469
  msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: rosshanney
3
  Tags: google, google calendar, calendar, event, events, ajax, widget
4
  Requires at least: 2.9.2
5
- Tested up to: 3.0
6
- Stable tag: 0.3.1
7
 
8
  Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
9
 
@@ -19,9 +19,9 @@ Parses Google Calendar feeds and displays the events as a calendar grid or list
19
  * Lists and grids can be displayed in posts, pages or within a widget
20
  * Options to change the number of events retrieved, date / time format, cache duration etc.
21
  * Options to change the information displayed (start time, location, description etc.).
22
- * Calendar grids can have the ability to change month, utilising AJAX
23
 
24
- Anyone upgrading from an earlier version should note that the 'Display title?' option has been moved from the feed settings to the widget / shortcode settings. You will need to re-enter any titles you specified. Visit the 0.3 features link below for more information.
25
 
26
  Please visit the plugin homepage for how to get started and other help:
27
 
@@ -31,9 +31,9 @@ There is also a demonstration page showing the plugin in action:
31
 
32
  * [Demo Page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo)
33
 
34
- For a summary of the new features in 0.3, visit:
35
 
36
- * [0.3 Features](http://www.rhanney.co.uk/2010/07/26/google-calendar-events-0-3)
37
 
38
  == Installation ==
39
 
@@ -57,6 +57,17 @@ You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.c
57
 
58
  == Changelog ==
59
 
 
 
 
 
 
 
 
 
 
 
 
60
  = 0.3.1 =
61
  * l10n / i18n fixes. Dates should now be localized correctly and should maintain localization after an AJAX request
62
  * MU / Multi-site issues. Issues preventing adding of feeds have been addressed
@@ -95,8 +106,8 @@ You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.c
95
 
96
  == Upgrade Notice ==
97
 
98
- = 0.3 =
99
- Fixes for internationalization / localization and MU / multi-site.
100
 
101
  == Frequently Asked Questions ==
102
 
2
  Contributors: rosshanney
3
  Tags: google, google calendar, calendar, event, events, ajax, widget
4
  Requires at least: 2.9.2
5
+ Tested up to: 3.0.1
6
+ Stable tag: 0.4
7
 
8
  Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
9
 
19
  * Lists and grids can be displayed in posts, pages or within a widget
20
  * Options to change the number of events retrieved, date / time format, cache duration etc.
21
  * Options to change the information displayed (start time, location, description etc.).
22
+ * Calendar grids can have the ability to change the month displayed, utilising AJAX
23
 
24
+ Anyone upgrading from a version earlier than 0.3 should note that the 'Display title?' option has been moved from the feed settings to the widget / shortcode settings. You will need to re-enter any titles you specified.
25
 
26
  Please visit the plugin homepage for how to get started and other help:
27
 
31
 
32
  * [Demo Page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo)
33
 
34
+ For a summary of the new features in 0.4, visit:
35
 
36
+ * [0.4 Features](http://www.rhanney.co.uk/2010/08/19/google-calendar-events-0-4)
37
 
38
  == Installation ==
39
 
57
 
58
  == Changelog ==
59
 
60
+ = 0.4 =
61
+ * More control over how start and end dates / times are displayed
62
+ * Events can now be limited to a specified timeframe (number of days)
63
+ * Events on the same day in lists can now be shown under a single date title
64
+ * JavaScript can now be added to the footer rather than the header, via an option
65
+ * The 'Loading...' text can now be customized
66
+ * Description text can now be limited to a specified number of words
67
+ * Multi-day events can be shown on each day that they span ([sort of](http://www.rhanney.co.uk/2010/08/19/google-calendar-events-0-4#multiday))
68
+ * Bug fixes
69
+ * i18n / l10n fixes
70
+
71
  = 0.3.1 =
72
  * l10n / i18n fixes. Dates should now be localized correctly and should maintain localization after an AJAX request
73
  * MU / Multi-site issues. Issues preventing adding of feeds have been addressed
106
 
107
  == Upgrade Notice ==
108
 
109
+ = 0.4 =
110
+ New features and a few bug fixes.
111
 
112
  == Frequently Asked Questions ==
113
 
widget/gce-widget.php CHANGED
@@ -64,6 +64,12 @@ class GCE_Widget extends WP_Widget{
64
  gce_widget_content_list($feed_ids, $title_text);
65
  echo '</div>';
66
  break;
 
 
 
 
 
 
67
  }
68
  }
69
  }else{
@@ -113,9 +119,10 @@ class GCE_Widget extends WP_Widget{
113
  <option value="grid"<?php selected($display_type, 'grid');?>><?php _e('Calendar Grid', GCE_TEXT_DOMAIN); ?></option>
114
  <option value="ajax"<?php selected($display_type, 'ajax');?>><?php _e('Calendar Grid - with AJAX', GCE_TEXT_DOMAIN); ?></option>
115
  <option value="list"<?php selected($display_type, 'list');?>><?php _e('List', GCE_TEXT_DOMAIN); ?></option>
 
116
  </select>
117
  </p><p>
118
- <label for="<?php echo $this->get_field_id('display_title'); ?>">Display title on tooltip / list item? (e.g. 'Events on 7th March')</label>
119
  <br />
120
  <input type="checkbox" id="<?php echo $this->get_field_id('display_title'); ?>" name="<?php echo $this->get_field_name('display_title'); ?>"<?php checked($display_title, true); ?> value="on" />
121
  <input type="text" id="<?php echo $this->get_field_id('display_title_text'); ?>" name="<?php echo $this->get_field_name('display_title_text'); ?>" value="<?php echo $title_text; ?>" style="width:90%;" />
@@ -140,13 +147,13 @@ function gce_widget_content_grid($feed_ids, $title_text, $widget_id, $ajaxified
140
  }
141
  }
142
 
143
- function gce_widget_content_list($feed_ids, $title_text){
144
  //Create new GCE_Parser object, passing array of feed id(s)
145
  $list = new GCE_Parser(explode('-', $feed_ids), $title_text);
146
 
147
  //If the feed(s) parsed ok, output the list markup, otherwise output an error message
148
  if(count($list->get_errors()) == 0){
149
- echo $list->get_list();
150
  }else{
151
  printf(__('The following feeds were not parsed successfully: %s. Please check that the feed URLs are correct and that the feeds have public sharing enabled.'), implode(', ', $list->get_errors()));
152
  }
64
  gce_widget_content_list($feed_ids, $title_text);
65
  echo '</div>';
66
  break;
67
+ case 'list-grouped':
68
+ echo '<div class="gce-widget-list" id="' . $args['widget_id'] . '-container">';
69
+ //Output main widget content as a grouped list
70
+ gce_widget_content_list($feed_ids, $title_text, true);
71
+ echo '</div>';
72
+ break;
73
  }
74
  }
75
  }else{
119
  <option value="grid"<?php selected($display_type, 'grid');?>><?php _e('Calendar Grid', GCE_TEXT_DOMAIN); ?></option>
120
  <option value="ajax"<?php selected($display_type, 'ajax');?>><?php _e('Calendar Grid - with AJAX', GCE_TEXT_DOMAIN); ?></option>
121
  <option value="list"<?php selected($display_type, 'list');?>><?php _e('List', GCE_TEXT_DOMAIN); ?></option>
122
+ <option value="list-grouped"<?php selected($display_type, 'list-grouped');?>><?php _e('List - grouped by date', GCE_TEXT_DOMAIN); ?></option>
123
  </select>
124
  </p><p>
125
+ <label for="<?php echo $this->get_field_id('display_title'); ?>">Display title on tooltip / list item? (e.g. 'Events on 7th March') Grouped lists always have a title displayed.</label>
126
  <br />
127
  <input type="checkbox" id="<?php echo $this->get_field_id('display_title'); ?>" name="<?php echo $this->get_field_name('display_title'); ?>"<?php checked($display_title, true); ?> value="on" />
128
  <input type="text" id="<?php echo $this->get_field_id('display_title_text'); ?>" name="<?php echo $this->get_field_name('display_title_text'); ?>" value="<?php echo $title_text; ?>" style="width:90%;" />
147
  }
148
  }
149
 
150
+ function gce_widget_content_list($feed_ids, $title_text, $grouped = false){
151
  //Create new GCE_Parser object, passing array of feed id(s)
152
  $list = new GCE_Parser(explode('-', $feed_ids), $title_text);
153
 
154
  //If the feed(s) parsed ok, output the list markup, otherwise output an error message
155
  if(count($list->get_errors()) == 0){
156
+ echo $list->get_list($grouped);
157
  }else{
158
  printf(__('The following feeds were not parsed successfully: %s. Please check that the feed URLs are correct and that the feeds have public sharing enabled.'), implode(', ', $list->get_errors()));
159
  }