Code Duplication    Length = 8-9 lines in 3 locations

code/Controllers/CMSMain.php 3 locations

@@ 258-265 (lines=8) @@
255
		return $this->LinkWithSearch($this->Link('galleryview'));
256
	}
257
258
	public function LinkPageEdit($id = null) {
259
		if(!$id) {
260
			$id = $this->currentPageID();
261
		}
262
		return $this->LinkWithSearch(
263
			Controller::join_links(CMSPageEditController::singleton()->Link('show'), $id)
264
		);
265
	}
266
267
	public function LinkPageSettings() {
268
		if($id = $this->currentPageID()) {
@@ 267-275 (lines=9) @@
264
		);
265
	}
266
267
	public function LinkPageSettings() {
268
		if($id = $this->currentPageID()) {
269
			return $this->LinkWithSearch(
270
				Controller::join_links(CMSPageSettingsController::singleton()->Link('show'), $id)
271
			);
272
		} else {
273
			return null;
274
		}
275
	}
276
277
	public function LinkPageHistory() {
278
		if($id = $this->currentPageID()) {
@@ 277-285 (lines=9) @@
274
		}
275
	}
276
277
	public function LinkPageHistory() {
278
		if($id = $this->currentPageID()) {
279
			return $this->LinkWithSearch(
280
				Controller::join_links(CMSPageHistoryController::singleton()->Link('show'), $id)
281
			);
282
		} else {
283
			return null;
284
		}
285
	}
286
287
	public function LinkWithSearch($link) {
288
		// Whitelist to avoid side effects