コード例 #1
0
ファイル: upcoming-events.php プロジェクト: bisko/jetpack
 public static function shortcode($atts = array())
 {
     jetpack_require_lib('icalendar-reader');
     $atts = shortcode_atts(array('url' => '', 'number' => 0), $atts, 'upcomingevents');
     $args = array('context' => 'shortcode', 'number' => absint($atts['number']));
     $events = icalendar_render_events($atts['url'], $args);
     if (!$events) {
         $events = sprintf('<p>%s</p>', __('No upcoming events', 'jetpack'));
     }
     return $events;
 }
コード例 #2
0
 function widget($args, $instance)
 {
     jetpack_require_lib('icalendar-reader');
     $events = icalendar_render_events($instance['feed-url'], array('context' => 'widget', 'number' => $instance['count']));
     // nothing to display?
     if (!$events) {
         $events = sprintf('<p>%s</p>', __('No upcoming events', 'jetpack'));
     }
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'];
         echo esc_html($instance['title']);
         echo $args['after_title'];
     }
     echo $events;
     echo $args['after_widget'];
     /** This action is documented in modules/widgets/gravatar-profile.php */
     do_action('jetpack_stats_extra', 'widget_view', 'grofile');
 }
コード例 #3
0
 function widget($args, $instance)
 {
     jetpack_require_lib('icalendar-reader');
     $events = icalendar_render_events($instance['feed-url'], array('context' => 'widget', 'number' => $instance['count']));
     // nothing to display?
     if (!$events) {
         $events = sprintf('<p>%s</p>', __('No upcoming events', 'jetpack'));
     }
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'];
         echo esc_html($instance['title']);
         echo $args['after_title'];
     }
     echo $events;
     echo $args['after_widget'];
 }