Calendar - Version 1.3.13

Version Description

  • Fixed loading order issue with internationalisation
  • Enabled the full 30 characters in the title, even for unicode
  • Fix ability to add basic HTML (line breaks etc.) into event descriptions
  • Validated performance and compatibility with latest version of WordPress
Download this release

Release Info

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

Code changes from version 1.3.12 to 1.3.13

Files changed (2) hide show
  1. calendar.php +19 -15
  2. readme.txt +9 -3
calendar.php CHANGED
@@ -7,7 +7,7 @@ Author: Kieran O'Shea
7
  Author URI: http://www.kieranoshea.com
8
  Text Domain: calendar
9
  Domain Path: /languages
10
- Version: 1.3.12
11
  */
12
 
13
  /* Copyright 2008 Kieran O'Shea (email : kieran@kieranoshea.com)
@@ -31,11 +31,15 @@ Version: 1.3.12
31
  if ( ! defined( 'ABSPATH' ) ) exit;
32
 
33
  // Enable internationalisation
34
- $plugin_dir = plugin_basename(dirname(__FILE__));
35
- load_plugin_textdomain( 'calendar',false, $plugin_dir.'/languages');
 
 
 
36
 
37
- // Define the tables used in Calendar
38
  global $wpdb;
 
39
  define('WP_CALENDAR_TABLE', $wpdb->prefix . 'calendar');
40
  define('WP_CALENDAR_CONFIG_TABLE', $wpdb->prefix . 'calendar_config');
41
  define('WP_CALENDAR_CATEGORIES_TABLE', $wpdb->prefix . 'calendar_categories');
@@ -536,7 +540,7 @@ function calendar_check()
536
  event_id INT(11) NOT NULL AUTO_INCREMENT ,
537
  event_begin DATE NOT NULL ,
538
  event_end DATE NOT NULL ,
539
- event_title VARCHAR(30) NOT NULL ,
540
  event_desc TEXT NOT NULL ,
541
  event_time TIME ,
542
  event_recur CHAR(1) ,
@@ -797,7 +801,7 @@ function calendar_events_edit_form($mode='add', $event_id=false)
797
  <table cellpadding="5" cellspacing="5">
798
  <tr>
799
  <td><legend><?php _e('Event Title','calendar'); ?></legend></td>
800
- <td><input type="text" name="event_title" class="input" size="40" maxlength="30"
801
  value="<?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_title)); ?>" /></td>
802
  </tr>
803
  <tr>
@@ -986,7 +990,7 @@ $event_id = !empty($_REQUEST['event_id']) ? sanitize_text_field($_REQUEST['event
986
  if ( $action == 'add' )
987
  {
988
  $title = !empty($_REQUEST['event_title']) ? sanitize_text_field($_REQUEST['event_title']) : '';
989
- $desc = !empty($_REQUEST['event_desc']) ? wp_filter_nohtml_kses($_REQUEST['event_desc']) : '';
990
  $begin = !empty($_REQUEST['event_begin']) ? sanitize_text_field($_REQUEST['event_begin']) : '';
991
  $end = !empty($_REQUEST['event_end']) ? sanitize_text_field($_REQUEST['event_end']) : '';
992
  $time = !empty($_REQUEST['event_time']) ? sanitize_text_field($_REQUEST['event_time']) : '';
@@ -1079,15 +1083,15 @@ if ( $action == 'add' )
1079
  <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http(s):// 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
1083
- if (preg_match('/^.{1,30}$/',$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','calendar'); ?></p></div>
1091
  <?php
1092
  }
1093
  // We run some checks on recurrance
@@ -1144,7 +1148,7 @@ if ( $action == 'add' )
1144
  elseif ( $action == 'edit_save' )
1145
  {
1146
  $title = !empty($_REQUEST['event_title']) ? sanitize_text_field($_REQUEST['event_title']) : '';
1147
- $desc = !empty($_REQUEST['event_desc']) ? wp_filter_nohtml_kses($_REQUEST['event_desc']) : '';
1148
  $begin = !empty($_REQUEST['event_begin']) ? sanitize_text_field($_REQUEST['event_begin']) : '';
1149
  $end = !empty($_REQUEST['event_end']) ? sanitize_text_field($_REQUEST['event_end']) : '';
1150
  $time = !empty($_REQUEST['event_time']) ? sanitize_text_field($_REQUEST['event_time']) : '';
@@ -1244,15 +1248,15 @@ elseif ( $action == 'edit_save' )
1244
  <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>
1245
  <?php
1246
  }
1247
- // The title must be at least one character in length and no more than 30
1248
- if (preg_match('/^.{1,30}$/',$title))
1249
  {
1250
  $title_ok =1;
1251
  }
1252
  else
1253
  {
1254
  ?>
1255
- <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The event title must be between 1 and 30 characters in length','calendar'); ?></p></div>
1256
  <?php
1257
  }
1258
  // We run some checks on recurrance
@@ -2281,7 +2285,7 @@ function calendar_draw_event($event)
2281
 
2282
  $linky = apply_filters('modify_calendar_link', $linky, $event);
2283
 
2284
- $details = '<span class="calnk"><a href="'.$linky.'" '.$style.'>' . htmlspecialchars(stripslashes($event->event_title)) . '<span '.$style.'>' . $header_details . '' . htmlspecialchars(stripslashes($event->event_desc)) . '</span></a></span>';
2285
 
2286
  return $details;
2287
  }
7
  Author URI: http://www.kieranoshea.com
8
  Text Domain: calendar
9
  Domain Path: /languages
10
+ Version: 1.3.13
11
  */
12
 
13
  /* Copyright 2008 Kieran O'Shea (email : kieran@kieranoshea.com)
31
  if ( ! defined( 'ABSPATH' ) ) exit;
32
 
33
  // Enable internationalisation
34
+ function calendar_load_text_domain() {
35
+ $plugin_dir = plugin_basename(dirname(__FILE__));
36
+ load_plugin_textdomain('calendar', false, $plugin_dir . '/languages');
37
+ }
38
+ add_action('plugins_loaded', 'calendar_load_text_domain');
39
 
40
+ // Define the constants & tables used in Calendar
41
  global $wpdb;
42
+ define('CALENDAR_TITLE_LENGTH', 30);
43
  define('WP_CALENDAR_TABLE', $wpdb->prefix . 'calendar');
44
  define('WP_CALENDAR_CONFIG_TABLE', $wpdb->prefix . 'calendar_config');
45
  define('WP_CALENDAR_CATEGORIES_TABLE', $wpdb->prefix . 'calendar_categories');
540
  event_id INT(11) NOT NULL AUTO_INCREMENT ,
541
  event_begin DATE NOT NULL ,
542
  event_end DATE NOT NULL ,
543
+ event_title VARCHAR(".CALENDAR_TITLE_LENGTH.") NOT NULL ,
544
  event_desc TEXT NOT NULL ,
545
  event_time TIME ,
546
  event_recur CHAR(1) ,
801
  <table cellpadding="5" cellspacing="5">
802
  <tr>
803
  <td><legend><?php _e('Event Title','calendar'); ?></legend></td>
804
+ <td><input type="text" name="event_title" class="input" size="40" maxlength="<?php echo CALENDAR_TITLE_LENGTH ?>"
805
  value="<?php if ( !empty($data) ) echo htmlspecialchars(stripslashes($data->event_title)); ?>" /></td>
806
  </tr>
807
  <tr>
990
  if ( $action == 'add' )
991
  {
992
  $title = !empty($_REQUEST['event_title']) ? sanitize_text_field($_REQUEST['event_title']) : '';
993
+ $desc = !empty($_REQUEST['event_desc']) ? wp_kses_post($_REQUEST['event_desc']) : '';
994
  $begin = !empty($_REQUEST['event_begin']) ? sanitize_text_field($_REQUEST['event_begin']) : '';
995
  $end = !empty($_REQUEST['event_end']) ? sanitize_text_field($_REQUEST['event_end']) : '';
996
  $time = !empty($_REQUEST['event_time']) ? sanitize_text_field($_REQUEST['event_time']) : '';
1083
  <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The URL entered must either be prefixed with http(s):// or be completely blank','calendar'); ?></p></div>
1084
  <?php
1085
  }
1086
+ // The title must be at least one character in length and no more than CALENDAR_TITLE_LENGTH
1087
+ if (mb_strlen($title, "UTF-8") > 0 && mb_strlen($title, "UTF-8") <= CALENDAR_TITLE_LENGTH)
1088
  {
1089
  $title_ok =1;
1090
  }
1091
  else
1092
  {
1093
  ?>
1094
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The event title must be between 1 and '.CALENDAR_TITLE_LENGTH.' characters in length','calendar'); ?></p></div>
1095
  <?php
1096
  }
1097
  // We run some checks on recurrance
1148
  elseif ( $action == 'edit_save' )
1149
  {
1150
  $title = !empty($_REQUEST['event_title']) ? sanitize_text_field($_REQUEST['event_title']) : '';
1151
+ $desc = !empty($_REQUEST['event_desc']) ? wp_kses_post($_REQUEST['event_desc']) : '';
1152
  $begin = !empty($_REQUEST['event_begin']) ? sanitize_text_field($_REQUEST['event_begin']) : '';
1153
  $end = !empty($_REQUEST['event_end']) ? sanitize_text_field($_REQUEST['event_end']) : '';
1154
  $time = !empty($_REQUEST['event_time']) ? sanitize_text_field($_REQUEST['event_time']) : '';
1248
  <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>
1249
  <?php
1250
  }
1251
+ // The title must be at least one character in length and no more than CALENDAR_TITLE_LENGTH
1252
+ if (mb_strlen($title, "UTF-8") > 0 && mb_strlen($title, "UTF-8") <= CALENDAR_TITLE_LENGTH)
1253
  {
1254
  $title_ok =1;
1255
  }
1256
  else
1257
  {
1258
  ?>
1259
+ <div class="error"><p><strong><?php _e('Error','calendar'); ?>:</strong> <?php _e('The event title must be between 1 and '.CALENDAR_TITLE_LENGTH.' characters in length','calendar'); ?></p></div>
1260
  <?php
1261
  }
1262
  // We run some checks on recurrance
2285
 
2286
  $linky = apply_filters('modify_calendar_link', $linky, $event);
2287
 
2288
+ $details = '<span class="calnk"><a href="'.$linky.'" '.$style.'>' . htmlspecialchars(stripslashes($event->event_title)) . '<span '.$style.'>' . $header_details . '' . stripslashes($event->event_desc) . '</span></a></span>';
2289
 
2290
  return $details;
2291
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: KieranOShea
3
  Donate link: http://www.kieranoshea.com
4
  Tags: calendar, dates, times, events
5
  Requires at least: 4.3.1
6
- Tested up to: 5.0
7
- Stable tag: 1.3.12
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.
@@ -238,6 +238,12 @@ You've not called wp_head() in your theme's header and/or wp_footer() in your th
238
 
239
  == Changelog ==
240
 
 
 
 
 
 
 
241
  = 1.3.12 =
242
  * Removed ability to access PHP files directly
243
  * Change import of admin CSS and JS to enqueue
@@ -250,7 +256,7 @@ You've not called wp_head() in your theme's header and/or wp_footer() in your th
250
  * Fixed reported XSS issues with category name and event title
251
 
252
  = 1.3.10 =
253
- * Validated performance and compatability with latest version of WordPress
254
  * Fixed bug with mouse hover box which caused longer titles to wrap in an unpleasant fashion
255
  * Corrected incorrect formatting of DTSTAMP field in iCalendar feed
256
  * Added a filter entitled "modify_drawn_event_content" which allows custom drawing of events on full calendar (requested by user Eric3D)
3
  Donate link: http://www.kieranoshea.com
4
  Tags: calendar, dates, times, events
5
  Requires at least: 4.3.1
6
+ Tested up to: 5.1
7
+ Stable tag: 1.3.13
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.
238
 
239
  == Changelog ==
240
 
241
+ = 1.3.13 =
242
+ * Fixed loading order issue with internationalisation
243
+ * Enabled the full 30 characters in the title, even for unicode
244
+ * Fix ability to add basic HTML (line breaks etc.) into event descriptions
245
+ * Validated performance and compatibility with latest version of WordPress
246
+
247
  = 1.3.12 =
248
  * Removed ability to access PHP files directly
249
  * Change import of admin CSS and JS to enqueue
256
  * Fixed reported XSS issues with category name and event title
257
 
258
  = 1.3.10 =
259
+ * Validated performance and compatibility with latest version of WordPress
260
  * Fixed bug with mouse hover box which caused longer titles to wrap in an unpleasant fashion
261
  * Corrected incorrect formatting of DTSTAMP field in iCalendar feed
262
  * Added a filter entitled "modify_drawn_event_content" which allows custom drawing of events on full calendar (requested by user Eric3D)