MediaWiki  master
HtmlArmor.php
Go to the documentation of this file.
1 <?php
30 class HtmlArmor {
31 
35  private $value;
36 
42  public function __construct( $value ) {
43  $this->value = $value;
44  }
45 
54  public static function getHtml( $input ) {
55  if ( $input instanceof HtmlArmor ) {
56  return $input->value;
57  } else {
58  return htmlspecialchars( $input, ENT_QUOTES );
59  }
60  }
61 }
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:30
HtmlArmor\$value
string null $value
Definition: HtmlArmor.php:35
HtmlArmor\getHtml
static getHtml( $input)
Provide a string or HtmlArmor object and get safe HTML back.
Definition: HtmlArmor.php:54
HtmlArmor\__construct
__construct( $value)
Stable to call.
Definition: HtmlArmor.php:42