本文整理汇总了PHP中PhabricatorEnv::getURI方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv::getURI方法的具体用法?PHP PhabricatorEnv::getURI怎么用?PHP PhabricatorEnv::getURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEnv
的用法示例。
在下文中一共展示了PhabricatorEnv::getURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildUserInformationDictionary
protected function buildUserInformationDictionary(PhabricatorUser $user, PhabricatorUserStatus $current_status = null)
{
$roles = array();
if ($user->getIsDisabled()) {
$roles[] = 'disabled';
}
if ($user->getIsSystemAgent()) {
$roles[] = 'agent';
}
if ($user->getIsAdmin()) {
$roles[] = 'admin';
}
$primary = $user->loadPrimaryEmail();
if ($primary && $primary->getIsVerified()) {
$roles[] = 'verified';
} else {
$roles[] = 'unverified';
}
$return = array('phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'image' => $user->loadProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/' . $user->getUsername() . '/'), 'roles' => $roles);
if ($current_status) {
$return['currentStatus'] = $current_status->getTextStatus();
$return['currentStatusUntil'] = $current_status->getDateTo();
}
return $return;
}
示例2: execute
protected function execute(ConduitAPIRequest $request)
{
$diff = null;
$revision_id = $request->getValue('revision_id');
$revision = id(new DifferentialRevision())->load($revision_id);
if (!$revision) {
throw new ConduitException('ERR_BAD_REVISION');
}
$revision->loadRelationships();
$reviewer_phids = array_values($revision->getReviewers());
$diffs = $revision->loadDiffs();
$diff_dicts = array();
foreach ($diffs as $diff) {
$diff->attachChangesets($diff->loadChangesets());
// TODO: We could batch this to improve performance.
foreach ($diff->getChangesets() as $changeset) {
$changeset->attachHunks($changeset->loadHunks());
}
$diff_dicts[] = $diff->getDiffDict();
}
$commit_dicts = array();
$commit_phids = $revision->loadCommitPHIDs();
$handles = id(new PhabricatorObjectHandleData($commit_phids))->loadHandles();
foreach ($commit_phids as $commit_phid) {
$commit_dicts[] = array('fullname' => $handles[$commit_phid]->getFullName(), 'dateCommitted' => $handles[$commit_phid]->getTimestamp());
}
$auxiliary_fields = $this->loadAuxiliaryFields($revision);
$dict = array('id' => $revision->getID(), 'phid' => $revision->getPHID(), 'authorPHID' => $revision->getAuthorPHID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()), 'title' => $revision->getTitle(), 'status' => $revision->getStatus(), 'statusName' => ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($revision->getStatus()), 'summary' => $revision->getSummary(), 'testPlan' => $revision->getTestPlan(), 'lineCount' => $revision->getLineCount(), 'reviewerPHIDs' => $reviewer_phids, 'diffs' => $diff_dicts, 'commits' => $commit_dicts, 'auxiliary' => $auxiliary_fields);
return $dict;
}
示例3: execute
protected function execute(ConduitAPIRequest $request)
{
$viewer = $request->getUser();
$revision = id(new DifferentialRevisionQuery())->setViewer($viewer)->withIDs(array($request->getValue('revision_id')))->needReviewerStatus(true)->needReviewerAuthority(true)->executeOne();
if (!$revision) {
throw new ConduitException('ERR_BAD_REVISION');
}
$xactions = array();
$action = $request->getValue('action');
if ($action && $action != 'comment' && $action != 'none') {
$xactions[] = id(new DifferentialTransaction())->setTransactionType(DifferentialTransaction::TYPE_ACTION)->setNewValue($action);
}
$content = $request->getValue('message');
if (strlen($content)) {
$xactions[] = id(new DifferentialTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new DifferentialTransactionComment())->setContent($content));
}
if ($request->getValue('attach_inlines')) {
$type_inline = DifferentialTransaction::TYPE_INLINE;
$inlines = DifferentialTransactionQuery::loadUnsubmittedInlineComments($viewer, $revision);
foreach ($inlines as $inline) {
$xactions[] = id(new DifferentialTransaction())->setTransactionType($type_inline)->attachComment($inline);
}
}
$editor = id(new DifferentialTransactionEditor())->setActor($viewer)->setDisableEmail($request->getValue('silent'))->setContentSource($request->newContentSource())->setContinueOnNoEffect(true)->setContinueOnMissingFields(true);
$editor->applyTransactions($revision, $xactions);
return array('revisionid' => $revision->getID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()));
}
示例4: execute
protected function execute(ConduitAPIRequest $request)
{
$diff = id(new DifferentialDiff())->load($request->getValue('diffid'));
if (!$diff) {
throw new ConduitException('ERR_BAD_DIFF');
}
$revision = id(new DifferentialRevision())->load($request->getValue('id'));
if (!$revision) {
throw new ConduitException('ERR_BAD_REVISION');
}
if ($request->getUser()->getPHID() !== $revision->getAuthorPHID()) {
throw new ConduitException('ERR_WRONG_USER');
}
if ($revision->getStatus() == ArcanistDifferentialRevisionStatus::CLOSED) {
throw new ConduitException('ERR_CLOSED');
}
$content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_CONDUIT, array());
$editor = new DifferentialRevisionEditor($revision, $revision->getAuthorPHID());
$editor->setContentSource($content_source);
$fields = $request->getValue('fields');
$editor->copyFieldsFromConduit($fields);
$editor->addDiff($diff, $request->getValue('message'));
$editor->save();
return array('revisionid' => $revision->getID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()));
}
示例5: renderText
public function renderText()
{
$author = null;
if ($this->getAuthorPHID()) {
$author = $this->getHandle($this->getAuthorPHID())->getLinkName();
} else {
$author = $this->getValue('authorName');
}
$committer = null;
if ($this->getValue('committerPHID')) {
$committer_handle = $this->getHandle($this->getValue('committerPHID'));
$committer = $committer_handle->getLinkName();
} else {
if ($this->getValue('committerName')) {
$committer = $this->getValue('committerName');
}
}
$commit_handle = $this->getHandle($this->getPrimaryObjectPHID());
$commit_uri = PhabricatorEnv::getURI($commit_handle->getURI());
$commit_name = $commit_handle->getLinkName();
if (!$committer) {
$committer = $author;
$author = null;
}
if ($author) {
$text = pht('%s committed %s (authored by %s).', $committer, $commit_name, $author);
} else {
$text = pht('%s committed %s.', $committer, $commit_name);
}
return $text;
}
示例6: getProviderConfigurationHelp
protected function getProviderConfigurationHelp()
{
$config = $this->getProviderConfig();
$base_uri = rtrim($config->getProperty(self::PROPERTY_PHABRICATOR_URI), '/');
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
return pht("**Step 2 of 2 - Configure Phabricator OAuth Instance**\n\n" . "To configure Phabricator OAuth, create a new application here:" . "\n\n" . "%s/oauthserver/client/create/" . "\n\n" . "When creating your application, use these settings:" . "\n\n" . " - **Redirect URI:** Set this to: `%s`" . "\n\n" . "After completing configuration, copy the **Client ID** and " . "**Client Secret** to the fields above. (You may need to generate the " . "client secret by clicking 'New Secret' first.)", $base_uri, $login_uri);
}
示例7: renderText
public function renderText()
{
$author_handle = $this->getHandle($this->getPrimaryObjectPHID());
$author_name = $author_handle->getLinkName();
$author_uri = PhabricatorEnv::getURI($author_handle->getURI());
$text = pht('% updated their status %s', $author_name, $author_uri);
return $text;
}
示例8: getObjectHref
protected function getObjectHref($object, PhabricatorObjectHandle $handle, $id)
{
$uri = $handle->getURI();
if ($this->getEngine()->getConfig('uri.full')) {
$uri = PhabricatorEnv::getURI($uri);
}
return $uri;
}
示例9: configureAdapter
protected function configureAdapter(PhutilOAuthAuthAdapter $adapter)
{
$config = $this->getProviderConfig();
$adapter->setClientID($config->getProperty(self::PROPERTY_APP_ID));
$adapter->setClientSecret(new PhutilOpaqueEnvelope($config->getProperty(self::PROPERTY_APP_SECRET)));
$adapter->setRedirectURI(PhabricatorEnv::getURI($this->getLoginURI()));
return $adapter;
}
示例10: getProviderConfigurationHelp
protected function getProviderConfigurationHelp()
{
if ($this->isSetup()) {
return pht("**Step 1 of 2**: Provide the name and URI for your JIRA install.\n\n" . "In the next step, you will configure JIRA.");
} else {
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
return pht("**Step 2 of 2**: In this step, you will configure JIRA.\n\n" . "**Create a JIRA Application**: Log into JIRA and go to " . "**Administration**, then **Add-ons**, then **Application Links**. " . "Click the button labeled **Add Application Link**, and use these " . "settings to create an application:\n\n" . " - **Server URL**: `%s`\n" . " - Then, click **Next**. On the second page:\n" . " - **Application Name**: `Phabricator`\n" . " - **Application Type**: `Generic Application`\n" . " - Then, click **Create**.\n\n" . "**Configure Your Application**: Find the application you just " . "created in the table, and click the **Configure** link under " . "**Actions**. Select **Incoming Authentication** and click the " . "**OAuth** tab (it may be selected by default). Then, use these " . "settings:\n\n" . " - **Consumer Key**: Set this to the \"Consumer Key\" value in the " . "form above.\n" . " - **Consumer Name**: `Phabricator`\n" . " - **Public Key**: Set this to the \"Public Key\" value in the " . "form above.\n" . " - **Consumer Callback URL**: `%s`\n" . "Click **Save** in JIRA. Authentication should now be configured, " . "and this provider should work correctly.", PhabricatorEnv::getProductionURI('/'), $login_uri);
}
}
示例11: renderText
public function renderText()
{
$author_name = $this->getHandle($this->getAuthorPHID())->getLinkName();
$commit_path = $this->getHandle($this->getPrimaryObjectPHID())->getURI();
$commit_uri = PhabricatorEnv::getURI($commit_path);
$action = $this->getValue('action');
$verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action);
$text = "{$author_name} {$verb} commit {$commit_uri}";
return $text;
}
示例12: execute
protected function execute(ConduitAPIRequest $request)
{
$fields = $request->getValue('fields');
$diff = id(new DifferentialDiff())->load($request->getValue('diffid'));
if (!$diff) {
throw new ConduitException('ERR_BAD_DIFF');
}
$revision = DifferentialRevisionEditor::newRevisionFromConduitWithDiff($fields, $diff, $request->getUser()->getPHID());
return array('revisionid' => $revision->getID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()));
}
示例13: getProviderConfigurationHelp
protected function getProviderConfigurationHelp()
{
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
$uri = new PhutilURI(PhabricatorEnv::getProductionURI('/'));
$https_note = null;
if ($uri->getProtocol() !== 'https') {
$https_note = pht('NOTE: Amazon **requires** HTTPS, but your Phabricator install does ' . 'not use HTTPS. **You will not be able to add Amazon as an ' . 'authentication provider until you configure HTTPS on this install**.');
}
return pht("%s\n\n" . "To configure Amazon OAuth, create a new 'API Project' here:" . "\n\n" . "http://login.amazon.com/manageApps" . "\n\n" . "Use these settings:" . "\n\n" . " - **Allowed Return URLs:** Add this: `%s`" . "\n\n" . "After completing configuration, copy the **Client ID** and " . "**Client Secret** to the fields above.", $https_note, $login_uri);
}
示例14: getProviderConfigurationHelp
protected function getProviderConfigurationHelp()
{
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
if ($this->isSetup()) {
return pht("**Step 1 of 2**: Provide the name and URI for your MediaWiki install.\n\n" . "In the next step, you will create an auth consumer in MediaWiki to be used by Phabricator oauth.");
} else {
$wiki_uri = $this->getWikiURI();
return pht("**Step 2 of 2**: Create a MediaWiki auth consumer for this Phabricator instance." . "\n\n" . "NOTE: Propose a consumer with the form at this url: %s" . "\n\n" . "Provide the following settings on the consumer registration:\n\n" . " - **Callback URL:** Set this to: `%s`\n" . " - **Grants:** `Basic Rights` is all that is needed for authentication.\n" . "\n\n" . "After you register the consumer, a **Consumer Key** and " . "**Consumer Secret** will be provided to you by MediaWiki. " . "To complete configuration of phabricator, copy the provided keys into " . "the corresponding fields above." . "\n\n" . "NOTE: Before Phabricator can successfully authenticate to your MediaWiki," . " a wiki admin must approve the oauth consumer registration using the form" . " which can be found at the following url: %s", $wiki_uri . '/index.php?title=Special:OAuthConsumerRegistration/propose', $login_uri, $wiki_uri . '/index.php?title=Special:OAuthManageConsumers/proposed');
}
}
示例15: buildUserInformationDictionary
protected function buildUserInformationDictionary(PhabricatorUser $user)
{
$src_phid = $user->getProfileImagePHID();
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
if ($file) {
$picture = $file->getBestURI();
} else {
$picture = null;
}
return array('phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'email' => $user->getEmail(), 'image' => $picture, 'uri' => PhabricatorEnv::getURI('/p/' . $user->getUsername() . '/'));
}