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


PHP eZSys::isDebugEnabled方法代码示例

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


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

示例1: init

 static function init($index = "index.php", $force_VirtualHost = false)
 {
     $isCGI = substr(php_sapi_name(), 0, 3) == 'cgi';
     $instance = eZSys::instance();
     if (eZSys::isDebugEnabled()) {
         eZDebug::writeNotice(eZSys::serverVariable('PHP_SELF'), 'PHP_SELF');
         eZDebug::writeNotice(eZSys::serverVariable('SCRIPT_FILENAME'), 'SCRIPT_FILENAME');
         eZDebug::writeNotice(eZSys::serverVariable('DOCUMENT_ROOT'), 'DOCUMENT_ROOT');
         eZDebug::writeNotice(eZSys::serverVariable('REQUEST_URI'), 'REQUEST_URI');
         eZDebug::writeNotice(eZSys::serverVariable('QUERY_STRING'), 'QUERY_STRING');
         eZDebug::writeNotice(ini_get('include_path'), 'include_path');
     }
     $phpSelf = eZSys::serverVariable('PHP_SELF');
     // Find out, where our files are.
     if (preg_match("!(.*/){$index}\$!", eZSys::serverVariable('SCRIPT_FILENAME'), $regs)) {
         $siteDir = $regs[1];
         $index = "/{$index}";
     } elseif (preg_match("!(.*/){$index}/?!", $phpSelf, $regs)) {
         // Some people using CGI have their $_SERVER['SCRIPT_FILENAME'] not right... so we are trying this.
         $siteDir = eZSys::serverVariable('DOCUMENT_ROOT') . $regs[1];
         $index = "/{$index}";
     } else {
         // Fallback... doesn't work with virtual-hosts, but better than nothing
         $siteDir = "./";
         $index = "/{$index}";
     }
     if ($isCGI and !$force_VirtualHost) {
         $index .= '?';
     }
     // Setting the right include_path
     $includePath = ini_get("include_path");
     if (trim($includePath) != "") {
         $includePath = $includePath . $instance->envSeparator() . $siteDir;
     } else {
         $includePath = $siteDir;
     }
     ini_set("include_path", $includePath);
     $scriptName = eZSys::serverVariable('SCRIPT_NAME');
     // Get the webdir.
     $wwwDir = "";
     if ($force_VirtualHost) {
         $wwwDir = "";
     } else {
         if (preg_match("!(.*){$index}\$!", $scriptName, $regs)) {
             $wwwDir = $regs[1];
         }
         if (preg_match("!(.*){$index}\$!", $phpSelf, $regs)) {
             $wwwDir = $regs[1];
         }
     }
     if (!$isCGI || $force_VirtualHost) {
         $requestURI = eZSys::serverVariable('REQUEST_URI');
     } else {
         $requestURI = eZSys::serverVariable('QUERY_STRING');
         /* take out PHPSESSID, if url-encoded */
         if (preg_match("/(.*)&PHPSESSID=[^&]+(.*)/", $requestURI, $matches)) {
             $requestURI = $matches[1] . $matches[2];
         }
     }
     // Fallback... Finding the paths above failed, so $_SERVER['PHP_SELF'] is not set right.
     if ($siteDir == "./") {
         $phpSelf = $requestURI;
     }
     if (!$isCGI) {
         $index_reg = str_replace(".", "\\.", $index);
         // Trick: Rewrite setup doesn't have index.php in $_SERVER['PHP_SELF'], so we don't want an $index
         if (!preg_match("!.*{$index_reg}.*!", $phpSelf) || $force_VirtualHost) {
             $index = "";
         } else {
             if (eZSys::isDebugEnabled()) {
                 eZDebug::writeNotice("{$wwwDir}{$index}", '$wwwDir$index');
             }
             // Get the right $_SERVER['REQUEST_URI'], when using nVH setup.
             if (preg_match("!^{$wwwDir}{$index}(.*)!", $phpSelf, $req)) {
                 if (!$req[1]) {
                     if ($phpSelf != "{$wwwDir}{$index}" and preg_match("!^{$wwwDir}(.*)!", $requestURI, $req)) {
                         $requestURI = $req[1];
                         $index = '';
                     } elseif ($phpSelf == "{$wwwDir}{$index}" and (preg_match("!^{$wwwDir}{$index}(.*)!", $requestURI, $req) or preg_match("!^{$wwwDir}(.*)!", $requestURI, $req))) {
                         $requestURI = $req[1];
                     }
                 } else {
                     $requestURI = $req[1];
                 }
             }
         }
     }
     if ($isCGI and $force_VirtualHost) {
         $index = '';
     }
     // Remove url parameters
     if ($isCGI and !$force_VirtualHost) {
         $pattern = "!(\\/[^&]+)!";
     } else {
         $pattern = "!([^?]+)!";
     }
     if (preg_match($pattern, $requestURI, $regs)) {
         $requestURI = $regs[1];
     }
     // Remove internal links
//.........这里部分代码省略.........
开发者ID:runelangseid,项目名称:ezpublish,代码行数:101,代码来源:ezsys.php


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