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

PHP msort函数代码示例

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

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



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

示例1: render

 public function render()
 {
     $messages = $this->unitMessages;
     $messages = msort($messages, 'getSortKey');
     if ($this->limit) {
         $messages = array_slice($messages, 0, $this->limit);
     }
     $rows = array();
     $any_duration = false;
     foreach ($messages as $message) {
         $result = $this->renderResult($message->getResult());
         $duration = $message->getDuration();
         if ($duration !== null) {
             $any_duration = true;
             $duration = pht('%s ms', new PhutilNumber((int) (1000 * $duration)));
         }
         $name = $message->getName();
         $namespace = $message->getNamespace();
         if (strlen($namespace)) {
             $name = $namespace . '::' . $name;
         }
         $engine = $message->getEngine();
         if (strlen($engine)) {
             $name = $engine . ' > ' . $name;
         }
         $rows[] = array($result, $duration, $name);
     }
     $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Result'), pht('Time'), pht('Test')))->setColumnClasses(array(null, null, 'pri wide'))->setColumnVisibility(array(true, $any_duration));
     return $table;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:HarbormasterUnitPropertyView.php


示例2: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $xaction = id(new PhabricatorObjectQuery())->withPHIDs(array($this->phid))->setViewer($user)->executeOne();
     if (!$xaction) {
         return new Aphront404Response();
     }
     if (!$xaction->getComment()) {
         // You can't view history of a transaction with no comments.
         return new Aphront404Response();
     }
     if ($xaction->getComment()->getIsRemoved()) {
         // You can't view history of a transaction with a removed comment.
         return new Aphront400Response();
     }
     $comments = id(new PhabricatorApplicationTransactionTemplatedCommentQuery())->setViewer($user)->setTemplate($xaction->getApplicationTransactionCommentObject())->withTransactionPHIDs(array($xaction->getPHID()))->execute();
     if (!$comments) {
         return new Aphront404Response();
     }
     $comments = msort($comments, 'getCommentVersion');
     $xactions = array();
     foreach ($comments as $comment) {
         $xactions[] = id(clone $xaction)->makeEphemeral()->setCommentVersion($comment->getCommentVersion())->setContentSource($comment->getContentSource())->setDateCreated($comment->getDateCreated())->attachComment($comment);
     }
     $obj_phid = $xaction->getObjectPHID();
     $obj_handle = id(new PhabricatorHandleQuery())->setViewer($user)->withPHIDs(array($obj_phid))->executeOne();
     $view = id(new PhabricatorApplicationTransactionView())->setUser($user)->setObjectPHID($obj_phid)->setTransactions($xactions)->setShowEditActions(false)->setHideCommentOptions(true);
     $dialog = id(new AphrontDialogView())->setUser($user)->setWidth(AphrontDialogView::WIDTH_FULL)->setFlush(true)->setTitle(pht('Comment History'));
     $dialog->appendChild($view);
     $dialog->addCancelButton($obj_handle->getURI());
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:33,代码来源:PhabricatorApplicationTransactionCommentHistoryController.php


示例3: renderModuleStatus

 public function renderModuleStatus(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $types = PhabricatorPHIDType::getAllTypes();
     $types = msort($types, 'getTypeConstant');
     $rows = array();
     foreach ($types as $key => $type) {
         $class_name = $type->getPHIDTypeApplicationClass();
         if ($class_name !== null) {
             $app = PhabricatorApplication::getByClass($class_name);
             $app_name = $app->getName();
             $icon = $app->getFontIcon();
             if ($icon) {
                 $app_icon = id(new PHUIIconView())->setIcon($icon);
             } else {
                 $app_icon = null;
             }
         } else {
             $app_name = null;
             $app_icon = null;
         }
         $icon = $type->getTypeIcon();
         if ($icon) {
             $type_icon = id(new PHUIIconView())->setIcon($icon);
         } else {
             $type_icon = null;
         }
         $rows[] = array($type->getTypeConstant(), get_class($type), $app_icon, $app_name, $type_icon, $type->getTypeName());
     }
     $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Constant'), pht('Class'), null, pht('Application'), null, pht('Name')))->setColumnClasses(array(null, 'pri', 'icon', null, 'icon', 'wide'));
     return id(new PHUIObjectBoxView())->setHeaderText(pht('PHID Types'))->setTable($table);
 }
开发者ID:billtt,项目名称:phabricator,代码行数:32,代码来源:PhabricatorConfigPHIDModule.php


示例4: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $this->requireApplicationCapability(AuthManageProvidersCapability::CAPABILITY);
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $providers = PhabricatorAuthProvider::getAllBaseProviders();
     $e_provider = null;
     $errors = array();
     if ($request->isFormPost()) {
         $provider_string = $request->getStr('provider');
         if (!strlen($provider_string)) {
             $e_provider = pht('Required');
             $errors[] = pht('You must select an authentication provider.');
         } else {
             $found = false;
             foreach ($providers as $provider) {
                 if (get_class($provider) === $provider_string) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $e_provider = pht('Invalid');
                 $errors[] = pht('You must select a valid provider.');
             }
         }
         if (!$errors) {
             return id(new AphrontRedirectResponse())->setURI($this->getApplicationURI('/config/new/' . $provider_string . '/'));
         }
     }
     $options = id(new AphrontFormRadioButtonControl())->setLabel(pht('Provider'))->setName('provider')->setError($e_provider);
     $configured = PhabricatorAuthProvider::getAllProviders();
     $configured_classes = array();
     foreach ($configured as $configured_provider) {
         $configured_classes[get_class($configured_provider)] = true;
     }
     // Sort providers by login order, and move disabled providers to the
     // bottom.
     $providers = msort($providers, 'getLoginOrder');
     $providers = array_diff_key($providers, $configured_classes) + $providers;
     foreach ($providers as $provider) {
         if (isset($configured_classes[get_class($provider)])) {
             $disabled = true;
             $description = pht('This provider is already configured.');
         } else {
             $disabled = false;
             $description = $provider->getDescriptionForCreate();
         }
         $options->addButton(get_class($provider), $provider->getNameForCreate(), $description, $disabled ? 'disabled' : null, $disabled);
     }
     $form = id(new AphrontFormView())->setUser($viewer)->appendChild($options)->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getApplicationURI())->setValue(pht('Continue')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Provider'))->setFormErrors($errors)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setForm($form);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Add Provider'));
     $crumbs->setBorder(true);
     $title = pht('Add Auth Provider');
     $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-plus-square');
     $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($form_box));
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:60,代码来源:PhabricatorAuthNewController.php


示例5: processRequest

 public function processRequest()
 {
     $items = id(new PhabricatorDirectoryItem())->loadAll();
     $items = msort($items, 'getSortKey');
     $categories = id(new PhabricatorDirectoryCategory())->loadAll();
     $categories = msort($categories, 'getSequence');
     $category_map = mpull($categories, 'getName', 'getID');
     $category_map[0] = 'Free Radicals';
     $items = mgroup($items, 'getCategoryID');
     require_celerity_resource('phabricator-directory-css');
     $content = array();
     foreach ($category_map as $id => $category_name) {
         $category_items = idx($items, $id);
         if (!$category_items) {
             continue;
         }
         $item_markup = array();
         foreach ($category_items as $item) {
             $item_markup[] = '<div>' . '<h2>' . phutil_render_tag('a', array('href' => $item->getHref()), phutil_escape_html($item->getName())) . '</h2>' . '<p>' . phutil_escape_html($item->getDescription()) . '</p>' . '</div>';
         }
         $content[] = '<div class="aphront-directory-category">' . '<h1>' . phutil_escape_html($category_name) . '</h1>' . '<div class="aphront-directory-group">' . implode("\n", $item_markup) . '</div>' . '</div>';
     }
     $content = '<div class="aphront-directory-list">' . implode("\n", $content) . '</div>';
     return $this->buildStandardPageResponse($content, array('title' => 'Directory', 'tab' => 'directory'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:25,代码来源:PhabricatorDirectoryMainController.php


示例6: processRequest

 public function processRequest()
 {
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($this->class, head_key($classes));
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     require_celerity_resource('phabricator-ui-example-css');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($example->getName());
     $header = id(new PHUIHeaderView())->setHeader(pht('%s (%s)', $example->getName(), get_class($example)))->setSubheader($example->getDescription())->setNoBackground(true);
     $nav->appendChild(array($crumbs, $header, phutil_tag('br'), $result));
     return $this->buildApplicationPage($nav, array('title' => $example->getName()));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:PhabricatorUIExampleRenderController.php


示例7: sortAndGroupInlines

 public static function sortAndGroupInlines(array $inlines, array $changesets)
 {
     assert_instances_of($inlines, 'DifferentialTransaction');
     assert_instances_of($changesets, 'DifferentialChangeset');
     $changesets = mpull($changesets, null, 'getID');
     $changesets = msort($changesets, 'getFilename');
     // Group the changesets by file and reorder them by display order.
     $inline_groups = array();
     foreach ($inlines as $inline) {
         $changeset_id = $inline->getComment()->getChangesetID();
         $inline_groups[$changeset_id][] = $inline;
     }
     $inline_groups = array_select_keys($inline_groups, array_keys($changesets));
     foreach ($inline_groups as $changeset_id => $group) {
         // Sort the group of inlines by line number.
         $items = array();
         foreach ($group as $inline) {
             $comment = $inline->getComment();
             $num = $comment->getLineNumber();
             $len = $comment->getLineLength();
             $id = $comment->getID();
             $items[] = array('inline' => $inline, 'sort' => sprintf('~%010d%010d%010d', $num, $len, $id));
         }
         $items = isort($items, 'sort');
         $items = ipull($items, 'inline');
         $inline_groups[$changeset_id] = $items;
     }
     return $inline_groups;
 }
开发者ID:sethkontny,项目名称:phabricator,代码行数:29,代码来源:DifferentialTransactionComment.php


示例8: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $types = PassphraseCredentialType::getAllCreateableTypes();
     $types = mpull($types, null, 'getCredentialType');
     $types = msort($types, 'getCredentialTypeName');
     $errors = array();
     $e_type = null;
     if ($request->isFormPost()) {
         $type = $request->getStr('type');
         if (empty($types[$type])) {
             $errors[] = pht('You must choose a credential type.');
             $e_type = pht('Required');
         }
         if (!$errors) {
             $uri = $this->getApplicationURI('edit/?type=' . $type);
             return id(new AphrontRedirectResponse())->setURI($uri);
         }
     }
     $types_control = id(new AphrontFormRadioButtonControl())->setName('type')->setLabel(pht('Credential Type'))->setError($e_type);
     foreach ($types as $type) {
         $types_control->addButton($type->getCredentialType(), $type->getCredentialTypeName(), $type->getCredentialTypeDescription());
     }
     $form = id(new AphrontFormView())->setUser($viewer)->appendChild($types_control)->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Continue'))->addCancelButton($this->getApplicationURI()));
     $title = pht('New Credential');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Create'));
     $box = id(new PHUIObjectBoxView())->setHeaderText(pht('Create New Credential'))->setFormErrors($errors)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $box), array('title' => $title));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:PassphraseCredentialCreateController.php


示例9: loadCommands

 protected function loadCommands($target_phid)
 {
     $viewer = $this->getViewer();
     $commands = id(new DrydockCommandQuery())->setViewer($viewer)->withTargetPHIDs(array($target_phid))->withConsumed(false)->execute();
     $commands = msort($commands, 'getID');
     return $commands;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:7,代码来源:DrydockWorker.php


示例10: renderConfigurationFooter

 public function renderConfigurationFooter()
 {
     $hashers = PhabricatorPasswordHasher::getAllHashers();
     $hashers = msort($hashers, 'getStrength');
     $hashers = array_reverse($hashers);
     $yes = phutil_tag('strong', array('style' => 'color: #009900'), pht('Yes'));
     $no = phutil_tag('strong', array('style' => 'color: #990000'), pht('Not Installed'));
     $best_hasher_name = null;
     try {
         $best_hasher = PhabricatorPasswordHasher::getBestHasher();
         $best_hasher_name = $best_hasher->getHashName();
     } catch (PhabricatorPasswordHasherUnavailableException $ex) {
         // There are no suitable hashers. The user might be able to enable some,
         // so we don't want to fatal here. We'll fatal when users try to actually
         // use this stuff if it isn't fixed before then. Until then, we just
         // don't highlight a row. In practice, at least one hasher should always
         // be available.
     }
     $rows = array();
     $rowc = array();
     foreach ($hashers as $hasher) {
         $is_installed = $hasher->canHashPasswords();
         $rows[] = array($hasher->getHumanReadableName(), $hasher->getHashName(), $hasher->getHumanReadableStrength(), $is_installed ? $yes : $no, $is_installed ? null : $hasher->getInstallInstructions());
         $rowc[] = $best_hasher_name == $hasher->getHashName() ? 'highlighted' : null;
     }
     $table = new AphrontTableView($rows);
     $table->setRowClasses($rowc);
     $table->setHeaders(array(pht('Algorithm'), pht('Name'), pht('Strength'), pht('Installed'), pht('Install Instructions')));
     $table->setColumnClasses(array('', '', '', '', 'wide'));
     $header = id(new PHUIHeaderView())->setHeader(pht('Password Hash Algorithms'))->setSubheader(pht('Stronger algorithms are listed first. The highlighted algorithm ' . 'will be used when storing new hashes. Older hashes will be ' . 'upgraded to the best algorithm over time.'));
     return id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:32,代码来源:PhabricatorPasswordAuthProvider.php


示例11: buildPanels

 private function buildPanels()
 {
     $panel_specs = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorSettingsPanel')->setConcreteOnly(true)->selectAndLoadSymbols();
     $panels = array();
     foreach ($panel_specs as $spec) {
         $class = newv($spec['name'], array());
         $panels[] = $class->buildPanels();
     }
     $panels = array_mergev($panels);
     $panels = mpull($panels, null, 'getPanelKey');
     $result = array();
     foreach ($panels as $key => $panel) {
         $panel->setUser($this->user);
         if (!$panel->isEnabled()) {
             continue;
         }
         if (!$this->isSelf()) {
             if (!$panel->isEditableByAdministrators()) {
                 continue;
             }
         }
         if (!empty($result[$key])) {
             throw new Exception(pht("Two settings panels share the same panel key ('%s'): %s, %s.", $key, get_class($panel), get_class($result[$key])));
         }
         $result[$key] = $panel;
     }
     $result = msort($result, 'getPanelSortKey');
     if (!$result) {
         throw new Exception(pht('No settings panels are available.'));
     }
     return $result;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:32,代码来源:PhabricatorSettingsMainController.php


示例12: getTagContent

 protected function getTagContent()
 {
     if (!$this->blankState && empty($this->events)) {
         return '';
     }
     $events = msort($this->events, 'getEpochStart');
     $singletons = array();
     $allday = false;
     foreach ($events as $event) {
         $color = $event->getColor();
         if ($event->getAllDay()) {
             $timelabel = pht('All Day');
         } else {
             $timelabel = phabricator_time($event->getEpochStart(), $this->getUser());
         }
         $dot = phutil_tag('span', array('class' => 'phui-calendar-list-dot'), '');
         $title = phutil_tag('span', array('class' => 'phui-calendar-list-title'), $this->renderEventLink($event, $allday));
         $time = phutil_tag('span', array('class' => 'phui-calendar-list-time'), $timelabel);
         $singletons[] = phutil_tag('li', array('class' => 'phui-calendar-list-item phui-calendar-' . $color), array($dot, $title, $time));
     }
     if (empty($singletons)) {
         $singletons[] = phutil_tag('li', array('class' => 'phui-calendar-list-item-empty'), pht('Clear sailing ahead.'));
     }
     $list = phutil_tag('ul', array('class' => 'phui-calendar-list'), $singletons);
     return $list;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:26,代码来源:PHUICalendarListView.php


示例13: buildPanels

 private function buildPanels()
 {
     $panels = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorSettingsPanel')->setExpandMethod('buildPanels')->setUniqueMethod('getPanelKey')->execute();
     $result = array();
     foreach ($panels as $key => $panel) {
         $panel->setUser($this->user);
         if (!$panel->isEnabled()) {
             continue;
         }
         if (!$this->isSelf()) {
             if (!$panel->isEditableByAdministrators()) {
                 continue;
             }
         }
         if (!empty($result[$key])) {
             throw new Exception(pht("Two settings panels share the same panel key ('%s'): %s, %s.", $key, get_class($panel), get_class($result[$key])));
         }
         $result[$key] = $panel;
     }
     $result = msort($result, 'getPanelSortKey');
     if (!$result) {
         throw new Exception(pht('No settings panels are available.'));
     }
     return $result;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:PhabricatorSettingsMainController.php


示例14: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $books = id(new DivinerBookQuery())->setViewer($viewer)->execute();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->setBorder(true);
     $crumbs->addTextCrumb(pht('Books'));
     $query_button = id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI('query/'))->setText(pht('Advanced Search'))->setIcon('fa-search');
     $header = id(new PHUIHeaderView())->setHeader(pht('Documentation Books'))->addActionLink($query_button);
     $document = new PHUIDocumentViewPro();
     $document->setHeader($header);
     $document->addClass('diviner-view');
     if ($books) {
         $books = msort($books, 'getTitle');
         $list = array();
         foreach ($books as $book) {
             $item = id(new DivinerBookItemView())->setTitle($book->getTitle())->setHref('/book/' . $book->getName() . '/')->setSubtitle($book->getPreface());
             $list[] = $item;
         }
         $list = id(new PHUIBoxView())->addPadding(PHUI::PADDING_MEDIUM_TOP)->appendChild($list);
         $document->appendChild($list);
     } else {
         $text = pht("(NOTE) **Looking for Phabricator documentation?** " . "If you're looking for help and information about Phabricator, " . "you can [[https://secure.phabricator.com/diviner/ | " . "browse the public Phabricator documentation]] on the live site.\n\n" . "Diviner is the documentation generator used to build the " . "Phabricator documentation.\n\n" . "You haven't generated any Diviner documentation books yet, so " . "there's nothing to show here. If you'd like to generate your own " . "local copy of the Phabricator documentation and have it appear " . "here, run this command:\n\n" . "  %s\n\n", 'phabricator/ $ ./bin/diviner generate');
         $text = new PHUIRemarkupView($viewer, $text);
         $document->appendChild($text);
     }
     return $this->newPage()->setTitle(pht('Documentation Books'))->setCrumbs($crumbs)->appendChild(array($document));
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:28,代码来源:DivinerMainController.php


示例15: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $books = id(new DivinerBookQuery())->setViewer($viewer)->execute();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Books'));
     $search_icon = id(new PHUIIconView())->setIconFont('fa-search');
     $query_button = id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI('query/'))->setText(pht('Advanced Search'))->setIcon($search_icon);
     $header = id(new PHUIHeaderView())->setHeader(pht('Documentation Books'))->addActionLink($query_button);
     $document = new PHUIDocumentView();
     $document->setHeader($header);
     $document->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS);
     $document->addClass('diviner-view');
     if ($books) {
         $books = msort($books, 'getTitle');
         $list = array();
         foreach ($books as $book) {
             $item = id(new DivinerBookItemView())->setTitle($book->getTitle())->setHref('/book/' . $book->getName() . '/')->setSubtitle($book->getPreface());
             $list[] = $item;
         }
         $list = id(new PHUIBoxView())->addPadding(PHUI::PADDING_LARGE_LEFT)->addPadding(PHUI::PADDING_LARGE_RIGHT)->addPadding(PHUI::PADDING_SMALL_TOP)->addPadding(PHUI::PADDING_SMALL_BOTTOM)->appendChild($list);
         $document->appendChild($list);
     } else {
         $text = pht("(NOTE) **Looking for Phabricator documentation?** If you're looking " . "for help and information about Phabricator, you can " . "[[ https://secure.phabricator.com/diviner/ | browse the public " . "Phabricator documentation ]] on the live site.\n\n" . "Diviner is the documentation generator used to build the Phabricator " . "documentation.\n\n" . "You haven't generated any Diviner documentation books yet, so " . "there's nothing to show here. If you'd like to generate your own " . "local copy of the Phabricator documentation and have it appear " . "here, run this command:\n\n" . "  phabricator/ \$ ./bin/diviner generate\n\n" . "Right now, Diviner isn't very useful for generating documentation " . "for projects other than Phabricator. If you're interested in using " . "it in your own projects, leave feedback for us on " . "[[ https://secure.phabricator.com/T4558 | T4558 ]].");
         $text = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($text), 'default', $viewer);
         $document->appendChild($text);
     }
     return $this->buildApplicationPage(array($crumbs, $document), array('title' => pht('Documentation Books'), 'fonts' => true));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:30,代码来源:DivinerMainController.php


示例16: render

 public function render()
 {
     $messages = $this->lintMessages;
     $messages = msort($messages, 'getSortKey');
     if ($this->limit) {
         $messages = array_slice($messages, 0, $this->limit);
     }
     $rows = array();
     foreach ($messages as $message) {
         $path = $message->getPath();
         $line = $message->getLine();
         $href = null;
         if (strlen(idx($this->pathURIMap, $path))) {
             $href = $this->pathURIMap[$path] . max($line, 1);
         }
         $severity = $this->renderSeverity($message->getSeverity());
         $location = $path . ':' . $line;
         if (strlen($href)) {
             $location = phutil_tag('a', array('href' => $href), $location);
         }
         $rows[] = array($severity, $location, $message->getCode(), $message->getName());
     }
     $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Severity'), pht('Location'), pht('Code'), pht('Message')))->setColumnClasses(array(null, 'pri', null, 'wide'));
     return $table;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:HarbormasterLintPropertyView.php


示例17: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $id = $request->getURIData('class');
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($id, head_key($classes));
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     require_celerity_resource('phabricator-ui-example-css');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($example->getName());
     $note = id(new PHUIInfoView())->setTitle(pht('%s (%s)', $example->getName(), get_class($example)))->appendChild($example->getDescription())->setSeverity(PHUIInfoView::SEVERITY_NODATA);
     $nav->appendChild(array($crumbs, $note, $result));
     return $this->buildApplicationPage($nav, array('title' => $example->getName()));
 }
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:26,代码来源:PhabricatorUIExampleRenderController.php


示例18: loadRestrictedNamespace

 /**
  * Load the namespace which prevents use of an Almanac name, if one exists.
  */
 public static function loadRestrictedNamespace(PhabricatorUser $viewer, $name)
 {
     // For a name like "x.y.z", produce a list of controlling namespaces like
     // ("z", "y.x", "x.y.z").
     $names = array();
     $parts = explode('.', $name);
     for ($ii = 0; $ii < count($parts); $ii++) {
         $names[] = implode('.', array_slice($parts, -($ii + 1)));
     }
     // Load all the possible controlling namespaces.
     $namespaces = id(new AlmanacNamespaceQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withNames($names)->execute();
     if (!$namespaces) {
         return null;
     }
     // Find the "nearest" (longest) namespace that exists. If both
     // "sub.domain.com" and "domain.com" exist, we only care about the policy
     // on the former.
     $namespaces = msort($namespaces, 'getNameLength');
     $namespace = last($namespaces);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $namespace, PhabricatorPolicyCapability::CAN_EDIT);
     if ($can_edit) {
         return null;
     }
     return $namespace;
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:28,代码来源:AlmanacNamespace.php


示例19: renderModuleStatus

 public function renderModuleStatus(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $collectors = PhabricatorGarbageCollector::getAllCollectors();
     $collectors = msort($collectors, 'getCollectorConstant');
     $rows = array();
     $rowc = array();
     foreach ($collectors as $key => $collector) {
         $class = null;
         if ($collector->hasAutomaticPolicy()) {
             $policy_view = phutil_tag('em', array(), pht('Automatic'));
         } else {
             $policy = $collector->getRetentionPolicy();
             if ($policy === null) {
                 $policy_view = pht('Indefinite');
             } else {
                 $days = ceil($policy / phutil_units('1 day in seconds'));
                 $policy_view = pht('%s Day(s)', new PhutilNumber($days));
             }
             $default = $collector->getDefaultRetentionPolicy();
             if ($policy !== $default) {
                 $class = 'highlighted';
                 $policy_view = phutil_tag('strong', array(), $policy_view);
             }
         }
         $rowc[] = $class;
         $rows[] = array($collector->getCollectorConstant(), $collector->getCollectorName(), $policy_view);
     }
     $table = id(new AphrontTableView($rows))->setRowClasses($rowc)->setHeaders(array(pht('Constant'), pht('Name'), pht('Retention Policy')))->setColumnClasses(array(null, 'pri wide', null));
     $header = id(new PHUIHeaderView())->setHeader(pht('Garbage Collectors'))->setSubheader(pht('Collectors with custom policies are highlighted. Use ' . '%s to change retention policies.', phutil_tag('tt', array(), 'bin/garbage set-policy')));
     return id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:PhabricatorConfigCollectorsModule.php


示例20: processRequest

 public function processRequest()
 {
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->setConcreteOnly(true)->selectAndLoadSymbols();
     $classes = ipull($classes, 'name', 'name');
     foreach ($classes as $class => $ignored) {
         $classes[$class] = newv($class, array());
     }
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($this->class, head_key($classes));
     require_celerity_resource('phabricator-ui-example-css');
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     $nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
     $nav->appendChild($result);
     return $this->buildApplicationPage($nav, array('title' => 'UI Example', 'device' => true));
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:27,代码来源:PhabricatorUIExampleRenderController.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP msp_get_parser函数代码示例发布时间:2022-05-15
下一篇:
PHP mso_widget_get_post函数代码示例发布时间: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