当前位置: 首页>>代码示例>>PHP>>正文


PHP phutil_implode_html函数代码示例

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


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

示例1: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $keys = $request->getStr('keys');
     try {
         $keys = phutil_json_decode($keys);
     } catch (PhutilJSONParserException $ex) {
         return new Aphront400Response();
     }
     // There have been at least two users asking for a keyboard shortcut to
     // close the dialog, so be explicit that escape works since it isn't
     // terribly discoverable.
     $keys[] = array('keys' => array('esc'), 'description' => pht('Close any dialog, including this one.'));
     $stroke_map = array('left' => "←", 'right' => "→", 'up' => "↑", 'down' => "↓", 'return' => "⏎", 'tab' => "⇥", 'delete' => "⌫");
     $rows = array();
     foreach ($keys as $shortcut) {
         $keystrokes = array();
         foreach ($shortcut['keys'] as $stroke) {
             $stroke = idx($stroke_map, $stroke, $stroke);
             $keystrokes[] = phutil_tag('kbd', array(), $stroke);
         }
         $keystrokes = phutil_implode_html(' or ', $keystrokes);
         $rows[] = phutil_tag('tr', array(), array(phutil_tag('th', array(), $keystrokes), phutil_tag('td', array(), $shortcut['description'])));
     }
     $table = phutil_tag('table', array('class' => 'keyboard-shortcut-help'), $rows);
     return $this->newDialog()->setTitle(pht('Keyboard Shortcuts'))->appendChild($table)->addCancelButton('#', pht('Close'));
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:27,代码来源:PhabricatorHelpKeyboardShortcutController.php

示例2: processRequest

 public function processRequest()
 {
     $root = dirname(phutil_get_library_root('phabricator'));
     require_once $root . '/support/phame/libskin.php';
     $this->cssResources = array();
     $css = $this->getPath('css/');
     if (Filesystem::pathExists($css)) {
         foreach (Filesystem::listDirectory($css) as $path) {
             if (!preg_match('/.css$/', $path)) {
                 continue;
             }
             $this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $this->getResourceURI('css/' . $path)));
         }
     }
     $map = CelerityResourceMap::getNamedInstance('phabricator');
     $resource_symbol = 'syntax-highlighting-css';
     $resource_uri = $map->getURIForSymbol($resource_symbol);
     $this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => PhabricatorEnv::getCDNURI($resource_uri)));
     $this->cssResources = phutil_implode_html("\n", $this->cssResources);
     $request = $this->getRequest();
     // Render page parts in order so the templates execute in order, if we're
     // using templates.
     $header = $this->renderHeader();
     $content = $this->renderContent($request);
     $footer = $this->renderFooter();
     if (!$content) {
         $content = $this->render404Page();
     }
     $content = array($header, $content, $footer);
     $response = new AphrontWebpageResponse();
     $response->setContent(phutil_implode_html("\n", $content));
     return $response;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:33,代码来源:PhameBasicTemplateBlogSkin.php

示例3: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $inlines = $this->loadInlineComments();
     assert_instances_of($inlines, 'PhabricatorInlineCommentInterface');
     $engine = new PhabricatorMarkupEngine();
     $engine->setViewer($user);
     foreach ($inlines as $inline) {
         $engine->addObject($inline, PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
     }
     $engine->process();
     $phids = array($user->getPHID());
     $handles = $this->loadViewerHandles($phids);
     $views = array();
     foreach ($inlines as $inline) {
         $view = new DifferentialInlineCommentView();
         $view->setInlineComment($inline);
         $view->setMarkupEngine($engine);
         $view->setHandles($handles);
         $view->setEditable(false);
         $view->setPreview(true);
         $views[] = $view->render();
     }
     $views = phutil_implode_html("\n", $views);
     return id(new AphrontAjaxResponse())->setContent($views);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:27,代码来源:PhabricatorInlineCommentPreviewController.php

示例4: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $document = id(new PhrictionDocumentQuery())->setViewer($user)->withIDs(array($this->id))->needContent(true)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_VIEW))->executeOne();
     if (!$document) {
         return new Aphront404Response();
     }
     $document_uri = PhrictionDocument::getSlugURI($document->getSlug());
     $e_text = null;
     if ($request->isFormPost()) {
         $xactions = array();
         $xactions[] = id(new PhrictionTransaction())->setTransactionType(PhrictionTransaction::TYPE_DELETE)->setNewValue(true);
         $editor = id(new PhrictionTransactionEditor())->setActor($user)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true);
         try {
             $editor->applyTransactions($document, $xactions);
             return id(new AphrontRedirectResponse())->setURI($document_uri);
         } catch (PhabricatorApplicationTransactionValidationException $ex) {
             $e_text = phutil_implode_html("\n", $ex->getErrorMessages());
         }
     }
     if ($e_text) {
         $dialog = id(new AphrontDialogView())->setUser($user)->setTitle(pht('Can Not Delete Document!'))->appendChild($e_text)->addCancelButton($document_uri);
     } else {
         $dialog = id(new AphrontDialogView())->setUser($user)->setTitle(pht('Delete Document?'))->appendChild(pht('Really delete this document? You can recover it later by ' . 'reverting to a previous version.'))->addSubmitButton(pht('Delete'))->addCancelButton($document_uri);
     }
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:28,代码来源:PhrictionDeleteController.php

示例5: render

 public function render()
 {
     if ($this->header !== null) {
         $header = phutil_tag('h1', array(), $this->header);
     } else {
         $header = null;
     }
     if ($this->caption !== null) {
         $caption = phutil_tag_div('aphront-panel-view-caption', $this->caption);
     } else {
         $caption = null;
     }
     $buttons = null;
     if ($this->buttons) {
         $buttons = phutil_tag_div('aphront-panel-view-buttons', phutil_implode_html(' ', $this->buttons));
     }
     $header_elements = phutil_tag_div('aphront-panel-header', array($buttons, $header, $caption));
     $table = phutil_implode_html('', $this->renderChildren());
     require_celerity_resource('aphront-panel-view-css');
     $classes = $this->classes;
     $classes[] = 'aphront-panel-view';
     if ($this->width) {
         $classes[] = 'aphront-panel-width-' . $this->width;
     }
     return phutil_tag('div', array('class' => implode(' ', $classes), 'id' => $this->id), array($header_elements, $table));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:26,代码来源:AphrontPanelView.php

示例6: getRevisionMatchExplanation

 private function getRevisionMatchExplanation($revision_match_data, PhabricatorObjectHandle $obj_handle)
 {
     if (!$revision_match_data) {
         return pht('This commit was made before this feature was built and thus this ' . 'information is unavailable.');
     }
     $body_why = array();
     if ($revision_match_data['usedURI']) {
         return pht('We found a "%s" field with value "%s" in the commit message, ' . 'and the domain on the URI matches this install, so ' . 'we linked this commit to %s.', 'Differential Revision', $revision_match_data['foundURI'], phutil_tag('a', array('href' => $obj_handle->getURI()), $obj_handle->getName()));
     } else {
         if ($revision_match_data['foundURI']) {
             $body_why[] = pht('We found a "%s" field with value "%s" in the commit message, ' . 'but the domain on this URI did not match the configured ' . 'domain for this install, "%s", so we ignored it under ' . 'the assumption that it refers to some third-party revision.', 'Differential Revision', $revision_match_data['foundURI'], $revision_match_data['validDomain']);
         } else {
             $body_why[] = pht('We didn\'t find a "%s" field in the commit message.', 'Differential Revision');
         }
     }
     switch ($revision_match_data['matchHashType']) {
         case ArcanistDifferentialRevisionHash::HASH_GIT_TREE:
             $hash_info = true;
             $hash_type = 'tree';
             break;
         case ArcanistDifferentialRevisionHash::HASH_GIT_COMMIT:
         case ArcanistDifferentialRevisionHash::HASH_MERCURIAL_COMMIT:
             $hash_info = true;
             $hash_type = 'commit';
             break;
         default:
             $hash_info = false;
             break;
     }
     if ($hash_info) {
         $diff_link = phutil_tag('a', array('href' => $obj_handle->getURI()), $obj_handle->getName());
         $body_why = pht('This commit and the active diff of %s had the same %s hash ' . '(%s) so we linked this commit to %s.', $diff_link, $hash_type, $revision_match_data['matchHashValue'], $diff_link);
     }
     return phutil_implode_html("\n", $body_why);
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:35,代码来源:DifferentialRevisionCloseDetailsController.php

示例7: getTagContent

 protected function getTagContent()
 {
     require_celerity_resource('ponder-view-css');
     $answer = $this->answer;
     $viewer = $this->getUser();
     $status = $answer->getStatus();
     $author_phid = $answer->getAuthorPHID();
     $actions = $this->buildAnswerActions();
     $handle = $this->handle;
     $id = $answer->getID();
     if ($status == PonderAnswerStatus::ANSWER_STATUS_HIDDEN) {
         $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $answer, PhabricatorPolicyCapability::CAN_EDIT);
         $message = array();
         $message[] = phutil_tag('em', array(), pht('This answer has been hidden.'));
         if ($can_edit) {
             $message[] = phutil_tag('a', array('href' => "/ponder/answer/edit/{$id}/"), pht('Edit Answer'));
         }
         $message = phutil_implode_html(' ', $message);
         return id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($message);
     }
     $action_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Actions'))->setHref('#')->setIcon('fa-bars')->setDropdownMenu($actions);
     $header_name = phutil_tag('a', array('href' => $handle->getURI()), $handle->getName());
     $header = id(new PHUIHeaderView())->setUser($viewer)->setEpoch($answer->getDateModified())->setHeader($header_name)->addActionLink($action_button)->setImage($handle->getImageURI())->setImageURL($handle->getURI());
     $content = phutil_tag('div', array('class' => 'phabricator-remarkup'), PhabricatorMarkupEngine::renderOneObject($answer, $answer->getMarkupField(), $viewer));
     $anchor = id(new PhabricatorAnchorView())->setAnchorName("A{$id}");
     $content_id = celerity_generate_unique_node_id();
     $footer = id(new PonderFooterView())->setContentID($content_id)->setCount(count($this->transactions));
     $content = phutil_tag_div('ponder-answer-content', array($anchor, $content, $footer));
     $answer_view = id(new PHUIObjectBoxView())->setHeader($header)->setBackground(PHUIObjectBoxView::GREY)->addClass('ponder-answer')->appendChild($content);
     $comment_view = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setShowPreview(false)->setHeaderText(pht('Answer Comment'))->setAction("/ponder/answer/comment/{$id}/")->setSubmitButtonName(pht('Comment'));
     $hidden_view = phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), array($this->timeline, $comment_view));
     return array($answer_view, $hidden_view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:33,代码来源:PonderAnswerView.php

示例8: render

 public function render()
 {
     require_celerity_resource('phabricator-source-code-view-css');
     require_celerity_resource('syntax-highlighting-css');
     Javelin::initBehavior('phabricator-oncopy', array());
     $line_number = $this->start;
     $rows = array();
     foreach ($this->lines as $line) {
         $hit_limit = $this->limit && $line_number == $this->limit && count($this->lines) != $this->limit;
         if ($hit_limit) {
             $content_number = '';
             $content_line = phutil_tag('span', array('class' => 'c'), pht('...'));
         } else {
             $content_number = $line_number;
             $content_line = $line;
         }
         $row_attributes = array();
         if (isset($this->highlights[$line_number])) {
             $row_attributes['class'] = 'phabricator-source-highlight';
         }
         // TODO: Provide nice links.
         $th = phutil_tag('th', array('class' => 'phabricator-source-line', 'style' => 'background-color: #fff;'), $content_number);
         $td = phutil_tag('td', array('class' => 'phabricator-source-code'), $content_line);
         $rows[] = phutil_tag('tr', $row_attributes, array($th, $td));
         if ($hit_limit) {
             break;
         }
         $line_number++;
     }
     $classes = array();
     $classes[] = 'phabricator-source-code-view';
     $classes[] = 'remarkup-code';
     $classes[] = 'PhabricatorMonospaced';
     return phutil_tag('div', array('class' => 'phabricator-source-code-container', 'style' => 'background-color: black; color: white;'), phutil_tag('table', array('class' => implode(' ', $classes), 'style' => 'background-color: black'), phutil_implode_html('', $rows)));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:ShellLogView.php

示例9: renderPanel

 public function renderPanel()
 {
     $data = $this->getData();
     $sections = array('Basics' => array('Machine' => php_uname('n')));
     // NOTE: This may not be present for some SAPIs, like php-fpm.
     if (!empty($data['Server']['SERVER_ADDR'])) {
         $addr = $data['Server']['SERVER_ADDR'];
         $sections['Basics']['Host'] = $addr;
         $sections['Basics']['Hostname'] = @gethostbyaddr($addr);
     }
     $sections = array_merge($sections, $data);
     $mask = array('HTTP_COOKIE' => true, 'HTTP_X_PHABRICATOR_CSRF' => true);
     $out = array();
     foreach ($sections as $header => $map) {
         $rows = array();
         foreach ($map as $key => $value) {
             if (isset($mask[$key])) {
                 $rows[] = array($key, phutil_tag('em', array(), '(Masked)'));
             } else {
                 $rows[] = array($key, is_array($value) ? json_encode($value) : $value);
             }
         }
         $table = new AphrontTableView($rows);
         $table->setHeaders(array($header, null));
         $table->setColumnClasses(array('header', 'wide wrap'));
         $out[] = $table->render();
     }
     return phutil_implode_html("\n", $out);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:29,代码来源:DarkConsoleRequestPlugin.php

示例10: markupNavigation

 public function markupNavigation(array $matches)
 {
     if (!$this->isFlatText($matches[0])) {
         return $matches[0];
     }
     $elements = ltrim($matches[1], ", \n");
     $elements = explode('>', $elements);
     $defaults = array('name' => null, 'type' => 'link', 'href' => null, 'icon' => null);
     $sequence = array();
     $parser = new PhutilSimpleOptions();
     foreach ($elements as $element) {
         if (strpos($element, '=') === false) {
             $sequence[] = array('name' => trim($element)) + $defaults;
         } else {
             $sequence[] = $parser->parse($element) + $defaults;
         }
     }
     if ($this->getEngine()->isTextMode()) {
         return implode(' > ', ipull($sequence, 'name'));
     }
     static $icon_names;
     if (!$icon_names) {
         $icon_names = array_fuse(PHUIIconView::getIcons());
     }
     $out = array();
     foreach ($sequence as $item) {
         $item_name = $item['name'];
         $item_color = PHUITagView::COLOR_GREY;
         if ($item['type'] == 'instructions') {
             $item_name = phutil_tag('em', array(), $item_name);
             $item_color = PHUITagView::COLOR_INDIGO;
         }
         $tag = id(new PHUITagView())->setType(PHUITagView::TYPE_SHADE)->setShade($item_color)->setName($item_name);
         if ($item['icon']) {
             $icon_name = 'fa-' . $item['icon'];
             if (isset($icon_names[$icon_name])) {
                 $tag->setIcon($icon_name);
             }
         }
         if ($item['href'] !== null) {
             if (PhabricatorEnv::isValidRemoteURIForLink($item['href'])) {
                 $tag->setHref($item['href']);
                 $tag->setExternal(true);
             }
         }
         $out[] = $tag;
     }
     if ($this->getEngine()->isHTMLMailMode()) {
         $arrow_attr = array('style' => 'color: #92969D;');
         $nav_attr = array();
     } else {
         $arrow_attr = array('class' => 'remarkup-nav-sequence-arrow');
         $nav_attr = array('class' => 'remarkup-nav-sequence');
     }
     $joiner = phutil_tag('span', $arrow_attr, " → ");
     $out = phutil_implode_html($joiner, $out);
     $out = phutil_tag('span', $nav_attr, $out);
     return $this->getEngine()->storeText($out);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:59,代码来源:PhabricatorNavigationRemarkupRule.php

示例11: renderThreadsHTML

 public function renderThreadsHTML()
 {
     $thread_html = array();
     foreach ($this->threads as $thread) {
         $thread_html[] = $this->renderSingleThread($thread);
     }
     return phutil_implode_html('', $thread_html);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:8,代码来源:ConpherenceThreadListView.php

示例12: implode_selected_handle_links

/**
 * Implodes selected handles from a pool of handles. Useful if you load handles
 * for various phids, but only render a few of them at a time.
 *
 * @return PhutilSafeHTML
 */
function implode_selected_handle_links($glue, array $handles, array $phids)
{
    $items = array();
    foreach ($phids as $phid) {
        $items[] = $handles[$phid]->renderLink();
    }
    return phutil_implode_html($glue, $items);
}
开发者ID:denghp,项目名称:phabricator,代码行数:14,代码来源:render.php

示例13: buildClusterNotificationStatus

 private function buildClusterNotificationStatus()
 {
     $viewer = $this->getViewer();
     $servers = PhabricatorNotificationServerRef::newRefs();
     Javelin::initBehavior('phabricator-tooltips');
     $rows = array();
     foreach ($servers as $server) {
         if ($server->isAdminServer()) {
             $type_icon = 'fa-database sky';
             $type_tip = pht('Admin Server');
         } else {
             $type_icon = 'fa-bell sky';
             $type_tip = pht('Client Server');
         }
         $type_icon = id(new PHUIIconView())->setIcon($type_icon)->addSigil('has-tooltip')->setMetadata(array('tip' => $type_tip));
         $messages = array();
         $details = array();
         if ($server->isAdminServer()) {
             try {
                 $details = $server->loadServerStatus();
                 $status_icon = 'fa-exchange green';
                 $status_label = pht('Version %s', idx($details, 'version'));
             } catch (Exception $ex) {
                 $status_icon = 'fa-times red';
                 $status_label = pht('Connection Error');
                 $messages[] = $ex->getMessage();
             }
         } else {
             try {
                 $server->testClient();
                 $status_icon = 'fa-exchange green';
                 $status_label = pht('Connected');
             } catch (Exception $ex) {
                 $status_icon = 'fa-times red';
                 $status_label = pht('Connection Error');
                 $messages[] = $ex->getMessage();
             }
         }
         if ($details) {
             $uptime = idx($details, 'uptime');
             $uptime = $uptime / 1000;
             $uptime = phutil_format_relative_time_detailed($uptime);
             $clients = pht('%s Active / %s Total', new PhutilNumber(idx($details, 'clients.active')), new PhutilNumber(idx($details, 'clients.total')));
             $stats = pht('%s In / %s Out', new PhutilNumber(idx($details, 'messages.in')), new PhutilNumber(idx($details, 'messages.out')));
         } else {
             $uptime = null;
             $clients = null;
             $stats = null;
         }
         $status_view = array(id(new PHUIIconView())->setIcon($status_icon), ' ', $status_label);
         $messages = phutil_implode_html(phutil_tag('br'), $messages);
         $rows[] = array($type_icon, $server->getProtocol(), $server->getHost(), $server->getPort(), $status_view, $uptime, $clients, $stats, $messages);
     }
     $table = id(new AphrontTableView($rows))->setNoDataString(pht('No notification servers are configured.'))->setHeaders(array(null, pht('Proto'), pht('Host'), pht('Port'), pht('Status'), pht('Uptime'), pht('Clients'), pht('Messages'), null))->setColumnClasses(array(null, null, null, null, null, null, null, null, 'wide'));
     $doc_href = PhabricatorEnv::getDoclink('Cluster: Notifications');
     $header = id(new PHUIHeaderView())->setHeader(pht('Cluster Notification Status'))->addActionLink(id(new PHUIButtonView())->setIcon('fa-book')->setHref($doc_href)->setTag('a')->setText(pht('Documentation')));
     return id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:58,代码来源:PhabricatorConfigClusterNotificationsController.php

示例14: markupText

 public function markupText($text, $children)
 {
     $text = preg_replace('/%%%\\s*$/', '', substr($text, 3));
     if ($this->getEngine()->isTextMode()) {
         return $text;
     }
     $text = phutil_split_lines($text, $retain_endings = true);
     return phutil_implode_html(phutil_tag('br', array()), $text);
 }
开发者ID:lsubra,项目名称:libphutil,代码行数:9,代码来源:PhutilRemarkupLiteralBlockRule.php

示例15: renderPropertyViewValue

 public function renderPropertyViewValue(array $handles)
 {
     $value = $this->getFieldValue();
     if (!$value) {
         return null;
     }
     $handles = mpull($handles, 'renderLink');
     $handles = phutil_implode_html(', ', $handles);
     return $handles;
 }
开发者ID:nilsdornblut,项目名称:phabricator,代码行数:10,代码来源:PhabricatorStandardCustomFieldPHIDs.php


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