From 64510bd87aaca44af3048121aff38d65c7712ae3 Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Sun, 14 Aug 2016 12:26:05 +0200 Subject: [PATCH] Theming: Add PHPdoc and icon fallback to theming logo Signed-off-by: Julius Haertl --- .../theming/lib/Controller/IconController.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index d7c27a88134..7ceaa599232 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -212,6 +212,10 @@ class IconController extends Controller { return $finalIconFile; } + /** + * @param $app app name + * @return string path to app icon / logo + */ private function getAppIcon($app) { $appPath = \OC_App::getAppPath($app); @@ -224,11 +228,19 @@ class IconController extends Controller { return $icon; } + $icon = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/') . '/themedinstancelogo'; + if(file_exists($icon)) { + return $icon; + } return \OC::$SERVERROOT . '/core/img/logo.svg'; } + /** + * @param $app app name + * @param $image relative path to image in app folder + * @return string absolute path to image + */ private function getAppImage($app, $image) { - // TODO: add support for images in core/img/ $appPath = \OC_App::getAppPath($app); if($app==="core") { @@ -260,6 +272,12 @@ class IconController extends Controller { } } + /** + * replace black with white and white with black + * + * @param $svg content of a svg file + * @return string + */ private function svgInvert($svg) { $svg = preg_replace('/#(f{3,6})/i', '#REPLACECOLOR', $svg); $svg = preg_replace('/#(0{3,6})/i', '#ffffff', $svg); @@ -267,6 +285,13 @@ class IconController extends Controller { return $svg; } + /** + * replace default color with a custom one + * + * @param $svg content of a svg file + * @param $color color to match + * @return string + */ private function colorizeSvg($svg, $color) { $svg = preg_replace('/#0082c9/i', $color, $svg); return $svg; -- 2.39.5