Code Duplication    Length = 8-9 lines in 3 locations

code/Controllers/CMSMain.php 3 locations

@@ 290-297 (lines=8) @@
287
		return $this->LinkWithSearch(CMSMain::singleton()->Link('listview'));
288
	}
289
290
	public function LinkPageEdit($id = null) {
291
		if(!$id) {
292
			$id = $this->currentPageID();
293
		}
294
		return $this->LinkWithSearch(
295
			Controller::join_links(CMSPageEditController::singleton()->Link('show'), $id)
296
		);
297
	}
298
299
	public function LinkPageSettings() {
300
		if($id = $this->currentPageID()) {
@@ 299-307 (lines=9) @@
296
		);
297
	}
298
299
	public function LinkPageSettings() {
300
		if($id = $this->currentPageID()) {
301
			return $this->LinkWithSearch(
302
				Controller::join_links(CMSPageSettingsController::singleton()->Link('show'), $id)
303
			);
304
		} else {
305
			return null;
306
		}
307
	}
308
309
	public function LinkPageHistory() {
310
		if($id = $this->currentPageID()) {
@@ 309-317 (lines=9) @@
306
		}
307
	}
308
309
	public function LinkPageHistory() {
310
		if($id = $this->currentPageID()) {
311
			return $this->LinkWithSearch(
312
				Controller::join_links(CMSPageHistoryController::singleton()->Link('show'), $id)
313
			);
314
		} else {
315
			return null;
316
		}
317
	}
318
319
	public function LinkWithSearch($link) {
320
		// Whitelist to avoid side effects