/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from the database. */ public function widget($args, $instance) { $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base); $out = $args['before_widget']; $out .= $args['before_title'] . $title . $args['after_title']; $out .= "<div class='ngg-media-rss-widget'>"; $out .= "<a href='" . nggMediaRss::get_mrss_url() . "' title='" . $instance['mrss_title'] . "' class='ngg-media-rss-link'>"; if ($instance['show_icon']) { $out .= '<span class="dashicons dashicons-rss" style="padding-right: 1.5em"></span>'; } if ($instance['show_global_mrss']) { $out .= $instance['mrss_text']; } $out .= "</a></div>"; $out .= $args['after_widget']; echo $out; }
function widget($args, $instance) { extract($args); $ngg_options = nggGallery::get_option('ngg_options'); $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base); $show_global_mrss = $instance['show_global_mrss']; $show_icon = $instance['show_icon']; $mrss_text = stripslashes($instance['mrss_text']); $mrss_title = strip_tags(stripslashes($instance['mrss_title'])); echo $before_widget; echo $before_title . $title . $after_title; echo "<ul class='ngg-media-rss-widget'>\n"; if ($show_global_mrss) { echo " <li>"; echo $this->get_mrss_link(nggMediaRss::get_mrss_url(), $show_icon, stripslashes($mrss_title), stripslashes($mrss_text), $ngg_options['usePicLens']); echo "</li>\n"; } echo "</ul>\n"; echo $after_widget; }
/** * Get the XML <rss> node */ function get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images) { if ($prev_link != '' || $next_link != '') { $out = "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom='http://www.w3.org/2005/Atom'>\n"; } else { $out = "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'>\n"; } $out .= "\t<channel>\n"; $out .= nggMediaRss::get_generator_mrss_node(); $out .= nggMediaRss::get_title_mrss_node($title); $out .= nggMediaRss::get_description_mrss_node($description); $out .= nggMediaRss::get_link_mrss_node($link); if ($prev_link != '' || $next_link != '') { $out .= nggMediaRss::get_self_node(nggMediaRss::get_mrss_url()); } if ($prev_link != '') { $out .= nggMediaRss::get_previous_link_mrss_node($prev_link); } if ($next_link != '') { $out .= nggMediaRss::get_next_link_mrss_node($next_link); } foreach ($images as $image) { $out .= nggMediaRss::get_image_mrss_node($image); } $out .= "\t</channel>\n"; $out .= "</rss>\n"; return $out; }
/** * Get the URL of the media RSS for last pictures */ function get_last_pictures_mrss_url($page = 0, $show = 30) { return nggMediaRss::get_mrss_url() . '?' . ('show=' . $show . '&page=' . $page . '&mode=last_pictures'); }
/** * Function to render the widget */ function render_widget($args, $widget_args = 1) { global $ngg_mrssw_plugin; $ngg_options = nggGallery::get_option('ngg_options'); // Get the options extract($args, EXTR_SKIP); if (is_numeric($widget_args)) { $widget_args = array('number' => $widget_args); } $widget_args = wp_parse_args($widget_args, array('number' => -1)); extract($widget_args, EXTR_SKIP); $title = empty($this->options[$number]['widget_title']) ? __('Media RSS', 'nggallery') : $this->options[$number]['widget_title']; $show_global_mrss = $this->options[$number]['show_global_mrss']; $show_icon = $this->options[$number]['show_icon']; // Compat reason for settings pre V1.4.X $show_icon = empty($this->options[$number]['mrss_icon_url']) ? $show_icon : true; $mrss_text = stripslashes($this->options[$number]['mrss_text']); $mrss_title = strip_tags(stripslashes($this->options[$number]['mrss_title'])); echo '<!-- NextGen Gallery Media RSS -->'; echo $before_widget; echo $before_title . $title . $after_title; echo "<ul class='ngg-media-rss-widget'>\n"; if ($show_global_mrss) { echo " <li>"; echo $this->get_mrss_link(nggMediaRss::get_mrss_url(), $show_icon, stripslashes($mrss_title), stripslashes($mrss_text), $ngg_options['usePicLens']); echo "</li>\n"; } echo "</ul>\n"; echo $after_widget; echo '<!-- /NextGen Gallery Media RSS -->'; }
<?php echo $before_widget . $before_title . $title . $after_title; ?> <ul class='ngg-media-rss-widget'> <?php if ($instance['show_global_mrss']) { ?> <li> <?php echo $self->get_mrss_link(nggMediaRss::get_mrss_url(), $instance['show_icon'], strip_tags(stripslashes($instance['mrss_title'])), stripslashes($instance['mrss_text']), $settings->usePicLens); ?> </li> <?php } ?> </ul> <?php echo $after_widget;