'', 'number' => 0, ), $atts, 'upcomingevents' ); $args = array( 'context' => 'shortcode', 'number' => absint( $atts['number'] ), ); if ( empty( $atts['url'] ) ) { // If the current user can access the Appearance->Widgets page. if ( current_user_can( 'edit_theme_options' ) ) { return sprintf( '

%s

', __( 'You must specify a URL to an iCalendar feed in the shortcode. This notice is only displayed to administrators.', 'jetpack' ) ); } return self::no_upcoming_event_text(); } $events = icalendar_render_events( $atts['url'], $args ); if ( ! $events ) { $events = self::no_upcoming_event_text(); } return $events; } /** * Returns No Upcoming Event text. */ private static function no_upcoming_event_text() { return sprintf( '

%s

', __( 'No upcoming events', 'jetpack' ) ); } } add_action( 'after_setup_theme', array( 'Upcoming_Events_Shortcode', 'init' ), 2 );