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


PHP PhutilURI::alter方法代码示例

本文整理汇总了PHP中PhutilURI::alter方法的典型用法代码示例。如果您正苦于以下问题:PHP PhutilURI::alter方法的具体用法?PHP PhutilURI::alter怎么用?PHP PhutilURI::alter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhutilURI的用法示例。


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

示例1: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $document = id(new PhrictionDocument())->loadOneWhere('slug = %s', PhabricatorSlug::normalize($this->slug));
     if (!$document) {
         return new Aphront404Response();
     }
     $current = id(new PhrictionContent())->load($document->getContentID());
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $pager->setURI($request->getRequestURI(), 'page');
     $history = id(new PhrictionContent())->loadAllWhere('documentID = %d ORDER BY version DESC LIMIT %d, %d', $document->getID(), $pager->getOffset(), $pager->getPageSize() + 1);
     $history = $pager->sliceResults($history);
     $author_phids = mpull($history, 'getAuthorPHID');
     $handles = id(new PhabricatorObjectHandleData($author_phids))->loadHandles();
     $rows = array();
     foreach ($history as $content) {
         $uri = PhrictionDocument::getSlugURI($document->getSlug());
         $version = $content->getVersion();
         $diff_uri = new PhutilURI('/phriction/diff/' . $document->getID() . '/');
         $vs_previous = '<em>Created</em>';
         if ($content->getVersion() != 1) {
             $uri = $diff_uri->alter('l', $content->getVersion() - 1)->alter('r', $content->getVersion());
             $vs_previous = phutil_render_tag('a', array('href' => $uri), 'Show Change');
         }
         $vs_head = '<em>Current</em>';
         if ($content->getID() != $document->getContentID()) {
             $uri = $diff_uri->alter('l', $content->getVersion())->alter('r', $current->getVersion());
             $vs_head = phutil_render_tag('a', array('href' => $uri), 'Show Later Changes');
         }
         $change_type = PhrictionChangeType::getChangeTypeLabel($content->getChangeType());
         $rows[] = array(phabricator_date($content->getDateCreated(), $user), phabricator_time($content->getDateCreated(), $user), phutil_render_tag('a', array('href' => $uri . '?v=' . $version), 'Version ' . $version), $handles[$content->getAuthorPHID()]->renderLink(), $change_type, phutil_escape_html($content->getDescription()), $vs_previous, $vs_head);
     }
     $crumbs = new AphrontCrumbsView();
     $crumbs->setCrumbs(array('Phriction', phutil_render_tag('a', array('href' => PhrictionDocument::getSlugURI($document->getSlug())), phutil_escape_html($current->getTitle())), 'History'));
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Date', 'Time', 'Version', 'Author', 'Type', 'Description', 'Against Previous', 'Against Current'));
     $table->setColumnClasses(array('', 'right', 'pri', '', '', 'wide', '', ''));
     $panel = new AphrontPanelView();
     $panel->setHeader('Document History');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     return $this->buildStandardPageResponse(array($crumbs, $panel), array('title' => 'Document History'));
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:45,代码来源:PhrictionHistoryController.php

示例2: buildEmailTable

 private function buildEmailTable($is_edit, $highlight)
 {
     $viewer = $this->getViewer();
     $application = $this->getApplication();
     $uri = new PhutilURI($this->getPanelURI());
     $emails = id(new PhabricatorMetaMTAApplicationEmailQuery())->setViewer($viewer)->withApplicationPHIDs(array($application->getPHID()))->execute();
     $rowc = array();
     $rows = array();
     foreach ($emails as $email) {
         $button_edit = javelin_tag('a', array('class' => 'button small grey', 'href' => $uri->alter('edit', $email->getID()), 'sigil' => 'workflow'), pht('Edit'));
         $button_remove = javelin_tag('a', array('class' => 'button small grey', 'href' => $uri->alter('delete', $email->getID()), 'sigil' => 'workflow'), pht('Delete'));
         if ($highlight == $email->getID()) {
             $rowc[] = 'highlighted';
         } else {
             $rowc[] = null;
         }
         $space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID($email);
         if ($space_phid) {
             $email_space = $viewer->renderHandle($space_phid);
         } else {
             $email_space = null;
         }
         $rows[] = array($email_space, $email->getAddress(), $button_edit, $button_remove);
     }
     $table = id(new AphrontTableView($rows))->setNoDataString(pht('No application emails created yet.'));
     $table->setHeaders(array(pht('Space'), pht('Email'), pht('Edit'), pht('Delete')));
     $table->setColumnClasses(array('', 'wide', 'action', 'action'));
     $table->setRowClasses($rowc);
     $table->setColumnVisibility(array(PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer), true, $is_edit, $is_edit));
     return $table;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:31,代码来源:PhabricatorMetaMTAApplicationEmailPanel.php

示例3: getEmailLoginURI

 public function getEmailLoginURI()
 {
     $token = $this->generateEmailToken();
     $uri = PhabricatorEnv::getProductionURI('/login/etoken/' . $token . '/');
     $uri = new PhutilURI($uri);
     return $uri->alter('email', $this->getEmail());
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:7,代码来源:PhabricatorUser.php

示例4: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $document = id(new PhrictionDocumentQuery())->setViewer($user)->withSlugs(array(PhabricatorSlug::normalize($this->slug)))->needContent(true)->executeOne();
     if (!$document) {
         return new Aphront404Response();
     }
     $current = $document->getContent();
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $pager->setURI($request->getRequestURI(), 'page');
     $history = id(new PhrictionContent())->loadAllWhere('documentID = %d ORDER BY version DESC LIMIT %d, %d', $document->getID(), $pager->getOffset(), $pager->getPageSize() + 1);
     $history = $pager->sliceResults($history);
     $author_phids = mpull($history, 'getAuthorPHID');
     $handles = $this->loadViewerHandles($author_phids);
     $list = new PHUIObjectItemListView();
     $list->setFlush(true);
     foreach ($history as $content) {
         $author = $handles[$content->getAuthorPHID()]->renderLink();
         $slug_uri = PhrictionDocument::getSlugURI($document->getSlug());
         $version = $content->getVersion();
         $diff_uri = new PhutilURI('/phriction/diff/' . $document->getID() . '/');
         $vs_previous = null;
         if ($content->getVersion() != 1) {
             $vs_previous = $diff_uri->alter('l', $content->getVersion() - 1)->alter('r', $content->getVersion());
         }
         $vs_head = null;
         if ($content->getID() != $document->getContentID()) {
             $vs_head = $diff_uri->alter('l', $content->getVersion())->alter('r', $current->getVersion());
         }
         $change_type = PhrictionChangeType::getChangeTypeLabel($content->getChangeType());
         switch ($content->getChangeType()) {
             case PhrictionChangeType::CHANGE_DELETE:
                 $color = 'red';
                 break;
             case PhrictionChangeType::CHANGE_EDIT:
                 $color = 'blue';
                 break;
             case PhrictionChangeType::CHANGE_MOVE_HERE:
                 $color = 'yellow';
                 break;
             case PhrictionChangeType::CHANGE_MOVE_AWAY:
                 $color = 'orange';
                 break;
             case PhrictionChangeType::CHANGE_STUB:
                 $color = 'green';
                 break;
             default:
                 throw new Exception('Unknown change type!');
                 break;
         }
         $item = id(new PHUIObjectItemView())->setHeader(pht('%s by %s', $change_type, $author))->setBarColor($color)->addAttribute(phutil_tag('a', array('href' => $slug_uri . '?v=' . $version), pht('Version %s', $version)))->addAttribute(pht('%s %s', phabricator_date($content->getDateCreated(), $user), phabricator_time($content->getDateCreated(), $user)));
         if ($content->getDescription()) {
             $item->addAttribute($content->getDescription());
         }
         if ($vs_previous) {
             $item->addIcon('fa-reply', pht('Show Change'), array('href' => $vs_previous));
         } else {
             $item->addIcon('fa-reply grey', phutil_tag('em', array(), pht('No previous change')));
         }
         if ($vs_head) {
             $item->addIcon('fa-reply-all', pht('Show Later Changes'), array('href' => $vs_head));
         } else {
             $item->addIcon('fa-reply-all grey', phutil_tag('em', array(), pht('No later changes')));
         }
         $list->addItem($item);
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumb_views = $this->renderBreadcrumbs($document->getSlug());
     foreach ($crumb_views as $view) {
         $crumbs->addCrumb($view);
     }
     $crumbs->addTextCrumb(pht('History'), PhrictionDocument::getSlugURI($document->getSlug(), 'history'));
     $header = new PHUIHeaderView();
     $header->setHeader(pht('Document History for %s', phutil_tag('a', array('href' => PhrictionDocument::getSlugURI($document->getSlug())), head($history)->getTitle())));
     $obj_box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($list)->appendChild($pager);
     return $this->buildApplicationPage(array($crumbs, $obj_box), array('title' => pht('Document History')));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:79,代码来源:PhrictionHistoryController.php

示例5: render

 public function render()
 {
     require_celerity_resource('differential-changeset-view-css');
     $changesets = $this->changesets;
     if ($this->standaloneViews) {
         Javelin::initBehavior('differential-dropdown-menus', array());
     }
     $output = array();
     $mapping = array();
     $repository = $this->repository;
     foreach ($changesets as $key => $changeset) {
         $file = $changeset->getFilename();
         $class = 'differential-changeset';
         if (!$this->editable) {
             $class .= ' differential-changeset-noneditable';
         }
         $ref = $this->references[$key];
         $detail = new DifferentialChangesetDetailView();
         $detail_button = null;
         if ($this->standaloneViews) {
             $detail_uri = new PhutilURI($this->renderURI);
             $detail_uri->setQueryParams(array('ref' => $ref, 'whitespace' => $this->whitespace));
             $diffusion_uri = null;
             if ($repository) {
                 $diffusion_uri = $repository->getDiffusionBrowseURIForPath($changeset->getAbsoluteRepositoryPath($this->diff, $repository));
             }
             $detail_button = javelin_render_tag('a', array('class' => 'button small grey', 'meta' => array('detailURI' => (string) $detail_uri, 'leftURI' => (string) $detail_uri->alter('view', 'old'), 'rightURI' => (string) $detail_uri->alter('view', 'new'), 'diffusionURI' => $diffusion_uri, 'containerID' => $detail->getID()), 'href' => $detail_uri, 'target' => '_blank', 'sigil' => 'differential-view-options'), "View Options ▼");
         }
         $detail->setChangeset($changeset);
         $detail->addButton($detail_button);
         $detail->setSymbolIndex(idx($this->symbolIndexes, $key));
         $uniq_id = celerity_generate_unique_node_id();
         $detail->appendChild(phutil_render_tag('div', array('id' => $uniq_id), '<div class="differential-loading">Loading...</div>'));
         $output[] = $detail->render();
         $mapping[$uniq_id] = $ref;
     }
     Javelin::initBehavior('differential-populate', array('registry' => $mapping, 'whitespace' => $this->whitespace, 'uri' => $this->renderURI));
     Javelin::initBehavior('differential-show-more', array('uri' => $this->renderURI, 'whitespace' => $this->whitespace));
     Javelin::initBehavior('differential-comment-jump', array());
     if ($this->editable) {
         $undo_templates = $this->renderUndoTemplates();
         $revision = $this->revision;
         Javelin::initBehavior('differential-edit-inline-comments', array('uri' => '/differential/comment/inline/edit/' . $revision->getID() . '/', 'undo_templates' => $undo_templates));
     }
     return '<div class="differential-review-stage" id="differential-review-stage">' . implode("\n", $output) . '</div>';
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:46,代码来源:DifferentialChangesetListView.php

示例6: sendMailToSubscribers

 private function sendMailToSubscribers(array $subscribers, $old_content)
 {
     if (!$subscribers) {
         return;
     }
     $author_phid = $this->getActor()->getPHID();
     $document = $this->document;
     $content = $document->getContent();
     $slug_uri = PhrictionDocument::getSlugURI($document->getSlug());
     $diff_uri = new PhutilURI('/phriction/diff/' . $document->getID() . '/');
     $prod_uri = PhabricatorEnv::getProductionURI('');
     $vs_head = $diff_uri->alter('l', $old_content->getVersion())->alter('r', $content->getVersion());
     $old_title = $old_content->getTitle();
     $title = $content->getTitle();
     $name = $this->getChangeTypeDescription($content->getChangeType(), $title);
     $action = PhrictionChangeType::getChangeTypeLabel($content->getChangeType());
     $body = array($name);
     // Content may have changed, you never know
     if ($content->getChangeType() == PhrictionChangeType::CHANGE_EDIT) {
         if ($old_title != $title) {
             $body[] = pht('Title was changed from "%s" to "%s"', $old_title, $title);
         }
         $body[] = pht("Link to new version:\n%s", $prod_uri . $slug_uri . '?v=' . $content->getVersion());
         $body[] = pht("Link to diff:\n%s", $prod_uri . $vs_head);
     } else {
         if ($content->getChangeType() == PhrictionChangeType::CHANGE_MOVE_AWAY) {
             $target_document = id(new PhrictionDocument())->load($content->getChangeRef());
             $slug_uri = PhrictionDocument::getSlugURI($target_document->getSlug());
             $body[] = pht("Link to destination document:\n%s", $prod_uri . $slug_uri);
         }
     }
     $body = implode("\n\n", $body);
     $subject_prefix = $this->getMailSubjectPrefix();
     $mail = new PhabricatorMetaMTAMail();
     $mail->setSubject($name)->setSubjectPrefix($subject_prefix)->setVarySubjectPrefix('[' . $action . ']')->addHeader('Thread-Topic', $name)->setFrom($author_phid)->addTos($subscribers)->setBody($body)->setRelatedPHID($document->getPHID())->setIsBulk(true);
     $mail->saveAndSend();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:37,代码来源:PhrictionDocumentEditor.php

示例7: getEmailLoginURI

 public function getEmailLoginURI(PhabricatorUserEmail $email = null)
 {
     if (!$email) {
         $email = $this->loadPrimaryEmail();
         if (!$email) {
             throw new Exception("User has no primary email!");
         }
     }
     $token = $this->generateEmailToken($email);
     $uri = PhabricatorEnv::getProductionURI('/login/etoken/' . $token . '/');
     $uri = new PhutilURI($uri);
     return $uri->alter('email', $email->getAddress());
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:13,代码来源:PhabricatorUser.php


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