예제 #1
1
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = Magee_Core::set_shortcode_defaults(array('url' => '', 'number' => 3, 'class' => '', 'id' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = '';
     //$html = '<h2>'._e( 'Recent news from Some-Other Blog:', 'my-text-domain' ).'<h2>';
     if ($url !== '') {
         include_once ABSPATH . WPINC . '/feed.php';
         $rss = fetch_feed(esc_url($url));
         $maxitems = 0;
         if (!is_wp_error($rss)) {
             $maxitems = $rss->get_item_quantity(esc_attr($number));
             $rss_items = $rss->get_items(0, $maxitems);
         }
         $html = '<ul class="' . esc_attr($class) . '" id="' . esc_attr($id) . '">';
         if ($maxitems == 0) {
             $html .= '<li>' . _e('No items', 'magee-shortcodes') . '</li>';
         } else {
             foreach ($rss_items as $item) {
                 $html .= '<li>';
                 $html .= '<a target="_blank" href="' . esc_url($item->get_permalink()) . '" ';
                 $html .= 'title="' . __('Posted ' . $item->get_date('j F Y | g:i a'), 'magee-shortcodes') . '">';
                 $html .= $item->get_title();
                 $html .= '</a>';
                 $html .= '</li>';
             }
         }
         $html .= '</ul>';
     }
     return $html;
 }
예제 #2
0
function ninja_forms_tab_addons()
{
    $uri = 'http://ninjaforms.com/downloads/category/ninja-forms/feed/';
    //include_once(ABSPATH . WPINC . '/feed.php');
    $feed = fetch_feed($uri);
    if (!is_wp_error($feed)) {
        $items = $feed->get_items(0, 0);
    }
    $items = array(array('title' => __('Layout and Styles', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/01/layout-styles-300x121.png', 'content' => __('This extension gives you power over the look and feel of your Ninja Forms from within your WordPress admin. It gives you the ability to style almost every part of your form, down to the the smallest detail, with little to no …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/layout-styles/', 'plugin' => 'ninja-forms-style/ninja-forms-style.php', 'docs' => 'http://ninjaforms.com/documentation/extensions/layout-styles/'), array('title' => __('PayPal Express', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/09/paypal-express-300x121.png', 'content' => __('Accept payments using PayPal Express and Ninja Forms', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/paypal-express/', 'plugin' => 'ninja-forms-paypal-express/paypal-express.php', 'docs' => 'http://ninjaforms.com/documentation/extensions/paypal-express/'), array('title' => __('Save User Progress', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/save-user-progress-300x121.png', 'content' => __('Sometimes forms can grow quite large, and it would be very helpful for users to be able to save their progress and come back at a later time. This extension does just that for you. Using the built-in WordPress user …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/save-user-progress/', 'plugin' => 'ninja-forms-save-progress/save-progress.php', 'docs' => ''), array('title' => __('File Uploads', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/file-uploads1-300x121.png', 'content' => __('File Uploads for Ninjas Forms gives you the ability to insert file upload fields to your forms. This will allow users the ability to upload images, docs, audio or video files, or anything else you may need. You can easily …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/file-uploads/', 'plugin' => 'ninja-forms-uploads/file-uploads.php', 'docs' => 'http://ninjaforms.com/documentation/extensions/file-uploads/'), array('title' => __('Front-End Posting', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/front-end-posting-300x121.png', 'content' => __('The Ninja Forms Front-end Posting extension gives you the power of the WordPress post editor on any publicly viewable page you choose. You can allow users the ability to create content and have it assigned to any publicly available built-in or custom …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/front-end-posting/', 'plugin' => 'ninja-forms-post-creation/post-creation.php', 'docs' => ''), array('title' => __('Front-End Editor', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/03/front-end-editor.png', 'content' => __('The Front-End Editor Extension brings the power of your WordPress admin to your front-facing site. It is a one-stop solution for almost all your front-end editing needs. Users can now be allowed to create, edit, or delete posts, pages, or any custom post type without the need to see the WordPress admin.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/front-end-editor/', 'plugin' => 'ninja-forms-front-end-editor/front-end-editor.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/front-end-editor/'), array('title' => __('Multi-Part Forms', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/multi-part-forms-300x121.png', 'content' => __('The Multi-Part Forms extension allows you to break long forms into sections, creating a natural flow for your visitors. You can add a breadcrumb trail through the various sections of the form and a progress bar so that your users …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/multi-part-forms/', 'plugin' => 'ninja-forms-multi-part/multi-part.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/multi-part-forms/'), array('title' => __('Conditional Logic', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/conditional-logic-300x121.png', 'content' => __('This extension for Ninja Forms allows you to create “smart” forms. Fields within these forms can dynamically change based upon user input; show or hide fields based on a selected item, set field values based upon a list selection, or …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/conditional-logic/', 'plugin' => 'ninja-forms-conditionals/conditionals.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/conditional-logic/'), array('title' => __('MailChimp', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/04/mailchimp-for-ninja-forms-300x121.png', 'content' => __('The MailChimp extension allows you to quickly create newsletter signup forms for your MailChimp account using the power and flexibility that Ninja Forms provides. …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/mail-chimp/', 'plugin' => 'ninja-forms-mailchimp/ninja-forms-mailchimp.php', 'docs' => ''), array('title' => __('Campaign Monitor', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/05/campaign-monitor-header-300x121.png', 'content' => __('The Campaign Monitor extension allows you to quickly create newsletter signup forms for your Campaign Monitor account using the power and flexibility that Ninja Forms provides. …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/mail-chimp/', 'plugin' => 'ninja-forms-campaign-monitor/ninja-forms-campaign-monitor.php', 'docs' => ''), array('title' => __('User Analytics', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/05/user-analytics-header-300x121.png', 'content' => __('The User Analytics extension will help website owners understand how hot a lead is based on extra data automatically collected about the user. …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/user-analytics/', 'plugin' => 'ninja-forms-user-analytics/nf-user-analytics.php', 'docs' => ''), array('title' => __('Constant Contact', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/07/constant-contact-300x121.png', 'content' => __('The Constant Contact extension allows you to quickly create newsletter signup forms for your Constant Contact account using the power and…', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/constant-contact/', 'plugin' => 'ninja-forms-constant-contact/ninja-forms-constant-contact.php', 'docs' => ''), array('title' => __('AWeber', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/08/aweber-300x121.png', 'content' => __('Use Ninja Forms to quickly create flexible newsletter signup forms for your AWeber email marketing account.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/aweber/', 'plugin' => 'ninja-forms-aweber/ninja-forms-aweber.php', 'docs' => ''), array('title' => __('Picatcha', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/08/picatcha-header-300x121.png', 'content' => __('The Picatcha extension allows you to add image-based CAPTHA to your forms.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/picatcha/', 'plugin' => 'ninja-forms-picatcha/ninja-forms-picatcha.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/picatcha/'), array('title' => __('MailPoet (formerly Wysija)', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/09/mailpoet-300x121.png', 'content' => __('The MailPoet (formerly Wysija) extension allows you to quickly create newsletter signup forms for your MailPoet mailing lists using the power and flexibility that Ninja Forms provides.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/mailpoet/', 'plugin' => 'ninja-forms-mailpoet/nf-mailpoet.php', 'docs' => ''), array('title' => __('HubSpot', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/10/hubspot-300x121.png', 'content' => __('The Ninja Forms HubSpot Extension extends a forms capabilities by forwarding submit data directly into your HubSpot account.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/hubspot/', 'plugin' => 'ninja-forms-hubspot/ninja-forms-hubspot.php', 'docs' => ''), array('title' => __('Text Message Notifications', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/10/text-message-notifications-300x121.png', 'content' => __('Send text message notifications to a site administrator when a form has been submitted.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/text-message-notifications/', 'plugin' => 'ninja-forms-text-message-notifications/nf-text-message-notifications.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/text-message-notifications/'), array('title' => __('Modal Forms', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/11/modal-forms-300x121.png', 'content' => __('Open your Ninja Forms with a simple and clean modal pop-up.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/modal-forms/', 'plugin' => 'ninja-forms-modal/ninja-forms-modal.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/modal-forms/'));
    foreach ($items as $item) {
        echo '<div class="nf-extend nf-box">';
        echo '<img src="' . $item['image'] . '" />';
        echo '<h2>' . $item['title'] . '</h2>';
        echo '<div>';
        echo '<p>' . $item['content'] . '</p>';
        if (!empty($item['docs'])) {
            echo '<a href="' . $item['docs'] . '" class="button-secondary nf-doc-button">' . __('Documentation', 'ninja-forms') . '</a>';
        } else {
            echo '<p>' . __('Documentation coming soon.', 'ninja-forms') . '</a>.</p>';
        }
        echo '</div>';
        if (file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
            if (is_plugin_active($item['plugin'])) {
                echo '<span class="button-secondary nf-button">' . __('Active', 'ninja-forms') . '</span>';
            } elseif (is_plugin_inactive($item['plugin'])) {
                echo '<span class="button-secondary nf-button">' . __('Installed', 'ninja-forms') . '</span>';
            } else {
                echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
            }
        } else {
            echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
        }
        echo '</div>';
    }
}
예제 #3
0
 function fetch_photos($page = 0)
 {
     $this->photos = array();
     if ($page > 1) {
         $this->args['page'] = $page;
     }
     if ($this->use_rss) {
         $rss = fetch_feed($this->get_feed_url());
         //use WordPress simple pie feed handler
         if (is_wp_error($rss)) {
             $this->message = "<p>Error fetching Flickr photos: " . $rss->get_error_message() . "</p>";
             $this->error = true;
         } else {
             $numitems = $rss->get_item_quantity($this->args["per_page"]);
             if ($numitems == 0) {
                 $this->message = '<p>No photos available right now.</p><p>Please verify your settings, clear your RSS cache on the Slickr Flickr Admin page and check your <a target="_blank" href="' . $this->get_feed_url() . '">Flickr feed</a></p>';
                 $this->error = true;
             } else {
                 $rss_items = $rss->get_items(0, $numitems);
                 foreach ($rss_items as $item) {
                     $this->photos[] = new slickr_flickr_photo($item);
                     //feed items and load into object
                 }
             }
         }
     } else {
         $this->photos = $this->call_flickr_api();
     }
     return $this->photos;
 }
예제 #4
0
파일: kexp-kuow.php 프로젝트: uw-sop/htdocs
 function widget($args, $instance)
 {
     if (isset($instance['error']) && $instance['error']) {
         return;
     }
     extract($args, EXTR_SKIP);
     $kexp_url = 'http://blog.kexp.org/feed/';
     $kuow_url = 'http://feeds2.feedburner.com/KUOW';
     $kexp = fetch_feed($kexp_url);
     $kuow = fetch_feed($kuow_url);
     $url = esc_url(strip_tags($kexp_url));
     $title = "<ul id='radio-tab-nav' data-tabs='toggle'>\n                <li class='selected'><a class='rsswidget' href='#tab-kexp' title='KEXP'>KEXP</a></li>\n                <li><a class='rsswidget' href='#tab-kuow' title='KUOW'>KUOW</a></li>\n              </ul>";
     echo $before_widget;
     echo '<div class="kexp-kuow">';
     echo $title;
     echo '<div class="radio-tab-content" id="tab-kexp"><span>';
     wp_widget_rss_output($kexp, $instance);
     echo "<a href='{$kexp_url}' class='more'>More</a>";
     echo '</span></div>';
     echo '<div class="radio-tab-content" id="tab-kuow" style="display:none;"><span>';
     wp_widget_rss_output($kuow, $instance);
     echo "<a href='{$kuow_url}' class='more'>More</a>";
     echo '</span></div>';
     echo '</div>';
     echo $after_widget;
     if (!is_wp_error($kexp)) {
         $kexp->__destruct();
     }
     unset($kexp);
     if (!is_wp_error($kuow)) {
         $kuow->__destruct();
     }
     unset($kuow);
 }
예제 #5
0
 /**
  * Fetches the addons from cache (if not expired) or from the marketplace RSS feed, directly.
  *
  * @param int $limit The number of addons to retrieve from the RSS feed.
  * @return array The list of addons from the RSS feed.
  */
 private function fetch_mp_items($limit = 0)
 {
     $addons = array();
     include_once ABSPATH . WPINC . '/feed.php';
     if (function_exists('fetch_feed')) {
         if (($addons = get_transient('_appthemes-addons-mp-' . $this->args['tab'])) === false) {
             $feed = fetch_feed('http://feeds.feedburner.com/AppThemesMarketplace/');
             if (!is_wp_error($feed)) {
                 $limit = $feed->get_item_quantity($limit);
                 $feed->handle_content_type();
                 // double-check the encoding type
                 $feed->set_cache_duration(0);
                 // don't cache results since we're using our own transient
                 $items = $feed->get_items(0, $limit);
                 // sets the addons limit and array for parsing the feed
                 if ($items) {
                     $addons = $this->get_addons_from_feed($items);
                     // cache for one day
                     set_transient('_appthemes-addons-mp-popular', $addons['popular'], 60 * 60 * 24);
                     set_transient('_appthemes-addons-mp-new', $addons['new'], 60 * 60 * 24);
                     // retrieve the addons list sorted as requested by the user (popular or new)
                     $addons = $addons[$this->args['tab']];
                 }
             } else {
                 $this->error = $feed;
             }
         }
     }
     return $addons;
 }
 /**
  * Return the RSS feed object.
  *
  * @param string $feed The feed to fetch.
  *
  * @return object
  */
 public static function fetch_feed($feed)
 {
     if (!function_exists('fetch_feed')) {
         include_once ABSPATH . WPINC . '/feed.php';
     }
     return fetch_feed($feed);
 }
예제 #7
0
function xpress_dashboard_rss_control($widget_id, $form_inputs = array())
{
    if (!($widget_options = get_option('xpress_dashboard_widget_options'))) {
        $widget_options = array();
    }
    if (!isset($widget_options[$widget_id])) {
        $widget_options[$widget_id] = array();
    }
    $number = 1;
    // Hack to use wp_widget_rss_form()
    $widget_options[$widget_id]['number'] = $number;
    if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number])) {
        $_POST['widget-rss'][$number] = stripslashes_deep($_POST['widget-rss'][$number]);
        $widget_options[$widget_id] = wp_widget_rss_process($_POST['widget-rss'][$number]);
        // title is optional.  If black, fill it if possible
        if (!$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title'])) {
            $rss = fetch_feed($widget_options[$widget_id]['url']);
            if (!is_wp_error($rss)) {
                $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
            } else {
                $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
            }
        }
        update_option('xpress_dashboard_widget_options', $widget_options);
    }
    wp_widget_rss_form($widget_options[$widget_id], $form_inputs);
}
예제 #8
0
 /**
  * Get events from an RSS feed
  *
  * Gets all events from a provided RSS URI
  *
  * @todo currently hard coded to the wordpress.org WordCamp content structure. Needs to be flexible
  * @param string $uri The URI of the feed to fetch
  * @return array $events The events from the provided URI
  */
 public function get_events_from_feed($uri)
 {
     include_once ABSPATH . WPINC . '/feed.php';
     $feed = fetch_feed($uri);
     $events = array();
     foreach ($feed->get_items() as $item) {
         // Get the title of the event
         $title = $item->get_title();
         // Parse the content for the information we need
         $content = wp_strip_all_tags($item->get_content());
         preg_match('/^([^\\n\\r]*)/', $content, $desc_arr);
         preg_match('/(\\w+\\s\\d{1,2},\\s\\d{4})/', $content, $date_arr);
         preg_match('/Location:[\\s\\t\\n\\r]+([^\\t\\n\\r]+)/', $content, $location_arr);
         preg_match('/(https?:\\/\\/?[\\da-z\\.-]+\\.[a-z\\.]{2,6}[\\/\\w \\.-]*\\/?)/', $content, $website_arr);
         // Create event array
         $event = array('title' => $title, 'desc' => trim(array_shift($desc_arr)), 'date' => trim(array_shift($date_arr)), 'location' => trim(array_pop($location_arr)), 'website' => trim(array_shift($website_arr)));
         // Null the description if it has one of the other fields in it
         if (false !== stripos($event['desc'], 'Date:') || false !== stripos($event['desc'], 'Location:') || false !== stripos($event['desc'], 'Website:')) {
             $event['desc'] = '';
         }
         // Create a timestamp from the date
         $event['timestamp'] = strtotime($event['date']);
         // Add the event to the events array
         $events[] = $event;
     }
     return $events;
 }
예제 #9
0
/**
 * Show the latest news.
 * 
 * @param Object $page A reference to the page object showing information.
 */
function WPCW_docs_showSupportInfo_News($page)
{
    $page->openPane('wpcw-docs-support-news', __('Latest news from FlyPlugins.com', 'wp_courseware'));
    $rss = fetch_feed('http://feeds.feedburner.com/FlyPlugins');
    // Got items, so show the news
    if (!is_wp_error($rss)) {
        $rss_items = $rss->get_items(0, $rss->get_item_quantity(3));
        $content = '<ul>';
        if (!$rss_items) {
            $content .= '<li class="fly">' . __('No news items, feed might be broken...', 'wp_courseware') . '</li>';
        } else {
            foreach ($rss_items as $item) {
                $url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), $protocolls = null, 'display'));
                $content .= '<li class="fly">';
                $content .= '<a class="rsswidget" href="' . $url . '">' . esc_html($item->get_title()) . '</a> ';
                $content .= '</li>';
            }
        }
        $content .= '</ul>';
    }
    $content .= '<ul class="wpcw_connect">';
    $content .= '<li class="facebook"><a href="http://flyplugins.com/facebook">' . __('Like Fly Plugins on Facebook', 'wp_courseware') . '</a></li>';
    $content .= '<li class="twitter"><a href="http://flyplugins.com/twitter">' . __('Follow Fly Plugins on Twitter', 'wp_courseware') . '</a></li>';
    $content .= '<li class="youtube"><a href="http://flyplugins.com/youtube">' . __('Watch Fly Plugins on YouTube', 'wp_courseware') . '</a></li>';
    $content .= '<li class="googleplus"><a href="http://flyplugins.com/Google-Plus">' . __('Circle Fly Plugins on Google+', 'wp_courseware') . '</a></li>';
    $content .= '<li class="rss"><a href="http://feeds.feedburner.com/FlyPlugins">' . __('Subscribe with RSS', 'wp_courseware') . '</a></li>';
    $content .= '<li class="email"><a href="http://feedburner.google.com/fb/a/mailverify?uri=FlyPlugins&amp;loc=en_US">' . __('Subscribe by email', 'wp_courseware') . '</a></li>';
    $content .= '</ul>';
    echo '<div class="wpcw_fly_support_news">' . $content . '</div>';
    $page->closePane();
}
예제 #10
0
function s8_dashboard_widget_function()
{
    $rss = fetch_feed("http://station8branding.com/feed/");
    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>Apparently, there are no updates to show!</p>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo "<header style='background: black; padding: 10px; text-align: center; margin: -11px -12px;'><a href='http://station8branding.com' target='_blank'><img src='http://station8branding.com/wp-content/uploads/2014/12/branding2.png'></a></header>";
    echo "<ul>\n";
    if (!isset($items)) {
        $items = 5;
    }
    foreach ($rss->get_items(0, $items) as $item) {
        $link = esc_url(strip_tags($item->get_link()));
        $title = esc_html($item->get_title());
        $content = $item->get_content();
        $content = wp_html_excerpt($content, 150) . ' ...';
        //$image = $item->get_the_post_thumbnail();
        echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>\n<div class='rssSummary'>{$content}</div>\n";
    }
    echo "</ul>\n";
    echo "<a href='http://station8branding.com'>Visit Station8 for more information</a>";
    $rss->__destruct();
    unset($rss);
}
function pb_aec_get_feed($feed, $limit, $append = '', $replace = '', $cache_time = 300)
{
    require_once ABSPATH . WPINC . '/feed.php';
    $rss = fetch_feed($feed);
    if (!is_wp_error($rss)) {
        $maxitems = $rss->get_item_quantity($limit);
        // Limit
        $rss_items = $rss->get_items(0, $maxitems);
        echo '<ul class="pluginbuddy-nodecor">';
        $feed_html = get_transient(md5($feed));
        if ($feed_html == '') {
            foreach ((array) $rss_items as $item) {
                $feed_html .= '<li>- <a href="' . $item->get_permalink() . '">';
                $title = $item->get_title();
                //, ENT_NOQUOTES, 'UTF-8');
                if ($replace != '') {
                    $title = str_replace($replace, '', $title);
                }
                if (strlen($title) < 30) {
                    $feed_html .= $title;
                } else {
                    $feed_html .= substr($title, 0, 32) . ' ...';
                }
                $feed_html .= '</a></li>';
            }
            set_transient(md5($feed), $feed_html, $cache_time);
            // expires in 300secs aka 5min
        }
        echo $feed_html;
        echo $append;
        echo '</ul>';
    } else {
        echo 'Temporarily unable to load feed...';
    }
}
 function get_photos($id, $count = 8)
 {
     if (empty($id)) {
         return false;
     }
     $transient_key = md5('favethemes_flickr_cache_' . $id . $count);
     $cached = get_transient($transient_key);
     if (!empty($cached)) {
         return $cached;
     }
     $output = array();
     $rss = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $id . '&lang=en-us&format=rss_200';
     $rss = fetch_feed($rss);
     if (is_wp_error($rss)) {
         //check for group feed
         $rss = 'http://api.flickr.com/services/feeds/groups_pool.gne?id=' . $id . '&lang=en-us&format=rss_200';
         $rss = fetch_feed($rss);
     }
     if (!is_wp_error($rss)) {
         $maxitems = $rss->get_item_quantity($count);
         $rss_items = $rss->get_items(0, $maxitems);
         foreach ($rss_items as $item) {
             $temp = array();
             $temp['img_url'] = esc_url($item->get_permalink());
             $temp['title'] = esc_html($item->get_title());
             $content = $item->get_content();
             preg_match_all("/<IMG.+?SRC=[\"']([^\"']+)/si", $content, $sub, PREG_SET_ORDER);
             $photo_url = str_replace("_m.jpg", "_t.jpg", $sub[0][1]);
             $temp['img_src'] = esc_url($photo_url);
             $output[] = $temp;
         }
         set_transient($transient_key, $output, 60 * 60 * 24);
     }
     return $output;
 }
function dashboard_widget_function()
{
    $rss = fetch_feed("http://oldtownmediainc.com/feed/");
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>';
            printf(__('<strong>RSS Error</strong>: %s', 'evans-mu'), $rss->get_error_message());
            echo '</p>';
        }
        return;
    }
    if (!$rss->get_item_quantity()) {
        echo '<p>' . __('Apparently, there are no updates to show!', 'evans-mu') . '</p>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo "<ul>\n";
    if (!isset($items)) {
        $items = 5;
    }
    foreach ($rss->get_items(0, $items) as $item) {
        $publisher = $site_link = $link = $content = '';
        $date = $item->get_date();
        $link = esc_url(strip_tags($item->get_link()));
        $title = esc_html($item->get_title());
        $content = $item->get_content();
        $content = wp_html_excerpt($content, 350) . '...';
        echo "<li class='rss-widget'><a class='rsswidget' href='{$link}'>{$title}</a><span class='rss-date'> - {$date}</span>\n<div class='rssSummary'>{$content}</div>\n\r\n";
    }
    echo "</ul>\n";
    $rss->__destruct();
    unset($rss);
}
 function latest_posts()
 {
     $content = '<h4><a href="http://feeds.feedburner.com/DesignChemical"><img src="' . plugins_url() . '/wordpress-social-stream/images/rss_admin.png" alt="" />Subscribe For Updates</a></h4>';
     require_once ABSPATH . WPINC . '/feed.php';
     $content .= '<ul class="dcwp-rss">';
     if ($rss = fetch_feed('http://feeds.feedburner.com/DesignChemical')) {
         if (!is_wp_error($rss)) {
             $maxitems = $rss->get_item_quantity(5);
             $rss_items = $rss->get_items(0, $maxitems);
         }
         if ($maxitems == 0) {
             $content .= '<li class="odd dcsmt-rss-item">No updates available ...</li>';
         } else {
             $count = 1;
             foreach ($rss_items as $item) {
                 $time = dcwss_wpcom_time_since(strtotime($item->get_date()));
                 if ($odd = $count % 2) {
                     $rssClass = "odd dcwp-rss-item";
                 } else {
                     $rssClass = "even dcwp-rss-item";
                 }
                 $content .= '<li class="' . $rssClass . '">' . esc_html($item->get_title());
                 $content .= ' ... <a href="' . esc_url($item->get_permalink()) . '">' . $time . '&nbsp;ago</a></li>';
                 $count++;
             }
         }
     } else {
         $content .= '<li class="odd dcsmt-rss-item">No updates available ...</li>';
     }
     $this->postbox($this->hook . '-latestpostbox', 'Design Chemical Lab:', $content);
 }
예제 #15
0
 function woo_vl_news_widget()
 {
     include_once ABSPATH . WPINC . '/feed.php';
     // Get the RSS feed for WooCommerce Plugins
     $rss = fetch_feed('http://www.visser.com.au/blog/category/woocommerce/feed/');
     $output = '<div class="rss-widget">';
     if (!is_wp_error($rss)) {
         $maxitems = $rss->get_item_quantity(5);
         $rss_items = $rss->get_items(0, $maxitems);
         $output .= '<ul>';
         foreach ($rss_items as $item) {
             $output .= '<li>';
             $output .= '<a href="' . $item->get_permalink() . '" title="' . 'Posted ' . $item->get_date('j F Y | g:i a') . '" class="rsswidget">' . $item->get_title() . '</a>';
             $output .= '<span class="rss-date">' . $item->get_date('j F, Y') . '</span>';
             $output .= '<div class="rssSummary">' . $item->get_description() . '</div>';
             $output .= '</li>';
         }
         $output .= '</ul>';
     } else {
         $message = __('Connection failed. Please check your network settings.', 'woocommerce-exporter');
         $output .= '<p>' . $message . '</p>';
     }
     $output .= '</div>';
     echo $output;
 }
예제 #16
0
 function widget($args, $instance)
 {
     extract($args);
     // outputs the content of the widget
     $URL = 'http://depts.washington.edu/newscomm/photos/feed';
     $rss = fetch_feed($URL);
     $title = apply_filters('widget_title', $instance['title']);
     $placeholder = get_bloginfo('template_url') . '/img/placeholder.gif';
     if (!is_wp_error($rss)) {
         $url = $rss->get_permalink();
         $maxitems = $rss->get_item_quantity(20);
         $rss_items = $rss->get_items(0, $maxitems);
         $content = '<span class="showcase-bar community-photos"></span><div class="communityphotos">';
         if (!empty($title)) {
             $content .= $before_title . $title . $after_title;
         }
         foreach ($rss_items as $item) {
             $title = $item->get_title();
             $link = $item->get_link();
             $src = ereg_replace("(https?)://", "//", $item->get_enclosure()->get_link());
             $content .= "\n          <a href='{$link}' title='{$title}'>\n            <span>\n              <img data-src='{$src}' src='{$placeholder}' width='110' height='100' alt='{$title}'/>\n            </span>\n            <div style='width:110px'>\n              <img data-src='{$src}' src='{$placeholder}' width='110' height='110' alt='{$title}'/>\n              <p>View Full Size</p>\n            </div>\n          </a>\n        ";
         }
         $content .= "<a class='more' href='http://depts.washington.edu/newscomm/photos/'>More</a></div>";
         echo $before_widget . $content . $after_widget;
     }
 }
예제 #17
0
 protected function __output()
 {
     $num = $this->property['num_posts'] ? $this->property['num_posts'] : 4;
     $url = $this->property['url'];
     while (stristr($url, 'http') != $url) {
         $url = substr($url, 1);
     }
     if (empty($url)) {
         return;
     }
     $rss = fetch_feed($url);
     $desc = '';
     $link = '';
     if (!is_wp_error($rss)) {
         $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
         if (empty($title)) {
             $title = esc_html(strip_tags($rss->get_title()));
         }
         $link = esc_url(strip_tags($rss->get_permalink()));
         while (stristr($link, 'http') != $link) {
             $link = substr($link, 1);
         }
     }
     $icon = includes_url('images/rss.png');
     if ($title) {
         $title = "<a class='rsswidget' href='{$url}' title='" . esc_attr__('Assinar feed', 'tnb') . "'><img style='border:0' width='14' height='14' src='{$icon}' alt='RSS' /></a> <a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>";
     }
     echo $title;
     $show_author = $this->property['exibir_autor'] == 1 ? 1 : 0;
     $show_date = $this->property['exibir_data'] == 1 ? 1 : 0;
     $show_summary = $this->property['exibir_resumo'] == 1 ? 1 : 0;
     $items = $this->property['num_posts'] ? $this->property['num_posts'] : 5;
     $default_args = array('show_author' => $show_author, 'show_date' => $show_date, 'show_summary' => $show_summary, 'items' => $items);
     wp_widget_rss_output($rss, $default_args);
 }
예제 #18
0
/**
 * Initialise sync settings for the first time (3.0)
 */
function buddyStreamInitSync()
{
    if (!get_site_option("buddystream_321")) {
        if (get_site_option('buddystream_license_key')) {
            global $bp;
            require_once ABSPATH . WPINC . '/class-feed.php';
            $url = "http://buddystream.net/cronservice/check.php?licensekey=" . get_site_option('buddystream_license_key') . "&domain=" . str_replace("http://", "", $bp->root_domain) . "&contenturl=" . WP_CONTENT_URL . "&output=rss" . "&validate=" . md5(date('Ymd'));
            @fetch_feed($url);
        }
        update_site_option("buddystream_321", "true");
    }
    if (!get_site_option("buddystream_30")) {
        $buddyStreamExtensions = new BuddyStreamExtensions();
        foreach ($buddyStreamExtensions->getExtensionsConfigs() as $extension) {
            if (is_array($extension) && !$extension['parent'] && $extension['synctypes']) {
                $arrSyncTypes = explode(",", str_replace(" ", "", $extension['synctypes']));
                foreach ($arrSyncTypes as $syncType) {
                    update_site_option('buddystream_' . $extension['name'] . '_' . $syncType, 'on');
                }
            }
            //get parent subextensions
            $subExtensions = $buddyStreamExtensions->getExtensionsWithParent($extension['name']);
            foreach ($subExtensions as $subExtension) {
                if ($subExtension['synctypes']) {
                    $arrSyncTypes = explode(",", str_replace(" ", "", $subExtension['synctypes']));
                    foreach ($arrSyncTypes as $syncType) {
                        update_site_option('buddystream_' . $subExtension['name'] . '_' . $syncType, 'on');
                    }
                }
            }
        }
        update_site_option("buddystream_30", "true");
    }
}
예제 #19
0
    public function createRssWidget()
    {
        require_once ABSPATH . WPINC . '/feed.php';
        $url = array_shift(static::$rssWidgets);
        $feed = fetch_feed($url);
        $limit = $feed->get_item_quantity(8);
        $items = $feed->get_items(0, $limit);
        if ($limit == 0) {
            echo '<div>The RSS Feed is either empty or unavailable.</div>';
            return;
        }
        foreach ($items as $item) {
            ?>
            <h4 style="margin-bottom: 0;">
                <a href="<?php 
            echo $item->get_permalink();
            ?>
" title="<?php 
            echo mysql2date('d.m.Y H:i:s', $item->get_date('Y-m-d H:i:s'));
            ?>
" target="_blank">
                    <?php 
            echo $item->get_title();
            ?>
                </a>
            </h4>
            <p style="margin-top: 0.5em;">
                <?php 
            echo substr($item->get_description(), 0, 200);
            ?>
            </p>
            <?php 
        }
    }
예제 #20
0
/**
 * @internal
 * @param int $maxItems
 * @return string
 */
function wpsPlugin_GetFeedData($maxItems = 10)
{
    $rss = fetch_feed(WpsSettings::BLOG_FEED);
    $out = '';
    if (is_wp_error($rss)) {
        return '<li>' . __('An error has occurred while trying to load the rss feed!') . '</li>';
    } else {
        // Limit to $maxItems entries.
        $maxitems = $rss->get_item_quantity($maxItems);
        // Build an array of all the items,
        $rss_items = $rss->get_items(0, $maxitems);
        if ($maxitems == 0) {
            $out .= '<li>' . __('There are no entries for this feed!') . '</li>';
        } else {
            foreach ($rss_items as $item) {
                $url = esc_url($item->get_permalink());
                $out .= '<li>';
                $out .= '<h4><a href="' . $url . '" target="_blank" title="' . __('Posted on ') . $item->get_date('F j, Y | g:i a') . '">';
                $out .= esc_html($item->get_title());
                $out .= '</a></h4>';
                $out .= '<div>' . $item->get_description() . '</div>';
                $out .= '</li>';
            }
        }
        $out .= '<div style="border-top: solid 1px #ccc; margin-top: 4px; padding: 2px 0;">';
        $out .= '<p style="margin: 5px 0 0 0; padding: 0 0; line-height: normal; overflow: hidden;">';
        $out .= '<a href="http://feeds.acunetix.com/acunetixwebapplicationsecurityblog"
                                    style="float: left; display: block; width: 50%; text-align: right; margin-left: 30px;
                                    padding-right: 22px; background: url(\'rss.png\') no-repeat right center;"
                                    target="_blank">' . __('Follow us on RSS') . '</a>';
        $out .= '</p>';
        $out .= '</div>';
    }
    return $out;
}
예제 #21
0
 /**
  * @method       Widget
  * @description  Displays the dashboard widget.
  */
 function widget($args = null)
 {
     // Validate Args
     $defaults = array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', 'widget_name' => '');
     extract(wp_parse_args($args, $defaults), EXTR_SKIP);
     echo $before_widget . $before_title . $widget_name . $after_title;
     echo '<div style="background-image:url(' . plugins_url(WPGEO_SUBDIR . 'img/logo/wp-geo.png') . '); background-repeat:no-repeat; background-position:right top; padding-right:80px;">';
     $feed = fetch_feed('http://feeds2.feedburner.com/wpgeo');
     if (is_wp_error($feed) || !$feed->get_item_quantity()) {
         echo '<p>No recent updates.</p>';
         return;
     }
     $items = $feed->get_items(0, 2);
     foreach ($items as $item) {
         $url = esc_url($item->get_link());
         $title = esc_html($item->get_title());
         $date = esc_html(strip_tags($item->get_date()));
         $description = esc_html(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))));
         echo '<div style="margin-bottom:20px;">';
         echo '<p style="margin-bottom:5px;"><a style="font-size: 1.2em; font-weight:bold;" href="' . $url . '" title="' . $title . '">' . $title . '</a></p>';
         echo '<p style="color: #aaa; margin-top:5px;">' . date('l, jS F Y', strtotime($date)) . '</p>';
         echo '<p>' . $description . '</p>';
         echo '</div>';
     }
     echo '<p><a href="http://www.wpgeo.com/">View all WP Geo news...</a></p>';
     echo '</div>';
     echo $after_widget;
 }
 function render_bean_plugins()
 {
     include_once ABSPATH . WPINC . '/feed.php';
     $rss = fetch_feed(self::MORE_PLUGINS_FEED);
     $rss_items = $rss->get_items();
     $this->render_bean_rss_items($rss_items);
 }
예제 #23
0
    function widget($args, $instance)
    {
        extract($args);
        $rss = fetch_feed('http://feeds.feedburner.com/INNMemberInvestigations');
        $title = __('Stories From Other INN Members', 'largo');
        $desc = __('View more recent stories from members of INN', 'largo');
        $link = 'http://inn.org/network-content';
        $title = "<a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>";
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Stories From Other INN Members', 'largo') : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        largo_widget_rss_output($rss, $instance);
        ?>

		<p class="morelink"><a href="<?php 
        echo esc_url($link);
        ?>
"><?php 
        _e('More Stories From INN Members', 'largo');
        ?>
&nbsp;&raquo;</a></p>

		<?php 
        echo $after_widget;
        unset($rss);
    }
예제 #24
0
function theme_update_notice() {
	
	global
	$theme_feeds;
	
	if (!empty($theme_feeds) && is_admin()) {
		include_once( ABSPATH . WPINC . '/feed.php' );
		
		$feed = fetch_feed($theme_feeds);
		
		if (!is_wp_error($feed)) {
			$max = $feed->get_item_quantity(1);
			$items = $feed->get_items();
			$feed->enable_cache(0);
		}
		
		if ($max > 0) {
			foreach ($items as $item) {
				if ($item->get_title() == THEMENAME && $item->get_description() > THEMEVERSION) {
					echo
						'<div class="update-nag">',
							'Version <b>' . $item->get_description() . '</b> for <b>' . THEMENAME . '</b> is available! <a href="' . $item->get_link() .'">Click here to download the update</a>',
						'</div>';
				}
			}
		}
	}
}
예제 #25
0
 function uw_feed_shortcode($atts)
 {
     extract(shortcode_atts(array('url' => null, 'number' => 5, 'title' => null, 'heading' => 'h3', 'span' => 4), $atts));
     if ($url == null || is_feed()) {
         return '';
     }
     $content = '';
     $feed = fetch_feed($url);
     if (!is_wp_error($feed)) {
         $url = $feed->get_permalink();
         $feed_items = $feed->get_items(0, $number);
         $feed_items = $feed->get_items(0, $number);
         $pullleft = $span === 4 ? 'pull-left' : '';
         $title = $title == null ? $feed->get_title() : $title;
         $content = "<div class=\"row {$pullleft}\">";
         $content .= "<div class=\"span{$span}\">";
         $content .= "<div class=\"feed-in-body\"><a href=\"{$url}\" title=\"{$title}\"><{$heading}>{$title}</{$heading}></a></div>";
         $content .= "<ul>";
         foreach ($feed_items as $index => $item) {
             $title = $item->get_title();
             $link = $item->get_link();
             $attr = esc_attr(strip_tags($title));
             $content .= "<li><a href=\"{$link}\" title=\"{$attr}\">{$title}</a></li>";
         }
         $span--;
         $content .= "<a href=\"{$url}\" title=\"{$title}\" class=\"offset{$span}\">More</a>";
         $content .= '</ul>';
         $content .= "</div></div>";
     }
     return $content;
 }
function synved_connect_sponsor_list($filter = null)
{
    $sponsor_list = array('wordpress-themes-1' => array('type' => 'credit', 'label' => 'WordPress Themes', 'tip' => 'WordPress plugins and themes', 'link' => 'http://synved.com', 'text' => '%%link%% by Synved'), 'wordpress-design-1' => array('type' => 'credit', 'label' => 'WordPress Design', 'tip' => 'WordPress development, themes and custom plugins', 'link' => 'http://synved.com', 'text' => '%%link%% by Synved'), 'synved-options' => array('type' => 'intern', 'label' => 'WordPress Options', 'tip' => 'Add options to your products, the easy way!', 'link' => 'http://synved.com/wordpress-options/', 'text' => 'If you are a designer or developer you might want to chek out our free plugin %%link%% to easily add options to your WordPress products and sell your own addons for them too'), 'hosting-1' => array('type' => 'extern', 'label' => 'professional hosting', 'tip' => 'recommended hosting', 'link' => 'http://synved.com/suggests/hosting/', 'text' => 'If searching for a reliable hosting service you might wanna check out our recommended %%link%%'), 'photocrati' => array('type' => 'extern', 'label' => 'Photocrati', 'tip' => 'WordPress theme for gallery management', 'link' => 'http://synved.com/suggests/photocrati/', 'text' => 'For more advanced image and gallery management features we recommend %%link%% and their fantastic support ;)'));
    $feed = fetch_feed('http://feeds.feedburner.com/_SynvedConnectList?format=xml');
    if (!is_wp_error($feed)) {
        $maxitems = $feed->get_item_quantity();
        $feed_items = $feed->get_items(0, $maxitems);
        $feed_list = array();
        if ($maxitems > 0) {
            foreach ($feed_items as $feed_item) {
                $id = $feed_item->get_id();
                $label = $feed_item->get_title();
                $tip = $feed_item->get_description();
                $link = $feed_item->get_permalink();
                $text = $feed_item->get_content();
                $id_parts = array();
                parse_str(parse_url($id, PHP_URL_QUERY), $id_parts);
                $id = $id_parts['guid'];
                $feed_categories = $feed_item->get_categories();
                $type = null;
                if ($feed_categories != null) {
                    $category_tag = 'synved-connect-type-';
                    foreach ($feed_categories as $feed_category) {
                        $feed_category = $feed_category->get_label();
                        if (substr($feed_category, 0, strlen($category_tag)) == $category_tag) {
                            $type = substr($feed_category, strlen($category_tag));
                            break;
                        }
                    }
                }
                if ($type != null && $id != null) {
                    $feed_list[$id] = array('type' => $type, 'label' => $label, 'tip' => $tip, 'link' => $link, 'text' => $text);
                }
            }
        }
        if ($feed_list != null) {
            $sponsor_list = $feed_list;
        }
    }
    if ($filter != null) {
        $final_list = array();
        foreach ($sponsor_list as $sponsor_key => $sponsor_item) {
            foreach ($filter as $filter_key => $filter_value) {
                if (isset($sponsor_item[$filter_key])) {
                    $sponsor_value = $sponsor_item[$filter_key];
                    if (synved_connect_key_item_match($sponsor_value, $filter_value)) {
                        $final_list[$sponsor_key] = $sponsor_item;
                    }
                }
            }
        }
        $sponsor_list = $final_list;
    }
    $sponsor_keys = array_keys($sponsor_list);
    foreach ($sponsor_keys as $sponsor_key) {
        $sponsor_list[$sponsor_key]['id'] = $sponsor_key;
    }
    return $sponsor_list;
}
예제 #27
0
/**
 * Creates the RSS metabox
 *
 * @access      public
 * @since       1.0 
 * @return      void
*/
function rss_box($rss)
{
    // Get RSS Feed(s)
    include_once ABSPATH . WPINC . '/feed.php';
    // My feeds list (add your own RSS feeds urls)
    $my_feeds = array('http://agora.xtec.cat/nodes/categoria/portada/feed');
    // Loop through Feeds
    foreach ($my_feeds as $feed) {
        // Get a SimplePie feed object from the specified feed source.
        $rss = fetch_feed($feed);
        if (!is_wp_error($rss)) {
            // Checks that the object is created correctly
            // Figure out how many total items there are, and choose a limit
            $maxitems = $rss->get_item_quantity(20);
            // Build an array of all the items, starting with element 0 (first element).
            $rss_items = $rss->get_items(0, $maxitems);
            // Get RSS title
            $rss_title = '<a href="' . $rss->get_permalink() . '" target="_blank">' . strtoupper($rss->get_title()) . '</a>';
        }
        // Display the container
        echo '<div class="rss-widget">';
        echo '<strong>' . $rss_title . '</strong>';
        echo '<hr style="border: 0; background-color: #DFDFDF; height: 1px;">';
        // Starts items listing within <ul> tag
        echo '<ul>';
        // Check items
        if ($maxitems == 0) {
            echo '<li>' . __('No item', 'rc_mdm') . '.</li>';
        } else {
            // Loop through each feed item and display each item as a hyperlink.
            foreach ($rss_items as $item) {
                // Uncomment line below to display non human date
                //$item_date = $item->get_date( get_option('date_format').' @ '.get_option('time_format') );
                // Get human date (comment if you want to use non human date)
                $item_date = human_time_diff($item->get_date('U'), current_time('timestamp')) . ' ' . __('ago', 'rc_mdm');
                // Start displaying item content within a <li> tag
                echo '<li>';
                // create item link
                echo '<a href="' . esc_url($item->get_permalink()) . '" title="' . $item_date . '">';
                // Get item title
                echo esc_html($item->get_title());
                echo '</a>';
                // Display date
                echo ' <span class="rss-date">' . $item_date . '</span><br />';
                // Get item content
                $content = $item->get_content();
                // Shorten content
                $content = wp_html_excerpt($content, 120) . ' [...]';
                // Display content
                echo $content;
                // End <li> tag
                echo '</li>';
            }
        }
        // End <ul> tag
        echo '</ul></div>';
    }
    // End foreach feed
}
 public function get_feed()
 {
     $url = $this->get_feed_url();
     add_action('wp_feed_options', function ($feed) {
         $feed->force_feed(true);
     }, 10, 1);
     return fetch_feed($url);
 }
 function fetch_raw_images($page, $per_page, $state, $options)
 {
     $feed = fetch_feed(explode(',', $this->source['url']));
     if (is_wp_error($feed)) {
         return array($feed, null);
     }
     $items = $feed->get_items(($page - 1) * $per_page, $page * $per_page);
     return array($items, null);
 }
예제 #30
0
function nattywp_more_themes_page()
{
    ?>
        <div class="wrap">
          <h2><?php 
    _e('More NattyWP Themes', 'silesia');
    ?>
</h2>
          <div class="info">
          <a href="http://www.nattywp.com/themes-club.php"><?php 
    _e('Join the NattyWP Club', 'silesia');
    ?>
</a> / <a href="http://www.nattywp.com/nattywp-services.php"><?php 
    _e('NattyWP Services', 'silesia');
    ?>
</a></div>          
          
            <?php 
    include_once ABSPATH . WPINC . '/feed.php';
    //class-simplepie.php
    $rss = fetch_feed('http://www.nattywp.com/feed/rss.xml');
    if (!isset($rss->errors)) {
        $rss->strip_attributes(false);
    }
    // RSS is failed.
    if (is_wp_error($rss)) {
        $error = $rss->get_error_code();
        if ($error == 'simplepie-error') {
            //Simplepie Error
            echo '<div class="updated fade"><p>' . __('An error has occured with the RSS feed.', 'silesia') . ' (<code>' . $error . '</code>)</p></div>';
        }
        return;
    }
    $maxitems = $rss->get_item_quantity(100);
    $items = $rss->get_items(0, $maxitems);
    ?>

            <ul class="themes">
            <?php 
    if (empty($items) || $maxitems == 0) {
        echo '<li>' . __('No items', 'silesia') . '</li>';
    } else {
        foreach ($items as $item) {
            ?>
                <li class="theme">
                <?php 
            echo $item->get_description();
            ?>
                </li>
            <?php 
        }
    }
    ?>
            </ul>            
            </div>         
         <?php 
}