Code Duplication    Length = 8-9 lines in 3 locations

code/Controllers/CMSMain.php 3 locations

@@ 244-251 (lines=8) @@
241
		return $this->LinkWithSearch($this->Link('galleryview'));
242
	}
243
244
	public function LinkPageEdit($id = null) {
245
		if(!$id) {
246
			$id = $this->currentPageID();
247
		}
248
		return $this->LinkWithSearch(
249
			Controller::join_links(CMSPageEditController::singleton()->Link('show'), $id)
250
		);
251
	}
252
253
	public function LinkPageSettings() {
254
		if($id = $this->currentPageID()) {
@@ 253-261 (lines=9) @@
250
		);
251
	}
252
253
	public function LinkPageSettings() {
254
		if($id = $this->currentPageID()) {
255
			return $this->LinkWithSearch(
256
				Controller::join_links(CMSPageSettingsController::singleton()->Link('show'), $id)
257
			);
258
		} else {
259
			return null;
260
		}
261
	}
262
263
	public function LinkPageHistory() {
264
		if($id = $this->currentPageID()) {
@@ 263-271 (lines=9) @@
260
		}
261
	}
262
263
	public function LinkPageHistory() {
264
		if($id = $this->currentPageID()) {
265
			return $this->LinkWithSearch(
266
				Controller::join_links(CMSPageHistoryController::singleton()->Link('show'), $id)
267
			);
268
		} else {
269
			return null;
270
		}
271
	}
272
273
	public function LinkWithSearch($link) {
274
		// Whitelist to avoid side effects