本文整理汇总了PHP中HabariDateTime::get方法的典型用法代码示例。如果您正苦于以下问题:PHP HabariDateTime::get方法的具体用法?PHP HabariDateTime::get怎么用?PHP HabariDateTime::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HabariDateTime
的用法示例。
在下文中一共展示了HabariDateTime::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_atom_wrapper
/**
* Creates a basic Atom-format XML structure
*
* @param string $alternate the IRI of an alternate version.
* @param string $self The preferred URI for retrieving Atom Feed Documents representing this Atom feed.
* @param string $id a permanent, universally unique identifier for an the feed.
* @param HabariDateTime $updated The most recent update in the collection to which this feed applies.
*
* @return SimpleXMLElement The requested Atom document
*/
public function create_atom_wrapper($alternate, $self, $id, $updated = null)
{
// Store handler vars since we'll be using them a lot.
$handler_vars = Controller::get_handler_vars();
// Retrieve the current matched rule and store its name and argument values.
$rr = URL::get_matched_rule();
$rr_name = $rr->name;
$rr_args = $rr->named_arg_values;
// Build the namespaces, plugins can alter it to override or insert their own.
$namespaces = array('default' => 'http://www.w3.org/2005/Atom');
$namespaces = Plugins::filter('atom_get_collection_namespaces', $namespaces);
$namespaces = array_map(function ($value, $key) {
return ($key == "default" ? "xmlns" : "xmlns:" . $key) . "=\"" . $value . "\"";
}, $namespaces, array_keys($namespaces));
$namespaces = implode(' ', $namespaces);
$xml = new SimpleXMLElement('<feed ' . $namespaces . '></feed>');
$feed_generator = $xml->addChild('generator', 'Habari');
$feed_generator->addAttribute('uri', 'http://www.habariproject.org/');
$feed_generator->addAttribute('version', Version::get_habariversion());
$feed_id = $xml->addChild('id', 'tag:' . Site::get_url('hostname') . ',' . date("Y-m-d") . ':' . $id . '/' . Options::get('GUID'));
$feed_title = $xml->addChild('title', Utils::htmlspecialchars(Options::get('title')));
if ($tagline = Options::get('tagline')) {
$feed_subtitle = $xml->addChild('subtitle', Utils::htmlspecialchars($tagline));
}
if ($updated == null) {
$feed_updated = $xml->addChild('updated', HabariDateTime::date_create()->get('c'));
} else {
$feed_updated = $xml->addChild('updated', $updated->get('c'));
}
$feed_link = $xml->addChild('link');
$feed_link->addAttribute('rel', 'alternate');
$feed_link->addAttribute('href', $alternate);
$feed_link = $xml->addChild('link');
$feed_link->addAttribute('rel', 'self');
$feed_link->addAttribute('href', $self);
Plugins::act('atom_create_wrapper', $xml);
return $xml;
}