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

PHP idx函数代码示例

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

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



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

示例1: buildCurtainView

 private function buildCurtainView(PhortuneAccount $account, $invoices)
 {
     $viewer = $this->getViewer();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $account, PhabricatorPolicyCapability::CAN_EDIT);
     $edit_uri = $this->getApplicationURI('account/edit/' . $account->getID() . '/');
     $curtain = $this->newCurtainView($account);
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Account'))->setIcon('fa-pencil')->setHref($edit_uri)->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $status_items = $this->getStatusItemsForAccount($account, $invoices);
     $status_view = new PHUIStatusListView();
     foreach ($status_items as $item) {
         $status_view->addItem(id(new PHUIStatusItemView())->setIcon(idx($item, 'icon'), idx($item, 'color'), idx($item, 'label'))->setTarget(idx($item, 'target'))->setNote(idx($item, 'note')));
     }
     $member_phids = $account->getMemberPHIDs();
     $handles = $viewer->loadHandles($member_phids);
     $member_list = id(new PHUIObjectItemListView())->setSimple(true);
     foreach ($member_phids as $member_phid) {
         $image_uri = $handles[$member_phid]->getImageURI();
         $image_href = $handles[$member_phid]->getURI();
         $person = $handles[$member_phid];
         $member = id(new PHUIObjectItemView())->setImageURI($image_uri)->setHref($image_href)->setHeader($person->getFullName());
         $member_list->addItem($member);
     }
     $curtain->newPanel()->setHeaderText(pht('Status'))->appendChild($status_view);
     $curtain->newPanel()->setHeaderText(pht('Members'))->appendChild($member_list);
     return $curtain;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:26,代码来源:PhortuneAccountViewController.php


示例2: execute

 public function execute(HarbormasterBuild $build, HarbormasterBuildTarget $build_target)
 {
     $viewer = PhabricatorUser::getOmnipotentUser();
     $settings = $this->getSettings();
     $variables = $build_target->getVariables();
     $uri = $this->mergeVariables('vurisprintf', $settings['uri'], $variables);
     $method = nonempty(idx($settings, 'method'), 'POST');
     $future = id(new HTTPSFuture($uri))->setMethod($method)->setTimeout(60);
     $credential_phid = $this->getSetting('credential');
     if ($credential_phid) {
         $key = PassphrasePasswordKey::loadFromPHID($credential_phid, $viewer);
         $future->setHTTPBasicAuthCredentials($key->getUsernameEnvelope()->openEnvelope(), $key->getPasswordEnvelope());
     }
     $this->resolveFutures($build, $build_target, array($future));
     list($status, $body, $headers) = $future->resolve();
     $header_lines = array();
     // TODO: We don't currently preserve the entire "HTTP" response header, but
     // should. Once we do, reproduce it here faithfully.
     $status_code = $status->getStatusCode();
     $header_lines[] = "HTTP {$status_code}";
     foreach ($headers as $header) {
         list($head, $tail) = $header;
         $header_lines[] = "{$head}: {$tail}";
     }
     $header_lines = implode("\n", $header_lines);
     $build_target->newLog($uri, 'http.head')->append($header_lines);
     $build_target->newLog($uri, 'http.body')->append($body);
     if ($status->isError()) {
         throw new HarbormasterBuildFailureException();
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:HarbormasterHTTPRequestBuildStepImplementation.php


示例3: render

 public function render()
 {
     $rows = array();
     $any_hidden = false;
     foreach ($this->rows as $row) {
         $style = idx($row, 'style');
         switch ($style) {
             case 'section':
                 $cells = phutil_render_tag('th', array('colspan' => 2), idx($row, 'name'));
                 break;
             default:
                 $name = phutil_render_tag('th', array(), idx($row, 'name'));
                 $value = phutil_render_tag('td', array(), idx($row, 'value'));
                 $cells = $name . $value;
                 break;
         }
         $show = idx($row, 'show');
         $rows[] = javelin_render_tag('tr', array('style' => $show ? null : 'display: none', 'sigil' => $show ? null : 'differential-results-row-toggle', 'class' => 'differential-results-row-' . $style), $cells);
         if (!$show) {
             $any_hidden = true;
         }
     }
     if ($any_hidden) {
         $show_more = javelin_render_tag('a', array('href' => '#', 'mustcapture' => true), $this->showMoreString);
         $hide_more = javelin_render_tag('a', array('href' => '#', 'mustcapture' => true), 'Hide');
         $rows[] = javelin_render_tag('tr', array('class' => 'differential-results-row-show', 'sigil' => 'differential-results-row-show'), '<th colspan="2">' . $show_more . '</td>');
         $rows[] = javelin_render_tag('tr', array('class' => 'differential-results-row-show', 'sigil' => 'differential-results-row-hide', 'style' => 'display: none'), '<th colspan="2">' . $hide_more . '</th>');
         Javelin::initBehavior('differential-show-field-details');
     }
     require_celerity_resource('differential-results-table-css');
     return javelin_render_tag('table', array('class' => 'differential-results-table', 'sigil' => 'differential-results-table'), implode("\n", $rows));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:32,代码来源:DifferentialResultsTableView.php


示例4: newFromString

 public static function newFromString($string, $default = null)
 {
     $matches = null;
     $ok = preg_match('/^([-$]*(?:\\d+)?(?:[.]\\d{0,2})?)(?:\\s+([A-Z]+))?$/', trim($string), $matches);
     if (!$ok) {
         self::throwFormatException($string);
     }
     $value = $matches[1];
     if (substr_count($value, '-') > 1) {
         self::throwFormatException($string);
     }
     if (substr_count($value, '$') > 1) {
         self::throwFormatException($string);
     }
     $value = str_replace('$', '', $value);
     $value = (double) $value;
     $value = (int) round(100 * $value);
     $currency = idx($matches, 2, $default);
     switch ($currency) {
         case 'USD':
             break;
         default:
             throw new Exception(pht("Unsupported currency '%s'!", $currency));
     }
     return self::newFromValueAndCurrency($value, $currency);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:26,代码来源:PhortuneCurrency.php


示例5: buildQueryFromParameters

 protected function buildQueryFromParameters(array $map)
 {
     $query = $this->newQuery();
     if ($map['callsigns']) {
         $query->withCallsigns($map['callsigns']);
     }
     if ($map['status']) {
         $status = idx($this->getStatusValues(), $map['status']);
         if ($status) {
             $query->withStatus($status);
         }
     }
     if ($map['hosted']) {
         $hosted = idx($this->getHostedValues(), $map['hosted']);
         if ($hosted) {
             $query->withHosted($hosted);
         }
     }
     if ($map['types']) {
         $query->withTypes($map['types']);
     }
     if (strlen($map['name'])) {
         $query->withNameContains($map['name']);
     }
     return $query;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:26,代码来源:PhabricatorRepositorySearchEngine.php


示例6: doWork

 protected function doWork()
 {
     $data = $this->getTaskData();
     $viewer = PhabricatorUser::getOmnipotentUser();
     $address = idx($data, 'address');
     $author_phid = idx($data, 'authorPHID');
     $author = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withPHIDs(array($author_phid))->executeOne();
     if (!$author) {
         throw new PhabricatorWorkerPermanentFailureException(pht('Invite has invalid author PHID ("%s").', $author_phid));
     }
     $invite = id(new PhabricatorAuthInviteQuery())->setViewer($viewer)->withEmailAddresses(array($address))->executeOne();
     if ($invite) {
         // If we're inviting a user who has already been invited, we just
         // regenerate their invite code.
         $invite->regenerateVerificationCode();
     } else {
         // Otherwise, we're creating a new invite.
         $invite = id(new PhabricatorAuthInvite())->setEmailAddress($address);
     }
     // Whether this is a new invite or not, tag this most recent author as
     // the invite author.
     $invite->setAuthorPHID($author_phid);
     $code = $invite->getVerificationCode();
     $invite_uri = '/auth/invite/' . $code . '/';
     $invite_uri = PhabricatorEnv::getProductionURI($invite_uri);
     $template = idx($data, 'template');
     $template = str_replace('{$INVITE_URI}', $invite_uri, $template);
     $invite->save();
     $mail = id(new PhabricatorMetaMTAMail())->addRawTos(array($invite->getEmailAddress()))->setForceDelivery(true)->setSubject(pht('[Phabricator] %s has invited you to join Phabricator', $author->getFullName()))->setBody($template)->saveAndSend();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:30,代码来源:PhabricatorAuthInviteWorker.php


示例7: renderValueForRevisionView

 public function renderValueForRevisionView()
 {
     $diff = $this->getDiff();
     $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
     $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
     $postponed_count = 0;
     $udata = $this->getDiffProperty('arc:unit');
     $utail = null;
     if ($udata) {
         $unit_messages = array();
         foreach ($udata as $test) {
             $name = idx($test, 'name');
             $result = idx($test, 'result');
             if ($result != DifferentialUnitTestResult::RESULT_POSTPONED && $result != DifferentialUnitTestResult::RESULT_PASS) {
                 $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
                 $userdata = phutil_utf8_shorten(idx($test, 'userdata'), 512);
                 $userdata = $engine->markupText($userdata);
                 $unit_messages[] = '<li>' . '<span class="unit-result-' . phutil_escape_html($result) . '">' . phutil_escape_html(ucwords($result)) . '</span>' . ' ' . phutil_escape_html($name) . '<p>' . $userdata . '</p>' . '</li>';
             } else {
                 if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) {
                     $postponed_count++;
                 }
             }
         }
         $uexcuse = $this->getUnitExcuse();
         if ($unit_messages) {
             $utail = '<div class="differential-unit-block">' . $uexcuse . '<ul>' . implode("\n", $unit_messages) . '</ul>' . '</div>';
         }
     }
     if ($postponed_count > 0 && $diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
         $umsg = $postponed_count . ' ' . $umsg;
     }
     return $ustar . ' ' . $umsg . $utail;
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:34,代码来源:DifferentialUnitFieldSpecification.php


示例8: resolveBaseCommit

 public function resolveBaseCommit(array $specs)
 {
     $specs += array('args' => '', 'local' => '', 'project' => '', 'global' => '', 'system' => '');
     foreach ($specs as $source => $spec) {
         $specs[$source] = self::tokenizeBaseCommitSpecification($spec);
     }
     $this->try = array('args', 'local', 'project', 'global', 'system');
     while ($this->try) {
         $source = head($this->try);
         if (!idx($specs, $source)) {
             $this->log("No rules left from source '{$source}'.");
             array_shift($this->try);
             continue;
         }
         $this->log("Trying rules from source '{$source}'.");
         $rules =& $specs[$source];
         while ($rule = array_shift($rules)) {
             $this->log("Trying rule '{$rule}'.");
             $commit = $this->resolveRule($rule, $source);
             if ($commit === false) {
                 // If a rule returns false, it means to go to the next ruleset.
                 break;
             } else {
                 if ($commit !== null) {
                     $this->log("Resolved commit '{$commit}' from rule '{$rule}'.");
                     return $commit;
                 }
             }
         }
     }
     return null;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:32,代码来源:ArcanistBaseCommitParser.php


示例9: willLintPaths

 public function willLintPaths(array $paths)
 {
     // Cleanup previous runs.
     $this->localExecx("rm -rf _build/_lint");
     // Build compilation database.
     $lintable_paths = $this->getLintablePaths($paths);
     $interesting_paths = $this->getInterestingPaths($lintable_paths);
     if (!$lintable_paths) {
         return;
     }
     // Run lint.
     try {
         $this->localExecx("%C %C -p _build/dev/ %Ls", $this->getBinaryPath(), $this->getFilteredIssues(), $lintable_paths);
     } catch (CommandException $exception) {
         PhutilConsole::getConsole()->writeErr($exception->getMessage());
     }
     // Load results.
     $result = id(new SQLite3($this->getProjectRoot() . '/_build/_lint/lint.db', SQLITE3_OPEN_READONLY))->query("SELECT * FROM raised_issues");
     while ($issue = $result->fetchArray(SQLITE3_ASSOC)) {
         // Skip issues not part of the linted file.
         if (in_array($issue['file'], $interesting_paths)) {
             $this->addLintMessage(id(new ArcanistLintMessage())->setPath($issue['file'])->setLine($issue['line'])->setChar($issue['column'])->setCode('Howtoeven')->setSeverity($this->getSeverity($issue['severity']))->setName('Hte-' . $issue['name'])->setDescription(sprintf("%s\n\n%s", $issue['message'] ? $issue['message'] : $issue['description'], $issue['explanation']))->setOriginalText(idx($issue, 'original', ''))->setReplacementText(idx($issue, 'replacement', '')));
         }
     }
 }
开发者ID:mopsled,项目名称:rocksdb,代码行数:25,代码来源:FacebookHowtoevenLinter.php


示例10: testFields

 function testFields()
 {
     $dir = PhutilDirectoryFixture::newEmptyFixture();
     $root = realpath($dir->getPath());
     $watch = $this->watch($root);
     $this->assertFileList($root, array());
     $this->watchmanCommand('log', 'debug', 'XXX: touch a');
     touch("{$root}/a");
     $this->assertFileList($root, array('a'));
     $query = $this->watchmanCommand('query', $root, array('fields' => array('name', 'exists', 'new', 'size', 'mode', 'uid', 'gid', 'mtime', 'mtime_ms', 'mtime_us', 'mtime_ns', 'mtime_f', 'ctime', 'ctime_ms', 'ctime_us', 'ctime_ns', 'ctime_f', 'ino', 'dev', 'nlink', 'oclock', 'cclock'), 'since' => 'n:foo'));
     $this->assertEqual(null, idx($query, 'error'));
     $this->assertEqual(1, count($query['files']));
     $file = $query['files'][0];
     $this->assertEqual('a', $file['name']);
     $this->assertEqual(true, $file['exists']);
     $this->assertEqual(true, $file['new']);
     $stat = stat("{$root}/a");
     $compare_fields = array('size', 'mode', 'uid', 'gid', 'ino', 'dev', 'nlink');
     foreach ($compare_fields as $field) {
         $this->assertEqual($stat[$field], $file[$field], $field);
     }
     $time_fields = array('mtime', 'ctime');
     foreach ($time_fields as $field) {
         $this->assertTimeEqual($stat[$field], $file[$field], $file[$field . '_ms'], $file[$field . '_us'], $file[$field . '_ns'], $file[$field . '_f']);
     }
     $this->assertRegex('/^c:\\d+:\\d+:\\d+:\\d+$/', $file['cclock'], "cclock looks clocky");
     $this->assertRegex('/^c:\\d+:\\d+:\\d+:\\d+$/', $file['oclock'], "oclock looks clocky");
 }
开发者ID:rogerwangzy,项目名称:watchman,代码行数:28,代码来源:fields.php


示例11: renderSeverity

 private function renderSeverity($severity)
 {
     $names = ArcanistLintSeverity::getLintSeverities();
     $name = idx($names, $severity, $severity);
     // TODO: Add some color here?
     return $name;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:HarbormasterLintPropertyView.php


示例12: markupText

 public function markupText($text, $children)
 {
     $matches = array();
     preg_match($this->getRegEx(), $text, $matches);
     if (idx($matches, 'showword')) {
         $word = $matches['showword'];
         $show = true;
     } else {
         $word = $matches['hideword'];
         $show = false;
     }
     $class_suffix = phutil_utf8_strtolower($word);
     // This is the "(IMPORTANT)" or "NOTE:" part.
     $word_part = rtrim(substr($text, 0, strlen($matches[0])));
     // This is the actual text.
     $text_part = substr($text, strlen($matches[0]));
     $text_part = $this->applyRules(rtrim($text_part));
     $text_mode = $this->getEngine()->isTextMode();
     if ($text_mode) {
         return $word_part . ' ' . $text_part;
     }
     if ($show) {
         $content = array(phutil_tag('span', array('class' => 'remarkup-note-word'), $word_part), ' ', $text_part);
     } else {
         $content = $text_part;
     }
     return phutil_tag('div', array('class' => 'remarkup-' . $class_suffix), $content);
 }
开发者ID:jasteele12,项目名称:prb_lint_tests,代码行数:28,代码来源:PhutilRemarkupEngineRemarkupNoteBlockRule.php


示例13: 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


示例14: dispatchEvent

 public static function dispatchEvent(PhutilEvent $event)
 {
     $instance = self::getInstance();
     $listeners = idx($instance->listeners, $event->getType(), array());
     $global_listeners = idx($instance->listeners, PhutilEventType::TYPE_ALL, array());
     // Merge and deduplicate listeners (we want to send the event to each
     // listener only once, even if it satisfies multiple criteria for the
     // event).
     $listeners = array_merge($listeners, $global_listeners);
     $listeners = mpull($listeners, null, 'getListenerID');
     $profiler = PhutilServiceProfiler::getInstance();
     $profiler_id = $profiler->beginServiceCall(array('type' => 'event', 'kind' => $event->getType(), 'count' => count($listeners)));
     $caught = null;
     try {
         foreach ($listeners as $listener) {
             if ($event->isStopped()) {
                 // Do this first so if someone tries to dispatch a stopped event it
                 // doesn't go anywhere. Silly but less surprising.
                 break;
             }
             $listener->handleEvent($event);
         }
     } catch (Exception $ex) {
         $profiler->endServiceCall($profiler_id, array());
         throw $ex;
     }
     $profiler->endServiceCall($profiler_id, array());
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:28,代码来源:PhutilEventEngine.php


示例15: phabricator_form

function phabricator_form(PhabricatorUser $user, $attributes, $content)
{
    $body = array();
    $http_method = idx($attributes, 'method');
    $is_post = strcasecmp($http_method, 'POST') === 0;
    $http_action = idx($attributes, 'action');
    $is_absolute_uri = preg_match('#^(https?:|//)#', $http_action);
    if ($is_post) {
        // NOTE: We only include CSRF tokens if a URI is a local URI on the same
        // domain. This is an important security feature and prevents forms which
        // submit to foreign sites from leaking CSRF tokens.
        // In some cases, we may construct a fully-qualified local URI. For example,
        // we can construct these for download links, depending on configuration.
        // These forms do not receive CSRF tokens, even though they safely could.
        // This can be confusing, if you're developing for Phabricator and
        // manage to construct a local form with a fully-qualified URI, since it
        // won't get CSRF tokens and you'll get an exception at the other end of
        // the request which is a bit disconnected from the actual root cause.
        // However, this is rare, and there are reasonable cases where this
        // construction occurs legitimately, and the simplest fix is to omit CSRF
        // tokens for these URIs in all cases. The error message you receive also
        // gives you some hints as to this potential source of error.
        if (!$is_absolute_uri) {
            $body[] = phutil_tag('input', array('type' => 'hidden', 'name' => AphrontRequest::getCSRFTokenName(), 'value' => $user->getCSRFToken()));
            $body[] = phutil_tag('input', array('type' => 'hidden', 'name' => '__form__', 'value' => true));
        }
    }
    if (is_array($content)) {
        $body = array_merge($body, $content);
    } else {
        $body[] = $content;
    }
    return javelin_tag('form', $attributes, $body);
}
开发者ID:pugong,项目名称:phabricator,代码行数:34,代码来源:markup.php


示例16: render

 public function render()
 {
     require_celerity_resource('differential-core-view-css');
     require_celerity_resource('differential-revision-detail-css');
     $revision = $this->revision;
     $rows = array();
     foreach ($this->auxiliaryFields as $field) {
         $value = $field->renderValueForRevisionView();
         if (strlen($value)) {
             $label = $field->renderLabelForRevisionView();
             $rows[] = '<tr>' . '<th>' . $label . '</th>' . '<td>' . $value . '</td>' . '</tr>';
         }
     }
     $properties = '<table class="differential-revision-properties">' . implode("\n", $rows) . '</table>';
     $actions = array();
     foreach ($this->actions as $action) {
         $obj = new AphrontHeadsupActionView();
         $obj->setName($action['name']);
         $obj->setURI(idx($action, 'href'));
         $obj->setWorkflow(idx($action, 'sigil') == 'workflow');
         $obj->setClass(idx($action, 'class'));
         $obj->setInstant(idx($action, 'instant'));
         $obj->setUser($this->user);
         $actions[] = $obj;
     }
     $action_list = new AphrontHeadsupActionListView();
     $action_list->setActions($actions);
     return '<div class="differential-revision-detail differential-panel">' . $action_list->render() . '<div class="differential-keyboard-shortcuts">' . id(new AphrontKeyboardShortcutsAvailableView())->render() . '</div>' . '<div class="differential-revision-detail-core">' . '<h1>' . '<span class="aphront-headsup-object-name">' . phutil_escape_html('D' . $revision->getID()) . '</span>' . ' ' . phutil_escape_html($revision->getTitle()) . '</h1>' . $properties . '</div>' . '<div style="clear: both;"></div>' . '</div>';
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:29,代码来源:DifferentialRevisionDetailView.php


示例17: resolvePHIDs

 private function resolvePHIDs(array $phids)
 {
     // If we have a function like `projects(alincoln)`, try to resolve the
     // username first. This won't happen normally, but can be passed in from
     // the query string.
     // The user might also give us an invalid username. In this case, we
     // preserve it and return it in-place so we get an "invalid" token rendered
     // in the UI. This shows the user where the issue is and  best represents
     // the user's input.
     $usernames = array();
     foreach ($phids as $key => $phid) {
         if (phid_get_type($phid) != PhabricatorPeopleUserPHIDType::TYPECONST) {
             $usernames[$key] = $phid;
         }
     }
     if ($usernames) {
         $users = id(new PhabricatorPeopleQuery())->setViewer($this->getViewer())->withUsernames($usernames)->execute();
         $users = mpull($users, null, 'getUsername');
         foreach ($usernames as $key => $username) {
             $user = idx($users, $username);
             if ($user) {
                 $phids[$key] = $user->getPHID();
             }
         }
     }
     return $phids;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:27,代码来源:PhabricatorProjectLogicalUserDatasource.php


示例18: renderValidateFactorForm

 public function renderValidateFactorForm(PhabricatorAuthFactorConfig $config, AphrontFormView $form, PhabricatorUser $viewer, $validation_result)
 {
     if (!$validation_result) {
         $validation_result = array();
     }
     $form->appendChild(id(new AphrontFormTextControl())->setName($this->getParameterName($config, 'totpcode'))->setLabel(pht('App Code'))->setCaption(pht('Factor Name: %s', $config->getFactorName()))->setValue(idx($validation_result, 'value'))->setError(idx($validation_result, 'error', true)));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:PhabricatorTOTPAuthFactor.php


示例19: loadSingle

 public static function loadSingle($viewer, $id)
 {
     if (!$viewer) {
         throw new Exception("Must set viewer when calling loadSingle");
     }
     return idx(id(new PonderAnswerQuery())->withID($id)->execute(), $id);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:7,代码来源:PonderAnswerQuery.php


示例20: getLog

 public static function getLog()
 {
     if (!self::$log) {
         $path = PhabricatorEnv::getEnvConfig('log.ssh.path');
         $format = PhabricatorEnv::getEnvConfig('log.ssh.format');
         $format = nonempty($format, "[%D]\t%p\t%h\t%r\t%s\t%S\t%u\t%C\t%U\t%c\t%T\t%i\t%o");
         // NOTE: Path may be null. We still create the log, it just won't write
         // anywhere.
         $data = array('D' => date('r'), 'h' => php_uname('n'), 'p' => getmypid(), 'e' => time());
         $sudo_user = PhabricatorEnv::getEnvConfig('phd.user');
         if (strlen($sudo_user)) {
             $data['S'] = $sudo_user;
         }
         if (function_exists('posix_geteuid')) {
             $system_uid = posix_geteuid();
             $system_info = posix_getpwuid($system_uid);
             $data['s'] = idx($system_info, 'name');
         }
         $client = getenv('SSH_CLIENT');
         if (strlen($client)) {
             $remote_address = head(explode(' ', $client));
             $data['r'] = $remote_address;
         }
         $log = id(new PhutilDeferredLog($path, $format))->setFailQuietly(true)->setData($data);
         self::$log = $log;
     }
     return self::$log;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:28,代码来源:PhabricatorSSHLog.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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