Page MenuHomePhabricator

img_support_in_remarkup

Authored By
swisspol
May 22 2014, 3:36 PM
Size
736 B
Referenced Files
None
Subscribers
None

img_support_in_remarkup

<?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

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)

Event Timeline