本文整理汇总了PHP中phutil_count函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_count函数的具体用法?PHP phutil_count怎么用?PHP phutil_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_BUILD:
return pht('Started %s build(s): %s.', phutil_count($data), $this->renderHandleList($data));
}
}
示例2: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_ADD_AUDITORS:
return pht('Added %s auditor(s): %s.', phutil_count($data), $this->renderHandleList($data));
}
}
示例3: generateGuidance
public function generateGuidance(PhabricatorGuidanceContext $context)
{
$domains_key = 'auth.email-domains';
$domains_link = $this->renderConfigLink($domains_key);
$domains_value = PhabricatorEnv::getEnvConfig($domains_key);
$approval_key = 'auth.require-approval';
$approval_link = $this->renderConfigLink($approval_key);
$approval_value = PhabricatorEnv::getEnvConfig($approval_key);
$results = array();
if ($domains_value) {
$message = pht('Phabricator is configured with an email domain whitelist (in %s), so ' . 'only users with a verified email address at one of these %s ' . 'allowed domain(s) will be able to register an account: %s', $domains_link, phutil_count($domains_value), phutil_tag('strong', array(), implode(', ', $domains_value)));
$results[] = $this->newGuidance('core.auth.email-domains.on')->setMessage($message);
} else {
$message = pht('Anyone who can browse to this Phabricator install will be able to ' . 'register an account. To add email domain restrictions, configure ' . '%s.', $domains_link);
$results[] = $this->newGuidance('core.auth.email-domains.off')->setMessage($message);
}
if ($approval_value) {
$message = pht('Administrative approvals are enabled (in %s), so all new users must ' . 'have their accounts approved by an administrator.', $approval_link);
$results[] = $this->newGuidance('core.auth.require-approval.on')->setMessage($message);
} else {
$message = pht('Administrative approvals are disabled, so users who register will ' . 'be able to use their accounts immediately. To enable approvals, ' . 'configure %s.', $approval_link);
$results[] = $this->newGuidance('core.auth.require-approval.off')->setMessage($message);
}
if (!$domains_value && !$approval_value) {
$message = pht('You can safely ignore these warnings if the install itself has ' . 'access controls (for example, it is deployed on a VPN) or if all of ' . 'the configured providers have access controls (for example, they are ' . 'all private LDAP or OAuth servers).');
$results[] = $this->newWarning('core.auth.warning')->setMessage($message);
}
return $results;
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:29,代码来源:PhabricatorAuthProvidersGuidanceEngineExtension.php
示例4: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_SEND:
return pht('Queued email to be delivered to %s target(s): %s.', phutil_count($data), $this->renderHandleList($data));
case self::DO_FORCE:
return pht('Queued email to be delivered to %s target(s), ignoring their ' . 'notification preferences: %s.', phutil_count($data), $this->renderHandleList($data));
}
}
示例5: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_SIGNED:
return pht('%s document(s) are already signed: %s.', phutil_count($data), $this->renderHandleList($data));
case self::DO_REQUIRED:
return pht('Required %s signature(s): %s.', phutil_count($data), $this->renderHandleList($data));
}
}
示例6: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_ADD_PROJECTS:
return pht('Added %s project(s): %s.', phutil_count($data), $this->renderHandleList($data));
case self::DO_REMOVE_PROJECTS:
return pht('Removed %s project(s): %s.', phutil_count($data), $this->renderHandleList($data));
}
}
示例7: reduceProxyResponse
public function reduceProxyResponse()
{
$request = $this->getRequest();
$ex = $this->exception;
$xactions = $ex->getTransactions();
$type_comment = PhabricatorTransactions::TYPE_COMMENT;
$only_empty_comment = count($xactions) == 1 && head($xactions)->getTransactionType() == $type_comment;
$count = phutil_count($xactions);
if ($ex->hasAnyEffect()) {
$title = pht('%s Action(s) With No Effect', $count);
$head = pht('Some of your %s action(s) have no effect:', $count);
$tail = pht('Apply remaining actions?');
$continue = pht('Apply Remaining Actions');
} else {
if ($ex->hasComment()) {
$title = pht('Post as Comment');
$head = pht('The %s action(s) you are taking have no effect:', $count);
$tail = pht('Do you want to post your comment anyway?');
$continue = pht('Post Comment');
} else {
if ($only_empty_comment) {
// Special case this since it's common and we can give the user a nicer
// dialog than "Action Has No Effect".
$title = pht('Empty Comment');
$head = null;
$tail = null;
$continue = null;
} else {
$title = pht('%s Action(s) Have No Effect', $count);
$head = pht('The %s action(s) you are taking have no effect:', $count);
$tail = null;
$continue = null;
}
}
}
$dialog = id(new AphrontDialogView())->setUser($request->getUser())->setTitle($title);
$dialog->appendChild($head);
$list = array();
foreach ($xactions as $xaction) {
$list[] = $xaction->getNoEffectDescription();
}
if ($list) {
$dialog->appendList($list);
}
$dialog->appendChild($tail);
if ($continue) {
$passthrough = $request->getPassthroughRequestParameters();
foreach ($passthrough as $key => $value) {
$dialog->addHiddenInput($key, $value);
}
$dialog->addHiddenInput('__continue__', 1);
$dialog->addSubmitButton($continue);
}
$dialog->addCancelButton($this->cancelURI);
return $this->getProxy()->setDialog($dialog);
}
开发者ID:barcelonascience,项目名称:phabricator,代码行数:56,代码来源:PhabricatorApplicationTransactionNoEffectResponse.php
示例8: execute
public function execute(PhutilArgumentParser $args)
{
$resources_map = CelerityPhysicalResources::getAll();
$this->log(pht('Rebuilding %d resource source(s).', phutil_count($resources_map)));
foreach ($resources_map as $name => $resources) {
$this->rebuildResources($resources);
}
$this->log(pht('Done.'));
return 0;
}
示例9: render
public function render()
{
$viewer = $this->getUser();
$project = $this->getProject();
$user_phids = $this->getUserPHIDs();
$can_edit = $this->canEditList();
$no_data = $this->getNoDataString();
$list = id(new PHUIObjectItemListView())->setNoDataString($no_data);
$limit = $this->getLimit();
// If we're showing everything, show oldest to newest. If we're showing
// only a slice, show newest to oldest.
if (!$limit) {
$user_phids = array_reverse($user_phids);
}
$handles = $viewer->loadHandles($user_phids);
// Always put the viewer first if they are on the list.
$user_phids = array_fuse($user_phids);
$user_phids = array_select_keys($user_phids, array($viewer->getPHID())) + $user_phids;
if ($limit) {
$render_phids = array_slice($user_phids, 0, $limit);
} else {
$render_phids = $user_phids;
}
foreach ($render_phids as $user_phid) {
$handle = $handles[$user_phid];
$item = id(new PHUIObjectItemView())->setHeader($handle->getFullName())->setHref($handle->getURI())->setImageURI($handle->getImageURI());
$icon = id(new PHUIIconView())->setIcon($handle->getIcon());
$subtitle = $handle->getSubtitle();
$item->addAttribute(array($icon, ' ', $subtitle));
if ($can_edit && !$limit) {
$remove_uri = $this->getRemoveURI($user_phid);
$item->addAction(id(new PHUIListItemView())->setIcon('fa-times')->setName(pht('Remove'))->setHref($remove_uri)->setWorkflow(true));
}
$list->addItem($item);
}
if ($user_phids) {
$header_text = pht('%s (%s)', $this->getHeaderText(), phutil_count($user_phids));
} else {
$header_text = $this->getHeaderText();
}
$id = $project->getID();
$header = id(new PHUIHeaderView())->setHeader($header_text);
if ($limit) {
$header->addActionLink(id(new PHUIButtonView())->setTag('a')->setIcon(id(new PHUIIconView())->setIcon('fa-list-ul'))->setText(pht('View All'))->setHref("/project/members/{$id}/"));
}
$box = id(new PHUIObjectBoxView())->setHeader($header)->setObjectList($list);
if ($this->background) {
$box->setBackground($this->background);
}
return $box;
}
示例10: process
public function process(XHPASTNode $root)
{
$classes = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
foreach ($classes as $class) {
$class_modifiers = $this->getModifiers($class);
$abstract_methods = array();
$methods = $class->selectDescendantsOfType('n_METHOD_DECLARATION');
foreach ($methods as $method) {
$method_modifiers = $this->getModifiers($method);
if (idx($method_modifiers, 'abstract')) {
$abstract_methods[] = $method;
}
}
if (!idx($class_modifiers, 'abstract') && $abstract_methods) {
$this->raiseLintAtNode($class, pht('Class contains %s %s method(s) and must therefore ' . 'be declared `%s`.', phutil_count($abstract_methods), 'abstract', 'abstract'));
}
}
}
示例11: getTitle
public function getTitle()
{
$author_phid = $this->getAuthorPHID();
$old = $this->getOldValue();
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
case self::TYPE_PICTURE:
return $this->getRoomTitle();
break;
case self::TYPE_FILES:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
if ($add && $rem) {
$title = pht('%s edited files(s), added %d and removed %d.', $this->renderHandleLink($author_phid), count($add), count($rem));
} else {
if ($add) {
$title = pht('%s added %s files(s).', $this->renderHandleLink($author_phid), phutil_count($add));
} else {
$title = pht('%s removed %s file(s).', $this->renderHandleLink($author_phid), phutil_count($rem));
}
}
return $title;
break;
case self::TYPE_PARTICIPANTS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
if ($add && $rem) {
$title = pht('%s edited participant(s), added %d: %s; removed %d: %s.', $this->renderHandleLink($author_phid), count($add), $this->renderHandleList($add), count($rem), $this->renderHandleList($rem));
} else {
if ($add) {
$title = pht('%s added %d participant(s): %s.', $this->renderHandleLink($author_phid), count($add), $this->renderHandleList($add));
} else {
$title = pht('%s removed %d participant(s): %s.', $this->renderHandleLink($author_phid), count($rem), $this->renderHandleList($rem));
}
}
return $title;
break;
}
return parent::getTitle();
}
示例12: extractLibrary
private function extractLibrary($root)
{
$files = $this->loadLibraryFiles($root);
$cache = $this->readCache($root);
$modified = $this->getModifiedFiles($files, $cache);
$cache['files'] = $files;
if ($modified) {
echo tsprintf("**<bg:blue> %s </bg>** %s\n", pht('MODIFIED'), pht('Found %s modified file(s) (of %s total).', phutil_count($modified), phutil_count($files)));
$old_strings = idx($cache, 'strings');
$old_strings = array_select_keys($old_strings, $files);
$new_strings = $this->extractFiles($root, $modified);
$all_strings = $new_strings + $old_strings;
$cache['strings'] = $all_strings;
$this->writeStrings($root, $all_strings);
} else {
echo tsprintf("**<bg:blue> %s </bg>** %s\n", pht('NOT MODIFIED'), pht('Strings for this library are already up to date.'));
}
$cache = id(new PhutilJSON())->encodeFormatted($cache);
$this->writeCache($root, 'i18n_files.json', $cache);
}
开发者ID:endlessm,项目名称:phabricator,代码行数:20,代码来源:PhabricatorInternationalizationManagementExtractWorkflow.php
示例13: buildProjectsView
private function buildProjectsView(PhabricatorUser $user)
{
$viewer = $this->getViewer();
$projects = id(new PhabricatorProjectQuery())->setViewer($viewer)->withMemberPHIDs(array($user->getPHID()))->needImages(true)->withStatuses(array(PhabricatorProjectStatus::STATUS_ACTIVE))->execute();
$header = id(new PHUIHeaderView())->setHeader(pht('Projects'));
if (!empty($projects)) {
$limit = 5;
$render_phids = array_slice($projects, 0, $limit);
$list = id(new PhabricatorProjectListView())->setUser($viewer)->setProjects($render_phids);
if (count($projects) > $limit) {
$header_text = pht('Projects (%s)', phutil_count($projects));
$header = id(new PHUIHeaderView())->setHeader($header_text)->addActionLink(id(new PHUIButtonView())->setTag('a')->setIcon('fa-list-ul')->setText(pht('View All'))->setHref('/project/?member=' . $user->getPHID()));
}
} else {
$error = id(new PHUIBoxView())->addClass('mlb')->appendChild(pht('User does not belong to any projects.'));
$list = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($error);
}
$box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($list)->setBackground(PHUIObjectBoxView::GREY);
return $box;
}
示例14: executeChecks
protected function executeChecks()
{
$task_daemon = id(new PhabricatorDaemonLogQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withStatus(PhabricatorDaemonLogQuery::STATUS_RUNNING)->withDaemonClasses(array('PhabricatorTaskmasterDaemon'))->setLimit(1)->execute();
if (!$task_daemon) {
$doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
$summary = pht('You must start the Phabricator daemons to send email, rebuild ' . 'search indexes, and do other background processing.');
$message = pht('The Phabricator daemons are not running, so Phabricator will not ' . 'be able to perform background processing (including sending email, ' . 'rebuilding search indexes, importing commits, cleaning up old data, ' . 'and running builds).' . "\n\n" . 'Use %s to start daemons. See %s for more information.', phutil_tag('tt', array(), 'bin/phd start'), phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Managing Daemons with phd')));
$this->newIssue('daemons.not-running')->setShortName(pht('Daemons Not Running'))->setName(pht('Phabricator Daemons Are Not Running'))->setSummary($summary)->setMessage($message)->addCommand('phabricator/ $ ./bin/phd start');
}
$phd_user = PhabricatorEnv::getEnvConfig('phd.user');
$environment_hash = PhabricatorEnv::calculateEnvironmentHash();
$all_daemons = id(new PhabricatorDaemonLogQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)->execute();
foreach ($all_daemons as $daemon) {
if ($phd_user) {
if ($daemon->getRunningAsUser() != $phd_user) {
$doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
$summary = pht('At least one daemon is currently running as a different ' . 'user than configured in the Phabricator %s setting', 'phd.user');
$message = pht('A daemon is running as user %s while the Phabricator config ' . 'specifies %s to be %s.' . "\n\n" . 'Either adjust %s to match %s or start ' . 'the daemons as the correct user. ' . "\n\n" . '%s Daemons will try to use %s to start as the configured user. ' . 'Make sure that the user who starts %s has the correct ' . 'sudo permissions to start %s daemons as %s', 'phd.user', 'phd.user', 'phd', 'sudo', 'phd', 'phd', phutil_tag('tt', array(), $daemon->getRunningAsUser()), phutil_tag('tt', array(), $phd_user), phutil_tag('tt', array(), $daemon->getRunningAsUser()), phutil_tag('tt', array(), $phd_user));
$this->newIssue('daemons.run-as-different-user')->setName(pht('Daemons are running as the wrong user'))->setSummary($summary)->setMessage($message)->addCommand('phabricator/ $ ./bin/phd restart');
}
}
if ($daemon->getEnvHash() != $environment_hash) {
$doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
$summary = pht('At least one daemon is currently running with different ' . 'configuration than the Phabricator web application.');
$list_section = null;
$env_info = $daemon->getEnvInfo();
if ($env_info) {
$issues = PhabricatorEnv::compareEnvironmentInfo(PhabricatorEnv::calculateEnvironmentInfo(), $env_info);
if ($issues) {
foreach ($issues as $key => $issue) {
$issues[$key] = phutil_tag('li', array(), $issue);
}
$list_section = array(pht('The configurations differ in the following %s way(s):', phutil_count($issues)), phutil_tag('ul', array(), $issues));
}
}
$message = pht('At least one daemon is currently running with a different ' . 'configuration (config checksum %s) than the web application ' . '(config checksum %s).' . "\n\n%s" . 'This usually means that you have just made a configuration change ' . 'from the web UI, but have not yet restarted the daemons. You ' . 'need to restart the daemons after making configuration changes ' . 'so they will pick up the new values: until you do, they will ' . 'continue operating with the old settings.' . "\n\n" . '(If you plan to make more changes, you can restart the daemons ' . 'once after you finish making all of your changes.)' . "\n\n" . 'Use %s to restart daemons. You can find a list of running daemons ' . 'in the %s, which will also help you identify which daemon (or ' . 'daemons) have divergent configuration. For more information about ' . 'managing the daemons, see %s in the documentation.' . "\n\n" . 'This can also happen if you use the %s environmental variable to ' . 'choose a configuration file, but the daemons run with a different ' . 'value than the web application. If restarting the daemons does ' . 'not resolve this issue and you use %s to select configuration, ' . 'check that it is set consistently.' . "\n\n" . 'A third possible cause is that you run several machines, and ' . 'the %s configuration file differs between them. This file is ' . 'updated when you edit configuration from the CLI with %s. If ' . 'restarting the daemons does not resolve this issue and you ' . 'run multiple machines, check that all machines have identical ' . '%s configuration files.' . "\n\n" . 'This issue is not severe, but usually indicates that something ' . 'is not configured the way you expect, and may cause the daemons ' . 'to exhibit different behavior than the web application does.', phutil_tag('tt', array(), substr($daemon->getEnvHash(), 0, 12)), phutil_tag('tt', array(), substr($environment_hash, 0, 12)), $list_section, phutil_tag('tt', array(), 'bin/phd restart'), phutil_tag('a', array('href' => '/daemon/', 'target' => '_blank'), pht('Daemon Console')), phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Managing Daemons with phd')), phutil_tag('tt', array(), 'PHABRICATOR_ENV'), phutil_tag('tt', array(), 'PHABRICATOR_ENV'), phutil_tag('tt', array(), 'phabricator/conf/local/local.json'), phutil_tag('tt', array(), 'bin/config'), phutil_tag('tt', array(), 'phabricator/conf/local/local.json'));
$this->newIssue('daemons.need-restarting')->setName(pht('Daemons and Web Have Different Config'))->setSummary($summary)->setMessage($message)->addCommand('phabricator/ $ ./bin/phd restart');
break;
}
}
}
示例15: render
public function render()
{
$viewer = $this->getUser();
$tasks = $this->tasks;
$query = $this->savedQuery;
// If we didn't match anything, just pick up the default empty state.
if (!$tasks) {
return id(new PHUIObjectItemListView())->setUser($viewer)->setNoDataString(pht('No tasks found.'));
}
$group_parameter = nonempty($query->getParameter('group'), 'priority');
$order_parameter = nonempty($query->getParameter('order'), 'priority');
$handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks);
$groups = $this->groupTasks($tasks, $group_parameter, $handles);
$can_edit_priority = $this->canEditPriority;
$can_drag = $order_parameter == 'priority' && $can_edit_priority && ($group_parameter == 'none' || $group_parameter == 'priority');
if (!$viewer->isLoggedIn()) {
// TODO: (T7131) Eventually, we conceivably need to make each task
// draggable individually, since the user may be able to edit some but
// not others.
$can_drag = false;
}
$result = array();
$lists = array();
foreach ($groups as $group => $list) {
$task_list = new ManiphestTaskListView();
$task_list->setShowBatchControls($this->showBatchControls);
if ($can_drag) {
$task_list->setShowSubpriorityControls(true);
}
$task_list->setUser($viewer);
$task_list->setTasks($list);
$task_list->setHandles($handles);
$header = id(new PHUIHeaderView())->addSigil('task-group')->setMetadata(array('priority' => head($list)->getPriority()))->setHeader(pht('%s (%s)', $group, phutil_count($list)));
$lists[] = id(new PHUIObjectBoxView())->setHeader($header)->setObjectList($task_list);
}
if ($can_drag) {
Javelin::initBehavior('maniphest-subpriority-editor', array('uri' => '/maniphest/subpriority/'));
}
return array($lists, $this->showBatchControls ? $this->renderBatchEditor($query) : null);
}