Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F158909
img_support_in_remarkup
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
swisspol
May 22 2014, 3:36 PM
2014-05-22 15:36:23 (UTC+0)
Size
736 B
Referenced Files
None
Subscribers
None
img_support_in_remarkup
View Options
<?php
final
class
CustomInlineImageRule
extends
PhabricatorRemarkupCustomInlineRule
{
public
function
getPriority
()
{
return
200.0
;
// Must be lower than 300 to over URL detection
}
public
function
apply
(
$text
)
{
return
preg_replace_callback
(
'(<img (.*?)>)s'
,
array
(
$this
,
'markupInlineImageBlock'
),
$text
);
}
public
function
markupInlineImageBlock
(
$matches
)
{
$engine
=
$this
->
getEngine
();
$text
=
$matches
[
1
];
$element
=
new
SimpleXMLElement
(
"<element $text />"
);
$attributes
=
array
();
foreach
(
$element
->
attributes
()
as
$k
=>
$v
)
{
$attributes
[
$k
]
=
$v
;
}
$source_body
=
phutil_tag
(
'img'
,
$attributes
);
return
$engine
->
storeText
(
$source_body
);
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/m6/4w/4xnw7eikmmtreglw
Default Alt Text
img_support_in_remarkup (736 B)
Attached To
Mode
P1158 <img> support in remarkup
Attached
Detach File
Event Timeline
Log In to Comment