Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 15:19:56 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 15:19:56 +0300
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/theming/lib
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Controller/IconController.php4
-rw-r--r--apps/theming/lib/Controller/ThemingController.php2
-rw-r--r--apps/theming/lib/IconBuilder.php11
-rw-r--r--apps/theming/lib/ImageManager.php4
-rw-r--r--apps/theming/lib/Settings/Admin.php1
-rw-r--r--apps/theming/lib/ThemingDefaults.php19
-rw-r--r--apps/theming/lib/Util.php11
7 files changed, 26 insertions, 26 deletions
diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php
index 73d3606a3df..c0bc22de8ee 100644
--- a/apps/theming/lib/Controller/IconController.php
+++ b/apps/theming/lib/Controller/IconController.php
@@ -133,7 +133,7 @@ class IconController extends Controller {
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
}
}
- if($response === null) {
+ if ($response === null) {
$fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon.png';
$response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
}
@@ -169,7 +169,7 @@ class IconController extends Controller {
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']);
}
}
- if($response === null) {
+ if ($response === null) {
$fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon-touch.png';
$response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/png']);
}
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index e1fbb227774..6184796406d 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -414,7 +414,7 @@ class ThemingController extends Controller {
* since we need to add the cacheBuster value to the url
*/
$cssCached = $this->scssCacher->process($appPath, 'css/theming.scss', 'theming');
- if(!$cssCached) {
+ if (!$cssCached) {
return new NotFoundResponse();
}
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php
index 2380e960c70..77079851d69 100644
--- a/apps/theming/lib/IconBuilder.php
+++ b/apps/theming/lib/IconBuilder.php
@@ -127,7 +127,7 @@ class IconBuilder {
*/
public function renderAppIcon($app, $size) {
$appIcon = $this->util->getAppIcon($app);
- if($appIcon === false) {
+ if ($appIcon === false) {
return false;
}
if ($appIcon instanceof ISimpleFile) {
@@ -138,7 +138,7 @@ class IconBuilder {
$mime = mime_content_type($appIcon);
}
- if($appIconContent === false || $appIconContent === "") {
+ if ($appIconContent === false || $appIconContent === "") {
return false;
}
@@ -150,8 +150,8 @@ class IconBuilder {
'<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' .
'</svg>';
// resize svg magic as this seems broken in Imagemagick
- if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") {
- if(substr($appIconContent, 0, 5) !== "<?xml") {
+ if ($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") {
+ if (substr($appIconContent, 0, 5) !== "<?xml") {
$svg = "<?xml version=\"1.0\"?>".$appIconContent;
} else {
$svg = $appIconContent;
@@ -163,7 +163,7 @@ class IconBuilder {
$res = $tmp->getImageResolution();
$tmp->destroy();
- if($x>$y) {
+ if ($x>$y) {
$max = $x;
} else {
$max = $y;
@@ -237,5 +237,4 @@ class IconBuilder {
return false;
}
}
-
}
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php
index 53189181bfa..35a03c30c43 100644
--- a/apps/theming/lib/ImageManager.php
+++ b/apps/theming/lib/ImageManager.php
@@ -234,11 +234,11 @@ class ImageManager {
*/
public function shouldReplaceIcons() {
$cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl());
- if($value = $cache->get('shouldReplaceIcons')) {
+ if ($value = $cache->get('shouldReplaceIcons')) {
return (bool)$value;
}
$value = false;
- if(extension_loaded('imagick')) {
+ if (extension_loaded('imagick')) {
if (count(\Imagick::queryFormats('SVG')) >= 1) {
$value = true;
}
diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php
index cd59b167365..518aace2c35 100644
--- a/apps/theming/lib/Settings/Admin.php
+++ b/apps/theming/lib/Settings/Admin.php
@@ -107,5 +107,4 @@ class Admin implements ISettings {
public function getPriority(): int {
return 5;
}
-
}
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 413e2a9e64f..059dc55cb99 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -188,9 +188,10 @@ class ThemingDefaults extends \OC_Defaults {
}, $navigation);
$links = array_merge($links, $guestNavigation);
- $legalLinks = ''; $divider = '';
- foreach($links as $link) {
- if($link['url'] !== ''
+ $legalLinks = '';
+ $divider = '';
+ foreach ($links as $link) {
+ if ($link['url'] !== ''
&& filter_var($link['url'], FILTER_VALIDATE_URL)
) {
$legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' .
@@ -198,7 +199,7 @@ class ThemingDefaults extends \OC_Defaults {
$divider = ' ยท ';
}
}
- if($legalLinks !== '') {
+ if ($legalLinks !== '') {
$footer .= '<br/>' . $legalLinks;
}
@@ -232,8 +233,8 @@ class ThemingDefaults extends \OC_Defaults {
$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
- if(!$logo || !$logoExists) {
- if($useSvg) {
+ if (!$logo || !$logoExists) {
+ if ($useSvg) {
$logo = $this->urlGenerator->imagePath('core', 'logo/logo.svg');
} else {
$logo = $this->urlGenerator->imagePath('core', 'logo/logo.png');
@@ -309,7 +310,7 @@ class ThemingDefaults extends \OC_Defaults {
}
$variables['has-legal-links'] = 'false';
- if($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') {
+ if ($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') {
$variables['has-legal-links'] = 'true';
}
@@ -350,7 +351,8 @@ class ThemingDefaults extends \OC_Defaults {
if (file_exists($appPath . '/img/manifest.json')) {
return false;
}
- } catch (AppPathNotFoundException $e) {}
+ } catch (AppPathNotFoundException $e) {
+ }
$route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest');
}
if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) {
@@ -372,7 +374,6 @@ class ThemingDefaults extends \OC_Defaults {
$this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1);
$this->cacheFactory->createDistributed('theming-')->clear();
$this->cacheFactory->createDistributed('imagePath')->clear();
-
}
/**
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index d66aeb3db2c..d3c0043b2a3 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -66,7 +66,7 @@ class Util {
*/
public function invertTextColor($color) {
$l = $this->calculateLuma($color);
- if($l>0.6) {
+ if ($l>0.6) {
return true;
} else {
return false;
@@ -81,7 +81,7 @@ class Util {
*/
public function elementColor($color) {
$l = $this->calculateLuminance($color);
- if($l>0.8) {
+ if ($l>0.8) {
return '#aaaaaa';
}
return $color;
@@ -153,7 +153,8 @@ class Util {
if (file_exists($icon)) {
return $icon;
}
- } catch (AppPathNotFoundException $e) {}
+ } catch (AppPathNotFoundException $e) {
+ }
if ($this->config->getAppValue('theming', 'logoMime', '') !== '') {
$logoFile = null;
@@ -162,7 +163,8 @@ class Util {
if ($folder !== null) {
return $folder->getFile('logo');
}
- } catch (NotFoundException $e) {}
+ } catch (NotFoundException $e) {
+ }
}
return \OC::$SERVERROOT . '/core/img/logo/logo.svg';
}
@@ -248,5 +250,4 @@ class Util {
}
return $backgroundLogo && $backgroundLogo !== 'backgroundColor' && $backgroundExists;
}
-
}