Completed
Pull Request — master (#4435)
by Lukas
16:16 queued 02:27
created
apps/updatenotification/lib/Controller/AdminController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
 		$currentChannel = \OCP\Util::getChannel();
100 100
 
101 101
 		// Remove the currently used channel from the channels list
102
-		if(($key = array_search($currentChannel, $channels)) !== false) {
102
+		if (($key = array_search($currentChannel, $channels)) !== false) {
103 103
 			unset($channels[$key]);
104 104
 		}
105 105
 		$updateState = $this->updateChecker->getUpdateState();
Please login to merge, or discard this patch.
apps/updatenotification/lib/UpdateChecker.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 		$data = $this->updater->check();
44 44
 		$result = [];
45 45
 
46
-		if(isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
46
+		if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
47 47
 			$result['updateAvailable'] = true;
48 48
 			$result['updateVersion'] = $data['versionstring'];
49 49
 			$result['updaterEnabled'] = $data['autoupdater'] === '1';
50
-			if(substr($data['web'], 0, 8) === 'https://') {
50
+			if (substr($data['web'], 0, 8) === 'https://') {
51 51
 				$result['updateLink'] = $data['web'];
52 52
 			}
53
-			if(substr($data['url'], 0, 8) === 'https://') {
53
+			if (substr($data['url'], 0, 8) === 'https://') {
54 54
 				$result['downloadLink'] = $data['url'];
55 55
 			}
56 56
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param array $data
65 65
 	 */
66 66
 	public function getJavaScript(array $data) {
67
-		$data['array']['oc_updateState'] =  json_encode([
67
+		$data['array']['oc_updateState'] = json_encode([
68 68
 			'updateAvailable' => true,
69 69
 			'updateVersion' => $this->getUpdateState()['updateVersion'],
70 70
 			'updateLink' => isset($this->getUpdateState()['updateLink']) ? $this->getUpdateState()['updateLink'] : '',
Please login to merge, or discard this patch.
apps/updatenotification/lib/AppInfo/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 use OCP\AppFramework\IAppContainer;
31 31
 
32 32
 class Application extends App {
33
-	public function __construct (array $urlParams = array()) {
33
+	public function __construct(array $urlParams = array()) {
34 34
 		parent::__construct('updatenotification', $urlParams);
35 35
 		$container = $this->getContainer();
36 36
 
Please login to merge, or discard this patch.
apps/updatenotification/lib/ResetTokenBackgroundJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 	 */
70 70
 	protected function run($argument) {
71 71
 		// Delete old tokens after 2 days
72
-		if($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) {
72
+		if ($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) {
73 73
 			$this->config->deleteSystemValue('updater.secret');
74 74
 		}
75 75
 	}
Please login to merge, or discard this patch.
apps/updatenotification/appinfo/app.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
apps/theming/templates/settings-admin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
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 } ?>
Please login to merge, or discard this patch.
apps/theming/lib/Util.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function invertTextColor($color) {
60 60
 		$l = $this->calculateLuminance($color);
61
-		if($l>0.5) {
61
+		if ($l > 0.5) {
62 62
 			return true;
63 63
 		} else {
64 64
 			return false;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function elementColor($color) {
75 75
 		$l = $this->calculateLuminance($color);
76
-		if($l>0.8) {
76
+		if ($l > 0.8) {
77 77
 			return '#555555';
78 78
 		} else {
79 79
 			return $color;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	public function calculateLuminance($color) {
88 88
 		$hex = preg_replace("/[^0-9A-Fa-f]/", '', $color);
89 89
 		if (strlen($hex) === 3) {
90
-			$hex = $hex{0} . $hex{0} . $hex{1} . $hex{1} . $hex{2} . $hex{2};
90
+			$hex = $hex{0}.$hex{0}.$hex{1}.$hex{1}.$hex{2}.$hex{2};
91 91
 		}
92 92
 		if (strlen($hex) !== 6) {
93 93
 			return 0;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$r = hexdec(substr($hex, 0, 2));
96 96
 		$g = hexdec(substr($hex, 2, 2));
97 97
 		$b = hexdec(substr($hex, 4, 2));
98
-		return (0.299 * $r + 0.587 * $g + 0.114 * $b)/255;
98
+		return (0.299 * $r + 0.587 * $g + 0.114 * $b) / 255;
99 99
 	}
100 100
 
101 101
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return string base64 encoded radio button svg
104 104
 	 */
105 105
 	public function generateRadioButton($color) {
106
-		$radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' .
106
+		$radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">'.
107 107
 			'<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>';
108 108
 		return base64_encode($radioButtonIcon);
109 109
 	}
@@ -117,20 +117,20 @@  discard block
 block discarded – undo
117 117
 		$app = str_replace(array('\0', '/', '\\', '..'), '', $app);
118 118
 		try {
119 119
 			$appPath = $this->appManager->getAppPath($app);
120
-			$icon = $appPath . '/img/' . $app . '.svg';
120
+			$icon = $appPath.'/img/'.$app.'.svg';
121 121
 			if (file_exists($icon)) {
122 122
 				return $icon;
123 123
 			}
124
-			$icon = $appPath . '/img/app.svg';
124
+			$icon = $appPath.'/img/app.svg';
125 125
 			if (file_exists($icon)) {
126 126
 				return $icon;
127 127
 			}
128 128
 		} catch (AppPathNotFoundException $e) {}
129 129
 
130
-		if($this->config->getAppValue('theming', 'logoMime', '') !== '' && $this->rootFolder->nodeExists('/themedinstancelogo')) {
131
-			return $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/themedinstancelogo';
130
+		if ($this->config->getAppValue('theming', 'logoMime', '') !== '' && $this->rootFolder->nodeExists('/themedinstancelogo')) {
131
+			return $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/themedinstancelogo';
132 132
 		}
133
-		return \OC::$SERVERROOT . '/core/img/logo.svg';
133
+		return \OC::$SERVERROOT.'/core/img/logo.svg';
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$app = str_replace(array('\0', '/', '\\', '..'), '', $app);
143 143
 		$image = str_replace(array('\0', '\\', '..'), '', $image);
144 144
 		if ($app === "core") {
145
-			$icon = \OC::$SERVERROOT . '/core/img/' . $image;
145
+			$icon = \OC::$SERVERROOT.'/core/img/'.$image;
146 146
 			if (file_exists($icon)) {
147 147
 				return $icon;
148 148
 			}
@@ -154,23 +154,23 @@  discard block
 block discarded – undo
154 154
 			return false;
155 155
 		}
156 156
 
157
-		$icon = $appPath . '/img/' . $image;
157
+		$icon = $appPath.'/img/'.$image;
158 158
 		if (file_exists($icon)) {
159 159
 			return $icon;
160 160
 		}
161
-		$icon = $appPath . '/img/' . $image . '.svg';
161
+		$icon = $appPath.'/img/'.$image.'.svg';
162 162
 		if (file_exists($icon)) {
163 163
 			return $icon;
164 164
 		}
165
-		$icon = $appPath . '/img/' . $image . '.png';
165
+		$icon = $appPath.'/img/'.$image.'.png';
166 166
 		if (file_exists($icon)) {
167 167
 			return $icon;
168 168
 		}
169
-		$icon = $appPath . '/img/' . $image . '.gif';
169
+		$icon = $appPath.'/img/'.$image.'.gif';
170 170
 		if (file_exists($icon)) {
171 171
 			return $icon;
172 172
 		}
173
-		$icon = $appPath . '/img/' . $image . '.jpg';
173
+		$icon = $appPath.'/img/'.$image.'.jpg';
174 174
 		if (file_exists($icon)) {
175 175
 			return $icon;
176 176
 		}
Please login to merge, or discard this patch.
apps/theming/lib/Controller/IconController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']);
Please login to merge, or discard this patch.
apps/theming/lib/IconBuilder.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.