Completed
Pull Request — master (#4406)
by Joas
33:30 queued 05:19
created
apps/theming/lib/Controller/IconController.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -36,142 +36,142 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/public/Defaults.php 1 patch
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -40,175 +40,175 @@
 block discarded – undo
40 40
  */
41 41
 class Defaults {
42 42
 
43
-	/**
44
-	 * \OC_Defaults instance to retrieve the defaults
45
-	 * @since 6.0.0
46
-	 */
47
-	private $defaults;
48
-
49
-	/**
50
-	 * creates a \OC_Defaults instance which is used in all methods to retrieve the
51
-	 * actual defaults
52
-	 * @since 6.0.0
53
-	 */
54
-	public function __construct(\OC_Defaults $defaults = null) {
55
-		if ($defaults === null) {
56
-			$defaults = \OC::$server->getThemingDefaults();
57
-		}
58
-		$this->defaults = $defaults;
59
-	}
60
-
61
-	/**
62
-	 * get base URL for the organisation behind your ownCloud instance
63
-	 * @return string
64
-	 * @since 6.0.0
65
-	 */
66
-	public function getBaseUrl() {
67
-		return $this->defaults->getBaseUrl();
68
-	}
69
-
70
-	/**
71
-	 * link to the desktop sync client
72
-	 * @return string
73
-	 * @since 6.0.0
74
-	 */
75
-	public function getSyncClientUrl() {
76
-		return $this->defaults->getSyncClientUrl();
77
-	}
78
-
79
-	/**
80
-	 * link to the iOS client
81
-	 * @return string
82
-	 * @since 8.0.0
83
-	 */
84
-	public function getiOSClientUrl() {
85
-		return $this->defaults->getiOSClientUrl();
86
-	}
87
-
88
-	/**
89
-	 * link to the Android client
90
-	 * @return string
91
-	 * @since 8.0.0
92
-	 */
93
-	public function getAndroidClientUrl() {
94
-		return $this->defaults->getAndroidClientUrl();
95
-	}
96
-
97
-	/**
98
-	 * base URL to the documentation of your ownCloud instance
99
-	 * @return string
100
-	 * @since 6.0.0
101
-	 */
102
-	public function getDocBaseUrl() {
103
-		return $this->defaults->getDocBaseUrl();
104
-	}
105
-
106
-	/**
107
-	 * name of your ownCloud instance
108
-	 * @return string
109
-	 * @since 6.0.0
110
-	 */
111
-	public function getName() {
112
-		return $this->defaults->getName();
113
-	}
114
-
115
-	/**
116
-	 * name of your ownCloud instance containing HTML styles
117
-	 * @return string
118
-	 * @since 8.0.0
119
-	 */
120
-	public function getHTMLName() {
121
-		return $this->defaults->getHTMLName();
122
-	}
123
-
124
-	/**
125
-	 * Entity behind your onwCloud instance
126
-	 * @return string
127
-	 * @since 6.0.0
128
-	 */
129
-	public function getEntity() {
130
-		return $this->defaults->getEntity();
131
-	}
132
-
133
-	/**
134
-	 * ownCloud slogan
135
-	 * @return string
136
-	 * @since 6.0.0
137
-	 */
138
-	public function getSlogan() {
139
-		return $this->defaults->getSlogan();
140
-	}
141
-
142
-	/**
143
-	 * logo claim
144
-	 * @return string
145
-	 * @since 6.0.0
146
-	 */
147
-	public function getLogoClaim() {
148
-		return $this->defaults->getLogoClaim();
149
-	}
150
-
151
-	/**
152
-	 * footer, short version
153
-	 * @return string
154
-	 * @since 6.0.0
155
-	 */
156
-	public function getShortFooter() {
157
-		return $this->defaults->getShortFooter();
158
-	}
159
-
160
-	/**
161
-	 * footer, long version
162
-	 * @return string
163
-	 * @since 6.0.0
164
-	 */
165
-	public function getLongFooter() {
166
-		return $this->defaults->getLongFooter();
167
-	}
168
-
169
-	/**
170
-	 * Returns the AppId for the App Store for the iOS Client
171
-	 * @return string AppId
172
-	 * @since 8.0.0
173
-	 */
174
-	public function getiTunesAppId() {
175
-		return $this->defaults->getiTunesAppId();
176
-	}
177
-
178
-	/**
179
-	 * Themed logo url
180
-	 *
181
-	 * @return string
182
-	 * @since 12.0.0
183
-	 */
184
-	public function getLogo() {
185
-		return $this->defaults->getLogo();
186
-	}
187
-
188
-	/**
189
-	 * Returns primary color
190
-	 * @return string
191
-	 * @since 12.0.0
192
-	 */
193
-	public function getColorPrimary() {
194
-		return $this->defaults->getColorPrimary();
195
-	}
196
-
197
-	/**
198
-	 * @param string $key
199
-	 * @return string URL to doc with key
200
-	 * @since 12.0.0
201
-	 */
202
-	public function buildDocLinkToKey($key) {
203
-		return $this->defaults->buildDocLinkToKey($key);
204
-	}
205
-
206
-	/**
207
-	 * Returns the title
208
-	 * @return string title
209
-	 * @since 12.0.0
210
-	 */
211
-	public function getTitle() {
212
-		return $this->defaults->getTitle();
213
-	}
43
+    /**
44
+     * \OC_Defaults instance to retrieve the defaults
45
+     * @since 6.0.0
46
+     */
47
+    private $defaults;
48
+
49
+    /**
50
+     * creates a \OC_Defaults instance which is used in all methods to retrieve the
51
+     * actual defaults
52
+     * @since 6.0.0
53
+     */
54
+    public function __construct(\OC_Defaults $defaults = null) {
55
+        if ($defaults === null) {
56
+            $defaults = \OC::$server->getThemingDefaults();
57
+        }
58
+        $this->defaults = $defaults;
59
+    }
60
+
61
+    /**
62
+     * get base URL for the organisation behind your ownCloud instance
63
+     * @return string
64
+     * @since 6.0.0
65
+     */
66
+    public function getBaseUrl() {
67
+        return $this->defaults->getBaseUrl();
68
+    }
69
+
70
+    /**
71
+     * link to the desktop sync client
72
+     * @return string
73
+     * @since 6.0.0
74
+     */
75
+    public function getSyncClientUrl() {
76
+        return $this->defaults->getSyncClientUrl();
77
+    }
78
+
79
+    /**
80
+     * link to the iOS client
81
+     * @return string
82
+     * @since 8.0.0
83
+     */
84
+    public function getiOSClientUrl() {
85
+        return $this->defaults->getiOSClientUrl();
86
+    }
87
+
88
+    /**
89
+     * link to the Android client
90
+     * @return string
91
+     * @since 8.0.0
92
+     */
93
+    public function getAndroidClientUrl() {
94
+        return $this->defaults->getAndroidClientUrl();
95
+    }
96
+
97
+    /**
98
+     * base URL to the documentation of your ownCloud instance
99
+     * @return string
100
+     * @since 6.0.0
101
+     */
102
+    public function getDocBaseUrl() {
103
+        return $this->defaults->getDocBaseUrl();
104
+    }
105
+
106
+    /**
107
+     * name of your ownCloud instance
108
+     * @return string
109
+     * @since 6.0.0
110
+     */
111
+    public function getName() {
112
+        return $this->defaults->getName();
113
+    }
114
+
115
+    /**
116
+     * name of your ownCloud instance containing HTML styles
117
+     * @return string
118
+     * @since 8.0.0
119
+     */
120
+    public function getHTMLName() {
121
+        return $this->defaults->getHTMLName();
122
+    }
123
+
124
+    /**
125
+     * Entity behind your onwCloud instance
126
+     * @return string
127
+     * @since 6.0.0
128
+     */
129
+    public function getEntity() {
130
+        return $this->defaults->getEntity();
131
+    }
132
+
133
+    /**
134
+     * ownCloud slogan
135
+     * @return string
136
+     * @since 6.0.0
137
+     */
138
+    public function getSlogan() {
139
+        return $this->defaults->getSlogan();
140
+    }
141
+
142
+    /**
143
+     * logo claim
144
+     * @return string
145
+     * @since 6.0.0
146
+     */
147
+    public function getLogoClaim() {
148
+        return $this->defaults->getLogoClaim();
149
+    }
150
+
151
+    /**
152
+     * footer, short version
153
+     * @return string
154
+     * @since 6.0.0
155
+     */
156
+    public function getShortFooter() {
157
+        return $this->defaults->getShortFooter();
158
+    }
159
+
160
+    /**
161
+     * footer, long version
162
+     * @return string
163
+     * @since 6.0.0
164
+     */
165
+    public function getLongFooter() {
166
+        return $this->defaults->getLongFooter();
167
+    }
168
+
169
+    /**
170
+     * Returns the AppId for the App Store for the iOS Client
171
+     * @return string AppId
172
+     * @since 8.0.0
173
+     */
174
+    public function getiTunesAppId() {
175
+        return $this->defaults->getiTunesAppId();
176
+    }
177
+
178
+    /**
179
+     * Themed logo url
180
+     *
181
+     * @return string
182
+     * @since 12.0.0
183
+     */
184
+    public function getLogo() {
185
+        return $this->defaults->getLogo();
186
+    }
187
+
188
+    /**
189
+     * Returns primary color
190
+     * @return string
191
+     * @since 12.0.0
192
+     */
193
+    public function getColorPrimary() {
194
+        return $this->defaults->getColorPrimary();
195
+    }
196
+
197
+    /**
198
+     * @param string $key
199
+     * @return string URL to doc with key
200
+     * @since 12.0.0
201
+     */
202
+    public function buildDocLinkToKey($key) {
203
+        return $this->defaults->buildDocLinkToKey($key);
204
+    }
205
+
206
+    /**
207
+     * Returns the title
208
+     * @return string title
209
+     * @since 12.0.0
210
+     */
211
+    public function getTitle() {
212
+        return $this->defaults->getTitle();
213
+    }
214 214
 }
Please login to merge, or discard this patch.