本文整理汇总了PHP中PhabricatorMarkupEngine::newPhrictionMarkupEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorMarkupEngine::newPhrictionMarkupEngine方法的具体用法?PHP PhabricatorMarkupEngine::newPhrictionMarkupEngine怎么用?PHP PhabricatorMarkupEngine::newPhrictionMarkupEngine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorMarkupEngine
的用法示例。
在下文中一共展示了PhabricatorMarkupEngine::newPhrictionMarkupEngine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
$document = $request->getStr('document');
$engine = PhabricatorMarkupEngine::newPhrictionMarkupEngine();
$content = '<div class="phabricator-remarkup">' . $engine->markupText($document) . '</div>';
return id(new AphrontAjaxResponse())->setContent($content);
}
示例2: processRequest
public function processRequest()
{
$request = $this->getRequest();
$document = $request->getStr('document');
$content_obj = new PhrictionContent();
$content_obj->setContent($document);
$engine = PhabricatorMarkupEngine::newPhrictionMarkupEngine();
$content = $content_obj->renderContent();
return id(new AphrontAjaxResponse())->setContent($content);
}
示例3: renderContent
public function renderContent()
{
$engine = PhabricatorMarkupEngine::newPhrictionMarkupEngine();
$markup = $engine->markupText($this->getContent());
$toc = PhutilRemarkupEngineRemarkupHeaderBlockRule::renderTableOfContents($engine);
if ($toc) {
$toc = '<div class="phabricator-remarkup-toc">' . '<div class="phabricator-remarkup-toc-header">' . 'Table of Contents' . '</div>' . $toc . '</div>';
}
return '<div class="phabricator-remarkup">' . $toc . $markup . '</div>';
}
示例4: processRequest
public function processRequest()
{
$request = $this->getRequest();
$document = $request->getStr('document');
$draft_key = $request->getStr('draftkey');
if ($draft_key) {
$table = new PhabricatorDraft();
queryfx($table->establishConnection('w'), 'INSERT INTO %T (authorPHID, draftKey, draft) VALUES (%s, %s, %s)
ON DUPLICATE KEY UPDATE draft = VALUES(draft)', $table->getTableName(), $request->getUser()->getPHID(), $draft_key, $document);
}
$content_obj = new PhrictionContent();
$content_obj->setContent($document);
$engine = PhabricatorMarkupEngine::newPhrictionMarkupEngine();
$content = $content_obj->renderContent();
return id(new AphrontAjaxResponse())->setContent($content);
}
示例5: newMarkupEngine
/**
* @task markup
*/
public function newMarkupEngine($field)
{
return PhabricatorMarkupEngine::newPhrictionMarkupEngine();
}
示例6: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$slug = PhrictionDocument::normalizeSlug($this->slug);
if ($slug != $this->slug) {
$uri = PhrictionDocument::getSlugURI($slug);
// Canonicalize pages to their one true URI.
return id(new AphrontRedirectResponse())->setURI($uri);
}
require_celerity_resource('phriction-document-css');
$document = id(new PhrictionDocument())->loadOneWhere('slug = %s', $slug);
$breadcrumbs = $this->renderBreadcrumbs($slug);
$version_note = null;
if (!$document) {
$create_uri = '/phriction/edit/?slug=' . $slug;
$page_content = '<div class="phriction-content">' . '<em>No content here!</em><br />' . 'No document found at <tt>' . phutil_escape_html($slug) . '</tt>. ' . 'You can <strong>' . phutil_render_tag('a', array('href' => $create_uri), 'create a new document') . '</strong>.' . '</div>';
$page_title = 'Page Not Found';
$button = phutil_render_tag('a', array('href' => $create_uri, 'class' => 'green button'), 'Create Page');
} else {
$version = $request->getInt('v');
if ($version) {
$content = id(new PhrictionContent())->loadOneWhere('documentID = %d AND version = %d', $document->getID(), $version);
if (!$content) {
return new Aphront404Response();
}
if ($content->getID() != $document->getContentID()) {
$version_note = new AphrontErrorView();
$version_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$version_note->setTitle('Older Version');
$version_note->appendChild('You are viewing an older version of this document, as it ' . 'appeared on ' . phabricator_datetime($content->getDateCreated(), $user) . '.');
}
} else {
$content = id(new PhrictionContent())->load($document->getContentID());
}
$page_title = $content->getTitle();
$phids = array($content->getAuthorPHID());
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$age = time() - $content->getDateCreated();
$age = floor($age / (60 * 60 * 24));
if ($age < 1) {
$when = 'today';
} else {
if ($age == 1) {
$when = 'yesterday';
} else {
$when = "{$age} days ago";
}
}
$byline = '<div class="phriction-byline">' . "Last updated {$when} by " . $handles[$content->getAuthorPHID()]->renderLink() . '.' . '</div>';
$engine = PhabricatorMarkupEngine::newPhrictionMarkupEngine();
$page_content = '<div class="phriction-content">' . $byline . '<div class="phabricator-remarkup">' . $engine->markupText($content->getContent()) . '</div>' . '</div>';
$button = phutil_render_tag('a', array('href' => '/phriction/edit/' . $document->getID() . '/', 'class' => 'button'), 'Edit Page');
}
if ($version_note) {
$version_note = $version_note->render();
}
$children = $this->renderChildren($slug);
$page = '<div class="phriction-header">' . $button . '<h1>' . phutil_escape_html($page_title) . '</h1>' . $breadcrumbs . '</div>' . $version_note . $page_content . $children;
return $this->buildStandardPageResponse($page, array('title' => 'Phriction - ' . $page_title, 'history' => PhrictionDocument::getSlugURI($slug, 'history')));
}