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


PHP midcom_core_context::get_all方法代碼示例

本文整理匯總了PHP中midcom_core_context::get_all方法的典型用法代碼示例。如果您正苦於以下問題:PHP midcom_core_context::get_all方法的具體用法?PHP midcom_core_context::get_all怎麽用?PHP midcom_core_context::get_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在midcom_core_context的用法示例。


在下文中一共展示了midcom_core_context::get_all方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_all_contexts

 /**
  * Returns the complete context data array
  *
  * @return array The data of all contexts
  */
 function get_all_contexts()
 {
     return midcom_core_context::get_all();
 }
開發者ID:nemein,項目名稱:openpsa,代碼行數:9,代碼來源:superglobal.php

示例2: _complete_sent_headers

 /**
  * This little helper ensures that the headers Accept-Ranges, Content-Length
  * and Last-Modified are present. The lastmod timestamp is taken out of the
  * component context information if it is populated correctly there; if not, the
  * system time is used instead.
  *
  * To force browsers to revalidate the page on every request (login changes would
  * go unnoticed otherwise), the Cache-Control header max-age=0 is added automatically.
  *
  * @param Array &$cache_data The current cache data that will be written to the database.
  */
 private function _complete_sent_headers(&$cache_data)
 {
     // Detected headers flags
     $ranges = false;
     $size = false;
     $lastmod = false;
     foreach ($this->_sent_headers as $header) {
         if (strncasecmp($header, 'Accept-Ranges', 13) == 0) {
             $ranges = true;
         } else {
             if (strncasecmp($header, 'Content-Length', 14) == 0) {
                 $size = true;
             } else {
                 if (strncasecmp($header, 'Last-Modified', 13) == 0) {
                     $lastmod = true;
                     // Populate last modified timestamp (force GMT):
                     $tmp = substr($header, 15);
                     if (strpos($tmp, 'GMT') === false) {
                         $tmp .= ' GMT';
                     }
                     $this->_last_modified = strtotime($tmp);
                     if ($this->_last_modified == -1) {
                         debug_add("Failed to extract the timecode from the last modified header '{$header}', defaulting to the current time.", MIDCOM_LOG_WARN);
                         $this->_last_modified = time();
                     }
                 }
             }
         }
     }
     if (!$ranges) {
         $header = "Accept-Ranges: none";
         _midcom_header($header);
         $this->_sent_headers[] = $header;
     }
     if (!$size) {
         /* TODO: Doublecheck the way this is handled, it seems it's one byte too short
            which causes issues with Squid for example (could be that we output extra
            whitespace somewhere or something), now we just don't send it if headers_strategy
            implies caching */
         switch ($this->_headers_strategy) {
             case 'public':
             case 'private':
                 break;
             default:
                 $header = "Content-Length: " . ob_get_length();
                 _midcom_header($header);
                 $this->_sent_headers[] = $header;
                 break;
         }
     }
     if (!$lastmod) {
         /* Determine Last-Modified using MidCOM's component context,
          * Fallback to time() if this fails.
          */
         $time = 0;
         foreach (midcom_core_context::get_all() as $id => $context) {
             $meta = midcom::get('metadata')->get_request_metadata($id);
             if ($meta['lastmodified'] > $time) {
                 $time = $meta['lastmodified'];
             }
         }
         if ($time == 0 || !is_numeric($time)) {
             $time = time();
         }
         $header = "Last-Modified: " . gmdate('D, d M Y H:i:s', $time) . ' GMT';
         _midcom_header($header);
         $this->_sent_headers[] = $header;
         $this->_last_modified = $time;
     }
     $this->cache_control_headers();
     if (is_array($this->_force_headers) && !empty($this->_force_headers)) {
         foreach ($this->_force_headers as $header => $value) {
             $header_string = "{$header}: {$value}";
             _midcom_header($header_string, true);
             $this->_replace_sent_header($header, $header_string);
         }
     }
 }
開發者ID:nemein,項目名稱:openpsa,代碼行數:89,代碼來源:content.php


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