summaryrefslogtreecommitdiff
path: root/liberty_plugins
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-27 17:29:38 +0100
committerlsces <lester@lsces.co.uk>2025-08-27 17:29:38 +0100
commit032957e0e2cf194f1736d8d9615bddd9bff77041 (patch)
treeea175ac3d1ec7208ab810a4d7844bc938eadef47 /liberty_plugins
parent001c8743879bf698260bdc3203c1367b8816b368 (diff)
downloadcalendar-032957e0e2cf194f1736d8d9615bddd9bff77041.tar.gz
calendar-032957e0e2cf194f1736d8d9615bddd9bff77041.tar.bz2
calendar-032957e0e2cf194f1736d8d9615bddd9bff77041.zip
Code updated to PHP8.4 and namespace
Diffstat (limited to 'liberty_plugins')
-rw-r--r--liberty_plugins/data.calendar.php42
1 files changed, 20 insertions, 22 deletions
diff --git a/liberty_plugins/data.calendar.php b/liberty_plugins/data.calendar.php
index 7851a6e..cc7861a 100644
--- a/liberty_plugins/data.calendar.php
+++ b/liberty_plugins/data.calendar.php
@@ -1,4 +1,8 @@
<?php
+
+use Bitweaver\BitDate;
+use Bitweaver\KernelTools;
+
/**
* @version $Revision$
* @package liberty
@@ -24,17 +28,17 @@
*/
define( 'PLUGIN_GUID_DATACALENDAR', 'datacalendar' );
global $gLibertySystem;
-$pluginParams = array (
- 'tag' => 'CALENDAR',
- 'auto_activate' => TRUE,
- 'requires_pair' => FALSE,
+$pluginParams = [
+ 'tag' => 'CALENDAR',
+ 'auto_activate' => true,
+ 'requires_pair' => false,
'load_function' => 'data_calendar',
- 'title' => 'Calendar',
- 'help_page' => 'DataPluginCalendar',
- 'description' => tra("Displays a mini calendar that links to the calendar package."),
- 'syntax' => " {CALENDAR} ",
- 'plugin_type' => DATA_PLUGIN
-);
+ 'title' => 'Calendar',
+ 'help_page' => 'DataPluginCalendar',
+ 'description' => KernelTools::tra( "Displays a mini calendar that links to the calendar package." ),
+ 'syntax' => " {CALENDAR} ",
+ 'plugin_type' => DATA_PLUGIN,
+];
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATACALENDAR, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATACALENDAR );
@@ -61,7 +65,7 @@ function data_calendar( $data, $params ) {
$last = $bitDate->getDate($last_time);
$next = $bitDate->getDate($next_time);
- $days = array();
+ $days = [];
for ($i = 2; $i < 9; $i++) {
// Start from known sunday.
$timestamp = $bitDate->mktime(0, 0, 0, 1, $i, 2000);
@@ -69,10 +73,10 @@ function data_calendar( $data, $params ) {
}
// Build a two-dimensional array of UNIX timestamps.
- $calendar = array();
+ $calendar = [];
// Start with last days of previous month.
- $week = array();
+ $week = [];
$month_begin = $bitDate->mktime(0, 0, 0, $month, 1, $year);
$month_begin_dow = strftime('%w', $month_begin);
@@ -95,7 +99,7 @@ function data_calendar( $data, $params ) {
// Done with row
$dow = 0;
unset($week);
- $week = array();
+ $week = [];
}
$d['time'] = $bitDate->mktime(0, 0, 0, $month, $i, $year);
$d['dim'] = false;
@@ -127,17 +131,11 @@ function data_calendar( $data, $params ) {
$gBitSmarty->assign('today', $time);
// Assign a base url
- if (empty($params['events'])) {
- $pBaseUrl = CALENDAR_PKG_URL.'index.php';
- }
- else {
- $pBaseUrl = EVENTS_PKG_URL.'calendar.php';
- }
+ $pBaseUrl = ( empty( $params['events'] ) ) ? CALENDAR_PKG_URL . 'index.php' : CALENDAR_PKG_URL . 'calendar.php';
$gBitSmarty->assign('baseCalendarUrl', $pBaseUrl);
return $gBitSmarty->fetch('bitpackage:calendar/minical.tpl');
}
return '<div class="error">Calendar Package Not Active</div>';
-}
-?>
+} \ No newline at end of file