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


PHP HabariDateTime::get方法代碼示例

本文整理匯總了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;
 }
開發者ID:wwxgitcat,項目名稱:habari,代碼行數:48,代碼來源:atomhandler.php


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