mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
add OC_APP::getCurrentApp() to get the id of the active app
This commit is contained in:
parent
a471d40cc8
commit
edec37b402
1 changed files with 16 additions and 0 deletions
16
lib/app.php
16
lib/app.php
|
|
@ -383,5 +383,21 @@ class OC_APP{
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the id of loaded app
|
||||
* @return string
|
||||
*/
|
||||
public static function getCurrentApp(){
|
||||
global $WEBROOT;
|
||||
$script=substr($_SERVER["SCRIPT_NAME"],strlen($WEBROOT)+1);
|
||||
$topFolder=substr($script,0,strpos($script,'/'));
|
||||
if($topFolder=='apps'){
|
||||
$length=strlen($topFolder);
|
||||
return substr($script,$length+1,strpos($script,'/',$length+1)-$length-1);
|
||||
}else{
|
||||
return $topFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in a new issue