本文整理汇总了PHP中phutil_count函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_count函数的具体用法?PHP phutil_count怎么用?PHP phutil_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_count函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:HarbormasterRunBuildPlansHeraldAction.php
示例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));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DiffusionAuditorsHeraldAction.php
示例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));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:PhabricatorMetaMTAEmailHeraldAction.php
示例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));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:LegalpadRequireSignatureHeraldAction.php
示例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));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:PhabricatorProjectHeraldAction.php
示例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;
}
开发者ID:pugong,项目名称:phabricator,代码行数:10,代码来源:CelerityManagementMapWorkflow.php
示例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;
}
开发者ID:truSense,项目名称:phabricator,代码行数:51,代码来源:PhabricatorProjectUserListView.php
示例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'));
}
}
}
开发者ID:mduan,项目名称:arcanist,代码行数:18,代码来源:ArcanistClassMustBeDeclaredAbstractXHPASTLinterRule.php
示例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();
}
开发者ID:pugong,项目名称:phabricator,代码行数:44,代码来源:ConpherenceTransaction.php
示例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;
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:20,代码来源:PhabricatorPeopleProfileViewController.php
示例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;
}
}
}
开发者ID:paladox,项目名称:phabricator,代码行数:41,代码来源:PhabricatorDaemonsSetupCheck.php
示例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);
}
开发者ID:endlessm,项目名称:phabricator,代码行数:40,代码来源:ManiphestTaskResultListView.php
示例16: commit_symbols
function commit_symbols(array $symbols, PhabricatorRepository $repository, $no_purge)
{
echo pht('Looking up path IDs...'), "\n";
$path_map = PhabricatorRepositoryCommitChangeParserWorker::lookupOrCreatePaths(ipull($symbols, 'path'));
$symbol = new PhabricatorRepositorySymbol();
$conn_w = $symbol->establishConnection('w');
echo pht('Preparing queries...'), "\n";
$sql = array();
foreach ($symbols as $dict) {
$sql[] = qsprintf($conn_w, '(%s, %s, %s, %s, %s, %d, %d)', $repository->getPHID(), $dict['ctxt'], $dict['name'], $dict['type'], $dict['lang'], $dict['line'], $path_map[$dict['path']]);
}
if (!$no_purge) {
echo pht('Purging old symbols...'), "\n";
queryfx($conn_w, 'DELETE FROM %T WHERE repositoryPHID = %s', $symbol->getTableName(), $repository->getPHID());
}
echo pht('Loading %s symbols...', phutil_count($sql)), "\n";
foreach (array_chunk($sql, 128) as $chunk) {
queryfx($conn_w, 'INSERT INTO %T
(repositoryPHID, symbolContext, symbolName, symbolType,
symbolLanguage, lineNumber, pathID) VALUES %Q', $symbol->getTableName(), implode(', ', $chunk));
}
}
开发者ID:rchicoli,项目名称:phabricator,代码行数:22,代码来源:import_repository_symbols.php
示例17: getTitleForFeed
public function getTitleForFeed()
{
list($add, $rem) = $this->getChanges();
if ($add && !$rem) {
return pht('%s invited %s attendee(s) to %s: %s.', $this->renderAuthor(), phutil_count($add), $this->renderObject(), $this->renderHandleList($add));
} else {
if (!$add && $rem) {
return pht('%s uninvited %s attendee(s) to %s: %s.', $this->renderAuthor(), phutil_count($rem), $this->renderObject(), $this->renderHandleList($rem));
} else {
return pht('%s updated the invite list for %s, invited %s: %s; ' . 'uninvinted %s: %s.', $this->renderAuthor(), $this->renderObject(), phutil_count($add), $this->renderHandleList($add), phutil_count($rem), $this->renderHandleList($rem));
}
}
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:13,代码来源:PhabricatorCalendarEventInviteTransaction.php
示例18: parseParams
private function parseParams(DivinerAtom $atom, AASTNode $func)
{
$params = $func->getChildByIndex(3, 'n_DECLARATAION_PARAMETER_LIST')->selectDescendantsOfType('n_DECLARATION_PARAMETER');
$param_spec = array();
if ($atom->getDocblockRaw()) {
$metadata = $atom->getDocblockMeta();
} else {
$metadata = array();
}
$docs = idx($metadata, 'param');
if ($docs) {
$docs = (array) $docs;
$docs = array_filter($docs);
} else {
$docs = array();
}
if (count($docs)) {
if (count($docs) < count($params)) {
$atom->addWarning(pht('This call takes %s parameter(s), but only %s are documented.', phutil_count($params), phutil_count($docs)));
}
}
foreach ($params as $param) {
$name = $param->getChildByIndex(1)->getConcreteString();
$dict = array('type' => $param->getChildByIndex(0)->getConcreteString(), 'default' => $param->getChildByIndex(2)->getConcreteString());
if ($docs) {
$doc = array_shift($docs);
if ($doc) {
$dict += $this->parseParamDoc($atom, $doc, $name);
}
}
$param_spec[] = array('name' => $name) + $dict;
}
if ($docs) {
foreach ($docs as $doc) {
if ($doc) {
$param_spec[] = $this->parseParamDoc($atom, $doc, null);
}
}
}
// TODO: Find `assert_instances_of()` calls in the function body and
// add their type information here. See T1089.
$atom->setProperty('parameters', $param_spec);
}
开发者ID:endlessm,项目名称:phabricator,代码行数:43,代码来源:DivinerPHPAtomizer.php
示例19: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_PREVIOUSLY_UNSUBSCRIBED:
return pht('Declined to resubscribe %s target(s) because they previously ' . 'unsubscribed: %s.', phutil_count($data), $this->renderHandleList($data));
case self::DO_AUTOSUBSCRIBED:
return pht('%s automatically subscribed target(s) were not affected: %s.', phutil_count($data), $this->renderHandleList($data));
case self::DO_SUBSCRIBED:
return pht('Added %s subscriber(s): %s.', phutil_count($data), $this->renderHandleList($data));
case self::DO_UNSUBSCRIBED:
return pht('Removed %s subscriber(s): %s.', phutil_count($data), $this->renderHandleList($data));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:13,代码来源:PhabricatorSubscriptionsHeraldAction.php
示例20: renderPHPConfig
private function renderPHPConfig(array $configs, $issue)
{
$table_info = phutil_tag('p', array(), pht('The current PHP configuration has these %d value(s):', count($configs)));
$dict = array();
foreach ($configs as $key) {
$dict[$key] = $issue->getPHPConfigOriginalValue($key, ini_get($key));
}
$table = $this->renderValueTable($dict);
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
$rex = '@Loaded Configuration File\\s*</td><td class="v">(.*?)</td>@i';
$matches = null;
$ini_loc = null;
if (preg_match($rex, $phpinfo, $matches)) {
$ini_loc = trim($matches[1]);
}
$rex = '@Additional \\.ini files parsed\\s*</td><td class="v">(.*?)</td>@i';
$more_loc = array();
if (preg_match($rex, $phpinfo, $matches)) {
$more_loc = trim($matches[1]);
if ($more_loc == '(none)') {
$more_loc = array();
} else {
$more_loc = preg_split('/\\s*,\\s*/', $more_loc);
}
}
$info = array();
if (!$ini_loc) {
$info[] = phutil_tag('p', array(), pht('To update these %d value(s), edit your PHP configuration file.', count($configs)));
} else {
$info[] = phutil_tag('p', array(), pht('To update these %d value(s), edit your PHP configuration file, ' . 'located here:', count($configs)));
$info[] = phutil_tag('pre', array(), $ini_loc);
}
if ($more_loc) {
$info[] = phutil_tag('p', array(), pht('PHP also loaded these %s configuration file(s):', phutil_count($more_loc)));
$info[] = phutil_tag('pre', array(), implode("\n", $more_loc));
}
$show_standard = false;
$show_opcache = false;
foreach ($configs as $key) {
if (preg_match('/^opcache\\./', $key)) {
$show_opcache = true;
} else {
$show_standard = true;
}
}
if ($show_standard) {
$info[] = phutil_tag('p', array(), pht('You can find more information about PHP configuration values ' . 'in the %s.', phutil_tag('a', array('href' => 'http://php.net/manual/ini.list.php', 'target' => '_blank'), pht('PHP Documentation'))));
}
if ($show_opcache) {
$info[] = phutil_tag('p', array(), pht('You can find more information about configuring OPCache in ' . 'the %s.', phutil_tag('a', array('href' => 'http://php.net/manual/opcache.configuration.php', 'target' => '_blank'), pht('PHP OPCache Documentation'))));
}
$info[] = phutil_tag('p', array(), pht('After editing the PHP configuration, <strong>restart Phabricator for ' . 'the changes to take effect</strong>. For help with restarting ' . 'Phabricator, see %s in the documentation.', $this->renderRestartLink()));
return phutil_tag('div', array('class' => 'setup-issue-config'), array($table_info, $table, $info));
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:56,代码来源:PhabricatorSetupIssueView.php
注:本文中的phutil_count函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论