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


PHP PerchUtil::url_to_ssl方法代码示例

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


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

示例1: _replace_form_tags

 private function _replace_form_tags($template, $opening_tag, $closing_tag)
 {
     $Perch = Perch::fetch();
     $OpeningTag = new PerchXMLTag($opening_tag);
     if ($OpeningTag->prefix()) {
         if ($OpeningTag->prefix() == 'none') {
             $this->field_prefix = '';
         } else {
             $this->field_prefix = $OpeningTag->prefix() . '_';
         }
     } else {
         $Perch->form_count++;
         $this->field_prefix = 'form' . $Perch->form_count . '_';
     }
     $attrs = array();
     $attrs['id'] = $this->field_prefix . $OpeningTag->id();
     $attrs['class'] = $OpeningTag->class();
     $attrs['action'] = $OpeningTag->action();
     $attrs['method'] = $OpeningTag->method();
     $attrs['role'] = $OpeningTag->role();
     $attrs['name'] = $OpeningTag->name();
     $attrs['autocomplete'] = $OpeningTag->autocomplete();
     $aria = $OpeningTag->search_attributes_for('aria-');
     if (PerchUtil::count($aria)) {
         $attrs = array_merge($attrs, $aria);
     }
     $html5data = $OpeningTag->search_attributes_for('data-');
     if (PerchUtil::count($html5data)) {
         $attrs = array_merge($attrs, $html5data);
     }
     $this->form_id = $OpeningTag->id();
     $this->handling_app = $OpeningTag->app();
     $this->template_path = $OpeningTag->template();
     $this->action = $OpeningTag->action();
     $this->app = $OpeningTag->app();
     $this->method = $OpeningTag->method();
     if (PERCH_HTML5 && $OpeningTag->novalidate()) {
         $attrs['novalidate'] = 'novalidate';
     }
     if (PERCH_RUNWAY) {
         if (!$attrs['action']) {
             $Runway = PerchRunway::fetch();
             $attrs['action'] = $Runway->get_page();
         }
     } else {
         if (!$attrs['action']) {
             $attrs['action'] = $Perch->get_page_as_set(true);
         }
     }
     // submit via ssl?
     if (PERCH_SSL && $OpeningTag->ssl() && PerchUtil::bool_val($OpeningTag->ssl())) {
         $attrs['action'] = PerchUtil::url_to_ssl($attrs['action']);
     }
     if (!$attrs['method']) {
         $attrs['method'] = 'post';
     }
     $this->form_key = base64_encode($this->form_id . ':' . $this->handling_app . ':' . $this->template_path . ':' . time());
     // Does it have file fields?
     $s = '/(<perch:input[^>]*type="(file|image)"[^>]*>)/s';
     if (preg_match($s, $template)) {
         $attrs['enctype'] = 'multipart/form-data';
     }
     $new_opening_tag = PerchXMLTag::create('form', 'opening', $attrs);
     $template = str_replace($opening_tag, $new_opening_tag, $template);
     $new_closing_tag = PerchXMLTag::create('form', 'closing');
     $template = str_replace($closing_tag, $new_closing_tag, $template);
     return $template;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:68,代码来源:PerchTemplatedForm.class.php

示例2: force_ssl

 public static function force_ssl()
 {
     Perch::fetch();
     // to define PERCH_SSL
     if (PERCH_SSL) {
         if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
             PerchUtil::redirect(PerchUtil::url_to_ssl($_SERVER['REQUEST_URI']));
         } else {
             header('Strict-Transport-Security: max-age=31536000');
         }
     }
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:12,代码来源:PerchSystem.class.php

示例3: url_to_ssl_if_needed

 public static function url_to_ssl_if_needed($path)
 {
     if (PERCH_SSL) {
         return PerchUtil::url_to_ssl($path);
     } else {
         return PerchUtil::url_to_non_ssl($path);
     }
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:8,代码来源:PerchUtil.class.php


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