My Calendar - Version 1.4.0

Version Description

  • Bug fixed: Today's Events widget was not taking internationalized time as it's argument
  • Added end time field for events
  • Added option for links to expire after events have occurred.
  • Added options for alternate applications of category colors in output.
  • Added ability to use My Calendar shortcodes in text widgets.
  • Added GPS location option for locations
  • Added zoom selection options for map links
  • Lengthened maximum length for category and event titles
  • Added a close link on opened events details boxes.
  • Added an option for a mini calendar display type in shortcode
  • Optimized some SQL queries and reduced total number of queries significantly.
  • Extended the featured to show CSS only on certain pages to include JavaScript as well.
  • Upcoming events widget only allowed up to 99 events to be shown forward or back. Changed to 999.
  • Attempted to solve a problem with infinitely recurring events not appearing in upcoming events. Let me know.
  • Added setting to change Previous Month/Next Month text.
  • Yeah, that's enough for now.
Download this release

Release Info

Developer joedolson
Plugin Icon 128x128 My Calendar
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.8 to 1.4.0

images/event-close.png ADDED
Binary file
my-calendar-categories.php CHANGED
@@ -58,7 +58,7 @@ function my_calendar_manage_categories() {
58
  </div>
59
  <fieldset>
60
  <legend><?php _e('Edit Category','my-calendar'); ?></legend>
61
- <label for="category_name"><?php _e('Category Name','my-calendar'); ?>:</label> <input type="text" id="category_name" name="category_name" class="input" size="30" maxlength="30" value="<?php echo $cur_cat->category_name ?>" /><br />
62
  <label for="category_color"><?php _e('Category Color (Hex format)','my-calendar'); ?>:</label> <input type="text" id="category_color" name="category_color" class="input" size="10" maxlength="7" value="<?php echo $cur_cat->category_color ?>" /><br />
63
  <label for="category_icon"><?php _e('Category Icon','my-calendar'); ?>:</label> <select name="category_icon" id="category_icon">
64
  <?php
@@ -111,7 +111,7 @@ if ($cur_cat->category_icon == $value) {
111
  </div>
112
  <fieldset>
113
  <legend><?php _e('Add Category'); ?></legend>
114
- <label for="category_name"><?php _e('Category Name','my-calendar'); ?>:</label> <input type="text" id="category_name" name="category_name" class="input" size="30" maxlength="30" value="" /><br />
115
  <label for="category_color"><?php _e('Category Color (Hex format)','my-calendar'); ?>:</label> <input type="text" id="category_color" name="category_color" class="input" size="10" maxlength="7" value="#" /><br />
116
  <label for="category_icon"><?php _e('Category Icon','my-calendar'); ?>:</label> <select name="category_icon" id="category_icon">
117
  <?php
58
  </div>
59
  <fieldset>
60
  <legend><?php _e('Edit Category','my-calendar'); ?></legend>
61
+ <label for="category_name"><?php _e('Category Name','my-calendar'); ?>:</label> <input type="text" id="category_name" name="category_name" class="input" size="30" value="<?php echo $cur_cat->category_name ?>" /><br />
62
  <label for="category_color"><?php _e('Category Color (Hex format)','my-calendar'); ?>:</label> <input type="text" id="category_color" name="category_color" class="input" size="10" maxlength="7" value="<?php echo $cur_cat->category_color ?>" /><br />
63
  <label for="category_icon"><?php _e('Category Icon','my-calendar'); ?>:</label> <select name="category_icon" id="category_icon">
64
  <?php
111
  </div>
112
  <fieldset>
113
  <legend><?php _e('Add Category'); ?></legend>
114
+ <label for="category_name"><?php _e('Category Name','my-calendar'); ?>:</label> <input type="text" id="category_name" name="category_name" class="input" size="30" value="" /><br />
115
  <label for="category_color"><?php _e('Category Color (Hex format)','my-calendar'); ?>:</label> <input type="text" id="category_color" name="category_color" class="input" size="10" maxlength="7" value="#" /><br />
116
  <label for="category_icon"><?php _e('Category Icon','my-calendar'); ?>:</label> <select name="category_icon" id="category_icon">
117
  <?php
my-calendar-event-manager.php CHANGED
@@ -3,8 +3,8 @@
3
  // to deal with posts
4
  function edit_my_calendar() {
5
  global $current_user, $wpdb, $users_entries;
6
- ?>
7
-
8
  <?php
9
  if ( get_option('ko_calendar_imported') != 'true' ) {
10
  if (function_exists('check_calendar')) {
@@ -75,13 +75,15 @@ if ( $action == 'add' ) {
75
  $begin = !empty($_POST['event_begin']) ? $_POST['event_begin'] : '';
76
  $end = !empty($_POST['event_end']) ? $_POST['event_end'] : $begin;
77
  $time = !empty($_POST['event_time']) ? $_POST['event_time'] : '';
 
78
  $recur = !empty($_POST['event_recur']) ? $_POST['event_recur'] : '';
79
  $repeats = !empty($_POST['event_repeats']) ? $_POST['event_repeats'] : 0;
80
  $category = !empty($_POST['event_category']) ? $_POST['event_category'] : '';
81
  $linky = !empty($_POST['event_link']) ? $_POST['event_link'] : '';
82
- $event_preset = !empty($_POST['event_preset']) ? $_POST['event_preset'] : '';
83
- if ($event_preset != 'none') {
84
- $sql = "SELECT * FROM " . MY_CALENDAR_LOCATIONS_TABLE . " WHERE location_id = $event_preset";
 
85
  $location = $wpdb->get_row($sql);
86
  $event_label = $location->location_label;
87
  $event_street = $location->location_street;
@@ -90,6 +92,9 @@ if ( $action == 'add' ) {
90
  $event_state = $location->location_state;
91
  $event_postcode = $location->location_postcode;
92
  $event_country = $location->location_country;
 
 
 
93
  } else {
94
  $event_label = !empty($_POST['event_label']) ? $_POST['event_label'] : '';
95
  $event_street = !empty($_POST['event_street']) ? $_POST['event_street'] : '';
@@ -97,7 +102,10 @@ if ( $action == 'add' ) {
97
  $event_city = !empty($_POST['event_city']) ? $_POST['event_city'] : '';
98
  $event_state = !empty($_POST['event_state']) ? $_POST['event_state'] : '';
99
  $event_postcode = !empty($_POST['event_postcode']) ? $_POST['event_postcode'] : '';
100
- $event_country = !empty($_POST['event_country']) ? $_POST['event_country'] : '';
 
 
 
101
  }
102
  // Deal with the fools who have left magic quotes turned on
103
  if ( ini_get('magic_quotes_gpc') ) {
@@ -106,17 +114,23 @@ if ( $action == 'add' ) {
106
  $begin = stripslashes($begin);
107
  $end = stripslashes($end);
108
  $time = stripslashes($time);
 
109
  $recur = stripslashes($recur);
110
  $repeats = stripslashes($repeats);
111
  $category = stripslashes($category);
112
  $linky = stripslashes($linky);
 
113
  $event_label = stripslashes($event_label);
114
  $event_street = stripslashes($event_street);
115
  $event_street2 = stripslashes($event_street2);
116
  $event_city = stripslashes($event_city);
117
  $event_state = stripslashes($event_state);
118
  $event_postcode = stripslashes($event_postcode);
119
- $event_country = stripslashes($event_country);
 
 
 
 
120
  }
121
 
122
  // Perform some validation on the submitted dates - this checks for valid years and months
@@ -170,13 +184,13 @@ if ( $action == 'add' ) {
170
  <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http:// or be completely blank','my-calendar'); ?></p></div>
171
  <?php
172
  }
173
- // The title must be at least one character in length and no more than 60 - only basic punctuation is allowed
174
  $title_length = strlen($title);
175
- if ( $title_length > 1 && $title_length <= 60 ) {
176
  $title_ok =1;
177
  } else {
178
  ?>
179
- <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 60 characters in length.','my-calendar'); ?></p></div>
180
  <?php
181
  }
182
  // We run some checks on recurrance
@@ -188,31 +202,39 @@ if ( $action == 'add' ) {
188
  <?php
189
  }
190
  if ($start_date_ok == 1 && $end_date_ok == 1 && $time_ok == 1 && $url_ok == 1 && $title_ok == 1 && $recurring_ok == 1) {
191
- $sql = "INSERT INTO " . MY_CALENDAR_TABLE . " SET
192
- event_title='" . mysql_real_escape_string($title) . "',
193
- event_desc='" . mysql_real_escape_string($desc) . "',
194
- event_begin='" . mysql_real_escape_string($begin) . "',
195
- event_end='" . mysql_real_escape_string($end) . "',
196
- event_time='" . mysql_real_escape_string($time) . "',
197
- event_recur='" . mysql_real_escape_string($recur) . "',
198
- event_repeats=" . mysql_real_escape_string($repeats) . ",
199
- event_author=".$current_user->ID.",
200
- event_category=".mysql_real_escape_string($category).",
201
- event_link='".mysql_real_escape_string($linky)."',
202
- event_label='".mysql_real_escape_string($event_label)."',
203
- event_street='".mysql_real_escape_string($event_street)."',
204
- event_street2='".mysql_real_escape_string($event_street2)."',
205
- event_city='".mysql_real_escape_string($event_city)."',
206
- event_state='".mysql_real_escape_string($event_state)."',
207
- event_postcode='".mysql_real_escape_string($event_postcode)."',
208
- event_country='".mysql_real_escape_string($event_country)."'";
209
-
210
- $wpdb->get_results($sql);
211
- $sql = "SELECT event_id FROM " . MY_CALENDAR_TABLE . " WHERE event_title='" . mysql_real_escape_string($title) . "'"
212
- . " AND event_desc='" . mysql_real_escape_string($desc) . "' AND event_begin='" . mysql_real_escape_string($begin) . "' AND event_end='" . mysql_real_escape_string($end) . "' AND event_recur='" . mysql_real_escape_string($recur) . "' AND event_repeats=" . mysql_real_escape_string($repeats) . " LIMIT 1";
213
- $result = $wpdb->get_results($sql);
214
-
215
- if ( empty($result) || empty($result[0]->event_id) ) {
 
 
 
 
 
 
 
 
216
  ?>
217
  <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('An event with the details you submitted could not be found in the database. This may indicate a problem with your database or the way in which it is configured.','my-calendar'); ?></p></div>
218
  <?php
@@ -228,32 +250,40 @@ if ( $action == 'add' ) {
228
  $users_entries->event_begin = $begin;
229
  $users_entries->event_end = $end;
230
  $users_entries->event_time = $time;
 
231
  $users_entries->event_recur = $recur;
232
  $users_entries->event_repeats = $repeats;
233
  $users_entries->event_category = $category;
234
  $users_entries->event_link = $linky;
 
235
  $users_entries->event_label = $event_label;
236
  $users_entries->event_street = $event_street;
237
  $users_entries->event_street2 = $event_street2;
238
  $users_entries->event_city = $event_city;
239
  $users_entries->event_state = $event_state;
240
  $users_entries->event_postcode = $event_postcode;
241
- $users_entries->event_country = $event_country;
 
 
 
 
242
  }
243
  // Permit saving of events that have been edited
244
  } elseif ( $action == 'edit_save' ) {
245
  $title = !empty($_POST['event_title']) ? $_POST['event_title'] : '';
246
- $desc = !empty($_POST['event_desc']) ? $_POST['event_desc'] : '';
247
  $begin = !empty($_POST['event_begin']) ? $_POST['event_begin'] : '';
248
  $end = !empty($_POST['event_end']) ? $_POST['event_end'] : $begin;
249
  $time = !empty($_POST['event_time']) ? $_POST['event_time'] : '';
 
250
  $recur = !empty($_POST['event_recur']) ? $_POST['event_recur'] : '';
251
  $repeats = !empty($_POST['event_repeats']) ? $_POST['event_repeats'] : 0;
252
  $category = !empty($_POST['event_category']) ? $_POST['event_category'] : '';
253
  $linky = !empty($_POST['event_link']) ? $_POST['event_link'] : '';
254
- $event_preset = !empty($_POST['event_preset']) ? $_POST['event_preset'] : '';
255
- if ($event_preset != 'none') {
256
- $sql = "SELECT * FROM " . MY_CALENDAR_LOCATIONS_TABLE . " WHERE location_id = $event_preset";
 
257
  $location = $wpdb->get_row($sql);
258
  $event_label = $location->location_label;
259
  $event_street = $location->location_street;
@@ -262,6 +292,9 @@ if ( $action == 'add' ) {
262
  $event_state = $location->location_state;
263
  $event_postcode = $location->location_postcode;
264
  $event_country = $location->location_country;
 
 
 
265
  } else {
266
  $event_label = !empty($_POST['event_label']) ? $_POST['event_label'] : '';
267
  $event_street = !empty($_POST['event_street']) ? $_POST['event_street'] : '';
@@ -270,6 +303,10 @@ if ( $action == 'add' ) {
270
  $event_state = !empty($_POST['event_state']) ? $_POST['event_state'] : '';
271
  $event_postcode = !empty($_POST['event_postcode']) ? $_POST['event_postcode'] : '';
272
  $event_country = !empty($_POST['event_country']) ? $_POST['event_country'] : '';
 
 
 
 
273
  }
274
  $event_author = !empty($_POST['event_author']) ? $_POST['event_author'] : '';
275
 
@@ -283,10 +320,12 @@ if ( $action == 'add' ) {
283
  $begin = stripslashes($begin);
284
  $end = stripslashes($end);
285
  $time = stripslashes($time);
 
286
  $recur = stripslashes($recur);
287
  $repeats = stripslashes($repeats);
288
  $category = stripslashes($category);
289
  $linky = stripslashes($linky);
 
290
  $event_label = stripslashes($event_label);
291
  $event_street = stripslashes($event_street);
292
  $event_street2 = stripslashes($event_street2);
@@ -294,6 +333,10 @@ if ( $action == 'add' ) {
294
  $event_state = stripslashes($event_state);
295
  $event_postcode = stripslashes($event_postcode);
296
  $event_country = stripslashes($event_country);
 
 
 
 
297
  $event_author = stripslashes($event_author);
298
  }
299
 
@@ -353,13 +396,13 @@ if ( $action == 'add' ) {
353
  <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http:// or be completely blank','my-calendar'); ?></p></div>
354
  <?php
355
  }
356
- // The title must be at least one character in length and no more than 60 - no non-standard characters allowed
357
  $title_length = strlen($title);
358
- if ( $title_length > 1 && $title_length <= 60 ) {
359
  $title_ok =1;
360
  } else {
361
  ?>
362
- <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 60 characters in length.','my-calendar'); ?></p></div>
363
  <?php
364
  }
365
  // We run some checks on recurrance
@@ -371,34 +414,41 @@ if ( $action == 'add' ) {
371
  <?php
372
  }
373
  if ($start_date_ok == 1 && $end_date_ok == 1 && $time_ok == 1 && $url_ok == 1 && $title_ok && $recurring_ok == 1) {
374
- $sql = "UPDATE " . MY_CALENDAR_TABLE . " SET
375
- event_title='" . mysql_real_escape_string($title) . "',
376
- event_desc='" . mysql_real_escape_string($desc) . "',
377
- event_begin='" . mysql_real_escape_string($begin) . "',
378
- event_end='" . mysql_real_escape_string($end) . "',
379
- event_time='" . mysql_real_escape_string($time) . "',
380
- event_recur='" . mysql_real_escape_string($recur) . "',
381
- event_repeats=" . mysql_real_escape_string($repeats) . ",
382
- event_category=".mysql_real_escape_string($category).",
383
- event_link='".mysql_real_escape_string($linky)."',
384
- event_label='".mysql_real_escape_string($event_label)."',
385
- event_street='".mysql_real_escape_string($event_street)."',
386
- event_street2='".mysql_real_escape_string($event_street2)."',
387
- event_city='".mysql_real_escape_string($event_city)."',
388
- event_state='".mysql_real_escape_string($event_state)."',
389
- event_postcode='".mysql_real_escape_string($event_postcode)."',
390
- event_country='".mysql_real_escape_string($event_country)."'
391
- WHERE event_id='" . mysql_real_escape_string($event_id) . "'";
392
-
393
- $wpdb->get_results($sql);
394
 
395
- $sql = "SELECT event_id FROM " . MY_CALENDAR_TABLE . " WHERE event_title='" . mysql_real_escape_string($title) . "'"
396
- . " AND event_desc='" . mysql_real_escape_string($desc) . "' AND event_begin='" . mysql_real_escape_string($begin) . "' AND event_end='" . mysql_real_escape_string($end) . "' AND event_recur='" . mysql_real_escape_string($recur) . "' AND event_repeats='" . mysql_real_escape_string($repeats) . "' LIMIT 1";
397
- $result = $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
 
399
- if ( empty($result) || empty($result[0]->event_id) ) {
400
  ?>
401
- <div class="error"><p><strong><?php _e('Failure','my-calendar'); ?>:</strong> <?php _e('The database failed to return data to indicate the event has been updated sucessfully. This may indicate a problem with your database or the way in which it is configured.','my-calendar'); ?></p></div>
402
  <?php
403
  } else {
404
  ?>
@@ -412,10 +462,12 @@ if ( $action == 'add' ) {
412
  $users_entries->event_begin = $begin;
413
  $users_entries->event_end = $end;
414
  $users_entries->event_time = $time;
 
415
  $users_entries->event_recur = $recur;
416
  $users_entries->event_repeats = $repeats;
417
  $users_entries->event_category = $category;
418
  $users_entries->event_link = $linky;
 
419
  $users_entries->event_label = $event_label;
420
  $users_entries->event_street = $event_street;
421
  $users_entries->event_street2 = $event_street2;
@@ -423,6 +475,10 @@ if ( $action == 'add' ) {
423
  $users_entries->event_state = $event_state;
424
  $users_entries->event_postcode = $event_postcode;
425
  $users_entries->event_country = $event_country;
 
 
 
 
426
  $users_entries->event_author = $event_author;
427
  $error_with_saving = 1;
428
  }
@@ -509,7 +565,7 @@ if ( $action == 'add' ) {
509
  </div>
510
 
511
  <?php
512
- }
513
 
514
  // The event edit form for the manage events admin page
515
  function jd_events_edit_form($mode='add', $event_id=false) {
@@ -553,7 +609,7 @@ function jd_events_edit_form($mode='add', $event_id=false) {
553
  <fieldset>
554
  <legend><?php _e('Enter your Event Information','my-calendar'); ?></legend>
555
  <p>
556
- <label for="event_title"><?php _e('Event Title','my-calendar'); ?></label> <input type="text" id="event_title" name="event_title" class="input" size="40" maxlength="60" value="<?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_title)); ?>" />
557
  </p>
558
  <p>
559
  <label for="event_desc"><?php _e('Event Description (<abbr title="hypertext markup language">HTML</abbr> allowed)','my-calendar'); ?></label><br /><textarea id="event_desc" name="event_desc" class="input" rows="5" cols="50"><?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_desc)); ?></textarea>
@@ -578,28 +634,42 @@ function jd_events_edit_form($mode='add', $event_id=false) {
578
  </select>
579
  </p>
580
  <p>
581
- <label for="event_link"><?php _e('Event Link (Optional)','my-calendar'); ?></label> <input type="text" id="event_link" name="event_link" class="input" size="40" value="<?php if ( !empty($data) ) echo htmlspecialchars($data->event_link); ?>" />
582
  </p>
583
- <p>
584
  <label for="event_begin"><?php _e('Start Date (YYYY-MM-DD)','my-calendar'); ?></label> <input type="text" id="event_begin" name="event_begin" class="calendar_input" size="12" value="<?php if ( !empty($data) ) { echo htmlspecialchars($data->event_begin);} else {echo date_i18n("Y-m-d");} ?>" />
585
  </p>
586
  <p>
587
- <label for="event_end"><?php _e('End Date (YYYY-MM-DD) (Optional)','calendar'); ?></label> <input type="text" name="event_end" id="event_end" class="calendar_input" size="12" value="<?php if ( !empty($data) ) {echo htmlspecialchars($data->event_end);} ?>" />
588
  </p>
589
  <p>
590
- <label for="event_time"><?php _e('Time (hh:mm)','calendar'); ?></label> <input type="text" id="event_time" name="event_time" class="input" size="12"
591
  value="<?php
592
  if ( !empty($data) ) {
593
  if ($data->event_time == "00:00:00") {
594
  echo '';
595
  } else {
596
- echo date_i18n("H:i",strtotime(htmlspecialchars($data->event_time)));
597
  }
598
  } else {
599
- echo date_i18n("H:i",strtotime(current_time('mysql')));
600
  }
601
  ?>" /> <?php _e('Optional, set blank if your event is an all-day event or does not happen at a specific time.','my-calendar'); ?> <?php _e('Current time difference from GMT is ','my-calendar'); echo get_option('gmt_offset'); _e(' hour(s)', 'my-calendar'); ?>
602
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  </fieldset>
604
  <fieldset>
605
  <legend><?php _e('Recurring Events','my-calendar'); ?></legend> <?php
@@ -645,7 +715,7 @@ function jd_events_edit_form($mode='add', $event_id=false) {
645
  if ( !empty($locations) ) {
646
  ?>
647
  <p>
648
- <label for="event_preset"><?php _e('Choose a preset location:','my-calendar'); ?></label> <select name="event_preset" id="event_preset">
649
  <option value="none"> -- </option>
650
  <?php
651
  foreach ( $locations as $location ) {
@@ -658,7 +728,7 @@ function jd_events_edit_form($mode='add', $event_id=false) {
658
  <?php
659
  } else {
660
  ?>
661
- <input type="hidden" name="event_preset" value="none" />
662
  <p><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar-locations"><?php _e('Add recurring locations for later use.','my-calendar'); ?></a></p>
663
  <?php
664
  }
@@ -678,13 +748,32 @@ function jd_events_edit_form($mode='add', $event_id=false) {
678
  <p>
679
  <label for="event_country"><?php _e('Country','my-calendar'); ?></label> <input type="text" id="event_country" name="event_country" class="input" size="10" value="<?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_country)); ?>" />
680
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  </fieldset>
682
  <?php } ?>
683
  <p>
684
  <input type="submit" name="save" class="button-primary" value="<?php _e('Save Event','my-calendar'); ?> &raquo;" />
685
  </p>
686
- <div id="datepicker1">
687
- </div>
688
  </form>
689
  </div>
690
  </div>
@@ -716,6 +805,9 @@ function jd_events_display_list($sortby='default',$sortdir='default') {
716
  case 6:
717
  $sortbyvalue = 'event_category';
718
  break;
 
 
 
719
  default:
720
  $sortbyvalue = 'event_begin';
721
  }
@@ -740,11 +832,11 @@ function jd_events_display_list($sortby='default',$sortdir='default') {
740
  <tr>
741
  <th class="manage-column n4" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=1<?php echo $sorting; ?>"><?php _e('ID','my-calendar') ?></a></th>
742
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=2<?php echo $sorting; ?>"><?php _e('Title','my-calendar') ?></a></th>
 
 
743
  <th class="manage-column n8" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=3<?php echo $sorting; ?>"><?php _e('Description','my-calendar') ?></a></th>
744
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=4<?php echo $sorting; ?>"><?php _e('Start Date','my-calendar') ?></a></th>
745
- <?php /* <th class="manage-column" scope="col"><?php _e('End Date','my-calendar') ?></th> */ ?>
746
  <th class="manage-column n6" scope="col"><?php _e('Recurs','my-calendar') ?></th>
747
- <th class="manage-column n6" scope="col"><?php _e('Repeats','my-calendar') ?></th>
748
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=5<?php echo $sorting; ?>"><?php _e('Author','my-calendar') ?></a></th>
749
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=6<?php echo $sorting; ?>"><?php _e('Category','my-calendar') ?></a></th>
750
  <th class="manage-column n7" scope="col"><?php _e('Edit / Delete','my-calendar') ?></th>
@@ -759,8 +851,10 @@ function jd_events_display_list($sortby='default',$sortdir='default') {
759
  <tr class="<?php echo $class; ?>">
760
  <th scope="row"><?php echo $event->event_id; ?></th>
761
  <td><?php echo htmlentities(stripslashes($event->event_title)); ?></td>
762
- <td><?php echo htmlentities(stripslashes($event->event_desc)); ?></td>
763
- <td><?php echo $event->event_begin; ?></td>
 
 
764
  <?php /* <td><?php echo $event->event_end; ?></td> */ ?>
765
  <td>
766
  <?php
@@ -771,15 +865,12 @@ function jd_events_display_list($sortby='default',$sortdir='default') {
771
  else if ($event->event_recur == 'B') { _e('Bi-Weekly','my-calendar'); }
772
  else if ($event->event_recur == 'M') { _e('Monthly','my-calendar'); }
773
  else if ($event->event_recur == 'Y') { _e('Yearly','my-calendar'); }
774
- ?>
775
- </td>
776
- <td>
777
- <?php
778
  // Interpret the DB values into something human readable
779
  if ($event->event_recur == 'S') { echo __('N/A','my-calendar'); }
780
  else if ($event->event_repeats == 0) { echo __('Forever','my-calendar'); }
781
  else if ($event->event_repeats > 0) { echo $event->event_repeats.' '.__('Times','my-calendar'); }
782
- ?>
783
  </td>
784
  <td><?php echo $author->display_name; ?></td>
785
  <?php
3
  // to deal with posts
4
  function edit_my_calendar() {
5
  global $current_user, $wpdb, $users_entries;
6
+ ?>
7
+
8
  <?php
9
  if ( get_option('ko_calendar_imported') != 'true' ) {
10
  if (function_exists('check_calendar')) {
75
  $begin = !empty($_POST['event_begin']) ? $_POST['event_begin'] : '';
76
  $end = !empty($_POST['event_end']) ? $_POST['event_end'] : $begin;
77
  $time = !empty($_POST['event_time']) ? $_POST['event_time'] : '';
78
+ $endtime = !empty($_POST['event_endtime']) ? $_POST['event_endtime'] : '';
79
  $recur = !empty($_POST['event_recur']) ? $_POST['event_recur'] : '';
80
  $repeats = !empty($_POST['event_repeats']) ? $_POST['event_repeats'] : 0;
81
  $category = !empty($_POST['event_category']) ? $_POST['event_category'] : '';
82
  $linky = !empty($_POST['event_link']) ? $_POST['event_link'] : '';
83
+ $expires = !empty($_POST['event_link_expires']) ? $_POST['event_link_expires'] : '0';
84
+ $location_preset = !empty($_POST['location_preset']) ? $_POST['location_preset'] : '';
85
+ if ($location_preset != 'none') {
86
+ $sql = "SELECT * FROM " . MY_CALENDAR_LOCATIONS_TABLE . " WHERE location_id = $location_preset";
87
  $location = $wpdb->get_row($sql);
88
  $event_label = $location->location_label;
89
  $event_street = $location->location_street;
92
  $event_state = $location->location_state;
93
  $event_postcode = $location->location_postcode;
94
  $event_country = $location->location_country;
95
+ $event_longitude = $location->location_longitude;
96
+ $event_latitude = $location->location_latitude;
97
+ $event_zoom = $location->location_zoom;
98
  } else {
99
  $event_label = !empty($_POST['event_label']) ? $_POST['event_label'] : '';
100
  $event_street = !empty($_POST['event_street']) ? $_POST['event_street'] : '';
102
  $event_city = !empty($_POST['event_city']) ? $_POST['event_city'] : '';
103
  $event_state = !empty($_POST['event_state']) ? $_POST['event_state'] : '';
104
  $event_postcode = !empty($_POST['event_postcode']) ? $_POST['event_postcode'] : '';
105
+ $event_country = !empty($_POST['event_country']) ? $_POST['event_country'] : '';
106
+ $event_longitude = !empty($_POST['event_longitude']) ? $_POST['event_longitude'] : '';
107
+ $event_latitude = !empty($_POST['event_latitude']) ? $_POST['event_latitude'] : '';
108
+ $event_zoom = !empty($_POST['event_zoom']) ? $_POST['event_zoom'] : '';
109
  }
110
  // Deal with the fools who have left magic quotes turned on
111
  if ( ini_get('magic_quotes_gpc') ) {
114
  $begin = stripslashes($begin);
115
  $end = stripslashes($end);
116
  $time = stripslashes($time);
117
+ $endtime = stripslashes($endtime);
118
  $recur = stripslashes($recur);
119
  $repeats = stripslashes($repeats);
120
  $category = stripslashes($category);
121
  $linky = stripslashes($linky);
122
+ $expires = stripslashes($expires);
123
  $event_label = stripslashes($event_label);
124
  $event_street = stripslashes($event_street);
125
  $event_street2 = stripslashes($event_street2);
126
  $event_city = stripslashes($event_city);
127
  $event_state = stripslashes($event_state);
128
  $event_postcode = stripslashes($event_postcode);
129
+ $event_country = stripslashes($event_country);
130
+ $event_longitude = stripslashes($event_longitude);
131
+ $event_latitude = stripslashes($event_latitude);
132
+ $event_zoom = stripslashes($event_zoom);
133
+
134
  }
135
 
136
  // Perform some validation on the submitted dates - this checks for valid years and months
184
  <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http:// or be completely blank','my-calendar'); ?></p></div>
185
  <?php
186
  }
187
+ // The title must be at least one character in length and no more than 255 - only basic punctuation is allowed
188
  $title_length = strlen($title);
189
+ if ( $title_length > 1 && $title_length <= 255 ) {
190
  $title_ok =1;
191
  } else {
192
  ?>
193
+ <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 255 characters in length.','my-calendar'); ?></p></div>
194
  <?php
195
  }
196
  // We run some checks on recurrance
202
  <?php
203
  }
204
  if ($start_date_ok == 1 && $end_date_ok == 1 && $time_ok == 1 && $url_ok == 1 && $title_ok == 1 && $recurring_ok == 1) {
205
+ $update = array(
206
+ 'event_id'=>'',
207
+ 'event_begin'=>$begin,
208
+ 'event_end'=>$end,
209
+ 'event_title'=>$title,
210
+ 'event_desc'=>$desc,
211
+ 'event_time'=>$time,
212
+ 'event_endtime'=>$endtime,
213
+ 'event_recur'=>$recur,
214
+ 'event_repeats'=>$repeats,
215
+ 'event_author'=>$current_user->ID,
216
+ 'event_category'=>$category,
217
+ 'event_link'=>$linky,
218
+ 'event_link_expires'=>$expires,
219
+ 'event_label'=>$event_label,
220
+ 'event_street'=>$event_street,
221
+ 'event_street2'=>$event_street2,
222
+ 'event_city'=>$event_city,
223
+ 'event_state'=>$event_state,
224
+ 'event_postcode'=>$event_postcode,
225
+ 'event_country'=>$event_country,
226
+ 'event_longitude'=>$event_longitude,
227
+ 'event_latitude'=>$event_latitude,
228
+ 'event_zoom'=>$event_zoom);
229
+
230
+ $format = array('%s');
231
+ $result = $wpdb->insert(
232
+ MY_CALENDAR_TABLE,
233
+ $update,
234
+ $formats
235
+ );
236
+
237
+ if ( !$result ) {
238
  ?>
239
  <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('An event with the details you submitted could not be found in the database. This may indicate a problem with your database or the way in which it is configured.','my-calendar'); ?></p></div>
240
  <?php
250
  $users_entries->event_begin = $begin;
251
  $users_entries->event_end = $end;
252
  $users_entries->event_time = $time;
253
+ $users_entries->event_endtime = $endtime;
254
  $users_entries->event_recur = $recur;
255
  $users_entries->event_repeats = $repeats;
256
  $users_entries->event_category = $category;
257
  $users_entries->event_link = $linky;
258
+ $users_entries->event_link_expires = $expires;
259
  $users_entries->event_label = $event_label;
260
  $users_entries->event_street = $event_street;
261
  $users_entries->event_street2 = $event_street2;
262
  $users_entries->event_city = $event_city;
263
  $users_entries->event_state = $event_state;
264
  $users_entries->event_postcode = $event_postcode;
265
+ $users_entries->event_country = $event_country;
266
+ $users_entries->event_longitude = $event_longitude;
267
+ $users_entries->event_latitude = $event_latitude;
268
+ $users_entries->event_zoom = $event_zoom;
269
+
270
  }
271
  // Permit saving of events that have been edited
272
  } elseif ( $action == 'edit_save' ) {
273
  $title = !empty($_POST['event_title']) ? $_POST['event_title'] : '';
274
+ $desc = !empty($_POST['event_desc']) ? $_POST['event_desc'] : ' ';
275
  $begin = !empty($_POST['event_begin']) ? $_POST['event_begin'] : '';
276
  $end = !empty($_POST['event_end']) ? $_POST['event_end'] : $begin;
277
  $time = !empty($_POST['event_time']) ? $_POST['event_time'] : '';
278
+ $endtime = !empty($_POST['event_endtime']) ? $_POST['event_endtime'] : '';
279
  $recur = !empty($_POST['event_recur']) ? $_POST['event_recur'] : '';
280
  $repeats = !empty($_POST['event_repeats']) ? $_POST['event_repeats'] : 0;
281
  $category = !empty($_POST['event_category']) ? $_POST['event_category'] : '';
282
  $linky = !empty($_POST['event_link']) ? $_POST['event_link'] : '';
283
+ $expires = !empty($_POST['event_link_expires']) ? $_POST['event_link_expires'] : '0';
284
+ $location_preset = !empty($_POST['location_preset']) ? $_POST['location_preset'] : '';
285
+ if ($location_preset != 'none') {
286
+ $sql = "SELECT * FROM " . MY_CALENDAR_LOCATIONS_TABLE . " WHERE location_id = $location_preset";
287
  $location = $wpdb->get_row($sql);
288
  $event_label = $location->location_label;
289
  $event_street = $location->location_street;
292
  $event_state = $location->location_state;
293
  $event_postcode = $location->location_postcode;
294
  $event_country = $location->location_country;
295
+ $event_longitude = $location->location_longitude;
296
+ $event_latitude = $location->location_latitude;
297
+ $event_zoom = $location->location_zoom;
298
  } else {
299
  $event_label = !empty($_POST['event_label']) ? $_POST['event_label'] : '';
300
  $event_street = !empty($_POST['event_street']) ? $_POST['event_street'] : '';
303
  $event_state = !empty($_POST['event_state']) ? $_POST['event_state'] : '';
304
  $event_postcode = !empty($_POST['event_postcode']) ? $_POST['event_postcode'] : '';
305
  $event_country = !empty($_POST['event_country']) ? $_POST['event_country'] : '';
306
+ $event_longitude = !empty($_POST['event_longitude']) ? $_POST['event_longitude'] : '';
307
+ $event_latitude = !empty($_POST['event_latitude']) ? $_POST['event_latitude'] : '';
308
+ $event_zoom = !empty($_POST['event_zoom']) ? $_POST['event_zoom'] : '';
309
+
310
  }
311
  $event_author = !empty($_POST['event_author']) ? $_POST['event_author'] : '';
312
 
320
  $begin = stripslashes($begin);
321
  $end = stripslashes($end);
322
  $time = stripslashes($time);
323
+ $endtime = stripslashes($endtime);
324
  $recur = stripslashes($recur);
325
  $repeats = stripslashes($repeats);
326
  $category = stripslashes($category);
327
  $linky = stripslashes($linky);
328
+ $expires = stripslashes($expires);
329
  $event_label = stripslashes($event_label);
330
  $event_street = stripslashes($event_street);
331
  $event_street2 = stripslashes($event_street2);
333
  $event_state = stripslashes($event_state);
334
  $event_postcode = stripslashes($event_postcode);
335
  $event_country = stripslashes($event_country);
336
+ $event_longitude = stripslashes($event_longitude);
337
+ $event_latitude = stripslashes($event_latitude);
338
+ $event_zoom = stripslashes($event_zoom);
339
+
340
  $event_author = stripslashes($event_author);
341
  }
342
 
396
  <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http:// or be completely blank','my-calendar'); ?></p></div>
397
  <?php
398
  }
399
+ // The title must be at least one character in length and no more than 255 - no non-standard characters allowed
400
  $title_length = strlen($title);
401
+ if ( $title_length > 1 && $title_length <= 255 ) {
402
  $title_ok =1;
403
  } else {
404
  ?>
405
+ <div class="error"><p><strong><?php _e('Error','my-calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 255 characters in length.','my-calendar'); ?></p></div>
406
  <?php
407
  }
408
  // We run some checks on recurrance
414
  <?php
415
  }
416
  if ($start_date_ok == 1 && $end_date_ok == 1 && $time_ok == 1 && $url_ok == 1 && $title_ok && $recurring_ok == 1) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
 
418
+ $update = array(
419
+ 'event_begin'=>$begin,
420
+ 'event_end'=>$end,
421
+ 'event_title'=>$title,
422
+ 'event_desc'=>$desc,
423
+ 'event_time'=>$time,
424
+ 'event_endtime'=>$endtime,
425
+ 'event_recur'=>$recur,
426
+ 'event_repeats'=>$repeats,
427
+ 'event_category'=>$category,
428
+ 'event_link'=>$linky,
429
+ 'event_link_expires'=>$expires,
430
+ 'event_label'=>$event_label,
431
+ 'event_street'=>$event_street,
432
+ 'event_street2'=>$event_street2,
433
+ 'event_city'=>$event_city,
434
+ 'event_state'=>$event_state,
435
+ 'event_postcode'=>$event_postcode,
436
+ 'event_country'=>$event_country,
437
+ 'event_longitude'=>$event_longitude,
438
+ 'event_latitude'=>$event_latitude,
439
+ 'event_zoom'=>$event_zoom);
440
+
441
+ $format = array('%s');
442
+ $result = $wpdb->update(
443
+ MY_CALENDAR_TABLE,
444
+ $update,
445
+ array( 'event_id'=>$event_id ),
446
+ $formats,
447
+ '%d' );
448
 
449
+ if ( !$result ) {
450
  ?>
451
+ <div class="error"><p><strong><?php _e('Failure','my-calendar'); ?>:</strong> <?php echo _e('Your event was not updated.','my-calendar'); ?></p></div>
452
  <?php
453
  } else {
454
  ?>
462
  $users_entries->event_begin = $begin;
463
  $users_entries->event_end = $end;
464
  $users_entries->event_time = $time;
465
+ $users_entries->event_endtime = $endtime;
466
  $users_entries->event_recur = $recur;
467
  $users_entries->event_repeats = $repeats;
468
  $users_entries->event_category = $category;
469
  $users_entries->event_link = $linky;
470
+ $users_entries->event_link_expires = $expires;
471
  $users_entries->event_label = $event_label;
472
  $users_entries->event_street = $event_street;
473
  $users_entries->event_street2 = $event_street2;
475
  $users_entries->event_state = $event_state;
476
  $users_entries->event_postcode = $event_postcode;
477
  $users_entries->event_country = $event_country;
478
+ $users_entries->event_longitude = $event_longitude;
479
+ $users_entries->event_latitude = $event_latitude;
480
+ $users_entries->event_zoom = $event_zoom;
481
+
482
  $users_entries->event_author = $event_author;
483
  $error_with_saving = 1;
484
  }
565
  </div>
566
 
567
  <?php
568
+ }
569
 
570
  // The event edit form for the manage events admin page
571
  function jd_events_edit_form($mode='add', $event_id=false) {
609
  <fieldset>
610
  <legend><?php _e('Enter your Event Information','my-calendar'); ?></legend>
611
  <p>
612
+ <label for="event_title"><?php _e('Event Title','my-calendar'); ?></label> <input type="text" id="event_title" name="event_title" class="input" size="60" value="<?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_title)); ?>" />
613
  </p>
614
  <p>
615
  <label for="event_desc"><?php _e('Event Description (<abbr title="hypertext markup language">HTML</abbr> allowed)','my-calendar'); ?></label><br /><textarea id="event_desc" name="event_desc" class="input" rows="5" cols="50"><?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_desc)); ?></textarea>
634
  </select>
635
  </p>
636
  <p>
637
+ <label for="event_link"><?php _e('Event Link (Optional)','my-calendar'); ?></label> <input type="text" id="event_link" name="event_link" class="input" size="40" value="<?php if ( !empty($data) ) echo htmlspecialchars($data->event_link); ?>" /> <input type="checkbox" value="1" id="event_link_expires" name="event_link_expires"<?php if ( !empty($data) && $data->event_link_expires == '1' ) { echo " checked=\"checked\""; } else if ( !empty($data) && $data->event_link_expires == '0' ) { echo ""; } else if ( get_option( 'mc_event_link_expires' ) == 'true' ) { echo " checked=\"checked\""; } ?> /> <label for="event_link_expires"><?php _e('This link will expire when the event passes.','my-calendar'); ?></label>
638
  </p>
639
+ <p>
640
  <label for="event_begin"><?php _e('Start Date (YYYY-MM-DD)','my-calendar'); ?></label> <input type="text" id="event_begin" name="event_begin" class="calendar_input" size="12" value="<?php if ( !empty($data) ) { echo htmlspecialchars($data->event_begin);} else {echo date_i18n("Y-m-d");} ?>" />
641
  </p>
642
  <p>
643
+ <label for="event_end"><?php _e('End Date (YYYY-MM-DD) (Optional)','my-calendar'); ?></label> <input type="text" name="event_end" id="event_end" class="calendar_input" size="12" value="<?php if ( !empty($data) ) {echo htmlspecialchars($data->event_end);} ?>" />
644
  </p>
645
  <p>
646
+ <label for="event_time"><?php _e('Time (hh:mm)','my-calendar'); ?></label> <input type="text" id="event_time" name="event_time" class="input" size="12"
647
  value="<?php
648
  if ( !empty($data) ) {
649
  if ($data->event_time == "00:00:00") {
650
  echo '';
651
  } else {
652
+ echo date("H:i",strtotime($data->event_time));
653
  }
654
  } else {
655
+ echo date_i18n("H:i",time());
656
  }
657
  ?>" /> <?php _e('Optional, set blank if your event is an all-day event or does not happen at a specific time.','my-calendar'); ?> <?php _e('Current time difference from GMT is ','my-calendar'); echo get_option('gmt_offset'); _e(' hour(s)', 'my-calendar'); ?>
658
  </p>
659
+ <p>
660
+ <label for="event_endtime"><?php _e('End Time (hh:mm)','my-calendar'); ?></label> <input type="text" id="event_endtime" name="event_endtime" class="input" size="12"
661
+ value="<?php
662
+ if ( !empty($data) ) {
663
+ if ($data->event_endtime == "00:00:00") {
664
+ echo '';
665
+ } else {
666
+ echo date("H:i",strtotime($data->event_time));
667
+ }
668
+ } else {
669
+ echo '';
670
+ }
671
+ ?>" /> <?php _e('Optional. End times will not be displayed on events where this is not set.','my-calendar'); ?>
672
+ </p>
673
  </fieldset>
674
  <fieldset>
675
  <legend><?php _e('Recurring Events','my-calendar'); ?></legend> <?php
715
  if ( !empty($locations) ) {
716
  ?>
717
  <p>
718
+ <label for="location_preset"><?php _e('Choose a preset location:','my-calendar'); ?></label> <select name="location_preset" id="location_preset">
719
  <option value="none"> -- </option>
720
  <?php
721
  foreach ( $locations as $location ) {
728
  <?php
729
  } else {
730
  ?>
731
+ <input type="hidden" name="location_preset" value="none" />
732
  <p><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar-locations"><?php _e('Add recurring locations for later use.','my-calendar'); ?></a></p>
733
  <?php
734
  }
748
  <p>
749
  <label for="event_country"><?php _e('Country','my-calendar'); ?></label> <input type="text" id="event_country" name="event_country" class="input" size="10" value="<?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_country)); ?>" />
750
  </p>
751
+ <p>
752
+ <label for="event_zoom"><?php _e('Initial Zoom','my-calendar'); ?></label>
753
+ <select name="event_zoom" id="event_zoom">
754
+ <option value="16"<?php if ( !empty( $data ) && ( $data->event_zoom == 16 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Neighborhood','my-calendar'); ?></option>
755
+ <option value="14"<?php if ( !empty( $data ) && ( $data->event_zoom == 14 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Small City','my-calendar'); ?></option>
756
+ <option value="12"<?php if ( !empty( $data ) && ( $data->event_zoom == 12 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Large City','my-calendar'); ?></option>
757
+ <option value="10"<?php if ( !empty( $data ) && ( $data->event_zoom == 10 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Greater Metro Area','my-calendar'); ?></option>
758
+ <option value="8"<?php if ( !empty( $data ) && ( $data->event_zoom == 8 ) ) { echo " selected=\"selected\""; } ?>><?php _e('State','my-calendar'); ?></option>
759
+ <option value="6"<?php if ( !empty( $data ) && ( $data->event_zoom == 6 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Region','my-calendar'); ?></option>
760
+ </select>
761
+ </p>
762
+ <fieldset>
763
+ <legend><?php _e('GPS Coordinates (optional)','my-calendar'); ?></legend>
764
+ <p>
765
+ <small><?php _e('If you supply GPS coordinates for your location, they will be used in place of any other address information to pinpoint your location.','my-calendar'); ?></small>
766
+ </p>
767
+ <p>
768
+ <label for="event_longitude"><?php _e('Longitude','my-calendar'); ?></label> <input type="text" id="event_longitude" name="event_longitude" class="input" size="10" value="<?php if ( !empty( $data ) ) echo htmlspecialchars(stripslashes($data->event_longitude)); ?>" /> <label for="event_latitude"><?php _e('Latitude','my-calendar'); ?></label> <input type="text" id="event_latitude" name="event_latitude" class="input" size="10" value="<?php if ( !empty( $data ) ) echo htmlspecialchars(stripslashes($data->event_latitude)); ?>" />
769
+ </p>
770
+ </fieldset>
771
  </fieldset>
772
  <?php } ?>
773
  <p>
774
  <input type="submit" name="save" class="button-primary" value="<?php _e('Save Event','my-calendar'); ?> &raquo;" />
775
  </p>
776
+
 
777
  </form>
778
  </div>
779
  </div>
805
  case 6:
806
  $sortbyvalue = 'event_category';
807
  break;
808
+ case 7:
809
+ $sortbyvalue = 'event_label';
810
+ break;
811
  default:
812
  $sortbyvalue = 'event_begin';
813
  }
832
  <tr>
833
  <th class="manage-column n4" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=1<?php echo $sorting; ?>"><?php _e('ID','my-calendar') ?></a></th>
834
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=2<?php echo $sorting; ?>"><?php _e('Title','my-calendar') ?></a></th>
835
+ <th class="manage-column" scope="col"><?php _e('Link','my-calendar') ?></th>
836
+ <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=7<?php echo $sorting; ?>"><?php _e('Location','my-calendar') ?></a></th>
837
  <th class="manage-column n8" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=3<?php echo $sorting; ?>"><?php _e('Description','my-calendar') ?></a></th>
838
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=4<?php echo $sorting; ?>"><?php _e('Start Date','my-calendar') ?></a></th>
 
839
  <th class="manage-column n6" scope="col"><?php _e('Recurs','my-calendar') ?></th>
 
840
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=5<?php echo $sorting; ?>"><?php _e('Author','my-calendar') ?></a></th>
841
  <th class="manage-column" scope="col"><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar&amp;sort=6<?php echo $sorting; ?>"><?php _e('Category','my-calendar') ?></a></th>
842
  <th class="manage-column n7" scope="col"><?php _e('Edit / Delete','my-calendar') ?></th>
851
  <tr class="<?php echo $class; ?>">
852
  <th scope="row"><?php echo $event->event_id; ?></th>
853
  <td><?php echo htmlentities(stripslashes($event->event_title)); ?></td>
854
+ <td><?php echo htmlentities(stripslashes($event->event_link)); ?></td>
855
+ <td><?php echo htmlentities(stripslashes($event->event_label)); ?></td>
856
+ <td><?php echo substr(strip_tags(stripslashes($event->event_desc)),0,60); ?>&hellip;</td>
857
+ <td><?php echo "$event->event_begin ($event->event_time)"; ?></td>
858
  <?php /* <td><?php echo $event->event_end; ?></td> */ ?>
859
  <td>
860
  <?php
865
  else if ($event->event_recur == 'B') { _e('Bi-Weekly','my-calendar'); }
866
  else if ($event->event_recur == 'M') { _e('Monthly','my-calendar'); }
867
  else if ($event->event_recur == 'Y') { _e('Yearly','my-calendar'); }
868
+ ?>&thinsp;&ndash;&thinsp;<?php
 
 
 
869
  // Interpret the DB values into something human readable
870
  if ($event->event_recur == 'S') { echo __('N/A','my-calendar'); }
871
  else if ($event->event_repeats == 0) { echo __('Forever','my-calendar'); }
872
  else if ($event->event_repeats > 0) { echo $event->event_repeats.' '.__('Times','my-calendar'); }
873
+ ?>
874
  </td>
875
  <td><?php echo $author->display_name; ?></td>
876
  <?php
my-calendar-help.php CHANGED
@@ -6,17 +6,18 @@ function my_calendar_help() {
6
  <h2><?php _e('How to use My Calendar','my-calendar'); ?></h2>
7
  <?php jd_show_support_box(); ?>
8
 
9
- <div id="poststuff" class="jd-my-calendar">
10
  <div class="postbox">
11
  <h3><?php _e('Shortcode Syntax','my-calendar'); ?></h3>
12
  <div class="inside">
13
-
 
14
  <ul>
15
  <li><code>[my_calendar]</code><br />
16
  <?php _e('This basic shortcode will show the calendar on a post or page including all categories and the category key, in a traditional month-by-month format.','my-calendar'); ?>
17
  </li>
18
  <li><code>[my_calendar category="General|Other" format="list" showkey="no"]</code><br />
19
- <?php _e('The shortcode supports three attributes, <code>category</code>, <code>format</code> and <code>showkey</code>. There is currently only one alternate option for <code>format</code> &mdash; <code>list</code> &mdash; which will show the calendar in a list format, skipping dates without any events. The <code>category</code> attribute requires either the name of or ID number one of your event categories (the name is case-sensitive). This will show a calendar only including events in that category. Multiple categories can be specified by separating the category names or IDs using the pipe character: <code>|</code>. Setting <code>showkey</code> to <code>no</code> will prevent the category key from being displayed &mdash; this can be useful with single-category output.','my-calendar'); ?>
20
  </li>
21
  <li><code>[my_calendar_upcoming before="3" after="3" type="event" category="General" template="{title} {date}"]</code><br />
22
  <?php _e('This shortcode displays the output of the Upcoming Events widget. Without attributes, it will display using the settings in your widget; the attributes are used to override the widget settings. The <code>before</code> and <code>after</code> attributes should be numbers; the <code>type</code> attribute can be either "event" or "days", and the <code>category</code> attribute works the same way as the category attribute on the main calendar shortcode. Templates work using the template codes listed below.','my-calendar'); ?>
@@ -28,7 +29,7 @@ function my_calendar_help() {
28
  </div>
29
  </div>
30
  </div>
31
- <div id="poststuff" class="jd-my-calendar">
32
  <div class="postbox">
33
  <h3><?php _e('Category Icons','my-calendar'); ?></h3>
34
  <div class="inside">
@@ -42,7 +43,7 @@ function my_calendar_help() {
42
  </div>
43
  </div>
44
 
45
- <div id="poststuff" class="jd-my-calendar">
46
  <div class="postbox">
47
  <h3 id="template"><?php _e('Widget Templating','my-calendar'); ?></h3>
48
  <div class="inside">
@@ -65,6 +66,9 @@ function my_calendar_help() {
65
  <dt><code>{enddate}</code></dt>
66
  <dd><?php _e('Displays the date on which the event ends.','my-calendar'); ?></dd>
67
 
 
 
 
68
  <dt><code>{author}</code></dt>
69
  <dd><?php _e('Displays the WordPress author who posted the event.','my-calendar'); ?></dd>
70
 
6
  <h2><?php _e('How to use My Calendar','my-calendar'); ?></h2>
7
  <?php jd_show_support_box(); ?>
8
 
9
+ <div id="shortcode" class="jd-my-calendar">
10
  <div class="postbox">
11
  <h3><?php _e('Shortcode Syntax','my-calendar'); ?></h3>
12
  <div class="inside">
13
+ <p>
14
+ <?php _e('These shortcodes can be used in Posts, Pages, or in text widgets.','my-calendar'); ?>
15
  <ul>
16
  <li><code>[my_calendar]</code><br />
17
  <?php _e('This basic shortcode will show the calendar on a post or page including all categories and the category key, in a traditional month-by-month format.','my-calendar'); ?>
18
  </li>
19
  <li><code>[my_calendar category="General|Other" format="list" showkey="no"]</code><br />
20
+ <?php _e('The shortcode supports three attributes, <code>category</code>, <code>format</code> and <code>showkey</code>. There two alternate option for <code>format</code> &mdash; <code>list</code> &mdash; which will show the calendar in a list format, skipping dates without any events, and <code>mini</code>, which will display the calendar in a form more suitable to being displayed in smaller spaces, such as the sidebar. The <code>category</code> attribute requires either the name of or ID number one of your event categories (the name is case-sensitive). This will show a calendar only including events in that category. Multiple categories can be specified by separating the category names or IDs using the pipe character: <code>|</code>. Setting <code>showkey</code> to <code>no</code> will prevent the category key from being displayed &mdash; this can be useful with single-category output.','my-calendar'); ?>
21
  </li>
22
  <li><code>[my_calendar_upcoming before="3" after="3" type="event" category="General" template="{title} {date}"]</code><br />
23
  <?php _e('This shortcode displays the output of the Upcoming Events widget. Without attributes, it will display using the settings in your widget; the attributes are used to override the widget settings. The <code>before</code> and <code>after</code> attributes should be numbers; the <code>type</code> attribute can be either "event" or "days", and the <code>category</code> attribute works the same way as the category attribute on the main calendar shortcode. Templates work using the template codes listed below.','my-calendar'); ?>
29
  </div>
30
  </div>
31
  </div>
32
+ <div id="icons" class="jd-my-calendar">
33
  <div class="postbox">
34
  <h3><?php _e('Category Icons','my-calendar'); ?></h3>
35
  <div class="inside">
43
  </div>
44
  </div>
45
 
46
+ <div id="templates" class="jd-my-calendar">
47
  <div class="postbox">
48
  <h3 id="template"><?php _e('Widget Templating','my-calendar'); ?></h3>
49
  <div class="inside">
66
  <dt><code>{enddate}</code></dt>
67
  <dd><?php _e('Displays the date on which the event ends.','my-calendar'); ?></dd>
68
 
69
+ <dt><code>{endtime}</code></dt>
70
+ <dd><?php _e('Displays the time at which the event ends.','my-calendar'); ?></dd>
71
+
72
  <dt><code>{author}</code></dt>
73
  <dd><?php _e('Displays the WordPress author who posted the event.','my-calendar'); ?></dd>
74
 
my-calendar-install.php ADDED
@@ -0,0 +1,473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // define global variables;
4
+ global $initial_listjs, $initial_caljs, $initial_minijs, $initial_style, $initial_db, $initial_loc_db, $initial_cat_db, $default_template;
5
+
6
+ // defaults will go into the options table on a new install
7
+ $initial_listjs = 'var $j = jQuery.noConflict();
8
+
9
+ $j(document).ready(function() {
10
+ $j("#calendar-list li").children().not(".event-date").hide();
11
+ $j("#calendar-list li.current-day").children().show();
12
+ $j(".event-date").toggle(
13
+ function() {
14
+ $j("#calendar-list li").children().not(".event-date").hide();
15
+ $j(this).parent().children().not(".event-date").show("fast");
16
+ },
17
+ function() {
18
+ $j("#calendar-list li").children().not(".event-date").hide("fast");
19
+ }
20
+ );
21
+ });';
22
+
23
+ $initial_caljs = 'var $j = jQuery.noConflict();
24
+
25
+ $j(document).ready(function() {
26
+ $j(".calendar-event").children().not("h3").hide();
27
+ $j(".calendar-event h3").toggle(
28
+ function() {
29
+ $j(".calendar-event").children().not("h3").hide();
30
+ $j(this).parent().children().not("h3").show("fast");
31
+ },
32
+ function() {
33
+ $j(".calendar-event").children().not("h3").hide("fast");
34
+ }
35
+ );
36
+ });';
37
+
38
+ $initial_minijs = 'var $j = jQuery.noConflict();
39
+
40
+ $j(document).ready(function() {
41
+ $j(".mini .has-events").children().not(".trigger").hide();
42
+ $j(".has-events .trigger").toggle(
43
+ function() {
44
+ $j(".mini .has-events").children().not(".trigger").hide();
45
+ $j(this).parent().children().not(".trigger").show("fast");
46
+ },
47
+ function() {
48
+ $j(".mini .has-events").children().not(".trigger").hide("fast");
49
+ }
50
+ );
51
+ });';
52
+
53
+ $initial_style = "
54
+ #jd-calendar * {
55
+ margin: 0;
56
+ padding: 0;
57
+ line-height: 1.5;
58
+ color: #000;
59
+ background: #fff;
60
+ }
61
+ #jd-calendar caption, #jd-calendar .my-calendar-date-switcher {
62
+ background: #edf7ff;
63
+ border: 1px solid #a9e3ff;
64
+ margin: 2px 0;
65
+ font-weight:700;
66
+ padding:2px 0;
67
+ }
68
+
69
+ #jd-calendar table {
70
+ width:100%;
71
+ line-height:1.2;
72
+ border-collapse:collapse;
73
+ }
74
+
75
+ #jd-calendar td {
76
+ vertical-align:top;
77
+ border:1px solid #eee;
78
+ text-align:left;
79
+ width:13%;
80
+ height:70px;
81
+ padding:2px!important;
82
+ }
83
+ .mini td {
84
+ height: auto!important;
85
+ }
86
+ #jd-calendar th {
87
+ text-align: center;
88
+ padding: 5px 0!important;
89
+ letter-spacing: 1px;
90
+ }
91
+ #jd-calendar th abbr {
92
+ border-bottom: none;
93
+ }
94
+ #jd-calendar h3 {
95
+ font-size:.8em;
96
+ font-family: Arial, Verdana, sans-serif;
97
+ font-weight:700;
98
+ margin:3px 0;
99
+ padding:0;
100
+ width: 100%;
101
+ -moz-border-radius: 3px;
102
+ -webkit-border-radius: 3px;
103
+ border-radius: 3px;
104
+ }
105
+ #jd-calendar h3 img {
106
+ vertical-align: middle;
107
+ margin: 0 3px 0 0!important;
108
+ }
109
+ #jd-calendar #calendar-list h3 img {
110
+ vertical-align: middle;
111
+ }
112
+
113
+ #jd-calendar .list-event h3 {
114
+ font-size:1.2em;
115
+ margin:0;
116
+ }
117
+ #jd-calendar .calendar-event .details, #jd-calendar .calendar-events {
118
+ position:absolute;
119
+ width:50%;
120
+ background: #edf7ff;
121
+ color:#000;
122
+ border:1px solid #9b5;
123
+ -moz-border-radius:10px;
124
+ -moz-box-shadow:3px 3px 6px #777;
125
+ -webkit-box-shadow:3px 3px 6px #777;
126
+ box-shadow:3px 3px 6px #777;
127
+ padding:5px;
128
+ z-index: 3;
129
+ }
130
+ #jd-calendar .details .close {
131
+ float: right;
132
+ width: 12px!important;
133
+ margin-top: -2px!important;
134
+ }
135
+ #jd-calendar .calendar-events {
136
+ width: 200px!important;
137
+ left: 0px;
138
+ }
139
+ #jd-calendar .list-event .details {
140
+ background:#fafafa;
141
+ border:1px solid #eee;
142
+ -moz-border-radius:5px;
143
+ -webkit-border-radius:5px;
144
+ border-radius:5px;
145
+ margin:5px 0;
146
+ padding:5px 5px 0;
147
+ color: #333;
148
+ }
149
+ #jd-calendar #calendar-list {
150
+ margin: 0;
151
+ padding: 0;
152
+ }
153
+ #jd-calendar #calendar-list li {
154
+ padding:5px;
155
+ list-style-type: none;
156
+ margin: 0;
157
+ }
158
+
159
+ #jd-calendar #calendar-list .odd {
160
+ background:#d3e3e3;
161
+ }
162
+
163
+ #jd-calendar .odd .list-event .details {
164
+ background:#e3f3f3;
165
+ border:1px solid #c3d3d3;
166
+ }
167
+
168
+ #jd-calendar .current-day {
169
+ background:#ffb;
170
+ }
171
+ #jd-calendar .current-day .mc-date {
172
+ color: #000;
173
+ background: #eee;
174
+ }
175
+
176
+ #jd-calendar .mc-date {
177
+ display:block;
178
+ background:#f6f6f6;
179
+ margin:-2px -2px 2px;
180
+ padding:2px 4px;
181
+ }
182
+
183
+ #jd-calendar .weekend {
184
+ background:#bd7;
185
+ color: #000;
186
+ }
187
+
188
+ #jd-calendar th {
189
+ font-size:.8em;
190
+ text-transform:uppercase;
191
+ padding:2px 4px 2px 0;
192
+ }
193
+ #jd-calendar .category-key {
194
+ background: #edf7ff;
195
+ border: 1px solid #a9e3ff;
196
+ padding: 5px;
197
+ margin: 5px 0;
198
+ }
199
+ #jd-calendar .category-key ul {
200
+ list-style-type: none;
201
+ margin: 0;
202
+ padding: 0;
203
+ }
204
+ #jd-calendar .category-key li {
205
+ margin: 2px 10px;
206
+ }
207
+ #jd-calendar .category-key span {
208
+ margin-right:5px;
209
+ vertical-align:middle;
210
+ }
211
+ #jd-calendar .category-key .no-icon {
212
+ width: 10px;
213
+ height: 10px;
214
+ display: inline-block;
215
+ border: 1px solid #555;
216
+ -moz-border-radius: 2px;
217
+ -webkit-border-radius: 2px;
218
+ border-radius: 2px;
219
+ }
220
+
221
+ #calendar-list li {
222
+ text-indent:0;
223
+ margin:0;
224
+ padding:0;
225
+ }
226
+
227
+ #jd-calendar .calendar-event .event-time, #jd-calendar .list-event .event-time {
228
+ display:block;
229
+ float:left;
230
+ height:100%;
231
+ margin-right:10px;
232
+ margin-bottom:10px;
233
+ font-weight:700;
234
+ font-size:.9em;
235
+ }
236
+
237
+ #jd-calendar p {
238
+ line-height:1.5;
239
+ margin:0 0 1em;
240
+ padding:0;
241
+ }
242
+
243
+ #jd-calendar .sub-details {
244
+ margin-left:6em;
245
+ }
246
+
247
+ #jd-calendar .vcard {
248
+ font-size:.9em;
249
+ margin:10px 0;
250
+ }
251
+
252
+ #jd-calendar .calendar-event .vcard {
253
+ margin:0 0 10px;
254
+ }
255
+
256
+ #jd-calendar,#calendar-list {
257
+ clear:left;
258
+ background: #fff;
259
+ }
260
+ #jd-calendar {
261
+ position: relative;
262
+ }
263
+ #jd-calendar img {
264
+ border: none;
265
+ }
266
+ .category-color-sample img {
267
+ margin-right: 5px;
268
+ vertical-align: top;
269
+ }
270
+
271
+ #jd-calendar .my-calendar-nav ul {
272
+ height: 2.95em;
273
+ list-style-type:none;
274
+ margin:0;
275
+ padding:0;
276
+ }
277
+
278
+ .mini .my-calendar-nav ul {
279
+ height: 2em!important;
280
+ }
281
+
282
+ #jd-calendar .my-calendar-nav li {
283
+ float:left;
284
+ list-style-type: none;
285
+ }
286
+
287
+ #jd-calendar .my-calendar-nav li:before {
288
+ content:'';
289
+ }
290
+ #jd-calendar .my-calendar-nav li a {
291
+ display:block;
292
+ background:#fff;
293
+ border:1px solid #9b5;
294
+ text-align:center;
295
+ padding:1px 20px;
296
+ color: #243f82;
297
+ }
298
+ .mini .my-calendar-nav li a {
299
+ padding: 1px 3px!important;
300
+ font-size: .7em;
301
+ }
302
+ #jd-calendar .my-calendar-nav li a:hover {
303
+ background:#a9e3ff;
304
+ color:#000;
305
+ border: 1px solid #243f82;
306
+ }
307
+ #jd-calendar .my-calendar-next {
308
+ margin-left: 4px;
309
+ text-align:right;
310
+ }
311
+ #jd-calendar .my-calendar-next a {
312
+ -webkit-border-top-right-radius: 8px;
313
+ -webkit-border-bottom-right-radius: 8px;
314
+ -moz-border-radius-topright: 8px;
315
+ -moz-border-radius-bottomright: 8px;
316
+ border-top-right-radius: 8px;
317
+ border-bottom-right-radius: 8px;
318
+ }
319
+ #jd-calendar .my-calendar-prev a {
320
+ -webkit-border-top-left-radius: 8px;
321
+ -webkit-border-bottom-left-radius: 8px;
322
+ -moz-border-radius-topleft: 8px;
323
+ -moz-border-radius-bottomleft: 8px;
324
+ border-top-left-radius: 8px;
325
+ border-bottom-left-radius: 8px;
326
+ }
327
+ #jd-calendar .day-without-date {
328
+ background: #fafafa;
329
+ }
330
+ #upcoming-events .past-event {
331
+ color: #777;
332
+ }
333
+ #upcoming-events .today {
334
+ color: #111;
335
+ }
336
+ #upcoming-events .future-event {
337
+ color: #555;
338
+ }
339
+ #jd-calendar.mini .my-calendar-date-switcher label {
340
+ display: block;
341
+ float: left;
342
+ width: 6em;
343
+ }
344
+ #jd-calendar.mini .my-calendar-date-switcher {
345
+ padding: 4px;
346
+ }
347
+ #jd-calendar.mini td .category-icon {
348
+ display: none;
349
+ }
350
+ #jd-calendar.mini h3 {
351
+ font-size: 1.1em;
352
+ }
353
+
354
+ #jd-calendar.mini .day-with-date span, #jd-calendar.mini .day-with-date a {
355
+ font-family: Arial, Verdana, sans-serif;
356
+ font-size: .9em;
357
+ padding:1px;
358
+ }
359
+ #jd-calendar .mini-event .sub-details {
360
+ margin: 0;
361
+ border-bottom: 1px solid #ccc;
362
+ padding: 2px 0 0;
363
+ margin-bottom: 5px;
364
+ }
365
+ #jd-calendar.mini .day-with-date a {
366
+ display: block;
367
+ margin: -2px;
368
+ font-weight: 700;
369
+ text-decoration: underline;
370
+ }";
371
+
372
+ $default_template = "<strong>{date}</strong> &#8211; {link_title}<br /><span>{time}, {category}</span>";
373
+
374
+ $initial_db = "CREATE TABLE " . MY_CALENDAR_TABLE . " (
375
+ event_id INT(11) NOT NULL AUTO_INCREMENT,
376
+ event_begin DATE NOT NULL,
377
+ event_end DATE NOT NULL,
378
+ event_title VARCHAR(255) NOT NULL,
379
+ event_desc TEXT NOT NULL,
380
+ event_time TIME,
381
+ event_endtime TIME,
382
+ event_recur CHAR(1),
383
+ event_repeats INT(3),
384
+ event_author BIGINT(20) UNSIGNED,
385
+ event_category BIGINT(20) UNSIGNED,
386
+ event_link TEXT,
387
+ event_link_expires TINYINT(1) NOT NULL,
388
+ event_label VARCHAR(60) NOT NULL,
389
+ event_street VARCHAR(60) NOT NULL,
390
+ event_street2 VARCHAR(60) NOT NULL,
391
+ event_city VARCHAR(60) NOT NULL,
392
+ event_state VARCHAR(60) NOT NULL,
393
+ event_postcode VARCHAR(10) NOT NULL,
394
+ event_country VARCHAR(60) NOT NULL,
395
+ event_longitude FLOAT(10,6) NOT NULL DEFAULT '0',
396
+ event_latitude FLOAT(10,6) NOT NULL DEFAULT '0',
397
+ event_zoom INT(2) NOT NULL DEFAULT '14',
398
+ PRIMARY KEY (event_id),
399
+ KEY event_recur (event_recur)
400
+ );";
401
+
402
+ $initial_cat_db = "CREATE TABLE " . MY_CALENDAR_CATEGORIES_TABLE . " (
403
+ category_id INT(11) NOT NULL AUTO_INCREMENT,
404
+ category_name VARCHAR(255) NOT NULL,
405
+ category_color VARCHAR(7) NOT NULL,
406
+ category_icon VARCHAR(128) NOT NULL,
407
+ PRIMARY KEY (category_id)
408
+ );";
409
+
410
+ $initial_loc_db = "CREATE TABLE " . MY_CALENDAR_LOCATIONS_TABLE . " (
411
+ location_id INT(11) NOT NULL AUTO_INCREMENT,
412
+ location_label VARCHAR(60) NOT NULL,
413
+ location_street VARCHAR(60) NOT NULL,
414
+ location_street2 VARCHAR(60) NOT NULL,
415
+ location_city VARCHAR(60) NOT NULL,
416
+ location_state VARCHAR(60) NOT NULL,
417
+ location_postcode VARCHAR(10) NOT NULL,
418
+ location_country VARCHAR(60) NOT NULL,
419
+ location_longitude FLOAT(10,6) NOT NULL DEFAULT '0',
420
+ location_latitude FLOAT(10,6) NOT NULL DEFAULT '0',
421
+ location_zoom INT(2) NOT NULL DEFAULT '14',
422
+ PRIMARY KEY (location_id)
423
+ );";
424
+
425
+ function mc_default_settings( ) {
426
+ global $initial_style, $default_template, $initial_listjs, $initial_caljs, $initial_db, $initial_loc_db, $initial_cat_db;
427
+ // no arguments
428
+ add_option('can_manage_events','edit_posts');
429
+ add_option('my_calendar_style',"$initial_style");
430
+ add_option('display_author','false');
431
+ add_option('display_jump','false');
432
+ add_option('display_todays','true');
433
+ add_option('display_upcoming','true');
434
+ add_option('display_upcoming_days',7);
435
+ add_option('my_calendar_version','1.4.0');
436
+ add_option('display_upcoming_type','false');
437
+ add_option('display_upcoming_events',3);
438
+ add_option('display_past_days',0);
439
+ add_option('display_past_events',2);
440
+ add_option('my_calendar_use_styles','false');
441
+ add_option('my_calendar_show_months',1);
442
+ add_option('my_calendar_show_map','true');
443
+ add_option('my_calendar_show_address','false');
444
+ add_option('my_calendar_today_template',$default_template);
445
+ add_option('my_calendar_upcoming_template',$default_template);
446
+ add_option('my_calendar_today_title','Today\'s Events');
447
+ add_option('my_calendar_upcoming_title','Upcoming Events');
448
+ add_option('calendar_javascript',0);
449
+ add_option('list_javascript',0);
450
+ add_option('mini_javascript',0);
451
+ add_option('my_calendar_minijs',$initial_minijs);
452
+ add_option('my_calendar_listjs',$initial_listjs);
453
+ add_option('my_calendar_caljs',$initial_caljs);
454
+ add_option('my_calendar_notime_text','N/A');
455
+ add_option('my_calendar_hide_icons','false');
456
+ add_option('mc_event_link_expires','no');
457
+ add_option('mc_apply_color','default');
458
+
459
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
460
+ dbDelta($initial_db);
461
+ dbDelta($initial_cat_db);
462
+ dbDelta($initial_loc_db);
463
+
464
+ }
465
+
466
+ function upgrade_db() {
467
+ global $initial_db, $initial_loc_db, $initial_cat_db;
468
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
469
+ dbDelta($initial_db);
470
+ dbDelta($initial_cat_db);
471
+ dbDelta($initial_loc_db);
472
+ }
473
+ ?>
my-calendar-locations.php CHANGED
@@ -13,7 +13,7 @@ function my_calendar_manage_locations() {
13
  <?php
14
  // We do some checking to see what we're doing
15
  if (isset($_POST['mode']) && $_POST['mode'] == 'add') {
16
- $sql = "INSERT INTO " . MY_CALENDAR_LOCATIONS_TABLE . " SET location_label='".mysql_real_escape_string($_POST['location_label'])."', location_street='".mysql_real_escape_string($_POST['location_street'])."', location_street2='".mysql_real_escape_string($_POST['location_street2'])."', location_city='".mysql_real_escape_string($_POST['location_city'])."', location_state='".mysql_real_escape_string($_POST['location_state'])."', location_postcode='".mysql_real_escape_string($_POST['location_postcode'])."', location_country='".mysql_real_escape_string($_POST['location_country'])."'";
17
  $wpdb->get_results($sql);
18
  echo "<div class=\"updated\"><p><strong>".__('Location added successfully','my-calendar')."</strong></p></div>";
19
  } else if (isset($_GET['mode']) && isset($_GET['location_id']) && $_GET['mode'] == 'delete') {
@@ -41,31 +41,51 @@ function my_calendar_manage_locations() {
41
  <?php _e('All location fields are optional: <em>insufficient information may result in an inaccurate map</em>.','my-calendar'); ?>
42
  </p>
43
  <p>
44
- <label for="location_label"><?php _e('Name of Location (e.g. <em>Joe\'s Bar and Grill</em>)','my-calendar'); ?></label> <input type="text" id="location_label" name="location_label" class="input" size="40" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars(stripslashes($cur_loc->location_label)); ?>" />
45
  </p>
46
  <p>
47
- <label for="location_street"><?php _e('Street Address','my-calendar'); ?></label> <input type="text" id="location_street" name="location_street" class="input" size="40" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars(stripslashes($cur_loc->location_street)); ?>" />
48
  </p>
49
  <p>
50
- <label for="location_street2"><?php _e('Street Address (2)','my-calendar'); ?></label> <input type="text" id="location_street2" name="location_street2" class="input" size="40" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars(stripslashes($cur_loc->location_street2)); ?>" />
51
  </p>
52
  <p>
53
- <label for="location_city"><?php _e('City','my-calendar'); ?></label> <input type="text" id="location_city" name="location_city" class="input" size="40" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars(stripslashes($cur_loc->location_city)); ?>" /> <label for="location_state"><?php _e('State/Province','my-calendar'); ?></label> <input type="text" id="location_state" name="location_state" class="input" size="10" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars($cur_loc->location_state); ?>" /> <label for="location_postcode"><?php _e('Postal Code','my-calendar'); ?></label> <input type="text" id="location_postcode" name="location_postcode" class="input" size="10" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars($cur_loc->location_postcode); ?>" />
54
  </p>
55
  <p>
56
- <label for="location_country"><?php _e('Country','my-calendar'); ?></label> <input type="text" id="location_country" name="location_country" class="input" size="10" value="<?php if ( !empty($cur_loc) ) echo htmlspecialchars(stripslashes($cur_loc->location_country)); ?>" />
57
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  </fieldset>
59
  <p>
60
  <input type="submit" name="save" class="button-primary" value="<?php _e('Save Changes','my-calendar'); ?> &raquo;" />
61
  </p>
 
62
  </form>
63
  </div>
64
  </div>
65
  </div>
66
  <?php
67
  } else if (isset($_POST['mode']) && isset($_POST['location_id']) && isset($_POST['location_label']) && isset($_POST['location_street']) && $_POST['mode'] == 'edit') {
68
- $sql = "UPDATE " . MY_CALENDAR_LOCATIONS_TABLE . " SET location_label='".mysql_real_escape_string($_POST['location_label'])."', location_street='".mysql_real_escape_string($_POST['location_street'])."', location_street2='".mysql_real_escape_string($_POST['location_street2'])."', location_city='".mysql_real_escape_string($_POST['location_city'])."', location_state='".mysql_real_escape_string($_POST['location_state'])."', location_postcode='".mysql_real_escape_string($_POST['location_postcode'])."', location_country='".mysql_real_escape_string($_POST['location_country'])."' WHERE location_id=".mysql_real_escape_string($_POST['location_id']);
69
  $wpdb->get_results($sql);
70
  echo "<div class=\"updated\"><p><strong>".__('Location edited successfully','my-calendar')."</strong></p></div>";
71
  }
@@ -104,10 +124,31 @@ function my_calendar_manage_locations() {
104
  <p>
105
  <label for="location_country"><?php _e('Country','my-calendar'); ?></label> <input type="text" id="location_country" name="location_country" class="input" size="10" value="" />
106
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  </fieldset>
108
  <p>
109
  <input type="submit" name="save" class="button-primary" value="<?php _e('Add Location','my-calendar'); ?> &raquo;" />
110
  </p>
 
 
111
  </form>
112
  </div>
113
  </div>
13
  <?php
14
  // We do some checking to see what we're doing
15
  if (isset($_POST['mode']) && $_POST['mode'] == 'add') {
16
+ $sql = "INSERT INTO " . MY_CALENDAR_LOCATIONS_TABLE . " SET location_label='".mysql_real_escape_string($_POST['location_label'])."', location_street='".mysql_real_escape_string($_POST['location_street'])."', location_street2='".mysql_real_escape_string($_POST['location_street2'])."', location_city='".mysql_real_escape_string($_POST['location_city'])."', location_state='".mysql_real_escape_string($_POST['location_state'])."', location_postcode='".mysql_real_escape_string($_POST['location_postcode'])."', location_country='".mysql_real_escape_string($_POST['location_country'])."', location_longitude='".mysql_real_escape_string($_POST['location_longitude'])."', location_latitude='".mysql_real_escape_string($_POST['location_latitude'])."', location_zoom='".mysql_real_escape_string($_POST['location_zoom'])."'";
17
  $wpdb->get_results($sql);
18
  echo "<div class=\"updated\"><p><strong>".__('Location added successfully','my-calendar')."</strong></p></div>";
19
  } else if (isset($_GET['mode']) && isset($_GET['location_id']) && $_GET['mode'] == 'delete') {
41
  <?php _e('All location fields are optional: <em>insufficient information may result in an inaccurate map</em>.','my-calendar'); ?>
42
  </p>
43
  <p>
44
+ <label for="location_label"><?php _e('Name of Location (e.g. <em>Joe\'s Bar and Grill</em>)','my-calendar'); ?></label> <input type="text" id="location_label" name="location_label" class="input" size="40" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_label)); ?>" />
45
  </p>
46
  <p>
47
+ <label for="location_street"><?php _e('Street Address','my-calendar'); ?></label> <input type="text" id="location_street" name="location_street" class="input" size="40" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_street)); ?>" />
48
  </p>
49
  <p>
50
+ <label for="location_street2"><?php _e('Street Address (2)','my-calendar'); ?></label> <input type="text" id="location_street2" name="location_street2" class="input" size="40" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_street2)); ?>" />
51
  </p>
52
  <p>
53
+ <label for="location_city"><?php _e('City','my-calendar'); ?></label> <input type="text" id="location_city" name="location_city" class="input" size="40" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_city)); ?>" /> <label for="location_state"><?php _e('State/Province','my-calendar'); ?></label> <input type="text" id="location_state" name="location_state" class="input" size="10" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars($cur_loc->location_state); ?>" /> <label for="location_postcode"><?php _e('Postal Code','my-calendar'); ?></label> <input type="text" id="location_postcode" name="location_postcode" class="input" size="10" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars($cur_loc->location_postcode); ?>" />
54
  </p>
55
  <p>
56
+ <label for="location_country"><?php _e('Country','my-calendar'); ?></label> <input type="text" id="location_country" name="location_country" class="input" size="10" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_country)); ?>" />
57
  </p>
58
+ <p>
59
+ <label for="location_zoom"><?php _e('Initial Zoom','my-calendar'); ?></label>
60
+ <select name="location_zoom" id="location_zoom">
61
+ <option value="16"<?php if ( !empty( $cur_loc ) && ( $cur_loc->location_zoom == 16 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Neighborhood','my-calendar'); ?></option>
62
+ <option value="14"<?php if ( !empty( $cur_loc ) && ( $cur_loc->location_zoom == 14 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Small City','my-calendar'); ?></option>
63
+ <option value="12"<?php if ( !empty( $cur_loc ) && ( $cur_loc->location_zoom == 12 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Large City','my-calendar'); ?></option>
64
+ <option value="10"<?php if ( !empty( $cur_loc ) && ( $cur_loc->location_zoom == 10 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Greater Metro Area','my-calendar'); ?></option>
65
+ <option value="8"<?php if ( !empty( $cur_loc ) && ( $cur_loc->location_zoom == 8 ) ) { echo " selected=\"selected\""; } ?>><?php _e('State','my-calendar'); ?></option>
66
+ <option value="6"<?php if ( !empty( $cur_loc ) && ( $cur_loc->location_zoom == 6 ) ) { echo " selected=\"selected\""; } ?>><?php _e('Region','my-calendar'); ?></option>
67
+ </select>
68
+ </p>
69
+ <fieldset>
70
+ <legend><?php _e('GPS Coordinates (optional)','my-calendar'); ?></legend>
71
+ <p>
72
+ <small><?php _e('If you supply GPS coordinates for your location, they will be used in place of any other address information to pinpoint your location.','my-calendar'); ?></small>
73
+ </p>
74
+ <p>
75
+ <label for="location_longitude"><?php _e('Longitude','my-calendar'); ?></label> <input type="text" id="location_longitude" name="location_longitude" class="input" size="10" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_longitude)); ?>" /> <label for="location_latitude"><?php _e('Latitude','my-calendar'); ?></label> <input type="text" id="location_latitude" name="location_latitude" class="input" size="10" value="<?php if ( !empty( $cur_loc ) ) echo htmlspecialchars(stripslashes($cur_loc->location_latitude)); ?>" />
76
+ </p>
77
  </fieldset>
78
  <p>
79
  <input type="submit" name="save" class="button-primary" value="<?php _e('Save Changes','my-calendar'); ?> &raquo;" />
80
  </p>
81
+ </fieldset>
82
  </form>
83
  </div>
84
  </div>
85
  </div>
86
  <?php
87
  } else if (isset($_POST['mode']) && isset($_POST['location_id']) && isset($_POST['location_label']) && isset($_POST['location_street']) && $_POST['mode'] == 'edit') {
88
+ $sql = "UPDATE " . MY_CALENDAR_LOCATIONS_TABLE . " SET location_label='".mysql_real_escape_string($_POST['location_label'])."', location_street='".mysql_real_escape_string($_POST['location_street'])."', location_street2='".mysql_real_escape_string($_POST['location_street2'])."', location_city='".mysql_real_escape_string($_POST['location_city'])."', location_state='".mysql_real_escape_string($_POST['location_state'])."', location_postcode='".mysql_real_escape_string($_POST['location_postcode'])."', location_country='".mysql_real_escape_string($_POST['location_country'])."', location_longitude='".mysql_real_escape_string($_POST['location_longitude'])."', location_latitude='".mysql_real_escape_string($_POST['location_latitude'])."', location_zoom='".mysql_real_escape_string($_POST['location_zoom'])."' WHERE location_id=".mysql_real_escape_string($_POST['location_id']);
89
  $wpdb->get_results($sql);
90
  echo "<div class=\"updated\"><p><strong>".__('Location edited successfully','my-calendar')."</strong></p></div>";
91
  }
124
  <p>
125
  <label for="location_country"><?php _e('Country','my-calendar'); ?></label> <input type="text" id="location_country" name="location_country" class="input" size="10" value="" />
126
  </p>
127
+ <p>
128
+ <label for="location_zoom"><?php _e('Initial Zoom','my-calendar'); ?></label>
129
+ <select name="location_zoom" id="location_zoom">
130
+ <option value="16"><?php _e('Neighborhood','my-calendar'); ?></option>
131
+ <option value="14"><?php _e('Small City','my-calendar'); ?></option>
132
+ <option value="12"><?php _e('Large City','my-calendar'); ?></option>
133
+ <option value="10"><?php _e('Greater Metro Area','my-calendar'); ?></option>
134
+ <option value="8"><?php _e('State','my-calendar'); ?></option>
135
+ <option value="6"><?php _e('Region','my-calendar'); ?></option>
136
+ </select>
137
+ </p>
138
+ <fieldset>
139
+ <legend><?php _e('GPS Coordinates (optional)','my-calendar'); ?></legend>
140
+ <p>
141
+ <small><?php _e('If you supply GPS coordinates for your location, they will be used in place of any other address information to pinpoint your location.','my-calendar'); ?></small>
142
+ </p>
143
+ <p>
144
+ <label for="location_longitude"><?php _e('Longitude','my-calendar'); ?></label> <input type="text" id="location_longitude" name="location_longitude" class="input" size="10" value="" /> <label for="location_latitude"><?php _e('Latitude','my-calendar'); ?></label> <input type="text" id="location_latitude" name="location_latitude" class="input" size="10" value="" />
145
+ </p>
146
  </fieldset>
147
  <p>
148
  <input type="submit" name="save" class="button-primary" value="<?php _e('Add Location','my-calendar'); ?> &raquo;" />
149
  </p>
150
+ </fieldset>
151
+
152
  </form>
153
  </div>
154
  </div>
my-calendar-settings.php CHANGED
@@ -99,14 +99,21 @@ function edit_my_calendar_config() {
99
  $my_calendar_show_months = (int) $_POST['my_calendar_show_months'];
100
  $my_calendar_date_format = $_POST['my_calendar_date_format'];
101
 
 
102
  $disp_author = ($_POST['display_author']=='on')?'true':'false';
103
  $disp_jump = ($_POST['display_jump']=='on')?'true':'false';
104
  $my_calendar_show_map = ($_POST['my_calendar_show_map']=='on')?'true':'false';
105
  $my_calendar_show_address = ($_POST['my_calendar_show_address']=='on')?'true':'false';
106
  $my_calendar_show_heading = ($_POST['my_calendar_show_heading']=='on')?'true':'false';
107
  $my_calendar_notime_text = $_POST['my_calendar_notime_text'];
 
 
 
108
  $my_calendar_hide_icons = ($_POST['my_calendar_hide_icons']=='on')?'true':'false';
 
 
109
  $my_calendar_caption = $_POST['my_calendar_caption'];
 
110
 
111
  update_option('can_manage_events',$new_perms);
112
  update_option('display_author',$disp_author);
@@ -117,8 +124,14 @@ function edit_my_calendar_config() {
117
  update_option('my_calendar_show_address',$my_calendar_show_address);
118
  update_option('my_calendar_show_heading',$my_calendar_show_heading);
119
  update_option('my_calendar_notime_text',$my_calendar_notime_text);
 
 
120
  update_option('my_calendar_hide_icons',$my_calendar_hide_icons);
121
  update_option('my_calendar_caption',$my_calendar_caption);
 
 
 
 
122
  echo "<div class=\"updated\"><p><strong>".__('Settings saved','my-calendar').".</strong></p></div>";
123
  }
124
 
@@ -128,6 +141,7 @@ function edit_my_calendar_config() {
128
  $my_calendar_show_map = get_option('my_calendar_show_map');
129
  $my_calendar_show_address = get_option('my_calendar_show_address');
130
  $disp_author = get_option('display_author');
 
131
  // checkbox
132
  $disp_jump = get_option('display_jump');
133
  //checkbox
@@ -190,6 +204,12 @@ function edit_my_calendar_config() {
190
  <label for="my_calendar_notime_text"><?php _e('Label for events without a specific time'); ?></label> <input type="text" id="my_calendar_notime_text" name="my_calendar_notime_text" value="<?php if ( get_option('my_calendar_notime_text') == "") { _e('N/A','my-calendar'); } else { echo stripslashes( get_option('my_calendar_notime_text') ); } ?>" />
191
  </p>
192
  <p>
 
 
 
 
 
 
193
  <label for="my_calendar_caption"><?php _e('Additional caption text','my-calendar'); ?></label> <input type="text" id="my_calendar_caption" name="my_calendar_caption" value="<?php echo stripslashes( get_option('my_calendar_caption') ); ?>" /><br /><small><?php _e('The calendar caption is the text containing the displayed month and year in either list or calendar format. This text will be displayed following that existing text.'); ?></small>
194
  </p>
195
  <p>
@@ -200,6 +220,14 @@ function edit_my_calendar_config() {
200
  </p>
201
  <p>
202
  <input type="checkbox" id="my_calendar_show_address" name="my_calendar_show_address" <?php jd_cal_checkCheckbox('my_calendar_show_address','true'); ?> /> <label for="my_calendar_show_address"><?php _e('Show Event Address in Details','my-calendar'); ?></label>
 
 
 
 
 
 
 
 
203
  </p>
204
  </fieldset>
205
  <p>
@@ -233,8 +261,5 @@ if ( get_option( 'ko_calendar_imported' ) != 'true' ) {
233
  </div>
234
  </div>
235
  <?php
236
-
237
-
238
  }
239
-
240
  ?>
99
  $my_calendar_show_months = (int) $_POST['my_calendar_show_months'];
100
  $my_calendar_date_format = $_POST['my_calendar_date_format'];
101
 
102
+
103
  $disp_author = ($_POST['display_author']=='on')?'true':'false';
104
  $disp_jump = ($_POST['display_jump']=='on')?'true':'false';
105
  $my_calendar_show_map = ($_POST['my_calendar_show_map']=='on')?'true':'false';
106
  $my_calendar_show_address = ($_POST['my_calendar_show_address']=='on')?'true':'false';
107
  $my_calendar_show_heading = ($_POST['my_calendar_show_heading']=='on')?'true':'false';
108
  $my_calendar_notime_text = $_POST['my_calendar_notime_text'];
109
+ $mc_previous_events = $_POST['mc_previous_events'];
110
+ $mc_next_events = $_POST['mc_next_events'];
111
+
112
  $my_calendar_hide_icons = ($_POST['my_calendar_hide_icons']=='on')?'true':'false';
113
+ $mc_apply_color = $_POST['mc_apply_color'];
114
+
115
  $my_calendar_caption = $_POST['my_calendar_caption'];
116
+ $my_calendar_event_link_expires = ($_POST['mc_event_link_expires']=='on')?'true':'false';
117
 
118
  update_option('can_manage_events',$new_perms);
119
  update_option('display_author',$disp_author);
124
  update_option('my_calendar_show_address',$my_calendar_show_address);
125
  update_option('my_calendar_show_heading',$my_calendar_show_heading);
126
  update_option('my_calendar_notime_text',$my_calendar_notime_text);
127
+ update_option('mc_next_events',$mc_next_events);
128
+ update_option('mc_previous_events',$mc_previous_events);
129
  update_option('my_calendar_hide_icons',$my_calendar_hide_icons);
130
  update_option('my_calendar_caption',$my_calendar_caption);
131
+ update_option('mc_event_link_expires',$my_calendar_event_link_expires);
132
+ update_option('mc_apply_color',$mc_apply_color);
133
+
134
+
135
  echo "<div class=\"updated\"><p><strong>".__('Settings saved','my-calendar').".</strong></p></div>";
136
  }
137
 
141
  $my_calendar_show_map = get_option('my_calendar_show_map');
142
  $my_calendar_show_address = get_option('my_calendar_show_address');
143
  $disp_author = get_option('display_author');
144
+ $mc_event_link_expires = get_option('mc_event_link_expires');
145
  // checkbox
146
  $disp_jump = get_option('display_jump');
147
  //checkbox
204
  <label for="my_calendar_notime_text"><?php _e('Label for events without a specific time'); ?></label> <input type="text" id="my_calendar_notime_text" name="my_calendar_notime_text" value="<?php if ( get_option('my_calendar_notime_text') == "") { _e('N/A','my-calendar'); } else { echo stripslashes( get_option('my_calendar_notime_text') ); } ?>" />
205
  </p>
206
  <p>
207
+ <label for="mc_previous_events"><?php _e('Previous events link text'); ?></label> <input type="text" id="mc_previous_events" name="mc_previous_events" value="<?php if ( get_option('mc_previous_events') == "") { _e('Previous Events','my-calendar'); } else { echo stripslashes( get_option('mc_previous_events') ); } ?>" />
208
+ </p>
209
+ <p>
210
+ <label for="mc_next_events"><?php _e('Next events link text'); ?></label> <input type="text" id="mc_next_events" name="mc_next_events" value="<?php if ( get_option('mc_next_events') == "") { _e('Next Events','my-calendar'); } else { echo stripslashes( get_option('mc_next_events') ); } ?>" />
211
+ </p>
212
+ <p>
213
  <label for="my_calendar_caption"><?php _e('Additional caption text','my-calendar'); ?></label> <input type="text" id="my_calendar_caption" name="my_calendar_caption" value="<?php echo stripslashes( get_option('my_calendar_caption') ); ?>" /><br /><small><?php _e('The calendar caption is the text containing the displayed month and year in either list or calendar format. This text will be displayed following that existing text.'); ?></small>
214
  </p>
215
  <p>
220
  </p>
221
  <p>
222
  <input type="checkbox" id="my_calendar_show_address" name="my_calendar_show_address" <?php jd_cal_checkCheckbox('my_calendar_show_address','true'); ?> /> <label for="my_calendar_show_address"><?php _e('Show Event Address in Details','my-calendar'); ?></label>
223
+ </p>
224
+ <p>
225
+ <input type="checkbox" id="mc_event_link_expires" name="mc_event_link_expires" <?php jd_cal_checkCheckbox('mc_event_link_expires','true'); ?> /> <label for="mc_event_link_expires"><?php _e('Links associated with events will automatically expire after the event has passed.','my-calendar'); ?></label>
226
+ </p>
227
+ <p>
228
+ <input type="radio" id="mc_apply_color_default" name="mc_apply_color" value="default" <?php jd_cal_checkCheckbox('mc_apply_color','default'); ?> /> <label for="mc_apply_color_default"><?php _e('Default usage of category colors.','my-calendar'); ?></label><br />
229
+ <input type="radio" id="mc_apply_color_to_titles" name="mc_apply_color" value="font" <?php jd_cal_checkCheckbox('mc_apply_color','font'); ?> /> <label for="mc_apply_color_to_titles"><?php _e('Apply category colors to event titles as a font color.','my-calendar'); ?></label><br />
230
+ <input type="radio" id="mc_apply_bgcolor_to_titles" name="mc_apply_color" value="background" <?php jd_cal_checkCheckbox('mc_apply_color','background'); ?> /> <label for="mc_apply_bgcolor_to_titles"><?php _e('Apply category colors to event titles as a background color.','my-calendar'); ?></label>
231
  </p>
232
  </fieldset>
233
  <p>
261
  </div>
262
  </div>
263
  <?php
 
 
264
  }
 
265
  ?>
my-calendar-styles.php CHANGED
@@ -2,8 +2,8 @@
2
  // Display the admin configuration page
3
 
4
  function edit_my_calendar_styles() {
5
- global $wpdb, $initial_style, $initial_listjs, $initial_caljs;
6
-
7
  // We can't use this page unless My Calendar is installed/upgraded
8
  check_my_calendar();
9
 
@@ -12,15 +12,20 @@ function edit_my_calendar_styles() {
12
  $my_calendar_style = $_POST['style'];
13
  $my_calendar_caljs = $_POST['my_calendar_caljs'];
14
  $my_calendar_listjs = $_POST['my_calendar_listjs'];
 
15
 
16
 
17
  $use_styles = ($_POST['use_styles']=='on')?'true':'false';
18
 
19
  update_option('my_calendar_style',$my_calendar_style);
20
  update_option('my_calendar_use_styles',$use_styles);
 
21
  update_option('calendar_javascript', (int) $_POST['calendar_javascript']);
22
  update_option('list_javascript', (int) $_POST['list_javascript']);
 
 
23
  update_option('my_calendar_listjs',$my_calendar_listjs);
 
24
  update_option('my_calendar_caljs',$my_calendar_caljs);
25
  $my_calendar_show_css = ($_POST['my_calendar_show_css']=='')?'':$_POST['my_calendar_show_css'];
26
  update_option('my_calendar_show_css',$my_calendar_show_css);
@@ -30,11 +35,14 @@ function edit_my_calendar_styles() {
30
  update_option('my_calendar_style',$initial_style);
31
  }
32
  if ( $_POST['reset_caljs'] == 'on') {
33
- update_option('my_calendar_listjs',$initial_listjs);
34
  }
35
  if ( $_POST['reset_listjs'] == 'on') {
36
- update_option('my_calendar_caljs',$initial_caljs);
37
  }
 
 
 
38
  echo "<div class=\"updated\"><p><strong>".__('Style Settings saved','my-calendar').".</strong></p></div>";
39
  }
40
 
@@ -47,12 +55,13 @@ function edit_my_calendar_styles() {
47
  $my_calendar_caljs = stripcslashes(get_option('my_calendar_caljs'));
48
  $calendar_javascript = get_option('calendar_javascript');
49
 
 
 
 
50
  $my_calendar_show_css = stripcslashes(get_option('my_calendar_show_css'));
51
-
52
 
53
  // Now we render the form
54
 
55
-
56
  ?>
57
  <div class="wrap">
58
 
@@ -63,7 +72,10 @@ function edit_my_calendar_styles() {
63
  <h3><?php _e('Calendar Style Settings','my-calendar'); ?></h3>
64
  <div class="inside">
65
  <form name="my-calendar" id="my-calendar" method="post" action="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar-styles">
66
- <fieldset>
 
 
 
67
  <legend><?php _e('CSS Style Options','my-calendar'); ?></legend>
68
  <p>
69
  <input type="checkbox" id="reset_styles" name="reset_styles" /> <label for="reset_styles"><?php _e('Reset the My Calendar stylesheet to the default','my-calendar'); ?></label> <input type="checkbox" id="use_styles" name="use_styles" <?php jd_cal_checkCheckbox('my_calendar_use_styles','true'); ?> /> <label for="use_styles"><?php _e('Disable My Calendar Stylesheet','my-calendar'); ?></label>
@@ -72,8 +84,8 @@ function edit_my_calendar_styles() {
72
  <label for="style"><?php _e('Edit the stylesheet for My Calendar','my-calendar'); ?></label><br /><textarea id="style" name="style" rows="30" cols="80"><?php echo $my_calendar_style; ?></textarea>
73
  </p>
74
  <p>
75
- <label for="my_calendar_show_css"><?php _e('Show CSS only on these pages (comma separated page IDs)','my-calendar'); ?></label> <input type="text" id="my_calendar_show_css" name="my_calendar_show_css" value="<?php echo $my_calendar_show_css; ?>" />
76
- </p>
77
  </fieldset>
78
  <fieldset>
79
  <legend><?php _e('Calendar Behaviors: Calendar View','my-calendar'); ?></legend>
@@ -83,6 +95,9 @@ function edit_my_calendar_styles() {
83
  <p>
84
  <label for="calendar-javascript"><?php _e('Edit the jQuery scripts for My Calendar in Calendar format','my-calendar'); ?></label><br /><textarea id="calendar-javascript" name="my_calendar_caljs" rows="10" cols="80"><?php echo $my_calendar_caljs; ?></textarea>
85
  </p>
 
 
 
86
  </fieldset>
87
  <fieldset>
88
  <legend><?php _e('Calendar Behaviors: List View','my-calendar'); ?></legend>
@@ -92,10 +107,22 @@ function edit_my_calendar_styles() {
92
  <p>
93
  <label for="list-javascript"><?php _e('Edit the jQuery scripts for My Calendar in List format','my-calendar'); ?></label><br /><textarea id="list-javascript" name="my_calendar_listjs" rows="10" cols="80"><?php echo $my_calendar_listjs; ?></textarea>
94
  </p>
95
- </fieldset>
96
  <p>
97
  <input type="submit" name="save" class="button-primary" value="<?php _e('Save','my-calendar'); ?> &raquo;" />
 
 
 
 
 
 
98
  </p>
 
 
 
 
 
 
 
99
  </form>
100
  </div>
101
 
2
  // Display the admin configuration page
3
 
4
  function edit_my_calendar_styles() {
5
+ global $wpdb, $initial_style, $initial_listjs, $initial_caljs, $initial_minijs;
6
+
7
  // We can't use this page unless My Calendar is installed/upgraded
8
  check_my_calendar();
9
 
12
  $my_calendar_style = $_POST['style'];
13
  $my_calendar_caljs = $_POST['my_calendar_caljs'];
14
  $my_calendar_listjs = $_POST['my_calendar_listjs'];
15
+ $my_calendar_minijs = $_POST['my_calendar_minijs'];
16
 
17
 
18
  $use_styles = ($_POST['use_styles']=='on')?'true':'false';
19
 
20
  update_option('my_calendar_style',$my_calendar_style);
21
  update_option('my_calendar_use_styles',$use_styles);
22
+ // turn info off or on
23
  update_option('calendar_javascript', (int) $_POST['calendar_javascript']);
24
  update_option('list_javascript', (int) $_POST['list_javascript']);
25
+ update_option('mini_javascript', (int) $_POST['mini_javascript']);
26
+ // set js
27
  update_option('my_calendar_listjs',$my_calendar_listjs);
28
+ update_option('my_calendar_minijs',$my_calendar_minijs);
29
  update_option('my_calendar_caljs',$my_calendar_caljs);
30
  $my_calendar_show_css = ($_POST['my_calendar_show_css']=='')?'':$_POST['my_calendar_show_css'];
31
  update_option('my_calendar_show_css',$my_calendar_show_css);
35
  update_option('my_calendar_style',$initial_style);
36
  }
37
  if ( $_POST['reset_caljs'] == 'on') {
38
+ update_option('my_calendar_caljs',$initial_caljs);
39
  }
40
  if ( $_POST['reset_listjs'] == 'on') {
41
+ update_option('my_calendar_listjs',$initial_listjs);
42
  }
43
+ if ( $_POST['reset_minijs'] == 'on') {
44
+ update_option('my_calendar_minijs',$initial_minijs);
45
+ }
46
  echo "<div class=\"updated\"><p><strong>".__('Style Settings saved','my-calendar').".</strong></p></div>";
47
  }
48
 
55
  $my_calendar_caljs = stripcslashes(get_option('my_calendar_caljs'));
56
  $calendar_javascript = get_option('calendar_javascript');
57
 
58
+ $my_calendar_minijs = stripcslashes(get_option('my_calendar_minijs'));
59
+ $mini_javascript = get_option('mini_javascript');
60
+
61
  $my_calendar_show_css = stripcslashes(get_option('my_calendar_show_css'));
 
62
 
63
  // Now we render the form
64
 
 
65
  ?>
66
  <div class="wrap">
67
 
72
  <h3><?php _e('Calendar Style Settings','my-calendar'); ?></h3>
73
  <div class="inside">
74
  <form name="my-calendar" id="my-calendar" method="post" action="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar-styles">
75
+ <p>
76
+ <label for="my_calendar_show_css"><?php _e('Show CSS & JavaScript only on these pages (comma separated page IDs)','my-calendar'); ?></label> <input type="text" id="my_calendar_show_css" name="my_calendar_show_css" value="<?php echo $my_calendar_show_css; ?>" />
77
+ </p>
78
+ <fieldset>
79
  <legend><?php _e('CSS Style Options','my-calendar'); ?></legend>
80
  <p>
81
  <input type="checkbox" id="reset_styles" name="reset_styles" /> <label for="reset_styles"><?php _e('Reset the My Calendar stylesheet to the default','my-calendar'); ?></label> <input type="checkbox" id="use_styles" name="use_styles" <?php jd_cal_checkCheckbox('my_calendar_use_styles','true'); ?> /> <label for="use_styles"><?php _e('Disable My Calendar Stylesheet','my-calendar'); ?></label>
84
  <label for="style"><?php _e('Edit the stylesheet for My Calendar','my-calendar'); ?></label><br /><textarea id="style" name="style" rows="30" cols="80"><?php echo $my_calendar_style; ?></textarea>
85
  </p>
86
  <p>
87
+ <input type="submit" name="save" class="button-primary" value="<?php _e('Save','my-calendar'); ?> &raquo;" />
88
+ </p>
89
  </fieldset>
90
  <fieldset>
91
  <legend><?php _e('Calendar Behaviors: Calendar View','my-calendar'); ?></legend>
95
  <p>
96
  <label for="calendar-javascript"><?php _e('Edit the jQuery scripts for My Calendar in Calendar format','my-calendar'); ?></label><br /><textarea id="calendar-javascript" name="my_calendar_caljs" rows="10" cols="80"><?php echo $my_calendar_caljs; ?></textarea>
97
  </p>
98
+ <p>
99
+ <input type="submit" name="save" class="button-primary" value="<?php _e('Save','my-calendar'); ?> &raquo;" />
100
+ </p>
101
  </fieldset>
102
  <fieldset>
103
  <legend><?php _e('Calendar Behaviors: List View','my-calendar'); ?></legend>
107
  <p>
108
  <label for="list-javascript"><?php _e('Edit the jQuery scripts for My Calendar in List format','my-calendar'); ?></label><br /><textarea id="list-javascript" name="my_calendar_listjs" rows="10" cols="80"><?php echo $my_calendar_listjs; ?></textarea>
109
  </p>
 
110
  <p>
111
  <input type="submit" name="save" class="button-primary" value="<?php _e('Save','my-calendar'); ?> &raquo;" />
112
+ </p>
113
+ </fieldset>
114
+ <fieldset>
115
+ <legend><?php _e('Calendar Behaviors: Mini Calendar View','my-calendar'); ?></legend>
116
+ <p>
117
+ <input type="checkbox" id="reset_minijs" name="reset_minijs" /> <label for="reset_listjs"><?php _e('Reset the My Calendar Mini Format Javascript','my-calendar'); ?></label> <input type="checkbox" id="list_javascript" name="list_javascript" value="1" <?php jd_cal_checkCheckbox('list_javascript',1); ?> /> <label for="list_javascript"><?php _e('Disable List Javascript Effects','my-calendar'); ?></label>
118
  </p>
119
+ <p>
120
+ <label for="mini-javascript"><?php _e('Edit the jQuery scripts for My Calendar in Mini Calendar format','my-calendar'); ?></label><br /><textarea id="mini-javascript" name="my_calendar_minijs" rows="10" cols="80"><?php echo $my_calendar_minijs; ?></textarea>
121
+ </p>
122
+ <p>
123
+ <input type="submit" name="save" class="button-primary" value="<?php _e('Save','my-calendar'); ?> &raquo;" />
124
+ </p>
125
+ </fieldset>
126
  </form>
127
  </div>
128
 
my-calendar-widgets.php CHANGED
@@ -135,12 +135,12 @@ function init_my_calendar_upcoming() {
135
  </select>
136
  </p>
137
  <p>
138
- <input type="text" id="display_upcoming_events" name="display_upcoming_events" value="<?php if(isset($_POST['display_upcoming_events'])){echo $_POST['display_upcoming_events']; } else { echo $upcoming_events; } ?>" size="1" maxlength="2" /> <label for="display_upcoming_events"><?php _e('events into the future;','my-calendar'); ?></label><br />
139
- <input type="text" id="display_past_events" name="display_past_events" value="<?php if(isset($_POST['display_past_events'])){echo $_POST['display_past_events']; } else { echo $past_events; } ?>" size="1" maxlength="2" /> <label for="display_past_events"><?php _e('events from the past','my-calendar'); ?></label>
140
  </p>
141
  <p>
142
- <input type="text" id="display_upcoming_days" name="display_upcoming_days" value="<?php if(isset($_POST['display_upcoming_days'])){echo $_POST['display_upcoming_days']; } else { echo $upcoming_days; } ?>" size="1" maxlength="2" /> <label for="display_upcoming_days"><?php _e('days into the future;','my-calendar'); ?></label><br />
143
- <input type="text" id="display_past_days" name="display_past_days" value="<?php if(isset($_POST['display_past_days'])){echo $_POST['display_past_days']; } else { echo $past_days; } ?>" size="1" maxlength="2" /> <label for="display_past_days"><?php _e('days from the past','my-calendar'); ?></label>
144
  </p>
145
  <p>
146
  <label for="display_in_category"><?php _e('Show only this category:','my-calendar'); ?></label><br />
@@ -157,11 +157,11 @@ function init_my_calendar_upcoming() {
157
  // Widget upcoming events
158
  function my_calendar_upcoming_events($before='default',$after='default',$type='default',$category='default',$template='default') {
159
  global $wpdb;
 
160
 
161
  // This function cannot be called unless calendar is up to date
162
  check_my_calendar();
163
- $offset = get_option('gmt_offset');
164
- $today = date('Y',time()+(60*60*$offset)).'-'.date('m',time()+(60*60*$offset)).'-'.date('d',time()+(60*60*$offset));
165
 
166
  if ($type == 'default') {
167
  $display_upcoming_type = get_option('display_upcoming_type');
@@ -298,7 +298,7 @@ function my_calendar_todays_events($category='default',$template='default') {
298
  $category = $category;
299
  }
300
 
301
- $events = my_calendar_grab_events(date("Y"),date("m"),date("d"),$category);
302
  if (count($events) != 0) {
303
  $output = "<ul>";
304
  }
@@ -339,6 +339,8 @@ function event_as_array($event) {
339
  // My Calendar must be updated to run this function
340
  check_my_calendar();
341
 
 
 
342
  $sql = "SELECT category_name FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=".$event->event_category;
343
  $category_name = $wpdb->get_row($sql);
344
  $e = get_userdata($event->event_author);
@@ -369,14 +371,20 @@ if ($event->event_country != "") {
369
  $hcard .= "</div>\n</div>";
370
 
371
  $map_string = $event->event_street.' '.$event->event_street2.' '.$event->event_city.' '.$event->event_state.' '.$event->event_postcode.' '.$event->event_country;
372
- if (strlen($map_string) > 10) {
373
  $map_string = str_replace(" ","+",$map_string);
374
  if ($event->event_label != "") {
375
  $map_label = $event->event_label;
376
  } else {
377
  $map_label = $event->event_title;
378
  }
379
- $map = "<a href=\"http://maps.google.com/maps?f=q&z=15&q=$map_string\">Map<span> to $map_label</span></a>";
 
 
 
 
 
 
380
  } else {
381
  $map = "";
382
  }
@@ -394,14 +402,27 @@ $date_end = date_i18n(get_option('date_format'),strtotime($event->event_end));
394
  $details['category'] = stripslashes($category_name->category_name);
395
  $details['title'] = stripslashes($event->event_title);
396
  if ($event->event_time == '00:00:00' ) {
397
- $details['time'] = __('N/A','my-calendar');
398
  } else {
399
  $details['time'] = date(get_option('time_format'),strtotime($event->event_time));
400
  }
 
 
 
 
 
401
  $details['author'] = $e->display_name;
 
402
  $details['link'] = $event->event_link;
 
 
 
 
 
 
 
403
  $details['description'] = stripslashes($event->event_desc);
404
- if ($event->event_link != '') {
405
  $details['link_title'] = "<a href='".$event->event_link."'>".stripslashes($event->event_title)."</a>";
406
  } else {
407
  $details['link_title'] = stripslashes($event->event_title);
@@ -421,5 +442,4 @@ $date_end = date_i18n(get_option('date_format'),strtotime($event->event_end));
421
  return $details;
422
  }
423
 
424
-
425
  ?>
135
  </select>
136
  </p>
137
  <p>
138
+ <input type="text" id="display_upcoming_events" name="display_upcoming_events" value="<?php if(isset($_POST['display_upcoming_events'])){echo $_POST['display_upcoming_events']; } else { echo $upcoming_events; } ?>" size="1" maxlength="3" /> <label for="display_upcoming_events"><?php _e('events into the future;','my-calendar'); ?></label><br />
139
+ <input type="text" id="display_past_events" name="display_past_events" value="<?php if(isset($_POST['display_past_events'])){echo $_POST['display_past_events']; } else { echo $past_events; } ?>" size="1" maxlength="3" /> <label for="display_past_events"><?php _e('events from the past','my-calendar'); ?></label>
140
  </p>
141
  <p>
142
+ <input type="text" id="display_upcoming_days" name="display_upcoming_days" value="<?php if(isset($_POST['display_upcoming_days'])){echo $_POST['display_upcoming_days']; } else { echo $upcoming_days; } ?>" size="1" maxlength="3" /> <label for="display_upcoming_days"><?php _e('days into the future;','my-calendar'); ?></label><br />
143
+ <input type="text" id="display_past_days" name="display_past_days" value="<?php if(isset($_POST['display_past_days'])){echo $_POST['display_past_days']; } else { echo $past_days; } ?>" size="1" maxlength="3" /> <label for="display_past_days"><?php _e('days from the past','my-calendar'); ?></label>
144
  </p>
145
  <p>
146
  <label for="display_in_category"><?php _e('Show only this category:','my-calendar'); ?></label><br />
157
  // Widget upcoming events
158
  function my_calendar_upcoming_events($before='default',$after='default',$type='default',$category='default',$template='default') {
159
  global $wpdb;
160
+ $offset = (60*60*get_option('gmt_offset'));
161
 
162
  // This function cannot be called unless calendar is up to date
163
  check_my_calendar();
164
+ $today = date('Y',time()+($offset)).'-'.date('m',time()+($offset)).'-'.date('d',time()+($offset));
 
165
 
166
  if ($type == 'default') {
167
  $display_upcoming_type = get_option('display_upcoming_type');
298
  $category = $category;
299
  }
300
 
301
+ $events = my_calendar_grab_events(date_i18n("Y"),date_i18n("m"),date_i18n("d"),$category);
302
  if (count($events) != 0) {
303
  $output = "<ul>";
304
  }
339
  // My Calendar must be updated to run this function
340
  check_my_calendar();
341
 
342
+ $offset = (60*60*get_option('gmt_offset'));
343
+
344
  $sql = "SELECT category_name FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=".$event->event_category;
345
  $category_name = $wpdb->get_row($sql);
346
  $e = get_userdata($event->event_author);
371
  $hcard .= "</div>\n</div>";
372
 
373
  $map_string = $event->event_street.' '.$event->event_street2.' '.$event->event_city.' '.$event->event_state.' '.$event->event_postcode.' '.$event->event_country;
374
+ if ( strlen($map_string) > 0 ) {
375
  $map_string = str_replace(" ","+",$map_string);
376
  if ($event->event_label != "") {
377
  $map_label = $event->event_label;
378
  } else {
379
  $map_label = $event->event_title;
380
  }
381
+ $zoom = ($event->event_zoom != 0)?$event->event_zoom:'15';
382
+
383
+ if ($event->event_longitude != '0.000000' && $event->event_latitude != '0.000000') {
384
+ $map_string = "$event->event_longitude,$event->event_latitude";
385
+ }
386
+
387
+ $map = "<a href=\"http://maps.google.com/maps?f=q&z=$zoom&q=$map_string\">Map<span> to $map_label</span></a>";
388
  } else {
389
  $map = "";
390
  }
402
  $details['category'] = stripslashes($category_name->category_name);
403
  $details['title'] = stripslashes($event->event_title);
404
  if ($event->event_time == '00:00:00' ) {
405
+ $details['time'] = get_option( 'my_calendar_notime_text' );
406
  } else {
407
  $details['time'] = date(get_option('time_format'),strtotime($event->event_time));
408
  }
409
+ if ($event->event_endtime == '00:00:00' ) {
410
+ $deatils['endtime'] = '';
411
+ } else {
412
+ $details['endtime'] = date( get_option('time_format'),strtotime($event->event_endtime));
413
+ }
414
  $details['author'] = $e->display_name;
415
+ if ( $event->event_link_expires == 0 ) {
416
  $details['link'] = $event->event_link;
417
+ } else {
418
+ if ( my_calendar_date_comp( $event->event_begin, date_i18n('Y-m-d',time() ) ) ) {
419
+ $details['link'] = '';
420
+ } else {
421
+ $details['link'] = $event->event_link;
422
+ }
423
+ }
424
  $details['description'] = stripslashes($event->event_desc);
425
+ if ($details['link'] != '') {
426
  $details['link_title'] = "<a href='".$event->event_link."'>".stripslashes($event->event_title)."</a>";
427
  } else {
428
  $details['link_title'] = stripslashes($event->event_title);
442
  return $details;
443
  }
444
 
 
445
  ?>
my-calendar.php CHANGED
@@ -1,2038 +1,1607 @@
1
- <?php
2
- /*
3
- Plugin Name: My Calendar
4
- Plugin URI: http://www.joedolson.com/articles/my-calendar/
5
- Description: Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
6
- Author: Joseph C Dolson
7
- Author URI: http://www.joedolson.com
8
- Version: 1.3.8
9
- */
10
- /* Copyright 2009 Joe Dolson (email : joe@joedolson.com)
11
-
12
- This program is free software; you can redistribute it and/or modify
13
- it under the terms of the GNU General Public License as published by
14
- the Free Software Foundation; either version 2 of the License, or
15
- (at your option) any later version.
16
-
17
- This program is distributed in the hope that it will be useful,
18
- but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- GNU General Public License for more details.
21
-
22
- You should have received a copy of the GNU General Public License
23
- along with this program; if not, write to the Free Software
24
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
- */
26
-
27
- // Enable internationalisation
28
- $plugin_dir = basename(dirname(__FILE__));
29
- load_plugin_textdomain( 'my-calendar','wp-content/plugins/'.$plugin_dir, $plugin_dir);
30
- global $wpdb;
31
- // Define the tables used in My Calendar
32
- define('MY_CALENDAR_TABLE', $wpdb->prefix . 'my_calendar');
33
- define('MY_CALENDAR_CATEGORIES_TABLE', $wpdb->prefix . 'my_calendar_categories');
34
- define('MY_CALENDAR_LOCATIONS_TABLE', $wpdb->prefix . 'my_calendar_locations');
35
-
36
- // Create a master category for My Calendar and its sub-pages
37
- add_action('admin_menu', 'my_calendar_menu');
38
- // Add the function that puts style information in the header
39
- add_action('wp_head', 'my_calendar_wp_head');
40
- // Add the function that deals with deleted users
41
- add_action('delete_user', 'mc_deal_with_deleted_user');
42
- // Add the widgets if we are using version 2.8
43
- add_action('widgets_init', 'init_my_calendar_today');
44
- add_action('widgets_init', 'init_my_calendar_upcoming');
45
-
46
- function jd_calendar_plugin_action($links, $file) {
47
- if ($file == plugin_basename(dirname(__FILE__).'/my-calendar.php'))
48
- $links[] = "<a href='admin.php?page=my-calendar-config'>" . __('Settings', 'my-calendar') . "</a>";
49
- return $links;
50
- }
51
- add_filter('plugin_action_links', 'jd_calendar_plugin_action', -10, 2);
52
-
53
- include(dirname(__FILE__).'/my-calendar-settings.php' );
54
- include(dirname(__FILE__).'/my-calendar-categories.php' );
55
- include(dirname(__FILE__).'/my-calendar-locations.php' );
56
- include(dirname(__FILE__).'/my-calendar-help.php' );
57
- include(dirname(__FILE__).'/my-calendar-event-manager.php' );
58
- include(dirname(__FILE__).'/my-calendar-styles.php' );
59
- include(dirname(__FILE__).'/my-calendar-widgets.php' );
60
- include(dirname(__FILE__).'/date-utilities.php' );
61
-
62
-
63
- // Before we get on with the functions, we need to define the initial style used for My Calendar
64
-
65
- function jd_show_support_box() {
66
- ?>
67
- <div class="resources">
68
- <ul>
69
- <li><a href="http://www.joedolson.com/articles/my-calendar/"><?php _e("Get Support",'my-calendar'); ?></a></li>
70
- <li><a href="http://www.joedolson.com/donate.php"><?php _e("Make a Donation",'my-calendar'); ?></a></li>
71
- <li><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
72
- <div>
73
- <input type="hidden" name="cmd" value="_s-xclick" />
74
- <input type="hidden" name="hosted_button_id" value="8490399" />
75
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate" />
76
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
77
- </div>
78
- </form></li>
79
- </ul>
80
-
81
- </div>
82
- <?php
83
- }
84
-
85
- // Function to deal with events posted by a user when that user is deleted
86
- function mc_deal_with_deleted_user($id) {
87
- global $wpdb;
88
- // This wouldn't work unless the database was up to date. Lets check.
89
- check_my_calendar();
90
- // Do the query
91
- $wpdb->get_results( "UPDATE ".MY_CALENDAR_TABLE." SET event_author=".$wpdb->get_var("SELECT MIN(ID) FROM ".$wpdb->prefix."users",0,0)." WHERE event_author=".$id );
92
- }
93
-
94
- // Function to add the calendar style into the header
95
- function my_calendar_wp_head() {
96
- global $wpdb, $wp_query;
97
- // If the calendar isn't installed or upgraded this won't work
98
- check_my_calendar();
99
- $styles = stripcslashes(get_option('my_calendar_style'));
100
- if ( get_option('my_calendar_use_styles') != 'true' ) {
101
-
102
- $this_post = $wp_query->get_queried_object();
103
- if (is_object($this_post)) {
104
- $id = $this_post->ID;
105
- }
106
- if ( get_option( 'my_calendar_show_css' ) != '' ) {
107
- $array = explode( ",",get_option( 'my_calendar_show_css' ) );
108
- if (!is_array($array)) {
109
- $array = array();
110
- }
111
- }
112
- if ( @in_array( $id, $array ) || get_option( 'my_calendar_show_css' ) == '' ) {
113
-
114
- echo "
115
- <style type=\"text/css\">
116
- <!--
117
- // Styles from My Calendar - Joseph C Dolson http://www.joedolson.com/
118
- $styles
119
- -->
120
- </style>";
121
-
122
- }
123
- }
124
- }
125
-
126
- // Function to deal with adding the calendar menus
127
- function my_calendar_menu() {
128
- global $wpdb;
129
- // We make use of the My Calendar tables so we must have installed My Calendar
130
- check_my_calendar();
131
- // Set admin as the only one who can use My Calendar for security
132
- $allowed_group = 'manage_options';
133
- // Use the database to *potentially* override the above if allowed
134
- $allowed_group = get_option('can_manage_events');
135
-
136
-
137
- // Add the admin panel pages for My Calendar. Use permissions pulled from above
138
- if (function_exists('add_menu_page')) {
139
- add_menu_page(__('My Calendar','my-calendar'), __('My Calendar','my-calendar'), $allowed_group, 'my-calendar', 'edit_my_calendar');
140
- }
141
- if (function_exists('add_submenu_page')) {
142
- add_submenu_page('my-calendar', __('Add/Edit Events','my-calendar'), __('Add/Edit Events','my-calendar'), $allowed_group, 'my-calendar', 'edit_my_calendar');
143
- add_action( "admin_head", 'my_calendar_write_js' );
144
- add_action( "admin_head", 'my_calendar_add_styles' );
145
- // Note only admin can change calendar options
146
- add_submenu_page('my-calendar', __('Manage Categories','my-calendar'), __('Manage Categories','my-calendar'), 'manage_options', 'my-calendar-categories', 'my_calendar_manage_categories');
147
- add_submenu_page('my-calendar', __('Manage Locations','my-calendar'), __('Manage Locations','my-calendar'), 'manage_options', 'my-calendar-locations', 'my_calendar_manage_locations');
148
- add_submenu_page('my-calendar', __('Settings','my-calendar'), __('Settings','my-calendar'), 'manage_options', 'my-calendar-config', 'edit_my_calendar_config');
149
- add_submenu_page('my-calendar', __('Style Editor','my-calendar'), __('Style Editor','my-calendar'), 'manage_options', 'my-calendar-styles', 'edit_my_calendar_styles');
150
- add_submenu_page('my-calendar', __('My Calendar Help','my-calendar'), __('Help','my-calendar'), 'manage_options', 'my-calendar-help', 'my_calendar_help');
151
- }
152
- }
153
- add_action( "admin_menu", 'my_calendar_add_javascript' );
154
-
155
- // Function to add the javascript to the admin header
156
- function my_calendar_add_javascript() {
157
- if ($_GET['page'] == 'my-calendar') {
158
- wp_enqueue_script('jquery-ui-datepicker',WP_PLUGIN_URL . '/my-calendar/js/ui.datepicker.js', array('jquery','jquery-ui-core') );
159
- }
160
- if ($_GET['page'] == 'my-calendar-categories') {
161
- wp_enqueue_script('jquery-colorpicker',WP_PLUGIN_URL . '/my-calendar/js/jquery-colorpicker.js', array('jquery') );
162
- }
163
- }
164
- function my_calendar_write_js() {
165
- if ($_GET['page']=='my-calendar') {
166
- echo '
167
- <script type="text/javascript">
168
- //<![CDATA[
169
- jQuery(document).ready(function($) {
170
- $("#event_begin").datepicker({
171
- numberOfMonths: 2,
172
- dateFormat: "yy-mm-dd"
173
- });
174
- $("#event_end").datepicker({
175
- numberOfMonths: 2,
176
- dateFormat: "yy-mm-dd"
177
- });
178
- });
179
- //]]>
180
- </script>
181
- ';
182
- }
183
- if ($_GET['page']=='my-calendar-categories') {
184
- /*
185
- <script type=\"text/javascript\">
186
- //<![CDATA[
187
- //jQuery(document).ready(function($) {
188
- //$('#category_color').colorpicker({ flat: true });
189
- //]]>
190
- */
191
- }
192
- }
193
- function my_calendar_add_display_javascript() {
194
- wp_enqueue_script('jquery');
195
- }
196
- add_action('init','my_calendar_add_display_javascript');
197
-
198
- function my_calendar_calendar_javascript() {
199
- $list_js = stripcslashes( get_option( 'my_calendar_listjs' ) );
200
- $cal_js = stripcslashes( get_option( 'my_calendar_caljs' ) );
201
-
202
- if ( get_option('calendar_javascript') != 1 || get_option('list_javascript') != 1 ) {
203
- //echo '<script type="text/javascript">
204
- //var $j = jQuery.noConflict();
205
- //$j(\'html\').addClass(\'js\');
206
- //</script>';
207
- }
208
-
209
- if ( get_option('calendar_javascript') != 1 ) {
210
- ?>
211
- <script type='text/javascript'>
212
- <?php echo $cal_js; ?>
213
- </script>
214
- <?php
215
- }
216
- if ( get_option('list_javascript') != 1 ) {
217
- ?>
218
- <script type='text/javascript'>
219
- <?php echo $list_js; ?>
220
- </script>
221
- <?php
222
- }
223
- }
224
- add_action('wp_head','my_calendar_calendar_javascript');
225
-
226
- function my_calendar_add_styles() {
227
- ?>
228
- <link type="text/css" rel="stylesheet" href="<?php echo WP_PLUGIN_URL; ?>/my-calendar/js/ui.datepicker.css" />
229
- <?php
230
- echo '
231
- <style type="text/css">
232
- <!--
233
- .jd-my-calendar {
234
- margin-right: 150px!important;
235
- }
236
- #my-calendar legend {
237
- font-weight: 700;
238
- font-size: 1em;
239
- }
240
- .resources {
241
- float: right;
242
- border: 1px solid #aaa;
243
- padding: 10px 10px 0;
244
- margin-left: 10px;
245
- -moz-border-radius: 5px;
246
- -webkit-border-radius: 5px;
247
- border-radius: 5px;
248
- background: #fff;
249
- text-align: center;
250
- }
251
- .resources form {
252
- margin: 0!important;
253
- }
254
- #category_icon option {
255
- padding: 5px 0 5px 24px;
256
- }
257
- #my-calendar-admin-table .delete {
258
- background: #a00;
259
- color: #fff;
260
- padding: 2px 8px;
261
- font-size: .8em;
262
- border: 1px solid #fff;
263
- -moz-border-radius: 8px;
264
- -webkit-border-radius: 8px;
265
- border-radius: 8px;
266
- text-decoration: none;
267
- }
268
- #my-calendar-admin-table .delete:hover, #my-calendar-admin-table .delete:focus {
269
- border: 1px solid #999;
270
- background: #b11;
271
- }
272
- .import {
273
- background: #ffa;
274
- padding: 5px 10px;
275
- border: 1px solid #aaa;
276
- -moz-border-radius: 5px;
277
- -webkit-border-radius: 5px;
278
- border-radius: 5px;
279
- margin: 15px 0;
280
- }
281
- .n4 {width: 32px;}
282
- .n5 {width: 32px;}
283
- .n6 {width: 64px;}
284
- .n7 {width: 128px;}
285
- .n8 {width: 256px;}
286
- .category-color {
287
- width: 1.2em;
288
- height: 1.2em;
289
- display: inline-block;
290
- -moz-border-radius: 3px;
291
- -webkit-border-radius: 3px;
292
- border-radius: 3px;
293
- border: 1px solid #000;
294
- }
295
- //-->
296
- </style>';
297
- }
298
-
299
- function my_calendar_insert($atts) {
300
- extract(shortcode_atts(array(
301
- 'name' => 'all',
302
- 'format' => 'calendar',
303
- 'category' => 'all',
304
- 'showkey' => 'yes',
305
- ), $atts));
306
- return my_calendar($name,$format,$category,$showkey);
307
- }
308
-
309
- function my_calendar_insert_upcoming($atts) {
310
- extract(shortcode_atts(array(
311
- 'before' => 'default',
312
- 'after' => 'default',
313
- 'type' => 'default',
314
- 'category' => 'default',
315
- 'template' => 'default'
316
- ), $atts));
317
- return my_calendar_upcoming_events($before, $after, $type, $category, $template);
318
- }
319
-
320
- function my_calendar_insert_today($atts) {
321
- extract(shortcode_atts(array(
322
- 'category' => 'default',
323
- 'template' => 'default'
324
- ), $atts));
325
- return my_calendar_todays_events($category, $template);
326
- }
327
-
328
-
329
- // add shortcode interpreter
330
- add_shortcode('my_calendar','my_calendar_insert');
331
- add_shortcode('my_calendar_upcoming','my_calendar_insert_upcoming');
332
- add_shortcode('my_calendar_today','my_calendar_insert_today');
333
-
334
- // Function to check what version of My Calendar is installed and install if needed
335
- function check_my_calendar() {
336
- // Checks to make sure My Calendar is installed, if not it adds the default
337
- // database tables and populates them with test data. If it is, then the
338
- // version is checked through various means and if it is not up to date
339
- // then it is upgraded. (Or will be, once there's a need.)
340
-
341
- // Lets see if this is first run and create a table if it is!
342
- global $wpdb, $initial_style, $initial_listjs, $initial_caljs;
343
-
344
- // defaults will go into the options table on a new install
345
- $initial_listjs = 'var $j = jQuery.noConflict();
346
-
347
- $j(document).ready(function() {
348
- $j("#calendar-list li").children().not(".event-date").hide();
349
- $j("#calendar-list li.current-day").children().show();
350
- $j(".event-date").toggle(
351
- function() {
352
- $j("#calendar-list li").children().not(".event-date").hide();
353
- $j(this).parent().children().not(".event-date").show("fast");
354
- },
355
- function() {
356
- $j("#calendar-list li").children().not(".event-date").hide("fast");
357
- }
358
- );
359
- });';
360
-
361
- $initial_caljs = 'var $j = jQuery.noConflict();
362
-
363
- $j(document).ready(function() {
364
- $j(".calendar-event").children().not("h3").hide();
365
- $j(".calendar-event h3").toggle(
366
- function() {
367
- $j(".calendar-event").children().not("h3").hide();
368
- $j(this).parent().children().not("h3").show("fast");
369
- },
370
- function() {
371
- $j(".calendar-event").children().not("h3").hide("fast");
372
- }
373
- );
374
- });';
375
-
376
- $initial_style = "
377
- #jd-calendar * {
378
- margin: 0;
379
- padding: 0;
380
- line-height: 1.5;
381
- color: #000;
382
- background: #fff;
383
- }
384
- #jd-calendar caption, #jd-calendar .my-calendar-date-switcher {
385
- background: #edf7ff;
386
- border: 1px solid #a9e3ff;
387
- margin: 2px 0;
388
- font-weight:700;
389
- padding:2px 0;
390
- }
391
-
392
- #jd-calendar table {
393
- width:100%;
394
- line-height:1.2;
395
- border-collapse:collapse;
396
- }
397
-
398
- #jd-calendar td {
399
- vertical-align:top;
400
- border:1px solid #eee;
401
- text-align:left;
402
- width:13%;
403
- height:70px;
404
- padding:2px!important;
405
- }
406
- #jd-calendar th {
407
- text-align: center;
408
- padding: 5px 0!important;
409
- letter-spacing: 1px;
410
- }
411
- #jd-calendar th abbr {
412
- border-bottom: none;
413
- }
414
- #jd-calendar h3 {
415
- font-size:.9em;
416
- font-family: Arial, Verdana, sans-serif;
417
- font-weight:700;
418
- margin:3px 0;
419
- padding:0;
420
- width: 100%;
421
- }
422
- #jd-calendar h3 img {
423
- vertical-align: bottom;
424
- margin: 0 3px 0 0!important;
425
- }
426
- #jd-calendar #calendar-list h3 img {
427
- vertical-align: middle;
428
- }
429
-
430
- #jd-calendar .list-event h3 {
431
- font-size:1.2em;
432
- margin:0;
433
- }
434
- #jd-calendar .calendar-event .details {
435
- position:absolute;
436
- width:50%;
437
- background: #edf7ff;
438
- color:#000;
439
- border:1px solid #9b5;
440
- -moz-border-radius:10px;
441
- -moz-box-shadow:3px 3px 6px #777;
442
- -webkit-box-shadow:3px 3px 6px #777;
443
- box-shadow:3px 3px 6px #777;
444
- padding:5px;
445
- z-index: 3;
446
- }
447
-
448
- #jd-calendar .list-event .details {
449
- background:#fafafa;
450
- border:1px solid #eee;
451
- -moz-border-radius:5px;
452
- -webkit-border-radius:5px;
453
- border-radius:5px;
454
- margin:5px 0;
455
- padding:5px 5px 0;
456
- color: #333;
457
- }
458
- #jd-calendar #calendar-list {
459
- margin: 0;
460
- padding: 0;
461
- }
462
- #jd-calendar #calendar-list li {
463
- padding:5px;
464
- list-style-type: none;
465
- margin: 0;
466
- }
467
-
468
- #jd-calendar #calendar-list .odd {
469
- background:#d3e3e3;
470
- }
471
-
472
- #jd-calendar .odd .list-event .details {
473
- background:#e3f3f3;
474
- border:1px solid #c3d3d3;
475
- }
476
-
477
- #jd-calendar .current-day {
478
- background:#ffb;
479
- }
480
- #jd-calendar .current-day span {
481
- color: #000;
482
- background: #eee;
483
- }
484
-
485
- #jd-calendar td span {
486
- display:block;
487
- background:#f6f6f6;
488
- margin:-2px -2px 2px;
489
- padding:2px 4px;
490
- }
491
-
492
- #jd-calendar .calendar-event span {
493
- display:inline;
494
- background:none;
495
- margin:0;
496
- padding:0;
497
- }
498
-
499
- #jd-calendar .weekend {
500
- background:#bd7;
501
- color: #000;
502
- }
503
-
504
- #jd-calendar th {
505
- font-size:.8em;
506
- text-transform:uppercase;
507
- padding:2px 4px 2px 0;
508
- }
509
- #jd-calendar .category-key {
510
- background: #edf7ff;
511
- border: 1px solid #a9e3ff;
512
- padding: 5px;
513
- margin: 5px 0;
514
- }
515
- #jd-calendar .category-key ul {
516
- list-style-type: none;
517
- margin: 0;
518
- padding: 0;
519
- }
520
- #jd-calendar .category-key li {
521
- margin: 2px 10px;
522
- }
523
- #jd-calendar .category-key span {
524
- margin-right:5px;
525
- vertical-align:middle;
526
- }
527
- #jd-calendar .category-key .no-icon {
528
- width: 10px;
529
- height: 10px;
530
- display: inline-block;
531
- border: 1px solid #555;
532
- -moz-border-radius: 2px;
533
- -webkit-border-radius: 2px;
534
- border-radius: 2px;
535
- }
536
-
537
- #calendar-list li {
538
- text-indent:0;
539
- margin:0;
540
- padding:0;
541
- }
542
-
543
- #jd-calendar .event-time {
544
- display:block;
545
- float:left;
546
- height:100%;
547
- margin-right:10px;
548
- margin-bottom:10px;
549
- font-weight:700;
550
- font-size:.9em;
551
- }
552
-
553
- #jd-calendar p {
554
- line-height:1.5;
555
- margin:0 0 1em;
556
- padding:0;
557
- }
558
-
559
- #jd-calendar .sub-details {
560
- margin-left:6em;
561
- }
562
-
563
- #jd-calendar .vcard {
564
- font-size:.9em;
565
- margin:10px 0;
566
- }
567
-
568
- #jd-calendar .calendar-event .vcard {
569
- margin:0 0 10px;
570
- }
571
-
572
- #jd-calendar,#calendar-list {
573
- clear:left;
574
- background: #fff;
575
- }
576
- #jd-calendar {
577
- position: relative;
578
- }
579
- #jd-calendar img {
580
- border: none;
581
- }
582
- .category-color-sample img {
583
- margin-right: 5px;
584
- vertical-align: top;
585
- }
586
- .my-calendar-nav {
587
-
588
- }
589
-
590
- #jd-calendar .my-calendar-nav ul {
591
- height: 2.95em;
592
- list-style-type:none;
593
- margin:0;
594
- padding:0;
595
- }
596
-
597
- #jd-calendar .my-calendar-nav li {
598
- float:left;
599
- list-style-type: none;
600
- }
601
-
602
- #jd-calendar .my-calendar-nav li:before {
603
- content:'';
604
- }
605
- #jd-calendar .my-calendar-nav li a {
606
- display:block;
607
- background:#fff;
608
- border:1px solid #9b5;
609
- text-align:center;
610
- padding:1px 20px;
611
- color: #243f82;
612
- }
613
-
614
- #jd-calendar .my-calendar-nav li a:hover {
615
- background:#a9e3ff;
616
- color:#000;
617
- border: 1px solid #243f82;
618
- }
619
- #jd-calendar .my-calendar-next {
620
- margin-left: 4px;
621
- text-align:right;
622
- }
623
- #jd-calendar .my-calendar-next a {
624
- -webkit-border-top-right-radius: 8px;
625
- -webkit-border-bottom-right-radius: 8px;
626
- -moz-border-radius-topright: 8px;
627
- -moz-border-radius-bottomright: 8px;
628
- border-top-right-radius: 8px;
629
- border-bottom-right-radius: 8px;
630
- }
631
- #jd-calendar .my-calendar-prev a {
632
- -webkit-border-top-left-radius: 8px;
633
- -webkit-border-bottom-left-radius: 8px;
634
- -moz-border-radius-topleft: 8px;
635
- -moz-border-radius-bottomleft: 8px;
636
- border-top-left-radius: 8px;
637
- border-bottom-left-radius: 8px;
638
- }
639
- #jd-calendar .day-without-date {
640
- background: #fafafa;
641
- }
642
- #upcoming-events .past-event {
643
- color: #777;
644
- }
645
- #upcoming-events .today {
646
- color: #111;
647
- }
648
- #upcoming-events .future-event {
649
- color: #555;
650
- }";
651
-
652
- $default_template = "<strong>{date}</strong> &#8211; {link_title}<br /><span>{time}, {category}</span>";
653
-
654
- // Assume this is not a new install until we prove otherwise
655
- $new_install = false;
656
-
657
- $my_calendar_exists = false;
658
- $upgrade_path = false;
659
-
660
- // Determine the calendar version
661
- $tables = $wpdb->get_results("show tables;");
662
- foreach ( $tables as $table ) {
663
- foreach ( $table as $value ) {
664
- if ( $value == MY_CALENDAR_TABLE ) {
665
- $my_calendar_exists = true;
666
- $current_version = get_option('my_calendar_version');
667
- // check whether installed version matches most recent version, establish upgrade process.
668
- }
669
- }
670
- }
671
- if ( $my_calendar_exists == false ) {
672
- $new_install = true;
673
- } else if ( version_compare( $current_version,"1.3.0","<" ) ) {
674
- $upgrade_path = "1.3.0";
675
- if ( version_compare( $current_version, "1.3.8","<" ) && version_compare( $current_version, "1.3.0",">" ) ) {
676
- update_option('my_calendar_show_css','');
677
- }
678
- // having determined upgrade path, assign new version number
679
- update_option( 'my_calendar_version' , '1.3.8' );
680
-
681
- }
682
-
683
-
684
- // Now we've determined what the current install is or isn't
685
- if ( $new_install == true ) {
686
- $sql = "CREATE TABLE " . MY_CALENDAR_TABLE . " (
687
- event_id INT(11) NOT NULL AUTO_INCREMENT ,
688
- event_begin DATE NOT NULL ,
689
- event_end DATE NOT NULL ,
690
- event_title VARCHAR(60) NOT NULL ,
691
- event_desc TEXT NOT NULL ,
692
- event_time TIME ,
693
- event_recur CHAR(1) ,
694
- event_repeats INT(3) ,
695
- event_author BIGINT(20) UNSIGNED,
696
- event_category BIGINT(20) UNSIGNED,
697
- event_link TEXT,
698
- event_label VARCHAR(60) NOT NULL ,
699
- event_street VARCHAR(60) NOT NULL ,
700
- event_street2 VARCHAR(60) NOT NULL ,
701
- event_city VARCHAR(60) NOT NULL ,
702
- event_state VARCHAR(60) NOT NULL ,
703
- event_postcode VARCHAR(10) NOT NULL ,
704
- event_country VARCHAR(60) NOT NULL ,
705
- PRIMARY KEY (event_id)
706
- )";
707
- $wpdb->get_results($sql);
708
- add_option('can_manage_events','edit_posts');
709
- add_option('my_calendar_style',"$initial_style");
710
- add_option('display_author','false');
711
- add_option('display_jump','false');
712
- add_option('display_todays','true');
713
- add_option('display_upcoming','true');
714
- add_option('display_upcoming_days',7);
715
- add_option('my_calendar_version','1.3.8');
716
- add_option('display_upcoming_type','false');
717
- add_option('display_upcoming_events',3);
718
- add_option('display_past_days',0);
719
- add_option('display_past_events',2);
720
- add_option('my_calendar_use_styles','false');
721
- add_option('my_calendar_show_months',1);
722
- add_option('my_calendar_show_map','true');
723
- add_option('my_calendar_show_address','false');
724
- add_option('my_calendar_today_template',$default_template);
725
- add_option('my_calendar_upcoming_template',$default_template);
726
- add_option('my_calendar_today_title','Today\'s Events');
727
- add_option('my_calendar_upcoming_title','Upcoming Events');
728
- add_option('calendar_javascript',0);
729
- add_option('list_javascript',0);
730
- add_option('my_calendar_listjs',$initial_listjs);
731
- add_option('my_calendar_caljs',$initial_caljs);
732
- add_option('my_calendar_notime_text','N/A');
733
- add_option('my_calendar_hide_icons','false');
734
- $sql = "UPDATE " . MY_CALENDAR_TABLE . " SET event_category=1";
735
- $wpdb->get_results($sql);
736
-
737
- $sql = "CREATE TABLE " . MY_CALENDAR_CATEGORIES_TABLE . " (
738
- category_id INT(11) NOT NULL AUTO_INCREMENT,
739
- category_name VARCHAR(30) NOT NULL ,
740
- category_color VARCHAR(30) NOT NULL ,
741
- category_icon VARCHAR(128) NOT NULL ,
742
- PRIMARY KEY (category_id)
743
- )";
744
- $wpdb->get_results($sql);
745
- $sql = "INSERT INTO " . MY_CALENDAR_CATEGORIES_TABLE . " SET category_id=1, category_name='General', category_color='#ffffff', category_icon='event.png'";
746
- $wpdb->get_results($sql);
747
-
748
- $sql = "CREATE TABLE " . MY_CALENDAR_LOCATIONS_TABLE . " (
749
- location_id INT(11) NOT NULL AUTO_INCREMENT,
750
- location_label VARCHAR(60) NOT NULL ,
751
- location_street VARCHAR(60) NOT NULL ,
752
- location_street2 VARCHAR(60) NOT NULL ,
753
- location_city VARCHAR(60) NOT NULL ,
754
- location_state VARCHAR(60) NOT NULL ,
755
- location_postcode VARCHAR(10) NOT NULL ,
756
- location_country VARCHAR(60) NOT NULL ,
757
- PRIMARY KEY (location_id)
758
- )";
759
- $wpdb->get_results($sql);
760
-
761
- }
762
-
763
- // switch for different upgrade paths
764
- switch ($upgrade_path) {
765
- case FALSE:
766
- break;
767
- case '1.3.0':
768
- add_option('my_calendar_listjs',$initial_listjs);
769
- add_option('my_calendar_caljs',$initial_caljs);
770
- add_option('my_calendar_show_heading','true');
771
- $sql = "CREATE TABLE " . MY_CALENDAR_LOCATIONS_TABLE . " (
772
- location_id INT(11) NOT NULL AUTO_INCREMENT,
773
- location_label VARCHAR(60) NOT NULL ,
774
- location_street VARCHAR(60) NOT NULL ,
775
- location_street2 VARCHAR(60) NOT NULL ,
776
- location_city VARCHAR(60) NOT NULL ,
777
- location_state VARCHAR(60) NOT NULL ,
778
- location_postcode VARCHAR(10) NOT NULL ,
779
- location_country VARCHAR(60) NOT NULL ,
780
- PRIMARY KEY (location_id)
781
- )";
782
- $wpdb->get_results($sql);
783
-
784
- /*
785
- if the user has fully uninstalled the plugin but kept the database of events, this will restore default settings.
786
- */
787
- if ( get_option( 'my_calendar_uninstalled' ) == 'true' ) {
788
- add_option('can_manage_events','edit_posts');
789
- add_option('my_calendar_style',"$initial_style");
790
- add_option('display_author','false');
791
- add_option('display_jump','false');
792
- add_option('display_todays','true');
793
- add_option('display_upcoming','true');
794
- add_option('display_upcoming_days',7);
795
- add_option('my_calendar_version','1.3.1');
796
- add_option('display_upcoming_type','false');
797
- add_option('display_upcoming_events',3);
798
- add_option('display_past_days',0);
799
- add_option('display_past_events',2);
800
- add_option('my_calendar_use_styles','false');
801
- add_option('my_calendar_show_months',1);
802
- add_option('my_calendar_show_map','true');
803
- add_option('my_calendar_show_address','false');
804
- add_option('my_calendar_today_template',$default_template);
805
- add_option('my_calendar_upcoming_template',$default_template);
806
- add_option('my_calendar_today_title','Today\'s Events');
807
- add_option('my_calendar_upcoming_title','Upcoming Events');
808
- add_option('calendar_javascript',0);
809
- add_option('list_javascript',0);
810
- }
811
- default:
812
- break;
813
- }
814
-
815
- }
816
- function jd_cal_checkCheckbox( $theFieldname,$theValue ){
817
- if( get_option( $theFieldname ) == $theValue ){
818
- echo 'checked="checked"';
819
- }
820
- }
821
- function jd_cal_checkSelect( $theFieldname,$theValue ) {
822
- if ( get_option( $theFieldname ) == $theValue) {
823
- echo 'selected="selected"';
824
- }
825
- }
826
-
827
- // Function to return a prefix which will allow the correct
828
- // placement of arguments into the query string.
829
- function my_calendar_permalink_prefix() {
830
- // Get the permalink structure from WordPress
831
- $p_link = get_permalink();
832
-
833
- // Work out what the real URL we are viewing is
834
- $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
835
- $protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")).$s;
836
- $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
837
- $real_link = $protocol.'://'.$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
838
-
839
- // Now use all of that to get the correctly craft the My Calendar link prefix
840
- if (strstr($p_link, '?') && $p_link == $real_link) {
841
- $link_part = $p_link.'&';
842
- } else if ($p_link == $real_link) {
843
- $link_part = $p_link.'?';
844
- } else if (strstr($real_link, '?')) {
845
- if (isset($_GET['month']) && isset($_GET['yr'])) {
846
- $new_tail = split("&", $real_link);
847
- foreach ($new_tail as $item) {
848
- if (!strstr($item, 'month') && !strstr($item, 'yr')) {
849
- $link_part .= $item.'&amp;';
850
- }
851
- }
852
- if (!strstr($link_part, '?')) {
853
- $new_tail = split("month", $link_part);
854
- $link_part = $new_tail[0].'?'.$new_tail[1];
855
- }
856
- } else {
857
- $link_part = $real_link.'&amp;';
858
- }
859
- } else {
860
- $link_part = $real_link.'?';
861
- }
862
- return $link_part;
863
- }
864
-
865
- // Configure the "Next" link in the calendar
866
- function my_calendar_next_link($cur_year,$cur_month,$format) {
867
- $mod_rewrite_months = array(1=>'jan','feb','mar','apr','may','jun','jul','aug','sept','oct','nov','dec');
868
- $next_year = $cur_year + 1;
869
-
870
- $num_months = get_option('my_calendar_show_months');
871
- if ($num_months <= 1 || $format=="calendar") {
872
- if ($cur_month == 12) {
873
- return '<a href="' . my_calendar_permalink_prefix() . 'month=jan&amp;yr=' . $next_year . '" rel="nofollow">'.__('Next Events','my-calendar').' &raquo;</a>';
874
- } else {
875
- $next_month = $cur_month + 1;
876
- $month = $mod_rewrite_months[$next_month];
877
- return '<a href="' . my_calendar_permalink_prefix() . 'month='.$month.'&amp;yr=' . $cur_year . '" rel="nofollow">'.__('Next Events','my-calendar').' &raquo;</a>';
878
- }
879
- } else {
880
- if (($cur_month + $num_months) > 12) {
881
- $next_month = ($cur_month + $num_months) - 12;
882
- } else {
883
- $next_month = $cur_month + $num_months;
884
- }
885
- $month = $mod_rewrite_months[$next_month];
886
- if ($cur_month >= (12-$num_months)) {
887
- return '<a href="' . my_calendar_permalink_prefix() . 'month='.$month.'&amp;yr=' . $next_year . '" rel="nofollow">'.__('Next Events','my-calendar').' &raquo;</a>';
888
- } else {
889
- return '<a href="' . my_calendar_permalink_prefix() . 'month='.$month.'&amp;yr=' . $cur_year . '" rel="nofollow">'.__('Next Events','my-calendar').' &raquo;</a>';
890
- }
891
- }
892
- }
893
-
894
- // Configure the "Previous" link in the calendar
895
- function my_calendar_prev_link($cur_year,$cur_month,$format) {
896
- $mod_rewrite_months = array(1=>'jan','feb','mar','apr','may','jun','jul','aug','sept','oct','nov','dec');
897
- $last_year = $cur_year - 1;
898
-
899
- $num_months = get_option('my_calendar_show_months');
900
- if ($num_months <= 1 || $format=="calendar") {
901
- if ($cur_month == 1) {
902
- return '<a href="' . my_calendar_permalink_prefix() . 'month=dec&amp;yr='. $last_year .'" rel="nofollow">&laquo; '.__('Previous Events','my-calendar').'</a>';
903
- } else {
904
- $next_month = $cur_month - 1;
905
- $month = $mod_rewrite_months[$next_month];
906
- return '<a href="' . my_calendar_permalink_prefix() . 'month='.$month.'&amp;yr=' . $cur_year . '" rel="nofollow">&laquo; '.__('Previous Events','my-calendar').'</a>';
907
- }
908
- } else {
909
- if ($cur_month > $num_months) {
910
- $next_month = $cur_month - $num_months;
911
- } else {
912
- $next_month = ($cur_month - $num_months) + 12;
913
- }
914
- $month = $mod_rewrite_months[$next_month];
915
- if ($cur_month <= $num_months) {
916
- return '<a href="' . my_calendar_permalink_prefix() . 'month='.$month.'&amp;yr=' . $last_year . '" rel="nofollow">&laquo; '.__('Previous Events','my-calendar').'</a>';
917
- } else {
918
- return '<a href="' . my_calendar_permalink_prefix() . 'month='.$month.'&amp;yr=' . $cur_year . '" rel="nofollow">&laquo; '.__('Previous Events','my-calendar').'</a>';
919
- }
920
- }
921
- }
922
-
923
- // Used to draw multiple events
924
- function my_calendar_draw_events($events, $type) {
925
- // We need to sort arrays of objects by time
926
- usort($events, "my_calendar_time_cmp");
927
- foreach($events as $event) {
928
- $output .= my_calendar_draw_event($event, $type);
929
- }
930
- return $output;
931
- }
932
-
933
- // Used to draw an event to the screen
934
- function my_calendar_draw_event($event, $type="calendar") {
935
- global $wpdb;
936
-
937
- // My Calendar must be updated to run this function
938
- check_my_calendar();
939
-
940
- $display_author = get_option('display_author');
941
- $display_map = get_option('my_calendar_show_map');
942
- $display_address = get_option('my_calendar_show_address');
943
- $sql = "SELECT * FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=".$event->event_category;
944
- $cat_details = $wpdb->get_row($sql);
945
- $style = "background-color:".$cat_details->category_color.";";
946
- if ( get_option('my_calendar_hide_icons')=='true' ) {
947
- $image = "";
948
- } else {
949
- if ($cat_details->category_icon != "") {
950
- if ( file_exists( WP_PLUGIN_DIR . '/my-calendar-custom/' ) ) {
951
- $path = '/my-calendar-custom';
952
- } else {
953
- $path = '/my-calendar/icons';
954
- }
955
- $image = '<img src="'.WP_PLUGIN_URL.$path.'/'.$cat_details->category_icon.'" alt="" class="category-icon" style="background:'.$cat_details->category_color.';" />';
956
- } else {
957
- $image = "";
958
- }
959
- }
960
- $location_string = $event->event_street.$event->event_street2.$event->event_city.$event->event_state.$event->event_postcode.$event->event_country;
961
- if (($display_address == 'true' || $display_map == 'true') && strlen($location_string) > 0 ) {
962
- $map_string = $event->event_street.' '.$event->event_street2.' '.$event->event_city.' '.$event->event_state.' '.$event->event_postcode.' '.$event->event_country;
963
-
964
- $address .= '<div class="address vcard">';
965
-
966
- if ($display_address == 'true') {
967
- $address .= "<div class=\"adr\">";
968
- if ($event->event_label != "") {
969
- $address .= "<strong class=\"org\">".stripslashes($event->event_label)."</strong><br />";
970
- }
971
- if ($event->event_street != "") {
972
- $address .= "<div class=\"street-address\">".stripslashes($event->event_street)."</div>";
973
- }
974
- if ($event->event_street2 != "") {
975
- $address .= "<div class=\"street-address\">".stripslashes($event->event_street2)."</div>";
976
- }
977
- if ($event->event_city != "") {
978
- $address .= "<span class=\"locality\">".stripslashes($event->event_city).",</span>";
979
- }
980
- if ($event->event_state != "") {
981
- $address .= " <span class=\"region\">".stripslashes($event->event_state)."</span> ";
982
- }
983
- if ($event->event_postcode != "") {
984
- $address .= " <span class=\"postal-code\">".stripslashes($event->event_postcode)."</span>";
985
- }
986
- if ($event->event_country != "") {
987
- $address .= "<div class=\"country-name\">".stripslashes($event->event_country)."</div>";
988
- }
989
- $address .= "</div>";
990
- }
991
- if ($display_map == 'true' && strlen($location_string) > 0 ) {
992
- $map_string = str_replace(" ","+",$map_string);
993
- if ($event->event_label != "") {
994
- $map_label = stripslashes($event->event_label);
995
- } else {
996
- $map_label = stripslashes($event->event_title);
997
- }
998
- $map = "<a href=\"http://maps.google.com/maps?f=q&amp;z=15&amp;q=$map_string\">Map<span> to $map_label</span></a>";
999
- $address .= "<div class=\"url map\">$map</div>";
1000
- }
1001
- $address .= "</div>";
1002
- }
1003
-
1004
- $my_calendar_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) );
1005
-
1006
- $header_details .= "\n<div class='$type-event'>\n";
1007
- if ($type == "calendar") {
1008
- $header_details .= "<h3 class='event-title'>$image".stripslashes($event->event_title)." <a href='#'><img src='$my_calendar_directory/images/event-details.png' alt='".__('Event Details','my-calendar')."' /></a></h3>\n";
1009
- }
1010
- $header_details .= "<div class='details'>";
1011
- if ($event->event_time != "00:00:00") {
1012
- $header_details .= "<span class='event-time'>".date(get_option('time_format'), strtotime($event->event_time)) . "</span>\n";
1013
- } else {
1014
- $header_details .= "<span class='event-time'>";
1015
- if ( get_option('my_calendar_notime_text') == '' || get_option('my_calendar_notime_text') == "N/A" ) {
1016
- $header_details .= "<abbr title='".__('Not Applicable','my-calendar')."'>".__('N/A','my-calendar')."</abbr>\n";
1017
- } else {
1018
- $header_details .= get_option('my_calendar_notime_text');
1019
- }
1020
- $header_details .= "</span>";
1021
- }
1022
- $header_details .= "<div class='sub-details'>";
1023
- if ($type != "calendar") {
1024
- $header_details .= "<h3 class='event-title'>$image".stripslashes($event->event_title)."</h3>\n";
1025
- }
1026
- if ($display_author == 'true') {
1027
- $e = get_userdata($event->event_author);
1028
- $header_details .= '<span class="event-author">'.__('Posted by', 'my-calendar').': <span class="author-name">'.$e->display_name."</span></span><br />\n ";
1029
- }
1030
- if (($display_address == 'true' || $display_map == 'true') && strlen($location_string) > 0 ) {
1031
- $header_details .= $address;
1032
- }
1033
-
1034
- if ($event->event_link != '') { $linky = $event->event_link; } else { $linky = '#'; }
1035
- if ($linky != "#") {
1036
- $details = "\n". $header_details . '' . wpautop(stripslashes($event->event_desc),1) . '<p><a href="'.$linky.'" class="event-link">' . stripslashes($event->event_title) . '&raquo; </a></p>'."</div></div></div>\n";
1037
- } else {
1038
- $details = "\n". $header_details . '' . wpautop(stripslashes($event->event_desc),1) . "</div></div></div>\n";
1039
- }
1040
- return $details;
1041
- }
1042
- // used to generate upcoming events lists
1043
- function mc_get_all_events($category) {
1044
- global $wpdb;
1045
- if ( $category!='default' ) {
1046
- if ( strpos( $category, "|" ) ) {
1047
- $categories = explode( "|", $category );
1048
- $numcat = count($categories);
1049
- $i = 1;
1050
- foreach ($categories as $key) {
1051
- if ( is_numeric($key) ) {
1052
- if ($i == 1) {
1053
- $select_category .= " WHERE (";
1054
- }
1055
- $select_category .= " event_category = $key";
1056
- if ($i < $numcat) {
1057
- $select_category .= " OR ";
1058
- } else if ($i == $numcat) {
1059
- $select_cateory .= ") ";
1060
- }
1061
- $i++;
1062
- } else {
1063
- $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$key'");
1064
- $category_id = $cat->category_id;
1065
- if ($i == 1) {
1066
- $select_category .= " WHERE (";
1067
- }
1068
- $select_category .= " event_category = $category_id";
1069
- if ($i < $numcat) {
1070
- $select_category .= " OR ";
1071
- } else if ($i == $numcat) {
1072
- $select_category .= ") ";
1073
- }
1074
- $i++;
1075
- }
1076
- }
1077
- } else {
1078
- if (is_numeric($category)) {
1079
- $select_category = " WHERE event_category = $category";
1080
- } else {
1081
- $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$category'");
1082
- $category_id = $cat->category_id;
1083
- if (!$category_id) {
1084
- //if the requested category doesn't exist, fail silently
1085
- $select_category = "";
1086
- } else {
1087
- $select_category = " WHERE event_category = $category_id";
1088
- }
1089
- }
1090
- }
1091
- } else {
1092
- $select_category = "";
1093
- }
1094
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . "$select_category");
1095
- $offset = get_option('gmt_offset');
1096
- $date = date('Y', time()+(60*60*$offset)).'-'.date('m', time()+(60*60*$offset)).'-'.date('d', time()+(60*60*$offset));
1097
- if (!empty($events)) {
1098
- foreach($events as $event) {
1099
- if ($event->event_recur != "S") {
1100
- $orig_begin = $event->event_begin;
1101
- $orig_end = $event->event_end;
1102
- $numback = 0;
1103
- $numforward = $event->event_repeats;
1104
- if ($event->event_repeats != 0) {
1105
- switch ($event->event_recur) {
1106
- case "D":
1107
- for ($i=$numback;$i<=$numforward;$i++) {
1108
- $begin = my_calendar_add_date($orig_begin,$i,0,0);
1109
- $end = my_calendar_add_date($orig_end,$i,0,0);
1110
- ${$i} = clone($event);
1111
- ${$i}->event_begin = $begin;
1112
- ${$i}->event_end = $end;
1113
- $arr_events[]=${$i};
1114
- }
1115
- break;
1116
- case "W":
1117
- for ($i=$numback;$i<=$numforward;$i++) {
1118
- $begin = my_calendar_add_date($orig_begin,($i*7),0,0);
1119
- $end = my_calendar_add_date($orig_end,($i*7),0,0);
1120
- ${$i} = clone($event);
1121
- ${$i}->event_begin = $begin;
1122
- ${$i}->event_end = $end;
1123
- $arr_events[]=${$i};
1124
- }
1125
- break;
1126
- case "B":
1127
- for ($i=$numback;$i<=$numforward;$i++) {
1128
- $begin = my_calendar_add_date($orig_begin,($i*14),0,0);
1129
- $end = my_calendar_add_date($orig_end,($i*14),0,0);
1130
- ${$i} = clone($event);
1131
- ${$i}->event_begin = $begin;
1132
- ${$i}->event_end = $end;
1133
- $arr_events[]=${$i};
1134
- }
1135
- break;
1136
- case "M":
1137
- for ($i=$numback;$i<=$numforward;$i++) {
1138
- $begin = my_calendar_add_date($orig_begin,0,$i,0);
1139
- $end = my_calendar_add_date($orig_end,0,$i,0);
1140
- ${$i} = clone($event);
1141
- ${$i}->event_begin = $begin;
1142
- ${$i}->event_end = $end;
1143
- $arr_events[]=${$i};
1144
- }
1145
- break;
1146
- case "Y":
1147
- for ($i=$numback;$i<=$numforward;$i++) {
1148
- $begin = my_calendar_add_date($orig_begin,0,0,$i);
1149
- $end = my_calendar_add_date($orig_end,0,0,$i);
1150
- ${$i} = clone($event);
1151
- ${$i}->event_begin = $begin;
1152
- ${$i}->event_end = $end;
1153
- $arr_events[]=${$i};
1154
- }
1155
- break;
1156
- }
1157
- } else {
1158
- switch ($event->event_recur) {
1159
- case "D":
1160
- $event_begin = $event->event_begin;
1161
- $today = date('Y',time()+(60*60*$offset)).'-'.date('m',time()+(60*60*$offset)).'-'.date('d',time()+(60*60*$offset));
1162
- $nDays = get_option('display_past_events');
1163
- $fDays = get_option('display_upcoming_events');
1164
- if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
1165
- if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays),0,0) )) {
1166
- $diff = jd_date_diff_precise(strtotime($event_begin));
1167
- $diff_days = $diff/(86400);
1168
- $days = explode(".",$diff_days);
1169
- $realStart = $days[0] - $nDays;
1170
- $realFinish = $days[0] + $fDays;
1171
-
1172
- for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
1173
- $this_date = my_calendar_add_date($event_begin,($realStart),0,0);
1174
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1175
- ${$realStart} = clone($event);
1176
- ${$realStart}->event_begin = $this_date;
1177
- $arr_events[] = ${$realStart};
1178
- }
1179
- }
1180
-
1181
- } else {
1182
- $realDays = -($nDays);
1183
- for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
1184
- $this_date = my_calendar_add_date($event_begin,$realDays,0,0);
1185
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) == true ) {
1186
- ${$realDays} = clone($event);
1187
- ${$realDays}->event_begin = $this_date;
1188
- $arr_events[] = ${$realDays};
1189
- }
1190
- }
1191
- }
1192
- } else {
1193
- break;
1194
- }
1195
- break;
1196
-
1197
- case "W":
1198
- $event_begin = $event->event_begin;
1199
- $today = date('Y',time()+(60*60*$offset)).'-'.date('m',time()+(60*60*$offset)).'-'.date('d',time()+(60*60*$offset));
1200
- $nDays = get_option('display_past_events');
1201
- $fDays = get_option('display_upcoming_events');
1202
-
1203
- if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
1204
- if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays*7),0,0) )) {
1205
- $diff = jd_date_diff_precise(strtotime($event_begin));
1206
- $diff_weeks = $diff/(86400*7);
1207
- $weeks = explode(".",$diff_weeks);
1208
- $realStart = $weeks[0] - $nDays;
1209
- $realFinish = $weeks[0] + $fDays;
1210
-
1211
- for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
1212
- $this_date = my_calendar_add_date($event_begin,($realStart*7),0,0);
1213
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1214
- ${$realStart} = clone($event);
1215
- ${$realStart}->event_begin = $this_date;
1216
- $arr_events[] = ${$realStart};
1217
- }
1218
- }
1219
-
1220
- } else {
1221
- $realDays = -($nDays);
1222
- for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
1223
- $this_date = my_calendar_add_date($event_begin,($realDays*7),0,0);
1224
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1225
- ${$realDays} = clone($event);
1226
- ${$realDays}->event_begin = $this_date;
1227
- $arr_events[] = ${$realDays};
1228
- }
1229
- }
1230
- }
1231
- } else {
1232
- break;
1233
- }
1234
- break;
1235
-
1236
- case "B":
1237
- $event_begin = $event->event_begin;
1238
- $today = date('Y',time()+(60*60*$offset)).'-'.date('m',time()+(60*60*$offset)).'-'.date('d',time()+(60*60*$offset));
1239
- $nDays = get_option('display_past_events');
1240
- $fDays = get_option('display_upcoming_events');
1241
-
1242
- if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
1243
- if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays*14),0,0) )) {
1244
- $diff = jd_date_diff_precise(strtotime($event_begin));
1245
- $diff_weeks = $diff/(86400*14);
1246
- $weeks = explode(".",$diff_weeks);
1247
- $realStart = $weeks[0] - $nDays;
1248
- $realFinish = $weeks[0] + $fDays;
1249
-
1250
- for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
1251
- $this_date = my_calendar_add_date($event_begin,($realStart*14),0,0);
1252
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1253
- ${$realStart} = clone($event);
1254
- ${$realStart}->event_begin = $this_date;
1255
- $arr_events[] = ${$realStart};
1256
- }
1257
- }
1258
-
1259
- } else {
1260
- $realDays = -($nDays);
1261
- for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
1262
- $this_date = my_calendar_add_date($event_begin,($realDays*14),0,0);
1263
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1264
- ${$realDays} = clone($event);
1265
- ${$realDays}->event_begin = $this_date;
1266
- $arr_events[] = ${$realDays};
1267
- }
1268
- }
1269
- }
1270
- } else {
1271
- break;
1272
- }
1273
- break;
1274
-
1275
- case "M":
1276
- $event_begin = $event->event_begin;
1277
- $today = date('Y',time()+(60*60*$offset)).'-'.date('m',time()+(60*60*$offset)).'-'.date('d',time()+(60*60*$offset));
1278
- $nDays = get_option('display_past_events');
1279
- $fDays = get_option('display_upcoming_events');
1280
-
1281
- if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
1282
- if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays),0,0) )) {
1283
- $diff = jd_date_diff_precise(strtotime($event_begin));
1284
- $diff_days = $diff/(86400*30);
1285
- $days = explode(".",$diff_days);
1286
- $realStart = $days[0] - $nDays;
1287
- $realFinish = $days[0] + $fDays;
1288
-
1289
- for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
1290
- $this_date = my_calendar_add_date($event_begin,0,$realStart,0);
1291
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1292
- ${$realStart} = clone($event);
1293
- ${$realStart}->event_begin = $this_date;
1294
- $arr_events[] = ${$realStart};
1295
- }
1296
- }
1297
-
1298
- } else {
1299
- $realDays = -($nDays);
1300
- for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
1301
- $this_date = my_calendar_add_date($event_begin,0,$realDays,0);
1302
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) == true ) {
1303
- ${$realDays} = clone($event);
1304
- ${$realDays}->event_begin = $this_date;
1305
- $arr_events[] = ${$realDays};
1306
- }
1307
- }
1308
- }
1309
- } else {
1310
- break;
1311
- }
1312
- break;
1313
-
1314
- case "Y":
1315
- $event_begin = $event->event_begin;
1316
- $today = date('Y',time()+(60*60*$offset)).'-'.date('m',time()+(60*60*$offset)).'-'.date('d',time()+(60*60*$offset));
1317
- $nDays = get_option('display_past_events');
1318
- $fDays = get_option('display_upcoming_events');
1319
-
1320
- if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
1321
- if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays),0,0) )) {
1322
- $diff = jd_date_diff_precise(strtotime($event_begin));
1323
- $diff_days = $diff/(86400*365);
1324
- $days = explode(".",$diff_days);
1325
- $realStart = $days[0] - $nDays;
1326
- $realFinish = $days[0] + $fDays;
1327
-
1328
- for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
1329
- $this_date = my_calendar_add_date($event_begin,0,0,$realStart);
1330
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1331
- ${$realStart} = clone($event);
1332
- ${$realStart}->event_begin = $this_date;
1333
- $arr_events[] = ${$realStart};
1334
- }
1335
- }
1336
-
1337
- } else {
1338
- $realDays = -($nDays);
1339
- for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
1340
- $this_date = my_calendar_add_date($event_begin,0,0,$realDays);
1341
- if ( my_calendar_date_comp( $event->event_begin,$this_date ) == true ) {
1342
- ${$realDays} = clone($event);
1343
- ${$realDays}->event_begin = $this_date;
1344
- $arr_events[] = ${$realDays};
1345
- }
1346
- }
1347
- }
1348
- } else {
1349
- break;
1350
- }
1351
- break;
1352
- }
1353
- }
1354
- } else {
1355
- $arr_events[]=$event;
1356
- }
1357
- }
1358
- }
1359
- return $arr_events;
1360
- }
1361
- // Grab all events for the requested date from calendar
1362
- function my_calendar_grab_events($y,$m,$d,$category=null) {
1363
-
1364
- if (!checkdate($m,$d,$y)) {
1365
- return;
1366
- }
1367
-
1368
- global $wpdb;
1369
-
1370
- if ( $category!=null ) {
1371
- if ( strpos( $category, "|" ) ) {
1372
- $categories = explode( "|", $category );
1373
- $numcat = count($categories);
1374
- $i = 1;
1375
- foreach ($categories as $key) {
1376
- if ( is_numeric($key) ) {
1377
- if ($i == 1) {
1378
- $select_category .= "(";
1379
- }
1380
- $select_category .= " event_category = $key";
1381
- if ($i < $numcat) {
1382
- $select_category .= " OR ";
1383
- } else if ($i == $numcat) {
1384
- $select_category .= ") AND";
1385
- }
1386
- $i++;
1387
- } else {
1388
- $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$key'");
1389
- $category_id = $cat->category_id;
1390
- if ($i == 1) {
1391
- $select_category .= "(";
1392
- }
1393
- $select_category .= " event_category = $category_id";
1394
- if ($i < $numcat) {
1395
- $select_category .= " OR ";
1396
- } else if ($i == $numcat) {
1397
- $select_category .= ") AND";
1398
- }
1399
- $i++;
1400
- }
1401
- }
1402
- } else {
1403
- if (is_numeric($category)) {
1404
- $select_category = "event_category = $category AND";
1405
- } else {
1406
- $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$category'");
1407
- $category_id = $cat->category_id;
1408
- if (!$category_id) {
1409
- //if the requested category doesn't exist, fail silently
1410
- $select_category = "";
1411
- } else {
1412
- $select_category = "event_category = $category_id AND";
1413
- }
1414
- }
1415
- }
1416
- }
1417
- $arr_events = array();
1418
-
1419
- // Get the date format right
1420
- $date = $y . '-' . $m . '-' . $d;
1421
-
1422
- // First we check for conventional events. These will form the first instance of a recurring event
1423
- // or the only instance of a one-off event
1424
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_begin <= '$date' AND event_end >= '$date' AND event_recur = 'S' ORDER BY event_id");
1425
- if (!empty($events)) {
1426
- foreach($events as $event) {
1427
- $arr_events[]=$event;
1428
- }
1429
- }
1430
-
1431
- // Deal with forever recurring year events
1432
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'Y' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin) AND event_repeats = 0 ORDER BY event_id");
1433
-
1434
- if (!empty($events)) {
1435
- foreach($events as $event) {
1436
- // Technically we don't care about the years, but we need to find out if the
1437
- // event spans the turn of a year so we can deal with it appropriately.
1438
- $year_begin = date('Y',strtotime($event->event_begin));
1439
- $year_end = date('Y',strtotime($event->event_end));
1440
-
1441
- if ($year_begin == $year_end) {
1442
- if (date('m-d',strtotime($event->event_begin)) <= date('m-d',strtotime($date)) &&
1443
- date('m-d',strtotime($event->event_end)) >= date('m-d',strtotime($date))) {
1444
- $arr_events[]=$event;
1445
- }
1446
- } else if ($year_begin < $year_end) {
1447
- if (date('m-d',strtotime($event->event_begin)) <= date('m-d',strtotime($date)) ||
1448
- date('m-d',strtotime($event->event_end)) >= date('m-d',strtotime($date))) {
1449
- $arr_events[]=$event;
1450
- }
1451
- }
1452
- }
1453
- }
1454
-
1455
- // Now the ones that happen a finite number of times
1456
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'Y' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin) AND event_repeats != 0 AND (EXTRACT(YEAR FROM '$date')-EXTRACT(YEAR FROM event_begin)) <= event_repeats ORDER BY event_id");
1457
- if (!empty($events)) {
1458
- foreach($events as $event) {
1459
- // Technically we don't care about the years, but we need to find out if the
1460
- // event spans the turn of a year so we can deal with it appropriately.
1461
- $year_begin = date('Y',strtotime($event->event_begin));
1462
- $year_end = date('Y',strtotime($event->event_end));
1463
-
1464
- if ($year_begin == $year_end) {
1465
- if (date('m-d',strtotime($event->event_begin)) <= date('m-d',strtotime($date)) &&
1466
- date('m-d',strtotime($event->event_end)) >= date('m-d',strtotime($date))) {
1467
- $arr_events[]=$event;
1468
- }
1469
- } else if ($year_begin < $year_end) {
1470
- if (date('m-d',strtotime($event->event_begin)) <= date('m-d',strtotime($date)) ||
1471
- date('m-d',strtotime($event->event_end)) >= date('m-d',strtotime($date))) {
1472
- $arr_events[]=$event;
1473
- }
1474
- }
1475
- }
1476
- }
1477
- // The monthly events that never stop recurring
1478
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'M' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin) AND event_repeats = 0 ORDER BY event_id");
1479
- if (!empty($events)) {
1480
- foreach($events as $event) {
1481
-
1482
- // Technically we don't care about the years or months, but we need to find out if the
1483
- // event spans the turn of a year or month so we can deal with it appropriately.
1484
- $month_begin = date('m',strtotime($event->event_begin));
1485
- $month_end = date('m',strtotime($event->event_end));
1486
-
1487
- if ($month_begin == $month_end) {
1488
- if (date('d',strtotime($event->event_begin)) <= date('d',strtotime($date)) &&
1489
- date('d',strtotime($event->event_end)) >= date('d',strtotime($date))) {
1490
- $arr_events[]=$event;
1491
- }
1492
- } else if ($month_begin < $month_end) {
1493
- if ( ($event->event_begin <= date('Y-m-d',strtotime($date))) && (date('d',strtotime($event->event_begin)) <= date('d',strtotime($date)) ||
1494
- date('d',strtotime($event->event_end)) >= date('d',strtotime($date))) ) {
1495
- $arr_events[]=$event;
1496
- }
1497
- }
1498
- }
1499
- }
1500
-
1501
- // Now the ones that happen a finite number of times
1502
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'M' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin) AND event_repeats != 0 AND (PERIOD_DIFF(EXTRACT(YEAR_MONTH FROM '$date'),EXTRACT(YEAR_MONTH FROM event_begin))) <= event_repeats ORDER BY event_id");
1503
- if (!empty($events)) {
1504
- foreach($events as $event) {
1505
-
1506
- // Technically we don't care about the years or months, but we need to find out if the
1507
- // event spans the turn of a year or month so we can deal with it appropriately.
1508
- $month_begin = date('m',strtotime($event->event_begin));
1509
- $month_end = date('m',strtotime($event->event_end));
1510
-
1511
- if ($month_begin == $month_end) {
1512
- if (date('d',strtotime($event->event_begin)) <= date('d',strtotime($date)) &&
1513
- date('d',strtotime($event->event_end)) >= date('d',strtotime($date))) {
1514
- $arr_events[]=$event;
1515
- }
1516
- } else if ($month_begin < $month_end) {
1517
- if ( ($event->event_begin <= date('Y-m-d',strtotime($date))) && (date('d',strtotime($event->event_begin)) <= date('d',strtotime($date)) ||
1518
- date('d',strtotime($event->event_end)) >= date('d',strtotime($date))) ) {
1519
- $arr_events[]=$event;
1520
- }
1521
- }
1522
- }
1523
- }
1524
-
1525
- //bi-weekly events
1526
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'B' AND '$date' >= event_begin AND event_repeats = 0 ORDER BY event_id");
1527
- if ( !empty( $events ) ) {
1528
- foreach( $events as $event ) {
1529
- // This is going to get complex so lets setup what we would place in for
1530
- // an event so we can drop it in with ease
1531
-
1532
- // Now we are going to check to see what day the original event
1533
- // fell on and see if the current date is both after it and on
1534
- // the correct day. If it is, display the event!
1535
- $day_start_event = date('D',strtotime($event->event_begin));
1536
- $day_end_event = date('D',strtotime($event->event_end));
1537
- $current_day = date('D',strtotime($date));
1538
- $current_date = date('Y-m-d',strtotime($date));
1539
- $start_date = $event->event_begin;
1540
-
1541
- $plan = array("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>7);
1542
-
1543
- for ($n=0;$n<=$event->event_repeats;$n++) {
1544
- if ( $current_date == my_calendar_add_date($start_date,(14*$n)) ) {
1545
- if ($plan[$day_start_event] > $plan[$day_end_event]) {
1546
- if (($plan[$day_start_event] <= $plan[$current_day]) || ($plan[$current_day] <= $plan[$day_end_event])) {
1547
- $arr_events[]=$event;
1548
- }
1549
- } else if (($plan[$day_start_event] < $plan[$day_end_event]) || ($plan[$day_start_event]== $plan[$day_end_event])) {
1550
- if (($plan[$day_start_event] <= $plan[$current_day]) && ($plan[$current_day] <= $plan[$day_end_event])) {
1551
- $arr_events[]=$event;
1552
- }
1553
- }
1554
- }
1555
- }
1556
-
1557
- }
1558
- }
1559
-
1560
- // The bi-weekly events that have a limit on how many times they occur
1561
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'B' AND '$date' >= event_begin AND event_repeats != 0 AND (event_repeats*14) >= (TO_DAYS('$date') - TO_DAYS(event_end)) ORDER BY event_id");
1562
- if (!empty($events)) {
1563
-
1564
- foreach($events as $event) {
1565
- // Now we are going to check to see what day the original event
1566
- // fell on and see if the current date is both after it and on
1567
- // the correct day. If it is, display the event!
1568
- $day_start_event = date('D',strtotime($event->event_begin));
1569
- $day_end_event = date('D',strtotime($event->event_end));
1570
- $current_day = date('D',strtotime($date));
1571
- $current_date = date('Y-m-d',strtotime($date));
1572
- $start_date = $event->event_begin;
1573
-
1574
- $plan = array("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>7);
1575
-
1576
- for ($n=0;$n<=$event->event_repeats;$n++) {
1577
- if ( $current_date == my_calendar_add_date($start_date,(14*$n)) ) {
1578
- if ($plan[$day_start_event] > $plan[$day_end_event]) {
1579
- if (($plan[$day_start_event] <= $plan[$current_day]) || ($plan[$current_day] <= $plan[$day_end_event])) {
1580
- $arr_events[]=$event;
1581
- }
1582
- } else if (($plan[$day_start_event] < $plan[$day_end_event]) || ($plan[$day_start_event]== $plan[$day_end_event])) {
1583
- if (($plan[$day_start_event] <= $plan[$current_day]) && ($plan[$current_day] <= $plan[$day_end_event])) {
1584
- $arr_events[]=$event;
1585
- }
1586
- }
1587
- }
1588
- }
1589
- }
1590
- }
1591
- /*
1592
- Weekly - well isn't this fun! We need to scan all weekly events, find what day they fell on
1593
- and see if that matches the current day. If it does, we check to see if the repeats are 0.
1594
- If they are, display the event, if not, we fast forward from the original day in week blocks
1595
- until the number is exhausted. If the date we arrive at is in the future, display the event.
1596
- */
1597
-
1598
- // The weekly events that never stop recurring
1599
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'W' AND '$date' >= event_begin AND event_repeats = 0 ORDER BY event_id");
1600
- if ( !empty( $events ) ) {
1601
- foreach( $events as $event ) {
1602
- // This is going to get complex so lets setup what we would place in for
1603
- // an event so we can drop it in with ease
1604
-
1605
- // Now we are going to check to see what day the original event
1606
- // fell on and see if the current date is both after it and on
1607
- // the correct day. If it is, display the event!
1608
- $day_start_event = date('D',strtotime($event->event_begin));
1609
- $day_end_event = date('D',strtotime($event->event_end));
1610
- $current_day = date('D',strtotime($date));
1611
-
1612
- $plan = array("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>7);
1613
-
1614
- if ($plan[$day_start_event] > $plan[$day_end_event]) {
1615
- if (($plan[$day_start_event] <= $plan[$current_day]) || ($plan[$current_day] <= $plan[$day_end_event])) {
1616
- $arr_events[]=$event;
1617
- }
1618
- } else if (($plan[$day_start_event] < $plan[$day_end_event]) || ($plan[$day_start_event]== $plan[$day_end_event])) {
1619
- if (($plan[$day_start_event] <= $plan[$current_day]) && ($plan[$current_day] <= $plan[$day_end_event])) {
1620
- $arr_events[]=$event;
1621
- }
1622
- }
1623
-
1624
- }
1625
- }
1626
-
1627
- // The weekly events that have a limit on how many times they occur
1628
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'W' AND '$date' >= event_begin AND event_repeats != 0 AND (event_repeats*7) >= (TO_DAYS('$date') - TO_DAYS(event_end)) ORDER BY event_id");
1629
- if (!empty($events)) {
1630
- foreach($events as $event) {
1631
-
1632
- // Now we are going to check to see what day the original event
1633
- // fell on and see if the current date is both after it and on
1634
- // the correct day. If it is, display the event!
1635
- $day_start_event = date('D',strtotime($event->event_begin));
1636
- $day_end_event = date('D',strtotime($event->event_end));
1637
- $current_day = date('D',strtotime($date));
1638
-
1639
- $plan = array("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>7);
1640
-
1641
- if ($plan[$day_start_event] > $plan[$day_end_event]) {
1642
- if (($plan[$day_start_event] <= $plan[$current_day]) || ($plan[$current_day] <= $plan[$day_end_event])) {
1643
- $arr_events[]=$event;
1644
- }
1645
- } else if (($plan[$day_start_event] < $plan[$day_end_event]) || ($plan[$day_start_event]== $plan[$day_end_event])) {
1646
- if (($plan[$day_start_event] <= $plan[$current_day]) && ($plan[$current_day] <= $plan[$day_end_event])) {
1647
- $arr_events[]=$event;
1648
- }
1649
- }
1650
-
1651
- }
1652
- }
1653
-
1654
-
1655
- // The daily events that never stop recurring
1656
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'D' AND '$date' >= event_begin AND event_repeats = 0 ORDER BY event_id");
1657
- if (!empty($events)) {
1658
- foreach($events as $event) {
1659
- // checking events which recur by day is easy: just shove 'em all in there!
1660
- $arr_events[]=$event;
1661
- }
1662
- }
1663
-
1664
- // The daily events that have a limit on how many times they occur
1665
- $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'D' AND '$date' >= event_begin AND event_repeats != 0 AND (event_repeats) >= (TO_DAYS('$date') - TO_DAYS(event_end)) ORDER BY event_id");
1666
- if (!empty($events)) {
1667
- foreach($events as $event) {
1668
- // checking events which recur by day is easy: just shove 'em all in there!
1669
- $arr_events[]=$event;
1670
- }
1671
- }
1672
- // end daily events
1673
- return $arr_events;
1674
- }
1675
-
1676
- function mc_month_comparison($month) {
1677
- $offset = get_option('gmt_offset');
1678
- $current_month = strtolower(date("M", time()+(60*60*$offset)));
1679
- if (isset($_GET['yr']) && isset($_GET['month'])) {
1680
- if ($month == $_GET['month']) {
1681
- return ' selected="selected"';
1682
- }
1683
- } elseif ($month == $current_month) {
1684
- return ' selected="selected"';
1685
- }
1686
- }
1687
-
1688
- function mc_year_comparison($year) {
1689
- $offset = get_option('gmt_offset');
1690
- $current_year = strtolower(date("Y", time()+(60*60*$offset)));
1691
- if (isset($_GET['yr']) && isset($_GET['month'])) {
1692
- if ($year == $_GET['yr']) {
1693
- return ' selected="selected"';
1694
- }
1695
- } else if ($year == $current_year) {
1696
- return ' selected="selected"';
1697
- }
1698
- }
1699
- function mc_build_date_switcher() {
1700
- $my_calendar_body = "";
1701
- $my_calendar_body .= '<div class="my-calendar-date-switcher">
1702
- <form method="get" action=""><div>';
1703
- $qsa = array();
1704
- parse_str($_SERVER['QUERY_STRING'],$qsa);
1705
- foreach ($qsa as $name => $argument) {
1706
- if ($name != 'month' && $name != 'yr') {
1707
- $my_calendar_body .= '<input type="hidden" name="'.$name.'" value="'.$argument.'" />';
1708
- }
1709
- }
1710
- // We build the months in the switcher
1711
- $my_calendar_body .= '
1712
- <label for="my-calendar-month">'.__('Month','my-calendar').':</label> <select id="my-calendar-month" name="month" style="width:100px;">
1713
- <option value="jan"'.mc_month_comparison('jan').'>'.__('January','my-calendar').'</option>
1714
- <option value="feb"'.mc_month_comparison('feb').'>'.__('February','my-calendar').'</option>
1715
- <option value="mar"'.mc_month_comparison('mar').'>'.__('March','my-calendar').'</option>
1716
- <option value="apr"'.mc_month_comparison('apr').'>'.__('April','my-calendar').'</option>
1717
- <option value="may"'.mc_month_comparison('may').'>'.__('May','my-calendar').'</option>
1718
- <option value="jun"'.mc_month_comparison('jun').'>'.__('June','my-calendar').'</option>
1719
- <option value="jul"'.mc_month_comparison('jul').'>'.__('July','my-calendar').'</option>
1720
- <option value="aug"'.mc_month_comparison('aug').'>'.__('August','my-calendar').'</option>
1721
- <option value="sept"'.mc_month_comparison('sept').'>'.__('September','my-calendar').'</option>
1722
- <option value="oct"'.mc_month_comparison('oct').'>'.__('October','my-calendar').'</option>
1723
- <option value="nov"'.mc_month_comparison('nov').'>'.__('November','my-calendar').'</option>
1724
- <option value="dec"'.mc_month_comparison('dec').'>'.__('December','my-calendar').'</option>
1725
- </select>
1726
- <label for="my-calendar-year">'.__('Year','my-calendar').':</label> <select id="my-calendar-year" name="yr">
1727
- ';
1728
- // The year builder is string mania. If you can make sense of this, you know your PHP!
1729
- $past = 5;
1730
- $future = 5;
1731
- $fut = 1;
1732
- $offset = get_option('gmt_offset');
1733
-
1734
- while ($past > 0) {
1735
- $p .= ' <option value="';
1736
- $p .= date("Y",time()+(60*60*$offset))-$past;
1737
- $p .= '"'.mc_year_comparison(date("Y",time()+(60*60*$offset))-$past).'>';
1738
- $p .= date("Y",time()+(60*60*$offset))-$past."</option>\n";
1739
- $past = $past - 1;
1740
- }
1741
- while ($fut < $future) {
1742
- $f .= ' <option value="';
1743
- $f .= date("Y",time()+(60*60*$offset))+$fut;
1744
- $f .= '"'.mc_year_comparison(date("Y",time()+(60*60*$offset))+$fut).'>';
1745
- $f .= date("Y",time()+(60*60*$offset))+$fut."</option>\n";
1746
- $fut = $fut + 1;
1747
- }
1748
- $my_calendar_body .= $p;
1749
- $my_calendar_body .= '<option value="'.date("Y",time()+(60*60*$offset)).'"'.mc_year_comparison(date("Y",time()+(60*60*$offset))).'>'.date("Y",time()+(60*60*$offset))."</option>\n";
1750
- $my_calendar_body .= $f;
1751
- $my_calendar_body .= '</select> <input type="submit" value="'.__('Go','my-calendar').'" /></div>
1752
- </form></div>';
1753
- return $my_calendar_body;
1754
- }
1755
-
1756
- // Actually do the printing of the calendar
1757
- // Compared to searching for and displaying events
1758
- // this bit is really rather easy!
1759
- function my_calendar($name,$format,$category,$showkey) {
1760
- global $wpdb;
1761
- if ($category == "") {
1762
- $category=null;
1763
- }
1764
- // First things first, make sure calendar is up to date
1765
- check_my_calendar();
1766
-
1767
- // Deal with the week not starting on a monday
1768
- if (get_option('start_of_week') == 0) {
1769
- $name_days = array(1=>__('<abbr title="Sunday">Sun</abbr>','my-calendar'),__('<abbr title="Monday">Mon</abbr>','my-calendar'),__('<abbr title="Tuesday">Tues</abbr>','my-calendar'),__('<abbr title="Wednesday">Wed</abbr>','my-calendar'),__('<abbr title="Thursday">Thur</abbr>','my-calendar'),__('<abbr title="Friday">Fri</abbr>','my-calendar'),__('<abbr title="Saturday">Sat</abbr>','my-calendar'));
1770
- } else {
1771
- // Choose Monday if anything other than Sunday is set
1772
- $name_days = array(1=>__('<abbr title="Monday">Mon</abbr>','my-calendar'),__('<abbr title="Tuesday">Tues</abbr>','my-calendar'),__('<abbr title="Wednesday">Wed</abbr>','my-calendar'),__('<abbr title="Thursday">Thur</abbr>','my-calendar'),__('<abbr title="Friday">Fri</abbr>','my-calendar'),__('<abbr title="Saturday">Sat</abbr>','my-calendar'),__('<abbr title="Sunday">Sun</abbr>','my-calendar'));
1773
- }
1774
-
1775
- // Carry on with the script
1776
- $name_months = array(1=>__('January','my-calendar'),__('February','my-calendar'),__('March','my-calendar'),__('April','my-calendar'),__('May','my-calendar'),__('June','my-calendar'),__('July','my-calendar'),__('August','my-calendar'),__('September','my-calendar'),__('October','my-calendar'),__('November','my-calendar'),__('December','my-calendar'));
1777
- $offset = get_option('gmt_offset');
1778
-
1779
- // If we don't pass arguments we want a calendar that is relevant to today
1780
- if (empty($_GET['month']) || empty($_GET['yr'])) {
1781
- $c_year = date("Y",time()+(60*60*$offset));
1782
- $c_month = date("m",time()+(60*60*$offset));
1783
- $c_day = date("d",time()+(60*60*$offset));
1784
- }
1785
-
1786
- // Years get funny if we exceed 3000, so we use this check
1787
- if ($_GET['yr'] <= 3000 && $_GET['yr'] >= 0) {
1788
- // This is just plain nasty and all because of permalinks
1789
- // which are no longer used, this will be cleaned up soon
1790
- if ($_GET['month'] == 'jan' || $_GET['month'] == 'feb' || $_GET['month'] == 'mar' || $_GET['month'] == 'apr' || $_GET['month'] == 'may' || $_GET['month'] == 'jun' || $_GET['month'] == 'jul' || $_GET['month'] == 'aug' || $_GET['month'] == 'sept' || $_GET['month'] == 'oct' || $_GET['month'] == 'nov' || $_GET['month'] == 'dec') {
1791
- // Again nasty code to map permalinks into something
1792
- // databases can understand. This will be cleaned up
1793
- $c_year = mysql_real_escape_string($_GET['yr']);
1794
- if ($_GET['month'] == 'jan') { $t_month = 1; }
1795
- else if ($_GET['month'] == 'feb') { $t_month = 2; }
1796
- else if ($_GET['month'] == 'mar') { $t_month = 3; }
1797
- else if ($_GET['month'] == 'apr') { $t_month = 4; }
1798
- else if ($_GET['month'] == 'may') { $t_month = 5; }
1799
- else if ($_GET['month'] == 'jun') { $t_month = 6; }
1800
- else if ($_GET['month'] == 'jul') { $t_month = 7; }
1801
- else if ($_GET['month'] == 'aug') { $t_month = 8; }
1802
- else if ($_GET['month'] == 'sept') { $t_month = 9; }
1803
- else if ($_GET['month'] == 'oct') { $t_month = 10; }
1804
- else if ($_GET['month'] == 'nov') { $t_month = 11; }
1805
- else if ($_GET['month'] == 'dec') { $t_month = 12; }
1806
- $c_month = $t_month;
1807
- $c_day = date("d",time()+(60*60*$offset));
1808
- } else {
1809
- // No valid month causes the calendar to default to today
1810
- $c_year = date("Y",time()+(60*60*$offset));
1811
- $c_month = date("m",time()+(60*60*$offset));
1812
- $c_day = date("d",time()+(60*60*$offset));
1813
- }
1814
- } else {
1815
- // No valid year causes the calendar to default to today
1816
- $c_year = date("Y",time()+(60*60*$offset));
1817
- $c_month = date("m",time()+(60*60*$offset));
1818
- $c_day = date("d",time()+(60*60*$offset));
1819
- }
1820
-
1821
- // Fix the days of the week if week start is not on a monday
1822
- if (get_option('start_of_week') == 0) {
1823
- $first_weekday = date("w",mktime(0,0,0,$c_month,1,$c_year));
1824
- $first_weekday = ($first_weekday==0?1:$first_weekday+1);
1825
- } else {
1826
- $first_weekday = date("w",mktime(0,0,0,$c_month,1,$c_year));
1827
- $first_weekday = ($first_weekday==0?7:$first_weekday);
1828
- }
1829
-
1830
- $days_in_month = date("t", mktime (0,0,0,$c_month,1,$c_year));
1831
- $and = __("and",'my-calendar');
1832
- if ($category != "" && $category != "all") {
1833
- $category_label = str_replace("|"," $and ",$category) . ' ';
1834
- } else {
1835
- $category_label = "";
1836
- }
1837
- // Start the calendar and add header and navigation
1838
- $my_calendar_body .= "<div id=\"jd-calendar\">";
1839
- // Add the calendar table and heading
1840
- $caption_text = stripslashes( get_option('my_calendar_caption') );
1841
-
1842
- if ($format == "calendar") {
1843
- $my_calendar_body .= '<div class="my-calendar-header">';
1844
-
1845
- // We want to know if we should display the date switcher
1846
- $date_switcher = get_option('display_jump');
1847
-
1848
- if ($date_switcher == 'true') {
1849
- $my_calendar_body .= mc_build_date_switcher();
1850
- }
1851
- // The header of the calendar table and the links. Note calls to link functions
1852
- $my_calendar_body .= '
1853
- <div class="my-calendar-nav">
1854
- <ul>
1855
- <li class="my-calendar-prev">' . my_calendar_prev_link($c_year,$c_month,$format) . '</li>
1856
- <li class="my-calendar-next">' . my_calendar_next_link($c_year,$c_month,$format) . '</li>
1857
- </ul>
1858
- </div>
1859
- </div>';
1860
- $my_calendar_body .= "\n<table class=\"my-calendar-table\" summary=\"$category_label".__('Calendar','my-calendar')."\">\n";
1861
- $my_calendar_body .= '<caption class="my-calendar-month">'.$name_months[(int)$c_month].' '.$c_year.$caption_text."</caption>\n";
1862
- } else {
1863
- if ( get_option('my_calendar_show_heading') == 'true' ) {
1864
- $my_calendar_body .= "\n<h2 class=\"my-calendar-heading\">$category_label".__('Calendar','my-calendar')."</h2>\n";
1865
- }
1866
- $num_months = get_option('my_calendar_show_months');
1867
- if ($num_months <= 1) {
1868
- $my_calendar_body .= '<h3 class="my-calendar-month">'.__('Events in','my-calendar').' '.$name_months[(int)$c_month].' '.$c_year.$caption_text."</h3>\n";
1869
- } else {
1870
- $my_calendar_body .= '<h3 class="my-calendar-month">'.$name_months[(int)$c_month].'&thinsp;&ndash;&thinsp;'.$name_months[(int)$c_month+$num_months-1].' '.$c_year.$caption_text."</h3>\n";
1871
- }
1872
- $my_calendar_body .= '<div class="my-calendar-header">';
1873
-
1874
- // We want to know if we should display the date switcher
1875
- $date_switcher = get_option('display_jump');
1876
-
1877
- if ($date_switcher == 'true') {
1878
- $my_calendar_body .= mc_build_date_switcher();
1879
- }
1880
-
1881
- // The header of the calendar table and the links. Note calls to link functions
1882
- $my_calendar_body .= '
1883
- <div class="my-calendar-nav">
1884
- <ul>
1885
- <li class="my-calendar-prev">' . my_calendar_prev_link($c_year,$c_month,$format) . '</li>
1886
- <li class="my-calendar-next">' . my_calendar_next_link($c_year,$c_month,$format) . '</li>
1887
- </ul>
1888
- </div>
1889
- </div>';
1890
- }
1891
- // If in calendar format, print the headings of the days of the week
1892
- //$my_calendar_body .= "$format, $category, $name";
1893
- if ($format == "calendar") {
1894
- $my_calendar_body .= "<thead>\n<tr>\n";
1895
- for ($i=1; $i<=7; $i++) {
1896
- // Colors need to be different if the starting day of the week is different
1897
-
1898
- if (get_option('start_of_week') == 0) {
1899
- $my_calendar_body .= '<th scope="col" class="'.($i<7&&$i>1?'day-heading':'weekend-heading').'">'.$name_days[$i]."</th>\n";
1900
- } else {
1901
- $my_calendar_body .= '<th scope="col" class="'.($i<6?'day-heading':'weekend-heading').'">'.$name_days[$i]."</th>\n";
1902
- }
1903
- }
1904
- $my_calendar_body .= "</tr>\n</thead>\n<tbody>";
1905
-
1906
- for ($i=1; $i<=$days_in_month;) {
1907
- $my_calendar_body .= '<tr>';
1908
- for ($ii=1; $ii<=7; $ii++) {
1909
- if ($ii==$first_weekday && $i==1) {
1910
- $go = TRUE;
1911
- } elseif ($i > $days_in_month ) {
1912
- $go = FALSE;
1913
- }
1914
-
1915
- if ($go) {
1916
- // Colors again, this time for the day numbers
1917
- if (get_option('start_of_week') == 0) {
1918
- // This bit of code is for styles believe it or not.
1919
- $grabbed_events = my_calendar_grab_events($c_year,$c_month,$i,$category);
1920
- $no_events_class = '';
1921
- if (!count($grabbed_events)) {
1922
- $no_events_class = ' no-events';
1923
- }
1924
- $my_calendar_body .= '<td class="'.(date("Ymd", mktime (0,0,0,$c_month,$i,$c_year))==date("Ymd",time()+(60*60*$offset))?'current-day':'day-with-date').$no_events_class.'">'."\n ".'<span'.($ii<7&&$ii>1?'':' class="weekend"').'>'.$i++.'</span>'."\n ". my_calendar_draw_events($grabbed_events, $format) . "\n</td>\n";
1925
- } else {
1926
- $grabbed_events = my_calendar_grab_events($c_year,$c_month,$i,$category);
1927
- $no_events_class = '';
1928
- if (!count($grabbed_events))
1929
- {
1930
- $no_events_class = ' no-events';
1931
- }
1932
- $my_calendar_body .= '<td class="'.(date("Ymd", mktime (0,0,0,$c_month,$i,$c_year))==date("Ymd",time()+(60*60*$offset))?'current-day':'day-with-date').$no_events_class.'">'."\n ".'<span'.($ii<6?'':' class="weekend"').'>'.$i++.'</span>'."\n ". my_calendar_draw_events($grabbed_events, $format) . "\n</td>\n";
1933
- }
1934
- } else {
1935
- $my_calendar_body .= "<td class='day-without-date'>&nbsp;</td>\n";
1936
- }
1937
- }
1938
- $my_calendar_body .= "</tr>";
1939
- }
1940
- $my_calendar_body .= "\n</tbody>\n</table>";
1941
- } else if ($format == "list") {
1942
- $my_calendar_body .= "<ul id=\"calendar-list\">";
1943
- // show calendar as list
1944
- $date_format = get_option('my_calendar_date_format');
1945
- if ($date_format == "") {
1946
- $date_format = "l, F j, Y";
1947
- }
1948
- $num_months = get_option('my_calendar_show_months');
1949
- $num_events = 0;
1950
- for ($m=0;$m<$num_months;$m++) {
1951
- if ($m == 0) {
1952
- $add_month = 0;
1953
- } else {
1954
- $add_month = 1;
1955
- }
1956
- $c_month = (int) $c_month + $add_month;
1957
- for ($i=1; $i<=31; $i++) {
1958
- $grabbed_events = my_calendar_grab_events($c_year,$c_month,$i,$category);
1959
- if (count($grabbed_events)) {
1960
- if ( get_option('list_javascript') != 1) {
1961
- $is_anchor = "<a href='#'>";
1962
- $is_close_anchor = "</a>";
1963
- } else {
1964
- $is_anchor = $is_close_anchor = "";
1965
- }
1966
- $my_calendar_body .= "<li class='$class".(date("Ymd", mktime (0,0,0,$c_month,$i,$c_year))==date("Ymd",time()+(60*60*$offset))?' current-day':'')."'><strong class=\"event-date\">$is_anchor".date_i18n($date_format,mktime(0,0,0,$c_month,$i,$c_year))."$is_close_anchor</strong>".my_calendar_draw_events($grabbed_events, $format)."</li>";
1967
- $num_events++;
1968
- }
1969
- if (my_calendar_is_odd($num_events)) {
1970
- $class = "odd";
1971
- } else {
1972
- $class = "even";
1973
- }
1974
- }
1975
- }
1976
- if ($num_events == 0) {
1977
- $my_calendar_body .= "<li class='no-events'>".__('There are no events scheduled during this period.','my-calendar') . "</li>";
1978
- }
1979
- $my_calendar_body .= "</ul>";
1980
- } else {
1981
- $my_calendar_body .= "Unrecognized calendar format.";
1982
- }
1983
- if ($showkey != 'no') {
1984
- $sql = "SELECT * FROM " . MY_CALENDAR_CATEGORIES_TABLE . " ORDER BY category_name ASC";
1985
- $cat_details = $wpdb->get_results($sql);
1986
- $my_calendar_body .= '<div class="category-key">
1987
- <h3>'.__('Category Key','my-calendar')."</h3>\n<ul>\n";
1988
-
1989
- if ( file_exists( WP_PLUGIN_DIR . '/my-calendar-custom/' ) ) {
1990
- $path = '/my-calendar-custom';
1991
- } else {
1992
- $path = '/my-calendar/icons';
1993
- }
1994
- foreach($cat_details as $cat_detail) {
1995
-
1996
- if ($cat_detail->category_icon != "" && get_option('my_calendar_hide_icons')!='true') {
1997
- $my_calendar_body .= '<li><span class="category-color-sample"><img src="'.WP_PLUGIN_URL.$path.'/'.$cat_detail->category_icon.'" alt="" style="background:'.$cat_detail->category_color.';" /></span>'.$cat_detail->category_name."</li>\n";
1998
- } else {
1999
- $my_calendar_body .= '<li><span class="category-color-sample no-icon" style="background:'.$cat_detail->category_color.';"> &nbsp; </span>'.$cat_detail->category_name."</li>\n";
2000
- }
2001
- }
2002
- $my_calendar_body .= "</ul>\n</div>";
2003
- }
2004
- $my_calendar_body .= "\n</div>";
2005
- // The actual printing is done by the shortcode function.
2006
- return $my_calendar_body;
2007
- }
2008
-
2009
- function my_calendar_is_odd( $int ) {
2010
- return( $int & 1 );
2011
- }
2012
-
2013
-
2014
- function mc_can_edit_event($author_id) {
2015
- global $user_ID;
2016
- get_currentuserinfo();
2017
- $user = get_userdata($user_ID);
2018
-
2019
- if ( current_user_can('create_users') ) {
2020
- return true;
2021
- } elseif ( $user_ID == $author_id ) {
2022
- return true;
2023
- } else {
2024
- return false;
2025
- }
2026
- }
2027
-
2028
- // compatibility of clone keyword between PHP 5 and 4
2029
- if (version_compare(phpversion(), '5.0') < 0) {
2030
- eval('
2031
- function clone($object) {
2032
- return $object;
2033
- }
2034
- ');
2035
- }
2036
-
2037
-
2038
  ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: My Calendar
4
+ Plugin URI: http://www.joedolson.com/articles/my-calendar/
5
+ Description: Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
6
+ Author: Joseph C Dolson
7
+ Author URI: http://www.joedolson.com
8
+ Version: 1.4.0
9
+ */
10
+ /* Copyright 2009 Joe Dolson (email : joe@joedolson.com)
11
+
12
+ This program is free software; you can redistribute it and/or modify
13
+ it under the terms of the GNU General Public License as published by
14
+ the Free Software Foundation; either version 2 of the License, or
15
+ (at your option) any later version.
16
+
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+
22
+ You should have received a copy of the GNU General Public License
23
+ along with this program; if not, write to the Free Software
24
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
+
27
+ // Enable internationalisation
28
+ $plugin_dir = basename(dirname(__FILE__));
29
+ load_plugin_textdomain( 'my-calendar','wp-content/plugins/'.$plugin_dir, $plugin_dir);
30
+ global $wpdb;
31
+ // Define the tables used in My Calendar
32
+ define('MY_CALENDAR_TABLE', $wpdb->prefix . 'my_calendar');
33
+ define('MY_CALENDAR_CATEGORIES_TABLE', $wpdb->prefix . 'my_calendar_categories');
34
+ define('MY_CALENDAR_LOCATIONS_TABLE', $wpdb->prefix . 'my_calendar_locations');
35
+
36
+ // Create a master category for My Calendar and its sub-pages
37
+ add_action('admin_menu', 'my_calendar_menu');
38
+ // Add the function that puts style information in the header
39
+ add_action('wp_head', 'my_calendar_wp_head');
40
+ // Add the function that deals with deleted users
41
+ add_action('delete_user', 'mc_deal_with_deleted_user');
42
+ // Add the widgets if we are using version 2.8
43
+ add_action('widgets_init', 'init_my_calendar_today');
44
+ add_action('widgets_init', 'init_my_calendar_upcoming');
45
+
46
+ register_activation_hook( __FILE__, 'check_my_calendar' );
47
+ // add filters to text widgets which will process shortcodes
48
+ add_filter( 'widget_text', 'do_shortcode', 9 );
49
+
50
+ function jd_calendar_plugin_action($links, $file) {
51
+ if ($file == plugin_basename(dirname(__FILE__).'/my-calendar.php'))
52
+ $links[] = "<a href='admin.php?page=my-calendar-config'>" . __('Settings', 'my-calendar') . "</a>";
53
+ $links[] = "<a href='admin.php?page=my-calendar-help'>" . __('Help', 'my-calendar') . "</a>";
54
+ return $links;
55
+ }
56
+ add_filter('plugin_action_links', 'jd_calendar_plugin_action', -10, 2);
57
+
58
+ include(dirname(__FILE__).'/my-calendar-settings.php' );
59
+ include(dirname(__FILE__).'/my-calendar-categories.php' );
60
+ include(dirname(__FILE__).'/my-calendar-locations.php' );
61
+ include(dirname(__FILE__).'/my-calendar-help.php' );
62
+ include(dirname(__FILE__).'/my-calendar-event-manager.php' );
63
+ include(dirname(__FILE__).'/my-calendar-styles.php' );
64
+ include(dirname(__FILE__).'/my-calendar-widgets.php' );
65
+ include(dirname(__FILE__).'/date-utilities.php' );
66
+ include(dirname(__FILE__).'/my-calendar-install.php' );
67
+
68
+
69
+ // Before we get on with the functions, we need to define the initial style used for My Calendar
70
+
71
+ function jd_show_support_box() {
72
+ ?>
73
+ <div class="resources">
74
+ <ul>
75
+ <li><a href="http://www.joedolson.com/articles/my-calendar/"><?php _e("Get Support",'my-calendar'); ?></a></li>
76
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=my-calendar-help"><?php _e("My Calendar Help",'my-calendar'); ?></a></li>
77
+ <li><a href="http://www.joedolson.com/donate.php"><?php _e("Make a Donation",'my-calendar'); ?></a></li>
78
+ <li><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
79
+ <div>
80
+ <input type="hidden" name="cmd" value="_s-xclick" />
81
+ <input type="hidden" name="hosted_button_id" value="8490399" />
82
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate" />
83
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
84
+ </div>
85
+ </form></li>
86
+ </ul>
87
+
88
+ </div>
89
+ <?php
90
+ }
91
+
92
+ // Function to deal with events posted by a user when that user is deleted
93
+ function mc_deal_with_deleted_user($id) {
94
+ global $wpdb;
95
+ // This wouldn't work unless the database was up to date. Lets check.
96
+ check_my_calendar();
97
+ // Do the query
98
+ $wpdb->get_results( "UPDATE ".MY_CALENDAR_TABLE." SET event_author=".$wpdb->get_var("SELECT MIN(ID) FROM ".$wpdb->prefix."users",0,0)." WHERE event_author=".$id );
99
+ }
100
+
101
+ // Function to add the calendar style into the header
102
+ function my_calendar_wp_head() {
103
+ global $wpdb, $wp_query;
104
+ // If the calendar isn't installed or upgraded this won't work
105
+ check_my_calendar();
106
+ $styles = stripcslashes(get_option('my_calendar_style'));
107
+ if ( get_option('my_calendar_use_styles') != 'true' ) {
108
+
109
+ $this_post = $wp_query->get_queried_object();
110
+ if (is_object($this_post)) {
111
+ $id = $this_post->ID;
112
+ }
113
+ if ( get_option( 'my_calendar_show_css' ) != '' ) {
114
+ $array = explode( ",",get_option( 'my_calendar_show_css' ) );
115
+ if (!is_array($array)) {
116
+ $array = array();
117
+ }
118
+ }
119
+ if ( @in_array( $id, $array ) || get_option( 'my_calendar_show_css' ) == '' ) {
120
+
121
+ // generate category colors
122
+ $categories = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_CATEGORIES_TABLE . " ORDER BY category_id ASC");
123
+ foreach ( $categories as $category ) {
124
+ $class = sanitize_title($category->category_name);
125
+ $color = $category->category_color;
126
+ if ( get_option( 'mc_apply_color' ) == 'font' ) {
127
+ $type = 'color';
128
+ } else if ( get_option( 'mc_apply_color' ) == 'background' ) {
129
+ $type = 'background';
130
+ }
131
+ $category_styles .= "\n#jd-calendar .$class { $type: $color; }";
132
+ }
133
+
134
+ echo "
135
+ <style type=\"text/css\">
136
+ <!--
137
+ // Styles from My Calendar - Joseph C Dolson http://www.joedolson.com/
138
+ $styles
139
+
140
+ $category_styles
141
+ -->
142
+ </style>";
143
+
144
+ }
145
+ }
146
+ }
147
+
148
+ // Function to deal with adding the calendar menus
149
+ function my_calendar_menu() {
150
+ global $wpdb;
151
+ // We make use of the My Calendar tables so we must have installed My Calendar
152
+ check_my_calendar();
153
+ // Set admin as the only one who can use My Calendar for security
154
+ $allowed_group = 'manage_options';
155
+ // Use the database to *potentially* override the above if allowed
156
+ $allowed_group = get_option('can_manage_events');
157
+
158
+
159
+ // Add the admin panel pages for My Calendar. Use permissions pulled from above
160
+ if (function_exists('add_menu_page')) {
161
+ add_menu_page(__('My Calendar','my-calendar'), __('My Calendar','my-calendar'), $allowed_group, 'my-calendar', 'edit_my_calendar');
162
+ }
163
+ if (function_exists('add_submenu_page')) {
164
+ add_submenu_page('my-calendar', __('Add/Edit Events','my-calendar'), __('Add/Edit Events','my-calendar'), $allowed_group, 'my-calendar', 'edit_my_calendar');
165
+ add_action( "admin_head", 'my_calendar_write_js' );
166
+ add_action( "admin_head", 'my_calendar_add_styles' );
167
+ // Note only admin can change calendar options
168
+ add_submenu_page('my-calendar', __('Manage Categories','my-calendar'), __('Manage Categories','my-calendar'), 'manage_options', 'my-calendar-categories', 'my_calendar_manage_categories');
169
+ add_submenu_page('my-calendar', __('Manage Locations','my-calendar'), __('Manage Locations','my-calendar'), 'manage_options', 'my-calendar-locations', 'my_calendar_manage_locations');
170
+ add_submenu_page('my-calendar', __('Settings','my-calendar'), __('Settings','my-calendar'), 'manage_options', 'my-calendar-config', 'edit_my_calendar_config');
171
+ add_submenu_page('my-calendar', __('Style Editor','my-calendar'), __('Style Editor','my-calendar'), 'manage_options', 'my-calendar-styles', 'edit_my_calendar_styles');
172
+ add_submenu_page('my-calendar', __('My Calendar Help','my-calendar'), __('Help','my-calendar'), 'manage_options', 'my-calendar-help', 'my_calendar_help');
173
+ }
174
+ }
175
+ add_action( "admin_menu", 'my_calendar_add_javascript' );
176
+
177
+ // Function to add the javascript to the admin header
178
+ function my_calendar_add_javascript() {
179
+ if ($_GET['page'] == 'my-calendar') {
180
+ wp_enqueue_script('jquery-ui-datepicker',WP_PLUGIN_URL . '/my-calendar/js/ui.datepicker.js', array('jquery','jquery-ui-core') );
181
+ }
182
+ if ($_GET['page'] == 'my-calendar-categories') {
183
+ wp_enqueue_script('jquery-colorpicker',WP_PLUGIN_URL . '/my-calendar/js/jquery-colorpicker.js', array('jquery') );
184
+ }
185
+ }
186
+ function my_calendar_write_js() {
187
+ if ($_GET['page']=='my-calendar') {
188
+ echo '
189
+ <script type="text/javascript">
190
+ //<![CDATA[
191
+ jQuery(document).ready(function($) {
192
+ $("#event_begin").datepicker({
193
+ numberOfMonths: 2,
194
+ dateFormat: "yy-mm-dd"
195
+ });
196
+ $("#event_end").datepicker({
197
+ numberOfMonths: 2,
198
+ dateFormat: "yy-mm-dd"
199
+ });
200
+ });
201
+ //]]>
202
+ </script>
203
+ ';
204
+ }
205
+ if ($_GET['page']=='my-calendar-categories') {
206
+ /*
207
+ <script type=\"text/javascript\">
208
+ //<![CDATA[
209
+ //jQuery(document).ready(function($) {
210
+ //$('#category_color').colorpicker({ flat: true });
211
+ //]]>
212
+ */
213
+ }
214
+ }
215
+ function my_calendar_add_display_javascript() {
216
+ wp_enqueue_script('jquery');
217
+ }
218
+ add_action('init','my_calendar_add_display_javascript');
219
+
220
+ function my_calendar_calendar_javascript() {
221
+ $list_js = stripcslashes( get_option( 'my_calendar_listjs' ) );
222
+ $cal_js = stripcslashes( get_option( 'my_calendar_caljs' ) );
223
+ $mini_js = stripcslashes( get_option( 'my_calendar_minijs' ) );
224
+
225
+ if ( get_option('calendar_javascript') != 1 || get_option('list_javascript') != 1 || get_option('mini_javascript') != 1 ) {
226
+ $fouc = "$j(\'html\').addClass(\'js\')";
227
+ } else {
228
+ $fouc = '';
229
+ }
230
+ if ( get_option( 'my_calendar_show_css' ) != '' ) {
231
+ $array = explode( ",",get_option( 'my_calendar_show_css' ) );
232
+ if (!is_array($array)) {
233
+ $array = array();
234
+ }
235
+ }
236
+ if ( @in_array( $id, $array ) || get_option( 'my_calendar_show_css' ) == '' ) {
237
+
238
+
239
+ if ( get_option('calendar_javascript') != 1 ) {
240
+ echo "\n";
241
+ ?>
242
+ <script type='text/javascript'>
243
+ <?php echo $cal_js; ?>
244
+ </script>
245
+ <?php
246
+ }
247
+ if ( get_option('list_javascript') != 1 ) {
248
+ echo "\n"
249
+ ?>
250
+ <script type='text/javascript'>
251
+ <?php echo $list_js; ?>
252
+ </script>
253
+ <?php
254
+ }
255
+ if ( get_option('mini_javascript') != 1 ) {
256
+ echo "\n"
257
+ ?>
258
+ <script type='text/javascript'>
259
+ <?php echo $mini_js; ?>
260
+ </script>
261
+ <?php
262
+ }
263
+ }
264
+ }
265
+ add_action('wp_head','my_calendar_calendar_javascript');
266
+
267
+ function my_calendar_add_styles() {
268
+ ?>
269
+ <link type="text/css" rel="stylesheet" href="<?php echo WP_PLUGIN_URL; ?>/my-calendar/js/ui.datepicker.css" />
270
+ <?php
271
+ echo '
272
+ <style type="text/css">
273
+ <!--
274
+ .jd-my-calendar {
275
+ margin-right: 150px!important;
276
+ }
277
+ #my-calendar legend {
278
+ font-weight: 700;
279
+ font-size: 1em;
280
+ }
281
+ .resources {
282
+ float: right;
283
+ border: 1px solid #aaa;
284
+ padding: 10px 10px 0;
285
+ margin-left: 10px;
286
+ -moz-border-radius: 5px;
287
+ -webkit-border-radius: 5px;
288
+ border-radius: 5px;
289
+ background: #fff;
290
+ text-align: center;
291
+ }
292
+ .resources form {
293
+ margin: 0!important;
294
+ }
295
+ #category_icon option {
296
+ padding: 5px 0 5px 24px;
297
+ }
298
+ #my-calendar-admin-table .delete {
299
+ background: #a00;
300
+ color: #fff;
301
+ padding: 2px 8px;
302
+ font-size: .8em;
303
+ border: 1px solid #fff;
304
+ -moz-border-radius: 8px;
305
+ -webkit-border-radius: 8px;
306
+ border-radius: 8px;
307
+ text-decoration: none;
308
+ }
309
+ #my-calendar-admin-table .delete:hover, #my-calendar-admin-table .delete:focus {
310
+ border: 1px solid #999;
311
+ background: #b11;
312
+ }
313
+ .import {
314
+ background: #ffa;
315
+ padding: 5px 10px;
316
+ border: 1px solid #aaa;
317
+ -moz-border-radius: 5px;
318
+ -webkit-border-radius: 5px;
319
+ border-radius: 5px;
320
+ margin: 15px 0;
321
+ }
322
+ .n4 {width: 32px;}
323
+ .n5 {width: 32px;}
324
+ .n6 {width: 64px;}
325
+ .n7 {width: 128px;}
326
+ .n8 {width: 256px;}
327
+ .category-color {
328
+ width: 1.2em;
329
+ height: 1.2em;
330
+ display: inline-block;
331
+ -moz-border-radius: 3px;
332
+ -webkit-border-radius: 3px;
333
+ border-radius: 3px;
334
+ border: 1px solid #000;
335
+ }
336
+ //-->
337
+ </style>';
338
+ }
339
+
340
+ function my_calendar_insert($atts) {
341
+ extract(shortcode_atts(array(
342
+ 'name' => 'all',
343
+ 'format' => 'calendar',
344
+ 'category' => 'all',
345
+ 'showkey' => 'yes'
346
+ ), $atts));
347
+ if ( isset($_GET['format']) ) {
348
+ $format = mysql_real_escape_string($_GET['format']);
349
+ }
350
+ return my_calendar($name,$format,$category,$showkey);
351
+ }
352
+
353
+ function my_calendar_insert_upcoming($atts) {
354
+ extract(shortcode_atts(array(
355
+ 'before' => 'default',
356
+ 'after' => 'default',
357
+ 'type' => 'default',
358
+ 'category' => 'default',
359
+ 'template' => 'default'
360
+ ), $atts));
361
+ return my_calendar_upcoming_events($before, $after, $type, $category, $template);
362
+ }
363
+
364
+ function my_calendar_insert_today($atts) {
365
+ extract(shortcode_atts(array(
366
+ 'category' => 'default',
367
+ 'template' => 'default'
368
+ ), $atts));
369
+ return my_calendar_todays_events($category, $template);
370
+ }
371
+
372
+
373
+ // add shortcode interpreter
374
+ add_shortcode('my_calendar','my_calendar_insert');
375
+ add_shortcode('my_calendar_upcoming','my_calendar_insert_upcoming');
376
+ add_shortcode('my_calendar_today','my_calendar_insert_today');
377
+
378
+ // Function to check what version of My Calendar is installed and install if needed
379
+ function check_my_calendar() {
380
+ global $wpdb, $initial_style, $initial_listjs, $initial_caljs, $initial_minijs;
381
+ $current_version = get_option('my_calendar_version');
382
+ // If current version matches, don't bother running this.
383
+ if ($current_version == '1.4.0') {
384
+ return true;
385
+ }
386
+ // Checks to make sure My Calendar is installed, if not it adds the default
387
+ // database tables and populates them with test data. If it is, then the
388
+ // version is checked through various means and if it is not up to date
389
+ // then it is upgraded.
390
+
391
+ // Lets see if this is first run and create a table if it is!
392
+ // Assume this is not a new install until we prove otherwise
393
+ $new_install = false;
394
+ $my_calendar_exists = false;
395
+ $upgrade_path = array();
396
+
397
+ // Determine the calendar version
398
+ $tables = $wpdb->get_results("show tables;");
399
+ foreach ( $tables as $table ) {
400
+ foreach ( $table as $value ) {
401
+ if ( $value == MY_CALENDAR_TABLE ) {
402
+ $my_calendar_exists = true;
403
+ // check whether installed version matches most recent version, establish upgrade process.
404
+ }
405
+ }
406
+ }
407
+
408
+ if ( $my_calendar_exists == false ) {
409
+ $new_install = true;
410
+ // for each release requiring an upgrade path, add a version compare. Loop will run every relevant upgrade cycle.
411
+ } else if ( version_compare( $current_version,"1.3.0","<" ) ) {
412
+ $upgrade_path[] = "1.3.0";
413
+ } else if ( version_compare( $current_version,"1.3.8","<" ) ) {
414
+ $upgrade_path[] = "1.3.8";
415
+ } else if ( version_compare( $current_version, "1.4.0", "<" ) ) {
416
+ $upgrade_path[] = "1.4.0";
417
+ }
418
+
419
+ // having determined upgrade path, assign new version number
420
+ update_option( 'my_calendar_version' , '1.4.0' );
421
+
422
+ // Now we've determined what the current install is or isn't
423
+ if ( $new_install == true ) {
424
+ //add default settings
425
+ mc_default_settings();
426
+
427
+ $sql = "UPDATE " . MY_CALENDAR_TABLE . " SET event_category=1";
428
+ $wpdb->get_results($sql);
429
+
430
+ $sql = "INSERT INTO " . MY_CALENDAR_CATEGORIES_TABLE . " SET category_id=1, category_name='General', category_color='#ffffff', category_icon='event.png'";
431
+ $wpdb->get_results($sql);
432
+
433
+ }
434
+
435
+ // switch for different upgrade paths
436
+ foreach ($upgrade_path as $upgrade) {
437
+ switch ($upgrade) {
438
+ case '1.3.0':
439
+ add_option('my_calendar_listjs',$initial_listjs);
440
+ add_option('my_calendar_caljs',$initial_caljs);
441
+ add_option('my_calendar_show_heading','true');
442
+ break;
443
+ case '1.3.8':
444
+ update_option('my_calendar_show_css','');
445
+ break;
446
+ case '1.4.0':
447
+ // change tables
448
+ add_option( 'mc_db_version', '1.4.0' );
449
+ add_option( 'mc_event_link_expires','false' );
450
+ add_option( 'mc_apply_color','default' );
451
+ add_option( 'my_calendar_minijs', $initial_minijs);
452
+ add_option( 'mini_javascript', 1);
453
+ upgrade_db();
454
+ break;
455
+ default:
456
+ break;
457
+ }
458
+ }
459
+ /*
460
+ if the user has fully uninstalled the plugin but kept the database of events, this will restore default
461
+ settings and upgrade db if needed.
462
+ */
463
+ if ( get_option( 'my_calendar_uninstalled' ) == 'true' ) {
464
+ mc_default_settings();
465
+ update_option( 'mc_db_version', '1.4.0' );
466
+ }
467
+ }
468
+
469
+ function jd_cal_checkCheckbox( $theFieldname,$theValue ){
470
+ if( get_option( $theFieldname ) == $theValue ){
471
+ echo 'checked="checked"';
472
+ }
473
+ }
474
+ function jd_cal_checkSelect( $theFieldname,$theValue ) {
475
+ if ( get_option( $theFieldname ) == $theValue) {
476
+ echo 'selected="selected"';
477
+ }
478
+ }
479
+
480
+ // Function to return a prefix which will allow the correct
481
+ // placement of arguments into the query string.
482
+ function my_calendar_permalink_prefix() {
483
+ // Get the permalink structure from WordPress
484
+ $p_link = get_permalink();
485
+
486
+ // Work out what the real URL we are viewing is
487
+ $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
488
+ $protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")).$s;
489
+ $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
490
+ $real_link = $protocol.'://'.$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
491
+
492
+ // Now use all of that to get the correctly craft the My Calendar link prefix
493
+ if (strstr($p_link, '?') && $p_link == $real_link) {
494
+ $link_part = $p_link.'&';
495
+ } else if ($p_link == $real_link) {
496
+ $link_part = $p_link.'?';
497
+ } else if (strstr($real_link, '?')) {
498
+ if (isset($_GET['month']) && isset($_GET['yr'])) {
499
+ $new_tail = split("&", $real_link);
500
+ foreach ($new_tail as $item) {
501
+ if (!strstr($item, 'month') && !strstr($item, 'yr')) {
502
+ $link_part .= $item.'&amp;';
503
+ }
504
+ }
505
+ if (!strstr($link_part, '?')) {
506
+ $new_tail = split("month", $link_part);
507
+ $link_part = $new_tail[0].'?'.$new_tail[1];
508
+ }
509
+ } else {
510
+ $link_part = $real_link.'&amp;';
511
+ }
512
+ } else {
513
+ $link_part = $real_link.'?';
514
+ }
515
+ return $link_part;
516
+ }
517
+
518
+ // Configure the "Next" link in the calendar
519
+ function my_calendar_next_link($cur_year,$cur_month,$format) {
520
+ $next_year = $cur_year + 1;
521
+ if ( get_option( 'mc_next_events') == '' ) {
522
+ $next_events = "Next events";
523
+ } else {
524
+ $next_events = stripcslashes( get_option( 'mc_next_events') );
525
+ }
526
+ $num_months = get_option('my_calendar_show_months');
527
+ if ($num_months <= 1 || $format=="calendar") {
528
+ if ($cur_month == 12) {
529
+ return '<a href="' . my_calendar_permalink_prefix() . 'month=1&amp;yr=' . $next_year . '#jd-calendar" rel="nofollow">'.$next_events.' &raquo;</a>';
530
+ } else {
531
+ $next_month = $cur_month + 1;
532
+ return '<a href="' . my_calendar_permalink_prefix() . 'month='.$next_month.'&amp;yr=' . $cur_year . '#jd-calendar" rel="nofollow">'.$next_events.' &raquo;</a>';
533
+ }
534
+ } else {
535
+ if (($cur_month + $num_months) > 12) {
536
+ $next_month = ($cur_month + $num_months) - 12;
537
+ } else {
538
+ $next_month = $cur_month + $num_months;
539
+ }
540
+ if ($cur_month >= (12-$num_months)) {
541
+ return '<a href="' . my_calendar_permalink_prefix() . 'month='.$next_month.'&amp;yr=' . $next_year . '#jd-calendar" rel="nofollow">'.$next_events.' &raquo;</a>';
542
+ } else {
543
+ return '<a href="' . my_calendar_permalink_prefix() . 'month='.$next_month.'&amp;yr=' . $cur_year . '#jd-calendar" rel="nofollow">'.$next_events.' &raquo;</a>';
544
+ }
545
+ }
546
+ }
547
+
548
+ // Configure the "Previous" link in the calendar
549
+ function my_calendar_prev_link($cur_year,$cur_month,$format) {
550
+ $last_year = $cur_year - 1;
551
+ if ( get_option( 'mc_previous_events') == '' ) {
552
+ $previous_events = "Previous events";
553
+ } else {
554
+ $previous_events = stripcslashes( get_option( 'mc_previous_events') );
555
+ }
556
+ $num_months = get_option('my_calendar_show_months');
557
+ if ($num_months <= 1 || $format=="calendar") {
558
+ if ($cur_month == 1) {
559
+ return '<a href="' . my_calendar_permalink_prefix() . 'month=12&amp;yr='. $last_year .'#jd-calendar" rel="nofollow">&laquo; '.$previous_events.'</a>';
560
+ } else {
561
+ $next_month = $cur_month - 1;
562
+ return '<a href="' . my_calendar_permalink_prefix() . 'month='.$next_month.'&amp;yr=' . $cur_year . '#jd-calendar" rel="nofollow">&laquo; '.$previous_events.'</a>';
563
+ }
564
+ } else {
565
+ if ($cur_month > $num_months) {
566
+ $next_month = $cur_month - $num_months;
567
+ } else {
568
+ $next_month = ($cur_month - $num_months) + 12;
569
+ }
570
+ if ($cur_month <= $num_months) {
571
+ return '<a href="' . my_calendar_permalink_prefix() . 'month='.$next_month.'&amp;yr=' . $last_year . '#jd-calendar" rel="nofollow">&laquo; '.$previous_events.'</a>';
572
+ } else {
573
+ return '<a href="' . my_calendar_permalink_prefix() . 'month='.$next_month.'&amp;yr=' . $cur_year . '#jd-calendar" rel="nofollow">&laquo; '.$previous_events.'</a>';
574
+ }
575
+ }
576
+ }
577
+
578
+ // Used to draw multiple events
579
+ function my_calendar_draw_events($events, $type) {
580
+ // We need to sort arrays of objects by time
581
+ usort($events, "my_calendar_time_cmp");
582
+ if ($type == "mini" && count($events)>0) {
583
+ $output .= "<div class='calendar-events'>";
584
+ }
585
+ foreach($events as $event) {
586
+ $output .= my_calendar_draw_event($event, $type);
587
+ }
588
+ if ($type == "mini" && count($events)>0) {
589
+ $output .= "</div>";
590
+ }
591
+ return $output;
592
+ }
593
+
594
+ // Used to draw an event to the screen
595
+ function my_calendar_draw_event($event, $type="calendar") {
596
+ global $wpdb;
597
+
598
+ // My Calendar must be updated to run this function
599
+ check_my_calendar();
600
+
601
+ $display_author = get_option('display_author');
602
+ $display_map = get_option('my_calendar_show_map');
603
+ $display_address = get_option('my_calendar_show_address');
604
+ $sql = "SELECT * FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=".$event->event_category;
605
+ $cat_details = $wpdb->get_row($sql);
606
+ $style = "background-color:".$cat_details->category_color.";";
607
+ $category = sanitize_title( $cat_details->category_name );
608
+ if ( get_option('my_calendar_hide_icons')=='true' ) {
609
+ $image = "";
610
+ } else {
611
+ if ($cat_details->category_icon != "") {
612
+ if ( file_exists( WP_PLUGIN_DIR . '/my-calendar-custom/' ) ) {
613
+ $path = '/my-calendar-custom';
614
+ } else {
615
+ $path = '/my-calendar/icons';
616
+ }
617
+ $image = '<img src="'.WP_PLUGIN_URL.$path.'/'.$cat_details->category_icon.'" alt="" class="category-icon" style="background:'.$cat_details->category_color.';" />';
618
+ } else {
619
+ $image = "";
620
+ }
621
+ }
622
+ $location_string = $event->event_street.$event->event_street2.$event->event_city.$event->event_state.$event->event_postcode.$event->event_country;
623
+
624
+ if (($display_address == 'true' || $display_map == 'true') && strlen($location_string) > 0 ) {
625
+ $map_string = $event->event_street.' '.$event->event_street2.' '.$event->event_city.' '.$event->event_state.' '.$event->event_postcode.' '.$event->event_country;
626
+ $address .= '<div class="address vcard">';
627
+
628
+ if ($display_address == 'true') {
629
+ $address .= "<div class=\"adr\">";
630
+ if ($event->event_label != "") {
631
+ $address .= "<strong class=\"org\">".stripslashes($event->event_label)."</strong><br />";
632
+ }
633
+ if ($event->event_street != "") {
634
+ $address .= "<div class=\"street-address\">".stripslashes($event->event_street)."</div>";
635
+ }
636
+ if ($event->event_street2 != "") {
637
+ $address .= "<div class=\"street-address\">".stripslashes($event->event_street2)."</div>";
638
+ }
639
+ if ($event->event_city != "") {
640
+ $address .= "<span class=\"locality\">".stripslashes($event->event_city).",</span>";
641
+ }
642
+ if ($event->event_state != "") {
643
+ $address .= " <span class=\"region\">".stripslashes($event->event_state)."</span> ";
644
+ }
645
+ if ($event->event_postcode != "") {
646
+ $address .= " <span class=\"postal-code\">".stripslashes($event->event_postcode)."</span>";
647
+ }
648
+ if ($event->event_country != "") {
649
+ $address .= "<div class=\"country-name\">".stripslashes($event->event_country)."</div>";
650
+ }
651
+ $address .= "</div>";
652
+ }
653
+ if ($display_map == 'true' && strlen($location_string) > 0 ) {
654
+ $map_string = str_replace(" ","+",$map_string);
655
+ if ($event->event_label != "") {
656
+ $map_label = stripslashes($event->event_label);
657
+ } else {
658
+ $map_label = stripslashes($event->event_title);
659
+ }
660
+ $zoom = ($event->event_zoom != 0)?$event->event_zoom:'15';
661
+
662
+ if ($event->event_longitude != '0.000000' && $event->event_latitude != '0.000000') {
663
+ $map_string = "$event->event_longitude,$event->event_latitude";
664
+ }
665
+
666
+ $map = "<a href=\"http://maps.google.com/maps?f=q&amp;z=$zoom&amp;q=$map_string\">Map<span> to $map_label</span></a>";
667
+ $address .= "<div class=\"url map\">$map</div>";
668
+ }
669
+ $address .= "</div>";
670
+ }
671
+
672
+ $my_calendar_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) );
673
+
674
+ $header_details .= "\n<div class='$type-event'>\n";
675
+ if ($type == 'calendar') {
676
+ $toggle = " <a href='#' class='mc-toggle mc-expand'><img src='$my_calendar_directory/images/event-details.png' alt='".__('Event Details','my-calendar')."' /></a>";
677
+ } else {
678
+ $toggle = "";
679
+ }
680
+ $header_details .= "<h3 class='event-title $category'>$image".stripslashes($event->event_title)."$toggle</h3>\n";
681
+
682
+
683
+ $header_details .= "<div class='details'>";
684
+ if ($type == "calendar" ) { $header_details .= "<h3 class='close'><a href='#' class='mc-toggle mc-close'><img src='$my_calendar_directory/images/event-close.png' alt='".__('Close','my-calendar')."' /></a></h3>"; }
685
+ if ($event->event_time != "00:00:00") {
686
+ $header_details .= "<span class='event-time'>".date_i18n(get_option('time_format'), strtotime($event->event_time));
687
+ if ($event->event_endtime != "00:00:00") {
688
+ $header_details .= "<span class='time-separator'>&thinsp;&ndash;&thinsp;</span><span class='end-time'>".date_i18n(get_option('time_format'), strtotime($event->event_endtime))."</span>";
689
+ }
690
+ $header_details .= "</span>\n";
691
+ } else {
692
+ $header_details .= "<span class='event-time'>";
693
+ if ( get_option('my_calendar_notime_text') == '' || get_option('my_calendar_notime_text') == "N/A" ) {
694
+ $header_details .= "<abbr title='".__('Not Applicable','my-calendar')."'>".__('N/A','my-calendar')."</abbr>\n";
695
+ } else {
696
+ $header_details .= get_option('my_calendar_notime_text');
697
+ }
698
+ $header_details .= "</span>";
699
+ }
700
+ $header_details .= "<div class='sub-details'>";
701
+ if ($type == "list") {
702
+ $header_details .= "<h3 class='event-title'>$image".stripslashes($event->event_title)."</h3>\n";
703
+ }
704
+ if ($display_author == 'true') {
705
+ $e = get_userdata($event->event_author);
706
+ $header_details .= '<span class="event-author">'.__('Posted by', 'my-calendar').': <span class="author-name">'.$e->display_name."</span></span><br />\n ";
707
+ }
708
+ if (($display_address == 'true' || $display_map == 'true') && strlen($location_string) > 0 ) {
709
+ $header_details .= $address;
710
+ }
711
+ // handle link expiration
712
+ if ( $event->event_link_expires == 0 ) {
713
+ $event_link = $event->event_link;
714
+ } else {
715
+ if ( my_calendar_date_comp( $event->event_begin,date_i18n('Y-m-d',time() ) ) ) {
716
+ $event_link = '';
717
+ } else {
718
+ $event_link = $event->event_link;
719
+ }
720
+ }
721
+
722
+ if ($event_link != '') {
723
+ $details = "\n". $header_details . '' . wpautop(stripslashes($event->event_desc),1) . '<p><a href="'.$event_link.'" class="event-link">' . stripslashes($event->event_title) . '&raquo; </a></p>'."</div></div></div>\n";
724
+ } else {
725
+ $details = "\n". $header_details . '' . wpautop(stripslashes($event->event_desc),1) . "</div></div></div>\n";
726
+ }
727
+ return $details;
728
+ }
729
+ // used to generate upcoming events lists
730
+ function mc_get_all_events($category) {
731
+ global $wpdb;
732
+ if ( $category!='default' ) {
733
+ if ( strpos( $category, "|" ) ) {
734
+ $categories = explode( "|", $category );
735
+ $numcat = count($categories);
736
+ $i = 1;
737
+ foreach ($categories as $key) {
738
+ if ( is_numeric($key) ) {
739
+ if ($i == 1) {
740
+ $select_category .= " WHERE (";
741
+ }
742
+ $select_category .= " event_category = $key";
743
+ if ($i < $numcat) {
744
+ $select_category .= " OR ";
745
+ } else if ($i == $numcat) {
746
+ $select_cateory .= ") ";
747
+ }
748
+ $i++;
749
+ } else {
750
+ $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$key'");
751
+ $category_id = $cat->category_id;
752
+ if ($i == 1) {
753
+ $select_category .= " WHERE (";
754
+ }
755
+ $select_category .= " event_category = $category_id";
756
+ if ($i < $numcat) {
757
+ $select_category .= " OR ";
758
+ } else if ($i == $numcat) {
759
+ $select_category .= ") ";
760
+ }
761
+ $i++;
762
+ }
763
+ }
764
+ } else {
765
+ if (is_numeric($category)) {
766
+ $select_category = " WHERE event_category = $category";
767
+ } else {
768
+ $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$category'");
769
+ $category_id = $cat->category_id;
770
+ if (!$category_id) {
771
+ //if the requested category doesn't exist, fail silently
772
+ $select_category = "";
773
+ } else {
774
+ $select_category = " WHERE event_category = $category_id";
775
+ }
776
+ }
777
+ }
778
+ } else {
779
+ $select_category = "";
780
+ }
781
+ $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . "$select_category");
782
+ $offset = (60*60*get_option('gmt_offset'));
783
+ $date = date('Y', time()+($offset)).'-'.date('m', time()+($offset)).'-'.date('d', time()+($offset));
784
+ if (!empty($events)) {
785
+ foreach($events as $event) {
786
+ if ($event->event_recur != "S") {
787
+ $orig_begin = $event->event_begin;
788
+ $orig_end = $event->event_end;
789
+ $numback = 0;
790
+ $numforward = $event->event_repeats;
791
+ $event_repetition = (int) $event->event_repeats;
792
+ if ($event_repetition !== 0) {
793
+ switch ($event->event_recur) {
794
+ case "D":
795
+ for ($i=$numback;$i<=$numforward;$i++) {
796
+ $begin = my_calendar_add_date($orig_begin,$i,0,0);
797
+ $end = my_calendar_add_date($orig_end,$i,0,0);
798
+ ${$i} = clone($event);
799
+ ${$i}->event_begin = $begin;
800
+ ${$i}->event_end = $end;
801
+ $arr_events[]=${$i};
802
+ }
803
+ break;
804
+ case "W":
805
+ for ($i=$numback;$i<=$numforward;$i++) {
806
+ $begin = my_calendar_add_date($orig_begin,($i*7),0,0);
807
+ $end = my_calendar_add_date($orig_end,($i*7),0,0);
808
+ ${$i} = clone($event);
809
+ ${$i}->event_begin = $begin;
810
+ ${$i}->event_end = $end;
811
+ $arr_events[]=${$i};
812
+ }
813
+ break;
814
+ case "B":
815
+ for ($i=$numback;$i<=$numforward;$i++) {
816
+ $begin = my_calendar_add_date($orig_begin,($i*14),0,0);
817
+ $end = my_calendar_add_date($orig_end,($i*14),0,0);
818
+ ${$i} = clone($event);
819
+ ${$i}->event_begin = $begin;
820
+ ${$i}->event_end = $end;
821
+ $arr_events[]=${$i};
822
+ }
823
+ break;
824
+ case "M":
825
+ for ($i=$numback;$i<=$numforward;$i++) {
826
+ $begin = my_calendar_add_date($orig_begin,0,$i,0);
827
+ $end = my_calendar_add_date($orig_end,0,$i,0);
828
+ ${$i} = clone($event);
829
+ ${$i}->event_begin = $begin;
830
+ ${$i}->event_end = $end;
831
+ $arr_events[]=${$i};
832
+ }
833
+ break;
834
+ case "Y":
835
+ for ($i=$numback;$i<=$numforward;$i++) {
836
+ $begin = my_calendar_add_date($orig_begin,0,0,$i);
837
+ $end = my_calendar_add_date($orig_end,0,0,$i);
838
+ ${$i} = clone($event);
839
+ ${$i}->event_begin = $begin;
840
+ ${$i}->event_end = $end;
841
+ $arr_events[]=${$i};
842
+ }
843
+ break;
844
+ }
845
+ } else {
846
+ switch ($event->event_recur) {
847
+ case "D":
848
+ $event_begin = $event->event_begin;
849
+ $today = date('Y',time()+($offset)).'-'.date('m',time()+($offset)).'-'.date('d',time()+($offset));
850
+ $nDays = get_option('display_past_events');
851
+ $fDays = get_option('display_upcoming_events');
852
+ if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
853
+ if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays),0,0) )) {
854
+ $diff = jd_date_diff_precise(strtotime($event_begin));
855
+ $diff_days = $diff/(86400);
856
+ $days = explode(".",$diff_days);
857
+ $realStart = $days[0] - $nDays;
858
+ $realFinish = $days[0] + $fDays;
859
+
860
+ for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
861
+ $this_date = my_calendar_add_date($event_begin,($realStart),0,0);
862
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
863
+ ${$realStart} = clone($event);
864
+ ${$realStart}->event_begin = $this_date;
865
+ $arr_events[] = ${$realStart};
866
+ }
867
+ }
868
+
869
+ } else {
870
+ $realDays = -($nDays);
871
+ for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
872
+ $this_date = my_calendar_add_date($event_begin,$realDays,0,0);
873
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) == true ) {
874
+ ${$realDays} = clone($event);
875
+ ${$realDays}->event_begin = $this_date;
876
+ $arr_events[] = ${$realDays};
877
+ }
878
+ }
879
+ }
880
+ } else {
881
+ break;
882
+ }
883
+ break;
884
+
885
+ case "W":
886
+ $event_begin = $event->event_begin;
887
+ $today = date('Y',time()+($offset)).'-'.date('m',time()+($offset)).'-'.date('d',time()+($offset));
888
+ $nDays = get_option('display_past_events');
889
+ $fDays = get_option('display_upcoming_events');
890
+
891
+ if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
892
+ if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays*7),0,0) )) {
893
+ $diff = jd_date_diff_precise(strtotime($event_begin));
894
+ $diff_weeks = $diff/(86400*7);
895
+ $weeks = explode(".",$diff_weeks);
896
+ $realStart = $weeks[0] - $nDays;
897
+ $realFinish = $weeks[0] + $fDays;
898
+
899
+ for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
900
+ $this_date = my_calendar_add_date($event_begin,($realStart*7),0,0);
901
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
902
+ ${$realStart} = clone($event);
903
+ ${$realStart}->event_begin = $this_date;
904
+ $arr_events[] = ${$realStart};
905
+ }
906
+ }
907
+
908
+ } else {
909
+ $realDays = -($nDays);
910
+ for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
911
+ $this_date = my_calendar_add_date($event_begin,($realDays*7),0,0);
912
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
913
+ ${$realDays} = clone($event);
914
+ ${$realDays}->event_begin = $this_date;
915
+ $arr_events[] = ${$realDays};
916
+ }
917
+ }
918
+ }
919
+ } else {
920
+ break;
921
+ }
922
+ break;
923
+
924
+ case "B":
925
+ $event_begin = $event->event_begin;
926
+ $today = date('Y',time()+($offset)).'-'.date('m',time()+($offset)).'-'.date('d',time()+($offset));
927
+ $nDays = get_option('display_past_events');
928
+ $fDays = get_option('display_upcoming_events');
929
+
930
+ if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
931
+ if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays*14),0,0) )) {
932
+ $diff = jd_date_diff_precise(strtotime($event_begin));
933
+ $diff_weeks = $diff/(86400*14);
934
+ $weeks = explode(".",$diff_weeks);
935
+ $realStart = $weeks[0] - $nDays;
936
+ $realFinish = $weeks[0] + $fDays;
937
+
938
+ for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
939
+ $this_date = my_calendar_add_date($event_begin,($realStart*14),0,0);
940
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
941
+ ${$realStart} = clone($event);
942
+ ${$realStart}->event_begin = $this_date;
943
+ $arr_events[] = ${$realStart};
944
+ }
945
+ }
946
+
947
+ } else {
948
+ $realDays = -($nDays);
949
+ for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
950
+ $this_date = my_calendar_add_date($event_begin,($realDays*14),0,0);
951
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
952
+ ${$realDays} = clone($event);
953
+ ${$realDays}->event_begin = $this_date;
954
+ $arr_events[] = ${$realDays};
955
+ }
956
+ }
957
+ }
958
+ } else {
959
+ break;
960
+ }
961
+ break;
962
+
963
+ case "M":
964
+ $event_begin = $event->event_begin;
965
+ $today = date('Y',time()+($offset)).'-'.date('m',time()+($offset)).'-'.date('d',time()+($offset));
966
+ $nDays = get_option('display_past_events');
967
+ $fDays = get_option('display_upcoming_events');
968
+
969
+ if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
970
+ if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays),0,0) )) {
971
+ $diff = jd_date_diff_precise(strtotime($event_begin));
972
+ $diff_days = $diff/(86400*30);
973
+ $days = explode(".",$diff_days);
974
+ $realStart = $days[0] - $nDays;
975
+ $realFinish = $days[0] + $fDays;
976
+
977
+ for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
978
+ $this_date = my_calendar_add_date($event_begin,0,$realStart,0);
979
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
980
+ ${$realStart} = clone($event);
981
+ ${$realStart}->event_begin = $this_date;
982
+ $arr_events[] = ${$realStart};
983
+ }
984
+ }
985
+
986
+ } else {
987
+ $realDays = -($nDays);
988
+ for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
989
+ $this_date = my_calendar_add_date($event_begin,0,$realDays,0);
990
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) == true ) {
991
+ ${$realDays} = clone($event);
992
+ ${$realDays}->event_begin = $this_date;
993
+ $arr_events[] = ${$realDays};
994
+ }
995
+ }
996
+ }
997
+ } else {
998
+ break;
999
+ }
1000
+ break;
1001
+
1002
+ case "Y":
1003
+ $event_begin = $event->event_begin;
1004
+ $today = date('Y',time()+($offset)).'-'.date('m',time()+($offset)).'-'.date('d',time()+($offset));
1005
+ $nDays = get_option('display_past_events');
1006
+ $fDays = get_option('display_upcoming_events');
1007
+
1008
+ if ( my_calendar_date_comp($event_begin, $today) ) { // compare first date against today's date
1009
+ if (my_calendar_date_comp( $event_begin, my_calendar_add_date($today,-($nDays),0,0) )) {
1010
+ $diff = jd_date_diff_precise(strtotime($event_begin));
1011
+ $diff_days = $diff/(86400*365);
1012
+ $days = explode(".",$diff_days);
1013
+ $realStart = $days[0] - $nDays;
1014
+ $realFinish = $days[0] + $fDays;
1015
+
1016
+ for ($realStart;$realStart<=$realFinish;$realStart++) { // jump forward to near present.
1017
+ $this_date = my_calendar_add_date($event_begin,0,0,$realStart);
1018
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) ) {
1019
+ ${$realStart} = clone($event);
1020
+ ${$realStart}->event_begin = $this_date;
1021
+ $arr_events[] = ${$realStart};
1022
+ }
1023
+ }
1024
+
1025
+ } else {
1026
+ $realDays = -($nDays);
1027
+ for ($realDays;$realDays<=$fDays;$realDays++) { // for each event within plus or minus range, mod date and add to array.
1028
+ $this_date = my_calendar_add_date($event_begin,0,0,$realDays);
1029
+ if ( my_calendar_date_comp( $event->event_begin,$this_date ) == true ) {
1030
+ ${$realDays} = clone($event);
1031
+ ${$realDays}->event_begin = $this_date;
1032
+ $arr_events[] = ${$realDays};
1033
+ }
1034
+ }
1035
+ }
1036
+ } else {
1037
+ break;
1038
+ }
1039
+ break;
1040
+ }
1041
+ }
1042
+ } else {
1043
+ $arr_events[]=$event;
1044
+ }
1045
+ }
1046
+ }
1047
+ return $arr_events;
1048
+ }
1049
+ // Grab all events for the requested date from calendar
1050
+ function my_calendar_grab_events($y,$m,$d,$category=null) {
1051
+
1052
+ if (!checkdate($m,$d,$y)) {
1053
+ return;
1054
+ }
1055
+
1056
+ global $wpdb;
1057
+
1058
+ if ( $category!=null ) {
1059
+ if ( strpos( $category, "|" ) ) {
1060
+ $categories = explode( "|", $category );
1061
+ $numcat = count($categories);
1062
+ $i = 1;
1063
+ foreach ($categories as $key) {
1064
+ if ( is_numeric($key) ) {
1065
+ if ($i == 1) {
1066
+ $select_category .= "(";
1067
+ }
1068
+ $select_category .= " event_category = $key";
1069
+ if ($i < $numcat) {
1070
+ $select_category .= " OR ";
1071
+ } else if ($i == $numcat) {
1072
+ $select_category .= ") AND";
1073
+ }
1074
+ $i++;
1075
+ } else {
1076
+ $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$key'");
1077
+ $category_id = $cat->category_id;
1078
+ if ($i == 1) {
1079
+ $select_category .= "(";
1080
+ }
1081
+ $select_category .= " event_category = $category_id";
1082
+ if ($i < $numcat) {
1083
+ $select_category .= " OR ";
1084
+ } else if ($i == $numcat) {
1085
+ $select_category .= ") AND";
1086
+ }
1087
+ $i++;
1088
+ }
1089
+ }
1090
+ } else {
1091
+ if (is_numeric($category)) {
1092
+ $select_category = "event_category = $category AND";
1093
+ } else {
1094
+ $cat = $wpdb->get_row("SELECT category_id FROM " . MY_CALENDAR_CATEGORIES_TABLE . " WHERE category_name = '$category'");
1095
+ $category_id = $cat->category_id;
1096
+ if (!$category_id) {
1097
+ //if the requested category doesn't exist, fail silently
1098
+ $select_category = "";
1099
+ } else {
1100
+ $select_category = "event_category = $category_id AND";
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+ $arr_events = array();
1106
+
1107
+ // set the date format
1108
+ $date = $y . '-' . $m . '-' . $d;
1109
+
1110
+ // First we check for conventional events. These will form the first instance of a recurring event
1111
+ // or the only instance of a one-off event
1112
+ $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_begin <= '$date' AND event_end >= '$date' AND event_recur = 'S' ORDER BY event_id");
1113
+ if (!empty($events)) {
1114
+ foreach($events as $event) {
1115
+ $arr_events[]=$event;
1116
+ }
1117
+ }
1118
+
1119
+ // Fetch Annual Events
1120
+ $events = $wpdb->get_results("SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'Y' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin)
1121
+ UNION ALL
1122
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'M' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin) AND event_repeats = 0
1123
+ UNION ALL
1124
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'M' AND EXTRACT(YEAR FROM '$date') >= EXTRACT(YEAR FROM event_begin) AND event_repeats != 0 AND (PERIOD_DIFF(EXTRACT(YEAR_MONTH FROM '$date'),EXTRACT(YEAR_MONTH FROM event_begin))) <= event_repeats
1125
+ UNION ALL
1126
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'B' AND '$date' >= event_begin AND event_repeats = 0
1127
+ UNION ALL
1128
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'B' AND '$date' >= event_begin AND event_repeats != 0 AND (event_repeats*14) >= (TO_DAYS('$date') - TO_DAYS(event_end))
1129
+ UNION ALL
1130
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'W' AND '$date' >= event_begin AND event_repeats = 0
1131
+ UNION ALL
1132
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'W' AND '$date' >= event_begin AND event_repeats != 0 AND (event_repeats*7) >= (TO_DAYS('$date') - TO_DAYS(event_end))
1133
+ UNION ALL
1134
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'D' AND '$date' >= event_begin AND event_repeats = 0
1135
+ UNION ALL
1136
+ SELECT * FROM " . MY_CALENDAR_TABLE . " WHERE $select_category event_recur = 'D' AND '$date' >= event_begin AND event_repeats != 0 AND (event_repeats) >= (TO_DAYS('$date') - TO_DAYS(event_end))
1137
+ ORDER BY event_id");
1138
+
1139
+ if (!empty($events)) {
1140
+ foreach($events as $event) {
1141
+ switch ($event->event_recur) {
1142
+ case 'Y':
1143
+ // Technically we don't care about the years, but we need to find out if the
1144
+ // event spans the turn of a year so we can deal with it appropriately.
1145
+ $year_begin = date('Y',strtotime($event->event_begin));
1146
+ $year_end = date('Y',strtotime($event->event_end));
1147
+
1148
+ if ($year_begin == $year_end) {
1149
+ if (date('m-d',strtotime($event->event_begin)) <= date('m-d',strtotime($date)) &&
1150
+ date('m-d',strtotime($event->event_end)) >= date('m-d',strtotime($date))) {
1151
+ $arr_events[]=$event;
1152
+ }
1153
+ } else if ($year_begin < $year_end) {
1154
+ if (date('m-d',strtotime($event->event_begin)) <= date('m-d',strtotime($date)) ||
1155
+ date('m-d',strtotime($event->event_end)) >= date('m-d',strtotime($date))) {
1156
+ $arr_events[]=$event;
1157
+ }
1158
+ }
1159
+ break;
1160
+ case 'M':
1161
+ // Technically we don't care about the years or months, but we need to find out if the
1162
+ // event spans the turn of a year or month so we can deal with it appropriately.
1163
+ $month_begin = date('m',strtotime($event->event_begin));
1164
+ $month_end = date('m',strtotime($event->event_end));
1165
+
1166
+ if ($month_begin == $month_end) {
1167
+ if (date('d',strtotime($event->event_begin)) <= date('d',strtotime($date)) &&
1168
+ date('d',strtotime($event->event_end)) >= date('d',strtotime($date))) {
1169
+ $arr_events[]=$event;
1170
+ }
1171
+ } else if ($month_begin < $month_end) {
1172
+ if ( ($event->event_begin <= date('Y-m-d',strtotime($date))) && (date('d',strtotime($event->event_begin)) <= date('d',strtotime($date)) ||
1173
+ date('d',strtotime($event->event_end)) >= date('d',strtotime($date))) ) {
1174
+ $arr_events[]=$event;
1175
+ }
1176
+ }
1177
+ break;
1178
+ case 'B':
1179
+ // Now we are going to check to see what day the original event
1180
+ // fell on and see if the current date is both after it and on
1181
+ // the correct day. If it is, display the event!
1182
+ $day_start_event = date('D',strtotime($event->event_begin));
1183
+ $day_end_event = date('D',strtotime($event->event_end));
1184
+ $current_day = date('D',strtotime($date));
1185
+ $current_date = date('Y-m-d',strtotime($date));
1186
+ $start_date = $event->event_begin;
1187
+
1188
+ $plan = array("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>7);
1189
+
1190
+ for ($n=0;$n<=$event->event_repeats;$n++) {
1191
+ if ( $current_date == my_calendar_add_date($start_date,(14*$n)) ) {
1192
+ if ($plan[$day_start_event] > $plan[$day_end_event]) {
1193
+ if (($plan[$day_start_event] <= $plan[$current_day]) || ($plan[$current_day] <= $plan[$day_end_event])) {
1194
+ $arr_events[]=$event;
1195
+ }
1196
+ } else if (($plan[$day_start_event] < $plan[$day_end_event]) || ($plan[$day_start_event]== $plan[$day_end_event])) {
1197
+ if (($plan[$day_start_event] <= $plan[$current_day]) && ($plan[$current_day] <= $plan[$day_end_event])) {
1198
+ $arr_events[]=$event;
1199
+ }
1200
+ }
1201
+ }
1202
+ }
1203
+ break;
1204
+ case 'W':
1205
+ // Now we are going to check to see what day the original event
1206
+ // fell on and see if the current date is both after it and on
1207
+ // the correct day. If it is, display the event!
1208
+ $day_start_event = date('D',strtotime($event->event_begin));
1209
+ $day_end_event = date('D',strtotime($event->event_end));
1210
+ $current_day = date('D',strtotime($date));
1211
+
1212
+ $plan = array("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>7);
1213
+
1214
+ if ($plan[$day_start_event] > $plan[$day_end_event]) {
1215
+ if (($plan[$day_start_event] <= $plan[$current_day]) || ($plan[$current_day] <= $plan[$day_end_event])) {
1216
+ $arr_events[]=$event;
1217
+ }
1218
+ } else if (($plan[$day_start_event] < $plan[$day_end_event]) || ($plan[$day_start_event]== $plan[$day_end_event])) {
1219
+ if (($plan[$day_start_event] <= $plan[$current_day]) && ($plan[$current_day] <= $plan[$day_end_event])) {
1220
+ $arr_events[]=$event;
1221
+ }
1222
+ }
1223
+ break;
1224
+ case 'D':
1225
+ $arr_events[]=$event;
1226
+ break;
1227
+
1228
+ }
1229
+ }
1230
+ }
1231
+
1232
+ return $arr_events;
1233
+ }
1234
+
1235
+ function mc_month_comparison($month) {
1236
+ $offset = (60*60*get_option('gmt_offset'));
1237
+ $current_month = date("n", time()+($offset));
1238
+ if (isset($_GET['yr']) && isset($_GET['month'])) {
1239
+ if ($month == $_GET['month']) {
1240
+ return ' selected="selected"';
1241
+ }
1242
+ } elseif ($month == $current_month) {
1243
+ return ' selected="selected"';
1244
+ }
1245
+ }
1246
+
1247
+ function mc_year_comparison($year) {
1248
+ $offset = (60*60*get_option('gmt_offset'));
1249
+ $current_year = date("Y", time()+($offset));
1250
+ if (isset($_GET['yr']) && isset($_GET['month'])) {
1251
+ if ($year == $_GET['yr']) {
1252
+ return ' selected="selected"';
1253
+ }
1254
+ } else if ($year == $current_year) {
1255
+ return ' selected="selected"';
1256
+ }
1257
+ }
1258
+ function mc_build_date_switcher() {
1259
+ $my_calendar_body = "";
1260
+ $my_calendar_body .= '<div class="my-calendar-date-switcher">
1261
+ <form method="get" action=""><div>';
1262
+ $qsa = array();
1263
+ parse_str($_SERVER['QUERY_STRING'],$qsa);
1264
+ foreach ($qsa as $name => $argument) {
1265
+ if ($name != 'month' && $name != 'yr') {
1266
+ $my_calendar_body .= '<input type="hidden" name="'.$name.'" value="'.$argument.'" />';
1267
+ }
1268
+ }
1269
+ // We build the months in the switcher
1270
+ $my_calendar_body .= '
1271
+ <label for="my-calendar-month">'.__('Month','my-calendar').':</label> <select id="my-calendar-month" name="month" style="width:100px;">
1272
+ <option value="1"'.mc_month_comparison('1').'>'.__('January','my-calendar').'</option>
1273
+ <option value="2"'.mc_month_comparison('2').'>'.__('February','my-calendar').'</option>
1274
+ <option value="3"'.mc_month_comparison('3').'>'.__('March','my-calendar').'</option>
1275
+ <option value="4"'.mc_month_comparison('4').'>'.__('April','my-calendar').'</option>
1276
+ <option value="5"'.mc_month_comparison('5').'>'.__('May','my-calendar').'</option>
1277
+ <option value="6"'.mc_month_comparison('6').'>'.__('June','my-calendar').'</option>
1278
+ <option value="7"'.mc_month_comparison('7').'>'.__('July','my-calendar').'</option>
1279
+ <option value="8"'.mc_month_comparison('8').'>'.__('August','my-calendar').'</option>
1280
+ <option value="9"'.mc_month_comparison('9').'>'.__('September','my-calendar').'</option>
1281
+ <option value="10"'.mc_month_comparison('10').'>'.__('October','my-calendar').'</option>
1282
+ <option value="11"'.mc_month_comparison('11').'>'.__('November','my-calendar').'</option>
1283
+ <option value="12"'.mc_month_comparison('12').'>'.__('December','my-calendar').'</option>
1284
+ </select>
1285
+ <label for="my-calendar-year">'.__('Year','my-calendar').':</label> <select id="my-calendar-year" name="yr">
1286
+ ';
1287
+ // The year builder is string mania. If you can make sense of this, you know your PHP!
1288
+ $past = 5;
1289
+ $future = 5;
1290
+ $fut = 1;
1291
+ $offset = (60*60*get_option('gmt_offset'));
1292
+
1293
+ while ($past > 0) {
1294
+ $p .= ' <option value="';
1295
+ $p .= date("Y",time()+($offset))-$past;
1296
+ $p .= '"'.mc_year_comparison(date("Y",time()+($offset))-$past).'>';
1297
+ $p .= date("Y",time()+($offset))-$past."</option>\n";
1298
+ $past = $past - 1;
1299
+ }
1300
+ while ($fut < $future) {
1301
+ $f .= ' <option value="';
1302
+ $f .= date("Y",time()+($offset))+$fut;
1303
+ $f .= '"'.mc_year_comparison(date("Y",time()+($offset))+$fut).'>';
1304
+ $f .= date("Y",time()+($offset))+$fut."</option>\n";
1305
+ $fut = $fut + 1;
1306
+ }
1307
+ $my_calendar_body .= $p;
1308
+ $my_calendar_body .= '<option value="'.date("Y",time()+($offset)).'"'.mc_year_comparison(date("Y",time()+($offset))).'>'.date("Y",time()+($offset))."</option>\n";
1309
+ $my_calendar_body .= $f;
1310
+ $my_calendar_body .= '</select> <input type="submit" value="'.__('Go','my-calendar').'" /></div>
1311
+ </form></div>';
1312
+ return $my_calendar_body;
1313
+ }
1314
+
1315
+ // Actually do the printing of the calendar
1316
+ // Compared to searching for and displaying events
1317
+ // this bit is really rather easy!
1318
+ function my_calendar($name,$format,$category,$showkey) {
1319
+ global $wpdb;
1320
+ if ($category == "") {
1321
+ $category=null;
1322
+ }
1323
+ // First things first, make sure calendar is up to date
1324
+ check_my_calendar();
1325
+
1326
+ // Deal with the week not starting on a monday
1327
+ $name_days = array(
1328
+ __('<abbr title="Sunday">Sun</abbr>','my-calendar'),
1329
+ __('<abbr title="Monday">Mon</abbr>','my-calendar'),
1330
+ __('<abbr title="Tuesday">Tues</abbr>','my-calendar'),
1331
+ __('<abbr title="Wednesday">Wed</abbr>','my-calendar'),
1332
+ __('<abbr title="Thursday">Thur</abbr>','my-calendar'),
1333
+ __('<abbr title="Friday">Fri</abbr>','my-calendar'),
1334
+ __('<abbr title="Saturday">Sat</abbr>','my-calendar')
1335
+ );
1336
+
1337
+ if ($format == "mini") {
1338
+ $name_days = array(
1339
+ __('<abbr title="Sunday">S</abbr>','my-calendar'),
1340
+ __('<abbr title="Monday">M</abbr>','my-calendar'),
1341
+ __('<abbr title="Tuesday">T</abbr>','my-calendar'),
1342
+ __('<abbr title="Wednesday">W</abbr>','my-calendar'),
1343
+ __('<abbr title="Thursday">T</abbr>','my-calendar'),
1344
+ __('<abbr title="Friday">F</abbr>','my-calendar'),
1345
+ __('<abbr title="Saturday">S</abbr>','my-calendar')
1346
+ );
1347
+ }
1348
+
1349
+ if ( get_option('start_of_week') == '1' ) {
1350
+ $first = array_shift($name_days);
1351
+ $name_days[] = $first;
1352
+ }
1353
+
1354
+
1355
+ // Carry on with the script
1356
+ $name_months = array(1=>__('January','my-calendar'),__('February','my-calendar'),__('March','my-calendar'),__('April','my-calendar'),__('May','my-calendar'),__('June','my-calendar'),__('July','my-calendar'),__('August','my-calendar'),__('September','my-calendar'),__('October','my-calendar'),__('November','my-calendar'),__('December','my-calendar'));
1357
+ $offset = (60*60*get_option('gmt_offset'));
1358
+
1359
+ // If we don't pass arguments we want a calendar that is relevant to today
1360
+ if (empty($_GET['month']) || empty($_GET['yr'])) {
1361
+ $c_year = date("Y",time()+($offset));
1362
+ $c_month = date("m",time()+($offset));
1363
+ $c_day = date("d",time()+($offset));
1364
+ }
1365
+
1366
+ // Years get funny if we exceed 3000, so we use this check
1367
+ if ($_GET['yr'] <= 3000 && $_GET['yr'] >= 0) {
1368
+
1369
+ if ( isset($_GET['month']) ) {
1370
+ $c_year = (int) $_GET['yr'];
1371
+ $c_month = (int) $_GET['month'];
1372
+ $c_day = date("d",time()+($offset));
1373
+ } else {
1374
+ // No valid month causes the calendar to default to today
1375
+ $c_year = date("Y",time()+($offset));
1376
+ $c_month = date("m",time()+($offset));
1377
+ $c_day = date("d",time()+($offset));
1378
+ }
1379
+ } else {
1380
+ // No valid year causes the calendar to default to today
1381
+ $c_year = date("Y",time()+($offset));
1382
+ $c_month = date("m",time()+($offset));
1383
+ $c_day = date("d",time()+($offset));
1384
+ }
1385
+
1386
+ // Fix the days of the week if week start is not on a monday
1387
+ if (get_option('start_of_week') == 0) {
1388
+ $first_weekday = date("w",mktime(0,0,0,$c_month,1,$c_year));
1389
+ } else {
1390
+ $first_weekday = date("w",mktime(0,0,0,$c_month,1,$c_year));
1391
+ $first_weekday = ($first_weekday==0?6:$first_weekday-1);
1392
+ }
1393
+
1394
+ $days_in_month = date("t", mktime (0,0,0,$c_month,1,$c_year));
1395
+ $and = __("and",'my-calendar');
1396
+ if ($category != "" && $category != "all") {
1397
+ $category_label = str_replace("|"," $and ",$category) . ' ';
1398
+ } else {
1399
+ $category_label = "";
1400
+ }
1401
+ // Start the calendar and add header and navigation
1402
+ $my_calendar_body .= "<div id=\"jd-calendar\" class=\"$format\">";
1403
+ // Add the calendar table and heading
1404
+ $caption_text = stripslashes( get_option('my_calendar_caption') );
1405
+
1406
+ if ($format == "calendar" || $format == "mini" ) {
1407
+ $my_calendar_body .= '<div class="my-calendar-header">';
1408
+
1409
+ // We want to know if we should display the date switcher
1410
+ $date_switcher = get_option('display_jump');
1411
+
1412
+ if ($date_switcher == 'true') {
1413
+ $my_calendar_body .= mc_build_date_switcher();
1414
+ }
1415
+ // The header of the calendar table and the links. Note calls to link functions
1416
+ $my_calendar_body .= '
1417
+ <div class="my-calendar-nav">
1418
+ <ul>
1419
+ <li class="my-calendar-prev">' . my_calendar_prev_link($c_year,$c_month,$format) . '</li>
1420
+ <li class="my-calendar-next">' . my_calendar_next_link($c_year,$c_month,$format) . '</li>
1421
+ </ul>
1422
+ </div>
1423
+ </div>';
1424
+ $my_calendar_body .= "\n<table class=\"my-calendar-table\" summary=\"$category_label".__('Calendar','my-calendar')."\">\n";
1425
+ $my_calendar_body .= '<caption class="my-calendar-month">'.$name_months[(int)$c_month].' '.$c_year.$caption_text."</caption>\n";
1426
+ } else {
1427
+ if ( get_option('my_calendar_show_heading') == 'true' ) {
1428
+ $my_calendar_body .= "\n<h2 class=\"my-calendar-heading\">$category_label".__('Calendar','my-calendar')."</h2>\n";
1429
+ }
1430
+ $num_months = get_option('my_calendar_show_months');
1431
+ if ($num_months <= 1) {
1432
+ $my_calendar_body .= '<h3 class="my-calendar-month">'.__('Events in','my-calendar').' '.$name_months[(int)$c_month].' '.$c_year.$caption_text."</h3>\n";
1433
+ } else {
1434
+ $my_calendar_body .= '<h3 class="my-calendar-month">'.$name_months[(int)$c_month].'&thinsp;&ndash;&thinsp;'.$name_months[(int)$c_month+$num_months-1].' '.$c_year.$caption_text."</h3>\n";
1435
+ }
1436
+ $my_calendar_body .= '<div class="my-calendar-header">';
1437
+
1438
+ // We want to know if we should display the date switcher
1439
+ $date_switcher = get_option('display_jump');
1440
+
1441
+ if ($date_switcher == 'true') {
1442
+ $my_calendar_body .= mc_build_date_switcher();
1443
+ }
1444
+
1445
+ // The header of the calendar table and the links. Note calls to link functions
1446
+ $my_calendar_body .= '
1447
+ <div class="my-calendar-nav">
1448
+ <ul>
1449
+ <li class="my-calendar-prev">' . my_calendar_prev_link($c_year,$c_month,$format) . '</li>
1450
+ <li class="my-calendar-next">' . my_calendar_next_link($c_year,$c_month,$format) . '</li>
1451
+ </ul>
1452
+ </div>
1453
+ </div>';
1454
+ }
1455
+ // If in calendar format, print the headings of the days of the week
1456
+ //$my_calendar_body .= "$format, $category, $name";
1457
+ if ( $format == "calendar" || $format == "mini" ) {
1458
+ $my_calendar_body .= "<thead>\n<tr>\n";
1459
+ for ($i=0; $i<=6; $i++) {
1460
+ // Colors need to be different if the starting day of the week is different
1461
+ if (get_option('start_of_week') == 0) {
1462
+ $my_calendar_body .= '<th scope="col" class="'.($i<6&&$i>0?'day-heading':'weekend-heading').'">'.$name_days[$i]."</th>\n";
1463
+ } else {
1464
+ $my_calendar_body .= '<th scope="col" class="'.($i<5?'day-heading':'weekend-heading').'">'.$name_days[$i]."</th>\n";
1465
+ }
1466
+ }
1467
+ $my_calendar_body .= "</tr>\n</thead>\n<tbody>";
1468
+
1469
+ for ($i=1; $i<=$days_in_month;) {
1470
+ $my_calendar_body .= '<tr>';
1471
+ for ($ii=0; $ii<=6; $ii++) {
1472
+ if ($ii==$first_weekday && $i==1) {
1473
+ $go = TRUE;
1474
+ } elseif ($i > $days_in_month ) {
1475
+ $go = FALSE;
1476
+ }
1477
+
1478
+ if ($go) {
1479
+ // Colors again, this time for the day numbers
1480
+ $grabbed_events = my_calendar_grab_events($c_year,$c_month,$i,$category);
1481
+ $events_class = '';
1482
+ if (!count($grabbed_events)) {
1483
+ $events_class = ' no-events';
1484
+ $element = 'span';
1485
+ $trigger = '';
1486
+ } else {
1487
+ $events_class = ' has-events';
1488
+ if ($format == 'mini') {
1489
+ $element = 'a href="#"';
1490
+ $trigger = ' trigger';
1491
+ } else {
1492
+ $element = 'span';
1493
+ $trigger = '';
1494
+ }
1495
+ }
1496
+ if (get_option('start_of_week') == 0) {
1497
+ $my_calendar_body .= '<td class="'.(date("Ymd", mktime (0,0,0,$c_month,$i,$c_year))==date_i18n("Ymd",time())?'current-day':'day-with-date').$events_class.'">'."\n <$element class='mc-date ".($ii<6&&$ii>0?"$trigger":"weekend$trigger")."'>".$i++."</$element>\n ". my_calendar_draw_events($grabbed_events, $format) . "\n</td>\n";
1498
+ } else {
1499
+ $my_calendar_body .= '<td class="'.(date("Ymd", mktime (0,0,0,$c_month,$i,$c_year))==date_i18n("Ymd",time())?'current-day':'day-with-date').$events_class.'">'."\n <$element class='mc-date ".($ii<5?"$trigger":"weekend$trigger'")."'>".$i++."</$element>\n ". my_calendar_draw_events($grabbed_events, $format) . "\n</td>\n";
1500
+ }
1501
+ } else {
1502
+ $my_calendar_body .= "<td class='day-without-date'>&nbsp;</td>\n";
1503
+ }
1504
+ }
1505
+ $my_calendar_body .= "</tr>";
1506
+ }
1507
+ $my_calendar_body .= "\n</tbody>\n</table>";
1508
+ } else if ($format == "list") {
1509
+ $my_calendar_body .= "<ul id=\"calendar-list\">";
1510
+ // show calendar as list
1511
+ $date_format = get_option('my_calendar_date_format');
1512
+ if ($date_format == "") {
1513
+ $date_format = "l, F j, Y";
1514
+ }
1515
+ $num_months = get_option('my_calendar_show_months');
1516
+ $num_events = 0;
1517
+ for ($m=0;$m<$num_months;$m++) {
1518
+ if ($m == 0) {
1519
+ $add_month = 0;
1520
+ } else {
1521
+ $add_month = 1;
1522
+ }
1523
+ $c_month = (int) $c_month + $add_month;
1524
+ for ($i=1; $i<=31; $i++) {
1525
+ $grabbed_events = my_calendar_grab_events($c_year,$c_month,$i,$category);
1526
+ if (count($grabbed_events)) {
1527
+ if ( get_option('list_javascript') != 1) {
1528
+ $is_anchor = "<a href='#'>";
1529
+ $is_close_anchor = "</a>";
1530
+ } else {
1531
+ $is_anchor = $is_close_anchor = "";
1532
+ }
1533
+ $my_calendar_body .= "<li class='$class".(date("Ymd", mktime (0,0,0,$c_month,$i,$c_year))==date("Ymd",time()+($offset))?' current-day':'')."'><strong class=\"event-date\">$is_anchor".date_i18n($date_format,mktime(0,0,0,$c_month,$i,$c_year))."$is_close_anchor</strong>".my_calendar_draw_events($grabbed_events, $format)."</li>";
1534
+ $num_events++;
1535
+ }
1536
+ if (my_calendar_is_odd($num_events)) {
1537
+ $class = "odd";
1538
+ } else {
1539
+ $class = "even";
1540
+ }
1541
+ }
1542
+ }
1543
+ if ($num_events == 0) {
1544
+ $my_calendar_body .= "<li class='no-events'>".__('There are no events scheduled during this period.','my-calendar') . "</li>";
1545
+ }
1546
+ $my_calendar_body .= "</ul>";
1547
+ } else {
1548
+ $my_calendar_body .= "Unrecognized calendar format.";
1549
+ }
1550
+ if ($showkey != 'no') {
1551
+ $sql = "SELECT * FROM " . MY_CALENDAR_CATEGORIES_TABLE . " ORDER BY category_name ASC";
1552
+ $cat_details = $wpdb->get_results($sql);
1553
+ $my_calendar_body .= '<div class="category-key">
1554
+ <h3>'.__('Category Key','my-calendar')."</h3>\n<ul>\n";
1555
+
1556
+ if ( file_exists( WP_PLUGIN_DIR . '/my-calendar-custom/' ) ) {
1557
+ $path = '/my-calendar-custom';
1558
+ } else {
1559
+ $path = '/my-calendar/icons';
1560
+ }
1561
+ foreach($cat_details as $cat_detail) {
1562
+
1563
+ if ($cat_detail->category_icon != "" && get_option('my_calendar_hide_icons')!='true') {
1564
+ $my_calendar_body .= '<li><span class="category-color-sample"><img src="'.WP_PLUGIN_URL.$path.'/'.$cat_detail->category_icon.'" alt="" style="background:'.$cat_detail->category_color.';" /></span>'.$cat_detail->category_name."</li>\n";
1565
+ } else {
1566
+ $my_calendar_body .= '<li><span class="category-color-sample no-icon" style="background:'.$cat_detail->category_color.';"> &nbsp; </span>'.$cat_detail->category_name."</li>\n";
1567
+ }
1568
+ }
1569
+ $my_calendar_body .= "</ul>\n</div>";
1570
+ }
1571
+ //$my_calendar_body .= $wpdb->num_queries; // total number of queries
1572
+
1573
+ $my_calendar_body .= "\n</div>";
1574
+ // The actual printing is done by the shortcode function.
1575
+ return $my_calendar_body;
1576
+ }
1577
+
1578
+ function my_calendar_is_odd( $int ) {
1579
+ return( $int & 1 );
1580
+ }
1581
+
1582
+
1583
+ function mc_can_edit_event($author_id) {
1584
+ global $user_ID;
1585
+ get_currentuserinfo();
1586
+ $user = get_userdata($user_ID);
1587
+
1588
+ if ( current_user_can('create_users') ) {
1589
+ return true;
1590
+ } elseif ( $user_ID == $author_id ) {
1591
+ return true;
1592
+ } else {
1593
+ return false;
1594
+ }
1595
+ }
1596
+
1597
+ // compatibility of clone keyword between PHP 5 and 4
1598
+ if (version_compare(phpversion(), '5.0') < 0) {
1599
+ eval('
1600
+ function clone($object) {
1601
+ return $object;
1602
+ }
1603
+ ');
1604
+ }
1605
+
1606
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1607
  ?>
my-calendar.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Translation of the WordPress plugin My Calendar 1.3.8 by Joseph C Dolson.
2
  # Copyright (C) 2010 Joseph C Dolson
3
  # This file is distributed under the same license as the My Calendar package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: My Calendar 1.3.8\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/my-calendar\n"
11
- "POT-Creation-Date: 2010-06-30 15:09+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"
@@ -46,7 +46,7 @@ msgstr ""
46
  msgid "Category Icon"
47
  msgstr ""
48
 
49
- #: my-calendar-categories.php:85 my-calendar-locations.php:60
50
  msgid "Save Changes"
51
  msgstr ""
52
 
@@ -63,12 +63,12 @@ msgstr ""
63
  msgid "Add New Category"
64
  msgstr ""
65
 
66
- #: my-calendar-categories.php:139 my-calendar.php:146
67
  msgid "Manage Categories"
68
  msgstr ""
69
 
70
- #: my-calendar-categories.php:151 my-calendar-event-manager.php:741
71
- #: my-calendar-locations.php:127
72
  msgid "ID"
73
  msgstr ""
74
 
@@ -77,24 +77,23 @@ msgid "Category Color"
77
  msgstr ""
78
 
79
  #: my-calendar-categories.php:155 my-calendar-categories.php:169
80
- #: my-calendar-event-manager.php:793 my-calendar-locations.php:129
81
- #: my-calendar-locations.php:141
82
  msgid "Edit"
83
  msgstr ""
84
 
85
  #: my-calendar-categories.php:156 my-calendar-categories.php:175
86
- #: my-calendar-event-manager.php:57 my-calendar-event-manager.php:793
87
- #: my-calendar-locations.php:130 my-calendar-locations.php:142
88
  msgid "Delete"
89
  msgstr ""
90
 
91
- #: my-calendar-categories.php:172 my-calendar-event-manager.php:779
92
- #: my-calendar-settings.php:190 my-calendar-widgets.php:397
93
- #: my-calendar.php:1016
94
  msgid "N/A"
95
  msgstr ""
96
 
97
- #: my-calendar-categories.php:175 my-calendar-locations.php:142
98
  msgid "Are you sure you want to delete this category?"
99
  msgstr ""
100
 
@@ -102,14 +101,14 @@ msgstr ""
102
  msgid "There are no categories in the database - something has gone wrong!"
103
  msgstr ""
104
 
105
- #: my-calendar-event-manager.php:13 my-calendar-settings.php:216
106
  msgid ""
107
  "My Calendar has identified that you have the Calendar plugin by Kieran "
108
  "O'Shea installed. You can import those events and categories into the My "
109
  "Calendar database. Would you like to import these events?"
110
  msgstr ""
111
 
112
- #: my-calendar-event-manager.php:19 my-calendar-settings.php:222
113
  msgid "Import from Calendar"
114
  msgstr ""
115
 
@@ -133,327 +132,398 @@ msgstr ""
133
  msgid "You do not have permission to delete that event."
134
  msgstr ""
135
 
136
- #: my-calendar-event-manager.php:142 my-calendar-event-manager.php:147
137
- #: my-calendar-event-manager.php:152 my-calendar-event-manager.php:162
138
- #: my-calendar-event-manager.php:170 my-calendar-event-manager.php:179
139
- #: my-calendar-event-manager.php:187 my-calendar-event-manager.php:217
140
- #: my-calendar-event-manager.php:325 my-calendar-event-manager.php:330
141
- #: my-calendar-event-manager.php:335 my-calendar-event-manager.php:345
142
- #: my-calendar-event-manager.php:353 my-calendar-event-manager.php:362
143
- #: my-calendar-event-manager.php:370 my-calendar-event-manager.php:442
144
- #: my-calendar-event-manager.php:457
145
  msgid "Error"
146
  msgstr ""
147
 
148
- #: my-calendar-event-manager.php:142 my-calendar-event-manager.php:325
149
  msgid ""
150
  "Your event end date must be either after or the same as your event begin date"
151
  msgstr ""
152
 
153
- #: my-calendar-event-manager.php:147 my-calendar-event-manager.php:330
154
  msgid ""
155
  "Your date formatting is correct but one or more of your dates is invalid. "
156
  "Check for number of days in month and leap year related errors."
157
  msgstr ""
158
 
159
- #: my-calendar-event-manager.php:152 my-calendar-event-manager.php:335
160
  msgid ""
161
  "Both start and end dates must be entered and be in the format YYYY-MM-DD"
162
  msgstr ""
163
 
164
- #: my-calendar-event-manager.php:162 my-calendar-event-manager.php:345
165
  msgid "The time field must either be blank or be entered in the format hh:mm"
166
  msgstr ""
167
 
168
- #: my-calendar-event-manager.php:170 my-calendar-event-manager.php:353
169
  msgid ""
170
  "The URL entered must either be prefixed with http:// or be completely blank"
171
  msgstr ""
172
 
173
- #: my-calendar-event-manager.php:179 my-calendar-event-manager.php:362
174
- msgid "The event title must be between 1 and 60 characters in length."
175
  msgstr ""
176
 
177
- #: my-calendar-event-manager.php:187 my-calendar-event-manager.php:370
178
  msgid ""
179
  "The repetition value must be 0 unless a type of recurrance is selected in "
180
  "which case the repetition value must be 0 or higher"
181
  msgstr ""
182
 
183
- #: my-calendar-event-manager.php:217
184
  msgid ""
185
  "An event with the details you submitted could not be found in the database. "
186
  "This may indicate a problem with your database or the way in which it is "
187
  "configured."
188
  msgstr ""
189
 
190
- #: my-calendar-event-manager.php:221
191
  msgid "Event added. It will now show in your calendar."
192
  msgstr ""
193
 
194
- #: my-calendar-event-manager.php:302 my-calendar-event-manager.php:401
195
  msgid "Failure"
196
  msgstr ""
197
 
198
- #: my-calendar-event-manager.php:302
199
  msgid "You can't update an event if you haven't submitted an event id"
200
  msgstr ""
201
 
202
- #: my-calendar-event-manager.php:401
203
- msgid ""
204
- "The database failed to return data to indicate the event has been updated "
205
- "sucessfully. This may indicate a problem with your database or the way in "
206
- "which it is configured."
207
  msgstr ""
208
 
209
- #: my-calendar-event-manager.php:405
210
  msgid "Event updated successfully"
211
  msgstr ""
212
 
213
- #: my-calendar-event-manager.php:433
214
  msgid "You do not have sufficient permissions to edit that event."
215
  msgstr ""
216
 
217
- #: my-calendar-event-manager.php:442
218
  msgid "You can't delete an event if you haven't submitted an event id"
219
  msgstr ""
220
 
221
- #: my-calendar-event-manager.php:453
222
  msgid "Event deleted successfully"
223
  msgstr ""
224
 
225
- #: my-calendar-event-manager.php:457
226
  msgid ""
227
  "Despite issuing a request to delete, the event still remains in the "
228
  "database. Please investigate."
229
  msgstr ""
230
 
231
- #: my-calendar-event-manager.php:472 my-calendar-event-manager.php:545
232
  msgid "Edit Event"
233
  msgstr ""
234
 
235
- #: my-calendar-event-manager.php:476
236
  msgid "You must provide an event id in order to edit it"
237
  msgstr ""
238
 
239
- #: my-calendar-event-manager.php:482
240
  msgid "Add Event"
241
  msgstr ""
242
 
243
- #: my-calendar-event-manager.php:487
244
  msgid "Manage Events"
245
  msgstr ""
246
 
247
- #: my-calendar-event-manager.php:521
248
  msgid "Sorry! That's an invalid event key."
249
  msgstr ""
250
 
251
- #: my-calendar-event-manager.php:526
252
  msgid "Sorry! We couldn't find an event with that ID."
253
  msgstr ""
254
 
255
- #: my-calendar-event-manager.php:545
256
  msgid "Add an Event"
257
  msgstr ""
258
 
259
- #: my-calendar-event-manager.php:554
260
  msgid "Enter your Event Information"
261
  msgstr ""
262
 
263
- #: my-calendar-event-manager.php:556
264
  msgid "Event Title"
265
  msgstr ""
266
 
267
- #: my-calendar-event-manager.php:559
268
  msgid ""
269
  "Event Description (<abbr title=\"hypertext markup language\">HTML</abbr> "
270
  "allowed)"
271
  msgstr ""
272
 
273
- #: my-calendar-event-manager.php:562
274
  msgid "Event Category"
275
  msgstr ""
276
 
277
- #: my-calendar-event-manager.php:581
278
  msgid "Event Link (Optional)"
279
  msgstr ""
280
 
281
- #: my-calendar-event-manager.php:584
 
 
 
 
282
  msgid "Start Date (YYYY-MM-DD)"
283
  msgstr ""
284
 
285
- #: my-calendar-event-manager.php:587
286
  msgid "End Date (YYYY-MM-DD) (Optional)"
287
  msgstr ""
288
 
289
- #: my-calendar-event-manager.php:590
290
  msgid "Time (hh:mm)"
291
  msgstr ""
292
 
293
- #: my-calendar-event-manager.php:601
294
  msgid ""
295
  "Optional, set blank if your event is an all-day event or does not happen at "
296
  "a specific time."
297
  msgstr ""
298
 
299
- #: my-calendar-event-manager.php:601
300
  msgid "Current time difference from GMT is "
301
  msgstr ""
302
 
303
- #: my-calendar-event-manager.php:601
304
  msgid " hour(s)"
305
  msgstr ""
306
 
307
- #: my-calendar-event-manager.php:605
 
 
 
 
 
 
 
 
 
308
  msgid "Recurring Events"
309
  msgstr ""
310
 
311
- #: my-calendar-event-manager.php:626
312
  msgid "Repeats for"
313
  msgstr ""
314
 
315
- #: my-calendar-event-manager.php:627
316
  msgid "Units"
317
  msgstr ""
318
 
319
- #: my-calendar-event-manager.php:628
320
  msgid "Does not recur"
321
  msgstr ""
322
 
323
- #: my-calendar-event-manager.php:629 my-calendar-event-manager.php:769
324
  msgid "Daily"
325
  msgstr ""
326
 
327
- #: my-calendar-event-manager.php:630 my-calendar-event-manager.php:770
328
  msgid "Weekly"
329
  msgstr ""
330
 
331
- #: my-calendar-event-manager.php:631
332
  msgid "Bi-weekly"
333
  msgstr ""
334
 
335
- #: my-calendar-event-manager.php:632 my-calendar-event-manager.php:772
336
  msgid "Monthly"
337
  msgstr ""
338
 
339
- #: my-calendar-event-manager.php:633
340
  msgid "Annually"
341
  msgstr ""
342
 
343
- #: my-calendar-event-manager.php:635
344
  msgid ""
345
  "Entering 0 means forever, if a unit is selected. If the recurrance unit is "
346
  "left at \"Does not recur,\" the event will not reoccur."
347
  msgstr ""
348
 
349
- #: my-calendar-event-manager.php:642 my-calendar-locations.php:41
350
- #: my-calendar-locations.php:90
351
  msgid ""
352
  "All location fields are optional: <em>insufficient information may result in "
353
  "an inaccurate map</em>."
354
  msgstr ""
355
 
356
- #: my-calendar-event-manager.php:648
357
  msgid "Choose a preset location:"
358
  msgstr ""
359
 
360
- #: my-calendar-event-manager.php:662
361
  msgid "Add recurring locations for later use."
362
  msgstr ""
363
 
364
- #: my-calendar-event-manager.php:667 my-calendar-locations.php:44
365
- #: my-calendar-locations.php:93
366
  msgid "Name of Location (e.g. <em>Joe's Bar and Grill</em>)"
367
  msgstr ""
368
 
369
- #: my-calendar-event-manager.php:670 my-calendar-locations.php:47
370
- #: my-calendar-locations.php:96
371
  msgid "Street Address"
372
  msgstr ""
373
 
374
- #: my-calendar-event-manager.php:673 my-calendar-locations.php:50
375
- #: my-calendar-locations.php:99
376
  msgid "Street Address (2)"
377
  msgstr ""
378
 
379
- #: my-calendar-event-manager.php:676 my-calendar-locations.php:53
380
- #: my-calendar-locations.php:102
381
  msgid "City"
382
  msgstr ""
383
 
384
- #: my-calendar-event-manager.php:676 my-calendar-locations.php:53
385
- #: my-calendar-locations.php:102
386
  msgid "State/Province"
387
  msgstr ""
388
 
389
- #: my-calendar-event-manager.php:676 my-calendar-locations.php:53
390
- #: my-calendar-locations.php:102
391
  msgid "Postal Code"
392
  msgstr ""
393
 
394
- #: my-calendar-event-manager.php:679 my-calendar-locations.php:56
395
- #: my-calendar-locations.php:105
396
  msgid "Country"
397
  msgstr ""
398
 
399
- #: my-calendar-event-manager.php:684
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  msgid "Save Event"
401
  msgstr ""
402
 
403
- #: my-calendar-event-manager.php:742 my-calendar-widgets.php:37
404
  #: my-calendar-widgets.php:122
405
  msgid "Title"
406
  msgstr ""
407
 
408
- #: my-calendar-event-manager.php:743
 
 
 
 
 
 
 
 
409
  msgid "Description"
410
  msgstr ""
411
 
412
- #: my-calendar-event-manager.php:744
413
  msgid "Start Date"
414
  msgstr ""
415
 
416
- #: my-calendar-event-manager.php:746
417
  msgid "Recurs"
418
  msgstr ""
419
 
420
- #: my-calendar-event-manager.php:747
421
- msgid "Repeats"
422
- msgstr ""
423
-
424
- #: my-calendar-event-manager.php:748 my-calendar-settings.php:158
425
  msgid "Author"
426
  msgstr ""
427
 
428
- #: my-calendar-event-manager.php:749
429
  msgid "Category"
430
  msgstr ""
431
 
432
- #: my-calendar-event-manager.php:750
433
  msgid "Edit / Delete"
434
  msgstr ""
435
 
436
- #: my-calendar-event-manager.php:768
437
  msgid "Never"
438
  msgstr ""
439
 
440
- #: my-calendar-event-manager.php:771
441
  msgid "Bi-Weekly"
442
  msgstr ""
443
 
444
- #: my-calendar-event-manager.php:773
445
  msgid "Yearly"
446
  msgstr ""
447
 
448
- #: my-calendar-event-manager.php:780
449
  msgid "Forever"
450
  msgstr ""
451
 
452
- #: my-calendar-event-manager.php:781
453
  msgid "Times"
454
  msgstr ""
455
 
456
- #: my-calendar-event-manager.php:803
457
  msgid "There are no events in the database!"
458
  msgstr ""
459
 
@@ -465,28 +535,34 @@ msgstr ""
465
  msgid "Shortcode Syntax"
466
  msgstr ""
467
 
468
- #: my-calendar-help.php:16
 
 
 
 
469
  msgid ""
470
  "This basic shortcode will show the calendar on a post or page including all "
471
  "categories and the category key, in a traditional month-by-month format."
472
  msgstr ""
473
 
474
- #: my-calendar-help.php:19
475
  msgid ""
476
  "The shortcode supports three attributes, <code>category</code>, "
477
- "<code>format</code> and <code>showkey</code>. There is currently only one "
478
- "alternate option for <code>format</code> &mdash; <code>list</code> &mdash; "
479
- "which will show the calendar in a list format, skipping dates without any "
480
- "events. The <code>category</code> attribute requires either the name of or "
481
- "ID number one of your event categories (the name is case-sensitive). This "
482
- "will show a calendar only including events in that category. Multiple "
483
- "categories can be specified by separating the category names or IDs using "
484
- "the pipe character: <code>|</code>. Setting <code>showkey</code> to "
485
- "<code>no</code> will prevent the category key from being displayed &mdash; "
486
- "this can be useful with single-category output."
487
- msgstr ""
488
-
489
- #: my-calendar-help.php:22
 
 
490
  msgid ""
491
  "This shortcode displays the output of the Upcoming Events widget. Without "
492
  "attributes, it will display using the settings in your widget; the "
@@ -497,17 +573,17 @@ msgid ""
497
  "shortcode. Templates work using the template codes listed below."
498
  msgstr ""
499
 
500
- #: my-calendar-help.php:25
501
  msgid ""
502
  "Predictably enough, this shortcode displays the output of the Today's Events "
503
  "widget, with two configurable attributes: category and template."
504
  msgstr ""
505
 
506
- #: my-calendar-help.php:33
507
  msgid "Category Icons"
508
  msgstr ""
509
 
510
- #: my-calendar-help.php:36
511
  msgid ""
512
  "My Calendar is designed to manage multiple calendars. The basis for these "
513
  "calendars are categories; you can easily setup a calendar page which "
@@ -517,7 +593,7 @@ msgid ""
517
  "locations, etc."
518
  msgstr ""
519
 
520
- #: my-calendar-help.php:39
521
  msgid ""
522
  "The pre-installed category icons may not be especially useful for your needs "
523
  "or design. I'm assuming that you're going to upload your own icons -- all "
@@ -526,97 +602,101 @@ msgid ""
526
  "custom\" to avoid having them overwritten by upgrades."
527
  msgstr ""
528
 
529
- #: my-calendar-help.php:39
530
  msgid "Your icons folder is:"
531
  msgstr ""
532
 
533
- #: my-calendar-help.php:39
534
  msgid "You can alternately place icons in:"
535
  msgstr ""
536
 
537
- #: my-calendar-help.php:47
538
  msgid "Widget Templating"
539
  msgstr ""
540
 
541
- #: my-calendar-help.php:50
542
  msgid ""
543
  "These codes are available in calendar widgets to create your own custom "
544
  "calendar format."
545
  msgstr ""
546
 
547
- #: my-calendar-help.php:54
548
  msgid "Displays the name of the category the event is in."
549
  msgstr ""
550
 
551
- #: my-calendar-help.php:57
552
  msgid "Displays the title of the event."
553
  msgstr ""
554
 
555
- #: my-calendar-help.php:60
556
  msgid "Displays the start time for the event."
557
  msgstr ""
558
 
559
- #: my-calendar-help.php:63
560
  msgid "Displays the date on which the event begins."
561
  msgstr ""
562
 
563
- #: my-calendar-help.php:66
564
  msgid "Displays the date on which the event ends."
565
  msgstr ""
566
 
567
- #: my-calendar-help.php:69
 
 
 
 
568
  msgid "Displays the WordPress author who posted the event."
569
  msgstr ""
570
 
571
- #: my-calendar-help.php:72
572
  msgid "Displays the URL provided for the event."
573
  msgstr ""
574
 
575
- #: my-calendar-help.php:75
576
  msgid "Displays the description of the event."
577
  msgstr ""
578
 
579
- #: my-calendar-help.php:78
580
  msgid ""
581
  "Displays title of the event as a link if a URL is present, or the title "
582
  "alone if no URL is available."
583
  msgstr ""
584
 
585
- #: my-calendar-help.php:81
586
  msgid "Displays the name of the location of the event."
587
  msgstr ""
588
 
589
- #: my-calendar-help.php:84
590
  msgid "Displays the first line of the site address."
591
  msgstr ""
592
 
593
- #: my-calendar-help.php:87
594
  msgid "Displays the second line of the site address."
595
  msgstr ""
596
 
597
- #: my-calendar-help.php:90
598
  msgid "Displays the city for the event."
599
  msgstr ""
600
 
601
- #: my-calendar-help.php:93
602
  msgid "Displays the state for the event."
603
  msgstr ""
604
 
605
- #: my-calendar-help.php:96
606
  msgid "Displays the postcode for the event."
607
  msgstr ""
608
 
609
- #: my-calendar-help.php:99
610
  msgid "Displays the country for the event location."
611
  msgstr ""
612
 
613
- #: my-calendar-help.php:102
614
  msgid ""
615
  "Displays the event address in <a href=\"http://microformats.org/wiki/hcard"
616
  "\">hcard</a> format."
617
  msgstr ""
618
 
619
- #: my-calendar-help.php:105
620
  msgid ""
621
  "Displays a link to a Google Map of the event, if sufficient address "
622
  "information is available. If not, will be empty."
@@ -638,31 +718,27 @@ msgstr ""
638
  msgid "Location Editor"
639
  msgstr ""
640
 
641
- #: my-calendar-locations.php:70
642
  msgid "Location edited successfully"
643
  msgstr ""
644
 
645
- #: my-calendar-locations.php:76 my-calendar-locations.php:109
646
  msgid "Add Location"
647
  msgstr ""
648
 
649
- #: my-calendar-locations.php:80
650
  msgid "Add New Location"
651
  msgstr ""
652
 
653
- #: my-calendar-locations.php:115 my-calendar.php:147
654
  msgid "Manage Locations"
655
  msgstr ""
656
 
657
- #: my-calendar-locations.php:128
658
- msgid "Location"
659
- msgstr ""
660
-
661
- #: my-calendar-locations.php:150
662
  msgid "There are no locations in the database yet!"
663
  msgstr ""
664
 
665
- #: my-calendar-locations.php:154
666
  msgid ""
667
  "Please note: editing or deleting locations stored for re-use will have no "
668
  "effect on any event previously scheduled at that location. The location "
@@ -686,178 +762,225 @@ msgstr ""
686
  msgid "Events not imported."
687
  msgstr ""
688
 
689
- #: my-calendar-settings.php:122
690
  msgid "Settings saved"
691
  msgstr ""
692
 
693
- #: my-calendar-settings.php:145
694
  msgid "My Calendar Options"
695
  msgstr ""
696
 
697
- #: my-calendar-settings.php:149
698
  msgid "Calendar Settings"
699
  msgstr ""
700
 
701
- #: my-calendar-settings.php:153
702
  msgid "Calendar Options: Management"
703
  msgstr ""
704
 
705
- #: my-calendar-settings.php:155
706
  msgid "Choose the lowest user group that may manage events"
707
  msgstr ""
708
 
709
- #: my-calendar-settings.php:156
710
  msgid "Subscriber"
711
  msgstr ""
712
 
713
- #: my-calendar-settings.php:157
714
  msgid "Contributor"
715
  msgstr ""
716
 
717
- #: my-calendar-settings.php:159
718
  msgid "Editor"
719
  msgstr ""
720
 
721
- #: my-calendar-settings.php:160
722
  msgid "Administrator"
723
  msgstr ""
724
 
725
- #: my-calendar-settings.php:165
726
  msgid "Calendar Options: Output"
727
  msgstr ""
728
 
729
- #: my-calendar-settings.php:167
730
  msgid "Do you want to display the author name on events?"
731
  msgstr ""
732
 
733
- #: my-calendar-settings.php:168 my-calendar-settings.php:175
734
  msgid "Yes"
735
  msgstr ""
736
 
737
- #: my-calendar-settings.php:169 my-calendar-settings.php:176
738
  msgid "No"
739
  msgstr ""
740
 
741
- #: my-calendar-settings.php:174
742
  msgid "Display a jumpbox for changing month and year quickly?"
743
  msgstr ""
744
 
745
- #: my-calendar-settings.php:180
746
  msgid "In list mode, show how many months of events at a time:"
747
  msgstr ""
748
 
749
- #: my-calendar-settings.php:183
750
  msgid "Date format in list mode"
751
  msgstr ""
752
 
753
- #: my-calendar-settings.php:184
754
  msgid ""
755
  "Date format uses the same syntax as the <a href=\"http://php.net/date\">PHP "
756
  "<code>date()</code> function</a>. Save option to update sample output."
757
  msgstr ""
758
 
759
- #: my-calendar-settings.php:187
760
  msgid "Show Heading for Calendar"
761
  msgstr ""
762
 
763
- #: my-calendar-settings.php:190
764
  msgid "Label for events without a specific time"
765
  msgstr ""
766
 
767
- #: my-calendar-settings.php:193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768
  msgid "Additional caption text"
769
  msgstr ""
770
 
771
- #: my-calendar-settings.php:193
772
  msgid ""
773
  "The calendar caption is the text containing the displayed month and year in "
774
  "either list or calendar format. This text will be displayed following that "
775
  "existing text."
776
  msgstr ""
777
 
778
- #: my-calendar-settings.php:196
779
  msgid "Hide category icons in output"
780
  msgstr ""
781
 
782
- #: my-calendar-settings.php:199
783
  msgid ""
784
  "Show Link to Google Map (when sufficient address information is available.)"
785
  msgstr ""
786
 
787
- #: my-calendar-settings.php:202
788
  msgid "Show Event Address in Details"
789
  msgstr ""
790
 
791
- #: my-calendar-settings.php:206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
  msgid "Save Settings"
793
  msgstr ""
794
 
795
- #: my-calendar-styles.php:38
796
  msgid "Style Settings saved"
797
  msgstr ""
798
 
799
- #: my-calendar-styles.php:59
800
  msgid "My Calendar Styles"
801
  msgstr ""
802
 
803
- #: my-calendar-styles.php:63
804
  msgid "Calendar Style Settings"
805
  msgstr ""
806
 
807
- #: my-calendar-styles.php:67
 
 
 
 
808
  msgid "CSS Style Options"
809
  msgstr ""
810
 
811
- #: my-calendar-styles.php:69
812
  msgid "Reset the My Calendar stylesheet to the default"
813
  msgstr ""
814
 
815
- #: my-calendar-styles.php:69
816
  msgid "Disable My Calendar Stylesheet"
817
  msgstr ""
818
 
819
- #: my-calendar-styles.php:72
820
  msgid "Edit the stylesheet for My Calendar"
821
  msgstr ""
822
 
823
- #: my-calendar-styles.php:75
824
- msgid "Show CSS only on these pages (comma separated page IDs)"
 
825
  msgstr ""
826
 
827
- #: my-calendar-styles.php:79
828
  msgid "Calendar Behaviors: Calendar View"
829
  msgstr ""
830
 
831
- #: my-calendar-styles.php:81
832
  msgid "Reset the My Calendar Calendar Javascript"
833
  msgstr ""
834
 
835
- #: my-calendar-styles.php:81
836
  msgid "Disable Calendar Javascript Effects"
837
  msgstr ""
838
 
839
- #: my-calendar-styles.php:84
840
  msgid "Edit the jQuery scripts for My Calendar in Calendar format"
841
  msgstr ""
842
 
843
- #: my-calendar-styles.php:88
844
  msgid "Calendar Behaviors: List View"
845
  msgstr ""
846
 
847
- #: my-calendar-styles.php:90
848
  msgid "Reset the My Calendar List Javascript"
849
  msgstr ""
850
 
851
- #: my-calendar-styles.php:90
852
  msgid "Disable List Javascript Effects"
853
  msgstr ""
854
 
855
- #: my-calendar-styles.php:93
856
  msgid "Edit the jQuery scripts for My Calendar in List format"
857
  msgstr ""
858
 
859
- #: my-calendar-styles.php:97
860
- msgid "Save"
 
 
 
 
 
 
 
 
861
  msgstr ""
862
 
863
  #: my-calendar-widgets.php:11 my-calendar-widgets.php:51
@@ -918,167 +1041,189 @@ msgstr ""
918
  msgid "There are no events currently scheduled."
919
  msgstr ""
920
 
921
- #: my-calendar.php:48 my-calendar.php:148
922
  msgid "Settings"
923
  msgstr ""
924
 
925
- #: my-calendar.php:69
 
 
 
 
926
  msgid "Get Support"
927
  msgstr ""
928
 
929
- #: my-calendar.php:70
 
 
 
 
930
  msgid "Make a Donation"
931
  msgstr ""
932
 
933
- #. #-#-#-#-# plugin.pot (My Calendar 1.3.8) #-#-#-#-#
934
  #. Plugin Name of the plugin/theme
935
- #: my-calendar.php:139
936
  msgid "My Calendar"
937
  msgstr ""
938
 
939
- #: my-calendar.php:142
940
  msgid "Add/Edit Events"
941
  msgstr ""
942
 
943
- #: my-calendar.php:149
944
  msgid "Style Editor"
945
  msgstr ""
946
 
947
- #: my-calendar.php:150
948
- msgid "My Calendar Help"
949
- msgstr ""
950
-
951
- #: my-calendar.php:150
952
- msgid "Help"
953
- msgstr ""
954
-
955
- #: my-calendar.php:873 my-calendar.php:877 my-calendar.php:887
956
- #: my-calendar.php:889
957
- msgid "Next Events"
958
- msgstr ""
959
-
960
- #: my-calendar.php:902 my-calendar.php:906 my-calendar.php:916
961
- #: my-calendar.php:918
962
- msgid "Previous Events"
963
  msgstr ""
964
 
965
- #: my-calendar.php:1008
966
- msgid "Event Details"
967
  msgstr ""
968
 
969
- #: my-calendar.php:1016
970
  msgid "Not Applicable"
971
  msgstr ""
972
 
973
- #: my-calendar.php:1028
974
  msgid "Posted by"
975
  msgstr ""
976
 
977
- #: my-calendar.php:1712
978
  msgid "Month"
979
  msgstr ""
980
 
981
- #: my-calendar.php:1713 my-calendar.php:1776
982
  msgid "January"
983
  msgstr ""
984
 
985
- #: my-calendar.php:1714 my-calendar.php:1776
986
  msgid "February"
987
  msgstr ""
988
 
989
- #: my-calendar.php:1715 my-calendar.php:1776
990
  msgid "March"
991
  msgstr ""
992
 
993
- #: my-calendar.php:1716 my-calendar.php:1776
994
  msgid "April"
995
  msgstr ""
996
 
997
- #: my-calendar.php:1717 my-calendar.php:1776
998
  msgid "May"
999
  msgstr ""
1000
 
1001
- #: my-calendar.php:1718 my-calendar.php:1776
1002
  msgid "June"
1003
  msgstr ""
1004
 
1005
- #: my-calendar.php:1719 my-calendar.php:1776
1006
  msgid "July"
1007
  msgstr ""
1008
 
1009
- #: my-calendar.php:1720 my-calendar.php:1776
1010
  msgid "August"
1011
  msgstr ""
1012
 
1013
- #: my-calendar.php:1721 my-calendar.php:1776
1014
  msgid "September"
1015
  msgstr ""
1016
 
1017
- #: my-calendar.php:1722 my-calendar.php:1776
1018
  msgid "October"
1019
  msgstr ""
1020
 
1021
- #: my-calendar.php:1723 my-calendar.php:1776
1022
  msgid "November"
1023
  msgstr ""
1024
 
1025
- #: my-calendar.php:1724 my-calendar.php:1776
1026
  msgid "December"
1027
  msgstr ""
1028
 
1029
- #: my-calendar.php:1726
1030
  msgid "Year"
1031
  msgstr ""
1032
 
1033
- #: my-calendar.php:1751
1034
  msgid "Go"
1035
  msgstr ""
1036
 
1037
- #: my-calendar.php:1769 my-calendar.php:1772
1038
  msgid "<abbr title=\"Sunday\">Sun</abbr>"
1039
  msgstr ""
1040
 
1041
- #: my-calendar.php:1769 my-calendar.php:1772
1042
  msgid "<abbr title=\"Monday\">Mon</abbr>"
1043
  msgstr ""
1044
 
1045
- #: my-calendar.php:1769 my-calendar.php:1772
1046
  msgid "<abbr title=\"Tuesday\">Tues</abbr>"
1047
  msgstr ""
1048
 
1049
- #: my-calendar.php:1769 my-calendar.php:1772
1050
  msgid "<abbr title=\"Wednesday\">Wed</abbr>"
1051
  msgstr ""
1052
 
1053
- #: my-calendar.php:1769 my-calendar.php:1772
1054
  msgid "<abbr title=\"Thursday\">Thur</abbr>"
1055
  msgstr ""
1056
 
1057
- #: my-calendar.php:1769 my-calendar.php:1772
1058
  msgid "<abbr title=\"Friday\">Fri</abbr>"
1059
  msgstr ""
1060
 
1061
- #: my-calendar.php:1769 my-calendar.php:1772
1062
  msgid "<abbr title=\"Saturday\">Sat</abbr>"
1063
  msgstr ""
1064
 
1065
- #: my-calendar.php:1831
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1066
  msgid "and"
1067
  msgstr ""
1068
 
1069
- #: my-calendar.php:1860 my-calendar.php:1864
1070
  msgid "Calendar"
1071
  msgstr ""
1072
 
1073
- #: my-calendar.php:1868
1074
  msgid "Events in"
1075
  msgstr ""
1076
 
1077
- #: my-calendar.php:1977
1078
  msgid "There are no events scheduled during this period."
1079
  msgstr ""
1080
 
1081
- #: my-calendar.php:1987
1082
  msgid "Category Key"
1083
  msgstr ""
1084
 
1
+ # Translation of the WordPress plugin My Calendar 1.4.0 by Joseph C Dolson.
2
  # Copyright (C) 2010 Joseph C Dolson
3
  # This file is distributed under the same license as the My Calendar package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: My Calendar 1.4.0\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/my-calendar\n"
11
+ "POT-Creation-Date: 2010-07-26 23:08+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"
46
  msgid "Category Icon"
47
  msgstr ""
48
 
49
+ #: my-calendar-categories.php:85 my-calendar-locations.php:79
50
  msgid "Save Changes"
51
  msgstr ""
52
 
63
  msgid "Add New Category"
64
  msgstr ""
65
 
66
+ #: my-calendar-categories.php:139 my-calendar.php:168
67
  msgid "Manage Categories"
68
  msgstr ""
69
 
70
+ #: my-calendar-categories.php:151 my-calendar-event-manager.php:833
71
+ #: my-calendar-locations.php:168
72
  msgid "ID"
73
  msgstr ""
74
 
77
  msgstr ""
78
 
79
  #: my-calendar-categories.php:155 my-calendar-categories.php:169
80
+ #: my-calendar-event-manager.php:884 my-calendar-locations.php:170
81
+ #: my-calendar-locations.php:182
82
  msgid "Edit"
83
  msgstr ""
84
 
85
  #: my-calendar-categories.php:156 my-calendar-categories.php:175
86
+ #: my-calendar-event-manager.php:57 my-calendar-event-manager.php:884
87
+ #: my-calendar-locations.php:171 my-calendar-locations.php:183
88
  msgid "Delete"
89
  msgstr ""
90
 
91
+ #: my-calendar-categories.php:172 my-calendar-event-manager.php:870
92
+ #: my-calendar-settings.php:204 my-calendar.php:694
 
93
  msgid "N/A"
94
  msgstr ""
95
 
96
+ #: my-calendar-categories.php:175 my-calendar-locations.php:183
97
  msgid "Are you sure you want to delete this category?"
98
  msgstr ""
99
 
101
  msgid "There are no categories in the database - something has gone wrong!"
102
  msgstr ""
103
 
104
+ #: my-calendar-event-manager.php:13 my-calendar-settings.php:244
105
  msgid ""
106
  "My Calendar has identified that you have the Calendar plugin by Kieran "
107
  "O'Shea installed. You can import those events and categories into the My "
108
  "Calendar database. Would you like to import these events?"
109
  msgstr ""
110
 
111
+ #: my-calendar-event-manager.php:19 my-calendar-settings.php:250
112
  msgid "Import from Calendar"
113
  msgstr ""
114
 
132
  msgid "You do not have permission to delete that event."
133
  msgstr ""
134
 
135
+ #: my-calendar-event-manager.php:156 my-calendar-event-manager.php:161
136
+ #: my-calendar-event-manager.php:166 my-calendar-event-manager.php:176
137
+ #: my-calendar-event-manager.php:184 my-calendar-event-manager.php:193
138
+ #: my-calendar-event-manager.php:201 my-calendar-event-manager.php:239
139
+ #: my-calendar-event-manager.php:368 my-calendar-event-manager.php:373
140
+ #: my-calendar-event-manager.php:378 my-calendar-event-manager.php:388
141
+ #: my-calendar-event-manager.php:396 my-calendar-event-manager.php:405
142
+ #: my-calendar-event-manager.php:413 my-calendar-event-manager.php:498
143
+ #: my-calendar-event-manager.php:513
144
  msgid "Error"
145
  msgstr ""
146
 
147
+ #: my-calendar-event-manager.php:156 my-calendar-event-manager.php:368
148
  msgid ""
149
  "Your event end date must be either after or the same as your event begin date"
150
  msgstr ""
151
 
152
+ #: my-calendar-event-manager.php:161 my-calendar-event-manager.php:373
153
  msgid ""
154
  "Your date formatting is correct but one or more of your dates is invalid. "
155
  "Check for number of days in month and leap year related errors."
156
  msgstr ""
157
 
158
+ #: my-calendar-event-manager.php:166 my-calendar-event-manager.php:378
159
  msgid ""
160
  "Both start and end dates must be entered and be in the format YYYY-MM-DD"
161
  msgstr ""
162
 
163
+ #: my-calendar-event-manager.php:176 my-calendar-event-manager.php:388
164
  msgid "The time field must either be blank or be entered in the format hh:mm"
165
  msgstr ""
166
 
167
+ #: my-calendar-event-manager.php:184 my-calendar-event-manager.php:396
168
  msgid ""
169
  "The URL entered must either be prefixed with http:// or be completely blank"
170
  msgstr ""
171
 
172
+ #: my-calendar-event-manager.php:193 my-calendar-event-manager.php:405
173
+ msgid "The event title must be between 1 and 255 characters in length."
174
  msgstr ""
175
 
176
+ #: my-calendar-event-manager.php:201 my-calendar-event-manager.php:413
177
  msgid ""
178
  "The repetition value must be 0 unless a type of recurrance is selected in "
179
  "which case the repetition value must be 0 or higher"
180
  msgstr ""
181
 
182
+ #: my-calendar-event-manager.php:239
183
  msgid ""
184
  "An event with the details you submitted could not be found in the database. "
185
  "This may indicate a problem with your database or the way in which it is "
186
  "configured."
187
  msgstr ""
188
 
189
+ #: my-calendar-event-manager.php:243
190
  msgid "Event added. It will now show in your calendar."
191
  msgstr ""
192
 
193
+ #: my-calendar-event-manager.php:345 my-calendar-event-manager.php:451
194
  msgid "Failure"
195
  msgstr ""
196
 
197
+ #: my-calendar-event-manager.php:345
198
  msgid "You can't update an event if you haven't submitted an event id"
199
  msgstr ""
200
 
201
+ #: my-calendar-event-manager.php:451
202
+ msgid "Your event was not updated."
 
 
 
203
  msgstr ""
204
 
205
+ #: my-calendar-event-manager.php:455
206
  msgid "Event updated successfully"
207
  msgstr ""
208
 
209
+ #: my-calendar-event-manager.php:489
210
  msgid "You do not have sufficient permissions to edit that event."
211
  msgstr ""
212
 
213
+ #: my-calendar-event-manager.php:498
214
  msgid "You can't delete an event if you haven't submitted an event id"
215
  msgstr ""
216
 
217
+ #: my-calendar-event-manager.php:509
218
  msgid "Event deleted successfully"
219
  msgstr ""
220
 
221
+ #: my-calendar-event-manager.php:513
222
  msgid ""
223
  "Despite issuing a request to delete, the event still remains in the "
224
  "database. Please investigate."
225
  msgstr ""
226
 
227
+ #: my-calendar-event-manager.php:528 my-calendar-event-manager.php:601
228
  msgid "Edit Event"
229
  msgstr ""
230
 
231
+ #: my-calendar-event-manager.php:532
232
  msgid "You must provide an event id in order to edit it"
233
  msgstr ""
234
 
235
+ #: my-calendar-event-manager.php:538
236
  msgid "Add Event"
237
  msgstr ""
238
 
239
+ #: my-calendar-event-manager.php:543
240
  msgid "Manage Events"
241
  msgstr ""
242
 
243
+ #: my-calendar-event-manager.php:577
244
  msgid "Sorry! That's an invalid event key."
245
  msgstr ""
246
 
247
+ #: my-calendar-event-manager.php:582
248
  msgid "Sorry! We couldn't find an event with that ID."
249
  msgstr ""
250
 
251
+ #: my-calendar-event-manager.php:601
252
  msgid "Add an Event"
253
  msgstr ""
254
 
255
+ #: my-calendar-event-manager.php:610
256
  msgid "Enter your Event Information"
257
  msgstr ""
258
 
259
+ #: my-calendar-event-manager.php:612
260
  msgid "Event Title"
261
  msgstr ""
262
 
263
+ #: my-calendar-event-manager.php:615
264
  msgid ""
265
  "Event Description (<abbr title=\"hypertext markup language\">HTML</abbr> "
266
  "allowed)"
267
  msgstr ""
268
 
269
+ #: my-calendar-event-manager.php:618
270
  msgid "Event Category"
271
  msgstr ""
272
 
273
+ #: my-calendar-event-manager.php:637
274
  msgid "Event Link (Optional)"
275
  msgstr ""
276
 
277
+ #: my-calendar-event-manager.php:637
278
+ msgid "This link will expire when the event passes."
279
+ msgstr ""
280
+
281
+ #: my-calendar-event-manager.php:640
282
  msgid "Start Date (YYYY-MM-DD)"
283
  msgstr ""
284
 
285
+ #: my-calendar-event-manager.php:643
286
  msgid "End Date (YYYY-MM-DD) (Optional)"
287
  msgstr ""
288
 
289
+ #: my-calendar-event-manager.php:646
290
  msgid "Time (hh:mm)"
291
  msgstr ""
292
 
293
+ #: my-calendar-event-manager.php:657
294
  msgid ""
295
  "Optional, set blank if your event is an all-day event or does not happen at "
296
  "a specific time."
297
  msgstr ""
298
 
299
+ #: my-calendar-event-manager.php:657
300
  msgid "Current time difference from GMT is "
301
  msgstr ""
302
 
303
+ #: my-calendar-event-manager.php:657
304
  msgid " hour(s)"
305
  msgstr ""
306
 
307
+ #: my-calendar-event-manager.php:660
308
+ msgid "End Time (hh:mm)"
309
+ msgstr ""
310
+
311
+ #: my-calendar-event-manager.php:671
312
+ msgid ""
313
+ "Optional. End times will not be displayed on events where this is not set."
314
+ msgstr ""
315
+
316
+ #: my-calendar-event-manager.php:675
317
  msgid "Recurring Events"
318
  msgstr ""
319
 
320
+ #: my-calendar-event-manager.php:696
321
  msgid "Repeats for"
322
  msgstr ""
323
 
324
+ #: my-calendar-event-manager.php:697
325
  msgid "Units"
326
  msgstr ""
327
 
328
+ #: my-calendar-event-manager.php:698
329
  msgid "Does not recur"
330
  msgstr ""
331
 
332
+ #: my-calendar-event-manager.php:699 my-calendar-event-manager.php:863
333
  msgid "Daily"
334
  msgstr ""
335
 
336
+ #: my-calendar-event-manager.php:700 my-calendar-event-manager.php:864
337
  msgid "Weekly"
338
  msgstr ""
339
 
340
+ #: my-calendar-event-manager.php:701
341
  msgid "Bi-weekly"
342
  msgstr ""
343
 
344
+ #: my-calendar-event-manager.php:702 my-calendar-event-manager.php:866
345
  msgid "Monthly"
346
  msgstr ""
347
 
348
+ #: my-calendar-event-manager.php:703
349
  msgid "Annually"
350
  msgstr ""
351
 
352
+ #: my-calendar-event-manager.php:705
353
  msgid ""
354
  "Entering 0 means forever, if a unit is selected. If the recurrance unit is "
355
  "left at \"Does not recur,\" the event will not reoccur."
356
  msgstr ""
357
 
358
+ #: my-calendar-event-manager.php:712 my-calendar-locations.php:41
359
+ #: my-calendar-locations.php:110
360
  msgid ""
361
  "All location fields are optional: <em>insufficient information may result in "
362
  "an inaccurate map</em>."
363
  msgstr ""
364
 
365
+ #: my-calendar-event-manager.php:718
366
  msgid "Choose a preset location:"
367
  msgstr ""
368
 
369
+ #: my-calendar-event-manager.php:732
370
  msgid "Add recurring locations for later use."
371
  msgstr ""
372
 
373
+ #: my-calendar-event-manager.php:737 my-calendar-locations.php:44
374
+ #: my-calendar-locations.php:113
375
  msgid "Name of Location (e.g. <em>Joe's Bar and Grill</em>)"
376
  msgstr ""
377
 
378
+ #: my-calendar-event-manager.php:740 my-calendar-locations.php:47
379
+ #: my-calendar-locations.php:116
380
  msgid "Street Address"
381
  msgstr ""
382
 
383
+ #: my-calendar-event-manager.php:743 my-calendar-locations.php:50
384
+ #: my-calendar-locations.php:119
385
  msgid "Street Address (2)"
386
  msgstr ""
387
 
388
+ #: my-calendar-event-manager.php:746 my-calendar-locations.php:53
389
+ #: my-calendar-locations.php:122
390
  msgid "City"
391
  msgstr ""
392
 
393
+ #: my-calendar-event-manager.php:746 my-calendar-locations.php:53
394
+ #: my-calendar-locations.php:122
395
  msgid "State/Province"
396
  msgstr ""
397
 
398
+ #: my-calendar-event-manager.php:746 my-calendar-locations.php:53
399
+ #: my-calendar-locations.php:122
400
  msgid "Postal Code"
401
  msgstr ""
402
 
403
+ #: my-calendar-event-manager.php:749 my-calendar-locations.php:56
404
+ #: my-calendar-locations.php:125
405
  msgid "Country"
406
  msgstr ""
407
 
408
+ #: my-calendar-event-manager.php:752 my-calendar-locations.php:59
409
+ #: my-calendar-locations.php:128
410
+ msgid "Initial Zoom"
411
+ msgstr ""
412
+
413
+ #: my-calendar-event-manager.php:754 my-calendar-locations.php:61
414
+ #: my-calendar-locations.php:130
415
+ msgid "Neighborhood"
416
+ msgstr ""
417
+
418
+ #: my-calendar-event-manager.php:755 my-calendar-locations.php:62
419
+ #: my-calendar-locations.php:131
420
+ msgid "Small City"
421
+ msgstr ""
422
+
423
+ #: my-calendar-event-manager.php:756 my-calendar-locations.php:63
424
+ #: my-calendar-locations.php:132
425
+ msgid "Large City"
426
+ msgstr ""
427
+
428
+ #: my-calendar-event-manager.php:757 my-calendar-locations.php:64
429
+ #: my-calendar-locations.php:133
430
+ msgid "Greater Metro Area"
431
+ msgstr ""
432
+
433
+ #: my-calendar-event-manager.php:758 my-calendar-locations.php:65
434
+ #: my-calendar-locations.php:134
435
+ msgid "State"
436
+ msgstr ""
437
+
438
+ #: my-calendar-event-manager.php:759 my-calendar-locations.php:66
439
+ #: my-calendar-locations.php:135
440
+ msgid "Region"
441
+ msgstr ""
442
+
443
+ #: my-calendar-event-manager.php:763 my-calendar-locations.php:70
444
+ #: my-calendar-locations.php:139
445
+ msgid "GPS Coordinates (optional)"
446
+ msgstr ""
447
+
448
+ #: my-calendar-event-manager.php:765 my-calendar-locations.php:72
449
+ #: my-calendar-locations.php:141
450
+ msgid ""
451
+ "If you supply GPS coordinates for your location, they will be used in place "
452
+ "of any other address information to pinpoint your location."
453
+ msgstr ""
454
+
455
+ #: my-calendar-event-manager.php:768 my-calendar-locations.php:75
456
+ #: my-calendar-locations.php:144
457
+ msgid "Longitude"
458
+ msgstr ""
459
+
460
+ #: my-calendar-event-manager.php:768 my-calendar-locations.php:75
461
+ #: my-calendar-locations.php:144
462
+ msgid "Latitude"
463
+ msgstr ""
464
+
465
+ #: my-calendar-event-manager.php:774
466
  msgid "Save Event"
467
  msgstr ""
468
 
469
+ #: my-calendar-event-manager.php:834 my-calendar-widgets.php:37
470
  #: my-calendar-widgets.php:122
471
  msgid "Title"
472
  msgstr ""
473
 
474
+ #: my-calendar-event-manager.php:835
475
+ msgid "Link"
476
+ msgstr ""
477
+
478
+ #: my-calendar-event-manager.php:836 my-calendar-locations.php:169
479
+ msgid "Location"
480
+ msgstr ""
481
+
482
+ #: my-calendar-event-manager.php:837
483
  msgid "Description"
484
  msgstr ""
485
 
486
+ #: my-calendar-event-manager.php:838
487
  msgid "Start Date"
488
  msgstr ""
489
 
490
+ #: my-calendar-event-manager.php:839
491
  msgid "Recurs"
492
  msgstr ""
493
 
494
+ #: my-calendar-event-manager.php:840 my-calendar-settings.php:172
 
 
 
 
495
  msgid "Author"
496
  msgstr ""
497
 
498
+ #: my-calendar-event-manager.php:841
499
  msgid "Category"
500
  msgstr ""
501
 
502
+ #: my-calendar-event-manager.php:842
503
  msgid "Edit / Delete"
504
  msgstr ""
505
 
506
+ #: my-calendar-event-manager.php:862
507
  msgid "Never"
508
  msgstr ""
509
 
510
+ #: my-calendar-event-manager.php:865
511
  msgid "Bi-Weekly"
512
  msgstr ""
513
 
514
+ #: my-calendar-event-manager.php:867
515
  msgid "Yearly"
516
  msgstr ""
517
 
518
+ #: my-calendar-event-manager.php:871
519
  msgid "Forever"
520
  msgstr ""
521
 
522
+ #: my-calendar-event-manager.php:872
523
  msgid "Times"
524
  msgstr ""
525
 
526
+ #: my-calendar-event-manager.php:894
527
  msgid "There are no events in the database!"
528
  msgstr ""
529
 
535
  msgid "Shortcode Syntax"
536
  msgstr ""
537
 
538
+ #: my-calendar-help.php:14
539
+ msgid "These shortcodes can be used in Posts, Pages, or in text widgets."
540
+ msgstr ""
541
+
542
+ #: my-calendar-help.php:17
543
  msgid ""
544
  "This basic shortcode will show the calendar on a post or page including all "
545
  "categories and the category key, in a traditional month-by-month format."
546
  msgstr ""
547
 
548
+ #: my-calendar-help.php:20
549
  msgid ""
550
  "The shortcode supports three attributes, <code>category</code>, "
551
+ "<code>format</code> and <code>showkey</code>. There two alternate option for "
552
+ "<code>format</code> &mdash; <code>list</code> &mdash; which will show the "
553
+ "calendar in a list format, skipping dates without any events, and "
554
+ "<code>mini</code>, which will display the calendar in a form more suitable "
555
+ "to being displayed in smaller spaces, such as the sidebar. The "
556
+ "<code>category</code> attribute requires either the name of or ID number one "
557
+ "of your event categories (the name is case-sensitive). This will show a "
558
+ "calendar only including events in that category. Multiple categories can be "
559
+ "specified by separating the category names or IDs using the pipe character: "
560
+ "<code>|</code>. Setting <code>showkey</code> to <code>no</code> will prevent "
561
+ "the category key from being displayed &mdash; this can be useful with single-"
562
+ "category output."
563
+ msgstr ""
564
+
565
+ #: my-calendar-help.php:23
566
  msgid ""
567
  "This shortcode displays the output of the Upcoming Events widget. Without "
568
  "attributes, it will display using the settings in your widget; the "
573
  "shortcode. Templates work using the template codes listed below."
574
  msgstr ""
575
 
576
+ #: my-calendar-help.php:26
577
  msgid ""
578
  "Predictably enough, this shortcode displays the output of the Today's Events "
579
  "widget, with two configurable attributes: category and template."
580
  msgstr ""
581
 
582
+ #: my-calendar-help.php:34
583
  msgid "Category Icons"
584
  msgstr ""
585
 
586
+ #: my-calendar-help.php:37
587
  msgid ""
588
  "My Calendar is designed to manage multiple calendars. The basis for these "
589
  "calendars are categories; you can easily setup a calendar page which "
593
  "locations, etc."
594
  msgstr ""
595
 
596
+ #: my-calendar-help.php:40
597
  msgid ""
598
  "The pre-installed category icons may not be especially useful for your needs "
599
  "or design. I'm assuming that you're going to upload your own icons -- all "
602
  "custom\" to avoid having them overwritten by upgrades."
603
  msgstr ""
604
 
605
+ #: my-calendar-help.php:40
606
  msgid "Your icons folder is:"
607
  msgstr ""
608
 
609
+ #: my-calendar-help.php:40
610
  msgid "You can alternately place icons in:"
611
  msgstr ""
612
 
613
+ #: my-calendar-help.php:48
614
  msgid "Widget Templating"
615
  msgstr ""
616
 
617
+ #: my-calendar-help.php:51
618
  msgid ""
619
  "These codes are available in calendar widgets to create your own custom "
620
  "calendar format."
621
  msgstr ""
622
 
623
+ #: my-calendar-help.php:55
624
  msgid "Displays the name of the category the event is in."
625
  msgstr ""
626
 
627
+ #: my-calendar-help.php:58
628
  msgid "Displays the title of the event."
629
  msgstr ""
630
 
631
+ #: my-calendar-help.php:61
632
  msgid "Displays the start time for the event."
633
  msgstr ""
634
 
635
+ #: my-calendar-help.php:64
636
  msgid "Displays the date on which the event begins."
637
  msgstr ""
638
 
639
+ #: my-calendar-help.php:67
640
  msgid "Displays the date on which the event ends."
641
  msgstr ""
642
 
643
+ #: my-calendar-help.php:70
644
+ msgid "Displays the time at which the event ends."
645
+ msgstr ""
646
+
647
+ #: my-calendar-help.php:73
648
  msgid "Displays the WordPress author who posted the event."
649
  msgstr ""
650
 
651
+ #: my-calendar-help.php:76
652
  msgid "Displays the URL provided for the event."
653
  msgstr ""
654
 
655
+ #: my-calendar-help.php:79
656
  msgid "Displays the description of the event."
657
  msgstr ""
658
 
659
+ #: my-calendar-help.php:82
660
  msgid ""
661
  "Displays title of the event as a link if a URL is present, or the title "
662
  "alone if no URL is available."
663
  msgstr ""
664
 
665
+ #: my-calendar-help.php:85
666
  msgid "Displays the name of the location of the event."
667
  msgstr ""
668
 
669
+ #: my-calendar-help.php:88
670
  msgid "Displays the first line of the site address."
671
  msgstr ""
672
 
673
+ #: my-calendar-help.php:91
674
  msgid "Displays the second line of the site address."
675
  msgstr ""
676
 
677
+ #: my-calendar-help.php:94
678
  msgid "Displays the city for the event."
679
  msgstr ""
680
 
681
+ #: my-calendar-help.php:97
682
  msgid "Displays the state for the event."
683
  msgstr ""
684
 
685
+ #: my-calendar-help.php:100
686
  msgid "Displays the postcode for the event."
687
  msgstr ""
688
 
689
+ #: my-calendar-help.php:103
690
  msgid "Displays the country for the event location."
691
  msgstr ""
692
 
693
+ #: my-calendar-help.php:106
694
  msgid ""
695
  "Displays the event address in <a href=\"http://microformats.org/wiki/hcard"
696
  "\">hcard</a> format."
697
  msgstr ""
698
 
699
+ #: my-calendar-help.php:109
700
  msgid ""
701
  "Displays a link to a Google Map of the event, if sufficient address "
702
  "information is available. If not, will be empty."
718
  msgid "Location Editor"
719
  msgstr ""
720
 
721
+ #: my-calendar-locations.php:90
722
  msgid "Location edited successfully"
723
  msgstr ""
724
 
725
+ #: my-calendar-locations.php:96 my-calendar-locations.php:148
726
  msgid "Add Location"
727
  msgstr ""
728
 
729
+ #: my-calendar-locations.php:100
730
  msgid "Add New Location"
731
  msgstr ""
732
 
733
+ #: my-calendar-locations.php:156 my-calendar.php:169
734
  msgid "Manage Locations"
735
  msgstr ""
736
 
737
+ #: my-calendar-locations.php:191
 
 
 
 
738
  msgid "There are no locations in the database yet!"
739
  msgstr ""
740
 
741
+ #: my-calendar-locations.php:195
742
  msgid ""
743
  "Please note: editing or deleting locations stored for re-use will have no "
744
  "effect on any event previously scheduled at that location. The location "
762
  msgid "Events not imported."
763
  msgstr ""
764
 
765
+ #: my-calendar-settings.php:135
766
  msgid "Settings saved"
767
  msgstr ""
768
 
769
+ #: my-calendar-settings.php:159
770
  msgid "My Calendar Options"
771
  msgstr ""
772
 
773
+ #: my-calendar-settings.php:163
774
  msgid "Calendar Settings"
775
  msgstr ""
776
 
777
+ #: my-calendar-settings.php:167
778
  msgid "Calendar Options: Management"
779
  msgstr ""
780
 
781
+ #: my-calendar-settings.php:169
782
  msgid "Choose the lowest user group that may manage events"
783
  msgstr ""
784
 
785
+ #: my-calendar-settings.php:170
786
  msgid "Subscriber"
787
  msgstr ""
788
 
789
+ #: my-calendar-settings.php:171
790
  msgid "Contributor"
791
  msgstr ""
792
 
793
+ #: my-calendar-settings.php:173
794
  msgid "Editor"
795
  msgstr ""
796
 
797
+ #: my-calendar-settings.php:174
798
  msgid "Administrator"
799
  msgstr ""
800
 
801
+ #: my-calendar-settings.php:179
802
  msgid "Calendar Options: Output"
803
  msgstr ""
804
 
805
+ #: my-calendar-settings.php:181
806
  msgid "Do you want to display the author name on events?"
807
  msgstr ""
808
 
809
+ #: my-calendar-settings.php:182 my-calendar-settings.php:189
810
  msgid "Yes"
811
  msgstr ""
812
 
813
+ #: my-calendar-settings.php:183 my-calendar-settings.php:190
814
  msgid "No"
815
  msgstr ""
816
 
817
+ #: my-calendar-settings.php:188
818
  msgid "Display a jumpbox for changing month and year quickly?"
819
  msgstr ""
820
 
821
+ #: my-calendar-settings.php:194
822
  msgid "In list mode, show how many months of events at a time:"
823
  msgstr ""
824
 
825
+ #: my-calendar-settings.php:197
826
  msgid "Date format in list mode"
827
  msgstr ""
828
 
829
+ #: my-calendar-settings.php:198
830
  msgid ""
831
  "Date format uses the same syntax as the <a href=\"http://php.net/date\">PHP "
832
  "<code>date()</code> function</a>. Save option to update sample output."
833
  msgstr ""
834
 
835
+ #: my-calendar-settings.php:201
836
  msgid "Show Heading for Calendar"
837
  msgstr ""
838
 
839
+ #: my-calendar-settings.php:204
840
  msgid "Label for events without a specific time"
841
  msgstr ""
842
 
843
+ #: my-calendar-settings.php:207
844
+ msgid "Previous events link text"
845
+ msgstr ""
846
+
847
+ #: my-calendar-settings.php:207
848
+ msgid "Previous Events"
849
+ msgstr ""
850
+
851
+ #: my-calendar-settings.php:210
852
+ msgid "Next events link text"
853
+ msgstr ""
854
+
855
+ #: my-calendar-settings.php:210
856
+ msgid "Next Events"
857
+ msgstr ""
858
+
859
+ #: my-calendar-settings.php:213
860
  msgid "Additional caption text"
861
  msgstr ""
862
 
863
+ #: my-calendar-settings.php:213
864
  msgid ""
865
  "The calendar caption is the text containing the displayed month and year in "
866
  "either list or calendar format. This text will be displayed following that "
867
  "existing text."
868
  msgstr ""
869
 
870
+ #: my-calendar-settings.php:216
871
  msgid "Hide category icons in output"
872
  msgstr ""
873
 
874
+ #: my-calendar-settings.php:219
875
  msgid ""
876
  "Show Link to Google Map (when sufficient address information is available.)"
877
  msgstr ""
878
 
879
+ #: my-calendar-settings.php:222
880
  msgid "Show Event Address in Details"
881
  msgstr ""
882
 
883
+ #: my-calendar-settings.php:225
884
+ msgid ""
885
+ "Links associated with events will automatically expire after the event has "
886
+ "passed."
887
+ msgstr ""
888
+
889
+ #: my-calendar-settings.php:228
890
+ msgid "Default usage of category colors."
891
+ msgstr ""
892
+
893
+ #: my-calendar-settings.php:229
894
+ msgid "Apply category colors to event titles as a font color."
895
+ msgstr ""
896
+
897
+ #: my-calendar-settings.php:230
898
+ msgid "Apply category colors to event titles as a background color."
899
+ msgstr ""
900
+
901
+ #: my-calendar-settings.php:234
902
  msgid "Save Settings"
903
  msgstr ""
904
 
905
+ #: my-calendar-styles.php:46
906
  msgid "Style Settings saved"
907
  msgstr ""
908
 
909
+ #: my-calendar-styles.php:68
910
  msgid "My Calendar Styles"
911
  msgstr ""
912
 
913
+ #: my-calendar-styles.php:72
914
  msgid "Calendar Style Settings"
915
  msgstr ""
916
 
917
+ #: my-calendar-styles.php:76
918
+ msgid "Show CSS & JavaScript only on these pages (comma separated page IDs)"
919
+ msgstr ""
920
+
921
+ #: my-calendar-styles.php:79
922
  msgid "CSS Style Options"
923
  msgstr ""
924
 
925
+ #: my-calendar-styles.php:81
926
  msgid "Reset the My Calendar stylesheet to the default"
927
  msgstr ""
928
 
929
+ #: my-calendar-styles.php:81
930
  msgid "Disable My Calendar Stylesheet"
931
  msgstr ""
932
 
933
+ #: my-calendar-styles.php:84
934
  msgid "Edit the stylesheet for My Calendar"
935
  msgstr ""
936
 
937
+ #: my-calendar-styles.php:87 my-calendar-styles.php:99
938
+ #: my-calendar-styles.php:111 my-calendar-styles.php:123
939
+ msgid "Save"
940
  msgstr ""
941
 
942
+ #: my-calendar-styles.php:91
943
  msgid "Calendar Behaviors: Calendar View"
944
  msgstr ""
945
 
946
+ #: my-calendar-styles.php:93
947
  msgid "Reset the My Calendar Calendar Javascript"
948
  msgstr ""
949
 
950
+ #: my-calendar-styles.php:93
951
  msgid "Disable Calendar Javascript Effects"
952
  msgstr ""
953
 
954
+ #: my-calendar-styles.php:96
955
  msgid "Edit the jQuery scripts for My Calendar in Calendar format"
956
  msgstr ""
957
 
958
+ #: my-calendar-styles.php:103
959
  msgid "Calendar Behaviors: List View"
960
  msgstr ""
961
 
962
+ #: my-calendar-styles.php:105
963
  msgid "Reset the My Calendar List Javascript"
964
  msgstr ""
965
 
966
+ #: my-calendar-styles.php:105 my-calendar-styles.php:117
967
  msgid "Disable List Javascript Effects"
968
  msgstr ""
969
 
970
+ #: my-calendar-styles.php:108
971
  msgid "Edit the jQuery scripts for My Calendar in List format"
972
  msgstr ""
973
 
974
+ #: my-calendar-styles.php:115
975
+ msgid "Calendar Behaviors: Mini Calendar View"
976
+ msgstr ""
977
+
978
+ #: my-calendar-styles.php:117
979
+ msgid "Reset the My Calendar Mini Format Javascript"
980
+ msgstr ""
981
+
982
+ #: my-calendar-styles.php:120
983
+ msgid "Edit the jQuery scripts for My Calendar in Mini Calendar format"
984
  msgstr ""
985
 
986
  #: my-calendar-widgets.php:11 my-calendar-widgets.php:51
1041
  msgid "There are no events currently scheduled."
1042
  msgstr ""
1043
 
1044
+ #: my-calendar.php:52 my-calendar.php:170
1045
  msgid "Settings"
1046
  msgstr ""
1047
 
1048
+ #: my-calendar.php:53 my-calendar.php:172
1049
+ msgid "Help"
1050
+ msgstr ""
1051
+
1052
+ #: my-calendar.php:75
1053
  msgid "Get Support"
1054
  msgstr ""
1055
 
1056
+ #: my-calendar.php:76 my-calendar.php:172
1057
+ msgid "My Calendar Help"
1058
+ msgstr ""
1059
+
1060
+ #: my-calendar.php:77
1061
  msgid "Make a Donation"
1062
  msgstr ""
1063
 
1064
+ #. #-#-#-#-# plugin.pot (My Calendar 1.4.0) #-#-#-#-#
1065
  #. Plugin Name of the plugin/theme
1066
+ #: my-calendar.php:161
1067
  msgid "My Calendar"
1068
  msgstr ""
1069
 
1070
+ #: my-calendar.php:164
1071
  msgid "Add/Edit Events"
1072
  msgstr ""
1073
 
1074
+ #: my-calendar.php:171
1075
  msgid "Style Editor"
1076
  msgstr ""
1077
 
1078
+ #: my-calendar.php:676
1079
+ msgid "Event Details"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1080
  msgstr ""
1081
 
1082
+ #: my-calendar.php:684
1083
+ msgid "Close"
1084
  msgstr ""
1085
 
1086
+ #: my-calendar.php:694
1087
  msgid "Not Applicable"
1088
  msgstr ""
1089
 
1090
+ #: my-calendar.php:706
1091
  msgid "Posted by"
1092
  msgstr ""
1093
 
1094
+ #: my-calendar.php:1271
1095
  msgid "Month"
1096
  msgstr ""
1097
 
1098
+ #: my-calendar.php:1272 my-calendar.php:1356
1099
  msgid "January"
1100
  msgstr ""
1101
 
1102
+ #: my-calendar.php:1273 my-calendar.php:1356
1103
  msgid "February"
1104
  msgstr ""
1105
 
1106
+ #: my-calendar.php:1274 my-calendar.php:1356
1107
  msgid "March"
1108
  msgstr ""
1109
 
1110
+ #: my-calendar.php:1275 my-calendar.php:1356
1111
  msgid "April"
1112
  msgstr ""
1113
 
1114
+ #: my-calendar.php:1276 my-calendar.php:1356
1115
  msgid "May"
1116
  msgstr ""
1117
 
1118
+ #: my-calendar.php:1277 my-calendar.php:1356
1119
  msgid "June"
1120
  msgstr ""
1121
 
1122
+ #: my-calendar.php:1278 my-calendar.php:1356
1123
  msgid "July"
1124
  msgstr ""
1125
 
1126
+ #: my-calendar.php:1279 my-calendar.php:1356
1127
  msgid "August"
1128
  msgstr ""
1129
 
1130
+ #: my-calendar.php:1280 my-calendar.php:1356
1131
  msgid "September"
1132
  msgstr ""
1133
 
1134
+ #: my-calendar.php:1281 my-calendar.php:1356
1135
  msgid "October"
1136
  msgstr ""
1137
 
1138
+ #: my-calendar.php:1282 my-calendar.php:1356
1139
  msgid "November"
1140
  msgstr ""
1141
 
1142
+ #: my-calendar.php:1283 my-calendar.php:1356
1143
  msgid "December"
1144
  msgstr ""
1145
 
1146
+ #: my-calendar.php:1285
1147
  msgid "Year"
1148
  msgstr ""
1149
 
1150
+ #: my-calendar.php:1310
1151
  msgid "Go"
1152
  msgstr ""
1153
 
1154
+ #: my-calendar.php:1328
1155
  msgid "<abbr title=\"Sunday\">Sun</abbr>"
1156
  msgstr ""
1157
 
1158
+ #: my-calendar.php:1329
1159
  msgid "<abbr title=\"Monday\">Mon</abbr>"
1160
  msgstr ""
1161
 
1162
+ #: my-calendar.php:1330
1163
  msgid "<abbr title=\"Tuesday\">Tues</abbr>"
1164
  msgstr ""
1165
 
1166
+ #: my-calendar.php:1331
1167
  msgid "<abbr title=\"Wednesday\">Wed</abbr>"
1168
  msgstr ""
1169
 
1170
+ #: my-calendar.php:1332
1171
  msgid "<abbr title=\"Thursday\">Thur</abbr>"
1172
  msgstr ""
1173
 
1174
+ #: my-calendar.php:1333
1175
  msgid "<abbr title=\"Friday\">Fri</abbr>"
1176
  msgstr ""
1177
 
1178
+ #: my-calendar.php:1334
1179
  msgid "<abbr title=\"Saturday\">Sat</abbr>"
1180
  msgstr ""
1181
 
1182
+ #: my-calendar.php:1339
1183
+ msgid "<abbr title=\"Sunday\">S</abbr>"
1184
+ msgstr ""
1185
+
1186
+ #: my-calendar.php:1340
1187
+ msgid "<abbr title=\"Monday\">M</abbr>"
1188
+ msgstr ""
1189
+
1190
+ #: my-calendar.php:1341
1191
+ msgid "<abbr title=\"Tuesday\">T</abbr>"
1192
+ msgstr ""
1193
+
1194
+ #: my-calendar.php:1342
1195
+ msgid "<abbr title=\"Wednesday\">W</abbr>"
1196
+ msgstr ""
1197
+
1198
+ #: my-calendar.php:1343
1199
+ msgid "<abbr title=\"Thursday\">T</abbr>"
1200
+ msgstr ""
1201
+
1202
+ #: my-calendar.php:1344
1203
+ msgid "<abbr title=\"Friday\">F</abbr>"
1204
+ msgstr ""
1205
+
1206
+ #: my-calendar.php:1345
1207
+ msgid "<abbr title=\"Saturday\">S</abbr>"
1208
+ msgstr ""
1209
+
1210
+ #: my-calendar.php:1395
1211
  msgid "and"
1212
  msgstr ""
1213
 
1214
+ #: my-calendar.php:1424 my-calendar.php:1428
1215
  msgid "Calendar"
1216
  msgstr ""
1217
 
1218
+ #: my-calendar.php:1432
1219
  msgid "Events in"
1220
  msgstr ""
1221
 
1222
+ #: my-calendar.php:1544
1223
  msgid "There are no events scheduled during this period."
1224
  msgstr ""
1225
 
1226
+ #: my-calendar.php:1554
1227
  msgid "Category Key"
1228
  msgstr ""
1229
 
readme.txt CHANGED
@@ -68,6 +68,25 @@ Languages available:
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  = 1.3.8 =
72
 
73
  * Fixed problem with CSS editing which effectively disabled CSS unless a specific choice had been made for pages to show CSS
68
 
69
  == Changelog ==
70
 
71
+ = 1.4.0 =
72
+
73
+ * Bug fixed: Today's Events widget was not taking internationalized time as it's argument
74
+ * Added end time field for events
75
+ * Added option for links to expire after events have occurred.
76
+ * Added options for alternate applications of category colors in output.
77
+ * Added ability to use My Calendar shortcodes in text widgets.
78
+ * Added GPS location option for locations
79
+ * Added zoom selection options for map links
80
+ * Lengthened maximum length for category and event titles
81
+ * Added a close link on opened events details boxes.
82
+ * Added an option for a mini calendar display type in shortcode
83
+ * Optimized some SQL queries and reduced total number of queries significantly.
84
+ * Extended the featured to show CSS only on certain pages to include JavaScript as well.
85
+ * Upcoming events widget only allowed up to 99 events to be shown forward or back. Changed to 999.
86
+ * Attempted to solve a problem with infinitely recurring events not appearing in upcoming events. Let me know.
87
+ * Added setting to change Previous Month/Next Month text.
88
+ * Yeah, that's enough for now.
89
+
90
  = 1.3.8 =
91
 
92
  * Fixed problem with CSS editing which effectively disabled CSS unless a specific choice had been made for pages to show CSS
uninstall.php CHANGED
@@ -21,12 +21,10 @@ delete_option('my_calendar_show_address');
21
  delete_option('my_calendar_today_template');
22
  delete_option('my_calendar_upcoming_template');
23
  delete_option('my_calendar_today_title');
 
 
24
  delete_option('my_calendar_upcoming_title');
25
- // Widget options
26
- delete_option('my_calendar_today_title');
27
  delete_option('my_calendar_today_template');
28
- delete_option('my_calendar_upcoming_title');
29
- delete_option('my_calendar_upcoming_template');
30
  delete_option('display_upcoming_type');
31
  delete_option('display_upcoming_days');
32
  delete_option('display_upcoming_events');
@@ -37,9 +35,22 @@ delete_option('display_in_category');
37
  delete_option('my_calendar_show_heading');
38
  delete_option('my_calendar_listjs');
39
  delete_option('my_calendar_caljs');
 
 
 
 
40
  delete_option('my_calendar_notime_text');
41
  delete_option('my_calendar_hide_icons');
42
  delete_option('my_calendar_caption');
 
 
 
 
 
 
 
 
 
43
  add_option('my_calendar_uninstalled','true');
44
  }
45
  ?>
21
  delete_option('my_calendar_today_template');
22
  delete_option('my_calendar_upcoming_template');
23
  delete_option('my_calendar_today_title');
24
+ delete_option('my_calendar_today_widget_title');
25
+ delete_option('my_calendar_upcoming_widget_title');
26
  delete_option('my_calendar_upcoming_title');
 
 
27
  delete_option('my_calendar_today_template');
 
 
28
  delete_option('display_upcoming_type');
29
  delete_option('display_upcoming_days');
30
  delete_option('display_upcoming_events');
35
  delete_option('my_calendar_show_heading');
36
  delete_option('my_calendar_listjs');
37
  delete_option('my_calendar_caljs');
38
+ delete_option('calendar_javascript');
39
+ delete_option('list_javascript');
40
+ delete_option('my_calendar_minijs');
41
+ delete_option('mini_javascript');
42
  delete_option('my_calendar_notime_text');
43
  delete_option('my_calendar_hide_icons');
44
  delete_option('my_calendar_caption');
45
+ delete_option('mc_event_link_expires');
46
+ delete_option('mc_apply_color');
47
+ delete_option('my_calendar_date_format');
48
+ delete_option('my_calendar_no_events_text');
49
+ delete_option('my_calendar_show_css');
50
+ delete_option('mc_apply_color');
51
+ delete_option('mc_next_events');
52
+ delete_option('mc_previous_events');
53
+
54
  add_option('my_calendar_uninstalled','true');
55
  }
56
  ?>