mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
render_tag -> tag: phame, remarkup
Summary: Converts various callsites from render_tag variants to tag variants. Test Plan: See inlines. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4689
This commit is contained in:
parent
820c6279f3
commit
edfcd7bd2d
11 changed files with 73 additions and 54 deletions
|
@ -48,7 +48,7 @@ final class DifferentialBlameRevisionFieldSpecification
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
||||||
return $engine->markupText($this->value);
|
return phutil_safe_html($engine->markupText($this->value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldAppearOnConduitView() {
|
public function shouldAppearOnConduitView() {
|
||||||
|
|
|
@ -113,7 +113,7 @@ final class DifferentialUnitFieldSpecification
|
||||||
$userdata = idx($test, 'userdata');
|
$userdata = idx($test, 'userdata');
|
||||||
if ($userdata) {
|
if ($userdata) {
|
||||||
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
||||||
$userdata = $engine->markupText($userdata);
|
$userdata = phutil_safe_html($engine->markupText($userdata));
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
'style' => 'details',
|
'style' => 'details',
|
||||||
'value' => $userdata,
|
'value' => $userdata,
|
||||||
|
|
|
@ -106,7 +106,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
|
|
||||||
private function markupText($text) {
|
private function markupText($text) {
|
||||||
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
||||||
$text = $engine->markupText($text);
|
$text = phutil_safe_html($engine->markupText($text));
|
||||||
|
|
||||||
$text = phutil_tag(
|
$text = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
|
|
|
@ -93,7 +93,8 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
|
|
||||||
$property_list->addTextContent(
|
$property_list->addTextContent(
|
||||||
'<div class="diffusion-commit-message phabricator-remarkup">'.
|
'<div class="diffusion-commit-message phabricator-remarkup">'.
|
||||||
$engine->markupText($commit_data->getCommitMessage()).
|
phutil_safe_html(
|
||||||
|
$engine->markupText($commit_data->getCommitMessage())).
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ abstract class DiffusionBrowseQuery {
|
||||||
} else {
|
} else {
|
||||||
// Markup extensionless files as remarkup so we get links and such.
|
// Markup extensionless files as remarkup so we get links and such.
|
||||||
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
||||||
$readme_content = $engine->markupText($readme_content);
|
$readme_content = phutil_safe_html($engine->markupText($readme_content));
|
||||||
|
|
||||||
$class = 'phabricator-remarkup';
|
$class = 'phabricator-remarkup';
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ final class PhabricatorPeopleProfileController
|
||||||
'//Nothing is known about this rare specimen.//');
|
'//Nothing is known about this rare specimen.//');
|
||||||
|
|
||||||
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
|
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
|
||||||
$blurb = $engine->markupText($blurb);
|
$blurb = phutil_safe_html($engine->markupText($blurb));
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
|
||||||
$view->setFrameable(true);
|
$view->setFrameable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$view->appendChild($content);
|
$view->appendChild($content);
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
$response = new AphrontWebpageResponse();
|
||||||
|
@ -95,23 +96,30 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
|
||||||
$summaries[] = $post->renderWithSummary();
|
$summaries[] = $post->renderWithSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = phutil_render_tag(
|
$list = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-post-list',
|
'class' => 'phame-post-list',
|
||||||
),
|
),
|
||||||
id(new AphrontNullView())->appendChild($summaries)->render());
|
id(new AphrontNullView())->appendChild($summaries)->render());
|
||||||
|
|
||||||
$pager = $this->renderOlderPageLink().$this->renderNewerPageLink();
|
$pager = null;
|
||||||
if ($pager) {
|
if ($this->renderOlderPageLink() || $this->renderNewerPageLink()) {
|
||||||
$pager = phutil_tag(
|
$pager = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-pager',
|
'class' => 'phame-pager',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$this->renderOlderPageLink(),
|
||||||
|
$this->renderNewerPageLink(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list.$pager;
|
return array(
|
||||||
|
$list,
|
||||||
|
$pager,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function render404Page() {
|
protected function render404Page() {
|
||||||
|
|
|
@ -87,7 +87,7 @@ final class PhamePostView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderBody() {
|
public function renderBody() {
|
||||||
return phutil_render_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-post-body',
|
'class' => 'phame-post-body',
|
||||||
|
@ -96,7 +96,7 @@ final class PhamePostView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderSummary() {
|
public function renderSummary() {
|
||||||
return phutil_render_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-post-body',
|
'class' => 'phame-post-body',
|
||||||
|
@ -159,20 +159,19 @@ final class PhamePostView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'id' => 'fb-root',
|
'id' => 'fb-root',
|
||||||
),
|
),
|
||||||
''
|
'');
|
||||||
);
|
|
||||||
|
|
||||||
$c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id;
|
$c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id;
|
||||||
$fb_js = jsprintf(
|
$fb_js = phutil_safe_html(
|
||||||
'<script>(function(d, s, id) {'.
|
jsprintf(
|
||||||
' var js, fjs = d.getElementsByTagName(s)[0];'.
|
'<script>(function(d, s, id) {'.
|
||||||
' if (d.getElementById(id)) return;'.
|
' var js, fjs = d.getElementsByTagName(s)[0];'.
|
||||||
' js = d.createElement(s); js.id = id;'.
|
' if (d.getElementById(id)) return;'.
|
||||||
' js.src = %s;'.
|
' js = d.createElement(s); js.id = id;'.
|
||||||
' fjs.parentNode.insertBefore(js, fjs);'.
|
' js.src = %s;'.
|
||||||
'}(document, \'script\', \'facebook-jssdk\'));</script>',
|
' fjs.parentNode.insertBefore(js, fjs);'.
|
||||||
$c_uri
|
'}(document, \'script\', \'facebook-jssdk\'));</script>',
|
||||||
);
|
$c_uri));
|
||||||
|
|
||||||
|
|
||||||
$uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle());
|
$uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle());
|
||||||
|
@ -183,17 +182,18 @@ final class PhamePostView extends AphrontView {
|
||||||
'data-href' => $uri,
|
'data-href' => $uri,
|
||||||
'data-num-posts' => 5,
|
'data-num-posts' => 5,
|
||||||
),
|
),
|
||||||
''
|
'');
|
||||||
);
|
|
||||||
|
|
||||||
return phutil_render_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-comments-facebook',
|
'class' => 'phame-comments-facebook',
|
||||||
),
|
),
|
||||||
$fb_root.
|
array(
|
||||||
$fb_js.
|
$fb_root,
|
||||||
$fb_comments);
|
$fb_js,
|
||||||
|
$fb_comments,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderDisqusComments() {
|
private function renderDisqusComments() {
|
||||||
|
@ -211,32 +211,34 @@ final class PhamePostView extends AphrontView {
|
||||||
);
|
);
|
||||||
|
|
||||||
// protip - try some var disqus_developer = 1; action to test locally
|
// protip - try some var disqus_developer = 1; action to test locally
|
||||||
$disqus_js = jsprintf(
|
$disqus_js = phutil_safe_html(
|
||||||
'<script>'.
|
jsprintf(
|
||||||
' var disqus_shortname = "phabricator";'.
|
'<script>'.
|
||||||
' var disqus_identifier = %s;'.
|
' var disqus_shortname = "phabricator";'.
|
||||||
' var disqus_url = %s;'.
|
' var disqus_identifier = %s;'.
|
||||||
' var disqus_title = %s;'.
|
' var disqus_url = %s;'.
|
||||||
'(function() {'.
|
' var disqus_title = %s;'.
|
||||||
' var dsq = document.createElement("script");'.
|
'(function() {'.
|
||||||
' dsq.type = "text/javascript";'.
|
' var dsq = document.createElement("script");'.
|
||||||
' dsq.async = true;'.
|
' dsq.type = "text/javascript";'.
|
||||||
' dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";'.
|
' dsq.async = true;'.
|
||||||
'(document.getElementsByTagName("head")[0] ||'.
|
' dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";'.
|
||||||
' document.getElementsByTagName("body")[0]).appendChild(dsq);'.
|
'(document.getElementsByTagName("head")[0] ||'.
|
||||||
'})(); </script>',
|
' document.getElementsByTagName("body")[0]).appendChild(dsq);'.
|
||||||
$post->getPHID(),
|
'})(); </script>',
|
||||||
$this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()),
|
$post->getPHID(),
|
||||||
$post->getTitle()
|
$this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()),
|
||||||
);
|
$post->getTitle()));
|
||||||
|
|
||||||
return phutil_render_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-comments-disqus',
|
'class' => 'phame-comments-disqus',
|
||||||
),
|
),
|
||||||
$disqus_thread.
|
array(
|
||||||
$disqus_js);
|
$disqus_thread,
|
||||||
|
$disqus_js,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,15 @@ final class ConduitAPI_remarkup_process_Method extends ConduitAPIMethod {
|
||||||
$engine = PhabricatorMarkupEngine::$engine_class();
|
$engine = PhabricatorMarkupEngine::$engine_class();
|
||||||
$engine->setConfig('viewer', $request->getUser());
|
$engine->setConfig('viewer', $request->getUser());
|
||||||
|
|
||||||
|
$text = $engine->markupText($content);
|
||||||
|
if ($text) {
|
||||||
|
$content = phutil_safe_html($text)->getHTMLContent();
|
||||||
|
} else {
|
||||||
|
$content = '';
|
||||||
|
}
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
'content' => $engine->markupText($content),
|
'content' => $content,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -203,7 +203,8 @@ final class PhabricatorSlowvotePollController
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
$handle = $handles[$comment->getAuthorPHID()];
|
$handle = $handles[$comment->getAuthorPHID()];
|
||||||
|
|
||||||
$markup = $engine->markupText($comment->getCommentText());
|
$markup = phutil_safe_html(
|
||||||
|
$engine->markupText($comment->getCommentText()));
|
||||||
|
|
||||||
require_celerity_resource('phabricator-remarkup-css');
|
require_celerity_resource('phabricator-remarkup-css');
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ final class PhabricatorMarkupEngine {
|
||||||
"Call process() before getOutput().");
|
"Call process() before getOutput().");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->objects[$key]['output'];
|
return new PhutilSafeHTML($this->objects[$key]['output']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue