当前位置: 首页>>代码示例>>PHP>>正文


PHP Header::get方法代码示例

本文整理汇总了PHP中Header::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Header::get方法的具体用法?PHP Header::get怎么用?PHP Header::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Header的用法示例。


在下文中一共展示了Header::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setData

 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $h = Header::get();
     $h->setTitleSeparator(Language::encodePair($data->get('separator')));
     $h->setTitleStart(Language::encodePair($data->get('start')));
     $h->setTitleEnd(Language::encodePair($data->get('end')));
     if ($data->get('add')) {
         $h->addTitleItem(Language::encodePair($data->get('add')));
     }
     parent::setData($data);
 }
开发者ID:point,项目名称:cassea,代码行数:18,代码来源:WPageTitle.php

示例2: getHeader

 public function getHeader($var)
 {
     return $this->header->get($var);
 }
开发者ID:buuum,项目名称:template,代码行数:4,代码来源:View.php

示例3: buildSort

 /**
  * @param string $path
  * @param array $pages
  * @param string $order_by
  * @param array $manual
  * @throws \RuntimeException
  * @internal
  */
 protected function buildSort($path, array $pages, $order_by = 'default', $manual = null)
 {
     $list = array();
     $header_default = null;
     $header_query = null;
     // do this headery query work only once
     if (strpos($order_by, 'header.') === 0) {
         $header_query = explode('|', str_replace('header.', '', $order_by));
         if (isset($header_query[1])) {
             $header_default = $header_query[1];
         }
     }
     foreach ($pages as $key => $info) {
         $child = isset($this->instances[$key]) ? $this->instances[$key] : null;
         if (!$child) {
             throw new \RuntimeException("Page does not exist: {$key}");
         }
         switch ($order_by) {
             case 'title':
                 $list[$key] = $child->title();
                 break;
             case 'date':
                 $list[$key] = $child->date();
                 break;
             case 'modified':
                 $list[$key] = $child->modified();
                 break;
             case 'slug':
                 $list[$key] = $child->slug();
                 break;
             case 'basename':
                 $list[$key] = basename($key);
                 break;
             case is_string($header_query[0]):
                 $child_header = new Header((array) $child->header());
                 $header_value = $child_header->get($header_query[0]);
                 if ($header_value) {
                     $list[$key] = $header_value;
                 } else {
                     $list[$key] = $header_default ?: $key;
                 }
                 break;
             case 'manual':
             case 'default':
             default:
                 $list[$key] = $key;
         }
     }
     // handle special case when order_by is random
     if ($order_by == 'random') {
         $list = $this->arrayShuffle($list);
     } else {
         // else just sort the list according to specified key
         asort($list);
     }
     // Move manually ordered items into the beginning of the list. Order of the unlisted items does not change.
     if (is_array($manual) && !empty($manual)) {
         $new_list = array();
         $i = count($manual);
         foreach ($list as $key => $dummy) {
             $info = $pages[$key];
             $order = array_search($info['slug'], $manual);
             if ($order === false) {
                 $order = $i++;
             }
             $new_list[$key] = (int) $order;
         }
         $list = $new_list;
         // Apply manual ordering to the list.
         asort($list);
     }
     foreach ($list as $key => $sort) {
         $info = $pages[$key];
         // TODO: order by manual needs a hash from the passed variables if we make this more general.
         $this->sort[$path][$order_by][$key] = $info;
     }
 }
开发者ID:alexslack,项目名称:faith-game,代码行数:85,代码来源:Pages.php

示例4: buildComplete

 /**
  * Method description
  *
  * More detailed method description
  * @param    void
  * @return   void
  */
 function buildComplete()
 {
     $this->setTitle($this->getTitle() . " - " . $this->getType());
     Header::get()->addLink(array('rel' => 'alternate', 'type' => Feed::getMimeType($this->getType()), 'title' => $this->getTitle(), 'href' => $this->getHREF()));
     parent::buildComplete();
 }
开发者ID:point,项目名称:cassea,代码行数:13,代码来源:WFeedLink.php

示例5: buildSort

 /**
  * @param string $path
  * @param array  $pages
  * @param string $order_by
  * @param array  $manual
  *
  * @throws \RuntimeException
  * @internal
  */
 protected function buildSort($path, array $pages, $order_by = 'default', $manual = null)
 {
     $list = [];
     $header_default = null;
     $header_query = null;
     $sort_flags = SORT_NATURAL | SORT_FLAG_CASE;
     // do this header query work only once
     if (strpos($order_by, 'header.') === 0) {
         $header_query = explode('|', str_replace('header.', '', $order_by));
         if (isset($header_query[1])) {
             $header_default = $header_query[1];
         }
     }
     foreach ($pages as $key => $info) {
         $child = isset($this->instances[$key]) ? $this->instances[$key] : null;
         if (!$child) {
             throw new \RuntimeException("Page does not exist: {$key}");
         }
         switch ($order_by) {
             case 'title':
                 $list[$key] = $child->title();
                 break;
             case 'date':
                 $list[$key] = $child->date();
                 $sort_flags = SORT_REGULAR;
                 break;
             case 'modified':
                 $list[$key] = $child->modified();
                 $sort_flags = SORT_REGULAR;
                 break;
             case 'slug':
                 $list[$key] = $child->slug();
                 break;
             case 'basename':
                 $list[$key] = basename($key);
                 break;
             case is_string($header_query[0]):
                 $child_header = new Header((array) $child->header());
                 $header_value = $child_header->get($header_query[0]);
                 if ($header_value) {
                     $list[$key] = $header_value;
                 } else {
                     $list[$key] = $header_default ?: $key;
                 }
                 $sort_flags = SORT_REGULAR;
                 break;
             case 'manual':
             case 'default':
             default:
                 $list[$key] = $key;
                 $sort_flags = SORT_REGULAR;
         }
     }
     // handle special case when order_by is random
     if ($order_by == 'random') {
         $list = $this->arrayShuffle($list);
     } else {
         // else just sort the list according to specified key
         if (extension_loaded('intl')) {
             $locale = setlocale(LC_COLLATE, 0);
             //`setlocale` with a 0 param returns the current locale set
             $col = \Collator::create($locale);
             if ($col) {
                 $col->asort($list, $sort_flags);
             } else {
                 asort($list, $sort_flags);
             }
         } else {
             asort($list, $sort_flags);
         }
     }
     // Move manually ordered items into the beginning of the list. Order of the unlisted items does not change.
     if (is_array($manual) && !empty($manual)) {
         $new_list = [];
         $i = count($manual);
         foreach ($list as $key => $dummy) {
             $info = $pages[$key];
             $order = array_search($info['slug'], $manual);
             if ($order === false) {
                 $order = $i++;
             }
             $new_list[$key] = (int) $order;
         }
         $list = $new_list;
         // Apply manual ordering to the list.
         asort($list);
     }
     foreach ($list as $key => $sort) {
         $info = $pages[$key];
         $this->sort[$path][$order_by][$key] = $info;
     }
//.........这里部分代码省略.........
开发者ID:indigo423,项目名称:blog.no42.org,代码行数:101,代码来源:Pages.php

示例6: parseParams

 /**
  * Method description
  *
  * More detailed method description
  * @param    array
  * @return void
  */
 function parseParams(SimpleXMLElement $elem)
 {
     $attr = array();
     if (isset($elem['http-equiv'])) {
         $attr['http-equiv'] = (string) $elem['http-equiv'];
     }
     if (isset($elem['name'])) {
         $attr['name'] = (string) $elem['name'];
     }
     if (isset($elem['content'])) {
         $attr['content'] = (string) $elem['content'];
     }
     if (isset($elem['scheme'])) {
         $attr['scheme'] = (string) $elem['scheme'];
     }
     if (!empty($attr['content'])) {
         // content is required
         Header::get()->addMeta($attr);
     }
     if (isset($elem['nofollow']) && (string) $elem['nofollow']) {
         Header::get()->nofollow();
     }
     if (isset($elem['noindex']) && (string) $elem['noindex']) {
         Header::get()->noindex();
     }
     $attr = array();
     if (isset($elem['charset'])) {
         $attr['charset'] = (string) $elem['charset'];
     }
     if (isset($elem['href'])) {
         $attr['href'] = (string) $elem['href'];
     }
     if (isset($elem['hreflang'])) {
         $attr['hreflang'] = (string) $elem['hreflang'];
     }
     if (isset($elem['type'])) {
         $attr['type'] = (string) $elem['type'];
     }
     if (isset($elem['rel'])) {
         $attr['rel'] = (string) $elem['rel'];
     }
     if (isset($elem['rev'])) {
         $attr['rev'] = (string) $elem['rev'];
     }
     if (isset($elem['title'])) {
         $attr['title'] = (string) $elem['title'];
     }
     if (isset($elem['cond'])) {
         $attr['cond'] = (string) $elem['cond'];
     }
     if (isset($elem['media'])) {
         $attr['media'] = (string) $elem['media'];
     }
     if (!empty($attr)) {
         Header::get()->addLink($attr);
     }
     parent::parseParams($elem);
 }
开发者ID:point,项目名称:cassea,代码行数:65,代码来源:WMeta.php

示例7: init

 /**
  * Lite version of Controller::init method. 
  * Navigator object isn't created and step isn't added, 
  * standard JS and CSS isn't added to the head part.
  *
  * @param null
  * @return nul
  */
 function init()
 {
     $this->trigger("BeforeInit", $this);
     Boot::setupAll();
     $this->header = Header::get();
     $this->dispatcher = new WidgetEventDispatcher();
     $this->display_mode_params = new DisplayModeParams();
     $this->adjacency_list = new WidgetsAdjacencyList();
     $full_path = $this->findPage();
     $dom = new DomDocument();
     if ($dom->load($full_path) === false) {
         throw new ControllerException("Can not load XML " . $full_path);
     }
     $this->restoreSignatures();
     $this->trigger("BeforeHandlePOST", $this);
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $this->restoreCheckers();
         $this->parsePageOnPOST($this->processPage($dom));
         $this->handlePOST();
         exit;
     }
     $this->parsePageOnGET($this->processPage($dom));
     $this->inited = true;
     $this->trigger("AfterInit", $this);
 }
开发者ID:point,项目名称:cassea,代码行数:33,代码来源:Controller.php

示例8: getUserAgent

 /**
  * Get User Agent
  *
  * @return string|null
  */
 public static function getUserAgent()
 {
     return Header::get('HTTP_USER_AGENT');
 }
开发者ID:aufa,项目名称:Enproject,代码行数:9,代码来源:Request.php


注:本文中的Header::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。