diff options
author | Bart Visscher <bart@thisnet.nl> | 2011-09-18 19:37:54 +0200 |
---|---|---|
committer | Bart Visscher <bart@thisnet.nl> | 2011-09-18 19:37:54 +0200 |
commit | 82c7598861db175617694891bb9f21b426426225 (patch) | |
tree | fce8fb4717b4cc2a5dc6da8835bdb51b5fb40054 /lib/helper.php | |
parent | d5656716f69caa6a1eb98706994ffcb9a08553a7 (diff) | |
download | nextcloud-server-82c7598861db175617694891bb9f21b426426225.tar.gz nextcloud-server-82c7598861db175617694891bb9f21b426426225.zip |
Remove global vars and use the OC static version.
Removed global vars are DOCUMENTROOT, SERVERROOT, SUBURI, WEBROOT and CONFIG_DATADIRECTORY
Diffstat (limited to 'lib/helper.php')
-rw-r--r-- | lib/helper.php | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/lib/helper.php b/lib/helper.php index d9b47280ff7..1661f38e8ab 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -35,25 +35,22 @@ class OC_Helper { * Returns a url to the given app and file. */ public static function linkTo( $app, $file, $redirect_url=NULL, $absolute=false ){ - global $WEBROOT; - global $SERVERROOT; - if( $app != '' ){ $app .= '/'; // Check if the app is in the app folder - if( file_exists( $SERVERROOT . '/apps/'. $app.$file )){ - $urlLinkTo = $WEBROOT . '/apps/' . $app . $file; + if( file_exists( OC::$SERVERROOT . '/apps/'. $app.$file )){ + $urlLinkTo = OC::$WEBROOT . '/apps/' . $app . $file; } else{ - $urlLinkTo = $WEBROOT . '/' . $app . $file; + $urlLinkTo = OC::$WEBROOT . '/' . $app . $file; } } else{ - if( file_exists( $SERVERROOT . '/core/'. $file )){ - $urlLinkTo = $WEBROOT . '/core/'.$file; + if( file_exists( OC::$SERVERROOT . '/core/'. $file )){ + $urlLinkTo = OC::$WEBROOT . '/core/'.$file; } else{ - $urlLinkTo = $WEBROOT . '/'.$file; + $urlLinkTo = OC::$WEBROOT . '/'.$file; } } @@ -79,18 +76,15 @@ class OC_Helper { * Returns the path to the image. */ public static function imagePath( $app, $image ){ - global $SERVERROOT; - global $WEBROOT; - // Check if the app is in the app folder - if( file_exists( "$SERVERROOT/apps/$app/img/$image" )){ - return "$WEBROOT/apps/$app/img/$image"; + if( file_exists( OC::$SERVERROOT."/apps/$app/img/$image" )){ + return OC::$WEBROOT."/apps/$app/img/$image"; } elseif( !empty( $app )){ - return "$WEBROOT/$app/img/$image"; + return OC::$WEBROOT."/$app/img/$image"; } else{ - return "$WEBROOT/core/img/$image"; + return OC::$WEBROOT."/core/img/$image"; } } @@ -102,27 +96,25 @@ class OC_Helper { * Returns the path to the image of this file type. */ public static function mimetypeIcon( $mimetype ){ - global $SERVERROOT; - global $WEBROOT; // Replace slash with a minus $mimetype = str_replace( "/", "-", $mimetype ); // Is it a dir? if( $mimetype == "dir" ){ - return "$WEBROOT/core/img/places/folder.svg"; + return OC::$WEBROOT."/core/img/places/folder.svg"; } // Icon exists? - if( file_exists( "$SERVERROOT/core/img/filetypes/$mimetype.svg" )){ - return "$WEBROOT/core/img/filetypes/$mimetype.svg"; + if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.svg" )){ + return OC::$WEBROOT."/core/img/filetypes/$mimetype.svg"; } //try only the first part of the filetype $mimetype=substr($mimetype,0,strpos($mimetype,'-')); - if( file_exists( "$SERVERROOT/core/img/filetypes/$mimetype.svg" )){ - return "$WEBROOT/core/img/filetypes/$mimetype.svg"; + if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.svg" )){ + return OC::$WEBROOT."/core/img/filetypes/$mimetype.svg"; } else{ - return "$WEBROOT/core/img/filetypes/file.svg"; + return OC::$WEBROOT."/core/img/filetypes/file.svg"; } } |