@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $route = substr($route, 7); |
| 102 | - $route = '/ocs/v2.php' . $route; |
|
| 102 | + $route = '/ocs/v2.php'.$route; |
|
| 103 | 103 | |
| 104 | 104 | return $this->getAbsoluteURL($route); |
| 105 | 105 | } |
@@ -117,37 +117,37 @@ discard block |
||
| 117 | 117 | public function linkTo(string $app, string $file, array $args = array()): string { |
| 118 | 118 | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
| 119 | 119 | |
| 120 | - if( $app !== '' ) { |
|
| 120 | + if ($app !== '') { |
|
| 121 | 121 | $app_path = \OC_App::getAppPath($app); |
| 122 | 122 | // Check if the app is in the app folder |
| 123 | - if ($app_path && file_exists($app_path . '/' . $file)) { |
|
| 123 | + if ($app_path && file_exists($app_path.'/'.$file)) { |
|
| 124 | 124 | if (substr($file, -3) === 'php') { |
| 125 | 125 | |
| 126 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; |
|
| 126 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$app; |
|
| 127 | 127 | if ($frontControllerActive) { |
| 128 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; |
|
| 128 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$app; |
|
| 129 | 129 | } |
| 130 | - $urlLinkTo .= ($file !== 'index.php') ? '/' . $file : ''; |
|
| 130 | + $urlLinkTo .= ($file !== 'index.php') ? '/'.$file : ''; |
|
| 131 | 131 | } else { |
| 132 | - $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; |
|
| 132 | + $urlLinkTo = \OC_App::getAppWebPath($app).'/'.$file; |
|
| 133 | 133 | } |
| 134 | 134 | } else { |
| 135 | - $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; |
|
| 135 | + $urlLinkTo = \OC::$WEBROOT.'/'.$app.'/'.$file; |
|
| 136 | 136 | } |
| 137 | 137 | } else { |
| 138 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
| 139 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
| 138 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
| 139 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
| 140 | 140 | } else { |
| 141 | 141 | if ($frontControllerActive && $file === 'index.php') { |
| 142 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
| 142 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
| 143 | 143 | } else { |
| 144 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
| 144 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if ($args && $query = http_build_query($args, '', '&')) { |
| 150 | - $urlLinkTo .= '?' . $query; |
|
| 150 | + $urlLinkTo .= '?'.$query; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return $urlLinkTo; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | public function imagePath(string $app, string $image): string { |
| 166 | 166 | $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); |
| 167 | 167 | $cacheKey = $app.'-'.$image; |
| 168 | - if($key = $cache->get($cacheKey)) { |
|
| 168 | + if ($key = $cache->get($cacheKey)) { |
|
| 169 | 169 | return $key; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $theme = \OC_Util::getTheme(); |
| 174 | 174 | |
| 175 | 175 | //if a theme has a png but not an svg always use the png |
| 176 | - $basename = substr(basename($image),0,-4); |
|
| 176 | + $basename = substr(basename($image), 0, -4); |
|
| 177 | 177 | |
| 178 | 178 | $appPath = \OC_App::getAppPath($app); |
| 179 | 179 | |
@@ -181,53 +181,53 @@ discard block |
||
| 181 | 181 | $path = ''; |
| 182 | 182 | $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); |
| 183 | 183 | $themingImagePath = false; |
| 184 | - if($themingEnabled) { |
|
| 184 | + if ($themingEnabled) { |
|
| 185 | 185 | $themingDefaults = \OC::$server->getThemingDefaults(); |
| 186 | 186 | if ($themingDefaults instanceof ThemingDefaults) { |
| 187 | 187 | $themingImagePath = $themingDefaults->replaceImagePath($app, $image); |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |
|
| 192 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; |
|
| 193 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") |
|
| 194 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { |
|
| 195 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png"; |
|
| 196 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { |
|
| 197 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; |
|
| 198 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") |
|
| 199 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { |
|
| 200 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; |
|
| 201 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { |
|
| 202 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; |
|
| 203 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
| 204 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
| 205 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
| 206 | - } elseif($themingEnabled && $themingImagePath) { |
|
| 191 | + if (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image")) { |
|
| 192 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; |
|
| 193 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.svg") |
|
| 194 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.png")) { |
|
| 195 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$basename.png"; |
|
| 196 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$image")) { |
|
| 197 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$image"; |
|
| 198 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.svg") |
|
| 199 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.png"))) { |
|
| 200 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$basename.png"; |
|
| 201 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$image")) { |
|
| 202 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$image"; |
|
| 203 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
| 204 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
| 205 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
| 206 | + } elseif ($themingEnabled && $themingImagePath) { |
|
| 207 | 207 | $path = $themingImagePath; |
| 208 | - } elseif ($appPath && file_exists($appPath . "/img/$image")) { |
|
| 209 | - $path = \OC_App::getAppWebPath($app) . "/img/$image"; |
|
| 210 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
| 211 | - && file_exists($appPath . "/img/$basename.png")) { |
|
| 212 | - $path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; |
|
| 213 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { |
|
| 214 | - $path = \OC::$WEBROOT . "/$app/img/$image"; |
|
| 215 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") |
|
| 216 | - && file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { |
|
| 217 | - $path = \OC::$WEBROOT . "/$app/img/$basename.png"; |
|
| 218 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { |
|
| 219 | - $path = \OC::$WEBROOT . "/core/img/$image"; |
|
| 220 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
| 221 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
| 222 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
| 208 | + } elseif ($appPath && file_exists($appPath."/img/$image")) { |
|
| 209 | + $path = \OC_App::getAppWebPath($app)."/img/$image"; |
|
| 210 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
| 211 | + && file_exists($appPath."/img/$basename.png")) { |
|
| 212 | + $path = \OC_App::getAppWebPath($app)."/img/$basename.png"; |
|
| 213 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/$app/img/$image")) { |
|
| 214 | + $path = \OC::$WEBROOT."/$app/img/$image"; |
|
| 215 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/$app/img/$basename.svg") |
|
| 216 | + && file_exists(\OC::$SERVERROOT."/$app/img/$basename.png"))) { |
|
| 217 | + $path = \OC::$WEBROOT."/$app/img/$basename.png"; |
|
| 218 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$image")) { |
|
| 219 | + $path = \OC::$WEBROOT."/core/img/$image"; |
|
| 220 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
| 221 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
| 222 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if($path !== '') { |
|
| 225 | + if ($path !== '') { |
|
| 226 | 226 | $cache->set($cacheKey, $path); |
| 227 | 227 | return $path; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
| 230 | + throw new RuntimeException('image not found: image:'.$image.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | $separator = strpos($url, '/') === 0 ? '' : '/'; |
| 241 | 241 | |
| 242 | 242 | if (\OC::$CLI && !\defined('PHPUNIT_RUN')) { |
| 243 | - return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
| 243 | + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
| 244 | 244 | } |
| 245 | 245 | // The ownCloud web root can already be prepended. |
| 246 | - if(\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) { |
|
| 246 | + if (\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) { |
|
| 247 | 247 | $url = substr($url, \strlen(\OC::$WEBROOT)); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - return $this->getBaseUrl() . $separator . $url; |
|
| 250 | + return $this->getBaseUrl().$separator.$url; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -263,6 +263,6 @@ discard block |
||
| 263 | 263 | * @return string base url of the current request |
| 264 | 264 | */ |
| 265 | 265 | public function getBaseUrl(): string { |
| 266 | - return $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; |
|
| 266 | + return $this->request->getServerProtocol().'://'.$this->request->getServerHost().\OC::$WEBROOT; |
|
| 267 | 267 | } |
| 268 | 268 | } |