MediaWiki master
HtmlArmor.php
Go to the documentation of this file.
1<?php
10
18class HtmlArmor {
19
23 private $value;
24
31 public function __construct( $value ) {
32 $this->value = $value;
33 }
34
43 public static function getHtml( $input ) {
44 if ( $input instanceof HtmlArmor ) {
45 return $input->value;
46 } else {
47 return htmlspecialchars( $input, ENT_QUOTES );
48 }
49 }
50}
51
53class_alias( HtmlArmor::class, 'HtmlArmor' );
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:18
static getHtml( $input)
Provide a string or HtmlArmor object and get safe HTML back.
Definition HtmlArmor.php:43