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 }
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:30
static getHtml( $input)
Provide a string or HtmlArmor object and get safe HTML back.
Definition: HtmlArmor.php:54
__construct( $value)
Definition: HtmlArmor.php:42