當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FeedDate::rfc3339方法代碼示例

本文整理匯總了PHP中FeedDate::rfc3339方法的典型用法代碼示例。如果您正苦於以下問題:PHP FeedDate::rfc3339方法的具體用法?PHP FeedDate::rfc3339怎麽用?PHP FeedDate::rfc3339使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FeedDate的用法示例。


在下文中一共展示了FeedDate::rfc3339方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createFeed

 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
     if ($this->format == 'TOOLBAR') {
         $feed .= " xmlns:gtb=\"http://toolbar.google.com/custombuttons/\"";
     }
     if ($this->language != "") {
         $feed .= " xml:lang=\"" . $this->language . "\"";
     }
     $feed .= ">\n";
     $feed .= "    <title>" . htmlspecialchars($this->title) . "</title>\n";
     $feed .= "    <subtitle>" . htmlspecialchars($this->description) . "</subtitle>\n";
     $feed .= "    <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n";
     if ($this->syndicationURL != '') {
         $feed .= "    <link href=\"" . $this->syndicationURL . "\" rel=\"self\" type=\"" . $this->contentType . "\"/>\n";
     }
     $feed .= "    <id>" . htmlspecialchars($this->link) . "</id>\n";
     $now = new FeedDate();
     $feed .= "    <updated>" . htmlspecialchars($now->rfc3339()) . "</updated>\n";
     if ($this->editor != "") {
         $feed .= "    <author>\n";
         $feed .= "        <name>" . $this->editor . "</name>\n";
         if ($this->editorEmail != "") {
             $feed .= "        <email>" . $this->editorEmail . "</email>\n";
         }
         $feed .= "    </author>\n";
     }
     $feed .= "    <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
     $feed .= $this->_createAdditionalElements($this->additionalElements, "    ");
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "    <entry>\n";
         $feed .= "        <title>" . utf8_encode(htmlnumericentities(strip_tags($this->items[$i]->title))) . "</title>\n";
         $feed .= "        <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
         if ($this->items[$i]->date == "") {
             $this->items[$i]->date = time();
         }
         $itemDate = new FeedDate($this->items[$i]->date);
         $feed .= "        <updated>" . htmlspecialchars($itemDate->rfc3339()) . "</updated>\n";
         $feed .= "        <published>" . htmlspecialchars($itemDate->rfc3339()) . "</published>\n";
         $feed .= "        <id>" . htmlspecialchars($this->items[$i]->link) . "</id>\n";
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");
         if ($this->items[$i]->author != "") {
             $feed .= "        <author>\n";
             $feed .= "            <name>" . htmlnumericentities($this->items[$i]->author) . "</name>\n";
             $feed .= "        </author>\n";
         }
         if ($this->items[$i]->description != "") {
             $feed .= "        <summary>" . utf8_encode(htmlnumericentities($this->items[$i]->description)) . "</summary>\n";
         }
         if ($this->items[$i]->thumbdata) {
             $feed .= "        <gtb:icon mode=\"base64\" type=\"image/jpeg\">\n";
             $feed .= chunk_split(base64_encode($this->items[$i]->thumbdata)) . "\n";
             $feed .= "        </gtb:icon>\n";
         }
         $feed .= "    </entry>\n";
     }
     $feed .= "</feed>\n";
     return $feed;
 }
開發者ID:s-a-r-id,項目名稱:geograph-project,代碼行數:62,代碼來源:feedcreator.class.php


注:本文中的FeedDate::rfc3339方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。