Code Duplication    Length = 8-9 lines in 3 locations

code/Controllers/CMSMain.php 3 locations

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