__( 'Display upcoming events from an iCalendar feed.', 'jetpack' ), 'customize_selective_refresh' => true, ) ); if ( is_active_widget( false, false, $this->id_base ) ) { add_action( 'wp_head', array( $this, 'css' ) ); } } /** * Output CSS in the header everywhere where the widget is active. */ public function css() { ?> __( 'Upcoming Events', 'jetpack' ), 'feed-url' => '', 'count' => 3, ); $instance = array_merge( $defaults, (array) $instance ); ?>

get_events( $instance['feed-url'], $instance['count'] ); $events = $this->apply_timezone_offset( $events ); } $ical->timezone = null; echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( ! empty( $instance['title'] ) ) { echo $args['before_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo esc_html( $instance['title'] ); echo $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if ( empty( $instance['feed-url'] ) ) { if ( current_user_can( 'manage_options' ) ) { echo '
'; esc_html_e( 'The events feed URL is not properly set up in this widget.', 'jetpack' ); echo '
'; } } elseif ( ! $events ) { echo '

'; esc_html_e( 'No upcoming events', 'jetpack' ); echo '

'; } else { ?> apply_timezone_offset( $events ); } }