當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。