@@ -36,184 +36,184 @@ |
||
| 36 | 36 | |
| 37 | 37 | class Util { |
| 38 | 38 | |
| 39 | - /** @var IConfig */ |
|
| 40 | - private $config; |
|
| 41 | - |
|
| 42 | - /** @var IAppManager */ |
|
| 43 | - private $appManager; |
|
| 44 | - |
|
| 45 | - /** @var IAppData */ |
|
| 46 | - private $appData; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Util constructor. |
|
| 50 | - * |
|
| 51 | - * @param IConfig $config |
|
| 52 | - * @param IAppManager $appManager |
|
| 53 | - * @param IAppData $appData |
|
| 54 | - */ |
|
| 55 | - public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData) { |
|
| 56 | - $this->config = $config; |
|
| 57 | - $this->appManager = $appManager; |
|
| 58 | - $this->appData = $appData; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @param string $color rgb color value |
|
| 63 | - * @return bool |
|
| 64 | - */ |
|
| 65 | - public function invertTextColor($color) { |
|
| 66 | - $l = $this->calculateLuminance($color); |
|
| 67 | - if($l>0.55) { |
|
| 68 | - return true; |
|
| 69 | - } else { |
|
| 70 | - return false; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * get color for on-page elements: |
|
| 76 | - * theme color by default, grey if theme color is to bright |
|
| 77 | - * @param $color |
|
| 78 | - * @return string |
|
| 79 | - */ |
|
| 80 | - public function elementColor($color) { |
|
| 81 | - $l = $this->calculateLuminance($color); |
|
| 82 | - if($l>0.8) { |
|
| 83 | - return '#555555'; |
|
| 84 | - } |
|
| 85 | - return $color; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @param string $color rgb color value |
|
| 90 | - * @return float |
|
| 91 | - */ |
|
| 92 | - public function calculateLuminance($color) { |
|
| 93 | - $hex = preg_replace("/[^0-9A-Fa-f]/", '', $color); |
|
| 94 | - if (strlen($hex) === 3) { |
|
| 95 | - $hex = $hex{0} . $hex{0} . $hex{1} . $hex{1} . $hex{2} . $hex{2}; |
|
| 96 | - } |
|
| 97 | - if (strlen($hex) !== 6) { |
|
| 98 | - return 0; |
|
| 99 | - } |
|
| 100 | - $red = hexdec(substr($hex, 0, 2)); |
|
| 101 | - $green = hexdec(substr($hex, 2, 2)); |
|
| 102 | - $blue = hexdec(substr($hex, 4, 2)); |
|
| 103 | - $compiler = new Compiler(); |
|
| 104 | - $hsl = $compiler->toHSL($red, $green, $blue); |
|
| 105 | - return $hsl[3]/100; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @param $color |
|
| 110 | - * @return string base64 encoded radio button svg |
|
| 111 | - */ |
|
| 112 | - public function generateRadioButton($color) { |
|
| 113 | - $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' . |
|
| 114 | - '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>'; |
|
| 115 | - return base64_encode($radioButtonIcon); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @param $app string app name |
|
| 121 | - * @return string|ISimpleFile path to app icon / file of logo |
|
| 122 | - */ |
|
| 123 | - public function getAppIcon($app) { |
|
| 124 | - $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
|
| 125 | - try { |
|
| 126 | - $appPath = $this->appManager->getAppPath($app); |
|
| 127 | - $icon = $appPath . '/img/' . $app . '.svg'; |
|
| 128 | - if (file_exists($icon)) { |
|
| 129 | - return $icon; |
|
| 130 | - } |
|
| 131 | - $icon = $appPath . '/img/app.svg'; |
|
| 132 | - if (file_exists($icon)) { |
|
| 133 | - return $icon; |
|
| 134 | - } |
|
| 135 | - } catch (AppPathNotFoundException $e) {} |
|
| 136 | - |
|
| 137 | - if ($this->config->getAppValue('theming', 'logoMime', '') !== '') { |
|
| 138 | - $logoFile = null; |
|
| 139 | - try { |
|
| 140 | - $folder = $this->appData->getFolder('images'); |
|
| 141 | - if ($folder !== null) { |
|
| 142 | - return $folder->getFile('logo'); |
|
| 143 | - } |
|
| 144 | - } catch (NotFoundException $e) {} |
|
| 145 | - } |
|
| 146 | - return \OC::$SERVERROOT . '/core/img/logo.svg'; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @param $app string app name |
|
| 151 | - * @param $image string relative path to image in app folder |
|
| 152 | - * @return string|false absolute path to image |
|
| 153 | - */ |
|
| 154 | - public function getAppImage($app, $image) { |
|
| 155 | - $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
|
| 156 | - $image = str_replace(array('\0', '\\', '..'), '', $image); |
|
| 157 | - if ($app === "core") { |
|
| 158 | - $icon = \OC::$SERVERROOT . '/core/img/' . $image; |
|
| 159 | - if (file_exists($icon)) { |
|
| 160 | - return $icon; |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - try { |
|
| 165 | - $appPath = $this->appManager->getAppPath($app); |
|
| 166 | - } catch (AppPathNotFoundException $e) { |
|
| 167 | - return false; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - $icon = $appPath . '/img/' . $image; |
|
| 171 | - if (file_exists($icon)) { |
|
| 172 | - return $icon; |
|
| 173 | - } |
|
| 174 | - $icon = $appPath . '/img/' . $image . '.svg'; |
|
| 175 | - if (file_exists($icon)) { |
|
| 176 | - return $icon; |
|
| 177 | - } |
|
| 178 | - $icon = $appPath . '/img/' . $image . '.png'; |
|
| 179 | - if (file_exists($icon)) { |
|
| 180 | - return $icon; |
|
| 181 | - } |
|
| 182 | - $icon = $appPath . '/img/' . $image . '.gif'; |
|
| 183 | - if (file_exists($icon)) { |
|
| 184 | - return $icon; |
|
| 185 | - } |
|
| 186 | - $icon = $appPath . '/img/' . $image . '.jpg'; |
|
| 187 | - if (file_exists($icon)) { |
|
| 188 | - return $icon; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return false; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * replace default color with a custom one |
|
| 196 | - * |
|
| 197 | - * @param $svg string content of a svg file |
|
| 198 | - * @param $color string color to match |
|
| 199 | - * @return string |
|
| 200 | - */ |
|
| 201 | - public function colorizeSvg($svg, $color) { |
|
| 202 | - $svg = preg_replace('/#0082c9/i', $color, $svg); |
|
| 203 | - return $svg; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Check if a custom theme is set in the server configuration |
|
| 208 | - * |
|
| 209 | - * @return bool |
|
| 210 | - */ |
|
| 211 | - public function isAlreadyThemed() { |
|
| 212 | - $theme = $this->config->getSystemValue('theme', ''); |
|
| 213 | - if ($theme !== '') { |
|
| 214 | - return true; |
|
| 215 | - } |
|
| 216 | - return false; |
|
| 217 | - } |
|
| 39 | + /** @var IConfig */ |
|
| 40 | + private $config; |
|
| 41 | + |
|
| 42 | + /** @var IAppManager */ |
|
| 43 | + private $appManager; |
|
| 44 | + |
|
| 45 | + /** @var IAppData */ |
|
| 46 | + private $appData; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Util constructor. |
|
| 50 | + * |
|
| 51 | + * @param IConfig $config |
|
| 52 | + * @param IAppManager $appManager |
|
| 53 | + * @param IAppData $appData |
|
| 54 | + */ |
|
| 55 | + public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData) { |
|
| 56 | + $this->config = $config; |
|
| 57 | + $this->appManager = $appManager; |
|
| 58 | + $this->appData = $appData; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @param string $color rgb color value |
|
| 63 | + * @return bool |
|
| 64 | + */ |
|
| 65 | + public function invertTextColor($color) { |
|
| 66 | + $l = $this->calculateLuminance($color); |
|
| 67 | + if($l>0.55) { |
|
| 68 | + return true; |
|
| 69 | + } else { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * get color for on-page elements: |
|
| 76 | + * theme color by default, grey if theme color is to bright |
|
| 77 | + * @param $color |
|
| 78 | + * @return string |
|
| 79 | + */ |
|
| 80 | + public function elementColor($color) { |
|
| 81 | + $l = $this->calculateLuminance($color); |
|
| 82 | + if($l>0.8) { |
|
| 83 | + return '#555555'; |
|
| 84 | + } |
|
| 85 | + return $color; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @param string $color rgb color value |
|
| 90 | + * @return float |
|
| 91 | + */ |
|
| 92 | + public function calculateLuminance($color) { |
|
| 93 | + $hex = preg_replace("/[^0-9A-Fa-f]/", '', $color); |
|
| 94 | + if (strlen($hex) === 3) { |
|
| 95 | + $hex = $hex{0} . $hex{0} . $hex{1} . $hex{1} . $hex{2} . $hex{2}; |
|
| 96 | + } |
|
| 97 | + if (strlen($hex) !== 6) { |
|
| 98 | + return 0; |
|
| 99 | + } |
|
| 100 | + $red = hexdec(substr($hex, 0, 2)); |
|
| 101 | + $green = hexdec(substr($hex, 2, 2)); |
|
| 102 | + $blue = hexdec(substr($hex, 4, 2)); |
|
| 103 | + $compiler = new Compiler(); |
|
| 104 | + $hsl = $compiler->toHSL($red, $green, $blue); |
|
| 105 | + return $hsl[3]/100; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @param $color |
|
| 110 | + * @return string base64 encoded radio button svg |
|
| 111 | + */ |
|
| 112 | + public function generateRadioButton($color) { |
|
| 113 | + $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' . |
|
| 114 | + '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>'; |
|
| 115 | + return base64_encode($radioButtonIcon); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @param $app string app name |
|
| 121 | + * @return string|ISimpleFile path to app icon / file of logo |
|
| 122 | + */ |
|
| 123 | + public function getAppIcon($app) { |
|
| 124 | + $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
|
| 125 | + try { |
|
| 126 | + $appPath = $this->appManager->getAppPath($app); |
|
| 127 | + $icon = $appPath . '/img/' . $app . '.svg'; |
|
| 128 | + if (file_exists($icon)) { |
|
| 129 | + return $icon; |
|
| 130 | + } |
|
| 131 | + $icon = $appPath . '/img/app.svg'; |
|
| 132 | + if (file_exists($icon)) { |
|
| 133 | + return $icon; |
|
| 134 | + } |
|
| 135 | + } catch (AppPathNotFoundException $e) {} |
|
| 136 | + |
|
| 137 | + if ($this->config->getAppValue('theming', 'logoMime', '') !== '') { |
|
| 138 | + $logoFile = null; |
|
| 139 | + try { |
|
| 140 | + $folder = $this->appData->getFolder('images'); |
|
| 141 | + if ($folder !== null) { |
|
| 142 | + return $folder->getFile('logo'); |
|
| 143 | + } |
|
| 144 | + } catch (NotFoundException $e) {} |
|
| 145 | + } |
|
| 146 | + return \OC::$SERVERROOT . '/core/img/logo.svg'; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @param $app string app name |
|
| 151 | + * @param $image string relative path to image in app folder |
|
| 152 | + * @return string|false absolute path to image |
|
| 153 | + */ |
|
| 154 | + public function getAppImage($app, $image) { |
|
| 155 | + $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
|
| 156 | + $image = str_replace(array('\0', '\\', '..'), '', $image); |
|
| 157 | + if ($app === "core") { |
|
| 158 | + $icon = \OC::$SERVERROOT . '/core/img/' . $image; |
|
| 159 | + if (file_exists($icon)) { |
|
| 160 | + return $icon; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + try { |
|
| 165 | + $appPath = $this->appManager->getAppPath($app); |
|
| 166 | + } catch (AppPathNotFoundException $e) { |
|
| 167 | + return false; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + $icon = $appPath . '/img/' . $image; |
|
| 171 | + if (file_exists($icon)) { |
|
| 172 | + return $icon; |
|
| 173 | + } |
|
| 174 | + $icon = $appPath . '/img/' . $image . '.svg'; |
|
| 175 | + if (file_exists($icon)) { |
|
| 176 | + return $icon; |
|
| 177 | + } |
|
| 178 | + $icon = $appPath . '/img/' . $image . '.png'; |
|
| 179 | + if (file_exists($icon)) { |
|
| 180 | + return $icon; |
|
| 181 | + } |
|
| 182 | + $icon = $appPath . '/img/' . $image . '.gif'; |
|
| 183 | + if (file_exists($icon)) { |
|
| 184 | + return $icon; |
|
| 185 | + } |
|
| 186 | + $icon = $appPath . '/img/' . $image . '.jpg'; |
|
| 187 | + if (file_exists($icon)) { |
|
| 188 | + return $icon; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return false; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * replace default color with a custom one |
|
| 196 | + * |
|
| 197 | + * @param $svg string content of a svg file |
|
| 198 | + * @param $color string color to match |
|
| 199 | + * @return string |
|
| 200 | + */ |
|
| 201 | + public function colorizeSvg($svg, $color) { |
|
| 202 | + $svg = preg_replace('/#0082c9/i', $color, $svg); |
|
| 203 | + return $svg; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Check if a custom theme is set in the server configuration |
|
| 208 | + * |
|
| 209 | + * @return bool |
|
| 210 | + */ |
|
| 211 | + public function isAlreadyThemed() { |
|
| 212 | + $theme = $this->config->getSystemValue('theme', ''); |
|
| 213 | + if ($theme !== '') { |
|
| 214 | + return true; |
|
| 215 | + } |
|
| 216 | + return false; |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function invertTextColor($color) { |
| 66 | 66 | $l = $this->calculateLuminance($color); |
| 67 | - if($l>0.55) { |
|
| 67 | + if ($l > 0.55) { |
|
| 68 | 68 | return true; |
| 69 | 69 | } else { |
| 70 | 70 | return false; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function elementColor($color) { |
| 81 | 81 | $l = $this->calculateLuminance($color); |
| 82 | - if($l>0.8) { |
|
| 82 | + if ($l > 0.8) { |
|
| 83 | 83 | return '#555555'; |
| 84 | 84 | } |
| 85 | 85 | return $color; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function calculateLuminance($color) { |
| 93 | 93 | $hex = preg_replace("/[^0-9A-Fa-f]/", '', $color); |
| 94 | 94 | if (strlen($hex) === 3) { |
| 95 | - $hex = $hex{0} . $hex{0} . $hex{1} . $hex{1} . $hex{2} . $hex{2}; |
|
| 95 | + $hex = $hex{0}.$hex{0}.$hex{1}.$hex{1}.$hex{2}.$hex{2}; |
|
| 96 | 96 | } |
| 97 | 97 | if (strlen($hex) !== 6) { |
| 98 | 98 | return 0; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $blue = hexdec(substr($hex, 4, 2)); |
| 103 | 103 | $compiler = new Compiler(); |
| 104 | 104 | $hsl = $compiler->toHSL($red, $green, $blue); |
| 105 | - return $hsl[3]/100; |
|
| 105 | + return $hsl[3] / 100; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return string base64 encoded radio button svg |
| 111 | 111 | */ |
| 112 | 112 | public function generateRadioButton($color) { |
| 113 | - $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' . |
|
| 113 | + $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">'. |
|
| 114 | 114 | '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>'; |
| 115 | 115 | return base64_encode($radioButtonIcon); |
| 116 | 116 | } |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
| 125 | 125 | try { |
| 126 | 126 | $appPath = $this->appManager->getAppPath($app); |
| 127 | - $icon = $appPath . '/img/' . $app . '.svg'; |
|
| 127 | + $icon = $appPath.'/img/'.$app.'.svg'; |
|
| 128 | 128 | if (file_exists($icon)) { |
| 129 | 129 | return $icon; |
| 130 | 130 | } |
| 131 | - $icon = $appPath . '/img/app.svg'; |
|
| 131 | + $icon = $appPath.'/img/app.svg'; |
|
| 132 | 132 | if (file_exists($icon)) { |
| 133 | 133 | return $icon; |
| 134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } catch (NotFoundException $e) {} |
| 145 | 145 | } |
| 146 | - return \OC::$SERVERROOT . '/core/img/logo.svg'; |
|
| 146 | + return \OC::$SERVERROOT.'/core/img/logo.svg'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
| 156 | 156 | $image = str_replace(array('\0', '\\', '..'), '', $image); |
| 157 | 157 | if ($app === "core") { |
| 158 | - $icon = \OC::$SERVERROOT . '/core/img/' . $image; |
|
| 158 | + $icon = \OC::$SERVERROOT.'/core/img/'.$image; |
|
| 159 | 159 | if (file_exists($icon)) { |
| 160 | 160 | return $icon; |
| 161 | 161 | } |
@@ -167,23 +167,23 @@ discard block |
||
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - $icon = $appPath . '/img/' . $image; |
|
| 170 | + $icon = $appPath.'/img/'.$image; |
|
| 171 | 171 | if (file_exists($icon)) { |
| 172 | 172 | return $icon; |
| 173 | 173 | } |
| 174 | - $icon = $appPath . '/img/' . $image . '.svg'; |
|
| 174 | + $icon = $appPath.'/img/'.$image.'.svg'; |
|
| 175 | 175 | if (file_exists($icon)) { |
| 176 | 176 | return $icon; |
| 177 | 177 | } |
| 178 | - $icon = $appPath . '/img/' . $image . '.png'; |
|
| 178 | + $icon = $appPath.'/img/'.$image.'.png'; |
|
| 179 | 179 | if (file_exists($icon)) { |
| 180 | 180 | return $icon; |
| 181 | 181 | } |
| 182 | - $icon = $appPath . '/img/' . $image . '.gif'; |
|
| 182 | + $icon = $appPath.'/img/'.$image.'.gif'; |
|
| 183 | 183 | if (file_exists($icon)) { |
| 184 | 184 | return $icon; |
| 185 | 185 | } |
| 186 | - $icon = $appPath . '/img/' . $image . '.jpg'; |
|
| 186 | + $icon = $appPath.'/img/'.$image.'.jpg'; |
|
| 187 | 187 | if (file_exists($icon)) { |
| 188 | 188 | return $icon; |
| 189 | 189 | } |
@@ -36,52 +36,52 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class Capabilities implements IPublicCapability { |
| 38 | 38 | |
| 39 | - /** @var ThemingDefaults */ |
|
| 40 | - protected $theming; |
|
| 39 | + /** @var ThemingDefaults */ |
|
| 40 | + protected $theming; |
|
| 41 | 41 | |
| 42 | - /** @var Util */ |
|
| 43 | - protected $util; |
|
| 42 | + /** @var Util */ |
|
| 43 | + protected $util; |
|
| 44 | 44 | |
| 45 | - /** @var IURLGenerator */ |
|
| 46 | - protected $url; |
|
| 45 | + /** @var IURLGenerator */ |
|
| 46 | + protected $url; |
|
| 47 | 47 | |
| 48 | - /** @var IConfig */ |
|
| 49 | - protected $config; |
|
| 48 | + /** @var IConfig */ |
|
| 49 | + protected $config; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param ThemingDefaults $theming |
|
| 53 | - * @param Util $util |
|
| 54 | - * @param IURLGenerator $url |
|
| 55 | - * @param IConfig $config |
|
| 56 | - */ |
|
| 57 | - public function __construct(ThemingDefaults $theming, Util $util, IURLGenerator $url, IConfig $config) { |
|
| 58 | - $this->theming = $theming; |
|
| 59 | - $this->util = $util; |
|
| 60 | - $this->url = $url; |
|
| 61 | - $this->config = $config; |
|
| 62 | - } |
|
| 51 | + /** |
|
| 52 | + * @param ThemingDefaults $theming |
|
| 53 | + * @param Util $util |
|
| 54 | + * @param IURLGenerator $url |
|
| 55 | + * @param IConfig $config |
|
| 56 | + */ |
|
| 57 | + public function __construct(ThemingDefaults $theming, Util $util, IURLGenerator $url, IConfig $config) { |
|
| 58 | + $this->theming = $theming; |
|
| 59 | + $this->util = $util; |
|
| 60 | + $this->url = $url; |
|
| 61 | + $this->config = $config; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Return this classes capabilities |
|
| 66 | - * |
|
| 67 | - * @return array |
|
| 68 | - */ |
|
| 69 | - public function getCapabilities() { |
|
| 70 | - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); |
|
| 71 | - $color = $this->theming->getColorPrimary(); |
|
| 72 | - return [ |
|
| 73 | - 'theming' => [ |
|
| 74 | - 'name' => $this->theming->getName(), |
|
| 75 | - 'url' => $this->theming->getBaseUrl(), |
|
| 76 | - 'slogan' => $this->theming->getSlogan(), |
|
| 77 | - 'color' => $color, |
|
| 78 | - 'color-text' => $this->util->invertTextColor($color) ? '#000000' : '#FFFFFF', |
|
| 79 | - 'color-element' => $this->util->elementColor($color), |
|
| 80 | - 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
|
| 81 | - 'background' => $backgroundLogo === 'backgroundColor' ? |
|
| 82 | - $this->theming->getColorPrimary() : |
|
| 83 | - $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
| 84 | - ], |
|
| 85 | - ]; |
|
| 86 | - } |
|
| 64 | + /** |
|
| 65 | + * Return this classes capabilities |
|
| 66 | + * |
|
| 67 | + * @return array |
|
| 68 | + */ |
|
| 69 | + public function getCapabilities() { |
|
| 70 | + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); |
|
| 71 | + $color = $this->theming->getColorPrimary(); |
|
| 72 | + return [ |
|
| 73 | + 'theming' => [ |
|
| 74 | + 'name' => $this->theming->getName(), |
|
| 75 | + 'url' => $this->theming->getBaseUrl(), |
|
| 76 | + 'slogan' => $this->theming->getSlogan(), |
|
| 77 | + 'color' => $color, |
|
| 78 | + 'color-text' => $this->util->invertTextColor($color) ? '#000000' : '#FFFFFF', |
|
| 79 | + 'color-element' => $this->util->elementColor($color), |
|
| 80 | + 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
|
| 81 | + 'background' => $backgroundLogo === 'backgroundColor' ? |
|
| 82 | + $this->theming->getColorPrimary() : |
|
| 83 | + $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
| 84 | + ], |
|
| 85 | + ]; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -79,8 +79,7 @@ |
||
| 79 | 79 | 'color-element' => $this->util->elementColor($color), |
| 80 | 80 | 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
| 81 | 81 | 'background' => $backgroundLogo === 'backgroundColor' ? |
| 82 | - $this->theming->getColorPrimary() : |
|
| 83 | - $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
| 82 | + $this->theming->getColorPrimary() : $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
| 84 | 83 | ], |
| 85 | 84 | ]; |
| 86 | 85 | } |