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


PHP request::protocol方法代码示例

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


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

示例1: base

 /**
  * Base URL, with or without the index page.
  *
  * If protocol (and core.site_protocol) and core.site_domain are both empty,
  * then
  *
  * @param   boolean  include the index page
  * @param   boolean  non-default protocol
  * @return  string
  */
 public static function base($index = NO, $protocol = NO)
 {
     if ($protocol == NO) {
         // Use the default configured protocol
         $protocol = Eight::config('core.site_protocol');
     }
     // Load the site domain
     $site_domain = (string) Eight::config('core.site_domain', YES);
     if ($protocol == NO) {
         if ($site_domain === '' or $site_domain[0] === '/') {
             // Use the configured site domain
             $base_url = $site_domain;
         } else {
             // Guess the protocol to provide full http://domain/path URL
             $base_url = request::protocol() . '://' . $site_domain;
         }
     } else {
         if ($site_domain === '' or $site_domain[0] === '/') {
             // Guess the server name if the domain starts with slash
             $base_url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $site_domain;
         } else {
             // Use the configured site domain
             $base_url = $protocol . '://' . $site_domain;
         }
     }
     if ($index === YES and $index = Eight::config('core.index_page')) {
         // Append the index page
         $base_url = $base_url . $index;
     }
     // Force a slash on the end of the URL
     return rtrim($base_url, '/') . '/';
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:42,代码来源:url.php

示例2: referrer

 /**
  * Returns the HTTP referrer, or the default if the referrer is not set.
  *
  * @param   mixed   default to return
  * @return  string
  */
 public static function referrer($default = NO)
 {
     if (!empty($_SERVER['HTTP_REFERER'])) {
         // Set referrer
         $ref = $_SERVER['HTTP_REFERER'];
         // Set the request protocol
         $protocol = request::protocol();
         if (strpos($ref, url::base(NO, $protocol)) === 0) {
             // Remove the base URL from the referrer
             $ref = substr($ref, strlen(url::base(YES, $protocol)));
         }
     }
     return isset($ref) ? $ref : $default;
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:20,代码来源:request.php

示例3: abs_site

 /**
  * Just like url::site() except that it returns an absolute URI and
  * doesn't take a protocol parameter.
  */
 static function abs_site($path)
 {
     return url::site($path, request::protocol());
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:8,代码来源:MY_url.php

示例4: t

  <div id="g-add-photos-canvas">
    <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?php 
echo t("Select photos (%size max per file)...", array("size" => $size_limit));
?>
</button>
    <span id="g-uploadify"></span>
  </div>
  <div id="g-add-photos-status">
    <ul id="g-action-status" class="g-message-block">
    </ul>
  </div>
</div>

<div class="no-flash" style="display: none">
  <p>
    <?php 
echo t("Your browser must have Adobe Flash Player version %flash_minimum_version or greater installed to use this feature.", array("flash_minimum_version" => $flash_minimum_version));
?>
  </p>
  <a href="http://www.adobe.com/go/getflashplayer">
    <img src="<?php 
echo request::protocol();
?>
://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
         alt=<?php 
echo t("Get Adobe Flash Player")->for_js();
?>
 />
  </a>
</div>
开发者ID:JasonWiki,项目名称:docs,代码行数:30,代码来源:form_uploadify.html.php

示例5: sendHeaders

 /**
  * See system/helpers/download.php
  */
 private function sendHeaders($filename, $filesize = null)
 {
     if (!is_null($filesize)) {
         header('Content-Length: ' . $filesize);
     }
     // Retrieve MIME type by extension
     $mime = Kohana::config('mimes.' . strtolower(substr(strrchr($filename, '.'), 1)));
     $mime = empty($mime) ? 'application/octet-stream' : $mime[0];
     header("Content-Type: {$mime}");
     header('Content-Transfer-Encoding: binary');
     // Send headers necessary to invoke a "Save As" dialog
     header('Content-Disposition: attachment; filename="' . $filename . '"');
     // Prevent caching
     header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
     $pragma = 'no-cache';
     $cachecontrol = 'no-cache, max-age=0';
     // request::user_agent('browser') seems bugged
     if (request::user_agent('browser') === 'Internet Explorer' || stripos(request::user_agent(), 'msie') !== false || stripos(request::user_agent(), 'internet explorer') !== false) {
         if (request::protocol() === 'https') {
             // See http://support.microsoft.com/kb/323308/en-us
             $pragma = 'cache';
             $cachecontrol = 'private';
         } else {
             if (request::user_agent('version') <= '6.0') {
                 $pragma = '';
                 $cachecontrol = 'must-revalidate, post-check=0, pre-check=0';
             }
         }
     }
     header('Pragma: ' . $pragma);
     header('Cache-Control: ' . $cachecontrol);
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:35,代码来源:downloadalbum.php

示例6: redirect

 /**
  * Sends a page redirect header and runs the system.redirect Event.
  *
  * @param  mixed   string site URI or URL to redirect to, or array of strings if method is 300
  * @param  string  HTTP method of redirect
  * @return void
  */
 public static function redirect($uri = '', $method = '302')
 {
     if (Event::has_run('system.send_headers')) {
         return FALSE;
     }
     $codes = array('refresh' => 'Refresh', '300' => 'Multiple Choices', '301' => 'Moved Permanently', '302' => 'Found', '303' => 'See Other', '304' => 'Not Modified', '305' => 'Use Proxy', '307' => 'Temporary Redirect');
     // Validate the method and default to 302
     $method = isset($codes[$method]) ? (string) $method : '302';
     if ($method === '300') {
         $uri = (array) $uri;
         $output = '<ul>';
         foreach ($uri as $link) {
             $output .= '<li>' . html::anchor($link) . '</li>';
         }
         $output .= '</ul>';
         // The first URI will be used for the Location header
         $uri = $uri[0];
     } else {
         $output = '<p>' . html::anchor($uri) . '</p>';
     }
     // Run the redirect event
     Event::run('system.redirect', $uri);
     if (strpos($uri, '://') === FALSE) {
         // HTTP headers expect absolute URLs
         $uri = url::site($uri, request::protocol());
     }
     if ($method === 'refresh') {
         header('Refresh: 0; url=' . $uri);
     } else {
         header('HTTP/1.1 ' . $method . ' ' . $codes[$method]);
         header('Location: ' . $uri);
     }
     // We are about to exit, so run the send_headers event
     Event::run('system.send_headers');
     exit('<h1>' . $method . ' - ' . $codes[$method] . '</h1>' . $output);
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:43,代码来源:url.php

示例7: setprefs

 public function setprefs()
 {
     // Change the calendar year and / or user.
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     // Get user specified settings.
     $str_user_id = Input::instance()->post("cal_user");
     $str_year_id = Input::instance()->post("cal_year");
     // redirect to the currect page.
     url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id, request::protocol()));
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:11,代码来源:calendarview.php

示例8: page_bottom

 static function page_bottom($theme)
 {
     $proto = request::protocol();
     return "<script src=\"{$proto}://e.cooliris.com/slideshow/v/37732/go.js\" " . "type=\"text/javascript\"></script>";
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:5,代码来源:slideshow_theme.php

示例9: defined

<?php

defined("SYSPATH") or die("No direct script access.");
if (module::get_var("adsense", "location") == "sidebar") {
    $code = module::get_var("adsense", "code");
    if (!$code) {
        return;
    }
    $proto = request::protocol();
    $google_code = '
	<script type="text/javascript">' . $code . '</script>
	<script type="text/javascript"
		src="' . $proto . '://pagead2.googlesyndication.com/pagead/show_ads.js">
	</script>';
    echo $google_code;
}
?>

开发者ID:khitrenovich,项目名称:gallery3-contrib,代码行数:17,代码来源:adsense_block.html.php

示例10: _set_action

 /**
  * Automatically sets the form action if no action is required
  *
  * @return string $result The resulting formatted form action url
  * @author Sam Clark
  */
 protected function _set_action()
 {
     $result = url::current();
     if (!empty($this->attributes['action'])) {
         if (preg_match('/(http:\\/\\/|https:\\/\\/)/', $this->attributes['action'])) {
             $result = $this->attributes['action'];
         } else {
             $result = url::site($this->attributes['action'], request::protocol());
         }
     }
     return $result;
 }
开发者ID:samsoir,项目名称:morf,代码行数:18,代码来源:Morf.php

示例11: defined

<?php

defined("SYSPATH") or die("No direct script access.");
?>
<?
  // Base URL for flag pictures.
  $flag_type = module::get_var("language_flags", "flag_shape");
  $base_url = url::base(false, request::protocol()) . "modules/language_flags/images/" . $flag_type . "/";

  // Loop through each installed locale and display a flag.
  while ($one_locale = current($installed_locales)) {
    // Skip "default" so we don't end up with the same flag twice.
    if (key($installed_locales) != "") {

      // Use seperate div id's and img classes for the current language, the default language, and everything else.
      $div_id = "g-language-flag";
      $img_class = "g-flag";
      if (key($installed_locales) == $selected) {
        $div_id = "g-selected-language-flag";
        $img_class = "g-selected-flag";
      } elseif (key($installed_locales) == module::get_var("gallery", "default_locale")) {
        $div_id = "g-default-language-flag";
        $img_class = "g-default-flag";
      }

      // Figure out where the flag is / use the default if it doesn't exist.
      $flag_path = MODPATH . "language_flags/images/" . $flag_type . "/" . key($installed_locales) . ".png";
      $flag_url = $base_url . key($installed_locales) . ".png";
      if (!file_exists($flag_path)) {
        $flag_url = $base_url . "default.png";
      }
开发者ID:khitrenovich,项目名称:gallery3-contrib,代码行数:31,代码来源:user_languages_block.html.php

示例12: text

 /**
  * Get a single line of text representing the exception:
  *
  * Error [ Code ]: Message ~ File [ Line ]
  *
  * @param   object  Exception
  * @return  string
  */
 public static function text($e, $full_args = FALSE)
 {
     // Should we use the full argument length or truncate?
     $arg_char_limit = $full_args ? 2500 : 50;
     // Clean up the message a bit
     $message = str_replace(array("<br>", "<br/>", "<br />", "\r\n", "\n", "\r"), '; ', strip_tags($e->getMessage()));
     // How was the request made
     $called = 'Request:' . "\n";
     $method = strtoupper(request::method());
     if ($method == 'CLI') {
         $called .= 'CLI - ' . cli::launch_cmd();
     } else {
         $called .= '[' . $method . '] ' . request::ip() . ' - ' . request::protocol() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         if (is_array($_POST) && count($_POST) > 0) {
             $called .= "\n\nBody:\n";
             $called .= var_export($_POST, TRUE);
         }
     }
     return sprintf('%s [ %s ]: %s ~ %s [ %d ]' . "\n\n" . '%s' . "\n\n" . '%s' . "\n", get_class($e), $e->getCode(), $message, Eight_Exception::debug_path($e->getFile()), $e->getLine(), $called, Eight_Exception::trace_string($e->getTrace(), $arg_char_limit));
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:28,代码来源:exception.php


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