Completed
Push — master ( 3b4314...83c2af )
by Sam
12:26
created

HTMLReadonlyField   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 2 Features 0
Metric Value
c 2
b 2
f 0
dl 0
loc 19
rs 10
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Field() 0 3 1
A ValueEntities() 0 3 1
1
<?php
2
3
/**
4
 * Readonly field equivalent for literal HTML
5
 *
6
 * Unlike HTMLEditorField_Readonly, does not processs shortcodes
7
 */
8
class HTMLReadonlyField extends ReadonlyField {
9
	private static $casting = [
10
		'Value' => 'HTMLFragment',
11
		'ValueEntities' => 'HTMLFragment',
12
	];
13
14
	public function Field($properties = array()) {
15
		return $this->renderWith($this->getTemplates());
16
	}
17
18
	/**
19
	 * Return value with all values encoded in html entities
20
	 *
21
	 * @return string Raw HTML
22
	 */
23
	public function ValueEntities() {
24
		return htmlentities($this->Value(), ENT_COMPAT, 'UTF-8');
25
	}
26
}
27