当前位置: 首页>>代码示例>>PHP>>正文


PHP SimplePie::get_permalink方法代码示例

本文整理汇总了PHP中SimplePie::get_permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::get_permalink方法的具体用法?PHP SimplePie::get_permalink怎么用?PHP SimplePie::get_permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimplePie的用法示例。


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

示例1: make

 /**
  * Render a newsletter
  * @return string the newsletter.
  */
 public function make()
 {
     $module = Yii::app()->controller->module;
     require_once 'protected/vendors/simplepie/autoloader.php';
     require_once 'protected/vendors/simplepie/idn/idna_convert.class.php';
     $timeLimit = KeyValue::model()->findByPk('newsletter_execution_time')->value;
     $simplePie = new SimplePie();
     $simplePie->set_cache_location('./protected/cache/simplepie');
     $simplePie->set_cache_duration(1);
     // 1 seconde
     // This makes sure that the content is sent to the browser as
     // text/html and the UTF-8 character set (since we didn't change it).
     $simplePie->handle_content_type();
     if ($module->multiLang) {
         if (isset($this->language)) {
             $feeds = $module->feeds[$this->language];
             $renderLanguage = $this->language;
         } else {
             $feeds = $module->feeds[Yii::app()->language];
             $renderLanguage = Yii::app()->language;
         }
     } else {
         $feeds = $module->feeds;
         $renderLanguage = Yii::app()->language;
     }
     $atLeastOne = false;
     for ($i = 0; $i < count($feeds); $i++) {
         if (isset($feeds[$i]['expression'])) {
             $feeds[$i]['content'] = $this->evaluateExpression($feeds[$i]['expression'], array('timeLimit' => $timeLimit, 'language' => $renderLanguage));
             if ($feeds[$i]['content'] != '') {
                 $atLeastOne = true;
             }
         } else {
             $simplePie->set_feed_url($feeds[$i]['url']);
             $simplePie->init();
             $feeds[$i]['link'] = $simplePie->get_permalink();
             $feeds[$i]['items'] = array();
             foreach ($simplePie->get_items(0, $feeds[$i]['limit']) as $item) {
                 if ($item->get_date('U') > strtotime($timeLimit)) {
                     $feeds[$i]['items'][] = $item;
                     $atLeastOne = true;
                 }
             }
         }
     }
     if ($atLeastOne) {
         return Yii::app()->controller->renderPartial('newsletter.components.views.newsletter', array('feeds' => $feeds, 'language' => $renderLanguage), true);
     } else {
         return false;
     }
 }
开发者ID:kostya1017,项目名称:our,代码行数:55,代码来源:Newsletter.php

示例2: elseif

 }
 if ($widget->post_date == "yes" || $widget->post_date == "friendly") {
     $post_date = "friendly";
 } elseif ($widget->post_date == "date") {
     $post_date = "date";
 } else {
     $post_date = false;
 }
 $feed = new SimplePie();
 $feed->set_feed_url($feed_url);
 $feed->set_cache_location(WIDGETS_RSS_CACHE_LOCATION);
 $feed->set_cache_duration(WIDGETS_RSS_CACHE_DURATION);
 $feed->init();
 $num_posts_in_feed = $feed->get_item_quantity($rss_count);
 if (($feed_title = $feed->get_title()) && $widget->show_feed_title == "yes") {
     echo "<h3><a href='" . $feed->get_permalink() . "' target='_blank'>" . $feed_title . "</a></h3>";
 }
 $body = "";
 if (empty($num_posts_in_feed)) {
     $body = elgg_echo('notfound');
 } else {
     foreach ($feed->get_items(0, $num_posts_in_feed) as $item) {
         if ($excerpt) {
             $body .= "<div class='widgets_rss_feed_item'>";
             $body .= "<div><a href='" . $item->get_permalink() . "' target='_blank'>" . $item->get_title() . "</a></div>";
             if ($show_item_icon) {
                 if ($enclosures = $item->get_enclosures()) {
                     foreach ($enclosures as $enclosure) {
                         if (substr($enclosure->type, 0, 6) == "image/") {
                             $body .= "<a href='" . $item->get_permalink() . "' target='_blank'><img class='widgets_rss_feed_item_image' src='" . $enclosure->link . "' /></a>";
                             break;
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:content.php

示例3: SimplePie

                if (!isset($person['delete'])) {
                    $newOpml->entries[] = $person;
                }
            } else {
                $newOpml->entries[] = $person;
            }
        }
    }
    // Add feed
    if (isset($_POST['add'])) {
        if ('http://' != $_POST['url']) {
            //autodiscover feed
            $feed = new SimplePie();
            $feed->enable_cache(false);
            $feed->set_feed_url($_POST['url']);
            $feed->init();
            $feed->handle_content_type();
            $person['name'] = $feed->get_title();
            $person['website'] = $feed->get_permalink();
            $person['feed'] = $feed->feed_url;
            $oldOpml->entries[] = $person;
            $newOpml->entries = $oldOpml->entries;
        }
    }
    // Backup old OPML
    OpmlManager::backup(dirname(__FILE__) . '/../custom/people.opml');
    // Save new OPML
    OpmlManager::save($newOpml, dirname(__FILE__) . '/../custom/people.opml');
}
header("Location: index.php");
die;
开发者ID:KasaiDot,项目名称:Fansubs.cat,代码行数:31,代码来源:subscriptions.php

示例4: getPosts

 /**
  *
  * Get posts from feeds:
  * @param array $feeds Array with the feeds.
  * @return array Array with the posts.
  */
 public function getPosts($feeds)
 {
     $posts = array();
     foreach ($feeds as $name => $feed) {
         Debug::info("Getting posts from " . $feed['url']);
         $rss = new SimplePie($feed['url']);
         $rss->handle_content_type();
         $rss->force_feed(true);
         $counter = 1;
         foreach ($rss->get_items() as $item) {
             Debug::info("  post {$counter} of " . MAXPOSTS . ".");
             if (!is_object($item)) {
                 Debug::error("Parsing item (" . $item . ").");
             } else {
                 if (strstr($item->get_title(), "[minipost]")) {
                     Debug::say("Minipost...passing.");
                 } else {
                     $counter++;
                     $timestamp = strtotime($item->get_date());
                     # Post:
                     $posts[$timestamp]['id'] = "p" . $timestamp . "-" . $counter;
                     $posts[$timestamp]['pubdate'] = $item->get_date('r');
                     $posts[$timestamp]['date'] = $item->get_local_date();
                     $posts[$timestamp]['time'] = $item->get_local_date("%T");
                     $posts[$timestamp]['permalink'] = $item->get_permalink();
                     $posts[$timestamp]['title'] = $item->get_title();
                     $posts[$timestamp]['description'] = $item->get_description();
                     $posts[$timestamp]['content'] = $item->get_content();
                     if ($posts[$timestamp]['description'] == $posts[$timestamp]['content'] and strlen($posts[$timestamp]['content']) < 400) {
                         $posts[$timestamp]['description'] = Html::Cut(Html::BurnerClean($item->get_description()));
                         $posts[$timestamp]['content'] = "";
                         $posts[$timestamp]['toggle'] = "";
                     } else {
                         $posts[$timestamp]['description'] = Html::Cut(Html::BurnerClean($item->get_description()));
                         $posts[$timestamp]['content'] = Html::Clean($item->get_content());
                         $posts[$timestamp]['toggle'] = "<a onclick='ToggleContent(\"" . $posts[$timestamp]['id'] . "\"); return false;' href=\"#\">&dArr; Read more</a>";
                     }
                     // Microblogging posts have same description as title
                     if (FALSE !== strpos($posts[$timestamp]['title'], $posts[$timestamp]['description'])) {
                         $posts[$timestamp]['description'] = "";
                         $posts[$timestamp]['content'] = "";
                         $posts[$timestamp]['toggle'] = "";
                     }
                     # Rss:
                     $posts[$timestamp]['description_rss'] = $posts[$timestamp]['description'];
                     $posts[$timestamp]['content_rss'] = $posts[$timestamp]['content'];
                     # author:
                     if (method_exists($item, 'get_author') and is_object($item->get_author())) {
                         # The feed ones:
                         $posts[$timestamp]['author'] = $item->get_author()->get_name();
                         $posts[$timestamp]['author_link'] = $item->get_author()->get_link();
                     } else {
                         Debug::say("No author data feed " . $name);
                         $posts[$timestamp]['author'] = $name;
                         $posts[$timestamp]['author_link'] = $rss->get_permalink();
                     }
                     # Si han quedado vacíos pese a todo:
                     if (empty($posts[$timestamp]['author'])) {
                         $posts[$timestamp]['author'] = $name;
                     }
                     if (empty($posts[$timestamp]['author_link'])) {
                         $posts[$timestamp]['author_link'] = $feed['url'];
                     }
                     $posts[$timestamp]['author_email'] = $feed['email'];
                     # Gravatar:
                     if (strlen($feed['avatar'])) {
                         $posts[$timestamp]['author_avatar'] = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($feed['avatar']) . "&amp;size=40&amp;default=" . urlencode(DEFAULT_AVATAR);
                     } else {
                         if (strlen($feed['avatar_url'])) {
                             $posts[$timestamp]['author_avatar'] = $feed['avatar_url'];
                         }
                     }
                     # Blog:
                     $posts[$timestamp]['blog_title'] = $rss->get_title();
                     $posts[$timestamp]['blog_url'] = $rss->get_permalink();
                     $posts[$timestamp]['blog_desc'] = $rss->get_description();
                     # Logo:
                     $posts[$timestamp]['logo_url'] = $rss->get_image_url();
                     $posts[$timestamp]['logo_link'] = $rss->get_image_link();
                     $posts[$timestamp]['logo_title'] = $rss->get_image_title();
                 }
             }
             if ($counter > MAXPOSTS) {
                 break;
             }
         }
     }
     krsort($posts);
     #Debug::dump($posts);
     return $posts;
 }
开发者ID:jorgefuertes,项目名称:qPlanet,代码行数:97,代码来源:Rss.class.php

示例5: feedzy_rss

function feedzy_rss($atts, $content = '')
{
    global $feedzyStyle;
    $feedzyStyle = true;
    $count = 0;
    //Load SimplePie if not already
    if (!class_exists('SimplePie')) {
        require_once ABSPATH . WPINC . '/class-feed.php';
    }
    //Retrieve & extract shorcode parameters
    extract(shortcode_atts(array("feeds" => '', "max" => '5', "feed_title" => 'yes', "target" => '_blank', "title" => '', "meta" => 'yes', "summary" => 'yes', "summarylength" => '', "thumb" => 'yes', "default" => '', "size" => '', "keywords_title" => ''), $atts, 'feedzy_default'));
    //Use "shortcode_atts_feedzy_default" filter to edit shortcode parameters default values or add your owns.
    if (!empty($feeds)) {
        $feeds = rtrim($feeds, ',');
        $feeds = explode(',', $feeds);
        //Remove SSL from HTTP request to prevent fetching errors
        foreach ($feeds as $feed) {
            $feedURL[] = preg_replace("/^https:/i", "http:", $feed);
        }
        if (count($feedURL) === 1) {
            $feedURL = $feedURL[0];
        }
    }
    if ($max == '0') {
        $max = '999';
    } else {
        if (empty($max) || !ctype_digit($max)) {
            $max = '5';
        }
    }
    if (empty($size) || !ctype_digit($size)) {
        $size = '150';
    }
    $sizes = array('width' => $size, 'height' => $size);
    $sizes = apply_filters('feedzy_thumb_sizes', $sizes, $feedURL);
    if (!empty($title) && !ctype_digit($title)) {
        $title = '';
    }
    if (!empty($keywords_title)) {
        $keywords_title = rtrim($keywords_title, ',');
        $keywords_title = array_map('trim', explode(',', $keywords_title));
    }
    if (!empty($summarylength) && !ctype_digit($summarylength)) {
        $summarylength = '';
    }
    if (!empty($default)) {
        $default = $default;
    } else {
        $default = apply_filters('feedzy_default_image', $default, $feedURL);
    }
    //Load SimplePie Instance
    $feed = new SimplePie();
    $feed->set_feed_url($feedURL);
    $feed->enable_cache(true);
    $feed->enable_order_by_date(true);
    $feed->set_cache_class('WP_Feed_Cache');
    $feed->set_file_class('WP_SimplePie_File');
    $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 7200, $feedURL));
    do_action_ref_array('wp_feed_options', array($feed, $feedURL));
    $feed->strip_comments(true);
    $feed->strip_htmltags(array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'));
    $feed->init();
    $feed->handle_content_type();
    // Display the error message
    if ($feed->error()) {
        $content .= apply_filters('feedzy_default_error', $feed->error(), $feedURL);
    }
    $content .= '<div class="feedzy-rss">';
    if ($feed_title == 'yes') {
        $content .= '<div class="rss_header">';
        $content .= '<h2><a href="' . $feed->get_permalink() . '" class="rss_title">' . html_entity_decode($feed->get_title()) . '</a> <span class="rss_description"> ' . $feed->get_description() . '</span></h2>';
        $content .= '</div>';
    }
    $content .= '<ul>';
    //Loop through RSS feed
    $items = apply_filters('feedzy_feed_items', $feed->get_items(), $feedURL);
    foreach ((array) $items as $item) {
        $continue = apply_filters('feedzy_item_keyword', true, $keywords_title, $item, $feedURL);
        if ($continue == true) {
            //Count items
            if ($count >= $max) {
                break;
            }
            $count++;
            //Fetch image thumbnail
            if ($thumb == 'yes' || $thumb == 'auto') {
                $thethumbnail = feedzy_retrieve_image($item);
            }
            $itemAttr = apply_filters('feedzy_item_attributes', $itemAttr = '', $sizes, $item, $feedURL);
            //Build element DOM
            $content .= '<li ' . $itemAttr . '>';
            if ($thumb == 'yes' || $thumb == 'auto') {
                $contentThumb = '';
                if (!empty($thethumbnail) && $thumb == 'auto' || $thumb == 'yes') {
                    $contentThumb .= '<div class="rss_image" style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px;">';
                    $contentThumb .= '<a href="' . $item->get_permalink() . '" target="' . $target . '" title="' . $item->get_title() . '" >';
                    if (!empty($thethumbnail)) {
                        $thethumbnail = feedzy_image_encode($thethumbnail);
                        $contentThumb .= '<span class="default" style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:  url(' . $default . ');" alt="' . $item->get_title() . '"></span>';
                        $contentThumb .= '<span class="fetched" style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:  url(' . $thethumbnail . ');" alt="' . $item->get_title() . '"></span>';
//.........这里部分代码省略.........
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:101,代码来源:feedzy-rss-feeds-shortcode.php

示例6: probe_url


//.........这里部分代码省略.........
                    }
                }
            } else {
                $item = $feed->get_item(0);
                if ($item) {
                    $author = $item->get_author();
                    if ($author) {
                        $vcard['fn'] = trim(unxmlify($author->get_name()));
                        if (!$vcard['fn']) {
                            $vcard['fn'] = trim(unxmlify($author->get_email()));
                        }
                        if (strpos($vcard['fn'], '@') !== false) {
                            $vcard['fn'] = substr($vcard['fn'], 0, strpos($vcard['fn'], '@'));
                        }
                        $email = unxmlify($author->get_email());
                        if (!$profile && $author->get_link()) {
                            $profile = trim(unxmlify($author->get_link()));
                        }
                    }
                    if (!$vcard['photo']) {
                        $rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/', 'thumbnail');
                        if ($rawmedia && $rawmedia[0]['attribs']['']['url']) {
                            $vcard['photo'] = unxmlify($rawmedia[0]['attribs']['']['url']);
                        }
                    }
                    if (!$vcard['photo']) {
                        $rawtags = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
                        if ($rawtags) {
                            $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
                            if (x($elems, 'link') && $elems['link'][0]['attribs']['']['rel'] === 'photo') {
                                $vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
                            }
                        }
                    }
                }
            }
            if (!$vcard['photo'] && strlen($email)) {
                $vcard['photo'] = avatar_img($email);
            }
            if ($poll === $profile) {
                $lnk = $feed->get_permalink();
            }
            if (isset($lnk) && strlen($lnk)) {
                $profile = $lnk;
            }
            if (!x($vcard, 'fn')) {
                $vcard['fn'] = notags($feed->get_title());
            }
            if (!x($vcard, 'fn')) {
                $vcard['fn'] = notags($feed->get_description());
            }
            if (strpos($vcard['fn'], 'Twitter / ') !== false) {
                $vcard['fn'] = substr($vcard['fn'], strpos($vcard['fn'], '/') + 1);
                $vcard['fn'] = trim($vcard['fn']);
            }
            if (!x($vcard, 'nick')) {
                $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
                if (strpos($vcard['nick'], ' ')) {
                    $vcard['nick'] = trim(substr($vcard['nick'], 0, strpos($vcard['nick'], ' ')));
                }
            }
            if (!$network) {
                $network = NETWORK_FEED;
            }
            if (!$priority) {
                $priority = 2;
            }
        }
    }
    if (!x($vcard, 'photo')) {
        $a = get_app();
        $vcard['photo'] = $a->get_baseurl() . '/images/person-175.jpg';
    }
    if (!$profile) {
        $profile = $url;
    }
    // No human could be associated with this link, use the URL as the contact name
    if ($network === NETWORK_FEED && $poll && !x($vcard, 'fn')) {
        $vcard['fn'] = $url;
    }
    $vcard['fn'] = notags($vcard['fn']);
    $vcard['nick'] = str_replace(' ', '', notags($vcard['nick']));
    $result['name'] = $vcard['fn'];
    $result['nick'] = $vcard['nick'];
    $result['url'] = $profile;
    $result['addr'] = $addr;
    $result['batch'] = $batch;
    $result['notify'] = $notify;
    $result['poll'] = $poll;
    $result['request'] = $request;
    $result['confirm'] = $confirm;
    $result['poco'] = $poco;
    $result['photo'] = $vcard['photo'];
    $result['priority'] = $priority;
    $result['network'] = $network;
    $result['alias'] = $alias;
    $result['pubkey'] = $pubkey;
    logger('probe_url: ' . print_r($result, true), LOGGER_DEBUG);
    return $result;
}
开发者ID:robhell,项目名称:friendica,代码行数:101,代码来源:Scrape.php

示例7: consume_feed

/**
 * @brief Process atom feed and update anything/everything we might need to update.
 *
 * $hub = should we find a hub declation in the feed, pass it back to our calling process, who might (or
 *        might not) try and subscribe to it.
 * $datedir sorts in reverse order
 *
 * @param array $xml
 *   The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.
 * @param $importer
 *   The contact_record (joined to user_record) of the local user who owns this
 *   relationship. It is this person's stuff that is going to be updated.
 * @param $contact
 *   The person who is sending us stuff. If not set, we MAY be processing a "follow" activity
 *   from an external network and MAY create an appropriate contact record. Otherwise, we MUST
 *   have a contact record.
 * @param int $pass by default ($pass = 0) we cannot guarantee that a parent item has been
 *   imported prior to its children being seen in the stream unless we are certain
 *   of how the feed is arranged/ordered.
 *  * With $pass = 1, we only pull parent items out of the stream.
 *  * With $pass = 2, we only pull children (comments/likes).
 *
 * So running this twice, first with pass 1 and then with pass 2 will do the right
 * thing regardless of feed ordering. This won't be adequate in a fully-threaded
 * model where comments can have sub-threads. That would require some massive sorting
 * to get all the feed items into a mostly linear ordering, and might still require
 * recursion.
 */
function consume_feed($xml, $importer, &$contact, $pass = 0)
{
    require_once 'library/simplepie/simplepie.inc';
    if (!strlen($xml)) {
        logger('consume_feed: empty input');
        return;
    }
    $feed = new SimplePie();
    $feed->set_raw_data($xml);
    $feed->init();
    if ($feed->error()) {
        logger('consume_feed: Error parsing XML: ' . $feed->error());
    }
    $permalink = $feed->get_permalink();
    // Check at the feed level for updated contact name and/or photo
    // process any deleted entries
    $del_entries = $feed->get_feed_tags(NAMESPACE_TOMB, 'deleted-entry');
    if (is_array($del_entries) && count($del_entries) && $pass != 2) {
        foreach ($del_entries as $dentry) {
            $deleted = false;
            if (isset($dentry['attribs']['']['ref'])) {
                $mid = $dentry['attribs']['']['ref'];
                $deleted = true;
                if (isset($dentry['attribs']['']['when'])) {
                    $when = $dentry['attribs']['']['when'];
                    $when = datetime_convert('UTC', 'UTC', $when, 'Y-m-d H:i:s');
                } else {
                    $when = datetime_convert('UTC', 'UTC', 'now', 'Y-m-d H:i:s');
                }
            }
            if ($deleted && is_array($contact)) {
                $r = q("SELECT * from item where mid = '%s' and author_xchan = '%s' and uid = %d limit 1", dbesc(base64url_encode($mid)), dbesc($contact['xchan_hash']), intval($importer['channel_id']));
                if ($r) {
                    $item = $r[0];
                    if (!($item['item_restrict'] & ITEM_DELETED)) {
                        logger('consume_feed: deleting item ' . $item['id'] . ' mid=' . base64url_decode($item['mid']), LOGGER_DEBUG);
                        drop_item($item['id'], false);
                    }
                }
            }
        }
    }
    // Now process the feed
    if ($feed->get_item_quantity()) {
        logger('consume_feed: feed item count = ' . $feed->get_item_quantity(), LOGGER_DEBUG);
        $items = $feed->get_items();
        foreach ($items as $item) {
            $is_reply = false;
            $item_id = base64url_encode($item->get_id());
            logger('consume_feed: processing ' . $item_id, LOGGER_DEBUG);
            $rawthread = $item->get_item_tags(NAMESPACE_THREAD, 'in-reply-to');
            if (isset($rawthread[0]['attribs']['']['ref'])) {
                $is_reply = true;
                $parent_mid = base64url_encode($rawthread[0]['attribs']['']['ref']);
            }
            if ($is_reply) {
                if ($pass == 1) {
                    continue;
                }
                // Have we seen it? If not, import it.
                $item_id = base64url_encode($item->get_id());
                $author = array();
                $datarray = get_atom_elements($feed, $item, $author);
                if (!x($author, 'author_name') || $author['author_is_feed']) {
                    $author['author_name'] = $contact['xchan_name'];
                }
                if (!x($author, 'author_link') || $author['author_is_feed']) {
                    $author['author_link'] = $contact['xchan_url'];
                }
                if (!x($author, 'author_photo') || $author['author_is_feed']) {
                    $author['author_photo'] = $contact['xchan_photo_m'];
                }
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:101,代码来源:items.php

示例8: SimplePie

}
echo "<div style=\"padding:20px;\">";
echo "Trying to add new feed: " . "<b>" . $feedname . "</b>";
$feed = new SimplePie();
$feed->set_feed_url($feedname);
$feed->set_cache_location(CACHE_DIR);
$feed->init();
$feed->handle_content_type();
//if error found, show error message and stop parsing
if ($feed->error()) {
    echo "<strong>Error! </strong>Unable to process feed: " . $feedname . "<br><br>";
    echo $feed->error();
} else {
    $title = $feed->get_title();
    $feed_desc = $feed->get_description();
    $feedurl = $feed->get_permalink();
    //favicon has been deprecated: $feed->get_favicon();
    $favicon = NULL;
    echo "<table style=\"width: 500px; margin-top:10px;\" class=\"table table-bordered\">";
    echo "<tr><td>Feed url:</td><td>" . $feedurl . "</td></tr>";
    echo "<tr><td>Feed title:</td><td>" . $title . "</td></tr>";
    echo "<tr><td>Feed description:</td><td>" . $feed_desc . "</td></tr>";
    echo "</table>";
    if (empty($title)) {
        echo "<strong style=\"color:red;\"><br>Title is empty, rss feed seems to be invalid!</strong>";
        exit;
    }
    //check if feed_name already exists in database
    $database->query("SELECT feed_name FROM t_feeds WHERE feed_name = :feed_name OR url = :url");
    $database->bind(':feed_name', $title);
    $database->bind(':url', $feedname);
开发者ID:esironal,项目名称:rssmonster,代码行数:31,代码来源:addfeedhandler.php

示例9: SimplePie

    $show_author = true;
}
if ($feed_url) {
    $rss_cachetimeout = 3600;
    if (!empty($widget->rss_cachetimeout)) {
        $rss_cachetimeout = sanitise_int($widget->rss_cachetimeout, false);
    }
    elgg_load_library("simplepie");
    $feed = new SimplePie();
    $feed->set_feed_url($feed_url);
    $feed->set_cache_location($cache_location);
    $feed->set_cache_duration($rss_cachetimeout);
    $feed->init();
    if ($show_feed_title) {
        echo "<h3>";
        echo elgg_view("output/url", array("text" => $feed->get_title(), "href" => $feed->get_permalink(), "target" => "_blank"));
        echo "</h3>";
    }
    echo "<ul class='widget-manager-rss-server-result elgg-list'>";
    foreach ($feed->get_items(0, $limit) as $index => $item) {
        echo "<li class='elgg-item'>";
        $title = "";
        $title_text = "";
        $content = "";
        $icon = "";
        if ($show_item_icon) {
            $enclosures = $item->get_enclosures();
            if (!empty($enclosures)) {
                foreach ($enclosures as $enclosure) {
                    if (strpos($enclosure->type, "image/") !== false) {
                        $icon .= elgg_view("output/url", array("text" => elgg_view("output/img", array("src" => $enclosure->link, "alt" => $item->get_title(), "class" => "widgets-rss-server-feed-item-image")), "href" => $item->get_permalink(), "target" => "_blank"));
开发者ID:myhotfb,项目名称:widget_manager,代码行数:31,代码来源:content.php

示例10: array

     $rss_obj->enable_cache(false);
 }
 // Remove surrounding DIV
 $rss_obj->remove_div(true);
 // Strip all HTML Tags
 $rss_obj->strip_htmltags(true);
 // Limit items
 if ($rssfeed["item"]) {
     $rss_obj->set_item_limit($rssfeed["item"]);
 }
 // Init Feed
 $rss_obj->init();
 if ($rss_obj->data) {
     // check RSS image
     if ($rss_obj->get_image_url()) {
         $rss['temp_feedinfo'] = '<a href="' . ($rss_obj->get_image_link() ? $rss_obj->get_image_link() : $rss_obj->get_permalink()) . '" target="_blank">';
         $rss['temp_feedinfo'] .= '<img src="' . $rss_obj->get_image_url() . '" alt="' . $rss_obj->get_image_title() . '" />';
         $rss['temp_feedinfo'] .= '</a>';
         $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'IMAGE', $rss['temp_feedinfo']);
     } else {
         $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'IMAGE', '');
     }
     $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'TITLE', $rss_obj->get_title());
     $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'DESCRIPTION', $rss_obj->get_description());
     $c = 0;
     $rss['items'] = array();
     foreach ($rss_obj->get_items() as $rssvalue) {
         // general item info
         $rss['items'][$c] = render_cnt_template($rss['template_ITEM'], 'LINK', $rssvalue->get_permalink());
         $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'TITLE', $rssvalue->get_title());
         $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'DESCRIPTION', $rssvalue->get_description());
开发者ID:EDVLanger,项目名称:phpwcms,代码行数:31,代码来源:cnt22.article.inc.php

示例11: probe_url


//.........这里部分代码省略.........
                    $network = NETWORK_DFRN;
                    $poco = str_replace("/profile/", "/poco/", $url);
                    $noscrapedata = json_decode($noscrapejson, true);
                    if (isset($noscrapedata["addr"])) {
                        $addr = $noscrapedata["addr"];
                    }
                    if (isset($noscrapedata["fn"])) {
                        $vcard["fn"] = $noscrapedata["fn"];
                    }
                    if (isset($noscrapedata["key"])) {
                        $pubkey = $noscrapedata["key"];
                    }
                    if (isset($noscrapedata["photo"])) {
                        $vcard["photo"] = $noscrapedata["photo"];
                    }
                    if (isset($noscrapedata["dfrn-request"])) {
                        $request = $noscrapedata["dfrn-request"];
                    }
                    if (isset($noscrapedata["dfrn-confirm"])) {
                        $confirm = $noscrapedata["dfrn-confirm"];
                    }
                    if (isset($noscrapedata["dfrn-notify"])) {
                        $notify = $noscrapedata["dfrn-notify"];
                    }
                    if (isset($noscrapedata["dfrn-poll"])) {
                        $poll = $noscrapedata["dfrn-poll"];
                    }
                }
            }
            if (!$vcard['photo'] && strlen($email)) {
                $vcard['photo'] = avatar_img($email);
            }
            if ($poll === $profile) {
                $lnk = $feed->get_permalink();
            }
            if (isset($lnk) && strlen($lnk)) {
                $profile = $lnk;
            }
            if (!$network) {
                $network = NETWORK_FEED;
                // If it is a feed, don't take the author name as feed name
                unset($vcard['fn']);
            }
            if (!x($vcard, 'fn')) {
                $vcard['fn'] = notags($feed->get_title());
            }
            if (!x($vcard, 'fn')) {
                $vcard['fn'] = notags($feed->get_description());
            }
            if (strpos($vcard['fn'], 'Twitter / ') !== false) {
                $vcard['fn'] = substr($vcard['fn'], strpos($vcard['fn'], '/') + 1);
                $vcard['fn'] = trim($vcard['fn']);
            }
            if (!x($vcard, 'nick')) {
                $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
                if (strpos($vcard['nick'], ' ')) {
                    $vcard['nick'] = trim(substr($vcard['nick'], 0, strpos($vcard['nick'], ' ')));
                }
            }
            if (!$priority) {
                $priority = 2;
            }
        }
    }
    if (!x($vcard, 'photo')) {
        $a = get_app();
开发者ID:vinzv,项目名称:friendica,代码行数:67,代码来源:Scrape.php

示例12: SimplePie

    elgg_log("Reading RSS server widget content from cache", "NOTICE");
    $feed_data = @json_decode($raw_feed_data, true);
}
// did we have cached data
if (empty($feed_data)) {
    $limit = (int) $widget->rss_count;
    if ($limit < 1) {
        $limit = 4;
    }
    // read the rss from the source
    $feed = new SimplePie();
    $feed->set_feed_url($feed_url);
    $feed->set_cache_location($cache_location);
    $feed->set_cache_duration($rss_cachetimeout);
    $feed->init();
    $feed_data = array("title_text" => $feed->get_title(), "title_href" => $feed->get_permalink(), "items" => array());
    foreach ($feed->get_items(0, $limit) as $index => $item) {
        $feed_item = array("title" => $item->get_title(), "href" => $item->get_permalink(), "icon" => "", "author" => "", "content" => $item->get_content(), "excerpt" => $item->get_description(), "timestamp" => $item->get_date("U"));
        $enclosures = $item->get_enclosures();
        if (!empty($enclosures)) {
            foreach ($enclosures as $enclosure) {
                if (strpos($enclosure->type, "image/") !== false) {
                    $feed_item["icon_url"] = $enclosure->link;
                    break;
                }
            }
        }
        $authors = $item->get_authors();
        if (!empty($authors)) {
            $author = $authors[0]->name;
            if (empty($author)) {
开发者ID:n8b,项目名称:VMN,代码行数:31,代码来源:content.php

示例13: SimplePie

        echo "</div>";
    }
    echo "</div>\n";
}
?>
		  
    </div>
  </div>
  <div class="c50r">
    <div class="subcr">
<?php 
$feed = new SimplePie();
$feed->set_feed_url('http://www.bewelcome.org/rss/blog/tags/Community%20News%20for%20the%20frontpage');
$feed->init();
$feed->handle_content_type();
$flink = $feed->get_permalink();
echo "<h3><a href=\"", $flink, "\">", $words->get('CommunityNews'), "</a></h3>";
foreach ($feed->get_items(0, 2) as $item) {
    $title = $item->get_title();
    $url = $item->get_permalink();
    $description = $item->get_description();
    $date = $item->get_date('j F Y');
    echo "<h4><a href=\"", $url, "\">", $title, "</a></h4>\n        <p>", $date, "</p>\n        <p>", $description, "</p>\n        \n    ";
}
echo "<a href=\"http://www.bewelcome.org/blog/tags/Community%20News%20for%20the%20frontpage\">", $words->get("getMoreEntriesandComments"), "</a>\n";
?>
	



	 
开发者ID:gpuenteallott,项目名称:rox,代码行数:26,代码来源:adminoverview.column_col3.php

示例14: SimplePieWP


//.........这里部分代码省略.........
        $tmpl = str_replace('{FEED_IMAGE_TITLE}', '', $tmpl);
    }
    // FEED_IMAGE_URL
    if ($image_url = $feed->get_image_url()) {
        $tmpl = str_replace('{FEED_IMAGE_URL}', SimplePie_WordPress::post_process('FEED_IMAGE_URL', $image_url), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_URL}', '', $tmpl);
    }
    // FEED_IMAGE_WIDTH
    if ($image_width = $feed->get_image_width()) {
        $tmpl = str_replace('{FEED_IMAGE_WIDTH}', SimplePie_WordPress::post_process('FEED_IMAGE_WIDTH', $image_width), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_WIDTH}', '', $tmpl);
    }
    // FEED_LANGUAGE
    if ($language = $feed->get_language()) {
        $tmpl = str_replace('{FEED_LANGUAGE}', SimplePie_WordPress::post_process('FEED_LANGUAGE', $language), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_LANGUAGE}', '', $tmpl);
    }
    // FEED_LATITUDE
    if ($latitude = $feed->get_latitude()) {
        $tmpl = str_replace('{FEED_LATITUDE}', SimplePie_WordPress::post_process('FEED_LATITUDE', $latitude), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_LATITUDE}', '', $tmpl);
    }
    // FEED_LONGITUDE
    if ($longitude = $feed->get_longitude()) {
        $tmpl = str_replace('{FEED_LONGITUDE}', SimplePie_WordPress::post_process('FEED_LONGITUDE', $longitude), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_LONGITUDE}', '', $tmpl);
    }
    // FEED_PERMALINK
    if ($permalink = $feed->get_permalink()) {
        $tmpl = str_replace('{FEED_PERMALINK}', SimplePie_WordPress::post_process('FEED_PERMALINK', $permalink), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_PERMALINK}', '', $tmpl);
    }
    // FEED_TITLE
    if ($title = $feed->get_title()) {
        $tmpl = str_replace('{FEED_TITLE}', SimplePie_WordPress::post_process('FEED_TITLE', $title), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_TITLE}', '', $tmpl);
    }
    // SUBSCRIBE_URL
    if ($subscribe_url = $feed->subscribe_url()) {
        $tmpl = str_replace('{SUBSCRIBE_URL}', SimplePie_WordPress::post_process('SUBSCRIBE_URL', $subscribe_url), $tmpl);
    } else {
        $tmpl = str_replace('{SUBSCRIBE_URL}', '', $tmpl);
    }
    // TRUNCATE_FEED_DESCRIPTION
    if ($description = $feed->get_description()) {
        $tmpl = str_replace('{TRUNCATE_FEED_DESCRIPTION}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_FEED_DESCRIPTION', $description), $truncate_feed_description), $tmpl);
    } else {
        $tmpl = str_replace('{TRUNCATE_FEED_DESCRIPTION}', '', $tmpl);
    }
    // TRUNCATE_FEED_TITLE
    if ($title = $feed->get_title()) {
        $tmpl = str_replace('{TRUNCATE_FEED_TITLE}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_FEED_TITLE', $title), $truncate_feed_title), $tmpl);
    } else {
        $tmpl = str_replace('{TRUNCATE_FEED_TITLE}', '', $tmpl);
    }
    /**************************************************************************************************************/
    // ITEMS
    // Separate out the pre-item template
    $tmpl = explode('{ITEM_LOOP_BEGIN}', $tmpl);
开发者ID:simplepie,项目名称:wordpress,代码行数:67,代码来源:simplepie_wordpress_2.php

示例15: process_salmon_feed

/**
 * @brief Process atom feed and return the first post and structure
 *
 * @param array $xml
 *   The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.
 * @param $importer
 *   The contact_record (joined to user_record) of the local user who owns this
 *   relationship. It is this person's stuff that is going to be updated.
 */
function process_salmon_feed($xml, $importer)
{
    $ret = array();
    require_once 'library/simplepie/simplepie.inc';
    if (!strlen($xml)) {
        logger('process_feed: empty input');
        return;
    }
    $feed = new SimplePie();
    $feed->set_raw_data($xml);
    $feed->init();
    if ($feed->error()) {
        logger('Error parsing XML: ' . $feed->error());
    }
    $permalink = $feed->get_permalink();
    if ($feed->get_item_quantity()) {
        // this should be exactly one
        logger('feed item count = ' . $feed->get_item_quantity(), LOGGER_DEBUG);
        $items = $feed->get_items();
        foreach ($items as $item) {
            $item_id = base64url_encode($item->get_id());
            logger('processing ' . $item_id, LOGGER_DEBUG);
            $rawthread = $item->get_item_tags(NAMESPACE_THREAD, 'in-reply-to');
            if (isset($rawthread[0]['attribs']['']['ref'])) {
                $is_reply = true;
                $parent_mid = base64url_encode($rawthread[0]['attribs']['']['ref']);
            }
            if ($is_reply) {
                $ret['parent_mid'] = $parent_mid;
            }
            $ret['author'] = array();
            $datarray = get_atom_elements($feed, $item, $ret['author']);
            // reset policies which are restricted by default for RSS connections
            // This item is likely coming from GNU-social via salmon and allows public interaction
            $datarray['public_policy'] = '';
            $datarray['comment_policy'] = '';
            $ret['item'] = $datarray;
        }
    }
    return $ret;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:50,代码来源:feedutils.php


注:本文中的SimplePie::get_permalink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。