Update plugin.calendar.php

- Fixes incorrect display if Russian is selected as the language
- Output must be in the selected character set
This commit is contained in:
Frank Hochmuth 2023-12-01 22:24:36 +01:00 committed by GitHub
parent ea2f35e14c
commit 60654485e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,10 @@
// see example at http://keithdevens.com/weblog
// License: http://keithdevens.com/software/license
function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array()) {
global $fp_config;
$characterset = $config ['charset'];
$first_of_month = gmmktime(0, 0, 0, $month, 1, $year);
// remember that mktime will automatically correct if invalid dates are entered
// for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
@ -44,7 +48,7 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3,
if ($day_name_length) { // if the day names should be shown ($day_name_length > 0)
// if day_name_length is >3, the full name of the day will be printed
foreach ($day_names as $d)
$calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities($day_name_length < 4 ? mb_substr($d, 0, $day_name_length, 'UTF-8') : $d) . '</th>';
$calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities($day_name_length < 4 ? mb_substr($d, 0, $day_name_length, $characterset) : $d) . '</th>';
$calendar .= "</tr>\n<tr>";
}