aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
authorJulius Haertl <jus@bitgrid.net>2016-08-14 12:26:05 +0200
committerJulius Haertl <jus@bitgrid.net>2016-11-18 10:23:22 +0100
commit64510bd87aaca44af3048121aff38d65c7712ae3 (patch)
tree2d74dd55c7623de2cac64a6633b929534947f685 /apps/theming
parent2d65b8c600580cd64aa599a791a467101b873c5a (diff)
downloadnextcloud-server-64510bd87aaca44af3048121aff38d65c7712ae3.tar.gz
nextcloud-server-64510bd87aaca44af3048121aff38d65c7712ae3.zip
Theming: Add PHPdoc and icon fallback to theming logo
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/lib/Controller/IconController.php27
1 files changed, 26 insertions, 1 deletions
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;