Code Duplication    Length = 8-9 lines in 3 locations

code/Controllers/CMSMain.php 3 locations

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