Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5986176
HtmlArmor.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
972 B
Referenced Files
None
Subscribers
None
HtmlArmor.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
* @license GPL-2.0-or-later
* @author Kunal Mehta <legoktm@debian.org>
*/
namespace
Wikimedia\HtmlArmor
;
/**
* Marks HTML that shouldn't be escaped
*
* @newable
*
* @since 1.28
*/
class
HtmlArmor
{
/**
* @var string|null
*/
private
$value
;
/**
* @stable to call
*
* @param string|null $value
* @param-taint $value exec_html
*/
public
function
__construct
(
$value
)
{
$this
->
value
=
$value
;
}
/**
* Provide a string or HtmlArmor object
* and get safe HTML back
*
* @param string|HtmlArmor $input
* @return string|null safe for usage in HTML, or null
* if the HtmlArmor instance was wrapping null.
*/
public
static
function
getHtml
(
$input
)
{
if
(
$input
instanceof
HtmlArmor
)
{
return
$input
->
value
;
}
else
{
return
htmlspecialchars
(
$input
,
ENT_QUOTES
);
}
}
}
/** @deprecated class alias since 1.44 */
class_alias
(
HtmlArmor
::
class
,
'HtmlArmor'
);
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Oct 4, 00:01 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0d/37/f10c057c608b5b5099e4938f969a
Default Alt Text
HtmlArmor.php (972 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment