@@ -93,40 +93,40 @@ discard block |
||
93 | 93 | * |
94 | 94 | * Returns a url to the given app and file. |
95 | 95 | */ |
96 | - public function linkTo( $app, $file, $args = array() ) { |
|
96 | + public function linkTo($app, $file, $args = array()) { |
|
97 | 97 | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
98 | 98 | |
99 | - if( $app != '' ) { |
|
99 | + if ($app != '') { |
|
100 | 100 | $app_path = \OC_App::getAppPath($app); |
101 | 101 | // Check if the app is in the app folder |
102 | - if ($app_path && file_exists($app_path . '/' . $file)) { |
|
102 | + if ($app_path && file_exists($app_path.'/'.$file)) { |
|
103 | 103 | if (substr($file, -3) == 'php') { |
104 | 104 | |
105 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; |
|
105 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$app; |
|
106 | 106 | if ($frontControllerActive) { |
107 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; |
|
107 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$app; |
|
108 | 108 | } |
109 | - $urlLinkTo .= ($file != 'index.php') ? '/' . $file : ''; |
|
109 | + $urlLinkTo .= ($file != 'index.php') ? '/'.$file : ''; |
|
110 | 110 | } else { |
111 | - $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; |
|
111 | + $urlLinkTo = \OC_App::getAppWebPath($app).'/'.$file; |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; |
|
114 | + $urlLinkTo = \OC::$WEBROOT.'/'.$app.'/'.$file; |
|
115 | 115 | } |
116 | 116 | } else { |
117 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
118 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
117 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
118 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
119 | 119 | } else { |
120 | 120 | if ($frontControllerActive && $file === 'index.php') { |
121 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
121 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
122 | 122 | } else { |
123 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
123 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($args && $query = http_build_query($args, '', '&')) { |
129 | - $urlLinkTo .= '?' . $query; |
|
129 | + $urlLinkTo .= '?'.$query; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $urlLinkTo; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function imagePath($app, $image) { |
145 | 145 | $cache = $this->cacheFactory->create('imagePath'); |
146 | 146 | $cacheKey = $app.'-'.$image; |
147 | - if($key = $cache->get($cacheKey)) { |
|
147 | + if ($key = $cache->get($cacheKey)) { |
|
148 | 148 | return $key; |
149 | 149 | } |
150 | 150 | |
@@ -152,57 +152,57 @@ discard block |
||
152 | 152 | $theme = \OC_Util::getTheme(); |
153 | 153 | |
154 | 154 | //if a theme has a png but not an svg always use the png |
155 | - $basename = substr(basename($image),0,-4); |
|
155 | + $basename = substr(basename($image), 0, -4); |
|
156 | 156 | |
157 | 157 | $appPath = \OC_App::getAppPath($app); |
158 | 158 | |
159 | 159 | // Check if the app is in the app folder |
160 | 160 | $path = ''; |
161 | 161 | $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); |
162 | - if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |
|
163 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; |
|
164 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") |
|
165 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { |
|
166 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { |
|
167 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; |
|
168 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") |
|
169 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { |
|
170 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; |
|
171 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { |
|
172 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; |
|
173 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
174 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
175 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
176 | - } elseif($themingEnabled && $image === "favicon.ico" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
162 | + if (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image")) { |
|
163 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; |
|
164 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.svg") |
|
165 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.png")) { |
|
166 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$image")) { |
|
167 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$image"; |
|
168 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.svg") |
|
169 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.png"))) { |
|
170 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$basename.png"; |
|
171 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$image")) { |
|
172 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$image"; |
|
173 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
174 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
175 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
176 | + } elseif ($themingEnabled && $image === "favicon.ico" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
177 | 177 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
178 | - if($app==="") { $app = "core"; } |
|
179 | - $path = $this->linkToRoute('theming.Icon.getFavicon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
180 | - } elseif($themingEnabled && $image === "favicon-touch.png" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
178 | + if ($app === "") { $app = "core"; } |
|
179 | + $path = $this->linkToRoute('theming.Icon.getFavicon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
180 | + } elseif ($themingEnabled && $image === "favicon-touch.png" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
181 | 181 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
182 | - if($app==="") { $app = "core"; } |
|
183 | - $path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
184 | - } elseif ($appPath && file_exists($appPath . "/img/$image")) { |
|
185 | - $path = \OC_App::getAppWebPath($app) . "/img/$image"; |
|
186 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
187 | - && file_exists($appPath . "/img/$basename.png")) { |
|
188 | - $path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; |
|
189 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { |
|
190 | - $path = \OC::$WEBROOT . "/$app/img/$image"; |
|
191 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") |
|
192 | - && file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { |
|
193 | - $path = \OC::$WEBROOT . "/$app/img/$basename.png"; |
|
194 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { |
|
195 | - $path = \OC::$WEBROOT . "/core/img/$image"; |
|
196 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
197 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
198 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
182 | + if ($app === "") { $app = "core"; } |
|
183 | + $path = $this->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
184 | + } elseif ($appPath && file_exists($appPath."/img/$image")) { |
|
185 | + $path = \OC_App::getAppWebPath($app)."/img/$image"; |
|
186 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
187 | + && file_exists($appPath."/img/$basename.png")) { |
|
188 | + $path = \OC_App::getAppWebPath($app)."/img/$basename.png"; |
|
189 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/$app/img/$image")) { |
|
190 | + $path = \OC::$WEBROOT."/$app/img/$image"; |
|
191 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/$app/img/$basename.svg") |
|
192 | + && file_exists(\OC::$SERVERROOT."/$app/img/$basename.png"))) { |
|
193 | + $path = \OC::$WEBROOT."/$app/img/$basename.png"; |
|
194 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$image")) { |
|
195 | + $path = \OC::$WEBROOT."/core/img/$image"; |
|
196 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
197 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
198 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
199 | 199 | } |
200 | 200 | |
201 | - if($path !== '') { |
|
201 | + if ($path !== '') { |
|
202 | 202 | $cache->set($cacheKey, $path); |
203 | 203 | return $path; |
204 | 204 | } else { |
205 | - throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
205 | + throw new RuntimeException('image not found: image:'.$image.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $separator = $url[0] === '/' ? '' : '/'; |
217 | 217 | |
218 | 218 | if (\OC::$CLI && !defined('PHPUNIT_RUN')) { |
219 | - return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
219 | + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | // The ownCloud web root can already be prepended. |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | : \OC::$WEBROOT; |
226 | 226 | |
227 | 227 | $request = \OC::$server->getRequest(); |
228 | - return $request->getServerProtocol() . '://' . $request->getServerHost() . $webRoot . $separator . $url; |
|
228 | + return $request->getServerProtocol().'://'.$request->getServerHost().$webRoot.$separator.$url; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $app = new \OCP\AppFramework\App('theming'); |
27 | 27 | /** @var \OCA\Theming\Util $util */ |
28 | 28 | $util = $app->getContainer()->query(\OCA\Theming\Util::class); |
29 | -if(!$util->isAlreadyThemed()) { |
|
29 | +if (!$util->isAlreadyThemed()) { |
|
30 | 30 | |
31 | 31 | $app->getContainer()->registerCapability(\OCA\Theming\Capabilities::class); |
32 | 32 |