Code Duplication    Length = 8-9 lines in 3 locations

code/Controllers/CMSMain.php 3 locations

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