• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP fetch_feed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fetch_feed函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_feed函数的具体用法?PHP fetch_feed怎么用?PHP fetch_feed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fetch_feed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: fetch_photos

 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;
 }
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:30,代码来源:slickr-flickr-feed.php


示例2: ninja_forms_tab_addons

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>';
    }
}
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:35,代码来源:addons.php


示例3: fetch_mp_items

 /**
  * 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;
 }
开发者ID:kalushta,项目名称:darom,代码行数:36,代码来源:addons-mp-class.php


示例4: widget

 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);
 }
开发者ID:uw-sop,项目名称:htdocs,代码行数:34,代码来源:kexp-kuow.php


示例5: fetch_feed

 /**
  * 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);
 }
开发者ID:wilxsv,项目名称:prevensionPublicLibrary,代码行数:14,代码来源:class-cl-common.php


示例6: xpress_dashboard_rss_control

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);
}
开发者ID:nouphet,项目名称:rata,代码行数:27,代码来源:dashboard_feed.php


示例7: get_events_from_feed

 /**
  * 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;
 }
开发者ID:ryanshoover,项目名称:wpengine-wordcamps,代码行数:36,代码来源:events.php


示例8: WPCW_docs_showSupportInfo_News

/**
 * 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();
}
开发者ID:JalpMi,项目名称:v2contact,代码行数:36,代码来源:documentation.inc.php


示例9: render

 /**
  * 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;
 }
开发者ID:JasonAJames,项目名称:jasonajamescom,代码行数:38,代码来源:class-rss-feed.php


示例10: s8_dashboard_widget_function

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);
}
开发者ID:Station8branding,项目名称:WP_roots,代码行数:35,代码来源:station.php


示例11: pb_aec_get_feed

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...';
    }
}
开发者ID:pawandhillon,项目名称:ICTICT-project,代码行数:35,代码来源:admin-getting-started.php


示例12: get_photos

 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;
 }
开发者ID:phuthuytinhoc,项目名称:Demo1,代码行数:35,代码来源:magazilla-flickr-photos.php


示例13: dashboard_widget_function

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);
}
开发者ID:TheTypoMaster,项目名称:evans,代码行数:34,代码来源:otm-blog-dashboard-widget.php


示例14: latest_posts

 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);
 }
开发者ID:visitcasabacardi,项目名称:backup-nov-15,代码行数:31,代码来源:dcwp_plugin_admin.php


示例15: woo_vl_news_widget

 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;
 }
开发者ID:hikaram,项目名称:wee,代码行数:25,代码来源:common-dashboard_widgets.php


示例16: widget

 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;
     }
 }
开发者ID:uw-sop,项目名称:htdocs,代码行数:26,代码来源:community-photos.php


示例17: __output

 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);
 }
开发者ID:hacklabr,项目名称:toquenobrasil,代码行数:35,代码来源:_widget_rss.class.php


示例18: buddyStreamInitSync

/**
 * 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");
    }
}
开发者ID:BonoboDesigns,项目名称:buddystream,代码行数:37,代码来源:buddystream.php


示例19: createRssWidget

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fetch_file_contents函数代码示例发布时间:2022-05-15
下一篇:
PHP fetch_error函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap