Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add widget to the dashboard
- * @since 0.1
- */
- function dnxsc_feed_display() {
- wp_add_dashboard_widget('dnxsc-dashboard-feed', __('Slackware Security Advisories', 'dnxsc'), 'dnxsc_feed');
- }
- add_action('wp_dashboard_setup', 'dnxsc_feed_display' );
- /**
- * check the feed for a chached version
- * @since 0.1
- */
- function dnxsc_feed() {
- $url = array(
- 'http://dev.slackware.it/rss/slackware-security.xml'
- );
- wp_dashboard_cached_rss_widget( 'dnxsc-dashboard-feed', dnxsc_feed_output(), $url );
- }
- function dnxsc_feed_output() {
- $url = 'http://dev.slackware.it/rss/slackware-security.xml';
- $rss = fetch_feed($url);
- if ( is_wp_error($rss) ) {
- if ( is_admin() || current_user_can('manage_options') ) {
- echo '<p>';
- printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
- echo '</p>';
- }
- return;
- }
- if ( ! $rss->get_item_quantity() ) {
- echo '<p>' . __('Weird, but there are no items in the Slackware Security Announcements Feed') . "</p>\n";
- $rss->__destruct();
- unset($rss);
- return;
- }
- if ( ! isset($items) )
- $items = 10;
- ?>
- <div class="dnxsc_container">
- <p class="dnxsc_list_desc">
- <img class="dnxsc_tux alignright" src="<?php echo plugins_url() . '/danixland-slackcheck/inc/images/tux512x594.png'; ?>" alt="got slack?" />
- <?php _e("These are the last 10 entries in the Slackware Security Announcements Mailing List.", "dnxsc"); ?>
- </p>
- <div class="clear">
- <ul>
- <?php
- foreach ( $rss->get_items(0, $items) as $item ) {
- $title = $item->get_title();
- $content_data = explode('+--------------------------+', $item->get_description());
- $content = html_entity_decode( $content_data[1], ENT_QUOTES, get_option('blog_charset') );
- $links_data = $item->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, link);
- $link = esc_url($links_data[0]['child']['']['p'][0]['data']);
- ?>
- <li>
- <p class="dnxsc_item_link"><a href="<?php echo $link; ?>" title="<?php echo $title; ?>" target="_blank"><?php echo $title; ?></a></p>
- <p class="dnxsc_item_desc"><?php echo $content; ?></p>
- </li>
- <?php } // endforeach ?>
- </ul>
- </div>
- <br class="clear" />
- <div class="dnxsc_buttons">
- <p class="dnxsc_list_desc"><?php _e("For more info about the List please check out the links below.", "dnxsc"); ?></p>
- <div class="alignright"><a class="button-primary" href="http://www.slackware.com/security/"><?php _e('View all SSA', 'dnxsc'); ?></a></div>
- <div class="alignright" style="width:7px"> </div>
- <div class="alignleft"><a class="button" href="mailto:majordomo@slackware.com?subject=list%20subscription&body=subscribe%20slackware-security"><?php _e('Subscribe to SSA', 'dnxsc'); ?></a></div>
- <br class="clear" />
- </div>
- </div><!-- end .dnxsc_container -->
- <?php
- $rss->__destruct();
- unset($rss);
- } // end dnxsc_feed_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement