本文整理汇总了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));
}