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


PHP TimeHelper::toAtom方法代碼示例

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


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

示例1: item

 /**
  * Creates an item for the sitemap or sitemap index
  *
  * @param array $options various options pertaining to the item
  * @return string The item
  * @author Jose Diaz-Gonzalez
  **/
 public function item($options = array())
 {
     $options = array_merge(array('loc' => NULL, 'lastmod' => NULL, 'changefreq' => NULL, 'priority' => NULL, 'encode' => true), $options);
     if (!empty($options['loc'])) {
         if (!empty($options['lastmod'])) {
             $time = new TimeHelper();
             $options['lastmod'] = $time->toAtom($options['lastmod']);
         }
         if ($options['encode']) {
             $options['loc'] = $this->_xmlspecialchars($options['loc']);
         }
         if ($this->sitemap) {
             //Construct a sitemapindex item
             $item = array();
             $item['openEntity'] = "<sitemap>";
             $item['loc'] = $this->_entityMaker("loc", $options['loc']);
             $item['lastmod'] = $this->_entityMaker("lastmod", $options['lastmod']);
             $item['closeEntity'] = "</sitemap>\n";
             return $this->_mergeArrayEntities($item);
         } else {
             //Construct a sitemap item
             $item = array();
             $item['openEntity'] = "<url>";
             $item['loc'] = $this->_entityMaker("loc", $options['loc']);
             $item['lastmod'] = $this->_entityMaker("lastmod", $options['lastmod']);
             $item['changefreq'] = $this->_entityMaker("changefreq", $options['changefreq']);
             $item['priority'] = $this->_entityMaker("priority", $options['priority']);
             $item['closeEntity'] = "</url>\n";
             return $this->_mergeArrayEntities($item);
         }
     }
     return false;
 }
開發者ID:josegonzalez,項目名稱:cakephp-sitemap,代碼行數:40,代碼來源:sitemap.php

示例2: toAtom

 /**
  * Returns a date formatted for Atom RSS feeds.
  *
  * @param string $dateString Datetime string or Unix timestamp
  * @param int $userOffset User's offset from GMT (in hours)
  * @return string Formatted date string
  * @access public
  * @link http://book.cakephp.org/view/1471/Formatting
  */
 function toAtom($dateString, $userOffset = null)
 {
     return parent::toAtom($dateString, $this->__userOffset($dateString, $userOffset));
 }
開發者ID:nani8124,項目名稱:infinitas,代碼行數:13,代碼來源:InfiniTimeHelper.php


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