summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Karlitschek <karlitschek@kde.org>2012-02-14 16:32:38 +0100
committerFrank Karlitschek <karlitschek@kde.org>2012-02-14 16:32:38 +0100
commitd53ed4b40bedc5c967f92839629379a91925bd87 (patch)
tree937f3edfab80b42bf353054fbb2a516802411e54
parentd10f4f071d8a51128e0b8056e9af414af98cf833 (diff)
downloadnextcloud-server-d53ed4b40bedc5c967f92839629379a91925bd87.tar.gz
nextcloud-server-d53ed4b40bedc5c967f92839629379a91925bd87.zip
make it possible to override every image and logo with a new version from within a theme. I think we have a very cool theming here. *self-praise*
-rw-r--r--lib/helper.php31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 4d1219d78d4..6d3df6d97e7 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -75,18 +75,25 @@ class OC_Helper {
*
* Returns the path to the image.
*/
- public static function imagePath( $app, $image ){
- // Check if the app is in the app folder
- if( file_exists( OC::$SERVERROOT."/apps/$app/img/$image" )){
- return OC::$WEBROOT."/apps/$app/img/$image";
- }
- elseif( !empty( $app )){
- return OC::$WEBROOT."/$app/img/$image";
- }
- else{
- return OC::$WEBROOT."/core/img/$image";
- }
- }
+ public static function imagePath( $app, $image ){
+ // Read the selected theme from the config file
+ $theme=OC_Config::getValue( "theme" );
+
+ // Check if the app is in the app folder
+ if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){
+ return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image";
+ }elseif( file_exists( OC::$SERVERROOT."/apps/$app/img/$image" )){
+ return OC::$WEBROOT."/apps/$app/img/$image";
+ }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){
+ return OC::$WEBROOT."/themes/$theme/$app/img/$image";
+ }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )){
+ return OC::$WEBROOT."/$app/img/$image";
+ }elseif( file_exists( OC::$SERVERROOT."/themes/$theme/core/img/$image" )){
+ return OC::$WEBROOT."/themes/$theme/core/img/$image";
+ }else{
+ return OC::$WEBROOT."/core/img/$image";
+ }
+ }
/**
* @brief get path to icon of file type