Calendar - Version 1.2.2

Version Description

Download this release

Release Info

Developer KieranOShea
Plugin Icon 128x128 Calendar
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

Files changed (4) hide show
  1. calendar.php +617 -246
  2. calendar.pot +505 -0
  3. javascript.js +4 -0
  4. readme.txt +42 -15
calendar.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  Plugin Name: Calendar
4
- Plugin URI: http://www.kjowebservices.co.uk
5
  Description: This plugin allows you to display a calendar of all your events and appointments as a page on your site.
6
  Author: Kieran O'Shea
7
- Author URI: http://www.kjowebservices.co.uk
8
- Version: 1.2.1
9
  */
10
 
11
- /* Copyright 2008 KJO Web Services (email : sales@kjowebservices.co.uk)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
@@ -25,6 +25,10 @@ Version: 1.2.1
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
 
 
 
 
28
  // Define the tables used in Calendar
29
  define('WP_CALENDAR_TABLE', $table_prefix . 'calendar');
30
  define('WP_CALENDAR_CONFIG_TABLE', $table_prefix . 'calendar_config');
@@ -42,7 +46,7 @@ add_action('wp_head', 'calendar_wp_head');
42
  // Add the function that deals with deleted users
43
  add_action('delete_user', 'deal_with_deleted_user');
44
 
45
- // Add the widgets if we are using version 2.5
46
  add_action('widgets_init', 'widget_init_calendar_today');
47
  add_action('widgets_init', 'widget_init_calendar_upcoming');
48
 
@@ -109,15 +113,15 @@ function calendar_menu()
109
  // Add the admin panel pages for Calendar. Use permissions pulled from above
110
  if (function_exists('add_menu_page'))
111
  {
112
- add_menu_page(__('Calendar'), __('Calendar'), $allowed_group, __FILE__, 'edit_calendar');
113
  }
114
  if (function_exists('add_submenu_page'))
115
  {
116
- add_submenu_page(__FILE__, __('Manage Calendar'), __('Manage Calendar'), $allowed_group, __FILE__, 'edit_calendar');
117
  add_action( "admin_head", 'calendar_add_javascript' );
118
  // Note only admin can change calendar options
119
- add_submenu_page(__FILE__, __('Manage Categories'), __('Manage Categories'), 'manage_options', 'manage-categories', 'manage_categories');
120
- add_submenu_page(__FILE__, __('Calendar Config'), __('Calendar Options'), 'manage_options', 'calendar-config', 'edit_calendar_config');
121
  }
122
  }
123
 
@@ -125,7 +129,7 @@ function calendar_menu()
125
  function calendar_add_javascript()
126
  {
127
  echo '<script type="text/javascript" src="';
128
- bloginfo('url');
129
  echo '/wp-content/plugins/calendar/javascript.js"></script>
130
  <script type="text/javascript">document.write(getCalendarStyles());</script>
131
  ';
@@ -136,7 +140,8 @@ function calendar_insert($content)
136
  {
137
  if (preg_match('{CALENDAR}',$content))
138
  {
139
- $content = str_replace('{CALENDAR}',calendar(),$content);
 
140
  }
141
  return $content;
142
  }
@@ -410,7 +415,7 @@ function check_calendar()
410
  PRIMARY KEY (category_id)
411
  )";
412
  $wpdb->get_results($sql);
413
- $sql = "INSERT INTO " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_id=0, category_name='General', category_colour='#F6F79B'";
414
  $wpdb->get_results($sql);
415
  }
416
  else if ($vone_point_one_upgrade == true)
@@ -461,7 +466,7 @@ function check_calendar()
461
  PRIMARY KEY (category_id)
462
  )";
463
  $wpdb->get_results($sql);
464
- $sql = "INSERT INTO " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_id=0, category_name='General', category_colour='#F6F79B'";
465
  $wpdb->get_results($sql);
466
  }
467
  else if ($vone_point_two_beta_upgrade == true)
@@ -502,20 +507,22 @@ function wp_events_display_list()
502
  if ( !empty($events) )
503
  {
504
  ?>
505
- <table width="100%" cellpadding="3" cellspacing="3">
506
- <tr>
507
- <th scope="col"><?php _e('ID') ?></th>
508
- <th scope="col"><?php _e('Title') ?></th>
509
- <th scope="col"><?php _e('Description') ?></th>
510
- <th scope="col"><?php _e('Start Date') ?></th>
511
- <th scope="col"><?php _e('End Date') ?></th>
512
- <th scope="col"><?php _e('Recurs') ?></th>
513
- <th scope="col"><?php _e('Repeats') ?></th>
514
- <th scope="col"><?php _e('Author') ?></th>
515
- <th scope="col"><?php _e('Category') ?></th>
516
- <th scope="col"><?php _e('Edit') ?></th>
517
- <th scope="col"><?php _e('Delete') ?></th>
518
- </tr>
 
 
519
  <?php
520
  $class = '';
521
  foreach ( $events as $event )
@@ -531,18 +538,18 @@ function wp_events_display_list()
531
  <td>
532
  <?php
533
  // Interpret the DB values into something human readable
534
- if ($event->event_recur == 'S') { echo 'Never'; }
535
- else if ($event->event_recur == 'W') { echo 'Weekly'; }
536
- else if ($event->event_recur == 'M') { echo 'Monthly'; }
537
- else if ($event->event_recur == 'Y') { echo 'Yearly'; }
538
  ?>
539
  </td>
540
  <td>
541
  <?php
542
  // Interpret the DB values into something human readable
543
- if ($event->event_recur == 'S') { echo 'N/A'; }
544
- else if ($event->event_repeats == 0) { echo 'Forever'; }
545
- else if ($event->event_repeats > 0) { echo $event->event_repeats.' Times'; }
546
  ?>
547
  </td>
548
  <td><?php $e = get_userdata($event->event_author); echo $e->display_name; ?></td>
@@ -552,8 +559,8 @@ function wp_events_display_list()
552
  ?>
553
  <td style="background-color:<?php echo $this_cat->category_colour;?>;"><?php echo $this_cat->category_name; ?></td>
554
  <?php unset($this_cat); ?>
555
- <td><a href="<?php echo $_SERVER['REQUEST_URI'] ?>&amp;action=edit&amp;event_id=<?php echo $event->event_id;?>" class='edit'><?php echo __('Edit'); ?></a></td>
556
- <td><a href="<?php echo $_SERVER['REQUEST_URI'] ?>&amp;action=delete&amp;event_id=<?php echo $event->event_id;?>" class="delete" onclick="return confirm('Are you sure you want to delete this event?')"><?php echo __('Delete'); ?></a></td>
557
  </tr>
558
  <?php
559
  }
@@ -564,7 +571,7 @@ function wp_events_display_list()
564
  else
565
  {
566
  ?>
567
- <p><?php _e("There are no events in the database!") ?></p>
568
  <?php
569
  }
570
  }
@@ -573,14 +580,14 @@ function wp_events_display_list()
573
  // The event edit form for the manage events admin page
574
  function wp_events_edit_form($mode='add', $event_id=false)
575
  {
576
- global $wpdb;
577
  $data = false;
578
 
579
  if ( $event_id !== false )
580
  {
581
  if ( intval($event_id) != $event_id )
582
  {
583
- echo "<div class=\"error\"><p>Bad Monkey! No banana!</p></div>";
584
  return;
585
  }
586
  else
@@ -588,33 +595,44 @@ function wp_events_edit_form($mode='add', $event_id=false)
588
  $data = $wpdb->get_results("SELECT * FROM " . WP_CALENDAR_TABLE . " WHERE event_id='" . mysql_escape_string($event_id) . "' LIMIT 1");
589
  if ( empty($data) )
590
  {
591
- echo "<div class=\"error\"><p>An event with that ID couldn't be found</p></div>";
592
  return;
593
  }
594
  $data = $data[0];
595
- }
 
 
 
 
 
596
  }
 
 
 
 
 
597
 
598
  ?>
599
- <div id="pop_up_cal" style="position:absolute;margin-left:150px;visibility:hidden;background-color:white;layer-background-color:white;"></div>
600
- <form name="quoteform" id="quoteform" class="wrap" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
601
  <input type="hidden" name="action" value="<?php echo $mode; ?>">
602
  <input type="hidden" name="event_id" value="<?php echo $event_id; ?>">
603
 
604
- <div id="item_manager">
605
- <div style="float: left; width: 98%; clear: both;" class="top">
606
- <!-- List URL -->
607
- <fieldset class="small"><legend><?php _e('Event Title'); ?></legend>
608
- <input type="text" name="event_title" class="input" size="40" maxlength="30"
609
- value="<?php if ( !empty($data) ) echo htmlspecialchars($data->event_title); ?>" />
610
- </fieldset>
611
-
612
- <fieldset class="small"><legend><?php _e('Event Description'); ?></legend>
613
- <textarea name="event_desc" class="input" rows="5" cols="50"><?php if ( !empty($data) ) echo htmlspecialchars($data->event_desc); ?></textarea>
614
- </fieldset>
615
-
616
- <fieldset class="small"><legend><?php _e('Event Category'); ?></legend>
617
- <select name="event_category">
 
618
  <?php
619
  // Grab all the categories and list them
620
  $sql = "SELECT * FROM " . WP_CALENDAR_CATEGORIES_TABLE;
@@ -634,17 +652,21 @@ function wp_events_edit_form($mode='add', $event_id=false)
634
  }
635
  ?>
636
  </select>
637
- </fieldset>
638
-
639
- <fieldset class="small"><legend><?php _e('Event Link (Optional)'); ?></legend>
640
- <input type="text" name="event_link" class="input" size="40" value="<?php if ( !empty($data) ) echo htmlspecialchars($data->event_link); ?>" />
641
- </fieldset>
642
-
643
- <fieldset class="small"><legend><?php _e('Start Date'); ?></legend>
644
- <script type="text/javascript">
 
645
  var cal_begin = new CalendarPopup('pop_up_cal');
 
 
 
646
  </script>
647
- <input type="text" name="event_begin" class="input" size=12
648
  value="<?php
649
  if ( !empty($data) )
650
  {
@@ -654,12 +676,14 @@ function wp_events_edit_form($mode='add', $event_id=false)
654
  {
655
  echo date("Y-m-d");
656
  }
657
- ?>" /> <a href="#" onClick="cal_begin.select(document.forms['quoteform'].event_begin,'event_begin_anchor','yyyy-MM-dd'); return false;" name="event_begin_anchor" id="event_begin_anchor">Select Date</a>
658
- </fieldset>
659
-
660
- <fieldset class="small"><legend><?php _e('End Date'); ?></legend>
661
- <script type="text/javascript">
 
662
  function check_and_print() {
 
663
  var cal_end = new CalendarPopup('pop_up_cal');
664
  var newDate = new Date();
665
  newDate.setFullYear(document.forms['quoteform'].event_begin.value.split('-')[0],document.forms['quoteform'].event_begin.value.split('-')[1]-1,document.forms['quoteform'].event_begin.value.split('-')[2]);
@@ -668,7 +692,7 @@ function wp_events_edit_form($mode='add', $event_id=false)
668
  cal_end.select(document.forms['quoteform'].event_end,'event_end_anchor','yyyy-MM-dd');
669
  }
670
  </script>
671
- <input type="text" name="event_end" class="input" size=12
672
  value="<?php
673
  if ( !empty($data) )
674
  {
@@ -678,11 +702,12 @@ function wp_events_edit_form($mode='add', $event_id=false)
678
  {
679
  echo date("Y-m-d");
680
  }
681
- ?>" /> <a href="#" onClick="check_and_print(); return false;" name="event_end_anchor" id="event_end_anchor">Select Date</a>
682
- </fieldset>
683
-
684
- <fieldset class="small"><legend><?php _e('Time (hh:mm)(optional, set blank if not required)'); ?></legend>
685
- <input type="text" name="event_time" class="input" size=12
 
686
  value="<?php
687
  if ( !empty($data) )
688
  {
@@ -699,11 +724,12 @@ function wp_events_edit_form($mode='add', $event_id=false)
699
  {
700
  echo date("H:i");
701
  }
702
- ?>" /> <?php _e('Current time difference from GMT is '); echo get_option('gmt_offset'); _e(' hour(s)'); ?>
703
- </fieldset>
704
-
705
- <fieldset class="small"><legend><?php _e('Recurring Events'); ?></legend>
706
- <?php
 
707
  if ($data->event_repeats != NULL)
708
  {
709
  $repeats = $data->event_repeats;
@@ -730,7 +756,7 @@ function wp_events_edit_form($mode='add', $event_id=false)
730
  $selected_y = 'selected="selected"';
731
  }
732
  ?>
733
- Repeats for
734
  <input type="text" name="event_repeats" class="input" size="1" value="<?php echo $repeats; ?>" />
735
  <select name="event_recur" class="input">
736
  <option class="input" <?php echo $selected_s; ?> value="S">None</option>
@@ -738,14 +764,14 @@ function wp_events_edit_form($mode='add', $event_id=false)
738
  <option class="input" <?php echo $selected_m; ?> value="M">Months</option>
739
  <option class="input" <?php echo $selected_y; ?> value="Y">Years</option>
740
  </select><br />
741
- Entering 0 means forever. Where the recurrance interval <br />
742
- is left at none, the event will not reoccur.
743
- </fieldset>
744
- <br />
745
- <input type="submit" name="save" class="button bold" value="Save &raquo;" />
746
  </div>
747
  <div style="clear:both; height:1px;">&nbsp;</div>
748
  </div>
 
749
  </form>
750
  <?php
751
  }
@@ -754,7 +780,7 @@ function wp_events_edit_form($mode='add', $event_id=false)
754
  // to deal with posts
755
  function edit_calendar()
756
  {
757
- global $current_user, $wpdb;
758
  ?>
759
  <style type="text/css">
760
  <!--
@@ -825,28 +851,132 @@ if ( $action == 'add' )
825
  $linky = stripslashes($linky);
826
  }
827
 
828
- $sql = "INSERT INTO " . WP_CALENDAR_TABLE . " SET event_title='" . mysql_escape_string($title)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829
  . "', event_desc='" . mysql_escape_string($desc) . "', event_begin='" . mysql_escape_string($begin)
830
  . "', event_end='" . mysql_escape_string($end) . "', event_time='" . mysql_escape_string($time) . "', event_recur='" . mysql_escape_string($recur) . "', event_repeats='" . mysql_escape_string($repeats) . "', event_author=".$current_user->ID.", event_category=".mysql_escape_string($category).", event_link='".mysql_escape_string($linky)."'";
831
 
832
- $wpdb->get_results($sql);
833
 
834
- $sql = "SELECT event_id FROM " . WP_CALENDAR_TABLE . " WHERE event_title='" . mysql_escape_string($title) . "'"
835
  . " AND event_desc='" . mysql_escape_string($desc) . "' AND event_begin='" . mysql_escape_string($begin) . "' AND event_end='" . mysql_escape_string($end) . "' AND event_recur='" . mysql_escape_string($recur) . "' AND event_repeats='" . mysql_escape_string($repeats) . "' LIMIT 1";
836
- $result = $wpdb->get_results($sql);
837
 
838
- if ( empty($result) || empty($result[0]->event_id) )
839
- {
840
- ?>
841
- <div class="error"><p><strong>Error:</strong> For some bizare reason your event was not added. Why not try again?</p></div>
842
  <?php
843
- }
844
- else
845
- {
846
  ?>
847
- <div class="updated"><p>Event added. It will now show in your calendar.</p></div>
848
  <?php
849
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  }
851
  // Permit saving of events that have been edited
852
  elseif ( $action == 'edit_save' )
@@ -878,11 +1008,101 @@ elseif ( $action == 'edit_save' )
878
  if ( empty($event_id) )
879
  {
880
  ?>
881
- <div class="error"><p><strong>Failure:</strong> You can't update an event if you haven't submitted an event id</p></div>
882
  <?php
883
  }
884
  else
885
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
886
  $sql = "UPDATE " . WP_CALENDAR_TABLE . " SET event_title='" . mysql_escape_string($title)
887
  . "', event_desc='" . mysql_escape_string($desc) . "', event_begin='" . mysql_escape_string($begin)
888
  . "', event_end='" . mysql_escape_string($end) . "', event_time='" . mysql_escape_string($time) . "', event_recur='" . mysql_escape_string($recur) . "', event_repeats='" . mysql_escape_string($repeats) . "', event_author=".$current_user->ID . ", event_category=".mysql_escape_string($category).", event_link='".mysql_escape_string($linky)."' WHERE event_id='" . mysql_escape_string($event_id) . "'";
@@ -896,15 +1116,30 @@ elseif ( $action == 'edit_save' )
896
  if ( empty($result) || empty($result[0]->event_id) )
897
  {
898
  ?>
899
- <div class="error"><p><strong>Failure:</strong> For some reason the event didnt update. Why not try again? </p></div>
900
  <?php
901
  }
902
  else
903
  {
904
  ?>
905
- <div class="updated"><p>Event updated successfully</p></div>
906
  <?php
907
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
908
  }
909
  }
910
  // Deal with deleting an event from the database
@@ -913,7 +1148,7 @@ elseif ( $action == 'delete' )
913
  if ( empty($event_id) )
914
  {
915
  ?>
916
- <div class="error"><p><strong>Error:</strong> Good Lord you gave me nothing to delete, nothing I tell you!</p></div>
917
  <?php
918
  }
919
  else
@@ -927,13 +1162,13 @@ elseif ( $action == 'delete' )
927
  if ( empty($result) || empty($result[0]->event_id) )
928
  {
929
  ?>
930
- <div class="updated"><p>Event deleted successfully</p></div>
931
  <?php
932
  }
933
  else
934
  {
935
  ?>
936
- <div class="error"><p><strong>Error:</strong> For some bizare reason the event could not be deleted. Why not try again?</p></div>
937
  <?php
938
 
939
  }
@@ -946,14 +1181,14 @@ elseif ( $action == 'delete' )
946
 
947
  <div class="wrap">
948
  <?php
949
- if ( $action == 'edit' )
950
  {
951
  ?>
952
- <h2><?php _e('Edit Event'); ?></h2>
953
  <?php
954
  if ( empty($event_id) )
955
  {
956
- echo "<div class=\"error\"><p>Good lord you didn't provide an event id to edit, what were you thinking?</p></div>";
957
  }
958
  else
959
  {
@@ -963,10 +1198,10 @@ elseif ( $action == 'delete' )
963
  else
964
  {
965
  ?>
966
- <h2><?php _e('Add Event'); ?></h2>
967
  <?php wp_events_edit_form(); ?>
968
 
969
- <h2><?php _e('Manage Events'); ?></h2>
970
  <?php
971
  wp_events_display_list();
972
  }
@@ -1057,7 +1292,7 @@ function edit_calendar_config()
1057
  $wpdb->get_results("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '".$initial_style."' WHERE config_item='calendar_style'");
1058
  }
1059
 
1060
- echo "<div class=\"updated\"><p><strong>Settings saved.</strong></p></div>";
1061
  }
1062
 
1063
  // Pull the values out of the database that we need for the form
@@ -1200,63 +1435,73 @@ function edit_calendar_config()
1200
  </style>
1201
 
1202
  <div class="wrap">
1203
- <h2><?php _e('Calendar Options'); ?></h2>
1204
- <form name="quoteform" id="quoteform" class="wrap" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
1205
- <div id="item_manager">
1206
- <div style="float: left; width: 98%; clear: both;" class="top">
1207
- <fieldset class="small"><legend><?php _e('Choose the lowest user group that may manage events'); ?></legend>
1208
- <select name="permissions">
1209
- <option value="subscriber"<?php echo $subscriber_seletced ?>><?php _e('Subscriber')?></option>
1210
- <option value="contributor" <?php echo $contributor_selected ?>><?php _e('Contributor')?></option>
1211
- <option value="author" <?php echo $author_selected ?>><?php _e('Author')?></option>
1212
- <option value="editor" <?php echo $editor_selected ?>><?php _e('Editor')?></option>
1213
- <option value="admin" <?php echo $admin_selected ?>><?php _e('Administrator')?></option>
 
 
1214
  </select>
1215
- </fieldset>
1216
- <fieldset class="small"><legend><?php _e('Do you want to display the author name on events?'); ?></legend>
1217
- <select name="display_author">
1218
- <option value="on" <?php echo $yes_disp_author ?>><?php _e('Yes') ?></option>
1219
- <option value="off" <?php echo $no_disp_author ?>><?php _e('No') ?></option>
 
 
1220
  </select>
1221
- </fieldset>
1222
- <fieldset class="small"><legend><?php _e('Display a jumpbox for changing month and year quickly?'); ?></legend>
1223
- <select name="display_jump">
1224
- <option value="on" <?php echo $yes_disp_jump ?>><?php _e('Yes') ?></option>
1225
- <option value="off" <?php echo $no_disp_jump ?>><?php _e('No') ?></option>
 
 
1226
  </select>
1227
- </fieldset>
1228
- <fieldset class="small"><legend><?php _e('Display todays events?'); ?></legend>
1229
- <select name="display_todays">
1230
- <option value="on" <?php echo $yes_disp_todays ?>><?php _e('Yes') ?></option>
1231
- <option value="off" <?php echo $no_disp_todays ?>><?php _e('No') ?></option>
 
 
1232
  </select>
1233
- </fieldset>
1234
- <fieldset class="small"><legend><?php _e('Display upcoming events? If yes, state for how many days into the future'); ?></legend>
1235
- <select name="display_upcoming">
1236
- <option value="on" <?php echo $yes_disp_upcoming ?>><?php _e('Yes') ?></option>
1237
- <option value="off" <?php echo $no_disp_upcoming ?>><?php _e('No') ?></option>
 
 
1238
  </select>
1239
- for <input type="text" name="display_upcoming_days" value="<?php echo $upcoming_days ?>" size="1" maxlength="2" /> days into the future
1240
- </fieldset>
1241
-
1242
- <fieldset class="small"><legend><?php _e('Enable event categories?'); ?></legend>
1243
- <select name="enable_categories">
1244
- <option value="on" <?php echo $yes_enable_categories ?>><?php _e('Yes') ?></option>
1245
- <option value="off" <?php echo $no_enable_categories ?>><?php _e('No') ?></option>
 
1246
  </select>
1247
- </fieldset>
1248
-
1249
- <fieldset class="small"><legend><?php _e('Configure the stylesheet for Calendar'); ?></legend>
1250
- <textarea name="style" rows="10" cols="60" tabindex="2"><?php echo $calendar_style; ?></textarea>
1251
- </fieldset>
1252
- <fieldset class="small"><legend><?php _e('Reset Styles'); ?></legend>
1253
- <input type="checkbox" name="reset_styles" /> <?php _e('Tick this box if you wish to reset the Calendar style to default'); ?>
1254
- </fieldset>
1255
- <br />
1256
- <input type="submit" name="save" class="button bold" value="Save &raquo;" />
1257
  </div>
1258
  <div style="clear:both; height:1px;">&nbsp;</div>
1259
  </div>
 
1260
  </form>
1261
  </div>
1262
  <?php
@@ -1308,7 +1553,7 @@ function manage_categories()
1308
  {
1309
  $sql = "INSERT INTO " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_name='".mysql_escape_string($_POST['category_name'])."', category_colour='".mysql_escape_string($_POST['category_colour'])."'";
1310
  $wpdb->get_results($sql);
1311
- echo "<div class=\"updated\"><p><strong>Category added successfully</strong></p></div>";
1312
  }
1313
  else if (isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'delete')
1314
  {
@@ -1316,7 +1561,7 @@ function manage_categories()
1316
  $wpdb->get_results($sql);
1317
  $sql = "UPDATE " . WP_CALENDAR_TABLE . " SET event_category=1 WHERE event_category=".mysql_escape_string($_GET['category_id']);
1318
  $wpdb->get_results($sql);
1319
- echo "<div class=\"updated\"><p><strong>Category deleted successfully</strong></p></div>";
1320
  }
1321
  else if (isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'edit' && !isset($_POST['mode']))
1322
  {
@@ -1324,23 +1569,26 @@ function manage_categories()
1324
  $cur_cat = $wpdb->get_row($sql);
1325
  ?>
1326
  <div class="wrap">
1327
- <h2><?php _e('Edit Category'); ?></h2>
1328
- <form name="catform" id="catform" class="wrap" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
1329
  <input type="hidden" name="mode" value="edit" />
1330
  <input type="hidden" name="category_id" value="<?php echo $cur_cat->category_id ?>" />
1331
- <div id="item_manager">
1332
- <div style="float: left; width: 98%; clear: both;" class="top">
1333
- <fieldset class="small"><legend><?php _e('Category Name:'); ?></legend>
1334
- <input type="text" name="category_name" class="input" size="30" maxlength="30" value="<?php echo $cur_cat->category_name ?>" />
1335
- </fieldset>
1336
- <fieldset class="small"><legend><?php _e('Category Colour (Hex format):'); ?></legend>
1337
- <input type="text" name="category_colour" class="input" size="10" maxlength="7" value="<?php echo $cur_cat->category_colour ?>" />
1338
- </fieldset>
1339
- <br />
1340
- <input type="submit" name="save" class="button bold" value="Save &raquo;" />
 
 
1341
  </div>
1342
  <div style="clear:both; height:1px;">&nbsp;</div>
1343
  </div>
 
1344
  </form>
1345
  </div>
1346
  <?php
@@ -1349,7 +1597,7 @@ function manage_categories()
1349
  {
1350
  $sql = "UPDATE " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_name='".mysql_escape_string($_POST['category_name'])."', category_colour='".mysql_escape_string($_POST['category_colour'])."' WHERE category_id=".mysql_escape_string($_POST['category_id']);
1351
  $wpdb->get_results($sql);
1352
- echo "<div class=\"updated\"><p><strong>Category edited successfully</strong></p></div>";
1353
  }
1354
 
1355
  if ($_GET['mode'] != 'edit' || $_POST['mode'] == 'edit')
@@ -1357,25 +1605,28 @@ function manage_categories()
1357
  ?>
1358
 
1359
  <div class="wrap">
1360
- <h2><?php _e('Add Category'); ?></h2>
1361
- <form name="catform" id="catform" class="wrap" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
1362
  <input type="hidden" name="mode" value="add" />
1363
  <input type="hidden" name="category_id" value="">
1364
- <div id="item_manager">
1365
- <div style="float: left; width: 98%; clear: both;" class="top">
1366
- <fieldset class="small"><legend><?php _e('Category Name:'); ?></legend>
1367
- <input type="text" name="category_name" class="input" size="30" maxlength="30" value="" />
1368
- </fieldset>
1369
- <fieldset class="small"><legend><?php _e('Category Colour (Hex format):'); ?></legend>
1370
- <input type="text" name="category_colour" class="input" size="10" maxlength="7" value="" />
1371
- </fieldset>
1372
- <br />
1373
- <input type="submit" name="save" class="button bold" value="Save &raquo;" />
 
 
1374
  </div>
1375
  <div style="clear:both; height:1px;">&nbsp;</div>
1376
  </div>
 
1377
  </form>
1378
- <h2><?php _e('Manage Categories'); ?></h2>
1379
  <?php
1380
 
1381
  // We pull the categories from the database
@@ -1384,14 +1635,16 @@ function manage_categories()
1384
  if ( !empty($categories) )
1385
  {
1386
  ?>
1387
- <table width="50%" cellpadding="3" cellspacing="3">
 
1388
  <tr>
1389
- <th scope="col"><?php _e('ID') ?></th>
1390
- <th scope="col"><?php _e('Category Name') ?></th>
1391
- <th scope="col"><?php _e('Category Colour') ?></th>
1392
- <th scope="col"><?php _e('Edit') ?></th>
1393
- <th scope="col"><?php _e('Delete') ?></th>
1394
  </tr>
 
1395
  <?php
1396
  $class = '';
1397
  foreach ( $categories as $category )
@@ -1402,18 +1655,16 @@ function manage_categories()
1402
  <th scope="row"><?php echo $category->category_id; ?></th>
1403
  <td><?php echo $category->category_name; ?></td>
1404
  <td style="background-color:<?php echo $category->category_colour; ?>;">&nbsp;</td>
1405
- <td><a href="<?php echo $_SERVER['REQUEST_URI'] ?>&amp;mode=edit&amp;category_id=<?php echo $category->category_id;?>" class='edit'><?php echo __('Edit'); ?></a></td>
1406
  <?php
1407
  if ($category->category_id == 1)
1408
  {
1409
- ?>
1410
- <td>N/A</td>
1411
- <?php
1412
  }
1413
  else
1414
  {
1415
  ?>
1416
- <td><a href="<?php echo $_SERVER['REQUEST_URI'] ?>&amp;mode=delete&amp;category_id=<?php echo $category->category_id;?>" class="delete" onclick="return confirm('Are you sure you want to delete this category?')"><?php echo __('Delete'); ?></a></td>
1417
  <?php
1418
  }
1419
  ?>
@@ -1426,9 +1677,7 @@ function manage_categories()
1426
  }
1427
  else
1428
  {
1429
- ?>
1430
- <p><?php _e("There are no categories in the database - something has gone wrong!") ?></p>
1431
- <?php
1432
  }
1433
 
1434
  ?>
@@ -1499,13 +1748,13 @@ function next_link($cur_year,$cur_month)
1499
 
1500
  if ($cur_month == 12)
1501
  {
1502
- return '<a href="' . permalink_prefix() . 'month=jan&yr=' . $next_year . '">Next &raquo;</a>';
1503
  }
1504
  else
1505
  {
1506
  $next_month = $cur_month + 1;
1507
  $month = $mod_rewrite_months[$next_month];
1508
- return '<a href="' . permalink_prefix() . 'month='.$month.'&yr=' . $cur_year . '">Next &raquo;</a>';
1509
  }
1510
  }
1511
 
@@ -1517,13 +1766,13 @@ function prev_link($cur_year,$cur_month)
1517
 
1518
  if ($cur_month == 1)
1519
  {
1520
- return '<a href="' . permalink_prefix() . 'month=dec&yr='. $last_year .'">&laquo; Prev</a>';
1521
  }
1522
  else
1523
  {
1524
  $next_month = $cur_month - 1;
1525
  $month = $mod_rewrite_months[$next_month];
1526
- return '<a href="' . permalink_prefix() . 'month='.$month.'&yr=' . $cur_year . '">&laquo; Prev</a>';
1527
  }
1528
  }
1529
 
@@ -1555,10 +1804,10 @@ function upcoming_events()
1555
  foreach($events as $event)
1556
  {
1557
  if ($event->event_time == '00:00:00') {
1558
- $time_string = ' all day';
1559
  }
1560
  else {
1561
- $time_string = ' at '.date(get_option('time_format'), strtotime($event->event_time));
1562
  }
1563
  $output .= '<li>'.draw_widget_event($event).$time_string.'</li>';
1564
  }
@@ -1570,7 +1819,7 @@ function upcoming_events()
1570
 
1571
  if ($output != '')
1572
  {
1573
- $visual = '<li class="upcoming-events"><h2>Upcoming Events</h2><ul>';
1574
  $visual .= $output;
1575
  $visual .= '</ul></li>';
1576
  return $visual;
@@ -1591,16 +1840,16 @@ function todays_events()
1591
 
1592
  if ($display == 'true')
1593
  {
1594
- $output = '<li class="todays-events"><h2>Todays Events</h2><ul>';
1595
  $events = grab_events(date("Y"),date("m"),date("d"));
1596
  usort($events, "time_cmp");
1597
  foreach($events as $event)
1598
  {
1599
  if ($event->event_time == '00:00:00') {
1600
- $time_string = ' all day';
1601
  }
1602
  else {
1603
- $time_string = ' at '.date(get_option('time_format'), strtotime($event->event_time));
1604
  }
1605
  $output .= '<li>'.draw_widget_event($event).$time_string.'</li>';
1606
  }
@@ -1635,6 +1884,88 @@ function draw_events($events)
1635
  return $output;
1636
  }
1637
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1638
 
1639
  // The widget to show todays events in the sidebar
1640
  function widget_init_calendar_today() {
@@ -1644,12 +1975,32 @@ function widget_init_calendar_today() {
1644
 
1645
  function widget_calendar_today($args) {
1646
  extract($args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1647
  ?>
1648
- <?php echo todays_events(); ?>
1649
- <?php
1650
- }
 
 
 
1651
 
1652
- register_sidebar_widget('Todays Events','widget_calendar_today');
 
1653
  }
1654
 
1655
  // The widget to show todays events in the sidebar
@@ -1660,12 +2011,32 @@ function widget_init_calendar_upcoming() {
1660
 
1661
  function widget_calendar_upcoming($args) {
1662
  extract($args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1663
  ?>
1664
- <?php echo upcoming_events(); ?>
1665
- <?php
1666
- }
 
 
 
1667
 
1668
- register_sidebar_widget('Upcoming Events','widget_calendar_upcoming');
 
1669
  }
1670
 
1671
 
@@ -1693,12 +2064,12 @@ function draw_event($event)
1693
  $header_details .= '<div class="event-title">'.$event->event_title.'</div><div class="event-title-break"></div>';
1694
  if ($event->event_time != "00:00:00")
1695
  {
1696
- $header_details .= '<strong>Time:</strong> ' . date(get_option('time_format'), strtotime($event->event_time)) . '<br />';
1697
  }
1698
  if ($display_author == 'true')
1699
  {
1700
  $e = get_userdata($event->event_author);
1701
- $header_details .= '<strong>Posted by:</strong> '.$e->display_name.'<br />';
1702
  }
1703
  if ($display_author == 'true' || $event->event_time != "00:00:00")
1704
  {
@@ -1737,12 +2108,12 @@ function draw_widget_event($event)
1737
  $header_details .= '<div class="event-title">'.$event->event_title.'</div><div class="event-title-break"></div>';
1738
  if ($event->event_time != "00:00:00")
1739
  {
1740
- $header_details .= '<strong>Time:</strong> ' . date(get_option('time_format'), strtotime($event->event_time)) . '<br />';
1741
  }
1742
  if ($display_author == 'true')
1743
  {
1744
  $e = get_userdata($event->event_author);
1745
- $header_details .= '<strong>Posted by:</strong> '.$e->display_name.'<br />';
1746
  }
1747
  if ($display_author == 'true' || $event->event_time != "00:00:00")
1748
  {
@@ -2037,16 +2408,16 @@ function calendar()
2037
  // Deal with the week not starting on a monday
2038
  if (get_option('start_of_week') == 0)
2039
  {
2040
- $name_days = array(1=>'Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
2041
  }
2042
  // Choose Monday if anything other than Sunday is set
2043
  else
2044
  {
2045
- $name_days = array(1=>'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
2046
  }
2047
 
2048
  // Carry on with the script
2049
- $name_months = array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
2050
 
2051
  // If we don't pass arguments we want a calendar that is relevant to today
2052
  if (empty($_GET['month']) || empty($_GET['yr']))
@@ -2155,21 +2526,21 @@ function calendar()
2155
  }
2156
  // We build the months in the switcher
2157
  $calendar_body .= '
2158
- Month: <select name="month" style="width:100px;">
2159
- <option value="jan"'.month_comparison('jan').'>January</option>
2160
- <option value="feb"'.month_comparison('feb').'>February</option>
2161
- <option value="mar"'.month_comparison('mar').'>March</option>
2162
- <option value="apr"'.month_comparison('apr').'>April</option>
2163
- <option value="may"'.month_comparison('may').'>May</option>
2164
- <option value="jun"'.month_comparison('jun').'>June</option>
2165
- <option value="jul"'.month_comparison('jul').'>July</option>
2166
- <option value="aug"'.month_comparison('aug').'>August</option>
2167
- <option value="sept"'.month_comparison('sept').'>September</option>
2168
- <option value="oct"'.month_comparison('oct').'>October</option>
2169
- <option value="nov"'.month_comparison('nov').'>November</option>
2170
- <option value="dec"'.month_comparison('dec').'>December</option>
2171
  </select>
2172
- Year: <select name="yr" style="width:60px;">
2173
  ';
2174
 
2175
  // The year builder is string mania. If you can make sense of this,
@@ -2316,7 +2687,7 @@ function calendar()
2316
  $cat_details = $wpdb->get_results($sql);
2317
  $calendar_body .= '<tr><td colspan="7">
2318
  <table class="cat-key">
2319
- <tr><td colspan="2"><strong>Category Key</strong></td></tr>
2320
  ';
2321
  foreach($cat_details as $cat_detail)
2322
  {
@@ -2330,7 +2701,7 @@ function calendar()
2330
  ';
2331
 
2332
  // A little link to yours truely. See the README if you wish to remove this
2333
- $calendar_body .= '<div class="kjo-link"><p>Web development and hosting from <a href="http://www.kjowebservices.co.uk">KJO Web Services</a></p></div>
2334
  ';
2335
 
2336
  // Phew! After that bit of string building, spit it all out.
1
  <?php
2
  /*
3
  Plugin Name: Calendar
4
+ Plugin URI: http://www.kieranoshea.com
5
  Description: This plugin allows you to display a calendar of all your events and appointments as a page on your site.
6
  Author: Kieran O'Shea
7
+ Author URI: http://www.kieranoshea.com
8
+ Version: 1.2.2
9
  */
10
 
11
+ /* Copyright 2008 Kieran O'Shea (email : kieran@kieranoshea.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
+ // Enable internationalisation
29
+ $plugin_dir = basename(dirname(__FILE__));
30
+ load_plugin_textdomain( 'calendar','wp-content/plugins/'.$plugin_dir, $plugin_dir);
31
+
32
  // Define the tables used in Calendar
33
  define('WP_CALENDAR_TABLE', $table_prefix . 'calendar');
34
  define('WP_CALENDAR_CONFIG_TABLE', $table_prefix . 'calendar_config');
46
  // Add the function that deals with deleted users
47
  add_action('delete_user', 'deal_with_deleted_user');
48
 
49
+ // Add the widgets if we are using version 2.8
50
  add_action('widgets_init', 'widget_init_calendar_today');
51
  add_action('widgets_init', 'widget_init_calendar_upcoming');
52
 
113
  // Add the admin panel pages for Calendar. Use permissions pulled from above
114
  if (function_exists('add_menu_page'))
115
  {
116
+ add_menu_page(__('Calendar','calendar'), __('Calendar','calendar'), $allowed_group, 'calendar', 'edit_calendar');
117
  }
118
  if (function_exists('add_submenu_page'))
119
  {
120
+ add_submenu_page('calendar', __('Manage Calendar','calendar'), __('Manage Calendar','calendar'), $allowed_group, 'calendar', 'edit_calendar');
121
  add_action( "admin_head", 'calendar_add_javascript' );
122
  // Note only admin can change calendar options
123
+ add_submenu_page('calendar', __('Manage Categories','calendar'), __('Manage Categories','calendar'), 'manage_options', 'calendar-categories', 'manage_categories');
124
+ add_submenu_page('calendar', __('Calendar Config','calendar'), __('Calendar Options','calendar'), 'manage_options', 'calendar-config', 'edit_calendar_config');
125
  }
126
  }
127
 
129
  function calendar_add_javascript()
130
  {
131
  echo '<script type="text/javascript" src="';
132
+ bloginfo('wpurl');
133
  echo '/wp-content/plugins/calendar/javascript.js"></script>
134
  <script type="text/javascript">document.write(getCalendarStyles());</script>
135
  ';
140
  {
141
  if (preg_match('{CALENDAR}',$content))
142
  {
143
+ $cal_output = calendar();
144
+ $content = str_replace('{CALENDAR}',$cal_output,$content);
145
  }
146
  return $content;
147
  }
415
  PRIMARY KEY (category_id)
416
  )";
417
  $wpdb->get_results($sql);
418
+ $sql = "INSERT INTO " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_id=1, category_name='General', category_colour='#F6F79B'";
419
  $wpdb->get_results($sql);
420
  }
421
  else if ($vone_point_one_upgrade == true)
466
  PRIMARY KEY (category_id)
467
  )";
468
  $wpdb->get_results($sql);
469
+ $sql = "INSERT INTO " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_id=1, category_name='General', category_colour='#F6F79B'";
470
  $wpdb->get_results($sql);
471
  }
472
  else if ($vone_point_two_beta_upgrade == true)
507
  if ( !empty($events) )
508
  {
509
  ?>
510
+ <table class="widefat page fixed" width="100%" cellpadding="3" cellspacing="3">
511
+ <thead>
512
+ <tr>
513
+ <th class="manage-column" scope="col"><?php _e('ID','calendar') ?></th>
514
+ <th class="manage-column" scope="col"><?php _e('Title','calendar') ?></th>
515
+ <th class="manage-column" scope="col"><?php _e('Description','calendar') ?></th>
516
+ <th class="manage-column" scope="col"><?php _e('Start Date','calendar') ?></th>
517
+ <th class="manage-column" scope="col"><?php _e('End Date','calendar') ?></th>
518
+ <th class="manage-column" scope="col"><?php _e('Recurs','calendar') ?></th>
519
+ <th class="manage-column" scope="col"><?php _e('Repeats','calendar') ?></th>
520
+ <th class="manage-column" scope="col"><?php _e('Author','calendar') ?></th>
521
+ <th class="manage-column" scope="col"><?php _e('Category','calendar') ?></th>
522
+ <th class="manage-column" scope="col"><?php _e('Edit','calendar') ?></th>
523
+ <th class="manage-column" scope="col"><?php _e('Delete','calendar') ?></th>
524
+ </tr>
525
+ </thead>
526
  <?php
527
  $class = '';
528
  foreach ( $events as $event )
538
  <td>
539
  <?php
540
  // Interpret the DB values into something human readable
541
+ if ($event->event_recur == 'S') { echo __('Never','calendar'); }
542
+ else if ($event->event_recur == 'W') { echo __('Weekly','calendar'); }
543
+ else if ($event->event_recur == 'M') { echo __('Monthly','calendar'); }
544
+ else if ($event->event_recur == 'Y') { echo __('Yearly','calendar'); }
545
  ?>
546
  </td>
547
  <td>
548
  <?php
549
  // Interpret the DB values into something human readable
550
+ if ($event->event_recur == 'S') { echo __('N/A','calendar'); }
551
+ else if ($event->event_repeats == 0) { echo __('Forever','calendar'); }
552
+ else if ($event->event_repeats > 0) { echo $event->event_repeats.' '.__('Times','calendar'); }
553
  ?>
554
  </td>
555
  <td><?php $e = get_userdata($event->event_author); echo $e->display_name; ?></td>
559
  ?>
560
  <td style="background-color:<?php echo $this_cat->category_colour;?>;"><?php echo $this_cat->category_name; ?></td>
561
  <?php unset($this_cat); ?>
562
+ <td><a href="<?php echo $_SERVER['PHP_SELF'] ?>?page=calendar&amp;action=edit&amp;event_id=<?php echo $event->event_id;?>" class='edit'><?php echo __('Edit','calendar'); ?></a></td>
563
+ <td><a href="<?php echo $_SERVER['PHP_SELF'] ?>?page=calendar&amp;action=delete&amp;event_id=<?php echo $event->event_id;?>" class="delete" onclick="return confirm('<?php _e('Are you sure you want to delete this event?','calendar'); ?>')"><?php echo __('Delete','calendar'); ?></a></td>
564
  </tr>
565
  <?php
566
  }
571
  else
572
  {
573
  ?>
574
+ <p><?php _e("There are no events in the database!",'calendar') ?></p>
575
  <?php
576
  }
577
  }
580
  // The event edit form for the manage events admin page
581
  function wp_events_edit_form($mode='add', $event_id=false)
582
  {
583
+ global $wpdb,$users_entries;
584
  $data = false;
585
 
586
  if ( $event_id !== false )
587
  {
588
  if ( intval($event_id) != $event_id )
589
  {
590
+ echo "<div class=\"error\"><p>".__('Bad Monkey! No banana!','calendar')."</p></div>";
591
  return;
592
  }
593
  else
595
  $data = $wpdb->get_results("SELECT * FROM " . WP_CALENDAR_TABLE . " WHERE event_id='" . mysql_escape_string($event_id) . "' LIMIT 1");
596
  if ( empty($data) )
597
  {
598
+ echo "<div class=\"error\"><p>".__("An event with that ID couldn't be found",'calendar')."</p></div>";
599
  return;
600
  }
601
  $data = $data[0];
602
+ }
603
+ // Recover users entries if they exist; in other words if editing an event went wrong
604
+ if (!empty($users_entries))
605
+ {
606
+ $data = $users_entries;
607
+ }
608
  }
609
+ // Deal with possibility that form was submitted but not saved due to error - recover user's entries here
610
+ else
611
+ {
612
+ $data = $users_entries;
613
+ }
614
 
615
  ?>
616
+ <div id="pop_up_cal" style="position:absolute;margin-left:150px;visibility:hidden;background-color:white;layer-background-color:white;z-index:1;"></div>
617
+ <form name="quoteform" id="quoteform" class="wrap" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=calendar">
618
  <input type="hidden" name="action" value="<?php echo $mode; ?>">
619
  <input type="hidden" name="event_id" value="<?php echo $event_id; ?>">
620
 
621
+ <div id="linkadvanceddiv" class="postbox">
622
+ <div style="float: left; width: 98%; clear: both;" class="inside">
623
+ <table cellpadding="5" cellspacing="5">
624
+ <tr>
625
+ <td><legend><?php _e('Event Title','calendar'); ?></legend></td>
626
+ <td><input type="text" name="event_title" class="input" size="40" maxlength="30"
627
+ value="<?php if ( !empty($data) ) echo htmlspecialchars($data->event_title); ?>" /></td>
628
+ </tr>
629
+ <tr>
630
+ <td style="vertical-align:top;"><legend><?php _e('Event Description','calendar'); ?></legend></td>
631
+ <td><textarea name="event_desc" class="input" rows="5" cols="50"><?php if ( !empty($data) ) echo htmlspecialchars($data->event_desc); ?></textarea></td>
632
+ </tr>
633
+ <tr>
634
+ <td><legend><?php _e('Event Category','calendar'); ?></legend></td>
635
+ <td> <select name="event_category">
636
  <?php
637
  // Grab all the categories and list them
638
  $sql = "SELECT * FROM " . WP_CALENDAR_CATEGORIES_TABLE;
652
  }
653
  ?>
654
  </select>
655
+ </td>
656
+ </tr>
657
+ <tr>
658
+ <td><legend><?php _e('Event Link (Optional)','calendar'); ?></legend></td>
659
+ <td><input type="text" name="event_link" class="input" size="40" value="<?php if ( !empty($data) ) echo htmlspecialchars($data->event_link); ?>" /></td>
660
+ </tr>
661
+ <tr>
662
+ <td><legend><?php _e('Start Date','calendar'); ?></legend></td>
663
+ <td> <script type="text/javascript">
664
  var cal_begin = new CalendarPopup('pop_up_cal');
665
+ function unifydates() {
666
+ document.forms['quoteform'].event_end.value = document.forms['quoteform'].event_begin.value;
667
+ }
668
  </script>
669
+ <input type="text" name="event_begin" class="input" size="12"
670
  value="<?php
671
  if ( !empty($data) )
672
  {
676
  {
677
  echo date("Y-m-d");
678
  }
679
+ ?>" /> <a href="#" onClick="cal_begin.select(document.forms['quoteform'].event_begin,'event_begin_anchor','yyyy-MM-dd'); return false;" name="event_begin_anchor" id="event_begin_anchor"><?php _e('Select Date','calendar'); ?></a>
680
+ </td>
681
+ </tr>
682
+ <tr>
683
+ <td><legend><?php _e('End Date','calendar'); ?></legend></td>
684
+ <td> <script type="text/javascript">
685
  function check_and_print() {
686
+ unifydates();
687
  var cal_end = new CalendarPopup('pop_up_cal');
688
  var newDate = new Date();
689
  newDate.setFullYear(document.forms['quoteform'].event_begin.value.split('-')[0],document.forms['quoteform'].event_begin.value.split('-')[1]-1,document.forms['quoteform'].event_begin.value.split('-')[2]);
692
  cal_end.select(document.forms['quoteform'].event_end,'event_end_anchor','yyyy-MM-dd');
693
  }
694
  </script>
695
+ <input type="text" name="event_end" class="input" size="12"
696
  value="<?php
697
  if ( !empty($data) )
698
  {
702
  {
703
  echo date("Y-m-d");
704
  }
705
+ ?>" /> <a href="#" onClick="check_and_print(); return false;" name="event_end_anchor" id="event_end_anchor"><?php _e('Select Date','calendar'); ?></a>
706
+ </td>
707
+ </tr>
708
+ <tr>
709
+ <td><legend><?php _e('Time (hh:mm)','calendar'); ?></legend></td>
710
+ <td> <input type="text" name="event_time" class="input" size=12
711
  value="<?php
712
  if ( !empty($data) )
713
  {
724
  {
725
  echo date("H:i");
726
  }
727
+ ?>" /> <?php _e('Optional, set blank if not required.','calendar'); ?> <?php _e('Current time difference from GMT is ','calendar'); echo get_option('gmt_offset'); _e(' hour(s)'); ?>
728
+ </td>
729
+ </tr>
730
+ <tr>
731
+ <td><legend><?php _e('Recurring Events','calendar'); ?></legend></td>
732
+ <td> <?php
733
  if ($data->event_repeats != NULL)
734
  {
735
  $repeats = $data->event_repeats;
756
  $selected_y = 'selected="selected"';
757
  }
758
  ?>
759
+ <?php _e('Repeats for','calendar'); ?>
760
  <input type="text" name="event_repeats" class="input" size="1" value="<?php echo $repeats; ?>" />
761
  <select name="event_recur" class="input">
762
  <option class="input" <?php echo $selected_s; ?> value="S">None</option>
764
  <option class="input" <?php echo $selected_m; ?> value="M">Months</option>
765
  <option class="input" <?php echo $selected_y; ?> value="Y">Years</option>
766
  </select><br />
767
+ <?php _e('Entering 0 means forever. Where the recurrance interval is left at none, the event will not reoccur.','calendar'); ?>
768
+ </td>
769
+ </tr>
770
+ </table>
 
771
  </div>
772
  <div style="clear:both; height:1px;">&nbsp;</div>
773
  </div>
774
+ <input type="submit" name="save" class="button bold" value="<?php _e('Save','calendar'); ?> &raquo;" />
775
  </form>
776
  <?php
777
  }
780
  // to deal with posts
781
  function edit_calendar()
782
  {
783
+ global $current_user, $wpdb, $users_entries;
784
  ?>
785
  <style type="text/css">
786
  <!--
851
  $linky = stripslashes($linky);
852
  }
853
 
854
+ // Perform some validation on the submitted dates - this checks for valid years and months
855
+ $date_format_one = '/^([0-9]{4})-([0][1-9])-([0-3][0-9])$/';
856
+ $date_format_two = '/^([0-9]{4})-([1][0-2])-([0-3][0-9])$/';
857
+ if ((preg_match($date_format_one,$begin) || preg_match($date_format_two,$begin)) && (preg_match($date_format_one,$end) || preg_match($date_format_two,$end)))
858
+ {
859
+ // We know we have a valid year and month and valid integers for days so now we do a final check on the date
860
+ $begin_split = split('-',$begin);
861
+ $begin_y = $begin_split[0];
862
+ $begin_m = $begin_split[1];
863
+ $begin_d = $begin_split[2];
864
+ $end_split = split('-',$end);
865
+ $end_y = $end_split[0];
866
+ $end_m = $end_split[1];
867
+ $end_d = $end_split[2];
868
+ if (checkdate($begin_m,$begin_d,$begin_y) && checkdate($end_m,$end_d,$end_y))
869
+ {
870
+ // Ok, now we know we have valid dates, we want to make sure that they are either equal or that the end date is later than the start date
871
+ if (strtotime($end) >= strtotime($begin))
872
+ {
873
+ $start_date_ok = 1;
874
+ $end_date_ok = 1;
875
+ }
876
+ else
877
+ {
878
+ ?>
879
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Your event end date must be either after or the same as your event begin date','calendar'); ?></p></div>
880
+ <?php
881
+ }
882
+ }
883
+ else
884
+ {
885
+ ?>
886
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Your date formatting is correct but one or more of your dates is invalid. Check for number of days in month and leap year related errors.','calendar'); ?></p></div>
887
+ <?php
888
+ }
889
+ }
890
+ else
891
+ {
892
+ ?>
893
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Both start and end dates must be entered and be in the format YYYY-MM-DD','calendar'); ?></p></div>
894
+ <?php
895
+ }
896
+ // We check for a valid time, or an empty one
897
+ $time_format_one = '/^([0-1][0-9]):([0-5][0-9])$/';
898
+ $time_format_two = '/^([2][0-3]):([0-5][0-9])$/';
899
+ if (preg_match($time_format_one,$time) || preg_match($time_format_two,$time) || $time == '')
900
+ {
901
+ $time_ok = 1;
902
+ }
903
+ else
904
+ {
905
+ ?>
906
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The time field must either be blank or be entered in the format hh:mm','calendar'); ?></p></div>
907
+ <?php
908
+ }
909
+ // We check to make sure the URL is alright
910
+ if (preg_match('/^(http)(s?)(:)\/\//',$linky) || $linky == '')
911
+ {
912
+ $url_ok = 1;
913
+ }
914
+ else
915
+ {
916
+ ?>
917
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http:// or be completely blank','calendar'); ?></p></div>
918
+ <?php
919
+ }
920
+ // The title must be at least one character in length and no more than 30 - no non-standard characters allowed
921
+ if (preg_match('/^[a-zA-Z0-9]{1}[a-zA-Z0-9[:space:]]{0,29}$/',$title))
922
+ {
923
+ $title_ok =1;
924
+ }
925
+ else
926
+ {
927
+ ?>
928
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 30 characters in length and contain no punctuation. Spaces are allowed but the title must not start with one.','calendar'); ?></p></div>
929
+ <?php
930
+ }
931
+ // We run some checks on recurrance
932
+ if (($repeats == 0 && $recur == 'S') || (($repeats >= 0) && ($recur == 'W' || $recur == 'M' || $recur == 'Y')))
933
+ {
934
+ $recurring_ok = 1;
935
+ }
936
+ else
937
+ {
938
+ ?>
939
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The repetition value must be 0 unless a type of recurrance is selected in which case the repetition value must be 0 or higher','calendar'); ?></p></div>
940
+ <?php
941
+ }
942
+ if ($start_date_ok == 1 && $end_date_ok == 1 && $time_ok == 1 && $url_ok == 1 && $title_ok == 1 && $recurring_ok == 1)
943
+ {
944
+ $sql = "INSERT INTO " . WP_CALENDAR_TABLE . " SET event_title='" . mysql_escape_string($title)
945
  . "', event_desc='" . mysql_escape_string($desc) . "', event_begin='" . mysql_escape_string($begin)
946
  . "', event_end='" . mysql_escape_string($end) . "', event_time='" . mysql_escape_string($time) . "', event_recur='" . mysql_escape_string($recur) . "', event_repeats='" . mysql_escape_string($repeats) . "', event_author=".$current_user->ID.", event_category=".mysql_escape_string($category).", event_link='".mysql_escape_string($linky)."'";
947
 
948
+ $wpdb->get_results($sql);
949
 
950
+ $sql = "SELECT event_id FROM " . WP_CALENDAR_TABLE . " WHERE event_title='" . mysql_escape_string($title) . "'"
951
  . " AND event_desc='" . mysql_escape_string($desc) . "' AND event_begin='" . mysql_escape_string($begin) . "' AND event_end='" . mysql_escape_string($end) . "' AND event_recur='" . mysql_escape_string($recur) . "' AND event_repeats='" . mysql_escape_string($repeats) . "' LIMIT 1";
952
+ $result = $wpdb->get_results($sql);
953
 
954
+ if ( empty($result) || empty($result[0]->event_id) )
955
+ {
956
+ ?>
957
+ <div class="error"><p><strong><?php _e('Error','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.','calendar'); ?></p></div>
958
  <?php
959
+ }
960
+ else
961
+ {
962
  ?>
963
+ <div class="updated"><p><?php _e('Event added. It will now show in your calendar.','calendar'); ?></p></div>
964
  <?php
965
+ }
966
+ }
967
+ else
968
+ {
969
+ // The form is going to be rejected due to field validation issues, so we preserve the users entries here
970
+ $users_entries->event_title = $title;
971
+ $users_entries->event_desc = $desc;
972
+ $users_entries->event_begin = $begin;
973
+ $users_entries->event_end = $end;
974
+ $users_entries->event_time = $time;
975
+ $users_entries->event_recur = $recur;
976
+ $users_entries->event_repeats = $repeats;
977
+ $users_entries->event_category = $category;
978
+ $users_entries->event_link = $linky;
979
+ }
980
  }
981
  // Permit saving of events that have been edited
982
  elseif ( $action == 'edit_save' )
1008
  if ( empty($event_id) )
1009
  {
1010
  ?>
1011
+ <div class="error"><p><strong><?php _e('Failure','calendar'); ?>:</strong> <?php _e("You can't update an event if you haven't submitted an event id",'calendar'); ?></p></div>
1012
  <?php
1013
  }
1014
  else
1015
  {
1016
+ // Perform some validation on the submitted dates - this checks for valid years and months
1017
+ $date_format_one = '/^([0-9]{4})-([0][1-9])-([0-3][0-9])$/';
1018
+ $date_format_two = '/^([0-9]{4})-([1][0-2])-([0-3][0-9])$/';
1019
+ if ((preg_match($date_format_one,$begin) || preg_match($date_format_two,$begin)) && (preg_match($date_format_one,$end) || preg_match($date_format_two,$end)))
1020
+ {
1021
+ // We know we have a valid year and month and valid integers for days so now we do a final check on the date
1022
+ $begin_split = split('-',$begin);
1023
+ $begin_y = $begin_split[0];
1024
+ $begin_m = $begin_split[1];
1025
+ $begin_d = $begin_split[2];
1026
+ $end_split = split('-',$end);
1027
+ $end_y = $end_split[0];
1028
+ $end_m = $end_split[1];
1029
+ $end_d = $end_split[2];
1030
+ if (checkdate($begin_m,$begin_d,$begin_y) && checkdate($end_m,$end_d,$end_y))
1031
+ {
1032
+ // Ok, now we know we have valid dates, we want to make sure that they are either equal or that the end date is later than the start date
1033
+ if (strtotime($end) >= strtotime($begin))
1034
+ {
1035
+ $start_date_ok = 1;
1036
+ $end_date_ok = 1;
1037
+ }
1038
+ else
1039
+ {
1040
+ ?>
1041
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Your event end date must be either after or the same as your event begin date','calendar'); ?></p></div>
1042
+ <?php
1043
+ }
1044
+ }
1045
+ else
1046
+ {
1047
+ ?>
1048
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Your date formatting is correct but one or more of your dates is invalid. Check for number of days in month and leap year related errors.','calendar'); ?></p></div>
1049
+ <?php
1050
+ }
1051
+ }
1052
+ else
1053
+ {
1054
+ ?>
1055
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Both start and end dates must be entered and be in the format YYYY-MM-DD','calendar'); ?></p></div>
1056
+ <?php
1057
+ }
1058
+ // We check for a valid time, or an empty one
1059
+ $time_format_one = '/^([0-1][0-9]):([0-5][0-9])$/';
1060
+ $time_format_two = '/^([2][0-3]):([0-5][0-9])$/';
1061
+ if (preg_match($time_format_one,$time) || preg_match($time_format_two,$time) || $time == '')
1062
+ {
1063
+ $time_ok = 1;
1064
+ }
1065
+ else
1066
+ {
1067
+ ?>
1068
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The time field must either be blank or be entered in the format hh:mm','calendar'); ?></p></div>
1069
+ <?php
1070
+ }
1071
+ // We check to make sure the URL is alright
1072
+ if (preg_match('/^(http)(s?)(:)\/\//',$linky) || $linky == '')
1073
+ {
1074
+ $url_ok = 1;
1075
+ }
1076
+ else
1077
+ {
1078
+ ?>
1079
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http:// or be completely blank','calendar'); ?></p></div>
1080
+ <?php
1081
+ }
1082
+ // The title must be at least one character in length and no more than 30 - no non-standard characters allowed
1083
+ if (preg_match('/^[a-zA-Z0-9]{1}[a-zA-Z0-9[:space:]]{0,29}$/',$title))
1084
+ {
1085
+ $title_ok =1;
1086
+ }
1087
+ else
1088
+ {
1089
+ ?>
1090
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 30 characters in length and contain no punctuation. Spaces are allowed but the title must not start with one.','calendar'); ?></p></div>
1091
+ <?php
1092
+ }
1093
+ // We run some checks on recurrance
1094
+ if (($repeats == 0 && $recur == 'S') || (($repeats >= 0) && ($recur == 'W' || $recur == 'M' || $recur == 'Y')))
1095
+ {
1096
+ $recurring_ok = 1;
1097
+ }
1098
+ else
1099
+ {
1100
+ ?>
1101
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The repetition value must be 0 unless a type of recurrance is selected in which case the repetition value must be 0 or higher','calendar'); ?></p></div>
1102
+ <?php
1103
+ }
1104
+ if ($start_date_ok == 1 && $end_date_ok == 1 && $time_ok == 1 && $url_ok == 1 && $title_ok && $recurring_ok == 1)
1105
+ {
1106
  $sql = "UPDATE " . WP_CALENDAR_TABLE . " SET event_title='" . mysql_escape_string($title)
1107
  . "', event_desc='" . mysql_escape_string($desc) . "', event_begin='" . mysql_escape_string($begin)
1108
  . "', event_end='" . mysql_escape_string($end) . "', event_time='" . mysql_escape_string($time) . "', event_recur='" . mysql_escape_string($recur) . "', event_repeats='" . mysql_escape_string($repeats) . "', event_author=".$current_user->ID . ", event_category=".mysql_escape_string($category).", event_link='".mysql_escape_string($linky)."' WHERE event_id='" . mysql_escape_string($event_id) . "'";
1116
  if ( empty($result) || empty($result[0]->event_id) )
1117
  {
1118
  ?>
1119
+ <div class="error"><p><strong><?php _e('Failure','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.','calendar'); ?></p></div>
1120
  <?php
1121
  }
1122
  else
1123
  {
1124
  ?>
1125
+ <div class="updated"><p><?php _e('Event updated successfully','calendar'); ?></p></div>
1126
  <?php
1127
+ }
1128
+ }
1129
+ else
1130
+ {
1131
+ // The form is going to be rejected due to field validation issues, so we preserve the users entries here
1132
+ $users_entries->event_title = $title;
1133
+ $users_entries->event_desc = $desc;
1134
+ $users_entries->event_begin = $begin;
1135
+ $users_entries->event_end = $end;
1136
+ $users_entries->event_time = $time;
1137
+ $users_entries->event_recur = $recur;
1138
+ $users_entries->event_repeats = $repeats;
1139
+ $users_entries->event_category = $category;
1140
+ $users_entries->event_link = $linky;
1141
+ $error_with_saving = 1;
1142
+ }
1143
  }
1144
  }
1145
  // Deal with deleting an event from the database
1148
  if ( empty($event_id) )
1149
  {
1150
  ?>
1151
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e("You can't delete an event if you haven't submitted an event id",'calendar'); ?></p></div>
1152
  <?php
1153
  }
1154
  else
1162
  if ( empty($result) || empty($result[0]->event_id) )
1163
  {
1164
  ?>
1165
+ <div class="updated"><p><?php _e('Event deleted successfully','calendar'); ?></p></div>
1166
  <?php
1167
  }
1168
  else
1169
  {
1170
  ?>
1171
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('Despite issuing a request to delete, the event still remains in the database. Please investigate.','calendar'); ?></p></div>
1172
  <?php
1173
 
1174
  }
1181
 
1182
  <div class="wrap">
1183
  <?php
1184
+ if ( $action == 'edit' || ($action == 'edit_save' && $error_with_saving == 1))
1185
  {
1186
  ?>
1187
+ <h2><?php _e('Edit Event','calendar'); ?></h2>
1188
  <?php
1189
  if ( empty($event_id) )
1190
  {
1191
+ echo "<div class=\"error\"><p>".__("You must provide an event id in order to edit it",'calendar')."</p></div>";
1192
  }
1193
  else
1194
  {
1198
  else
1199
  {
1200
  ?>
1201
+ <h2><?php _e('Add Event','calendar'); ?></h2>
1202
  <?php wp_events_edit_form(); ?>
1203
 
1204
+ <h2><?php _e('Manage Events','calendar'); ?></h2>
1205
  <?php
1206
  wp_events_display_list();
1207
  }
1292
  $wpdb->get_results("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '".$initial_style."' WHERE config_item='calendar_style'");
1293
  }
1294
 
1295
+ echo "<div class=\"updated\"><p><strong>".__('Settings saved','calendar').".</strong></p></div>";
1296
  }
1297
 
1298
  // Pull the values out of the database that we need for the form
1435
  </style>
1436
 
1437
  <div class="wrap">
1438
+ <h2><?php _e('Calendar Options','calendar'); ?></h2>
1439
+ <form name="quoteform" id="quoteform" class="wrap" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=calendar-config">
1440
+ <div id="linkadvanceddiv" class="postbox">
1441
+ <div style="float: left; width: 98%; clear: both;" class="inside">
1442
+ <table cellpadding="5" cellspacing="5">
1443
+ <tr>
1444
+ <td><legend><?php _e('Choose the lowest user group that may manage events','calendar'); ?></legend></td>
1445
+ <td> <select name="permissions">
1446
+ <option value="subscriber"<?php echo $subscriber_selected ?>><?php _e('Subscriber','calendar')?></option>
1447
+ <option value="contributor" <?php echo $contributor_selected ?>><?php _e('Contributor','calendar')?></option>
1448
+ <option value="author" <?php echo $author_selected ?>><?php _e('Author','calendar')?></option>
1449
+ <option value="editor" <?php echo $editor_selected ?>><?php _e('Editor','calendar')?></option>
1450
+ <option value="admin" <?php echo $admin_selected ?>><?php _e('Administrator','calendar')?></option>
1451
  </select>
1452
+ </td>
1453
+ </tr>
1454
+ <tr>
1455
+ <td><legend><?php _e('Do you want to display the author name on events?','calendar'); ?></legend></td>
1456
+ <td> <select name="display_author">
1457
+ <option value="on" <?php echo $yes_disp_author ?>><?php _e('Yes','calendar') ?></option>
1458
+ <option value="off" <?php echo $no_disp_author ?>><?php _e('No','calendar') ?></option>
1459
  </select>
1460
+ </td>
1461
+ </tr>
1462
+ <tr>
1463
+ <td><legend><?php _e('Display a jumpbox for changing month and year quickly?','calendar'); ?></legend></td>
1464
+ <td> <select name="display_jump">
1465
+ <option value="on" <?php echo $yes_disp_jump ?>><?php _e('Yes','calendar') ?></option>
1466
+ <option value="off" <?php echo $no_disp_jump ?>><?php _e('No','calendar') ?></option>
1467
  </select>
1468
+ </td>
1469
+ </tr>
1470
+ <tr>
1471
+ <td><legend><?php _e('Display todays events?','calendar'); ?></legend></td>
1472
+ <td> <select name="display_todays">
1473
+ <option value="on" <?php echo $yes_disp_todays ?>><?php _e('Yes','calendar') ?></option>
1474
+ <option value="off" <?php echo $no_disp_todays ?>><?php _e('No','calendar') ?></option>
1475
  </select>
1476
+ </td>
1477
+ </tr>
1478
+ <tr>
1479
+ <td><legend><?php _e('Display upcoming events?','calendar'); ?></legend></td>
1480
+ <td> <select name="display_upcoming">
1481
+ <option value="on" <?php echo $yes_disp_upcoming ?>><?php _e('Yes','calendar') ?></option>
1482
+ <option value="off" <?php echo $no_disp_upcoming ?>><?php _e('No','calendar') ?></option>
1483
  </select>
1484
+ <?php _e('for','calendar'); ?> <input type="text" name="display_upcoming_days" value="<?php echo $upcoming_days ?>" size="1" maxlength="2" /> <?php _e('days into the future','calendar'); ?>
1485
+ </td>
1486
+ </tr>
1487
+ <tr>
1488
+ <td><legend><?php _e('Enable event categories?','calendar'); ?></legend></td>
1489
+ <td> <select name="enable_categories">
1490
+ <option value="on" <?php echo $yes_enable_categories ?>><?php _e('Yes','calendar') ?></option>
1491
+ <option value="off" <?php echo $no_enable_categories ?>><?php _e('No','calendar') ?></option>
1492
  </select>
1493
+ </td>
1494
+ </tr>
1495
+ <tr>
1496
+ <td style="vertical-align:top;"><legend><?php _e('Configure the stylesheet for Calendar','calendar'); ?></legend></td>
1497
+ <td><textarea name="style" rows="10" cols="60" tabindex="2"><?php echo $calendar_style; ?></textarea><br />
1498
+ <input type="checkbox" name="reset_styles" /> <?php _e('Tick this box if you wish to reset the Calendar style to default','calendar'); ?></td>
1499
+ </tr>
1500
+ </table>
 
 
1501
  </div>
1502
  <div style="clear:both; height:1px;">&nbsp;</div>
1503
  </div>
1504
+ <input type="submit" name="save" class="button bold" value="<?php _e('Save','calendar'); ?> &raquo;" />
1505
  </form>
1506
  </div>
1507
  <?php
1553
  {
1554
  $sql = "INSERT INTO " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_name='".mysql_escape_string($_POST['category_name'])."', category_colour='".mysql_escape_string($_POST['category_colour'])."'";
1555
  $wpdb->get_results($sql);
1556
+ echo "<div class=\"updated\"><p><strong>".__('Category added successfully','calendar')."</strong></p></div>";
1557
  }
1558
  else if (isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'delete')
1559
  {
1561
  $wpdb->get_results($sql);
1562
  $sql = "UPDATE " . WP_CALENDAR_TABLE . " SET event_category=1 WHERE event_category=".mysql_escape_string($_GET['category_id']);
1563
  $wpdb->get_results($sql);
1564
+ echo "<div class=\"updated\"><p><strong>".__('Category deleted successfully','calendar')."</strong></p></div>";
1565
  }
1566
  else if (isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'edit' && !isset($_POST['mode']))
1567
  {
1569
  $cur_cat = $wpdb->get_row($sql);
1570
  ?>
1571
  <div class="wrap">
1572
+ <h2><?php _e('Edit Category','calendar'); ?></h2>
1573
+ <form name="catform" id="catform" class="wrap" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=calendar-categories">
1574
  <input type="hidden" name="mode" value="edit" />
1575
  <input type="hidden" name="category_id" value="<?php echo $cur_cat->category_id ?>" />
1576
+ <div id="linkadvanceddiv" class="postbox">
1577
+ <div style="float: left; width: 98%; clear: both;" class="inside">
1578
+ <table cellpadding="5" cellspacing="5">
1579
+ <tr>
1580
+ <td><legend><?php _e('Category Name','calendar'); ?>:</legend></td>
1581
+ <td><input type="text" name="category_name" class="input" size="30" maxlength="30" value="<?php echo $cur_cat->category_name ?>" /></td>
1582
+ </tr>
1583
+ <tr>
1584
+ <td><legend><?php _e('Category Colour (Hex format)','calendar'); ?>:</legend></td>
1585
+ <td><input type="text" name="category_colour" class="input" size="10" maxlength="7" value="<?php echo $cur_cat->category_colour ?>" /></td>
1586
+ </tr>
1587
+ </table>
1588
  </div>
1589
  <div style="clear:both; height:1px;">&nbsp;</div>
1590
  </div>
1591
+ <input type="submit" name="save" class="button bold" value="<?php _e('Save','calendar'); ?> &raquo;" />
1592
  </form>
1593
  </div>
1594
  <?php
1597
  {
1598
  $sql = "UPDATE " . WP_CALENDAR_CATEGORIES_TABLE . " SET category_name='".mysql_escape_string($_POST['category_name'])."', category_colour='".mysql_escape_string($_POST['category_colour'])."' WHERE category_id=".mysql_escape_string($_POST['category_id']);
1599
  $wpdb->get_results($sql);
1600
+ echo "<div class=\"updated\"><p><strong>".__('Category edited successfully','calendar')."</strong></p></div>";
1601
  }
1602
 
1603
  if ($_GET['mode'] != 'edit' || $_POST['mode'] == 'edit')
1605
  ?>
1606
 
1607
  <div class="wrap">
1608
+ <h2><?php _e('Add Category','calendar'); ?></h2>
1609
+ <form name="catform" id="catform" class="wrap" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=calendar-categories">
1610
  <input type="hidden" name="mode" value="add" />
1611
  <input type="hidden" name="category_id" value="">
1612
+ <div id="linkadvanceddiv" class="postbox">
1613
+ <div style="float: left; width: 98%; clear: both;" class="inside">
1614
+ <table cellspacing="5" cellpadding="5">
1615
+ <tr>
1616
+ <td><legend><?php _e('Category Name','calendar'); ?>:</legend></td>
1617
+ <td><input type="text" name="category_name" class="input" size="30" maxlength="30" value="" /></td>
1618
+ </tr>
1619
+ <tr>
1620
+ <td><legend><?php _e('Category Colour (Hex format)','calendar'); ?>:</legend></td>
1621
+ <td><input type="text" name="category_colour" class="input" size="10" maxlength="7" value="" /></td>
1622
+ </tr>
1623
+ </table>
1624
  </div>
1625
  <div style="clear:both; height:1px;">&nbsp;</div>
1626
  </div>
1627
+ <input type="submit" name="save" class="button bold" value="<?php _e('Save','calendar'); ?> &raquo;" />
1628
  </form>
1629
+ <h2><?php _e('Manage Categories','calendar'); ?></h2>
1630
  <?php
1631
 
1632
  // We pull the categories from the database
1635
  if ( !empty($categories) )
1636
  {
1637
  ?>
1638
+ <table class="widefat page fixed" width="50%" cellpadding="3" cellspacing="3">
1639
+ <thead>
1640
  <tr>
1641
+ <th class="manage-column" scope="col"><?php _e('ID','calendar') ?></th>
1642
+ <th class="manage-column" scope="col"><?php _e('Category Name','calendar') ?></th>
1643
+ <th class="manage-column" scope="col"><?php _e('Category Colour','calendar') ?></th>
1644
+ <th class="manage-column" scope="col"><?php _e('Edit','calendar') ?></th>
1645
+ <th class="manage-column" scope="col"><?php _e('Delete','calendar') ?></th>
1646
  </tr>
1647
+ </thead>
1648
  <?php
1649
  $class = '';
1650
  foreach ( $categories as $category )
1655
  <th scope="row"><?php echo $category->category_id; ?></th>
1656
  <td><?php echo $category->category_name; ?></td>
1657
  <td style="background-color:<?php echo $category->category_colour; ?>;">&nbsp;</td>
1658
+ <td><a href="<?php echo $_SERVER['PHP_SELF'] ?>?page=calendar-categories&amp;mode=edit&amp;category_id=<?php echo $category->category_id;?>" class='edit'><?php echo __('Edit','calendar'); ?></a></td>
1659
  <?php
1660
  if ($category->category_id == 1)
1661
  {
1662
+ echo '<td>'.__('N/A','calendar').'</td>';
 
 
1663
  }
1664
  else
1665
  {
1666
  ?>
1667
+ <td><a href="<?php echo $_SERVER['PHP_SELF'] ?>?page=calendar-categories&amp;mode=delete&amp;category_id=<?php echo $category->category_id;?>" class="delete" onclick="return confirm('<?php echo __('Are you sure you want to delete this category?','calendar'); ?>')"><?php echo __('Delete','calendar'); ?></a></td>
1668
  <?php
1669
  }
1670
  ?>
1677
  }
1678
  else
1679
  {
1680
+ echo '<p>'.__('There are no categories in the database - something has gone wrong!','calendar').'</p>';
 
 
1681
  }
1682
 
1683
  ?>
1748
 
1749
  if ($cur_month == 12)
1750
  {
1751
+ return '<a href="' . permalink_prefix() . 'month=jan&yr=' . $next_year . '">'.__('Next','calendar').' &raquo;</a>';
1752
  }
1753
  else
1754
  {
1755
  $next_month = $cur_month + 1;
1756
  $month = $mod_rewrite_months[$next_month];
1757
+ return '<a href="' . permalink_prefix() . 'month='.$month.'&yr=' . $cur_year . '">'.__('Next','calendar').' &raquo;</a>';
1758
  }
1759
  }
1760
 
1766
 
1767
  if ($cur_month == 1)
1768
  {
1769
+ return '<a href="' . permalink_prefix() . 'month=dec&yr='. $last_year .'">&laquo; '.__('Prev','calendar').'</a>';
1770
  }
1771
  else
1772
  {
1773
  $next_month = $cur_month - 1;
1774
  $month = $mod_rewrite_months[$next_month];
1775
+ return '<a href="' . permalink_prefix() . 'month='.$month.'&yr=' . $cur_year . '">&laquo; '.__('Prev','calendar').'</a>';
1776
  }
1777
  }
1778
 
1804
  foreach($events as $event)
1805
  {
1806
  if ($event->event_time == '00:00:00') {
1807
+ $time_string = ' '.__('all day','calendar');
1808
  }
1809
  else {
1810
+ $time_string = ' '.__('at','calendar').' '.date(get_option('time_format'), strtotime($event->event_time));
1811
  }
1812
  $output .= '<li>'.draw_widget_event($event).$time_string.'</li>';
1813
  }
1819
 
1820
  if ($output != '')
1821
  {
1822
+ $visual = '<li class="upcoming-events"><h2>'.__('Upcoming Events','calendar').'</h2><ul>';
1823
  $visual .= $output;
1824
  $visual .= '</ul></li>';
1825
  return $visual;
1840
 
1841
  if ($display == 'true')
1842
  {
1843
+ $output = '<li class="todays-events"><h2>'.__('Today\'s Events','calendar').'</h2><ul>';
1844
  $events = grab_events(date("Y"),date("m"),date("d"));
1845
  usort($events, "time_cmp");
1846
  foreach($events as $event)
1847
  {
1848
  if ($event->event_time == '00:00:00') {
1849
+ $time_string = ' '.__('all day','calendar');
1850
  }
1851
  else {
1852
+ $time_string = ' '.__('at','calendar').' '.date(get_option('time_format'), strtotime($event->event_time));
1853
  }
1854
  $output .= '<li>'.draw_widget_event($event).$time_string.'</li>';
1855
  }
1884
  return $output;
1885
  }
1886
 
1887
+ // Widget todays events
1888
+ function todays_events_widget() {
1889
+ global $wpdb;
1890
+
1891
+ // This function cannot be called unless calendar is up to date
1892
+ check_calendar();
1893
+
1894
+ // Find out if we should be displaying todays events
1895
+ $display = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='display_todays'",0,0);
1896
+
1897
+ if ($display == 'true')
1898
+ {
1899
+ $output = '<ul>';
1900
+ $events = grab_events(date("Y"),date("m"),date("d"));
1901
+ usort($events, "time_cmp");
1902
+ foreach($events as $event)
1903
+ {
1904
+ if ($event->event_time == '00:00:00') {
1905
+ $time_string = ' '.__('all day','calendar');
1906
+ }
1907
+ else {
1908
+ $time_string = ' '.__('at','calendar').' '.date(get_option('time_format'), strtotime($event->event_time));
1909
+ }
1910
+ $output .= '<li>'.draw_widget_event($event).$time_string.'</li>';
1911
+ }
1912
+ $output .= '</ul>';
1913
+ if (count($events) != 0)
1914
+ {
1915
+ return $output;
1916
+ }
1917
+ }
1918
+ }
1919
+
1920
+ // Widget upcoming events
1921
+ function upcoming_events_widget() {
1922
+ global $wpdb;
1923
+
1924
+ // This function cannot be called unless calendar is up to date
1925
+ check_calendar();
1926
+
1927
+ // Find out if we should be displaying upcoming events
1928
+ $display = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='display_upcoming'",0,0);
1929
+
1930
+ if ($display == 'true')
1931
+ {
1932
+ // Get number of days we should go into the future
1933
+ $future_days = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='display_upcoming_days'",0,0);
1934
+ $day_count = 1;
1935
+
1936
+ while ($day_count < $future_days+1)
1937
+ {
1938
+ list($y,$m,$d) = split("-",date("Y-m-d",mktime($day_count*24,0,0,date("m"),date("d"),date("Y"))));
1939
+ $events = grab_events($y,$m,$d);
1940
+ usort($events, "time_cmp");
1941
+ if (count($events) != 0) {
1942
+ $output .= '<li>'.date(get_option('date_format'),mktime($day_count*24,0,0,date("m"),date("d"),date("Y"))).'<ul>';
1943
+ }
1944
+ foreach($events as $event)
1945
+ {
1946
+ if ($event->event_time == '00:00:00') {
1947
+ $time_string = ' '.__('all day','calendar');
1948
+ }
1949
+ else {
1950
+ $time_string = ' '.__('at','calendar').' '.date(get_option('time_format'), strtotime($event->event_time));
1951
+ }
1952
+ $output .= '<li>'.draw_widget_event($event).$time_string.'</li>';
1953
+ }
1954
+ if (count($events) != 0) {
1955
+ $output .= '</ul></li>';
1956
+ }
1957
+ $day_count = $day_count+1;
1958
+ }
1959
+
1960
+ if ($output != '')
1961
+ {
1962
+ $visual = '<ul>';
1963
+ $visual .= $output;
1964
+ $visual .= '</ul>';
1965
+ return $visual;
1966
+ }
1967
+ }
1968
+ }
1969
 
1970
  // The widget to show todays events in the sidebar
1971
  function widget_init_calendar_today() {
1975
 
1976
  function widget_calendar_today($args) {
1977
  extract($args);
1978
+ $the_title = get_option('calendar_today_widget_title');
1979
+ $widget_title = empty($the_title) ? __('Today\'s Events','calendar') : $the_title;
1980
+ $the_events = todays_events_widget();
1981
+ if ($the_events != '') {
1982
+ echo $before_widget;
1983
+ echo $before_title . $widget_title . $after_title;
1984
+ echo $the_events;
1985
+ echo $after_widget;
1986
+ }
1987
+ }
1988
+
1989
+ function widget_calendar_today_control() {
1990
+ $widget_title = get_option('calendar_today_widget_title');
1991
+ if (isset($_POST['calendar_today_widget_title'])) {
1992
+ update_option('calendar_today_widget_title',strip_tags($_POST['calendar_today_widget_title']));
1993
+ }
1994
  ?>
1995
+ <p>
1996
+ <label for="calendar_today_widget_title"><?php _e('Title','calendar'); ?>:<br />
1997
+ <input class="widefat" type="text" id="calendar_today_widget_title" name="calendar_today_widget_title" value="<?php echo $widget_title; ?>"/></label>
1998
+ </p>
1999
+ <?php
2000
+ }
2001
 
2002
+ register_sidebar_widget(__('Today\'s Events','calendar'),'widget_calendar_today');
2003
+ register_widget_control(__('Today\'s Events','calendar'),'widget_calendar_today_control');
2004
  }
2005
 
2006
  // The widget to show todays events in the sidebar
2011
 
2012
  function widget_calendar_upcoming($args) {
2013
  extract($args);
2014
+ $the_title = get_option('calendar_upcoming_widget_title');
2015
+ $widget_title = empty($the_title) ? __('Upcoming Events','calendar') : $the_title;
2016
+ $the_events = upcoming_events_widget();
2017
+ if ($the_events != '') {
2018
+ echo $before_widget;
2019
+ echo $before_title . $widget_title . $after_title;
2020
+ echo $the_events;
2021
+ echo $after_widget;
2022
+ }
2023
+ }
2024
+
2025
+ function widget_calendar_upcoming_control() {
2026
+ $widget_title = get_option('calendar_upcoming_widget_title');
2027
+ if (isset($_POST['calendar_upcoming_widget_title'])) {
2028
+ update_option('calendar_upcoming_widget_title',strip_tags($_POST['calendar_upcoming_widget_title']));
2029
+ }
2030
  ?>
2031
+ <p>
2032
+ <label for="calendar_upcoming_widget_title"><?php _e('Title','calendar'); ?>:<br />
2033
+ <input class="widefat" type="text" id="calendar_upcoming_widget_title" name="calendar_upcoming_widget_title" value="<?php echo $widget_title; ?>"/></label>
2034
+ </p>
2035
+ <?php
2036
+ }
2037
 
2038
+ register_sidebar_widget(__('Upcoming Events','calendar'),'widget_calendar_upcoming');
2039
+ register_widget_control(__('Upcoming Events','calendar'),'widget_calendar_upcoming_control');
2040
  }
2041
 
2042
 
2064
  $header_details .= '<div class="event-title">'.$event->event_title.'</div><div class="event-title-break"></div>';
2065
  if ($event->event_time != "00:00:00")
2066
  {
2067
+ $header_details .= '<strong>'.__('Time','calendar').':</strong> ' . date(get_option('time_format'), strtotime($event->event_time)) . '<br />';
2068
  }
2069
  if ($display_author == 'true')
2070
  {
2071
  $e = get_userdata($event->event_author);
2072
+ $header_details .= '<strong>'.__('Posted by', 'calendar').':</strong> '.$e->display_name.'<br />';
2073
  }
2074
  if ($display_author == 'true' || $event->event_time != "00:00:00")
2075
  {
2108
  $header_details .= '<div class="event-title">'.$event->event_title.'</div><div class="event-title-break"></div>';
2109
  if ($event->event_time != "00:00:00")
2110
  {
2111
+ $header_details .= '<strong>'.__('Time','calendar').':</strong> ' . date(get_option('time_format'), strtotime($event->event_time)) . '<br />';
2112
  }
2113
  if ($display_author == 'true')
2114
  {
2115
  $e = get_userdata($event->event_author);
2116
+ $header_details .= '<strong>'.__('Posted by','calendar').':</strong> '.$e->display_name.'<br />';
2117
  }
2118
  if ($display_author == 'true' || $event->event_time != "00:00:00")
2119
  {
2408
  // Deal with the week not starting on a monday
2409
  if (get_option('start_of_week') == 0)
2410
  {
2411
+ $name_days = array(1=>__('Sunday','calendar'),__('Monday','calendar'),__('Tuesday','calendar'),__('Wednesday','calendar'),__('Thursday','calendar'),__('Friday','calendar'),__('Saturday','calendar'));
2412
  }
2413
  // Choose Monday if anything other than Sunday is set
2414
  else
2415
  {
2416
+ $name_days = array(1=>__('Monday','calendar'),__('Tuesday','calendar'),__('Wednesday','calendar'),__('Thursday','calendar'),__('Friday','calendar'),__('Saturday','calendar'),__('Sunday','calendar'));
2417
  }
2418
 
2419
  // Carry on with the script
2420
+ $name_months = array(1=>__('January','calendar'),__('February','calendar'),__('March','calendar'),__('April','calendar'),__('May','calendar'),__('June','calendar'),__('July','calendar'),__('August','calendar'),__('September','calendar'),__('October','calendar'),__('November','calendar'),__('December','calendar'));
2421
 
2422
  // If we don't pass arguments we want a calendar that is relevant to today
2423
  if (empty($_GET['month']) || empty($_GET['yr']))
2526
  }
2527
  // We build the months in the switcher
2528
  $calendar_body .= '
2529
+ '.__('Month','calendar').': <select name="month" style="width:100px;">
2530
+ <option value="jan"'.month_comparison('jan').'>'.__('January','calendar').'</option>
2531
+ <option value="feb"'.month_comparison('feb').'>'.__('February','calendar').'</option>
2532
+ <option value="mar"'.month_comparison('mar').'>'.__('March','calendar').'</option>
2533
+ <option value="apr"'.month_comparison('apr').'>'.__('April','calendar').'</option>
2534
+ <option value="may"'.month_comparison('may').'>'.__('May','calendar').'</option>
2535
+ <option value="jun"'.month_comparison('jun').'>'.__('June','calendar').'</option>
2536
+ <option value="jul"'.month_comparison('jul').'>'.__('July','calendar').'</option>
2537
+ <option value="aug"'.month_comparison('aug').'>'.__('August','calendar').'</option>
2538
+ <option value="sept"'.month_comparison('sept').'>'.__('September','calendar').'</option>
2539
+ <option value="oct"'.month_comparison('oct').'>'.__('October','calendar').'</option>
2540
+ <option value="nov"'.month_comparison('nov').'>'.__('November','calendar').'</option>
2541
+ <option value="dec"'.month_comparison('dec').'>'.__('December','calendar').'</option>
2542
  </select>
2543
+ '.__('Year','calendar').': <select name="yr" style="width:60px;">
2544
  ';
2545
 
2546
  // The year builder is string mania. If you can make sense of this,
2687
  $cat_details = $wpdb->get_results($sql);
2688
  $calendar_body .= '<tr><td colspan="7">
2689
  <table class="cat-key">
2690
+ <tr><td colspan="2"><strong>'.__('Category Key','calendar').'</strong></td></tr>
2691
  ';
2692
  foreach($cat_details as $cat_detail)
2693
  {
2701
  ';
2702
 
2703
  // A little link to yours truely. See the README if you wish to remove this
2704
+ $calendar_body .= '<div class="kjo-link" style="visibility:visible;display:block;"><p>'.__('Calendar developed and supported by ', 'calendar').'<a href="http://www.kieranoshea.com">Kieran O\'Shea</a></p></div>
2705
  ';
2706
 
2707
  // Phew! After that bit of string building, spit it all out.
calendar.pot ADDED
@@ -0,0 +1,505 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Calendar translation file
2
+ # Copyright (C) 2009 Kieran O'Shea
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # Kieran O'Shea <kieran@kieranoshea.com>, 2009
5
+
6
+ #: calendar.php:116
7
+ msgid "Calendar"
8
+ msgstr ""
9
+
10
+ #: calendar.php:120
11
+ msgid "Manage Calendar"
12
+ msgstr ""
13
+
14
+ #: calendar.php:123 calendar.php:1628
15
+ msgid "Manage Categories"
16
+ msgstr ""
17
+
18
+ #: calendar.php:124
19
+ msgid "Calendar Config"
20
+ msgstr ""
21
+
22
+ #: calendar.php:124 calendar.php:1437
23
+ msgid "Calendar Options"
24
+ msgstr ""
25
+
26
+ #: calendar.php:516 calendar.php:1640
27
+ msgid "ID"
28
+ msgstr ""
29
+
30
+ #: calendar.php:517 calendar.php:1992 calendar.php:2025
31
+ msgid "Title"
32
+ msgstr ""
33
+
34
+ #: calendar.php:518
35
+ msgid "Description"
36
+ msgstr ""
37
+
38
+ #: calendar.php:519 calendar.php:665
39
+ msgid "Start Date"
40
+ msgstr ""
41
+
42
+ #: calendar.php:520 calendar.php:683
43
+ msgid "End Date"
44
+ msgstr ""
45
+
46
+ #: calendar.php:521
47
+ msgid "Recurs"
48
+ msgstr ""
49
+
50
+ #: calendar.php:522
51
+ msgid "Repeats"
52
+ msgstr ""
53
+
54
+ #: calendar.php:523 calendar.php:1447
55
+ msgid "Author"
56
+ msgstr ""
57
+
58
+ #: calendar.php:524
59
+ msgid "Category"
60
+ msgstr ""
61
+
62
+ #: calendar.php:525 calendar.php:565 calendar.php:1643 calendar.php:1657
63
+ msgid "Edit"
64
+ msgstr ""
65
+
66
+ #: calendar.php:526 calendar.php:566 calendar.php:1644 calendar.php:1666
67
+ msgid "Delete"
68
+ msgstr ""
69
+
70
+ #: calendar.php:544
71
+ msgid "Never"
72
+ msgstr ""
73
+
74
+ #: calendar.php:545
75
+ msgid "Weekly"
76
+ msgstr ""
77
+
78
+ #: calendar.php:546
79
+ msgid "Monthly"
80
+ msgstr ""
81
+
82
+ #: calendar.php:547
83
+ msgid "Yearly"
84
+ msgstr ""
85
+
86
+ #: calendar.php:553 calendar.php:1661
87
+ msgid "N/A"
88
+ msgstr ""
89
+
90
+ #: calendar.php:554
91
+ msgid "Forever"
92
+ msgstr ""
93
+
94
+ #: calendar.php:555
95
+ msgid "Times"
96
+ msgstr ""
97
+
98
+ #: calendar.php:566
99
+ msgid "Are you sure you want to delete this event?"
100
+ msgstr ""
101
+
102
+ #: calendar.php:577
103
+ msgid "There are no events in the database!"
104
+ msgstr ""
105
+
106
+ #: calendar.php:593
107
+ msgid "Bad Monkey! No banana!"
108
+ msgstr ""
109
+
110
+ #: calendar.php:601
111
+ msgid "An event with that ID couldn't be found"
112
+ msgstr ""
113
+
114
+ #: calendar.php:628
115
+ msgid "Event Title"
116
+ msgstr ""
117
+
118
+ #: calendar.php:633
119
+ msgid "Event Description"
120
+ msgstr ""
121
+
122
+ #: calendar.php:637
123
+ msgid "Event Category"
124
+ msgstr ""
125
+
126
+ #: calendar.php:661
127
+ msgid "Event Link (Optional)"
128
+ msgstr ""
129
+
130
+ #: calendar.php:679 calendar.php:704
131
+ msgid "Select Date"
132
+ msgstr ""
133
+
134
+ #: calendar.php:708
135
+ msgid "Time (hh:mm)"
136
+ msgstr ""
137
+
138
+ #: calendar.php:726
139
+ msgid "Optional, set blank if not required."
140
+ msgstr ""
141
+
142
+ #: calendar.php:726
143
+ msgid "Current time difference from GMT is "
144
+ msgstr ""
145
+
146
+ #: calendar.php:726
147
+ msgid " hour(s)"
148
+ msgstr ""
149
+
150
+ #: calendar.php:730
151
+ msgid "Recurring Events"
152
+ msgstr ""
153
+
154
+ #: calendar.php:758
155
+ msgid "Repeats for"
156
+ msgstr ""
157
+
158
+ #: calendar.php:766
159
+ msgid ""
160
+ "Entering 0 means forever. Where the recurrance interval is left at none, the "
161
+ "event will not reoccur."
162
+ msgstr ""
163
+
164
+ #: calendar.php:773 calendar.php:1503 calendar.php:1590 calendar.php:1626
165
+ msgid "Save"
166
+ msgstr ""
167
+
168
+ #: calendar.php:878 calendar.php:885 calendar.php:892 calendar.php:905
169
+ #: calendar.php:916 calendar.php:927 calendar.php:938 calendar.php:956
170
+ #: calendar.php:1040 calendar.php:1047 calendar.php:1054 calendar.php:1067
171
+ #: calendar.php:1078 calendar.php:1089 calendar.php:1100 calendar.php:1150
172
+ #: calendar.php:1170
173
+ msgid "Error"
174
+ msgstr ""
175
+
176
+ #: calendar.php:878 calendar.php:1040
177
+ msgid ""
178
+ "Your event end date must be either after or the same as your event begin date"
179
+ msgstr ""
180
+
181
+ #: calendar.php:885 calendar.php:1047
182
+ msgid ""
183
+ "Your date formatting is correct but one or more of your dates is invalid. "
184
+ "Check for number of days in month and leap year related errors."
185
+ msgstr ""
186
+
187
+ #: calendar.php:892 calendar.php:1054
188
+ msgid ""
189
+ "Both start and end dates must be entered and be in the format YYYY-MM-DD"
190
+ msgstr ""
191
+
192
+ #: calendar.php:905 calendar.php:1067
193
+ msgid "The time field must either be blank or be entered in the format hh:mm"
194
+ msgstr ""
195
+
196
+ #: calendar.php:916 calendar.php:1078
197
+ msgid ""
198
+ "The URL entered must either be prefixed with http:// or be completely blank"
199
+ msgstr ""
200
+
201
+ #: calendar.php:927 calendar.php:1089
202
+ msgid ""
203
+ "The event title must be between 1 and 30 characters in length and contain no "
204
+ "punctuation. Spaces are allowed but the title must not start with one."
205
+ msgstr ""
206
+
207
+ #: calendar.php:938 calendar.php:1100
208
+ msgid ""
209
+ "The repetition value must be 0 unless a type of recurrance is selected in "
210
+ "which case the repetition value must be 0 or higher"
211
+ msgstr ""
212
+
213
+ #: calendar.php:956
214
+ msgid ""
215
+ "An event with the details you submitted could not be found in the database. "
216
+ "This may indicate a problem with your database or the way in which it is "
217
+ "configured."
218
+ msgstr ""
219
+
220
+ #: calendar.php:962
221
+ msgid "Event added. It will now show in your calendar."
222
+ msgstr ""
223
+
224
+ #: calendar.php:1010 calendar.php:1118
225
+ msgid "Failure"
226
+ msgstr ""
227
+
228
+ #: calendar.php:1010
229
+ msgid "You can't update an event if you haven't submitted an event id"
230
+ msgstr ""
231
+
232
+ #: calendar.php:1118
233
+ msgid ""
234
+ "The database failed to return data to indicate the event has been updated "
235
+ "sucessfully. This may indicate a problem with your database or the way in "
236
+ "which it is configured."
237
+ msgstr ""
238
+
239
+ #: calendar.php:1124
240
+ msgid "Event updated successfully"
241
+ msgstr ""
242
+
243
+ #: calendar.php:1150
244
+ msgid "You can't delete an event if you haven't submitted an event id"
245
+ msgstr ""
246
+
247
+ #: calendar.php:1164
248
+ msgid "Event deleted successfully"
249
+ msgstr ""
250
+
251
+ #: calendar.php:1170
252
+ msgid ""
253
+ "Despite issuing a request to delete, the event still remains in the "
254
+ "database. Please investigate."
255
+ msgstr ""
256
+
257
+ #: calendar.php:1186
258
+ msgid "Edit Event"
259
+ msgstr ""
260
+
261
+ #: calendar.php:1190
262
+ msgid "You must provide an event id in order to edit it"
263
+ msgstr ""
264
+
265
+ #: calendar.php:1200
266
+ msgid "Add Event"
267
+ msgstr ""
268
+
269
+ #: calendar.php:1203
270
+ msgid "Manage Events"
271
+ msgstr ""
272
+
273
+ #: calendar.php:1294
274
+ msgid "Settings saved"
275
+ msgstr ""
276
+
277
+ #: calendar.php:1443
278
+ msgid "Choose the lowest user group that may manage events"
279
+ msgstr ""
280
+
281
+ #: calendar.php:1445
282
+ msgid "Subscriber"
283
+ msgstr ""
284
+
285
+ #: calendar.php:1446
286
+ msgid "Contributor"
287
+ msgstr ""
288
+
289
+ #: calendar.php:1448
290
+ msgid "Editor"
291
+ msgstr ""
292
+
293
+ #: calendar.php:1449
294
+ msgid "Administrator"
295
+ msgstr ""
296
+
297
+ #: calendar.php:1454
298
+ msgid "Do you want to display the author name on events?"
299
+ msgstr ""
300
+
301
+ #: calendar.php:1456 calendar.php:1464 calendar.php:1472 calendar.php:1480
302
+ #: calendar.php:1489
303
+ msgid "Yes"
304
+ msgstr ""
305
+
306
+ #: calendar.php:1457 calendar.php:1465 calendar.php:1473 calendar.php:1481
307
+ #: calendar.php:1490
308
+ msgid "No"
309
+ msgstr ""
310
+
311
+ #: calendar.php:1462
312
+ msgid "Display a jumpbox for changing month and year quickly?"
313
+ msgstr ""
314
+
315
+ #: calendar.php:1470
316
+ msgid "Display todays events?"
317
+ msgstr ""
318
+
319
+ #: calendar.php:1478
320
+ msgid "Display upcoming events?"
321
+ msgstr ""
322
+
323
+ #: calendar.php:1483
324
+ msgid "for"
325
+ msgstr ""
326
+
327
+ #: calendar.php:1483
328
+ msgid "days into the future"
329
+ msgstr ""
330
+
331
+ #: calendar.php:1487
332
+ msgid "Enable event categories?"
333
+ msgstr ""
334
+
335
+ #: calendar.php:1495
336
+ msgid "Configure the stylesheet for Calendar"
337
+ msgstr ""
338
+
339
+ #: calendar.php:1497
340
+ msgid "Tick this box if you wish to reset the Calendar style to default"
341
+ msgstr ""
342
+
343
+ #: calendar.php:1555
344
+ msgid "Category added successfully"
345
+ msgstr ""
346
+
347
+ #: calendar.php:1563
348
+ msgid "Category deleted successfully"
349
+ msgstr ""
350
+
351
+ #: calendar.php:1571
352
+ msgid "Edit Category"
353
+ msgstr ""
354
+
355
+ #: calendar.php:1579 calendar.php:1615 calendar.php:1641
356
+ msgid "Category Name"
357
+ msgstr ""
358
+
359
+ #: calendar.php:1583 calendar.php:1619
360
+ msgid "Category Colour (Hex format)"
361
+ msgstr ""
362
+
363
+ #: calendar.php:1599
364
+ msgid "Category edited successfully"
365
+ msgstr ""
366
+
367
+ #: calendar.php:1607
368
+ msgid "Add Category"
369
+ msgstr ""
370
+
371
+ #: calendar.php:1642
372
+ msgid "Category Colour"
373
+ msgstr ""
374
+
375
+ #: calendar.php:1666
376
+ msgid "Are you sure you want to delete this category?"
377
+ msgstr ""
378
+
379
+ #: calendar.php:1679
380
+ msgid "There are no categories in the database - something has gone wrong!"
381
+ msgstr ""
382
+
383
+ #: calendar.php:1750 calendar.php:1756
384
+ msgid "Next"
385
+ msgstr ""
386
+
387
+ #: calendar.php:1768 calendar.php:1774
388
+ msgid "Prev"
389
+ msgstr ""
390
+
391
+ #: calendar.php:1806 calendar.php:1848 calendar.php:1904 calendar.php:1946
392
+ msgid "all day"
393
+ msgstr ""
394
+
395
+ #: calendar.php:1809 calendar.php:1851 calendar.php:1907 calendar.php:1949
396
+ msgid "at"
397
+ msgstr ""
398
+
399
+ #: calendar.php:1821 calendar.php:2011 calendar.php:2031 calendar.php:2032
400
+ msgid "Upcoming Events"
401
+ msgstr ""
402
+
403
+ #: calendar.php:1842 calendar.php:1978 calendar.php:1998 calendar.php:1999
404
+ msgid "Today's Events"
405
+ msgstr ""
406
+
407
+ #: calendar.php:2060 calendar.php:2104
408
+ msgid "Time"
409
+ msgstr ""
410
+
411
+ #: calendar.php:2065 calendar.php:2109
412
+ msgid "Posted by"
413
+ msgstr ""
414
+
415
+ #: calendar.php:2404 calendar.php:2409
416
+ msgid "Sunday"
417
+ msgstr ""
418
+
419
+ #: calendar.php:2404 calendar.php:2409
420
+ msgid "Monday"
421
+ msgstr ""
422
+
423
+ #: calendar.php:2404 calendar.php:2409
424
+ msgid "Tuesday"
425
+ msgstr ""
426
+
427
+ #: calendar.php:2404 calendar.php:2409
428
+ msgid "Wednesday"
429
+ msgstr ""
430
+
431
+ #: calendar.php:2404 calendar.php:2409
432
+ msgid "Thursday"
433
+ msgstr ""
434
+
435
+ #: calendar.php:2404 calendar.php:2409
436
+ msgid "Friday"
437
+ msgstr ""
438
+
439
+ #: calendar.php:2404 calendar.php:2409
440
+ msgid "Saturday"
441
+ msgstr ""
442
+
443
+ #: calendar.php:2413 calendar.php:2523
444
+ msgid "January"
445
+ msgstr ""
446
+
447
+ #: calendar.php:2413 calendar.php:2524
448
+ msgid "February"
449
+ msgstr ""
450
+
451
+ #: calendar.php:2413 calendar.php:2525
452
+ msgid "March"
453
+ msgstr ""
454
+
455
+ #: calendar.php:2413 calendar.php:2526
456
+ msgid "April"
457
+ msgstr ""
458
+
459
+ #: calendar.php:2413 calendar.php:2527
460
+ msgid "May"
461
+ msgstr ""
462
+
463
+ #: calendar.php:2413 calendar.php:2528
464
+ msgid "June"
465
+ msgstr ""
466
+
467
+ #: calendar.php:2413 calendar.php:2529
468
+ msgid "July"
469
+ msgstr ""
470
+
471
+ #: calendar.php:2413 calendar.php:2530
472
+ msgid "August"
473
+ msgstr ""
474
+
475
+ #: calendar.php:2413 calendar.php:2531
476
+ msgid "September"
477
+ msgstr ""
478
+
479
+ #: calendar.php:2413 calendar.php:2532
480
+ msgid "October"
481
+ msgstr ""
482
+
483
+ #: calendar.php:2413 calendar.php:2533
484
+ msgid "November"
485
+ msgstr ""
486
+
487
+ #: calendar.php:2413 calendar.php:2534
488
+ msgid "December"
489
+ msgstr ""
490
+
491
+ #: calendar.php:2522
492
+ msgid "Month"
493
+ msgstr ""
494
+
495
+ #: calendar.php:2536
496
+ msgid "Year"
497
+ msgstr ""
498
+
499
+ #: calendar.php:2683
500
+ msgid "Category Key"
501
+ msgstr ""
502
+
503
+ #: calendar.php:2697
504
+ msgid "Calendar developed and supported by "
505
+ msgstr ""
javascript.js CHANGED
@@ -1038,6 +1038,10 @@ function CP_tmpReturnFunction(y,m,d) {
1038
  var dt = new Date(y,m-1,d,0,0,0);
1039
  if (window.CP_calendarObject!=null) { window.CP_calendarObject.copyMonthNamesToWindow(); }
1040
  window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);
 
 
 
 
1041
  }
1042
  else {
1043
  alert('Use setReturnFunction() to define which function will get the clicked results!');
1038
  var dt = new Date(y,m-1,d,0,0,0);
1039
  if (window.CP_calendarObject!=null) { window.CP_calendarObject.copyMonthNamesToWindow(); }
1040
  window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);
1041
+ // Kieran - fixed issue with end date not becoming begin date after begin date is set
1042
+ if (CP_targetInput.name == 'event_begin') {
1043
+ document.forms['quoteform'].event_end.value = formatDate(dt,window.CP_dateFormat);
1044
+ }
1045
  }
1046
  else {
1047
  alert('Use setReturnFunction() to define which function will get the clicked results!');
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Calendar ===
2
  Contributors: KieranOShea
3
- Donate link: http://www.kjowebservices.co.uk
4
  Tags: calendar, dates, times, events
5
  Requires at least: 2.0
6
- Tested up to: 2.6.2
7
- Stable tag: 1.2.1
8
 
9
  A simple but effective Calendar plugin for WordPress that allows you to
10
  manage your events and appointments and display them to the world.
@@ -28,14 +28,19 @@ Features:
28
  * Easy to use events manager in admin dashboard
29
  * Sidebar function/Widget to show todays events
30
  * Sidebar function/Widget to show upcoming events
 
 
31
  * Comprehensive options panel for admin
32
  * Modifiable CSS using the options panel
33
  * Optional drop down boxes to quickly change month and year
34
  * User groups other than admin can be permitted to manage events
35
  * Events can be placed into categories
 
36
  * Categories system can be switched on or off
37
  * Pop up javascript calendars help the choosing of dates
38
  * Events can be links pointing to a location of your choice
 
 
39
 
40
  == Installation ==
41
 
@@ -47,7 +52,7 @@ Installing:
47
 
48
  2. Activate the plugin on your WordPress plugins page
49
 
50
- 3. Configure Calendar using:
51
 
52
  Calendar -> Manage Events
53
 
@@ -56,6 +61,27 @@ Installing:
56
  Calendar -> Calendar Options
57
 
58
  4. Edit or create a page on your blog which includes the text {CALENDAR} and visit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  the page you have edited or created page. You should see your calendar in action.
60
 
61
  Upgrading from 1.1:
@@ -71,7 +97,7 @@ Upgrading from 1.1:
71
 
72
  5. Activate the plugin on your WordPress plugins page
73
 
74
- 6. Configure Calendar using:
75
 
76
  Calendar -> Manage Events
77
 
@@ -94,21 +120,22 @@ Uninstalling:
94
 
95
  = Where are the frequently asked questions for Calendar? =
96
 
97
- They are located on the [KJO Web Services forum](http://forum.kjowebservices.co.uk/viewtopic.php?f=13&t=10 "KJO Web Services forum")
 
 
98
 
99
  = Where can I get support for the plugin? =
100
 
101
- Support via e-mail became too much of a burden and the lack of e-mail
102
- notifications made monitoring the WordPress forums impossible. There
103
- is now a support area for Calendar on the [KJO Web Services forum](http://forum.kjowebservices.co.uk/viewtopic.php?f=13 "KJO Web Services forum")
104
- which will be monitored and is the only official place to get support for Calendar.
105
 
106
- = Can I remove the link to your company? =
107
 
108
- Yes, you may do this, but please only do so if you absolutely have to (for
109
- instance if you are using Calendar for a business site). Calendar is
110
- popular and the business we get from users of Calendar deciding to comission
111
- web work is what allows us to continue to provide Calendar free and open source.
112
 
113
  == Screenshots ==
114
 
1
  === Calendar ===
2
  Contributors: KieranOShea
3
+ Donate link: http://www.kieranoshea.com
4
  Tags: calendar, dates, times, events
5
  Requires at least: 2.0
6
+ Tested up to: 2.8
7
+ Stable tag: 1.2.2
8
 
9
  A simple but effective Calendar plugin for WordPress that allows you to
10
  manage your events and appointments and display them to the world.
28
  * Easy to use events manager in admin dashboard
29
  * Sidebar function/Widget to show todays events
30
  * Sidebar function/Widget to show upcoming events
31
+ * Lists of todays events can be displayed in posts or pages
32
+ * Lists of upcoming events can be displayed in posts or pages
33
  * Comprehensive options panel for admin
34
  * Modifiable CSS using the options panel
35
  * Optional drop down boxes to quickly change month and year
36
  * User groups other than admin can be permitted to manage events
37
  * Events can be placed into categories
38
+ * A calendar of events for just one of more categories can be displayed
39
  * Categories system can be switched on or off
40
  * Pop up javascript calendars help the choosing of dates
41
  * Events can be links pointing to a location of your choice
42
+ * Full internationalisation is possible
43
+ * Comaptible with WordPress MU
44
 
45
  == Installation ==
46
 
52
 
53
  2. Activate the plugin on your WordPress plugins page
54
 
55
+ 3. Configure Calendar using the following pages in the admin panel:
56
 
57
  Calendar -> Manage Events
58
 
61
  Calendar -> Calendar Options
62
 
63
  4. Edit or create a page on your blog which includes the text {CALENDAR} and visit
64
+ the page you have edited or created. You should see your calendar in action.
65
+
66
+ Upgrading from 1.2 or later:
67
+
68
+ 1. Deactivate the plugin (you will not lose any events)
69
+
70
+ 2. Remove your current calendar directory from the WordPress plugins directory
71
+
72
+ 2. Upload the whole calendar directory into your WordPress plugins directory.
73
+
74
+ 3. Activate the plugin on your WordPress plugins page
75
+
76
+ 4. Configure Calendar using the following pages in the admin panel:
77
+
78
+ Calendar -> Manage Events
79
+
80
+ Calendar -> Manage Categories
81
+
82
+ Calendar -> Calendar Options
83
+
84
+ 5. Edit or create a page on your blog which includes the text {CALENDAR} and visit
85
  the page you have edited or created page. You should see your calendar in action.
86
 
87
  Upgrading from 1.1:
97
 
98
  5. Activate the plugin on your WordPress plugins page
99
 
100
+ 6. Configure Calendar using the following pages in the admin panel:
101
 
102
  Calendar -> Manage Events
103
 
120
 
121
  = Where are the frequently asked questions for Calendar? =
122
 
123
+ They are located on [Kieran O'Shea's forum](http://www.kieranoshea.com/forum/viewtopic.php?f=13&t=10 "Kieran O'Shea's forum").
124
+ Please note that you should check these before asking any support questions or thinking your calendar install isn't working
125
+ properly.
126
 
127
  = Where can I get support for the plugin? =
128
 
129
+ Support is only available on [Kieran O'Shea's forum](http://www.kieranoshea.com/forum/viewtopic.php?f=13&t=10 "Kieran O'Shea's forum").
130
+ Regrettably e-mail support became too cumberome to manage and so now all support and bug report e-mails for calendar will be ignored. All
131
+ such queries will be answered promptly on the forums, although please make sure you search first before asking your question.
 
132
 
133
+ = Can I remove the link to your site? =
134
 
135
+ Yes, you may do this, but please be aware that support will not be provided
136
+ to those who choose to remove the link. When you ask your support question
137
+ you will be asked for the URL to your blog and the presence of the link will
138
+ be checked before support will be provided.
139
 
140
  == Screenshots ==
141