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


PHP eZURI::encodeIRI方法代码示例

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


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

示例1: match


//.........这里部分代码省略.........
                             case 'part':
                                 $hasHostMatch = strpos($host, $matchHost) !== false;
                                 break;
                             default:
                                 $hasHostMatch = false;
                                 eZDebug::writeError("Unknown host_uri host match: {$matchHostMethod}", "access");
                                 break;
                         }
                         if ($hasHostMatch) {
                             if ($matchURI !== '') {
                                 $matchURIFolders = explode('/', $matchURI);
                                 $uri->increase(count($matchURIFolders));
                                 $uri->dropBase();
                                 $access['uri_part'] = $matchURIFolders;
                             }
                             $access['name'] = $matchAccess;
                             $access['type'] = $type;
                             return $access;
                         }
                     }
                 }
                 break;
             case 'index':
                 $type = eZSiteAccess::TYPE_INDEX_FILE;
                 $match_type = $ini->variable('SiteAccessSettings', 'IndexMatchType');
                 $match_item = $file;
                 if ($match_type == 'element') {
                     $match_index = $ini->variable('SiteAccessSettings', 'IndexMatchElement');
                     $match_pos = strpos($match_item, '.php');
                     if ($match_pos !== false) {
                         $match_item = substr($match_item, 0, $match_pos);
                         $match_arr = explode('_', $match_item);
                         $name = $match_arr[$match_index];
                     }
                 } else {
                     if ($match_type == 'text') {
                         $matcher_pre = $ini->variable('SiteAccessSettings', 'IndexMatchSubtextPre');
                         $matcher_post = $ini->variable('SiteAccessSettings', 'IndexMatchSubtextPost');
                     } else {
                         if ($match_type == 'regexp') {
                             $matcher = $ini->variable('SiteAccessSettings', 'IndexMatchRegexp');
                             $match_num = $ini->variable('SiteAccessSettings', 'IndexMatchRegexpItem');
                         } else {
                             continue;
                         }
                     }
                 }
                 break;
             default:
                 eZDebug::writeError("Unknown access match: {$matchprobe}", "access");
                 break;
         }
         if ($match_type == 'regexp') {
             $name = self::matchRegexp($match_item, $matcher, $match_num);
         } else {
             if ($match_type == 'text') {
                 $name = self::matchText($match_item, $matcher_pre, $matcher_post);
             }
         }
         if (isset($name) && $name != '') {
             $nameClean = self::washName($name);
             if (in_array($nameClean, $siteAccessList)) {
                 if ($nameClean !== $name) {
                     if (!$ini->hasVariable('SiteAccessSettings', 'NormalizeSANames') || $ini->variable('SiteAccessSettings', 'NormalizeSANames') == 'enabled') {
                         $name = $nameClean;
                         if ($ini->hasVariable('SiteAccessSettings', 'RedirectOnNormalize') && $ini->variable('SiteAccessSettings', 'RedirectOnNormalize') == 'enabled') {
                             header($_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently");
                             header("Status: 301 Moved Permanently");
                             $uriSlice = $uri->URIArray;
                             array_shift($uriSlice);
                             $newUri = $name . '/' . implode('/', $uriSlice);
                             $location = eZSys::indexDir() . "/" . eZURI::encodeIRI($newUri);
                             header("Location: " . $location);
                             eZExecution::cleanExit();
                         }
                     }
                 }
                 if ($type == eZSiteAccess::TYPE_URI) {
                     if ($match_type == 'element') {
                         $uri->increase($match_index);
                         $uri->dropBase();
                     } else {
                         if ($match_type == 'regexp') {
                             $uri->setURIString($match_item);
                         } else {
                             if ($match_type == 'text') {
                                 $uri->setURIString($match_item);
                             }
                         }
                     }
                 }
                 $access['type'] = $type;
                 $access['name'] = $name;
                 $access['uri_part'] = $uri_part;
                 return $access;
             }
         }
     }
     return $access;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezsiteaccess.php

示例2: codecURL

 /**
  * Parse URL and encode/decode its path string
  *
  * @param string $url the URL to parse
  * @param boolean $encode tells to encode the URI
  * @return string the parsed url
  */
 public static function codecURL($url, $encode)
 {
     $originalLocale = setlocale(LC_CTYPE, "0");
     setlocale(LC_CTYPE, 'C');
     // Parse URL and encode the path.
     $data = parse_url($url);
     setlocale(LC_CTYPE, $originalLocale);
     if (isset($data['path'])) {
         if ($encode) {
             $data['path'] = eZURI::encodeIRI($data['path']);
         } else {
             $data['path'] = eZURI::decodeIRI($data['path']);
         }
         // Make sure it is dencoded to internal encoding
     }
     // Reconstruct the URL
     $host = '';
     $preHost = '';
     if (isset($data['user'])) {
         if (isset($data['pass'])) {
             $preHost .= $data['user'] . ':' . $data['pass'] . '@';
         } else {
             $preHost .= $data['user'] . '@';
         }
     }
     if (isset($data['host'])) {
         if (isset($data['port'])) {
             $host = $preHost . $data['host'] . ':' . $data['port'];
         } else {
             $host = $preHost . $data['host'];
         }
     }
     $url = '';
     if (isset($data['scheme'])) {
         $url = $data['scheme'] . '://' . $host;
     } else {
         if (strlen($host) > 0) {
             $url = '//' . $host;
         }
     }
     if (isset($data['path'])) {
         $url .= $data['path'];
     }
     if (isset($data['query'])) {
         $url .= '?' . $data['query'];
     }
     if (isset($data['fragment'])) {
         $url .= '#' . $data['fragment'];
     }
     return $url;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:58,代码来源:ezuri.php

示例3: header

if ($errorHandlerType != 'redirect') {
    // Set apache error headers if error.ini tells us to
    if ($errorINI->hasVariable('ErrorSettings-' . $errorType, 'HTTPError')) {
        $errorMap = $errorINI->variable('ErrorSettings-' . $errorType, 'HTTPError');
        if (isset($errorMap[$errorNumber])) {
            $httpErrorCode = $errorMap[$errorNumber];
            if ($errorINI->hasVariable('HTTPError-' . $httpErrorCode, 'HTTPName')) {
                $httpErrorName = $errorINI->variable('HTTPError-' . $httpErrorCode, 'HTTPName');
                $httpErrorString = "{$httpErrorCode} {$httpErrorName}";
                header(eZSys::serverVariable('SERVER_PROTOCOL') . " {$httpErrorString}");
                header("Status: {$httpErrorString}");
                if ($errorNumber == eZError::KERNEL_MOVED) {
                    // Set moved permanently headers.
                    header($_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently");
                    header("Status: 301 Moved Permanently");
                    $location = eZSys::indexDir() . "/" . eZURI::encodeIRI($extraErrorParameters['new_location']);
                    // Make sure it is encoded to IRI format
                    header("Location: " . $location);
                }
            }
        }
    }
}
if ($errorHandlerType == 'redirect') {
    $errorRedirectURL = $errorINI->variable('ErrorSettings', 'DefaultRedirectURL');
    if (isset($redirectURLList[$errorNumber])) {
        $errorRedirectURL = $redirectURLList[$errorNumber];
    }
    return $module->redirectTo($errorRedirectURL);
} else {
    if ($errorHandlerType == 'rerun') {
开发者ID:runelangseid,项目名称:ezpublish,代码行数:31,代码来源:view.php


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