@@ -25,6 +25,6 @@ |
||
25 | 25 | |
26 | 26 | $application = new Application(); |
27 | 27 | $application->registerRoutes($this, ['routes' => [ |
28 | - ['name' => 'Admin#createCredentials', 'url' => '/credentials', 'verb' => 'GET'], |
|
29 | - ['name' => 'Admin#setChannel', 'url' => '/channel', 'verb' => 'POST'], |
|
28 | + ['name' => 'Admin#createCredentials', 'url' => '/credentials', 'verb' => 'GET'], |
|
29 | + ['name' => 'Admin#setChannel', 'url' => '/channel', 'verb' => 'POST'], |
|
30 | 30 | ]]); |
@@ -23,33 +23,33 @@ |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | if(\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { |
26 | - $updater = new \OC\Updater\VersionCheck( |
|
27 | - \OC::$server->getHTTPClientService(), |
|
28 | - \OC::$server->getConfig() |
|
29 | - ); |
|
30 | - $updateChecker = new \OCA\UpdateNotification\UpdateChecker( |
|
31 | - $updater |
|
32 | - ); |
|
26 | + $updater = new \OC\Updater\VersionCheck( |
|
27 | + \OC::$server->getHTTPClientService(), |
|
28 | + \OC::$server->getConfig() |
|
29 | + ); |
|
30 | + $updateChecker = new \OCA\UpdateNotification\UpdateChecker( |
|
31 | + $updater |
|
32 | + ); |
|
33 | 33 | |
34 | - $userObject = \OC::$server->getUserSession()->getUser(); |
|
35 | - if($userObject !== null) { |
|
36 | - if(\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && |
|
37 | - !\OC::$server->getAppManager()->isEnabledForUser('notifications')) { |
|
38 | - if($updateChecker->getUpdateState() !== []) { |
|
39 | - \OCP\Util::addScript('updatenotification', 'notification'); |
|
40 | - OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
34 | + $userObject = \OC::$server->getUserSession()->getUser(); |
|
35 | + if($userObject !== null) { |
|
36 | + if(\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && |
|
37 | + !\OC::$server->getAppManager()->isEnabledForUser('notifications')) { |
|
38 | + if($updateChecker->getUpdateState() !== []) { |
|
39 | + \OCP\Util::addScript('updatenotification', 'notification'); |
|
40 | + OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); |
|
41 | + } |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - $manager = \OC::$server->getNotificationManager(); |
|
46 | - $manager->registerNotifier(function() use ($manager) { |
|
47 | - return \OC::$server->query(\OCA\UpdateNotification\Notification\Notifier::class); |
|
48 | - }, function() { |
|
49 | - $l = \OC::$server->getL10N('updatenotification'); |
|
50 | - return [ |
|
51 | - 'id' => 'updatenotification', |
|
52 | - 'name' => $l->t('Update notifications'), |
|
53 | - ]; |
|
54 | - }); |
|
45 | + $manager = \OC::$server->getNotificationManager(); |
|
46 | + $manager->registerNotifier(function() use ($manager) { |
|
47 | + return \OC::$server->query(\OCA\UpdateNotification\Notification\Notifier::class); |
|
48 | + }, function() { |
|
49 | + $l = \OC::$server->getL10N('updatenotification'); |
|
50 | + return [ |
|
51 | + 'id' => 'updatenotification', |
|
52 | + 'name' => $l->t('Update notifications'), |
|
53 | + ]; |
|
54 | + }); |
|
55 | 55 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | */ |
24 | 24 | |
25 | -if(\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { |
|
25 | +if (\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { |
|
26 | 26 | $updater = new \OC\Updater\VersionCheck( |
27 | 27 | \OC::$server->getHTTPClientService(), |
28 | 28 | \OC::$server->getConfig() |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | ); |
33 | 33 | |
34 | 34 | $userObject = \OC::$server->getUserSession()->getUser(); |
35 | - if($userObject !== null) { |
|
36 | - if(\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && |
|
35 | + if ($userObject !== null) { |
|
36 | + if (\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && |
|
37 | 37 | !\OC::$server->getAppManager()->isEnabledForUser('notifications')) { |
38 | - if($updateChecker->getUpdateState() !== []) { |
|
38 | + if ($updateChecker->getUpdateState() !== []) { |
|
39 | 39 | \OCP\Util::addScript('updatenotification', 'notification'); |
40 | 40 | OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); |
41 | 41 | } |
@@ -1,6 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - |
|
4 | 3 | * |
5 | 4 | * @author Bjoern Schiessle <[email protected]> |
6 | 5 | * @author Jan-Christoph Borchardt <[email protected]> |
@@ -81,7 +81,7 @@ |
||
81 | 81 | </form> |
82 | 82 | </div> |
83 | 83 | |
84 | - <div id="theming-preview" style="background-color:<?php p($_['color']);?>; background-image:url(<?php p($_['background']); ?>);"> |
|
84 | + <div id="theming-preview" style="background-color:<?php p($_['color']); ?>; background-image:url(<?php p($_['background']); ?>);"> |
|
85 | 85 | <img src="<?php p($_['logo']); ?>" id="theming-preview-logo" /> |
86 | 86 | </div> |
87 | 87 | <?php } ?> |
@@ -31,196 +31,196 @@ |
||
31 | 31 | |
32 | 32 | class ThemingDefaults extends \OC_Defaults { |
33 | 33 | |
34 | - /** @var IConfig */ |
|
35 | - private $config; |
|
36 | - /** @var IL10N */ |
|
37 | - private $l; |
|
38 | - /** @var IURLGenerator */ |
|
39 | - private $urlGenerator; |
|
40 | - /** @var IRootFolder */ |
|
41 | - private $rootFolder; |
|
42 | - /** @var ICacheFactory */ |
|
43 | - private $cacheFactory; |
|
44 | - /** @var string */ |
|
45 | - private $name; |
|
46 | - /** @var string */ |
|
47 | - private $url; |
|
48 | - /** @var string */ |
|
49 | - private $slogan; |
|
50 | - /** @var string */ |
|
51 | - private $color; |
|
52 | - |
|
53 | - /** |
|
54 | - * ThemingDefaults constructor. |
|
55 | - * |
|
56 | - * @param IConfig $config |
|
57 | - * @param IL10N $l |
|
58 | - * @param IURLGenerator $urlGenerator |
|
59 | - * @param \OC_Defaults $defaults |
|
60 | - * @param IRootFolder $rootFolder |
|
61 | - * @param ICacheFactory $cacheFactory |
|
62 | - */ |
|
63 | - public function __construct(IConfig $config, |
|
64 | - IL10N $l, |
|
65 | - IURLGenerator $urlGenerator, |
|
66 | - \OC_Defaults $defaults, |
|
67 | - IRootFolder $rootFolder, |
|
68 | - ICacheFactory $cacheFactory |
|
69 | - ) { |
|
70 | - parent::__construct(); |
|
71 | - $this->config = $config; |
|
72 | - $this->l = $l; |
|
73 | - $this->urlGenerator = $urlGenerator; |
|
74 | - $this->rootFolder = $rootFolder; |
|
75 | - $this->cacheFactory = $cacheFactory; |
|
76 | - |
|
77 | - $this->name = $defaults->getName(); |
|
78 | - $this->url = $defaults->getBaseUrl(); |
|
79 | - $this->slogan = $defaults->getSlogan(); |
|
80 | - $this->color = $defaults->getMailHeaderColor(); |
|
81 | - } |
|
82 | - |
|
83 | - public function getName() { |
|
84 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
85 | - } |
|
86 | - |
|
87 | - public function getHTMLName() { |
|
88 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
89 | - } |
|
90 | - |
|
91 | - public function getTitle() { |
|
92 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
93 | - } |
|
94 | - |
|
95 | - public function getEntity() { |
|
96 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
97 | - } |
|
98 | - |
|
99 | - public function getBaseUrl() { |
|
100 | - return $this->config->getAppValue('theming', 'url', $this->url); |
|
101 | - } |
|
102 | - |
|
103 | - public function getSlogan() { |
|
104 | - return $this->config->getAppValue('theming', 'slogan', $this->slogan); |
|
105 | - } |
|
106 | - |
|
107 | - public function getShortFooter() { |
|
108 | - $slogan = $this->getSlogan(); |
|
109 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
110 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
111 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
112 | - |
|
113 | - return $footer; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * Color that is used for the header as well as for mail headers |
|
118 | - * |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public function getMailHeaderColor() { |
|
122 | - return $this->config->getAppValue('theming', 'color', $this->color); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Themed logo url |
|
127 | - * |
|
128 | - * @return string |
|
129 | - */ |
|
130 | - public function getLogo() { |
|
131 | - $logo = $this->config->getAppValue('theming', 'logoMime'); |
|
132 | - if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
133 | - return $this->urlGenerator->imagePath('core','logo.svg'); |
|
134 | - } else { |
|
135 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); |
|
136 | - } |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Themed background image url |
|
141 | - * |
|
142 | - * @return string |
|
143 | - */ |
|
144 | - public function getBackground() { |
|
145 | - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime'); |
|
146 | - if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) { |
|
147 | - return $this->urlGenerator->imagePath('core','background.jpg'); |
|
148 | - } else { |
|
149 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Check if Imagemagick is enabled and if SVG is supported |
|
155 | - * otherwise we can't render custom icons |
|
156 | - * |
|
157 | - * @return bool |
|
158 | - */ |
|
159 | - public function shouldReplaceIcons() { |
|
160 | - $cache = $this->cacheFactory->create('theming'); |
|
161 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
162 | - return (bool)$value; |
|
163 | - } |
|
164 | - $value = false; |
|
165 | - if(extension_loaded('imagick')) { |
|
166 | - $checkImagick = new \Imagick(); |
|
167 | - if (count($checkImagick->queryFormats('SVG')) >= 1) { |
|
168 | - $value = true; |
|
169 | - } |
|
170 | - $checkImagick->clear(); |
|
171 | - } |
|
172 | - $cache->set('shouldReplaceIcons', $value); |
|
173 | - return $value; |
|
174 | - } |
|
175 | - |
|
176 | - /** |
|
177 | - * Increases the cache buster key |
|
178 | - */ |
|
179 | - private function increaseCacheBuster() { |
|
180 | - $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
181 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
182 | - } |
|
183 | - |
|
184 | - /** |
|
185 | - * Update setting in the database |
|
186 | - * |
|
187 | - * @param string $setting |
|
188 | - * @param string $value |
|
189 | - */ |
|
190 | - public function set($setting, $value) { |
|
191 | - $this->config->setAppValue('theming', $setting, $value); |
|
192 | - $this->increaseCacheBuster(); |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Revert settings to the default value |
|
197 | - * |
|
198 | - * @param string $setting setting which should be reverted |
|
199 | - * @return string default value |
|
200 | - */ |
|
201 | - public function undo($setting) { |
|
202 | - $this->config->deleteAppValue('theming', $setting); |
|
203 | - $this->increaseCacheBuster(); |
|
204 | - |
|
205 | - switch ($setting) { |
|
206 | - case 'name': |
|
207 | - $returnValue = $this->getEntity(); |
|
208 | - break; |
|
209 | - case 'url': |
|
210 | - $returnValue = $this->getBaseUrl(); |
|
211 | - break; |
|
212 | - case 'slogan': |
|
213 | - $returnValue = $this->getSlogan(); |
|
214 | - break; |
|
215 | - case 'color': |
|
216 | - $returnValue = $this->getMailHeaderColor(); |
|
217 | - break; |
|
218 | - default: |
|
219 | - $returnValue = ''; |
|
220 | - break; |
|
221 | - } |
|
222 | - |
|
223 | - return $returnValue; |
|
224 | - } |
|
34 | + /** @var IConfig */ |
|
35 | + private $config; |
|
36 | + /** @var IL10N */ |
|
37 | + private $l; |
|
38 | + /** @var IURLGenerator */ |
|
39 | + private $urlGenerator; |
|
40 | + /** @var IRootFolder */ |
|
41 | + private $rootFolder; |
|
42 | + /** @var ICacheFactory */ |
|
43 | + private $cacheFactory; |
|
44 | + /** @var string */ |
|
45 | + private $name; |
|
46 | + /** @var string */ |
|
47 | + private $url; |
|
48 | + /** @var string */ |
|
49 | + private $slogan; |
|
50 | + /** @var string */ |
|
51 | + private $color; |
|
52 | + |
|
53 | + /** |
|
54 | + * ThemingDefaults constructor. |
|
55 | + * |
|
56 | + * @param IConfig $config |
|
57 | + * @param IL10N $l |
|
58 | + * @param IURLGenerator $urlGenerator |
|
59 | + * @param \OC_Defaults $defaults |
|
60 | + * @param IRootFolder $rootFolder |
|
61 | + * @param ICacheFactory $cacheFactory |
|
62 | + */ |
|
63 | + public function __construct(IConfig $config, |
|
64 | + IL10N $l, |
|
65 | + IURLGenerator $urlGenerator, |
|
66 | + \OC_Defaults $defaults, |
|
67 | + IRootFolder $rootFolder, |
|
68 | + ICacheFactory $cacheFactory |
|
69 | + ) { |
|
70 | + parent::__construct(); |
|
71 | + $this->config = $config; |
|
72 | + $this->l = $l; |
|
73 | + $this->urlGenerator = $urlGenerator; |
|
74 | + $this->rootFolder = $rootFolder; |
|
75 | + $this->cacheFactory = $cacheFactory; |
|
76 | + |
|
77 | + $this->name = $defaults->getName(); |
|
78 | + $this->url = $defaults->getBaseUrl(); |
|
79 | + $this->slogan = $defaults->getSlogan(); |
|
80 | + $this->color = $defaults->getMailHeaderColor(); |
|
81 | + } |
|
82 | + |
|
83 | + public function getName() { |
|
84 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
85 | + } |
|
86 | + |
|
87 | + public function getHTMLName() { |
|
88 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
89 | + } |
|
90 | + |
|
91 | + public function getTitle() { |
|
92 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
93 | + } |
|
94 | + |
|
95 | + public function getEntity() { |
|
96 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
97 | + } |
|
98 | + |
|
99 | + public function getBaseUrl() { |
|
100 | + return $this->config->getAppValue('theming', 'url', $this->url); |
|
101 | + } |
|
102 | + |
|
103 | + public function getSlogan() { |
|
104 | + return $this->config->getAppValue('theming', 'slogan', $this->slogan); |
|
105 | + } |
|
106 | + |
|
107 | + public function getShortFooter() { |
|
108 | + $slogan = $this->getSlogan(); |
|
109 | + $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
110 | + ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
111 | + ($slogan !== '' ? ' – ' . $slogan : ''); |
|
112 | + |
|
113 | + return $footer; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * Color that is used for the header as well as for mail headers |
|
118 | + * |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public function getMailHeaderColor() { |
|
122 | + return $this->config->getAppValue('theming', 'color', $this->color); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Themed logo url |
|
127 | + * |
|
128 | + * @return string |
|
129 | + */ |
|
130 | + public function getLogo() { |
|
131 | + $logo = $this->config->getAppValue('theming', 'logoMime'); |
|
132 | + if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
133 | + return $this->urlGenerator->imagePath('core','logo.svg'); |
|
134 | + } else { |
|
135 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); |
|
136 | + } |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Themed background image url |
|
141 | + * |
|
142 | + * @return string |
|
143 | + */ |
|
144 | + public function getBackground() { |
|
145 | + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime'); |
|
146 | + if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) { |
|
147 | + return $this->urlGenerator->imagePath('core','background.jpg'); |
|
148 | + } else { |
|
149 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Check if Imagemagick is enabled and if SVG is supported |
|
155 | + * otherwise we can't render custom icons |
|
156 | + * |
|
157 | + * @return bool |
|
158 | + */ |
|
159 | + public function shouldReplaceIcons() { |
|
160 | + $cache = $this->cacheFactory->create('theming'); |
|
161 | + if($value = $cache->get('shouldReplaceIcons')) { |
|
162 | + return (bool)$value; |
|
163 | + } |
|
164 | + $value = false; |
|
165 | + if(extension_loaded('imagick')) { |
|
166 | + $checkImagick = new \Imagick(); |
|
167 | + if (count($checkImagick->queryFormats('SVG')) >= 1) { |
|
168 | + $value = true; |
|
169 | + } |
|
170 | + $checkImagick->clear(); |
|
171 | + } |
|
172 | + $cache->set('shouldReplaceIcons', $value); |
|
173 | + return $value; |
|
174 | + } |
|
175 | + |
|
176 | + /** |
|
177 | + * Increases the cache buster key |
|
178 | + */ |
|
179 | + private function increaseCacheBuster() { |
|
180 | + $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
181 | + $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
182 | + } |
|
183 | + |
|
184 | + /** |
|
185 | + * Update setting in the database |
|
186 | + * |
|
187 | + * @param string $setting |
|
188 | + * @param string $value |
|
189 | + */ |
|
190 | + public function set($setting, $value) { |
|
191 | + $this->config->setAppValue('theming', $setting, $value); |
|
192 | + $this->increaseCacheBuster(); |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Revert settings to the default value |
|
197 | + * |
|
198 | + * @param string $setting setting which should be reverted |
|
199 | + * @return string default value |
|
200 | + */ |
|
201 | + public function undo($setting) { |
|
202 | + $this->config->deleteAppValue('theming', $setting); |
|
203 | + $this->increaseCacheBuster(); |
|
204 | + |
|
205 | + switch ($setting) { |
|
206 | + case 'name': |
|
207 | + $returnValue = $this->getEntity(); |
|
208 | + break; |
|
209 | + case 'url': |
|
210 | + $returnValue = $this->getBaseUrl(); |
|
211 | + break; |
|
212 | + case 'slogan': |
|
213 | + $returnValue = $this->getSlogan(); |
|
214 | + break; |
|
215 | + case 'color': |
|
216 | + $returnValue = $this->getMailHeaderColor(); |
|
217 | + break; |
|
218 | + default: |
|
219 | + $returnValue = ''; |
|
220 | + break; |
|
221 | + } |
|
222 | + |
|
223 | + return $returnValue; |
|
224 | + } |
|
225 | 225 | |
226 | 226 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | public function getShortFooter() { |
108 | 108 | $slogan = $this->getSlogan(); |
109 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
110 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
111 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
109 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
110 | + ' rel="noreferrer">'.$this->getEntity().'</a>'. |
|
111 | + ($slogan !== '' ? ' – '.$slogan : ''); |
|
112 | 112 | |
113 | 113 | return $footer; |
114 | 114 | } |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getLogo() { |
131 | 131 | $logo = $this->config->getAppValue('theming', 'logoMime'); |
132 | - if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
133 | - return $this->urlGenerator->imagePath('core','logo.svg'); |
|
132 | + if (!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
133 | + return $this->urlGenerator->imagePath('core', 'logo.svg'); |
|
134 | 134 | } else { |
135 | 135 | return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); |
136 | 136 | } |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function getBackground() { |
145 | 145 | $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime'); |
146 | - if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) { |
|
147 | - return $this->urlGenerator->imagePath('core','background.jpg'); |
|
146 | + if (!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) { |
|
147 | + return $this->urlGenerator->imagePath('core', 'background.jpg'); |
|
148 | 148 | } else { |
149 | 149 | return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); |
150 | 150 | } |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function shouldReplaceIcons() { |
160 | 160 | $cache = $this->cacheFactory->create('theming'); |
161 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
162 | - return (bool)$value; |
|
161 | + if ($value = $cache->get('shouldReplaceIcons')) { |
|
162 | + return (bool) $value; |
|
163 | 163 | } |
164 | 164 | $value = false; |
165 | - if(extension_loaded('imagick')) { |
|
165 | + if (extension_loaded('imagick')) { |
|
166 | 166 | $checkImagick = new \Imagick(); |
167 | 167 | if (count($checkImagick->queryFormats('SVG')) >= 1) { |
168 | 168 | $value = true; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | private function increaseCacheBuster() { |
180 | 180 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
181 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
181 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -36,142 +36,142 @@ |
||
36 | 36 | use OCP\IConfig; |
37 | 37 | |
38 | 38 | class IconController extends Controller { |
39 | - /** @var ThemingDefaults */ |
|
40 | - private $themingDefaults; |
|
41 | - /** @var Util */ |
|
42 | - private $util; |
|
43 | - /** @var ITimeFactory */ |
|
44 | - private $timeFactory; |
|
45 | - /** @var IConfig */ |
|
46 | - private $config; |
|
47 | - /** @var IconBuilder */ |
|
48 | - private $iconBuilder; |
|
49 | - /** @var ImageManager */ |
|
50 | - private $imageManager; |
|
39 | + /** @var ThemingDefaults */ |
|
40 | + private $themingDefaults; |
|
41 | + /** @var Util */ |
|
42 | + private $util; |
|
43 | + /** @var ITimeFactory */ |
|
44 | + private $timeFactory; |
|
45 | + /** @var IConfig */ |
|
46 | + private $config; |
|
47 | + /** @var IconBuilder */ |
|
48 | + private $iconBuilder; |
|
49 | + /** @var ImageManager */ |
|
50 | + private $imageManager; |
|
51 | 51 | |
52 | - /** |
|
53 | - * IconController constructor. |
|
54 | - * |
|
55 | - * @param string $appName |
|
56 | - * @param IRequest $request |
|
57 | - * @param ThemingDefaults $themingDefaults |
|
58 | - * @param Util $util |
|
59 | - * @param ITimeFactory $timeFactory |
|
60 | - * @param IConfig $config |
|
61 | - * @param IconBuilder $iconBuilder |
|
62 | - * @param ImageManager $imageManager |
|
63 | - */ |
|
64 | - public function __construct( |
|
65 | - $appName, |
|
66 | - IRequest $request, |
|
67 | - ThemingDefaults $themingDefaults, |
|
68 | - Util $util, |
|
69 | - ITimeFactory $timeFactory, |
|
70 | - IConfig $config, |
|
71 | - IconBuilder $iconBuilder, |
|
72 | - ImageManager $imageManager |
|
73 | - ) { |
|
74 | - parent::__construct($appName, $request); |
|
52 | + /** |
|
53 | + * IconController constructor. |
|
54 | + * |
|
55 | + * @param string $appName |
|
56 | + * @param IRequest $request |
|
57 | + * @param ThemingDefaults $themingDefaults |
|
58 | + * @param Util $util |
|
59 | + * @param ITimeFactory $timeFactory |
|
60 | + * @param IConfig $config |
|
61 | + * @param IconBuilder $iconBuilder |
|
62 | + * @param ImageManager $imageManager |
|
63 | + */ |
|
64 | + public function __construct( |
|
65 | + $appName, |
|
66 | + IRequest $request, |
|
67 | + ThemingDefaults $themingDefaults, |
|
68 | + Util $util, |
|
69 | + ITimeFactory $timeFactory, |
|
70 | + IConfig $config, |
|
71 | + IconBuilder $iconBuilder, |
|
72 | + ImageManager $imageManager |
|
73 | + ) { |
|
74 | + parent::__construct($appName, $request); |
|
75 | 75 | |
76 | - $this->themingDefaults = $themingDefaults; |
|
77 | - $this->util = $util; |
|
78 | - $this->timeFactory = $timeFactory; |
|
79 | - $this->config = $config; |
|
80 | - $this->iconBuilder = $iconBuilder; |
|
81 | - $this->imageManager = $imageManager; |
|
82 | - } |
|
76 | + $this->themingDefaults = $themingDefaults; |
|
77 | + $this->util = $util; |
|
78 | + $this->timeFactory = $timeFactory; |
|
79 | + $this->config = $config; |
|
80 | + $this->iconBuilder = $iconBuilder; |
|
81 | + $this->imageManager = $imageManager; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @PublicPage |
|
86 | - * @NoCSRFRequired |
|
87 | - * |
|
88 | - * @param $app string app name |
|
89 | - * @param $image string image file name (svg required) |
|
90 | - * @return FileDisplayResponse|NotFoundResponse |
|
91 | - */ |
|
92 | - public function getThemedIcon($app, $image) { |
|
93 | - try { |
|
94 | - $iconFile = $this->imageManager->getCachedImage("icon-" . $app . '-' . str_replace("/","_",$image)); |
|
95 | - } catch (NotFoundException $exception) { |
|
96 | - $icon = $this->iconBuilder->colorSvg($app, $image); |
|
97 | - if ($icon === false || $icon === "") { |
|
98 | - return new NotFoundResponse(); |
|
99 | - } |
|
100 | - $iconFile = $this->imageManager->setCachedImage("icon-" . $app . '-' . str_replace("/","_",$image), $icon); |
|
101 | - } |
|
102 | - if ($iconFile !== false) { |
|
103 | - $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); |
|
104 | - $response->cacheFor(86400); |
|
105 | - $expires = new \DateTime(); |
|
106 | - $expires->setTimestamp($this->timeFactory->getTime()); |
|
107 | - $expires->add(new \DateInterval('PT24H')); |
|
108 | - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
|
109 | - $response->addHeader('Pragma', 'cache'); |
|
110 | - return $response; |
|
111 | - } else { |
|
112 | - return new NotFoundResponse(); |
|
113 | - } |
|
114 | - } |
|
84 | + /** |
|
85 | + * @PublicPage |
|
86 | + * @NoCSRFRequired |
|
87 | + * |
|
88 | + * @param $app string app name |
|
89 | + * @param $image string image file name (svg required) |
|
90 | + * @return FileDisplayResponse|NotFoundResponse |
|
91 | + */ |
|
92 | + public function getThemedIcon($app, $image) { |
|
93 | + try { |
|
94 | + $iconFile = $this->imageManager->getCachedImage("icon-" . $app . '-' . str_replace("/","_",$image)); |
|
95 | + } catch (NotFoundException $exception) { |
|
96 | + $icon = $this->iconBuilder->colorSvg($app, $image); |
|
97 | + if ($icon === false || $icon === "") { |
|
98 | + return new NotFoundResponse(); |
|
99 | + } |
|
100 | + $iconFile = $this->imageManager->setCachedImage("icon-" . $app . '-' . str_replace("/","_",$image), $icon); |
|
101 | + } |
|
102 | + if ($iconFile !== false) { |
|
103 | + $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); |
|
104 | + $response->cacheFor(86400); |
|
105 | + $expires = new \DateTime(); |
|
106 | + $expires->setTimestamp($this->timeFactory->getTime()); |
|
107 | + $expires->add(new \DateInterval('PT24H')); |
|
108 | + $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
|
109 | + $response->addHeader('Pragma', 'cache'); |
|
110 | + return $response; |
|
111 | + } else { |
|
112 | + return new NotFoundResponse(); |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Return a 32x32 favicon as png |
|
118 | - * |
|
119 | - * @PublicPage |
|
120 | - * @NoCSRFRequired |
|
121 | - * |
|
122 | - * @param $app string app name |
|
123 | - * @return FileDisplayResponse|NotFoundResponse |
|
124 | - */ |
|
125 | - public function getFavicon($app = "core") { |
|
126 | - if ($this->themingDefaults->shouldReplaceIcons()) { |
|
127 | - try { |
|
128 | - $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); |
|
129 | - } catch (NotFoundException $exception) { |
|
130 | - $icon = $this->iconBuilder->getFavicon($app); |
|
131 | - $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); |
|
132 | - } |
|
133 | - if ($iconFile !== false) { |
|
134 | - $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
|
135 | - $response->cacheFor(86400); |
|
136 | - $expires = new \DateTime(); |
|
137 | - $expires->setTimestamp($this->timeFactory->getTime()); |
|
138 | - $expires->add(new \DateInterval('PT24H')); |
|
139 | - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
|
140 | - $response->addHeader('Pragma', 'cache'); |
|
141 | - return $response; |
|
142 | - } |
|
143 | - } |
|
144 | - return new NotFoundResponse(); |
|
145 | - } |
|
116 | + /** |
|
117 | + * Return a 32x32 favicon as png |
|
118 | + * |
|
119 | + * @PublicPage |
|
120 | + * @NoCSRFRequired |
|
121 | + * |
|
122 | + * @param $app string app name |
|
123 | + * @return FileDisplayResponse|NotFoundResponse |
|
124 | + */ |
|
125 | + public function getFavicon($app = "core") { |
|
126 | + if ($this->themingDefaults->shouldReplaceIcons()) { |
|
127 | + try { |
|
128 | + $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); |
|
129 | + } catch (NotFoundException $exception) { |
|
130 | + $icon = $this->iconBuilder->getFavicon($app); |
|
131 | + $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); |
|
132 | + } |
|
133 | + if ($iconFile !== false) { |
|
134 | + $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
|
135 | + $response->cacheFor(86400); |
|
136 | + $expires = new \DateTime(); |
|
137 | + $expires->setTimestamp($this->timeFactory->getTime()); |
|
138 | + $expires->add(new \DateInterval('PT24H')); |
|
139 | + $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
|
140 | + $response->addHeader('Pragma', 'cache'); |
|
141 | + return $response; |
|
142 | + } |
|
143 | + } |
|
144 | + return new NotFoundResponse(); |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * Return a 512x512 icon for touch devices |
|
149 | - * |
|
150 | - * @PublicPage |
|
151 | - * @NoCSRFRequired |
|
152 | - * |
|
153 | - * @param $app string app name |
|
154 | - * @return FileDisplayResponse|NotFoundResponse |
|
155 | - */ |
|
156 | - public function getTouchIcon($app = "core") { |
|
157 | - if ($this->themingDefaults->shouldReplaceIcons()) { |
|
158 | - try { |
|
159 | - $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); |
|
160 | - } catch (NotFoundException $exception) { |
|
161 | - $icon = $this->iconBuilder->getTouchIcon($app); |
|
162 | - $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); |
|
163 | - } |
|
164 | - if ($iconFile !== false) { |
|
165 | - $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); |
|
166 | - $response->cacheFor(86400); |
|
167 | - $expires = new \DateTime(); |
|
168 | - $expires->setTimestamp($this->timeFactory->getTime()); |
|
169 | - $expires->add(new \DateInterval('PT24H')); |
|
170 | - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
|
171 | - $response->addHeader('Pragma', 'cache'); |
|
172 | - return $response; |
|
173 | - } |
|
174 | - } |
|
175 | - return new NotFoundResponse(); |
|
176 | - } |
|
147 | + /** |
|
148 | + * Return a 512x512 icon for touch devices |
|
149 | + * |
|
150 | + * @PublicPage |
|
151 | + * @NoCSRFRequired |
|
152 | + * |
|
153 | + * @param $app string app name |
|
154 | + * @return FileDisplayResponse|NotFoundResponse |
|
155 | + */ |
|
156 | + public function getTouchIcon($app = "core") { |
|
157 | + if ($this->themingDefaults->shouldReplaceIcons()) { |
|
158 | + try { |
|
159 | + $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); |
|
160 | + } catch (NotFoundException $exception) { |
|
161 | + $icon = $this->iconBuilder->getTouchIcon($app); |
|
162 | + $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); |
|
163 | + } |
|
164 | + if ($iconFile !== false) { |
|
165 | + $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); |
|
166 | + $response->cacheFor(86400); |
|
167 | + $expires = new \DateTime(); |
|
168 | + $expires->setTimestamp($this->timeFactory->getTime()); |
|
169 | + $expires->add(new \DateInterval('PT24H')); |
|
170 | + $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
|
171 | + $response->addHeader('Pragma', 'cache'); |
|
172 | + return $response; |
|
173 | + } |
|
174 | + } |
|
175 | + return new NotFoundResponse(); |
|
176 | + } |
|
177 | 177 | } |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function getThemedIcon($app, $image) { |
93 | 93 | try { |
94 | - $iconFile = $this->imageManager->getCachedImage("icon-" . $app . '-' . str_replace("/","_",$image)); |
|
94 | + $iconFile = $this->imageManager->getCachedImage("icon-".$app.'-'.str_replace("/", "_", $image)); |
|
95 | 95 | } catch (NotFoundException $exception) { |
96 | 96 | $icon = $this->iconBuilder->colorSvg($app, $image); |
97 | 97 | if ($icon === false || $icon === "") { |
98 | 98 | return new NotFoundResponse(); |
99 | 99 | } |
100 | - $iconFile = $this->imageManager->setCachedImage("icon-" . $app . '-' . str_replace("/","_",$image), $icon); |
|
100 | + $iconFile = $this->imageManager->setCachedImage("icon-".$app.'-'.str_replace("/", "_", $image), $icon); |
|
101 | 101 | } |
102 | 102 | if ($iconFile !== false) { |
103 | 103 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | public function getFavicon($app = "core") { |
126 | 126 | if ($this->themingDefaults->shouldReplaceIcons()) { |
127 | 127 | try { |
128 | - $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); |
|
128 | + $iconFile = $this->imageManager->getCachedImage('favIcon-'.$app); |
|
129 | 129 | } catch (NotFoundException $exception) { |
130 | 130 | $icon = $this->iconBuilder->getFavicon($app); |
131 | - $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); |
|
131 | + $iconFile = $this->imageManager->setCachedImage('favIcon-'.$app, $icon); |
|
132 | 132 | } |
133 | 133 | if ($iconFile !== false) { |
134 | 134 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | public function getTouchIcon($app = "core") { |
157 | 157 | if ($this->themingDefaults->shouldReplaceIcons()) { |
158 | 158 | try { |
159 | - $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); |
|
159 | + $iconFile = $this->imageManager->getCachedImage('touchIcon-'.$app); |
|
160 | 160 | } catch (NotFoundException $exception) { |
161 | 161 | $icon = $this->iconBuilder->getTouchIcon($app); |
162 | - $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); |
|
162 | + $iconFile = $this->imageManager->setCachedImage('touchIcon-'.$app, $icon); |
|
163 | 163 | } |
164 | 164 | if ($iconFile !== false) { |
165 | 165 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); |
@@ -28,162 +28,162 @@ |
||
28 | 28 | use OCP\App\AppPathNotFoundException; |
29 | 29 | |
30 | 30 | class IconBuilder { |
31 | - /** @var ThemingDefaults */ |
|
32 | - private $themingDefaults; |
|
33 | - /** @var Util */ |
|
34 | - private $util; |
|
35 | - |
|
36 | - /** |
|
37 | - * IconBuilder constructor. |
|
38 | - * |
|
39 | - * @param ThemingDefaults $themingDefaults |
|
40 | - * @param Util $util |
|
41 | - */ |
|
42 | - public function __construct( |
|
43 | - ThemingDefaults $themingDefaults, |
|
44 | - Util $util |
|
45 | - ) { |
|
46 | - $this->themingDefaults = $themingDefaults; |
|
47 | - $this->util = $util; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * @param $app string app name |
|
52 | - * @return string|false image blob |
|
53 | - */ |
|
54 | - public function getFavicon($app) { |
|
55 | - $icon = $this->renderAppIcon($app, 32); |
|
56 | - if($icon === false) { |
|
57 | - return false; |
|
58 | - } |
|
59 | - $icon->setImageFormat("png24"); |
|
60 | - $data = $icon->getImageBlob(); |
|
61 | - $icon->destroy(); |
|
62 | - return $data; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * @param $app string app name |
|
67 | - * @return string|false image blob |
|
68 | - */ |
|
69 | - public function getTouchIcon($app) { |
|
70 | - $icon = $this->renderAppIcon($app, 512); |
|
71 | - if($icon === false) { |
|
72 | - return false; |
|
73 | - } |
|
74 | - $icon->setImageFormat("png24"); |
|
75 | - $data = $icon->getImageBlob(); |
|
76 | - $icon->destroy(); |
|
77 | - return $data; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Render app icon on themed background color |
|
82 | - * fallback to logo |
|
83 | - * |
|
84 | - * @param $app string app name |
|
85 | - * @param $size int size of the icon in px |
|
86 | - * @return Imagick|false |
|
87 | - */ |
|
88 | - public function renderAppIcon($app, $size) { |
|
89 | - try { |
|
90 | - $appIcon = $this->util->getAppIcon($app); |
|
91 | - $appIconContent = file_get_contents($appIcon); |
|
92 | - } catch (AppPathNotFoundException $e) { |
|
93 | - return false; |
|
94 | - } |
|
95 | - |
|
96 | - if($appIconContent === false) { |
|
97 | - return false; |
|
98 | - } |
|
99 | - |
|
100 | - $color = $this->themingDefaults->getMailHeaderColor(); |
|
101 | - $mime = mime_content_type($appIcon); |
|
102 | - |
|
103 | - // generate background image with rounded corners |
|
104 | - $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
105 | - '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
106 | - '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
107 | - '</svg>'; |
|
108 | - // resize svg magic as this seems broken in Imagemagick |
|
109 | - if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
110 | - if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
111 | - $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
|
112 | - } else { |
|
113 | - $svg = $appIconContent; |
|
114 | - } |
|
115 | - $tmp = new Imagick(); |
|
116 | - $tmp->readImageBlob($svg); |
|
117 | - $x = $tmp->getImageWidth(); |
|
118 | - $y = $tmp->getImageHeight(); |
|
119 | - $res = $tmp->getImageResolution(); |
|
120 | - $tmp->destroy(); |
|
121 | - |
|
122 | - if($x>$y) { |
|
123 | - $max = $x; |
|
124 | - } else { |
|
125 | - $max = $y; |
|
126 | - } |
|
127 | - |
|
128 | - // convert svg to resized image |
|
129 | - $appIconFile = new Imagick(); |
|
130 | - $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
131 | - $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
132 | - $appIconFile->setResolution($resX, $resY); |
|
133 | - $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
134 | - $appIconFile->readImageBlob($svg); |
|
135 | - $appIconFile->scaleImage(512, 512, true); |
|
136 | - } else { |
|
137 | - $appIconFile = new Imagick(); |
|
138 | - $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
139 | - $appIconFile->readImageBlob(file_get_contents($appIcon)); |
|
140 | - $appIconFile->scaleImage(512, 512, true); |
|
141 | - } |
|
142 | - |
|
143 | - // offset for icon positioning |
|
144 | - $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
145 | - $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
146 | - $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
147 | - $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
148 | - $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
|
149 | - // center icon |
|
150 | - $offset_w = 512 / 2 - $innerWidth / 2; |
|
151 | - $offset_h = 512 / 2 - $innerHeight / 2; |
|
152 | - |
|
153 | - $appIconFile->setImageFormat("png24"); |
|
154 | - |
|
155 | - $finalIconFile = new Imagick(); |
|
156 | - $finalIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
157 | - $finalIconFile->readImageBlob($background); |
|
158 | - $finalIconFile->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); |
|
159 | - $finalIconFile->setImageArtifact('compose:args', "1,0,-0.5,0.5"); |
|
160 | - $finalIconFile->compositeImage($appIconFile, Imagick::COMPOSITE_ATOP, $offset_w, $offset_h); |
|
161 | - $finalIconFile->setImageFormat('png24'); |
|
162 | - if (defined("Imagick::INTERPOLATE_BICUBIC") === true) { |
|
163 | - $filter = Imagick::INTERPOLATE_BICUBIC; |
|
164 | - } else { |
|
165 | - $filter = Imagick::FILTER_LANCZOS; |
|
166 | - } |
|
167 | - $finalIconFile->resizeImage($size, $size, $filter, 1, false); |
|
168 | - |
|
169 | - $appIconFile->destroy(); |
|
170 | - return $finalIconFile; |
|
171 | - } |
|
172 | - |
|
173 | - public function colorSvg($app, $image) { |
|
174 | - try { |
|
175 | - $imageFile = $this->util->getAppImage($app, $image); |
|
176 | - } catch (AppPathNotFoundException $e) { |
|
177 | - return false; |
|
178 | - } |
|
179 | - $svg = file_get_contents($imageFile); |
|
180 | - if ($svg !== false && $svg !== "") { |
|
181 | - $color = $this->util->elementColor($this->themingDefaults->getMailHeaderColor()); |
|
182 | - $svg = $this->util->colorizeSvg($svg, $color); |
|
183 | - return $svg; |
|
184 | - } else { |
|
185 | - return false; |
|
186 | - } |
|
187 | - } |
|
31 | + /** @var ThemingDefaults */ |
|
32 | + private $themingDefaults; |
|
33 | + /** @var Util */ |
|
34 | + private $util; |
|
35 | + |
|
36 | + /** |
|
37 | + * IconBuilder constructor. |
|
38 | + * |
|
39 | + * @param ThemingDefaults $themingDefaults |
|
40 | + * @param Util $util |
|
41 | + */ |
|
42 | + public function __construct( |
|
43 | + ThemingDefaults $themingDefaults, |
|
44 | + Util $util |
|
45 | + ) { |
|
46 | + $this->themingDefaults = $themingDefaults; |
|
47 | + $this->util = $util; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * @param $app string app name |
|
52 | + * @return string|false image blob |
|
53 | + */ |
|
54 | + public function getFavicon($app) { |
|
55 | + $icon = $this->renderAppIcon($app, 32); |
|
56 | + if($icon === false) { |
|
57 | + return false; |
|
58 | + } |
|
59 | + $icon->setImageFormat("png24"); |
|
60 | + $data = $icon->getImageBlob(); |
|
61 | + $icon->destroy(); |
|
62 | + return $data; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * @param $app string app name |
|
67 | + * @return string|false image blob |
|
68 | + */ |
|
69 | + public function getTouchIcon($app) { |
|
70 | + $icon = $this->renderAppIcon($app, 512); |
|
71 | + if($icon === false) { |
|
72 | + return false; |
|
73 | + } |
|
74 | + $icon->setImageFormat("png24"); |
|
75 | + $data = $icon->getImageBlob(); |
|
76 | + $icon->destroy(); |
|
77 | + return $data; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Render app icon on themed background color |
|
82 | + * fallback to logo |
|
83 | + * |
|
84 | + * @param $app string app name |
|
85 | + * @param $size int size of the icon in px |
|
86 | + * @return Imagick|false |
|
87 | + */ |
|
88 | + public function renderAppIcon($app, $size) { |
|
89 | + try { |
|
90 | + $appIcon = $this->util->getAppIcon($app); |
|
91 | + $appIconContent = file_get_contents($appIcon); |
|
92 | + } catch (AppPathNotFoundException $e) { |
|
93 | + return false; |
|
94 | + } |
|
95 | + |
|
96 | + if($appIconContent === false) { |
|
97 | + return false; |
|
98 | + } |
|
99 | + |
|
100 | + $color = $this->themingDefaults->getMailHeaderColor(); |
|
101 | + $mime = mime_content_type($appIcon); |
|
102 | + |
|
103 | + // generate background image with rounded corners |
|
104 | + $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
105 | + '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
106 | + '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
107 | + '</svg>'; |
|
108 | + // resize svg magic as this seems broken in Imagemagick |
|
109 | + if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
110 | + if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
111 | + $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
|
112 | + } else { |
|
113 | + $svg = $appIconContent; |
|
114 | + } |
|
115 | + $tmp = new Imagick(); |
|
116 | + $tmp->readImageBlob($svg); |
|
117 | + $x = $tmp->getImageWidth(); |
|
118 | + $y = $tmp->getImageHeight(); |
|
119 | + $res = $tmp->getImageResolution(); |
|
120 | + $tmp->destroy(); |
|
121 | + |
|
122 | + if($x>$y) { |
|
123 | + $max = $x; |
|
124 | + } else { |
|
125 | + $max = $y; |
|
126 | + } |
|
127 | + |
|
128 | + // convert svg to resized image |
|
129 | + $appIconFile = new Imagick(); |
|
130 | + $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
131 | + $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
132 | + $appIconFile->setResolution($resX, $resY); |
|
133 | + $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
134 | + $appIconFile->readImageBlob($svg); |
|
135 | + $appIconFile->scaleImage(512, 512, true); |
|
136 | + } else { |
|
137 | + $appIconFile = new Imagick(); |
|
138 | + $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
139 | + $appIconFile->readImageBlob(file_get_contents($appIcon)); |
|
140 | + $appIconFile->scaleImage(512, 512, true); |
|
141 | + } |
|
142 | + |
|
143 | + // offset for icon positioning |
|
144 | + $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
145 | + $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
146 | + $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
147 | + $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
148 | + $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
|
149 | + // center icon |
|
150 | + $offset_w = 512 / 2 - $innerWidth / 2; |
|
151 | + $offset_h = 512 / 2 - $innerHeight / 2; |
|
152 | + |
|
153 | + $appIconFile->setImageFormat("png24"); |
|
154 | + |
|
155 | + $finalIconFile = new Imagick(); |
|
156 | + $finalIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
157 | + $finalIconFile->readImageBlob($background); |
|
158 | + $finalIconFile->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); |
|
159 | + $finalIconFile->setImageArtifact('compose:args', "1,0,-0.5,0.5"); |
|
160 | + $finalIconFile->compositeImage($appIconFile, Imagick::COMPOSITE_ATOP, $offset_w, $offset_h); |
|
161 | + $finalIconFile->setImageFormat('png24'); |
|
162 | + if (defined("Imagick::INTERPOLATE_BICUBIC") === true) { |
|
163 | + $filter = Imagick::INTERPOLATE_BICUBIC; |
|
164 | + } else { |
|
165 | + $filter = Imagick::FILTER_LANCZOS; |
|
166 | + } |
|
167 | + $finalIconFile->resizeImage($size, $size, $filter, 1, false); |
|
168 | + |
|
169 | + $appIconFile->destroy(); |
|
170 | + return $finalIconFile; |
|
171 | + } |
|
172 | + |
|
173 | + public function colorSvg($app, $image) { |
|
174 | + try { |
|
175 | + $imageFile = $this->util->getAppImage($app, $image); |
|
176 | + } catch (AppPathNotFoundException $e) { |
|
177 | + return false; |
|
178 | + } |
|
179 | + $svg = file_get_contents($imageFile); |
|
180 | + if ($svg !== false && $svg !== "") { |
|
181 | + $color = $this->util->elementColor($this->themingDefaults->getMailHeaderColor()); |
|
182 | + $svg = $this->util->colorizeSvg($svg, $color); |
|
183 | + return $svg; |
|
184 | + } else { |
|
185 | + return false; |
|
186 | + } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getFavicon($app) { |
55 | 55 | $icon = $this->renderAppIcon($app, 32); |
56 | - if($icon === false) { |
|
56 | + if ($icon === false) { |
|
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | $icon->setImageFormat("png24"); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function getTouchIcon($app) { |
70 | 70 | $icon = $this->renderAppIcon($app, 512); |
71 | - if($icon === false) { |
|
71 | + if ($icon === false) { |
|
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | $icon->setImageFormat("png24"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
96 | - if($appIconContent === false) { |
|
96 | + if ($appIconContent === false) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | 99 | |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | $mime = mime_content_type($appIcon); |
102 | 102 | |
103 | 103 | // generate background image with rounded corners |
104 | - $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
105 | - '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
106 | - '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
104 | + $background = '<?xml version="1.0" encoding="UTF-8"?>'. |
|
105 | + '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">'. |
|
106 | + '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:'.$color.';" />'. |
|
107 | 107 | '</svg>'; |
108 | 108 | // resize svg magic as this seems broken in Imagemagick |
109 | - if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
110 | - if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
109 | + if ($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
110 | + if (substr($appIconContent, 0, 5) !== "<?xml") { |
|
111 | 111 | $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
112 | 112 | } else { |
113 | 113 | $svg = $appIconContent; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $res = $tmp->getImageResolution(); |
120 | 120 | $tmp->destroy(); |
121 | 121 | |
122 | - if($x>$y) { |
|
122 | + if ($x > $y) { |
|
123 | 123 | $max = $x; |
124 | 124 | } else { |
125 | 125 | $max = $y; |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | |
128 | 128 | // convert svg to resized image |
129 | 129 | $appIconFile = new Imagick(); |
130 | - $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
131 | - $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
130 | + $resX = (int) (512 * $res['x'] / $max * 2.53); |
|
131 | + $resY = (int) (512 * $res['y'] / $max * 2.53); |
|
132 | 132 | $appIconFile->setResolution($resX, $resY); |
133 | 133 | $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
134 | 134 | $appIconFile->readImageBlob($svg); |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | // offset for icon positioning |
144 | - $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
145 | - $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
146 | - $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
147 | - $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
144 | + $border_w = (int) ($appIconFile->getImageWidth() * 0.05); |
|
145 | + $border_h = (int) ($appIconFile->getImageHeight() * 0.05); |
|
146 | + $innerWidth = (int) ($appIconFile->getImageWidth() - $border_w * 2); |
|
147 | + $innerHeight = (int) ($appIconFile->getImageHeight() - $border_h * 2); |
|
148 | 148 | $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
149 | 149 | // center icon |
150 | 150 | $offset_w = 512 / 2 - $innerWidth / 2; |
@@ -33,37 +33,37 @@ |
||
33 | 33 | */ |
34 | 34 | class Capabilities implements ICapability { |
35 | 35 | |
36 | - /** @var ThemingDefaults */ |
|
37 | - protected $theming; |
|
36 | + /** @var ThemingDefaults */ |
|
37 | + protected $theming; |
|
38 | 38 | |
39 | 39 | |
40 | - /** @var IURLGenerator */ |
|
41 | - protected $url; |
|
40 | + /** @var IURLGenerator */ |
|
41 | + protected $url; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param ThemingDefaults $theming |
|
45 | - * @param IURLGenerator $url |
|
46 | - */ |
|
47 | - public function __construct(ThemingDefaults $theming, IURLGenerator $url) { |
|
48 | - $this->theming = $theming; |
|
49 | - $this->url = $url; |
|
50 | - } |
|
43 | + /** |
|
44 | + * @param ThemingDefaults $theming |
|
45 | + * @param IURLGenerator $url |
|
46 | + */ |
|
47 | + public function __construct(ThemingDefaults $theming, IURLGenerator $url) { |
|
48 | + $this->theming = $theming; |
|
49 | + $this->url = $url; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Return this classes capabilities |
|
54 | - * |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function getCapabilities() { |
|
58 | - return [ |
|
59 | - 'theming' => [ |
|
60 | - 'name' => $this->theming->getName(), |
|
61 | - 'url' => $this->theming->getBaseUrl(), |
|
62 | - 'slogan' => $this->theming->getSlogan(), |
|
63 | - 'color' => $this->theming->getMailHeaderColor(), |
|
64 | - 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
|
65 | - 'background' => $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
66 | - ], |
|
67 | - ]; |
|
68 | - } |
|
52 | + /** |
|
53 | + * Return this classes capabilities |
|
54 | + * |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function getCapabilities() { |
|
58 | + return [ |
|
59 | + 'theming' => [ |
|
60 | + 'name' => $this->theming->getName(), |
|
61 | + 'url' => $this->theming->getBaseUrl(), |
|
62 | + 'slogan' => $this->theming->getSlogan(), |
|
63 | + 'color' => $this->theming->getMailHeaderColor(), |
|
64 | + 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
|
65 | + 'background' => $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
66 | + ], |
|
67 | + ]; |
|
68 | + } |
|
69 | 69 | } |
@@ -28,55 +28,55 @@ |
||
28 | 28 | use OCP\Settings\IIconSection; |
29 | 29 | |
30 | 30 | class Section implements IIconSection { |
31 | - /** @var IL10N */ |
|
32 | - private $l; |
|
33 | - /** @var IURLGenerator */ |
|
34 | - private $url; |
|
31 | + /** @var IL10N */ |
|
32 | + private $l; |
|
33 | + /** @var IURLGenerator */ |
|
34 | + private $url; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param IURLGenerator $url |
|
38 | - * @param IL10N $l |
|
39 | - */ |
|
40 | - public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | - $this->url = $url; |
|
42 | - $this->l = $l; |
|
43 | - } |
|
36 | + /** |
|
37 | + * @param IURLGenerator $url |
|
38 | + * @param IL10N $l |
|
39 | + */ |
|
40 | + public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | + $this->url = $url; |
|
42 | + $this->l = $l; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | - * e.g. 'ldap' |
|
48 | - * |
|
49 | - * @returns string |
|
50 | - */ |
|
51 | - public function getID() { |
|
52 | - return 'theming'; |
|
53 | - } |
|
45 | + /** |
|
46 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | + * e.g. 'ldap' |
|
48 | + * |
|
49 | + * @returns string |
|
50 | + */ |
|
51 | + public function getID() { |
|
52 | + return 'theming'; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | - * integration'. Use the L10N service to translate it. |
|
58 | - * |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function getName() { |
|
62 | - return $this->l->t('Theming'); |
|
63 | - } |
|
55 | + /** |
|
56 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | + * integration'. Use the L10N service to translate it. |
|
58 | + * |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function getName() { |
|
62 | + return $this->l->t('Theming'); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return int whether the form should be rather on the top or bottom of |
|
67 | - * the settings navigation. The sections are arranged in ascending order of |
|
68 | - * the priority values. It is required to return a value between 0 and 99. |
|
69 | - * |
|
70 | - * E.g.: 70 |
|
71 | - */ |
|
72 | - public function getPriority() { |
|
73 | - return 30; |
|
74 | - } |
|
65 | + /** |
|
66 | + * @return int whether the form should be rather on the top or bottom of |
|
67 | + * the settings navigation. The sections are arranged in ascending order of |
|
68 | + * the priority values. It is required to return a value between 0 and 99. |
|
69 | + * |
|
70 | + * E.g.: 70 |
|
71 | + */ |
|
72 | + public function getPriority() { |
|
73 | + return 30; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * {@inheritdoc} |
|
78 | - */ |
|
79 | - public function getIcon() { |
|
80 | - return $this->url->imagePath('theming', 'app-dark.svg'); |
|
81 | - } |
|
76 | + /** |
|
77 | + * {@inheritdoc} |
|
78 | + */ |
|
79 | + public function getIcon() { |
|
80 | + return $this->url->imagePath('theming', 'app-dark.svg'); |
|
81 | + } |
|
82 | 82 | } |
@@ -31,72 +31,72 @@ |
||
31 | 31 | use OCP\Settings\ISettings; |
32 | 32 | |
33 | 33 | class Admin implements ISettings { |
34 | - /** @var IConfig */ |
|
35 | - private $config; |
|
36 | - /** @var IL10N */ |
|
37 | - private $l; |
|
38 | - /** @var ThemingDefaults */ |
|
39 | - private $themingDefaults; |
|
40 | - /** @var IURLGenerator */ |
|
41 | - private $urlGenerator; |
|
34 | + /** @var IConfig */ |
|
35 | + private $config; |
|
36 | + /** @var IL10N */ |
|
37 | + private $l; |
|
38 | + /** @var ThemingDefaults */ |
|
39 | + private $themingDefaults; |
|
40 | + /** @var IURLGenerator */ |
|
41 | + private $urlGenerator; |
|
42 | 42 | |
43 | - public function __construct(IConfig $config, |
|
44 | - IL10N $l, |
|
45 | - ThemingDefaults $themingDefaults, |
|
46 | - IURLGenerator $urlGenerator) { |
|
47 | - $this->config = $config; |
|
48 | - $this->l = $l; |
|
49 | - $this->themingDefaults = $themingDefaults; |
|
50 | - $this->urlGenerator = $urlGenerator; |
|
51 | - } |
|
43 | + public function __construct(IConfig $config, |
|
44 | + IL10N $l, |
|
45 | + ThemingDefaults $themingDefaults, |
|
46 | + IURLGenerator $urlGenerator) { |
|
47 | + $this->config = $config; |
|
48 | + $this->l = $l; |
|
49 | + $this->themingDefaults = $themingDefaults; |
|
50 | + $this->urlGenerator = $urlGenerator; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return TemplateResponse |
|
55 | - */ |
|
56 | - public function getForm() { |
|
57 | - $path = $this->urlGenerator->linkToRoute('theming.Theming.updateLogo'); |
|
53 | + /** |
|
54 | + * @return TemplateResponse |
|
55 | + */ |
|
56 | + public function getForm() { |
|
57 | + $path = $this->urlGenerator->linkToRoute('theming.Theming.updateLogo'); |
|
58 | 58 | |
59 | - $themable = true; |
|
60 | - $errorMessage = ''; |
|
61 | - $theme = $this->config->getSystemValue('theme', ''); |
|
62 | - if ($theme !== '') { |
|
63 | - $themable = false; |
|
64 | - $errorMessage = $this->l->t('You are already using a custom theme'); |
|
65 | - } |
|
59 | + $themable = true; |
|
60 | + $errorMessage = ''; |
|
61 | + $theme = $this->config->getSystemValue('theme', ''); |
|
62 | + if ($theme !== '') { |
|
63 | + $themable = false; |
|
64 | + $errorMessage = $this->l->t('You are already using a custom theme'); |
|
65 | + } |
|
66 | 66 | |
67 | - $parameters = [ |
|
68 | - 'themable' => $themable, |
|
69 | - 'errorMessage' => $errorMessage, |
|
70 | - 'name' => $this->themingDefaults->getEntity(), |
|
71 | - 'url' => $this->themingDefaults->getBaseUrl(), |
|
72 | - 'slogan' => $this->themingDefaults->getSlogan(), |
|
73 | - 'color' => $this->themingDefaults->getMailHeaderColor(), |
|
74 | - 'logo' => $this->themingDefaults->getLogo(), |
|
75 | - 'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''), |
|
76 | - 'background' => $this->themingDefaults->getBackground(), |
|
77 | - 'backgroundMime' => $this->config->getAppValue('theming', 'backgroundMime', ''), |
|
78 | - 'uploadLogoRoute' => $path, |
|
79 | - ]; |
|
67 | + $parameters = [ |
|
68 | + 'themable' => $themable, |
|
69 | + 'errorMessage' => $errorMessage, |
|
70 | + 'name' => $this->themingDefaults->getEntity(), |
|
71 | + 'url' => $this->themingDefaults->getBaseUrl(), |
|
72 | + 'slogan' => $this->themingDefaults->getSlogan(), |
|
73 | + 'color' => $this->themingDefaults->getMailHeaderColor(), |
|
74 | + 'logo' => $this->themingDefaults->getLogo(), |
|
75 | + 'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''), |
|
76 | + 'background' => $this->themingDefaults->getBackground(), |
|
77 | + 'backgroundMime' => $this->config->getAppValue('theming', 'backgroundMime', ''), |
|
78 | + 'uploadLogoRoute' => $path, |
|
79 | + ]; |
|
80 | 80 | |
81 | - return new TemplateResponse('theming', 'settings-admin', $parameters, ''); |
|
82 | - } |
|
81 | + return new TemplateResponse('theming', 'settings-admin', $parameters, ''); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @return string the section ID, e.g. 'sharing' |
|
86 | - */ |
|
87 | - public function getSection() { |
|
88 | - return 'theming'; |
|
89 | - } |
|
84 | + /** |
|
85 | + * @return string the section ID, e.g. 'sharing' |
|
86 | + */ |
|
87 | + public function getSection() { |
|
88 | + return 'theming'; |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * @return int whether the form should be rather on the top or bottom of |
|
93 | - * the admin section. The forms are arranged in ascending order of the |
|
94 | - * priority values. It is required to return a value between 0 and 100. |
|
95 | - * |
|
96 | - * E.g.: 70 |
|
97 | - */ |
|
98 | - public function getPriority() { |
|
99 | - return 5; |
|
100 | - } |
|
91 | + /** |
|
92 | + * @return int whether the form should be rather on the top or bottom of |
|
93 | + * the admin section. The forms are arranged in ascending order of the |
|
94 | + * priority values. It is required to return a value between 0 and 100. |
|
95 | + * |
|
96 | + * E.g.: 70 |
|
97 | + */ |
|
98 | + public function getPriority() { |
|
99 | + return 5; |
|
100 | + } |
|
101 | 101 | |
102 | 102 | } |