MediaWiki master
HtmlArmor.php
Go to the documentation of this file.
1<?php
24
32class HtmlArmor {
33
37 private $value;
38
45 public function __construct( $value ) {
46 $this->value = $value;
47 }
48
57 public static function getHtml( $input ) {
58 if ( $input instanceof HtmlArmor ) {
59 return $input->value;
60 } else {
61 return htmlspecialchars( $input, ENT_QUOTES );
62 }
63 }
64}
65
67class_alias( HtmlArmor::class, 'HtmlArmor' );
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:32
static getHtml( $input)
Provide a string or HtmlArmor object and get safe HTML back.
Definition HtmlArmor.php:57