本文整理匯總了PHP中OC::APPSROOT方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC::APPSROOT方法的具體用法?PHP OC::APPSROOT怎麽用?PHP OC::APPSROOT使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OC
的用法示例。
在下文中一共展示了OC::APPSROOT方法的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);
}