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


PHP OC::APPSWEBROOT方法代码示例

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


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

示例1: initPaths

 public static function initPaths()
 {
     // calculate the documentroot
     OC::$DOCUMENTROOT = realpath($_SERVER['DOCUMENT_ROOT']);
     OC::$SERVERROOT = str_replace("\\", '/', substr(__FILE__, 0, -13));
     OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
     $scriptName = $_SERVER["SCRIPT_NAME"];
     if (substr($scriptName, -1) == '/') {
         $scriptName .= 'index.php';
         //make sure suburi follows the same rules as scriptName
         if (substr(OC::$SUBURI, -9) != 'index.php') {
             if (substr(OC::$SUBURI, -1) != '/') {
                 OC::$SUBURI = OC::$SUBURI . '/';
             }
             OC::$SUBURI = OC::$SUBURI . 'index.php';
         }
     }
     OC::$WEBROOT = substr($scriptName, 0, strlen($scriptName) - strlen(OC::$SUBURI));
     // try a new way to detect the WEBROOT which is simpler and also works with the app directory outside the owncloud folder. let´s see if this works for everybody
     //		OC::$WEBROOT=substr(OC::$SERVERROOT,strlen(OC::$DOCUMENTROOT));
     if (OC::$WEBROOT != '' and OC::$WEBROOT[0] !== '/') {
         OC::$WEBROOT = '/' . OC::$WEBROOT;
     }
     // ensure we can find OC_Config
     set_include_path(OC::$SERVERROOT . '/lib' . PATH_SEPARATOR . get_include_path());
     // search the 3rdparty folder
     if (OC_Config::getValue('3rdpartyroot', '') != '' and OC_Config::getValue('3rdpartyurl', '') != '') {
         OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', '');
         OC::$THIRDPARTYWEBROOT = OC_Config::getValue('3rdpartyurl', '');
     } elseif (file_exists(OC::$SERVERROOT . '/3rdparty')) {
         OC::$THIRDPARTYROOT = OC::$SERVERROOT;
         OC::$THIRDPARTYWEBROOT = OC::$WEBROOT;
     } elseif (file_exists(OC::$SERVERROOT . '/../3rdparty')) {
         OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/');
         OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/');
     } else {
         echo "3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.";
         exit;
     }
     // search the apps folder
     if (OC_Config::getValue('appsroot', '') != '') {
         OC::$APPSROOT = OC_Config::getValue('appsroot', '');
         OC::$APPSWEBROOT = OC_Config::getValue('appsurl', '');
     } elseif (file_exists(OC::$SERVERROOT . '/apps')) {
         OC::$APPSROOT = OC::$SERVERROOT;
         OC::$APPSWEBROOT = OC::$WEBROOT;
     } elseif (file_exists(OC::$SERVERROOT . '/../apps')) {
         OC::$APPSROOT = rtrim(dirname(OC::$SERVERROOT), '/');
         OC::$APPSWEBROOT = rtrim(dirname(OC::$WEBROOT), '/');
     } else {
         echo "apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.";
         exit;
     }
     // set the right include path
     set_include_path(OC::$SERVERROOT . '/lib' . PATH_SEPARATOR . OC::$SERVERROOT . '/config' . PATH_SEPARATOR . OC::$THIRDPARTYROOT . '/3rdparty' . PATH_SEPARATOR . OC::$APPSROOT . PATH_SEPARATOR . OC::$APPSROOT . '/apps' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . OC::$SERVERROOT);
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:56,代码来源:base.php


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