本文整理汇总了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);
}