本文整理汇总了PHP中PhutilURI::setQueryParam方法的典型用法代码示例。如果您正苦于以下问题:PHP PhutilURI::setQueryParam方法的具体用法?PHP PhutilURI::setQueryParam怎么用?PHP PhutilURI::setQueryParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhutilURI
的用法示例。
在下文中一共展示了PhutilURI::setQueryParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAuthenticateURI
public function getAuthenticateURI()
{
$uri = new PhutilURI($this->getAuthenticateBaseURI());
$uri->setQueryParam('client_id', $this->getClientID());
$uri->setQueryParam('scope', $this->getScope());
$uri->setQueryParam('redirect_uri', $this->getRedirectURI());
$uri->setQueryParam('state', $this->getState());
foreach ($this->getExtraAuthenticateParameters() as $key => $value) {
$uri->setQueryParam($key, $value);
}
return (string) $uri;
}
示例2: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://disqus.com/api/3.0/users/details.json');
$uri->setQueryParam('api_key', $this->getClientID());
$uri->setQueryParam('access_token', $this->getAccessToken());
$uri = (string) $uri;
$future = new HTTPSFuture($uri);
$future->setMethod('GET');
list($body) = $future->resolvex();
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception("Expected valid JSON response from Disqus account data request, " . "got: " . $body);
}
return $data['response'];
}
示例3: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
if ($request->isFormPost()) {
$uri = new PhutilURI('/fact/chart/');
$uri->setQueryParam('y1', $request->getStr('y1'));
return id(new AphrontRedirectResponse())->setURI($uri);
}
$types = array('+N:*', '+N:DREV', 'updated');
$engines = PhabricatorFactEngine::loadAllEngines();
$specs = PhabricatorFactSpec::newSpecsForFactTypes($engines, $types);
$facts = id(new PhabricatorFactAggregate())->loadAllWhere('factType IN (%Ls)', $types);
$rows = array();
foreach ($facts as $fact) {
$spec = $specs[$fact->getFactType()];
$name = $spec->getName();
$value = $spec->formatValueForDisplay($user, $fact->getValueX());
$rows[] = array(phutil_escape_html($name), phutil_escape_html($value));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Fact', 'Value'));
$table->setColumnClasses(array('wide', 'n'));
$panel = new AphrontPanelView();
$panel->setHeader('Facts!');
$panel->appendChild($table);
$chart_form = $this->buildChartForm();
return $this->buildStandardPageResponse(array($chart_form, $panel), array('title' => 'Facts!'));
}
示例4: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
if ($request->isFormPost()) {
$uri = new PhutilURI('/fact/chart/');
$uri->setQueryParam('y1', $request->getStr('y1'));
return id(new AphrontRedirectResponse())->setURI($uri);
}
$types = array('+N:*', '+N:DREV', 'updated');
$engines = PhabricatorFactEngine::loadAllEngines();
$specs = PhabricatorFactSpec::newSpecsForFactTypes($engines, $types);
$facts = id(new PhabricatorFactAggregate())->loadAllWhere('factType IN (%Ls)', $types);
$rows = array();
foreach ($facts as $fact) {
$spec = $specs[$fact->getFactType()];
$name = $spec->getName();
$value = $spec->formatValueForDisplay($viewer, $fact->getValueX());
$rows[] = array($name, $value);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Fact'), pht('Value')));
$table->setColumnClasses(array('wide', 'n'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Facts'));
$panel->setTable($table);
$chart_form = $this->buildChartForm();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Home'));
$title = pht('Facts');
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($chart_form, $panel));
}
示例5: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://disqus.com/api/3.0/users/details.json');
$uri->setQueryParam('api_key', $this->getClientID());
$uri->setQueryParam('access_token', $this->getAccessToken());
$uri = (string) $uri;
$future = new HTTPSFuture($uri);
$future->setMethod('GET');
list($body) = $future->resolvex();
try {
$data = phutil_json_decode($body);
return $data['response'];
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(pht('Expected valid JSON response from Disqus account data request.'), $ex);
}
}
示例6: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$fields = array('id', 'name', 'email', 'link', 'security_settings', 'picture');
$uri = new PhutilURI('https://graph.facebook.com/me');
$uri->setQueryParam('access_token', $this->getAccessToken());
$uri->setQueryParam('fields', implode(',', $fields));
list($body) = id(new HTTPSFuture($uri))->resolvex();
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception("Expected valid JSON response from Facebook account data request, " . "got: " . $body);
}
if ($this->requireSecureBrowsing) {
if (empty($data['security_settings']['secure_browsing']['enabled'])) {
throw new Exception(pht("This Phabricator install requires you to enable Secure Browsing " . "on your Facebook account in order to use it to log in to " . "Phabricator. For more information, see %s", 'https://www.facebook.com/help/156201551113407/'));
}
}
return $data;
}
示例7: render
public function render()
{
$handles = $this->handles;
require_celerity_resource('maniphest-task-summary-css');
$list = new PHUIObjectItemListView();
if ($this->noDataString) {
$list->setNoDataString($this->noDataString);
} else {
$list->setNoDataString(pht('No tasks.'));
}
$status_map = ManiphestTaskStatus::getTaskStatusMap();
$color_map = ManiphestTaskPriority::getColorMap();
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
if ($this->showBatchControls) {
Javelin::initBehavior('maniphest-list-editor');
}
foreach ($this->tasks as $task) {
$item = id(new PHUIObjectItemView())->setUser($this->getUser())->setObject($task)->setObjectName('T' . $task->getID())->setHeader($task->getTitle())->setHref('/T' . $task->getID());
if ($task->getOwnerPHID()) {
$owner = $handles[$task->getOwnerPHID()];
$item->addByline(pht('Assigned: %s', $owner->renderLink()));
}
$status = $task->getStatus();
$pri = idx($priority_map, $task->getPriority());
$status_name = idx($status_map, $task->getStatus());
$tooltip = pht('%s, %s', $status_name, $pri);
$icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
$color = idx($color_map, $task->getPriority(), 'grey');
if ($task->isClosed()) {
$item->setDisabled(true);
$color = 'grey';
}
$item->setStatusIcon($icon . ' ' . $color, $tooltip);
$item->addIcon('none', phabricator_datetime($task->getDateModified(), $this->getUser()));
if ($this->showSubpriorityControls) {
$item->setGrippable(true);
}
if ($this->showSubpriorityControls || $this->showBatchControls) {
$item->addSigil('maniphest-task');
}
$project_handles = array_select_keys($handles, array_reverse($task->getProjectPHIDs()));
$item->addAttribute(id(new PHUIHandleTagListView())->setLimit(4)->setNoDataString(pht('No Projects'))->setSlim(true)->setHandles($project_handles));
$item->setMetadata(array('taskID' => $task->getID()));
if ($this->showBatchControls) {
$href = new PhutilURI('/maniphest/task/edit/' . $task->getID() . '/');
if (!$this->showSubpriorityControls) {
$href->setQueryParam('ungrippable', 'true');
}
$item->addAction(id(new PHUIListItemView())->setIcon('fa-pencil')->addSigil('maniphest-edit-task')->setHref($href));
}
$list->addItem($item);
}
return $list;
}
示例8: buildLoginMenu
private function buildLoginMenu()
{
$controller = $this->getController();
$uri = new PhutilURI('/auth/start/');
if ($controller) {
$path = $controller->getRequest()->getPath();
$uri->setQueryParam('next', $path);
}
$bar_item = id(new PHUIListItemView())->addClass('core-menu-item')->setName(pht('Log In'))->setIcon('fa-sign-in')->setHref($uri)->setAural(pht('Log In'));
return id(new PHUIMainMenuView())->setOrder(900)->setMenuBarItem($bar_item);
}
示例9: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://api.amazon.com/user/profile');
$uri->setQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
list($body) = $future->resolvex();
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception("Expected valid JSON response from Amazon account data request, " . "got: " . $body);
}
return $data;
}
示例10: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://api.amazon.com/user/profile');
$uri->setQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
list($body) = $future->resolvex();
try {
return phutil_json_decode($body);
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(pht('Expected valid JSON response from Amazon account data request.'), $ex);
}
}
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$project_id = $request->getURIData('projectID');
$project = id(new PhabricatorProjectQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->withIDs(array($project_id))->executeOne();
if (!$project) {
return new Aphront404Response();
}
$this->setProject($project);
$column = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$column) {
return new Aphront404Response();
}
$column_phid = $column->getPHID();
$view_uri = $this->getApplicationURI('/board/' . $project_id . '/');
$view_uri = new PhutilURI($view_uri);
foreach ($request->getPassthroughRequestData() as $key => $value) {
$view_uri->setQueryParam($key, $value);
}
if ($column->isDefaultColumn()) {
return $this->newDialog()->setTitle(pht('Can Not Hide Default Column'))->appendParagraph(pht('You can not hide the default/backlog column on a board.'))->addCancelButton($view_uri, pht('Okay'));
}
if ($request->isFormPost()) {
if ($column->isHidden()) {
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
} else {
$new_status = PhabricatorProjectColumn::STATUS_HIDDEN;
}
$type_status = PhabricatorProjectColumnTransaction::TYPE_STATUS;
$xactions = array(id(new PhabricatorProjectColumnTransaction())->setTransactionType($type_status)->setNewValue($new_status));
$editor = id(new PhabricatorProjectColumnTransactionEditor())->setActor($viewer)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->applyTransactions($column, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
if ($column->isHidden()) {
$title = pht('Show Column');
} else {
$title = pht('Hide Column');
}
if ($column->isHidden()) {
$body = pht('Are you sure you want to show this column?');
} else {
$body = pht('Are you sure you want to hide this column? It will no longer ' . 'appear on the workboard.');
}
$dialog = $this->newDialog()->setWidth(AphrontDialogView::WIDTH_FORM)->setTitle($title)->appendChild($body)->setDisableWorkflowOnCancel(true)->addCancelButton($view_uri)->addSubmitButton($title);
foreach ($request->getPassthroughRequestData() as $key => $value) {
$dialog->addHiddenInput($key, $value);
}
return $dialog;
}
示例12: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://api.github.com/user');
$uri->setQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
// NOTE: GitHub requires a User-Agent string.
$future->addHeader('User-Agent', 'PhutilAuthAdapterOAuthGitHub');
list($body) = $future->resolvex();
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception("Expected valid JSON response from GitHub account data request, " . "got: " . $body);
}
return $data;
}
示例13: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://api.github.com/user');
$uri->setQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
// NOTE: GitHub requires a User-Agent string.
$future->addHeader('User-Agent', __CLASS__);
list($body) = $future->resolvex();
try {
return phutil_json_decode($body);
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(pht('Expected valid JSON response from GitHub account data request.'), $ex);
}
}
示例14: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$file = id(new PhabricatorFileQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->executeOne();
if (!$file) {
return new Aphront404Response();
}
$monogram = $file->getMonogram();
$xdst = id(new PhabricatorTransformedFile())->loadAllWhere('transformedPHID = %s', $file->getPHID());
$dst_rows = array();
foreach ($xdst as $source) {
$dst_rows[] = array($source->getTransform(), $viewer->renderHandle($source->getOriginalPHID()));
}
$dst_table = id(new AphrontTableView($dst_rows))->setHeaders(array(pht('Key'), pht('Source')))->setColumnClasses(array('', 'wide'))->setNoDataString(pht('This file was not created by transforming another file.'));
$xsrc = id(new PhabricatorTransformedFile())->loadAllWhere('originalPHID = %s', $file->getPHID());
$xsrc = mpull($xsrc, 'getTransformedPHID', 'getTransform');
$src_rows = array();
$xforms = PhabricatorFileTransform::getAllTransforms();
foreach ($xforms as $xform) {
$dst_phid = idx($xsrc, $xform->getTransformKey());
if ($xform->canApplyTransform($file)) {
$can_apply = pht('Yes');
$view_href = $file->getURIForTransform($xform);
$view_href = new PhutilURI($view_href);
$view_href->setQueryParam('regenerate', 'true');
$view_text = pht('Regenerate');
$view_link = phutil_tag('a', array('class' => 'small grey button', 'href' => $view_href), $view_text);
} else {
$can_apply = phutil_tag('em', array(), pht('No'));
$view_link = phutil_tag('em', array(), pht('None'));
}
if ($dst_phid) {
$dst_link = $viewer->renderHandle($dst_phid);
} else {
$dst_link = phutil_tag('em', array(), pht('None'));
}
$src_rows[] = array($xform->getTransformName(), $xform->getTransformKey(), $can_apply, $dst_link, $view_link);
}
$src_table = id(new AphrontTableView($src_rows))->setHeaders(array(pht('Name'), pht('Key'), pht('Supported'), pht('Transform'), pht('View')))->setColumnClasses(array('wide', '', '', '', 'action'));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($monogram, '/' . $monogram);
$crumbs->addTextCrumb(pht('Transforms'));
$crumbs->setBorder(true);
$dst_box = id(new PHUIObjectBoxView())->setHeaderText(pht('File Sources'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setTable($dst_table);
$src_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Available Transforms'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setTable($src_table);
$title = pht('%s Transforms', $file->getName());
$header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-arrows-alt');
$view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($dst_box, $src_box));
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
}
示例15: loadOAuthAccountData
protected function loadOAuthAccountData()
{
$uri = new PhutilURI('https://www.googleapis.com/plus/v1/people/me');
$uri->setQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
list($status, $body) = $future->resolve();
if ($status->isError()) {
$this->tryToThrowSpecializedError($status, $body);
throw $status;
}
try {
return phutil_json_decode($body);
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(pht('Expected valid JSON response from Google account data request.'), $ex);
}
}