當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。