show(); // Ersetze den Originalstring durch den Ersatzstring im Seiteninhalt $content = str_replace( $original_string, $replacement_string, $content ); } return $content; } /** * Constructor */ public function __construct() { $categories = get_option('bdp_calendar_categories', null); if (null !== $categories) { $categories = json_decode($categories, true); } else { $categories = [ 'yellow' => 'Meute', 'blue' => 'Sippe', 'red' => 'Runde', 'green' => 'StaFü', 'fuchsia' => '', 'orange' => '' ]; } foreach ($categories as $color => $keyname) { $this->categories[$keyname] = $color; } $calendarUrl = get_option('bdp_calendar_source_url', null); if (null === '') { return; } $this->ical = new \ICal('', array( 'defaultSpan' => 2, // Default value 'defaultTimeZone' => '', 'defaultWeekStart' => 'MO', // Default value 'disableCharacterReplacement' => false, // Default value 'filterDaysAfter' => null, // Default value 'filterDaysBefore' => null, // Default value 'httpUserAgent' => null, // Default value 'skipRecurrence' => false, // Default value )); $this->ical->initUrl($calendarUrl); $this->ical->events(); $this->naviHref = htmlentities($_SERVER['PHP_SELF']); } /********************* PROPERTY ********************/ private $dayLabels = array("Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"); private $monthLabels = ['', 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']; private $currentYear = 0; private $currentMonth = 0; private $currentDay = 0; private $currentDate = null; private $daysInMonth = 0; private $naviHref = null; /********************* PUBLIC **********************/ /** * print out the calendar */ public function show() { $year = null; $month = null; if (null == $year && isset($_GET['year'])) { $year = $_GET['year']; } else if (null == $year) { $year = date("Y", time()); } if (null == $month && isset($_GET['month'])) { $month = $_GET['month']; } else if (null == $month) { $month = date("m", time()); } $this->currentYear = $year; $this->currentMonth = $month; $this->daysInMonth = $this->_daysInMonth($month, $year); $content = '
'; foreach ($this->ical->filterByDate($date) as $curEvent) { $time = $curEvent->getEventTime() ?? 'Ganztags'; #print_r($curEvent); $eventString .= '