Version Description
- Correcting CSS that was inadvertently overriding wider site elements
- Removed use of date_i18n - this changed in WordPress 5.3 and now causes undesired operation on upcoming events
- Enhanced use of CSS colours; added backgrounds on mini calendar, add option to improve category foreground contrast
- Adding span wrappers around * and "all day" elements with CSS classes to permit removal if so desired
- Validated performance and compatibility with latest version of WordPress
Download this release
Release Info
Developer | KieranOShea |
Plugin | Calendar |
Version | 1.3.14 |
Comparing to | |
See all releases |
Code changes from version 1.3.13 to 1.3.14
- calendar.php +102 -14
- readme.txt +9 -2
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.
|
11 |
*/
|
12 |
|
13 |
/* Copyright 2008 Kieran O'Shea (email : kieran@kieranoshea.com)
|
@@ -461,7 +461,10 @@ function calendar_check()
|
|
461 |
.page-todays-events {
|
462 |
font-size:80%;
|
463 |
}
|
464 |
-
.calendar-table table,
|
|
|
|
|
|
|
465 |
margin:0 !important;
|
466 |
padding:0 !important;
|
467 |
}
|
@@ -1461,6 +1464,12 @@ function calendar_config_edit()
|
|
1461 |
$enable_feed = 'false';
|
1462 |
}
|
1463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1464 |
if ($_POST['show_attribution_link'] == 'on') {
|
1465 |
$show_attribution_link = 'true';
|
1466 |
} else {
|
@@ -1476,6 +1485,11 @@ function calendar_config_edit()
|
|
1476 |
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%d' WHERE config_item='display_upcoming_days'",$display_upcoming_days));
|
1477 |
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%s' WHERE config_item='enable_categories'",$enable_categories));
|
1478 |
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%s' WHERE config_item='enable_feed'",$enable_feed));
|
|
|
|
|
|
|
|
|
|
|
1479 |
$attribution_present = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='show_attribution_link'");
|
1480 |
if (empty($attribution_present)) {
|
1481 |
$wpdb->get_results("INSERT INTO " . WP_CALENDAR_CONFIG_TABLE . " SET config_item='show_attribution_link', config_value='false'");
|
@@ -1621,6 +1635,20 @@ function calendar_config_edit()
|
|
1621 |
}
|
1622 |
}
|
1623 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1624 |
$configs = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='show_attribution_link'");
|
1625 |
$yes_show_attribution_link = '';
|
1626 |
$no_show_attribution_link = '';
|
@@ -1718,6 +1746,16 @@ function calendar_config_edit()
|
|
1718 |
</select>
|
1719 |
</td>
|
1720 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1721 |
<tr>
|
1722 |
<td><legend><?php _e('Enable attribution link?','calendar'); ?></legend></td>
|
1723 |
<td> <select name="show_attribution_link">
|
@@ -2041,15 +2079,15 @@ function calendar_upcoming_events($cat_list = '')
|
|
2041 |
$events = grab_events($y,$m,$d,'upcoming',$cat_list);
|
2042 |
usort($events, "calendar_time_cmp");
|
2043 |
if (count($events) != 0) {
|
2044 |
-
$output .= '<li>'.
|
2045 |
}
|
2046 |
foreach($events as $event)
|
2047 |
{
|
2048 |
if ($event->event_time == '00:00:00') {
|
2049 |
-
$time_string = ' '.__('all day','calendar');
|
2050 |
}
|
2051 |
else {
|
2052 |
-
$time_string = ' '.__('at','calendar').' '.date(get_option('time_format'), strtotime(stripslashes($event->event_time)));
|
2053 |
}
|
2054 |
$output .= '<li>'.calendar_draw_event($event).$time_string.'</li>';
|
2055 |
}
|
@@ -2085,10 +2123,10 @@ function calendar_todays_events($cat_list = '')
|
|
2085 |
foreach($events as $event)
|
2086 |
{
|
2087 |
if ($event->event_time == '00:00:00') {
|
2088 |
-
$time_string = ' '.__('all day','calendar');
|
2089 |
}
|
2090 |
else {
|
2091 |
-
$time_string = ' '.__('at','calendar').' '.date(get_option('time_format'), strtotime(stripslashes($event->event_time)));
|
2092 |
}
|
2093 |
$output .= '<li>'.calendar_draw_event($event).$time_string.'</li>';
|
2094 |
}
|
@@ -2118,7 +2156,7 @@ function calendar_draw_events($events)
|
|
2118 |
// Now process the events
|
2119 |
foreach($events as $event)
|
2120 |
{
|
2121 |
-
$output .= '
|
2122 |
$output = apply_filters('modify_drawn_event_content', $output, $event);
|
2123 |
}
|
2124 |
return $output;
|
@@ -2247,6 +2285,28 @@ function widget_init_calendar_upcoming() {
|
|
2247 |
wp_register_widget_control('upcoming_events_calendar','upcoming_events_calendar','widget_calendar_upcoming_control');
|
2248 |
}
|
2249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2250 |
// Used to draw an event to the screen
|
2251 |
function calendar_draw_event($event)
|
2252 |
{
|
@@ -2257,12 +2317,19 @@ function calendar_draw_event($event)
|
|
2257 |
// We check for this later
|
2258 |
$display_author = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='display_author'",0,0);
|
2259 |
$show_cat = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='enable_categories'",0,0);
|
|
|
2260 |
$style = '';
|
2261 |
if ($show_cat == 'true')
|
2262 |
{
|
2263 |
$sql = $wpdb->prepare("SELECT * FROM " . WP_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=%d",$event->event_category);
|
2264 |
$cat_details = $wpdb->get_row($sql);
|
2265 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
2266 |
}
|
2267 |
|
2268 |
$header_details = '<span class="event-title" '.$style.'>'.htmlspecialchars(stripslashes($event->event_title)).'</span><br />
|
@@ -2821,18 +2888,39 @@ function calendar($cat_list = '')
|
|
2821 |
// Used to create a hover will all a day's events in for minical
|
2822 |
function calendar_minical_draw_events($events,$day_of_week = '')
|
2823 |
{
|
|
|
|
|
|
|
|
|
2824 |
// We need to sort arrays of objects by time
|
2825 |
usort($events, "calendar_time_cmp");
|
2826 |
// Only show anything if there are events
|
2827 |
$output = '';
|
2828 |
if (count($events)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2829 |
// Setup the wrapper
|
2830 |
-
$output = '<span class="calnk"><a href="#" class="minical-day">'.$day_of_week.'<span>';
|
2831 |
// Now process the events
|
2832 |
-
foreach($events as $event)
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
|
|
|
|
|
|
2836 |
}
|
2837 |
// The tail
|
2838 |
$output .= '</span></a></span>';
|
7 |
Author URI: http://www.kieranoshea.com
|
8 |
Text Domain: calendar
|
9 |
Domain Path: /languages
|
10 |
+
Version: 1.3.14
|
11 |
*/
|
12 |
|
13 |
/* Copyright 2008 Kieran O'Shea (email : kieran@kieranoshea.com)
|
461 |
.page-todays-events {
|
462 |
font-size:80%;
|
463 |
}
|
464 |
+
.calendar-table table,
|
465 |
+
.calendar-table tbody,
|
466 |
+
.calendar-table tr,
|
467 |
+
.calendar-table td {
|
468 |
margin:0 !important;
|
469 |
padding:0 !important;
|
470 |
}
|
1464 |
$enable_feed = 'false';
|
1465 |
}
|
1466 |
|
1467 |
+
if ($_POST['enhance_contrast'] == 'on') {
|
1468 |
+
$enhance_contrast = 'true';
|
1469 |
+
} else {
|
1470 |
+
$enhance_contrast = 'false';
|
1471 |
+
}
|
1472 |
+
|
1473 |
if ($_POST['show_attribution_link'] == 'on') {
|
1474 |
$show_attribution_link = 'true';
|
1475 |
} else {
|
1485 |
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%d' WHERE config_item='display_upcoming_days'",$display_upcoming_days));
|
1486 |
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%s' WHERE config_item='enable_categories'",$enable_categories));
|
1487 |
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%s' WHERE config_item='enable_feed'",$enable_feed));
|
1488 |
+
$contrast_present = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='enhance_contrast'");
|
1489 |
+
if (empty($contrast_present)) {
|
1490 |
+
$wpdb->get_results("INSERT INTO " . WP_CALENDAR_CONFIG_TABLE . " SET config_item='enhance_contrast', config_value='false'");
|
1491 |
+
}
|
1492 |
+
$wpdb->get_results($wpdb->prepare("UPDATE " . WP_CALENDAR_CONFIG_TABLE . " SET config_value = '%s' WHERE config_item='enhance_contrast'",$enhance_contrast));
|
1493 |
$attribution_present = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='show_attribution_link'");
|
1494 |
if (empty($attribution_present)) {
|
1495 |
$wpdb->get_results("INSERT INTO " . WP_CALENDAR_CONFIG_TABLE . " SET config_item='show_attribution_link', config_value='false'");
|
1635 |
}
|
1636 |
}
|
1637 |
}
|
1638 |
+
|
1639 |
+
$configs = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='enhance_contrast'");
|
1640 |
+
$yes_enhance_contrast = '';
|
1641 |
+
$no_enhance_contrast = '';
|
1642 |
+
if (!empty($configs)) {
|
1643 |
+
foreach ($configs as $config) {
|
1644 |
+
if ($config->config_value == 'true') {
|
1645 |
+
$yes_enhance_contrast = 'selected="selected"';
|
1646 |
+
} else {
|
1647 |
+
$no_enhance_contrast = 'selected="selected"';
|
1648 |
+
}
|
1649 |
+
}
|
1650 |
+
}
|
1651 |
+
|
1652 |
$configs = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='show_attribution_link'");
|
1653 |
$yes_show_attribution_link = '';
|
1654 |
$no_show_attribution_link = '';
|
1746 |
</select>
|
1747 |
</td>
|
1748 |
</tr>
|
1749 |
+
|
1750 |
+
<tr>
|
1751 |
+
<td><legend><?php _e('Enhance foreground contrast against category colour?','calendar'); ?></legend></td>
|
1752 |
+
<td> <select name="enhance_contrast">
|
1753 |
+
<option value="on" <?php echo $yes_enhance_contrast ?>><?php _e('Yes','calendar') ?></option>
|
1754 |
+
<option value="off" <?php echo $no_enhance_contrast ?>><?php _e('No','calendar') ?></option>
|
1755 |
+
</select>
|
1756 |
+
</td>
|
1757 |
+
</tr>
|
1758 |
+
|
1759 |
<tr>
|
1760 |
<td><legend><?php _e('Enable attribution link?','calendar'); ?></legend></td>
|
1761 |
<td> <select name="show_attribution_link">
|
2079 |
$events = grab_events($y,$m,$d,'upcoming',$cat_list);
|
2080 |
usort($events, "calendar_time_cmp");
|
2081 |
if (count($events) != 0) {
|
2082 |
+
$output .= '<li>'.wp_date(get_option('date_format'),mktime($day_count*24,0,0,date("m",calendar_ctwo()),date("d",calendar_ctwo()),date("Y",calendar_ctwo()))).'<ul>';
|
2083 |
}
|
2084 |
foreach($events as $event)
|
2085 |
{
|
2086 |
if ($event->event_time == '00:00:00') {
|
2087 |
+
$time_string = ' <span class="calendar_time all_day" style="position:relative;display:inline;width:unset;background:none;">'.__('all day','calendar').'</span>';
|
2088 |
}
|
2089 |
else {
|
2090 |
+
$time_string = ' <span class="calendar_time" style="position:relative;display:inline;width:unset;background:none;">'.__('at','calendar').' '.date(get_option('time_format'), strtotime(stripslashes($event->event_time))).'</span>';
|
2091 |
}
|
2092 |
$output .= '<li>'.calendar_draw_event($event).$time_string.'</li>';
|
2093 |
}
|
2123 |
foreach($events as $event)
|
2124 |
{
|
2125 |
if ($event->event_time == '00:00:00') {
|
2126 |
+
$time_string = ' <span class="calendar_time all_day" style="position:relative;display:inline;width:unset;background:none;">'.__('all day','calendar').'</span>';
|
2127 |
}
|
2128 |
else {
|
2129 |
+
$time_string = ' <span class="calendar_time" style="position:relative;display:inline;width:unset;background:none;">'.__('at','calendar').' '.date(get_option('time_format'), strtotime(stripslashes($event->event_time))).'</span>';
|
2130 |
}
|
2131 |
$output .= '<li>'.calendar_draw_event($event).$time_string.'</li>';
|
2132 |
}
|
2156 |
// Now process the events
|
2157 |
foreach($events as $event)
|
2158 |
{
|
2159 |
+
$output .= '<span class="calendar_bullet" style="position:relative;display:inline;width:unset;background:none;">* </span>'.calendar_draw_event($event).'<br />';
|
2160 |
$output = apply_filters('modify_drawn_event_content', $output, $event);
|
2161 |
}
|
2162 |
return $output;
|
2285 |
wp_register_widget_control('upcoming_events_calendar','upcoming_events_calendar','widget_calendar_upcoming_control');
|
2286 |
}
|
2287 |
|
2288 |
+
// A function that determines an appropriate foreground colour from the background
|
2289 |
+
function getContrastYIQ($hexcolor){
|
2290 |
+
if (preg_match('/#([a-fA-F0-9]{3}){1,2}\b/',$hexcolor)) {
|
2291 |
+
if (strlen($hexcolor)==4) {
|
2292 |
+
$r = hexdec(str_repeat(substr($hexcolor,1,1),2));
|
2293 |
+
$g = hexdec(str_repeat(substr($hexcolor,2,3),2));
|
2294 |
+
$b = hexdec(str_repeat(substr($hexcolor,3,3),2));
|
2295 |
+
} elseif (strlen($hexcolor)==7) {
|
2296 |
+
$r = hexdec(substr($hexcolor,1,2));
|
2297 |
+
$g = hexdec(substr($hexcolor,3,2));
|
2298 |
+
$b = hexdec(substr($hexcolor,5,2));
|
2299 |
+
} else {
|
2300 |
+
return '#000000';
|
2301 |
+
}
|
2302 |
+
$yiq = (($r*299)+($g*587)+($b*114))/1000;
|
2303 |
+
return ($yiq >= 128) ? '#000000' : '#FFFFFF';
|
2304 |
+
}
|
2305 |
+
else {
|
2306 |
+
return '#000000';
|
2307 |
+
}
|
2308 |
+
}
|
2309 |
+
|
2310 |
// Used to draw an event to the screen
|
2311 |
function calendar_draw_event($event)
|
2312 |
{
|
2317 |
// We check for this later
|
2318 |
$display_author = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='display_author'",0,0);
|
2319 |
$show_cat = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='enable_categories'",0,0);
|
2320 |
+
$contrast = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='enhance_contrast'",0,0);
|
2321 |
$style = '';
|
2322 |
if ($show_cat == 'true')
|
2323 |
{
|
2324 |
$sql = $wpdb->prepare("SELECT * FROM " . WP_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=%d",$event->event_category);
|
2325 |
$cat_details = $wpdb->get_row($sql);
|
2326 |
+
if ($contrast == 'true') {
|
2327 |
+
$fgcolor=getContrastYIQ($cat_details->category_colour);
|
2328 |
+
$style = 'style="background-color:'.stripslashes($cat_details->category_colour).'; color:'.$fgcolor.';"';
|
2329 |
+
} else {
|
2330 |
+
$style = 'style="background-color:'.stripslashes($cat_details->category_colour).';"';
|
2331 |
+
}
|
2332 |
+
|
2333 |
}
|
2334 |
|
2335 |
$header_details = '<span class="event-title" '.$style.'>'.htmlspecialchars(stripslashes($event->event_title)).'</span><br />
|
2888 |
// Used to create a hover will all a day's events in for minical
|
2889 |
function calendar_minical_draw_events($events,$day_of_week = '')
|
2890 |
{
|
2891 |
+
global $wpdb;
|
2892 |
+
// Bring in the category & contrast option
|
2893 |
+
$show_cat = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='enable_categories'",0,0);
|
2894 |
+
$contrast = $wpdb->get_var("SELECT config_value FROM ".WP_CALENDAR_CONFIG_TABLE." WHERE config_item='enhance_contrast'",0,0);
|
2895 |
// We need to sort arrays of objects by time
|
2896 |
usort($events, "calendar_time_cmp");
|
2897 |
// Only show anything if there are events
|
2898 |
$output = '';
|
2899 |
if (count($events)) {
|
2900 |
+
$style = '';
|
2901 |
+
if ($show_cat == 'true') {
|
2902 |
+
$arr_values = array_values($events);
|
2903 |
+
$firstevent = array_shift($arr_values);
|
2904 |
+
$sql = $wpdb->prepare("SELECT * FROM " . WP_CALENDAR_CATEGORIES_TABLE . " WHERE category_id=%d",$firstevent->event_category);
|
2905 |
+
$cat_details = $wpdb->get_row($sql);
|
2906 |
+
if ($contrast == 'true') {
|
2907 |
+
$fgcolor = getContrastYIQ($cat_details->category_colour);
|
2908 |
+
$style = 'style="background-color:' . stripslashes($cat_details->category_colour) . '; color:' . $fgcolor . '"';
|
2909 |
+
} else {
|
2910 |
+
$style = 'style="background-color:' . stripslashes($cat_details->category_colour) . ';"';
|
2911 |
+
}
|
2912 |
+
}
|
2913 |
+
|
2914 |
// Setup the wrapper
|
2915 |
+
$output = '<span class="calnk"><a href="#" class="minical-day" '.$style.'>'.$day_of_week.'<span '.$style.'>';
|
2916 |
// Now process the events
|
2917 |
+
foreach($events as $event) {
|
2918 |
+
if ($event->event_time == '00:00:00') {
|
2919 |
+
$the_time = '<span class="calendar_time all_day" style="position:relative;display:inline;width:unset;background:none;">'.__('all day','calendar').'</span>';
|
2920 |
+
} else {
|
2921 |
+
$the_time = '<span class="calendar_time" style="position:relative;display:inline;width:unset;background:none;">'.__('at','calendar').' '.date(get_option('time_format'), strtotime(stripslashes($event->event_time))).'</span>';
|
2922 |
+
}
|
2923 |
+
$output .= '<span class="calendar_bullet" style="position:relative;display:inline;width:unset;background:none;">* </span><strong>'.$event->event_title.'</strong> '.$the_time.'<br />';
|
2924 |
}
|
2925 |
// The tail
|
2926 |
$output .= '</span></a></span>';
|
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.
|
7 |
-
Stable tag: 1.3.
|
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,13 @@ 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.13 =
|
242 |
* Fixed loading order issue with internationalisation
|
243 |
* Enabled the full 30 characters in the title, even for unicode
|
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.3.2
|
7 |
+
Stable tag: 1.3.14
|
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.14 =
|
242 |
+
* Correcting CSS that was inadvertently overriding wider site elements
|
243 |
+
* Removed use of date_i18n - this changed in WordPress 5.3 and now causes undesired operation on upcoming events
|
244 |
+
* Enhanced use of CSS colours; added backgrounds on mini calendar, add option to improve category foreground contrast
|
245 |
+
* Adding span wrappers around * and "all day" elements with CSS classes to permit removal if so desired
|
246 |
+
* Validated performance and compatibility with latest version of WordPress
|
247 |
+
|
248 |
= 1.3.13 =
|
249 |
* Fixed loading order issue with internationalisation
|
250 |
* Enabled the full 30 characters in the title, even for unicode
|