Handling of new components

This commit is contained in:
2024-08-12 15:11:25 +02:00
parent 138b3859aa
commit da63fe3b3c
10 changed files with 225 additions and 28 deletions

View File

@ -5,25 +5,6 @@ class Calendar
public $ical;
private $categories = [];
public static function setup()
{
$pageName = 'Kalender';
$page_exists = get_page_by_path($pageName, OBJECT, 'page');
// Wenn die Seite nicht existiert, erstelle sie
if (!$page_exists) {
$page_id = wp_insert_post(array(
'post_title' => $pageName,
'post_content' => '{{calendar}}',
'post_status' => 'publish',
'post_type' => 'page',
));
update_option('bdp_calendar_source_url', 'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics');
}
}
public static function printCalendar($content) : string {
// Der zu ersetzende String
$original_string = '{{calendar}}';
@ -67,8 +48,10 @@ class Calendar
}
$calendarUrl = get_option('bdp_calendar_source_url', 'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics');
$calendarUrl = get_option('bdp_calendar_source_url', null);
if (null === '') {
return;
}
$this->ical = new \ICal('', array(
'defaultSpan' => 2, // Default value
'defaultTimeZone' => '',