function evt_calendar($atts) { global $Plugin_Prefix; global $EVT_DefLabels, $EVT_CalenderSettingNames, $EVT_ServerSettingNames, $EVT_QuerySettingNames, $EVT_DefValues; if (is_singular()) { // Set the default values to settungs from settings page or to internal default $def_atts = $EVT_DefValues; foreach ($EVT_DefValues as $key => $value) { $def_atts[$key] = get_option('evt_' . $key); if ($def_atts[$key] == '') { // Set to internal default $def_atts[$key] = $value; } // if } // foreach // Get the attributs form shortcode $sc_atts = shortcode_atts($def_atts, $atts, 'evtcalendar'); if ($sc_atts['title'] == '') { $eventheading = "<!-- No heading -->"; } else { $eventheading = "<h3>" . $sc_atts['title'] . "</h3>"; } $termine = postprocess_xml(evt_getevents($sc_atts, $EVT_QuerySettingNames)); /* Debugging foreach ($sc_atts as $key => $value) { $termine .= "<p>$key = $value</p>\n"; } // foreach */ return "\r\n\t<!-- Begin shortcode Ev. Termine -->\r\n\t<div class=\"evt-eventtab\">\r\n\t{$eventheading}\r\n\t{$termine}\r\n\t</div>\r\n\t<p style=\"font-size: x-small;\">Powered by Evangelische Termine Plugin - © Thomas Arend, Rheinbach</p>\r\n\t<!-- End shortcode Ev. Termine -->\r\n\t"; } else { // if is_sigular return ""; } }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $EVT_DefLabels, $EVT_CalenderSettingNames, $EVT_ServerSettingNames, $EVT_QuerySettingNames, $EVT_DefValues; $wg_atts = $args; foreach ($instance as $key => $value) { $wg_atts[$key] = Trim(empty($instance[$key]) ? $EVT_DefValues[$key] : $instance[$key]); } $wg_atts['title'] = apply_filters('widget_title', $wg_atts['title']); if ($wg_atts['script'] == '') { $wg_atts['script'] = 'xml.php'; } $termine = postprocess_xml(evt_getevents($wg_atts, $EVT_QuerySettingNames), 'widget'); echo $before_widget; if ($wg_atts['title']) { echo $before_title . $wg_atts['title'] . $after_title; } echo $termine; // Hier ist der richtige Patz um den erzeugten HTML Code auszugeben. echo "<p style=\"font-size: x-small;\">Powered by Evangelische Termine Plugin - © Thomas Arend, Rheinbach</p>"; echo $after_widget; }