本文整理匯總了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;
}
示例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));
}