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


PHP Item::setAuthor方法代码示例

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


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

示例1: fetch

 /**
  * @brief Fetch a feed from remote
  * @param url remote url of the feed
  * @returns an instance of OC_News_Feed
  */
 public static function fetch($url)
 {
     $spfeed = new \SimplePie_Core();
     $spfeed->set_feed_url($url);
     $spfeed->enable_cache(false);
     if (!$spfeed->init()) {
         return null;
     }
     //temporary try-catch to bypass SimplePie bugs
     try {
         $spfeed->handle_content_type();
         $title = $spfeed->get_title();
         $items = array();
         if ($spitems = $spfeed->get_items()) {
             foreach ($spitems as $spitem) {
                 $itemUrl = $spitem->get_permalink();
                 $itemTitle = $spitem->get_title();
                 $itemGUID = $spitem->get_id();
                 $itemBody = $spitem->get_content();
                 $item = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
                 $spAuthor = $spitem->get_author();
                 if ($spAuthor !== null) {
                     $item->setAuthor($spAuthor->get_name());
                 }
                 //date in Item is stored in UNIX timestamp format
                 $itemDate = $spitem->get_date('U');
                 $item->setDate($itemDate);
                 // associated media file, for podcasts
                 $itemEnclosure = $spitem->get_enclosure();
                 if ($itemEnclosure !== null) {
                     $enclosureType = $itemEnclosure->get_type();
                     $enclosureLink = $itemEnclosure->get_link();
                     if (stripos($enclosureType, "audio/") !== FALSE) {
                         $enclosure = new Item_Enclosure();
                         $enclosure->setMimeType($enclosureType);
                         $enclosure->setLink($enclosureLink);
                         $item->setEnclosure($enclosure);
                     }
                 }
                 $items[] = $item;
             }
         }
         $feed = new Feed($url, $title, $items);
         $favicon = $spfeed->get_image_url();
         if ($favicon !== null && self::checkFavicon($favicon)) {
             // use favicon from feed
             $feed->setFavicon($favicon);
         } else {
             // try really hard to find a favicon
             $webFavicon = self::discoverFavicon($url);
             if ($webFavicon !== null) {
                 $feed->setFavicon($webFavicon);
             }
         }
         return $feed;
     } catch (Exception $e) {
         return null;
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:64,代码来源:utils.php

示例2: fromRow

 /**
  * @brief 
  * @param row a row from the items table of the database
  * @returns an object of the class OC_News_Item
  */
 public function fromRow($row)
 {
     $url = $row['url'];
     $title = $row['title'];
     $guid = $row['guid'];
     $body = $row['body'];
     $id = $row['id'];
     $item = new Item($url, $title, $guid, $body, $id);
     $item->setStatus($row['status']);
     $item->setAuthor($row['author']);
     $item->setDate(Utils::dbtimestampToUnixtime($row['pub_date']));
     return $item;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:18,代码来源:itemmapper.php

示例3: fromRow

 /**
  * @brief
  * @param row a row from the items table of the database
  * @returns an object of the class OC_News_Item
  */
 public function fromRow($row)
 {
     $url = $row['url'];
     $title = $row['title'];
     $guid = $row['guid'];
     $body = $row['body'];
     $id = $row['id'];
     $item = new Item($url, $title, $guid, $body, $id);
     $item->setStatus($row['status']);
     $item->setAuthor($row['author']);
     $item->setFeedId($row['feed_id']);
     $item->setDate(Utils::dbtimestampToUnixtime($row['pub_date']));
     if ($row['enclosure_mime'] !== null && $row['enclosure_link'] !== null) {
         $enclosure = new Item_Enclosure();
         $enclosure->setMimeType($row['enclosure_mime']);
         $enclosure->setLink($row['enclosure_link']);
         $item->setEnclosure($enclosure);
     }
     return $item;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:25,代码来源:itemmapper.php

示例4: testSetAuthor

 public function testSetAuthor()
 {
     $item = new Item();
     $item->setAuthor('<a>my link</li>');
     $this->assertEquals('my link', $item->getAuthor());
     $this->assertContains('author', $item->getUpdatedFields());
 }
开发者ID:amin-hedayati,项目名称:news,代码行数:7,代码来源:ItemTest.php

示例5: while

									post_category, 
									category_id, 
									category_name 
								FROM post 
								LEFT JOIN category ON category_id = post_category_id 
								WHERE post_valid=1 
								LIMIT 10');
    while ($row = mysql_fetch_object($request)) {
        // Creating a new feed item
        $rssItem = new Item();
        $rssItem->setTitle($row->post_title);
        $rssItem->setDescription($row->post_description);
        $rssItem->setLink('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id);
        $rssItem->setGuid('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id, true);
        $rssItem->setComments('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id . '#comments');
        $rssItem->setAuthor($row->post_author_email, $row->post_author_name);
        $rssItem->setPubDate($row->post_date);
        $rssItem->setSource($row->post_source_uri, $row->post_source_name);
        $rssItem->setEnclosure('http://www.mywebsite.com/blog/images/nopicture.jpg', 2800, 'image/jpg');
        $rssItem->setCategory('http://www.mywebsite.com/blog/category.php.idCat=' . $row->category_id, $row->category_name);
        // Add the item to the feed
        $rssFeed->appendItem($rssItem);
    }
    // Save the feed
    $rssFeed->save();
    // SQL connection closing
    mysql_close();
    // Send headers to the browser
    header('Content-Type: text/xml; charset=utf-8');
    // Display the feed
    $rssFeed->display();
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:31,代码来源:example2.php

示例6: testSetAuthor

 /**
  * @covers Debril\RssAtomBundle\Protocol\Parser\Item::setAuthor
  */
 public function testSetAuthor()
 {
     $newAuthor = 'New Contributor';
     $this->object->setAuthor($newAuthor);
     $this->assertEquals($newAuthor, $this->object->getAuthor());
 }
开发者ID:DrBallMD,项目名称:rss-atom-bundle,代码行数:9,代码来源:ItemTest.php


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