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


PHP is_https函数代码示例

本文整理汇总了PHP中is_https函数的典型用法代码示例。如果您正苦于以下问题:PHP is_https函数的具体用法?PHP is_https怎么用?PHP is_https使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: filter

 /**
  * @param HTMLPurifier_URI $uri
  * @param HTMLPurifier_Config $config
  * @param HTMLPurifier_Context $context
  * @return bool
  */
 public function filter(&$uri, $config, $context)
 {
     // check if filter not applicable
     if (!$config->get('HTML.SafeIframe')) {
         return true;
     }
     // check if the filter should actually trigger
     if (!$context->get('EmbeddedURI', true)) {
         return true;
     }
     $token = $context->get('CurrentToken', true);
     if (!($token && $token->name == 'iframe')) {
         return true;
     }
     // check if we actually have some whitelists enabled
     if ($this->regexp === null) {
         return false;
     }
     // actually check the whitelists
     if (!preg_match($this->regexp, $uri->toString())) {
         return false;
     }
     // Make sure that if we're an HTTPS site, the iframe is also HTTPS
     if (is_https() && $uri->scheme == 'http') {
         // Convert it to a protocol-relative URL
         $uri->scheme = null;
     }
     return $uri;
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:35,代码来源:SafeIframe.php

示例2: view_hook

/**
 * replace any http images with https urls
 * 
 * @param type $h
 * @param type $t
 * @param type $r
 * @param type $p
 * @return type
 */
function view_hook($h, $t, $r, $p)
{
    $http_url = str_replace('https://', 'http://', elgg_get_site_url());
    if (preg_match_all('/<img[^>]+src\\s*=\\s*["\']?([^"\' ]+)[^>]*>/', $r, $extracted_image)) {
        foreach ($extracted_image[0] as $key => $i) {
            if (strpos($extracted_image[1][$key], elgg_get_site_url()) !== false) {
                continue;
                // already one of our links
            }
            // check if this is our url being requested over http, and rewrite to https
            if (strpos($extracted_image[1][$key], $http_url) === 0) {
                $https_image = str_replace('http://', 'https://', $extracted_image[1][$key]);
                $replacement_image = str_replace($extracted_image[1][$key], $https_image, $i);
                $r = str_replace($i, $replacement_image, $r);
                continue;
            }
            if (!is_https($extracted_image[1][$key])) {
                // replace this url
                $url = urlencode($extracted_image[1][$key]);
                if (strpos($url, 'http') === 0) {
                    $token = get_token($extracted_image[1][$key]);
                    $new_url = elgg_normalize_url('mod/image_proxy/image.php?url=' . $url . '&token=' . $token);
                    $replacement_image = str_replace($extracted_image[1][$key], $new_url, $i);
                    $r = str_replace($i, $replacement_image, $r);
                }
            }
        }
    }
    return $r;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:39,代码来源:start.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     /**
      * Set no-cache headers so pages are never cached by the browser.
      * This is necessary because if the browser caches a page, the 
      * login or logout link and user specific data may not change when 
      * the logged in status changes.
      */
     header('Expires: Wed, 13 Dec 1972 18:37:00 GMT');
     header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
     header('Pragma: no-cache');
     /**
      * Set the request protocol
      */
     if (is_https()) {
         $this->protocol = 'https';
     }
     /**
      * If the http user cookie is set, make user data available in views
      */
     if (get_cookie(config_item('http_user_cookie_name'))) {
         $http_user_data = unserialize_data(get_cookie(config_item('http_user_cookie_name')));
         $this->load->vars($http_user_data);
     }
     //$this->output->enable_profiler();
 }
开发者ID:alphabraga,项目名称:digitaloffice,代码行数:27,代码来源:Auth_Controller.php

示例4: force_http

 function force_http($port = null)
 {
     if (is_https()) {
         $ci = get_instance();
         if (isset($ci->session) && is_object($ci->session)) {
             $ci->session->keep_flashdata();
         }
         redirect(to_http(CURRENT_URL, $port));
     }
 }
开发者ID:patilstar,项目名称:HMVC-WITH-CI,代码行数:10,代码来源:MY_url_helper.php

示例5: MoodleQuickForm_recaptcha

 /**
  * constructor
  *
  * @param string $elementName (optional) name of the recaptcha element
  * @param string $elementLabel (optional) label for recaptcha element
  * @param mixed $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  */
 function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null)
 {
     global $CFG;
     parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
     $this->_type = 'recaptcha';
     if (is_https()) {
         $this->_https = true;
     } else {
         $this->_https = false;
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:19,代码来源:recaptcha.php

示例6: __construct

 /**
  * constructor
  *
  * @param string $elementName (optional) name of the recaptcha element
  * @param string $elementLabel (optional) label for recaptcha element
  * @param mixed $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null)
 {
     global $CFG;
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_type = 'recaptcha';
     if (is_https()) {
         $this->_https = true;
     } else {
         $this->_https = false;
     }
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:19,代码来源:recaptcha.php

示例7: show_submit

function show_submit()
{
    row1(tra("Submit profile"));
    echo "<script>var RecaptchaOptions = { theme : 'white' };</script>";
    $config = get_config();
    $publickey = parse_config($config, "<recaptcha_public_key>");
    if ($publickey) {
        table_row(tra("Please enter the words shown in the image.") . "<br>\n" . recaptcha_get_html($publickey, null, is_https()));
    }
    table_row("<p><input type=\"submit\" value=\"" . tra("Create/edit profile") . "\" name=\"submit\">");
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:11,代码来源:create_profile.php

示例8: embedly_embed_thumbnails

function embedly_embed_thumbnails(&$feed)
{
    $matched_urls = array();
    $embedly_re = '/(www\\.flickr\\.com\\/photos\\/.*|flic\\.kr\\/.*|www\\.mobypicture\\.com\\/user\\/.*\\/view\\/.*|moby\\.to\\/.*|.*imgur\\.com\\/.*|.*\\.posterous\\.com\\/.*|post\\.ly\\/.*|i.*\\.photobucket\\.com\\/albums\\/.*|s.*\\.photobucket\\.com\\/albums\\/.*|phodroid\\.com\\/.*\\/.*\\/.*|xkcd\\.com\\/.*|www\\.xkcd\\.com\\/.*|imgs\\.xkcd\\.com\\/.*|www\\.asofterworld\\.com\\/index\\.php\\?id=.*|www\\.asofterworld\\.com\\/.*\\.jpg|asofterworld\\.com\\/.*\\.jpg|www\\.qwantz\\.com\\/index\\.php\\?comic=.*|23hq\\.com\\/.*\\/photo\\/.*|www\\.23hq\\.com\\/.*\\/photo\\/.*|.*dribbble\\.com\\/shots\\/.*|drbl\\.in\\/.*|.*\\.smugmug\\.com\\/.*|.*\\.smugmug\\.com\\/.*#.*|emberapp\\.com\\/.*\\/images\\/.*|emberapp\\.com\\/.*\\/images\\/.*\\/sizes\\/.*|emberapp\\.com\\/.*\\/collections\\/.*\\/.*|emberapp\\.com\\/.*\\/categories\\/.*\\/.*\\/.*|embr\\.it\\/.*|picasaweb\\.google\\.com.*\\/.*\\/.*#.*|picasaweb\\.google\\.com.*\\/lh\\/photo\\/.*|picasaweb\\.google\\.com.*\\/.*\\/.*|dailybooth\\.com\\/.*\\/.*|brizzly\\.com\\/pic\\/.*|pics\\.brizzly\\.com\\/.*\\.jpg|www\\.tinypic\\.com\\/view\\.php.*|tinypic\\.com\\/view\\.php.*|www\\.tinypic\\.com\\/player\\.php.*|tinypic\\.com\\/player\\.php.*|www\\.tinypic\\.com\\/r\\/.*\\/.*|tinypic\\.com\\/r\\/.*\\/.*|.*\\.tinypic\\.com\\/.*\\.jpg|.*\\.tinypic\\.com\\/.*\\.png|meadd\\.com\\/.*\\/.*|meadd\\.com\\/.*|.*\\.deviantart\\.com\\/art\\/.*|.*\\.deviantart\\.com\\/gallery\\/.*|.*\\.deviantart\\.com\\/#\\/.*|fav\\.me\\/.*|.*\\.deviantart\\.com|.*\\.deviantart\\.com\\/gallery|.*\\.deviantart\\.com\\/.*\\/.*\\.jpg|.*\\.deviantart\\.com\\/.*\\/.*\\.gif|.*\\.deviantart\\.net\\/.*\\/.*\\.jpg|.*\\.deviantart\\.net\\/.*\\/.*\\.gif|plixi\\.com\\/p\\/.*|plixi\\.com\\/profile\\/home\\/.*|plixi\\.com\\/.*|www\\.fotopedia\\.com\\/.*\\/.*|fotopedia\\.com\\/.*\\/.*|photozou\\.jp\\/photo\\/show\\/.*\\/.*|photozou\\.jp\\/photo\\/photo_only\\/.*\\/.*|skitch\\.com\\/.*\\/.*\\/.*|img\\.skitch\\.com\\/.*|https:\\/\\/skitch\\.com\\/.*\\/.*\\/.*|https:\\/\\/img\\.skitch\\.com\\/.*|share\\.ovi\\.com\\/media\\/.*\\/.*|www\\.questionablecontent\\.net\\/|questionablecontent\\.net\\/|www\\.questionablecontent\\.net\\/view\\.php.*|questionablecontent\\.net\\/view\\.php.*|questionablecontent\\.net\\/comics\\/.*\\.png|www\\.questionablecontent\\.net\\/comics\\/.*\\.png|twitrpix\\.com\\/.*|.*\\.twitrpix\\.com\\/.*|www\\.someecards\\.com\\/.*\\/.*|someecards\\.com\\/.*\\/.*|some\\.ly\\/.*|www\\.some\\.ly\\/.*|pikchur\\.com\\/.*|achewood\\.com\\/.*|www\\.achewood\\.com\\/.*|achewood\\.com\\/index\\.php.*|www\\.achewood\\.com\\/index\\.php.*)/i';
    $services = array('#twitpic\\.com\\/([\\d\\w]+)#i' => 'http://twitpic.com/show/thumb/%s', '#twitgoo\\.com\\/([\\d\\w]+)#i' => 'http://twitgoo.com/show/thumb/%s', '#tweetphoto\\.com\\/(\\d+)#' => 'http://api.plixi.com/api/tpapi.svc/imagefromurl?url=http://tweetphoto.com/%s', '#img\\.ly\\/([\\w\\d]+)#i' => 'http://img.ly/show/thumb/%s', '#picplz\\.com\\/([\\d\\w\\.]+)#' => 'http://picplz.com/%s/thumb', '#yfrog\\.com\\/([\\d\\w]+)#' => 'http://yfrog.com/%s:small', '#instagr\\.am\\/p\\/([_-\\d\\w]+)#i' => 'http://instagr.am/p/%s/media/?size=t', '#instagram\\.com\\/p\\/([_-\\d\\w]+)#i' => 'http://instagr.am/p/%s/media/?size=t');
    foreach ($feed as &$status) {
        if ($status->entities) {
            if ($status->entities->urls) {
                foreach ($status->entities->urls as $urls) {
                    if (preg_match($embedly_re, $urls->expanded_url) > 0) {
                        // If it matches an Embedly supported URL
                        $matched_urls[urlencode($urls->expanded_url)][] = $status->id;
                    } elseif (preg_match("/.*\\.(jpg|png|gif)/i", $urls->expanded_url)) {
                        $feed[$status->id]->text .= '<br /><a href="' . $urls->expanded_url . '"><img src="' . img_proxy_url($urls->expanded_url, TRUE) . '" style="max-width:150px;" /></a>';
                    } else {
                        foreach ($services as $pattern => $thumbnail_url) {
                            if (preg_match_all($pattern, $urls->expanded_url, $matches, PREG_PATTERN_ORDER) > 0) {
                                foreach ($matches[1] as $key => $match) {
                                    $feed[$status->id]->text .= '<br /><a href="' . $urls->expanded_url . '"><img src="' . img_proxy_url(sprintf($thumbnail_url, $match)) . '" style="max-width:150px;" /></a>';
                                }
                            }
                        }
                    }
                }
            }
            if ($status->entities->media) {
                $image = is_https() ? $status->entities->media[0]->media_url_https : $status->entities->media[0]->media_url;
                $feed[$status->id]->text .= '<br /><a href="' . $image . '"><img src="' . img_proxy_url($image, TRUE) . '" style="max-width:150px;" /></a>';
            }
        }
    }
    // Make a single API call to Embedly.
    $justUrls = array_keys($matched_urls);
    $count = count($justUrls);
    if ($count == 0) {
        return;
    }
    if ($count > 20) {
        // Embedly has a limit of 20 URLs processed at a time. Not ideal for @dabr, but fair enough to ignore images after that.
        $justUrls = array_chunk($justUrls, 20);
        $justUrls = $justUrls[0];
    }
    $url = 'http://api.embed.ly/1/oembed?key=' . EMBEDLY_KEY . '&urls=' . implode(',', $justUrls) . '&format=json';
    $embedly_json = twitter_fetch($url);
    $oembeds = json_decode($embedly_json);
    // Put the thumbnails into the $feed
    foreach ($justUrls as $index => $url) {
        if ($thumb = $oembeds[$index]->thumbnail_url) {
            foreach ($matched_urls[$url] as $statusId) {
                $feed[$statusId]->text .= '<br /><a href="' . urldecode($url) . '"><img src="' . img_proxy_url($thumb) . '" style="max-width:150px;" /></a>';
            }
        }
    }
}
开发者ID:xctcc,项目名称:npt,代码行数:54,代码来源:class.embedly.php

示例9: current_url

/**
 * Current URL
 *
 * Returns the full URL (including segments) of the page where this
 * function is placed
 *
 * Modified so that current_url() allows for HTTPS. Also modified
 * so that a specific host (domain) can replace the current one.
 * This is important if you want to be able to have somebody
 * switch the current page to another language using i18n domains.
 *
 * @param  string  the requested language.
 */
function current_url()
{
    $CI =& get_instance();
    $url = $CI->config->site_url($CI->uri->uri_string());
    if (is_https()) {
        if (parse_url($url, PHP_URL_SCHEME) == 'http') {
            $url = substr($url, 0, 4) . 's' . substr($url, 4);
        }
    }
    // Return the current URL, making sure to attach any query string that may exist
    return $_SERVER['QUERY_STRING'] ? $url . '?' . $_SERVER['QUERY_STRING'] : $url;
}
开发者ID:ducthang128,项目名称:VPS_v2,代码行数:25,代码来源:MY_url_helper.php

示例10: common_functions

 public function common_functions()
 {
     echo is_php('5.3');
     echo is_really_writable('file.php');
     echo config_item('key');
     echo set_status_header('200', 'text');
     echo remove_invisible_characters('Java\\0script');
     echo html_escape(array());
     echo get_mimes();
     echo is_https();
     echo is_cli();
     echo function_usable('eval');
 }
开发者ID:psosulski,项目名称:ci,代码行数:13,代码来源:Examples.php

示例11: __construct

 /**
  * Constructor
  *
  * Sets the $config data from the primary config.php file as a class variable
  *
  * @access   public
  * @param   string	the config file name
  * @param   boolean  if configuration values should be loaded into their own section
  * @param   boolean  true if errors should just return false, false if an error message should be displayed
  * @return  boolean  if the file was successfully loaded or not
  */
 public function __construct()
 {
     $this->config =& get_config();
     log_message('debug', 'Config Class Initialized');
     // Set the base_url automatically if none was provided
     if (empty($this->config['base_url'])) {
         if (isset($_SERVER['HTTP_HOST'])) {
             $base_url = (is_https() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
         } else {
             $base_url = 'http://localhost/';
         }
         $this->set_item('base_url', $base_url);
     }
 }
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:25,代码来源:Config.php

示例12: __construct

 /**
  * Constructor
  *
  * Sets the $config data from the primary config.php file as a class variable
  *
  * @access   public
  * @param   string	the config file name
  * @param   boolean  if configuration values should be loaded into their own section
  * @param   boolean  true if errors should just return false, false if an error message should be displayed
  * @return  boolean  if the file was successfully loaded or not
  */
 function __construct()
 {
     $this->config =& get_config();
     log_message('debug', "Config Class Initialized");
     // Set the base_url automatically if none was provided
     if ($this->config['base_url'] == '') {
         // Modify by ET-NiK
         if (isset($_SERVER['HTTP_HOST']) && preg_match('/^((\\[[0-9a-f:]+\\])|(\\d{1,3}(\\.\\d{1,3}){3})|[a-z0-9\\-\\.]+)(:\\d+)?$/i', $_SERVER['HTTP_HOST'])) {
             $base_url = (is_https() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
         } else {
             $base_url = 'http://localhost/';
         }
         $this->set_item('base_url', $base_url);
     }
 }
开发者ID:mefisto2009,项目名称:GameAP,代码行数:26,代码来源:Config.php

示例13: __construct

 /**
  * Class constructor
  *
  * Sets the $config data from the primary config.php file as a class variable.
  *
  * @return    void
  */
 public function __construct()
 {
     $this->config =& get_config();
     // Set the base_url automatically if none was provided
     if (empty($this->config['base_url'])) {
         // The regular expression is only a basic validation for a valid "Host" header.
         // It's not exhaustive, only checks for valid characters.
         if (isset($_SERVER['HTTP_HOST']) && preg_match('/^((\\[[0-9a-f:]+\\])|(\\d{1,3}(\\.\\d{1,3}){3})|[a-z0-9\\-\\.]+)(:\\d+)?$/i', $_SERVER['HTTP_HOST'])) {
             $base_url = (is_https() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
         } else {
             $base_url = 'http://localhost/';
         }
         $this->set_item('base_url', $base_url);
     }
     log_message('info', 'Config Class Initialized');
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:23,代码来源:TI_Config.php

示例14: plugin_ssl_convert

/**
*
*
*/
function plugin_ssl_convert()
{
    global $script, $script_ssl, $vars, $reg_exp_host;
    //------------ [重要かつ複雑なロジック] ----------------------------------
    // #sslと記述されたページのみ、ssl通信の対象としたいため以下のような処理をする
    // (ナビ、メニュー、ナビ2などは、通常のURLにリンクさせたい)
    //
    //   0. lib/init.php で、$script_ssl が未設定なら生成される
    //   2. 入れ替えた後は、$script_ssl によって、コンテンツ部分の様々なURLが作られる
    //   3. lib/html.php 内で、元に戻す
    //   4. naviや、menuや、pukiwiki.skin.phpで呼び出すところでは、元の$scriptが使われる
    //
    //   なるべく、ドメインを含めないURL指定を心掛けるとよいかも
    //
    // lib/html.php でSSL用の処理(HTMLコードの書き換えを実行)をするためのフラグ
    $qt = get_qt();
    $qt->setv('plugin_ssl_flag', TRUE);
    $go_ssl_url = $script_ssl . '?' . rawurlencode($vars['page']);
    // 移動を促すメッセージ
    $args = func_get_args();
    $msg = isset($args[0]) ? h($args[0]) : '暗号化されたページへ移動してください';
    // javascriptで判定して、https:に移動させる(PHPのSERVER変数が信用できないから)
    $qt->setv('jquery_include', true);
    $js_co = check_editable($vars['page'], false, false) ? '//' : '';
    $js = <<<EOD
<script type="text/javascript">
if( document.location.protocol != 'https:' ){
\t{$js_co}location.href = '{$go_ssl_url}';
\t\$(function(){
\t\t\$('div#plugin_ssl_msg').html('<a href="{$go_ssl_url}" data-target="nowin">{$msg}</a>');
\t});
}
</script>
EOD;
    $qt->appendv_once('plugin_ssl', 'beforescript', $js);
    // 外部ウインドウで開くリストから、通常ページへのURLを除外
    $p_url = parse_url(is_https() ? $script_ssl : $script);
    $reg_exp_host .= ($reg_exp_host == '' ? '' : '|') . $p_url['host'];
    return <<<EOD
<div id="plugin_ssl_msg"></div>
EOD;
}
开发者ID:big2men,项目名称:qhm,代码行数:46,代码来源:ssl.inc.php

示例15: form_open

 function form_open($action = '', $attributes = array(), $hidden = array())
 {
     $CI =& get_instance();
     // Load URL helper for the site_url and base_url functions
     $CI->load->helper('url');
     // Set the link protocol to https if secure
     $link_protocol = USE_SSL && is_https() ? 'https' : NULL;
     // If no action is provided then set to the current url
     if (!$action) {
         $action = current_url($action);
         if (is_https()) {
             if (parse_url($action, PHP_URL_SCHEME) == 'http') {
                 $action = substr($action, 0, 4) . 's' . substr($action, 4);
             }
         }
         $action = $_SERVER['QUERY_STRING'] ? $action . '?' . $_SERVER['QUERY_STRING'] : $action;
     } elseif (strpos($action, '://') === FALSE) {
         $action = site_url($action, $link_protocol);
     }
     $attributes = _attributes_to_string($attributes);
     if (stripos($attributes, 'method=') === FALSE) {
         $attributes .= ' method="post"';
     }
     if (stripos($attributes, 'accept-charset=') === FALSE) {
         $attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
     }
     $form = '<form action="' . $action . '"' . $attributes . ">\n";
     // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
     if ($CI->config->item('csrf_protection') === TRUE && strpos($action, base_url('', $link_protocol)) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
     }
     // Add MY CSRF token if MY CSRF library is loaded
     if ($CI->load->is_loaded('tokens') && strpos($action, base_url('', $link_protocol)) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->tokens->name] = $CI->tokens->token();
     }
     if (is_array($hidden)) {
         foreach ($hidden as $name => $value) {
             $form .= '<input type="hidden" name="' . $name . '" value="' . html_escape($value) . '" style="display:none;" />' . "\n";
         }
     }
     return $form;
 }
开发者ID:Osub,项目名称:Community-Auth-For-CodeIgniter-3,代码行数:42,代码来源:MY_form_helper.php


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