2013-02-26 23:59:31 +01:00
|
|
|
<?php
|
|
|
|
|
2013-07-16 22:31:20 +02:00
|
|
|
/**
|
|
|
|
* @group pholio
|
|
|
|
*/
|
2013-02-26 23:59:31 +01:00
|
|
|
final class PholioRemarkupRule
|
|
|
|
extends PhabricatorRemarkupRuleObject {
|
|
|
|
|
|
|
|
protected function getObjectNamePrefix() {
|
|
|
|
return 'M';
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function loadObjects(array $ids) {
|
|
|
|
$viewer = $this->getEngine()->getConfig('viewer');
|
|
|
|
return id(new PholioMockQuery())
|
|
|
|
->setViewer($viewer)
|
2013-03-07 17:23:40 +01:00
|
|
|
->needImages(true)
|
|
|
|
->needTokenCounts(true)
|
2013-02-26 23:59:31 +01:00
|
|
|
->withIDs($ids)
|
|
|
|
->execute();
|
|
|
|
}
|
|
|
|
|
2013-03-07 17:23:40 +01:00
|
|
|
protected function renderObjectEmbed($object, $handle, $options) {
|
|
|
|
$embed_mock = id(new PholioMockEmbedView())
|
|
|
|
->setMock($object);
|
|
|
|
|
2013-03-14 17:38:56 +01:00
|
|
|
if (strlen($options)) {
|
|
|
|
$parser = new PhutilSimpleOptions();
|
|
|
|
$opts = $parser->parse(substr($options, 1));
|
|
|
|
|
|
|
|
if (isset($opts['image'])) {
|
|
|
|
$images = array_unique(
|
|
|
|
explode('&', preg_replace('/\s+/', '', $opts['image'])));
|
|
|
|
|
|
|
|
$embed_mock->setImages($images);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-07 17:23:40 +01:00
|
|
|
return $embed_mock->render();
|
|
|
|
}
|
|
|
|
|
2013-02-26 23:59:31 +01:00
|
|
|
}
|