• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phutil_escape_html_newlines函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中phutil_escape_html_newlines函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_escape_html_newlines函数的具体用法?PHP phutil_escape_html_newlines怎么用?PHP phutil_escape_html_newlines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了phutil_escape_html_newlines函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: markupText

 public function markupText($text, $children)
 {
     $engine = $this->getEngine();
     $text = trim($text);
     $text = $this->applyRules($text);
     if ($engine->isTextMode()) {
         if (!$this->getEngine()->getConfig('preserve-linebreaks')) {
             $text = preg_replace('/ *\\n */', ' ', $text);
         }
         return $text;
     }
     if ($engine->getConfig('preserve-linebreaks')) {
         $text = phutil_escape_html_newlines($text);
     }
     if (!strlen($text)) {
         return null;
     }
     $default_attributes = $engine->getConfig('default.p.attributes');
     if ($default_attributes) {
         $attributes = $default_attributes;
     } else {
         $attributes = array();
     }
     return phutil_tag('p', $attributes, $text);
 }
开发者ID:endlessm,项目名称:libphutil,代码行数:25,代码来源:PhutilRemarkupDefaultBlockRule.php


示例2: renderForMail

 public function renderForMail()
 {
     $diff = $this->buildDiff();
     $old_styles = array('padding: 0 2px;', 'color: #802b2b;', 'background: rgba(251, 175, 175, .7);');
     $old_styles = implode(' ', $old_styles);
     $new_styles = array('padding: 0 2px;', 'color: #3e6d35;', 'background: rgba(151, 234, 151, .6);');
     $new_styles = implode(' ', $new_styles);
     $omit_styles = array('padding: 8px 0;');
     $omit_styles = implode(' ', $omit_styles);
     $result = array();
     foreach ($diff->getSummaryParts() as $part) {
         $type = $part['type'];
         $text = $part['text'];
         switch ($type) {
             case '.':
                 $result[] = phutil_tag('div', array('style' => $omit_styles), pht('...'));
                 break;
             case '-':
                 $result[] = phutil_tag('span', array('style' => $old_styles), $text);
                 break;
             case '+':
                 $result[] = phutil_tag('span', array('style' => $new_styles), $text);
                 break;
             case '=':
                 $result[] = $text;
                 break;
         }
     }
     $styles = array('white-space: pre-wrap;', 'color: #74777D;');
     // Beyond applying "pre-wrap", convert newlines to "<br />" explicitly
     // to improve behavior in clients like Airmail.
     $result = phutil_escape_html_newlines($result);
     return phutil_tag('div', array('style' => implode(' ', $styles)), $result);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:34,代码来源:PhabricatorApplicationTransactionTextDiffDetailView.php


示例3: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $signature = id(new LegalpadDocumentSignatureQuery())->setViewer($viewer)->withIDs(array($this->id))->executeOne();
     if (!$signature) {
         return new Aphront404Response();
     }
     // NOTE: In order to see signature details (which include the relatively
     // internal-feeling "notes" field) you must be able to edit the document.
     // Essentially, this power is for document managers. Notably, this prevents
     // users from seeing notes about their own exemptions by guessing their
     // signature ID. This is purely a policy check.
     $document = id(new LegalpadDocumentQuery())->setViewer($viewer)->withIDs(array($signature->getDocument()->getID()))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
     if (!$document) {
         return new Aphront404Response();
     }
     $document_id = $signature->getDocument()->getID();
     $next_uri = $this->getApplicationURI('signatures/' . $document_id . '/');
     $data = $signature->getSignatureData();
     $exemption_phid = $signature->getExemptionPHID();
     $actor_phid = idx($data, 'actorPHID');
     $handles = $this->loadViewerHandles(array($exemption_phid, $actor_phid));
     $exemptor_handle = $handles[$exemption_phid];
     $actor_handle = $handles[$actor_phid];
     $form = id(new AphrontFormView())->setUser($viewer);
     if ($signature->getExemptionPHID()) {
         $form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Exemption By'))->setValue($exemptor_handle->renderLink()))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Notes'))->setValue(idx($data, 'notes')));
     }
     $type_corporation = LegalpadDocument::SIGNATURE_TYPE_CORPORATION;
     if ($signature->getSignatureType() == $type_corporation) {
         $form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Signing User'))->setValue($actor_handle->renderLink()))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Company Name'))->setValue(idx($data, 'name')))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Address'))->setValue(phutil_escape_html_newlines(idx($data, 'address'))))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Contact Name'))->setValue(idx($data, 'contact.name')))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Contact Email'))->setValue(phutil_tag('a', array('href' => 'mailto:' . idx($data, 'email')), idx($data, 'email'))));
     }
     return $this->newDialog()->setTitle(pht('Signature Details'))->setWidth(AphrontDialogView::WIDTH_FORM)->appendChild($form->buildLayoutView())->addCancelButton($next_uri, pht('Close'));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:LegalpadDocumentSignatureViewController.php


示例4: apply

 public function apply($text)
 {
     if ($this->getEngine()->isTextMode()) {
         return $text;
     }
     return phutil_escape_html_newlines($text);
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:7,代码来源:PhutilRemarkupRuleLinebreaks.php


示例5: getBodyForFeed

 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $new = $this->getNewValue();
     $body = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_CONTENT:
             return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($new));
             break;
     }
     return parent::getBodyForFeed($story);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:11,代码来源:PonderAnswerTransaction.php


示例6: getResponseBody

 protected function getResponseBody()
 {
     $ex = $this->exception;
     if ($ex instanceof AphrontUsageException) {
         $title = $ex->getTitle();
     } else {
         $title = get_class($ex);
     }
     $body = $ex->getMessage();
     $body = phutil_escape_html_newlines($body);
     return phutil_tag('div', array('class' => 'unhandled-exception-detail'), array(phutil_tag('h1', array('class' => 'unhandled-exception-title'), $title), phutil_tag('div', array('class' => 'unhandled-exception-body'), $body)));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:12,代码来源:AphrontUnhandledExceptionResponse.php


示例7: renderHarbormasterStatus

 protected function renderHarbormasterStatus(DifferentialDiff $diff, array $messages)
 {
     $colors = array(DifferentialLintStatus::LINT_NONE => 'grey', DifferentialLintStatus::LINT_OKAY => 'green', DifferentialLintStatus::LINT_WARN => 'yellow', DifferentialLintStatus::LINT_FAIL => 'red', DifferentialLintStatus::LINT_SKIP => 'blue', DifferentialLintStatus::LINT_AUTO_SKIP => 'blue');
     $icon_color = idx($colors, $diff->getLintStatus(), 'grey');
     $message = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
     $excuse = $diff->getProperty('arc:lint-excuse');
     if (strlen($excuse)) {
         $excuse = array(phutil_tag('strong', array(), pht('Excuse:')), ' ', phutil_escape_html_newlines($excuse));
     }
     $status = id(new PHUIStatusListView())->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color)->setTarget($message)->setNote($excuse));
     return $status;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:12,代码来源:DifferentialLintField.php


示例8: addTextSection

 /**
  * Add a block of text with a section header. This is rendered like this:
  *
  *    HEADER
  *      Text is indented.
  *
  * @param string Header text.
  * @param string Section text.
  * @return this
  * @task compose
  */
 public function addTextSection($header, $section)
 {
     if ($section instanceof PhabricatorMetaMTAMailSection) {
         $plaintext = $section->getPlaintext();
         $html = $section->getHTML();
     } else {
         $plaintext = $section;
         $html = phutil_escape_html_newlines(phutil_tag('div', array(), $section));
     }
     $this->addPlaintextSection($header, $plaintext);
     $this->addHTMLSection($header, $html);
     return $this;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:24,代码来源:PhabricatorMetaMTAMailBody.php


示例9: processRequest

 public function processRequest()
 {
     try {
         $status = PhabricatorNotificationClient::getServerStatus();
         $status = $this->renderServerStatus($status);
     } catch (Exception $ex) {
         $status = new AphrontErrorView();
         $status->setTitle('Notification Server Issue');
         $status->appendChild(hsprintf('Unable to determine server status. This probably means the server ' . 'is not in great shape. The specific issue encountered was:' . '<br />' . '<br />' . '<strong>%s</strong> %s', get_class($ex), phutil_escape_html_newlines($ex->getMessage())));
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Status'));
     return $this->buildApplicationPage(array($crumbs, $status), array('title' => pht('Notification Server Status'), 'device' => false));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:14,代码来源:PhabricatorNotificationStatusController.php


示例10: markupText

 public function markupText($text)
 {
     $text = trim($text);
     $text = $this->applyRules($text);
     if ($this->getEngine()->isTextMode()) {
         if (!$this->getEngine()->getConfig('preserve-linebreaks')) {
             $text = preg_replace('/ *\\n */', ' ', $text);
         }
         return $text;
     }
     if ($this->getEngine()->getConfig('preserve-linebreaks')) {
         $text = phutil_escape_html_newlines($text);
     }
     return phutil_tag('p', array(), $text);
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:15,代码来源:PhutilRemarkupEngineRemarkupDefaultBlockRule.php


示例11: newTable

 public function newTable()
 {
     $viewer = $this->getViewer();
     $logs = $this->getLogs();
     $show_sources = $this->getShowImportSources();
     $rows = array();
     foreach ($logs as $log) {
         $icon = $log->getDisplayIcon($viewer);
         $color = $log->getDisplayColor($viewer);
         $name = $log->getDisplayType($viewer);
         $description = $log->getDisplayDescription($viewer);
         $rows[] = array($log->getID(), $show_sources ? $viewer->renderHandle($log->getImport()->getPHID()) : null, id(new PHUIIconView())->setIcon($icon, $color), $name, phutil_escape_html_newlines($description), phabricator_datetime($log->getDateCreated(), $viewer));
     }
     $table = id(new AphrontTableView($rows))->setHeaders(array(pht('ID'), pht('Source'), null, pht('Type'), pht('Message'), pht('Date')))->setColumnVisibility(array(true, $show_sources))->setColumnClasses(array('top', 'top', 'top', 'top pri', 'top wide', 'top'));
     return $table;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:16,代码来源:PhabricatorCalendarImportLogView.php


示例12: render

 public function render()
 {
     $readme_path = $this->getPath();
     $readme_name = basename($readme_path);
     $interpreter = $this->getReadmeLanguage($readme_name);
     require_celerity_resource('diffusion-readme-css');
     $content = $this->getContent();
     $class = null;
     switch ($interpreter) {
         case 'remarkup':
             // TODO: This is sketchy, but make sure we hit the markup cache.
             $markup_object = id(new PhabricatorMarkupOneOff())->setEngineRuleset('diffusion-readme')->setContent($content);
             $markup_field = 'default';
             $content = id(new PhabricatorMarkupEngine())->setViewer($this->getUser())->addObject($markup_object, $markup_field)->process()->getOutput($markup_object, $markup_field);
             $engine = $markup_object->newMarkupEngine($markup_field);
             $toc = PhutilRemarkupHeaderBlockRule::renderTableOfContents($engine);
             if ($toc) {
                 $toc = phutil_tag_div('phabricator-remarkup-toc', array(phutil_tag_div('phabricator-remarkup-toc-header', pht('Table of Contents')), $toc));
                 $content = array($toc, $content);
             }
             $readme_content = $content;
             $class = null;
             break;
         case 'rainbow':
             $content = id(new PhutilRainbowSyntaxHighlighter())->getHighlightFuture($content)->resolve();
             $readme_content = phutil_escape_html_newlines($content);
             require_celerity_resource('syntax-highlighting-css');
             $class = 'remarkup-code ml';
             break;
         default:
         case 'text':
             $readme_content = phutil_escape_html_newlines($content);
             $class = 'ml';
             break;
     }
     $readme_content = phutil_tag_div($class, $readme_content);
     $header = id(new PHUIHeaderView())->setHeader($readme_name);
     $document = id(new PHUIDocumentViewPro())->setFluid(true)->appendChild($readme_content);
     return id(new PHUIObjectBoxView())->setHeader($header)->appendChild($document)->addClass('diffusion-readme-view');
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:40,代码来源:DiffusionReadmeView.php


示例13: getResult

 protected function getResult(ConduitAPIRequest $request)
 {
     $drequest = $this->getDiffusionRequest();
     $path_dicts = $request->getValue('paths', array());
     $paths = array();
     foreach ($path_dicts as $dict) {
         $paths[] = DiffusionRepositoryPath::newFromDictionary($dict);
     }
     $best = -1;
     $readme = '';
     $best_render_type = 'plain';
     foreach ($paths as $result_path) {
         $file_type = $result_path->getFileType();
         if ($file_type != ArcanistDiffChangeType::FILE_NORMAL && $file_type != ArcanistDiffChangeType::FILE_TEXT) {
             // Skip directories, etc.
             continue;
         }
         $path = strtolower($result_path->getPath());
         if ($path === 'readme') {
             $path .= '.remarkup';
         }
         if (strncmp($path, 'readme.', 7) !== 0) {
             continue;
         }
         $priority = 0;
         switch (substr($path, 7)) {
             case 'remarkup':
                 $priority = 100;
                 $render_type = 'remarkup';
                 break;
             case 'rainbow':
                 $priority = 90;
                 $render_type = 'rainbow';
                 break;
             case 'md':
                 $priority = 50;
                 $render_type = 'remarkup';
                 break;
             case 'txt':
                 $priority = 10;
                 $render_type = 'plain';
                 break;
             default:
                 $priority = 0;
                 $render_type = 'plain';
                 break;
         }
         if ($priority > $best) {
             $best = $priority;
             $readme = $result_path;
             $best_render_type = $render_type;
         }
     }
     if (!$readme) {
         return '';
     }
     $readme_request = DiffusionRequest::newFromDictionary(array('user' => $request->getUser(), 'repository' => $drequest->getRepository(), 'commit' => $drequest->getStableCommit(), 'path' => $readme->getFullPath()));
     $file_content = DiffusionFileContent::newFromConduit(DiffusionQuery::callConduitWithDiffusionRequest($request->getUser(), $readme_request, 'diffusion.filecontentquery', array('commit' => $drequest->getStableCommit(), 'path' => $readme->getFullPath(), 'needsBlame' => false)));
     $readme_content = $file_content->getCorpus();
     switch ($best_render_type) {
         case 'plain':
             $readme_content = phutil_escape_html_newlines($readme_content);
             $class = null;
             break;
         case 'rainbow':
             $highlighter = new PhutilRainbowSyntaxHighlighter();
             $readme_content = $highlighter->getHighlightFuture($readme_content)->resolve();
             $readme_content = phutil_escape_html_newlines($readme_content);
             require_celerity_resource('syntax-highlighting-css');
             $class = 'remarkup-code';
             break;
         case 'remarkup':
             // TODO: This is sketchy, but make sure we hit the markup cache.
             $markup_object = id(new PhabricatorMarkupOneOff())->setEngineRuleset('diffusion-readme')->setContent($readme_content);
             $markup_field = 'default';
             $readme_content = id(new PhabricatorMarkupEngine())->setViewer($request->getUser())->addObject($markup_object, $markup_field)->process()->getOutput($markup_object, $markup_field);
             $engine = $markup_object->newMarkupEngine($markup_field);
             $toc = PhutilRemarkupHeaderBlockRule::renderTableOfContents($engine);
             if ($toc) {
                 $toc = phutil_tag_div('phabricator-remarkup-toc', array(phutil_tag_div('phabricator-remarkup-toc-header', pht('Table of Contents')), $toc));
                 $readme_content = array($toc, $readme_content);
             }
             $class = 'phabricator-remarkup';
             break;
     }
     $readme_content = phutil_tag('div', array('class' => $class), $readme_content);
     return $readme_content;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:88,代码来源:DiffusionReadmeQueryConduitAPIMethod.php


示例14: getBodyForFeed

 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $text = null;
     switch ($this->getTransactionType()) {
         case PholioTransactionType::TYPE_NAME:
             if ($this->getOldValue() === null) {
                 $mock = $story->getPrimaryObject();
                 $text = $mock->getDescription();
             }
             break;
         case PholioTransactionType::TYPE_INLINE:
             $text = $this->getComment()->getContent();
             break;
     }
     if ($text) {
         return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($text));
     }
     return parent::getBodyForFeed($story);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:19,代码来源:PholioTransaction.php


示例15: renderPropertyViewValue

 public function renderPropertyViewValue(array $handles)
 {
     $diff = $this->getObject()->getActiveDiff();
     $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
     $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
     $rows = array();
     $rows[] = array('style' => 'star', 'name' => $ustar, 'value' => $umsg, 'show' => true);
     $excuse = $diff->getProperty('arc:unit-excuse');
     if ($excuse) {
         $rows[] = array('style' => 'excuse', 'name' => 'Excuse', 'value' => phutil_escape_html_newlines($excuse), 'show' => true);
     }
     $show_limit = 10;
     $hidden = array();
     $udata = $diff->getProperty('arc:unit');
     if ($udata) {
         $sort_map = array(ArcanistUnitTestResult::RESULT_BROKEN => 0, ArcanistUnitTestResult::RESULT_FAIL => 1, ArcanistUnitTestResult::RESULT_UNSOUND => 2, ArcanistUnitTestResult::RESULT_SKIP => 3, ArcanistUnitTestResult::RESULT_POSTPONED => 4, ArcanistUnitTestResult::RESULT_PASS => 5);
         foreach ($udata as $key => $test) {
             $udata[$key]['sort'] = idx($sort_map, idx($test, 'result'));
         }
         $udata = isort($udata, 'sort');
         $engine = new PhabricatorMarkupEngine();
         $engine->setViewer($this->getViewer());
         $markup_objects = array();
         foreach ($udata as $key => $test) {
             $userdata = idx($test, 'userdata');
             if ($userdata) {
                 if ($userdata !== false) {
                     $userdata = str_replace("", '', $userdata);
                 }
                 $markup_object = id(new PhabricatorMarkupOneOff())->setContent($userdata)->setPreserveLinebreaks(true);
                 $engine->addObject($markup_object, 'default');
                 $markup_objects[$key] = $markup_object;
             }
         }
         $engine->process();
         foreach ($udata as $key => $test) {
             $result = idx($test, 'result');
             $default_hide = false;
             switch ($result) {
                 case ArcanistUnitTestResult::RESULT_POSTPONED:
                 case ArcanistUnitTestResult::RESULT_PASS:
                     $default_hide = true;
                     break;
             }
             if ($show_limit && !$default_hide) {
                 --$show_limit;
                 $show = true;
             } else {
                 $show = false;
                 if (empty($hidden[$result])) {
                     $hidden[$result] = 0;
                 }
                 $hidden[$result]++;
             }
             $value = idx($test, 'name');
             if (!empty($test['link'])) {
                 $value = phutil_tag('a', array('href' => $test['link'], 'target' => '_blank'), $value);
             }
             $rows[] = array('style' => $this->getResultStyle($result), 'name' => ucwords($result), 'value' => $value, 'show' => $show);
             if (isset($markup_objects[$key])) {
                 $rows[] = array('style' => 'details', 'value' => $engine->getOutput($markup_objects[$key], 'default'), 'show' => false);
                 if (empty($hidden['details'])) {
                     $hidden['details'] = 0;
                 }
                 $hidden['details']++;
             }
         }
     }
     $show_string = $this->renderShowString($hidden);
     $view = new DifferentialResultsTableView();
     $view->setRows($rows);
     $view->setShowMoreString($show_string);
     return $view->render();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:74,代码来源:DifferentialUnitField.php


示例16: getBodyForFeed

 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $text = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($this->getOldValue() === null) {
                 $post = $story->getPrimaryObject();
                 $text = $post->getBody();
             }
             break;
         case self::TYPE_VISIBILITY:
             if ($this->getNewValue() == PhameConstants::VISIBILITY_PUBLISHED) {
                 $post = $story->getPrimaryObject();
                 $text = $post->getBody();
             }
             break;
         case self::TYPE_BODY:
             $text = $this->getNewValue();
             break;
     }
     if (strlen($text)) {
         return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($text));
     }
     return parent::getBodyForFeed($story);
 }
开发者ID:hamilyjing,项目名称:phabricator,代码行数:25,代码来源:PhamePostTransaction.php


示例17: addFragment

 public function addFragment($fragment)
 {
     $this->plaintextFragments[] = $fragment;
     $this->htmlFragments[] = phutil_escape_html_newlines(phutil_tag('div', array(), $fragment));
     return $this;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:6,代码来源:PhabricatorMetaMTAMailSection.php


示例18: render

 public function render()
 {
     $issue = $this->getIssue();
     $description = array();
     $description[] = phutil_tag('div', array('class' => 'setup-issue-instructions'), phutil_escape_html_newlines($issue->getMessage()));
     $configs = $issue->getPHPConfig();
     if ($configs) {
         $description[] = $this->renderPHPConfig($configs, $issue);
     }
     $configs = $issue->getMySQLConfig();
     if ($configs) {
         $description[] = $this->renderMySQLConfig($configs);
     }
     $configs = $issue->getPhabricatorConfig();
     if ($configs) {
         $description[] = $this->renderPhabricatorConfig($configs);
     }
     $related_configs = $issue->getRelatedPhabricatorConfig();
     if ($related_configs) {
         $description[] = $this->renderPhabricatorConfig($related_configs, $related = true);
     }
     $commands = $issue->getCommands();
     if ($commands) {
         $run_these = pht('Run these %d command(s):', count($commands));
         $description[] = phutil_tag('div', array('class' => 'setup-issue-config'), array(phutil_tag('p', array(), $run_these), phutil_tag('pre', array(), phutil_implode_html("\n", $commands))));
     }
     $extensions = $issue->getPHPExtensions();
     if ($extensions) {
         $install_these = pht('Install these %d PHP extension(s):', count($extensions));
         $install_info = pht('You can usually install a PHP extension using %s or %s. Common ' . 'package names are %s or %s. Try commands like these:', phutil_tag('tt', array(), 'apt-get'), phutil_tag('tt', array(), 'yum'), hsprintf('<tt>php-<em>%s</em></tt>', pht('extname')), hsprintf('<tt>php5-<em>%s</em></tt>', pht('extname')));
         // TODO: We should do a better job of detecting how to install extensions
         // on the current system.
         $install_commands = hsprintf("\$ sudo apt-get install php5-<em>extname</em>  " . "# Debian / Ubuntu\n" . "\$ sudo yum install php-<em>extname</em>       " . "# Red Hat / Derivatives");
         $fallback_info = pht("If those commands don't work, try Google. The process of installing " . "PHP extensions is not specific to Phabricator, and any instructions " . "you can find for installing them on your system should work. On Mac " . "OS X, you might want to try Homebrew.");
         $restart_info = pht('After installing new PHP extensions, <strong>restart Phabricator ' . 'for the changes to take effect</strong>. For help with restarting ' . 'Phabricator, see %s in the documentation.', $this->renderRestartLink());
         $description[] = phutil_tag('div', array('class' => 'setup-issue-config'), array(phutil_tag('p', array(), $install_these), phutil_tag('pre', array(), implode("\n", $extensions)), phutil_tag('p', array(), $install_info), phutil_tag('pre', array(), $install_commands), phutil_tag('p', array(), $fallback_info), phutil_tag('p', array(), $restart_info)));
     }
     $related_links = $issue->getLinks();
     if ($related_links) {
         $description[] = $this->renderRelatedLinks($related_links);
     }
     $actions = array();
     if (!$issue->getIsFatal()) {
         if ($issue->getIsIgnored()) {
             $actions[] = javelin_tag('a', array('href' => '/config/unignore/' . $issue->getIssueKey() . '/', 'sigil' => 'workflow', 'class' => 'button grey'), pht('Unignore Setup Issue'));
         } else {
             $actions[] = javelin_tag('a', array('href' => '/config/ignore/' . $issue->getIssueKey() . '/', 'sigil' => 'workflow', 'class' => 'button grey'), pht('Ignore Setup Issue'));
         }
         $actions[] = javelin_tag('a', array('href' => '/config/issue/' . $issue->getIssueKey() . '/', 'class' => 'button grey', 'style' => 'float: right'), pht('Reload Page'));
     }
     if ($actions) {
         $actions = phutil_tag('div', array('class' => 'setup-issue-actions'), $actions);
     }
     if ($issue->getIsIgnored()) {
         $status = phutil_tag('div', array('class' => 'setup-issue-status'), pht('This issue is currently ignored, and does not show a global ' . 'warning.'));
         $next = null;
     } else {
         $status = null;
         $next = phutil_tag('div', array('class' => 'setup-issue-next'), pht('To continue, resolve this problem and reload the page.'));
     }
     $name = phutil_tag('div', array('class' => 'setup-issue-name'), $issue->getName());
     $head = phutil_tag('div', array('class' => 'setup-issue-head'), array($name, $status));
     $tail = phutil_tag('div', array('class' => 'setup-issue-tail'), array($actions));
     $issue = phutil_tag('div', array('class' => 'setup-issue'), array($head, $description, $tail));
     $debug_info = phutil_tag('div', array('class' => 'setup-issue-debug'), pht('Host: %s', php_uname('n')));
     return phutil_tag('div', array('class' => 'setup-issue-shell'), array($issue, $next, $debug_info));
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:67,代码来源:PhabricatorSetupIssueView.php


示例19: getBodyForFeed

 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $new = $this->getNewValue();
     $old = $this->getOldValue();
     $body = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 $question = $story->getObject($this->getObjectPHID());
                 return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($question->getContent()));
             }
             break;
         case self::TYPE_ANSWERS:
             $answer = $this->getNewAnswerObject($story);
             if ($answer) {
                 return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($answer->getContent()));
             }
             break;
     }
     return parent::getBodyForFeed($story);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:21,代码来源:PonderQuestionTransaction.php


示例20: buildRepositoryRawError

 private function buildRepositoryRawError(PhabricatorRepository $repository, array $messages)
 {
     $viewer = $this->getViewer();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $repository, PhabricatorPolicyCapability::CAN_EDIT);
     $raw_error = null;
     $message = idx($messages, PhabricatorRepositoryStatusMessage::TYPE_FETCH);
     if ($message) {
         switch ($message->getStatusCode()) {
             case PhabricatorRepositoryStatusMessage::CODE_ERROR:
                 $raw_error = $message->getParameter('message');
                 break;
         }
     }
     if ($raw_error !== null) {
         if (!$can_edit) {
             $raw_message = pht('You must be able to edit a repository to see raw error messages ' . 'because they sometimes disclose sensitive information.');
             $raw_message = phutil_tag('em', array(), $raw_message);
         } else {
             $raw_message = phutil_escape_html_newlines($raw_error);
         }
     } else {
         $raw_message = null;
     }
     return $raw_message;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:25,代码来源:DiffusionRepositoryStatusManagementPanel.php



注:本文中的phutil_escape_html_newlines函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP phutil_escape_uri函数代码示例发布时间:2022-05-15
下一篇:
PHP phutil_escape_html函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap