本文整理汇总了PHP中phutil_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_tag函数的具体用法?PHP phutil_tag怎么用?PHP phutil_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_tag函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: renderModuleStatus
public function renderModuleStatus(AphrontRequest $request)
{
$viewer = $request->getViewer();
$collectors = PhabricatorGarbageCollector::getAllCollectors();
$collectors = msort($collectors, 'getCollectorConstant');
$rows = array();
$rowc = array();
foreach ($collectors as $key => $collector) {
$class = null;
if ($collector->hasAutomaticPolicy()) {
$policy_view = phutil_tag('em', array(), pht('Automatic'));
} else {
$policy = $collector->getRetentionPolicy();
if ($policy === null) {
$policy_view = pht('Indefinite');
} else {
$days = ceil($policy / phutil_units('1 day in seconds'));
$policy_view = pht('%s Day(s)', new PhutilNumber($days));
}
$default = $collector->getDefaultRetentionPolicy();
if ($policy !== $default) {
$class = 'highlighted';
$policy_view = phutil_tag('strong', array(), $policy_view);
}
}
$rowc[] = $class;
$rows[] = array($collector->getCollectorConstant(), $collector->getCollectorName(), $policy_view);
}
$table = id(new AphrontTableView($rows))->setRowClasses($rowc)->setHeaders(array(pht('Constant'), pht('Name'), pht('Retention Policy')))->setColumnClasses(array(null, 'pri wide', null));
$header = id(new PHUIHeaderView())->setHeader(pht('Garbage Collectors'))->setSubheader(pht('Collectors with custom policies are highlighted. Use ' . '%s to change retention policies.', phutil_tag('tt', array(), 'bin/garbage set-policy')));
return id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
}
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:PhabricatorConfigCollectorsModule.php
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
// If the user already has a full session, just kick them out of here.
$has_partial_session = $viewer->hasSession() && $viewer->getSession()->getIsPartial();
if (!$has_partial_session) {
return id(new AphrontRedirectResponse())->setURI('/');
}
$engine = new PhabricatorAuthSessionEngine();
// If this cookie is set, the user is headed into a high security area
// after login (normally because of a password reset) so if they are
// able to pass the checkpoint we just want to put their account directly
// into high security mode, rather than prompt them again for the same
// set of credentials.
$jump_into_hisec = $request->getCookie(PhabricatorCookies::COOKIE_HISEC);
try {
$token = $engine->requireHighSecuritySession($viewer, $request, '/logout/', $jump_into_hisec);
} catch (PhabricatorAuthHighSecurityRequiredException $ex) {
$form = id(new PhabricatorAuthSessionEngine())->renderHighSecurityForm($ex->getFactors(), $ex->getFactorValidationResults(), $viewer, $request);
return $this->newDialog()->setTitle(pht('Provide Multi-Factor Credentials'))->setShortTitle(pht('Multi-Factor Login'))->setWidth(AphrontDialogView::WIDTH_FORM)->addHiddenInput(AphrontRequest::TYPE_HISEC, true)->appendParagraph(pht('Welcome, %s. To complete the login process, provide your ' . 'multi-factor credentials.', phutil_tag('strong', array(), $viewer->getUsername())))->appendChild($form->buildLayoutView())->setSubmitURI($request->getPath())->addCancelButton($ex->getCancelURI())->addSubmitButton(pht('Continue'));
}
// Upgrade the partial session to a full session.
$engine->upgradePartialSession($viewer);
// TODO: It might be nice to add options like "bind this session to my IP"
// here, even for accounts without multi-factor auth attached to them.
$next = PhabricatorCookies::getNextURICookie($request);
$request->clearCookie(PhabricatorCookies::COOKIE_NEXTURI);
$request->clearCookie(PhabricatorCookies::COOKIE_HISEC);
if (!PhabricatorEnv::isValidLocalURIForLink($next)) {
$next = '/';
}
return id(new AphrontRedirectResponse())->setURI($next);
}
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhabricatorAuthFinishController.php
示例3: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$configs = id(new PhabricatorAuthProviderConfigQuery())->setViewer($viewer)->execute();
$list = new PHUIObjectItemListView();
$can_manage = $this->hasApplicationCapability(AuthManageProvidersCapability::CAPABILITY);
foreach ($configs as $config) {
$item = new PHUIObjectItemView();
$id = $config->getID();
$edit_uri = $this->getApplicationURI('config/edit/' . $id . '/');
$enable_uri = $this->getApplicationURI('config/enable/' . $id . '/');
$disable_uri = $this->getApplicationURI('config/disable/' . $id . '/');
$provider = $config->getProvider();
if ($provider) {
$name = $provider->getProviderName();
} else {
$name = $config->getProviderType() . ' (' . $config->getProviderClass() . ')';
}
$item->setHeader($name);
if ($provider) {
$item->setHref($edit_uri);
} else {
$item->addAttribute(pht('Provider Implementation Missing!'));
}
$domain = null;
if ($provider) {
$domain = $provider->getProviderDomain();
if ($domain !== 'self') {
$item->addAttribute($domain);
}
}
if ($config->getShouldAllowRegistration()) {
$item->addAttribute(pht('Allows Registration'));
} else {
$item->addAttribute(pht('Does Not Allow Registration'));
}
if ($config->getIsEnabled()) {
$item->setStatusIcon('fa-check-circle green');
$item->addAction(id(new PHUIListItemView())->setIcon('fa-times')->setHref($disable_uri)->setDisabled(!$can_manage)->addSigil('workflow'));
} else {
$item->setStatusIcon('fa-ban red');
$item->addIcon('fa-ban grey', pht('Disabled'));
$item->addAction(id(new PHUIListItemView())->setIcon('fa-plus')->setHref($enable_uri)->setDisabled(!$can_manage)->addSigil('workflow'));
}
$list->addItem($item);
}
$list->setNoDataString(pht('%s You have not added authentication providers yet. Use "%s" to add ' . 'a provider, which will let users register new Phabricator accounts ' . 'and log in.', phutil_tag('strong', array(), pht('No Providers Configured:')), phutil_tag('a', array('href' => $this->getApplicationURI('config/new/')), pht('Add Authentication Provider'))));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Auth Providers'));
$crumbs->setBorder(true);
$guidance_context = new PhabricatorAuthProvidersGuidanceContext();
$guidance = id(new PhabricatorGuidanceEngine())->setViewer($viewer)->setGuidanceContext($guidance_context)->newInfoView();
$button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::SIMPLE)->setHref($this->getApplicationURI('config/new/'))->setIcon('fa-plus')->setDisabled(!$can_manage)->setText(pht('Add Provider'));
$list->setFlush(true);
$list = id(new PHUIObjectBoxView())->setHeaderText(pht('Providers'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->appendChild($list);
$title = pht('Auth Providers');
$header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-key')->addActionLink($button);
$view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($guidance, $list));
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:60,代码来源:PhabricatorAuthListController.php
示例4: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$this->requireApplicationCapability(DiffusionCreateRepositoriesCapability::CAPABILITY);
if ($request->isFormPost()) {
if ($request->getStr('type')) {
switch ($request->getStr('type')) {
case 'create':
$uri = $this->getApplicationURI('create/');
break;
case 'import':
default:
$uri = $this->getApplicationURI('import/');
break;
}
return id(new AphrontRedirectResponse())->setURI($uri);
}
}
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Hosting');
$doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Diffusion User Guide: Repository Hosting'));
$form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormRadioButtonControl())->setName('type')->addButton('create', pht('Create a New Hosted Repository'), array(pht('Create a new, empty repository which Phabricator will host. ' . 'For instructions on configuring repository hosting, see %s.', $doc_link)))->addButton('import', pht('Import an Existing External Repository'), pht("Import a repository hosted somewhere else, like GitHub, " . "Bitbucket, or your organization's existing servers. " . "Phabricator will read changes from the repository but will " . "not host or manage it. The authoritative master version of " . "the repository will stay where it is now.")))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Continue'))->addCancelButton($this->getApplicationURI()));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('New Repository'));
$form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Create or Import Repository'))->setForm($form);
return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => pht('New Repository')));
}
开发者ID:patelhardik,项目名称:phabricator,代码行数:26,代码来源:DiffusionRepositoryNewController.php
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$viewer = $request->getUser();
$project = id(new PhabricatorProjectQuery())->setViewer($viewer)->withIDs(array($this->id))->needMembers(true)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$project) {
return new Aphront404Response();
}
$member_phids = $project->getMemberPHIDs();
$remove_phid = $request->getStr('phid');
if (!in_array($remove_phid, $member_phids)) {
return new Aphront404Response();
}
$members_uri = $this->getApplicationURI('members/' . $project->getID() . '/');
if ($request->isFormPost()) {
$member_spec = array();
$member_spec['-'] = array($remove_phid => $remove_phid);
$type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
$xactions = array();
$xactions[] = id(new PhabricatorProjectTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $type_member)->setNewValue($member_spec);
$editor = id(new PhabricatorProjectTransactionEditor($project))->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($project, $xactions);
return id(new AphrontRedirectResponse())->setURI($members_uri);
}
$handle = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs(array($remove_phid))->executeOne();
$dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('Really Remove Member?'))->appendParagraph(pht('Really remove %s from the project %s?', phutil_tag('strong', array(), $handle->getName()), phutil_tag('strong', array(), $project->getName())))->addCancelButton($members_uri)->addSubmitButton(pht('Remove Project Member'));
return id(new AphrontDialogResponse())->setDialog($dialog);
}
开发者ID:hrb518,项目名称:phabricator,代码行数:27,代码来源:PhabricatorProjectMembersRemoveController.php
示例6: validateCustomDomain
/**
* Makes sure a given custom blog uri is properly configured in DNS
* to point at this Phabricator instance. If there is an error in
* the configuration, return a string describing the error and how
* to fix it. If there is no error, return an empty string.
*
* @return string
*/
public function validateCustomDomain($custom_domain)
{
$example_domain = 'blog.example.com';
$label = pht('Invalid');
// note this "uri" should be pretty busted given the desired input
// so just use it to test if there's a protocol specified
$uri = new PhutilURI($custom_domain);
if ($uri->getProtocol()) {
return array($label, pht('The custom domain should not include a protocol. Just provide ' . 'the bare domain name (for example, "%s").', $example_domain));
}
if ($uri->getPort()) {
return array($label, pht('The custom domain should not include a port number. Just provide ' . 'the bare domain name (for example, "%s").', $example_domain));
}
if (strpos($custom_domain, '/') !== false) {
return array($label, pht('The custom domain should not specify a path (hosting a Phame ' . 'blog at a path is currently not supported). Instead, just provide ' . 'the bare domain name (for example, "%s").', $example_domain));
}
if (strpos($custom_domain, '.') === false) {
return array($label, pht('The custom domain should contain at least one dot (.) because ' . 'some browsers fail to set cookies on domains without a dot. ' . 'Instead, use a normal looking domain name like "%s".', $example_domain));
}
if (!PhabricatorEnv::getEnvConfig('policy.allow-public')) {
$href = PhabricatorEnv::getProductionURI('/config/edit/policy.allow-public/');
return array(pht('Fix Configuration'), pht('For custom domains to work, this Phabricator instance must be ' . 'configured to allow the public access policy. Configure this ' . 'setting %s, or ask an administrator to configure this setting. ' . 'The domain can be specified later once this setting has been ' . 'changed.', phutil_tag('a', array('href' => $href), pht('here'))));
}
return null;
}
开发者ID:fengshao0907,项目名称:phabricator,代码行数:33,代码来源:PhameBlog.php
示例7: buildNav
public function buildNav()
{
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/'));
$applications = id(new PhabricatorApplicationQuery())->setViewer($user)->withInstalled(true)->withUnlisted(false)->withLaunchable(true)->execute();
$pinned = $user->loadPreferences()->getPinnedApplications($applications, $user);
// Force "Applications" to appear at the bottom.
$meta_app = 'PhabricatorApplicationsApplication';
$pinned = array_fuse($pinned);
unset($pinned[$meta_app]);
$pinned[$meta_app] = $meta_app;
$applications[$meta_app] = PhabricatorApplication::getByClass($meta_app);
$tiles = array();
$home_app = new PhabricatorHomeApplication();
$tiles[] = id(new PhabricatorApplicationLaunchView())->setApplication($home_app)->setApplicationStatus($home_app->loadStatus($user))->addClass('phabricator-application-launch-phone-only')->setUser($user);
foreach ($pinned as $pinned_application) {
if (empty($applications[$pinned_application])) {
continue;
}
$application = $applications[$pinned_application];
$tile = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus($application->loadStatus($user))->setUser($user);
$tiles[] = $tile;
}
$nav->addCustomBlock(phutil_tag('div', array('class' => 'application-tile-group'), $tiles));
$nav->addFilter('', pht('Customize Applications...'), '/settings/panel/home/');
$nav->addClass('phabricator-side-menu-home');
$nav->selectFilter(null);
return $nav;
}
开发者ID:denghp,项目名称:phabricator,代码行数:30,代码来源:PhabricatorHomeController.php
示例8: processRequest
public function processRequest()
{
$request = $this->getRequest();
$admin = $request->getUser();
$user = id(new PhabricatorPeopleQuery())->setViewer($admin)->withIDs(array($this->id))->executeOne();
if (!$user) {
return new Aphront404Response();
}
$profile_uri = '/p/' . $user->getUsername() . '/';
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession($admin, $request, $profile_uri);
if ($user->getPHID() == $admin->getPHID()) {
return $this->newDialog()->setTitle(pht('Your Way is Blocked'))->appendParagraph(pht('After a time, your efforts fail. You can not adjust your own ' . 'status as an administrator.'))->addCancelButton($profile_uri, pht('Accept Fate'));
}
if ($request->isFormPost()) {
id(new PhabricatorUserEditor())->setActor($admin)->makeAdminUser($user, !$user->getIsAdmin());
return id(new AphrontRedirectResponse())->setURI($profile_uri);
}
if ($user->getIsAdmin()) {
$title = pht('Remove as Administrator?');
$short = pht('Remove Administrator');
$body = pht('Remove %s as an administrator? They will no longer be able to ' . 'perform administrative functions on this Phabricator install.', phutil_tag('strong', array(), $user->getUsername()));
$submit = pht('Remove Administrator');
} else {
$title = pht('Make Administrator?');
$short = pht('Make Administrator');
$body = pht('Empower %s as an administrator? They will be able to create users, ' . 'approve users, make and remove administrators, delete accounts, and ' . 'perform other administrative functions on this Phabricator install.', phutil_tag('strong', array(), $user->getUsername()));
$submit = pht('Make Administrator');
}
return $this->newDialog()->setTitle($title)->setShortTitle($short)->appendParagraph($body)->addCancelButton($profile_uri)->addSubmitButton($submit);
}
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:PhabricatorPeopleEmpowerController.php
示例9: 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
示例10: buildPropertyListView
private function buildPropertyListView(DrydockResource $resource, PhabricatorActionListView $actions)
{
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())->setActionList($actions);
$status = $resource->getStatus();
$status = DrydockResourceStatus::getNameForStatus($status);
$view->addProperty(pht('Status'), $status);
$until = $resource->getUntil();
if ($until) {
$until_display = phabricator_datetime($until, $viewer);
} else {
$until_display = phutil_tag('em', array(), pht('Never'));
}
$view->addProperty(pht('Expires'), $until_display);
$view->addProperty(pht('Resource Type'), $resource->getType());
$view->addProperty(pht('Blueprint'), $viewer->renderHandle($resource->getBlueprintPHID()));
$attributes = $resource->getAttributes();
if ($attributes) {
$view->addSectionHeader(pht('Attributes'), 'fa-list-ul');
foreach ($attributes as $key => $value) {
$view->addProperty($key, $value);
}
}
return $view;
}
开发者ID:remxcode,项目名称:phabricator,代码行数:25,代码来源:DrydockResourceViewController.php
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$client = id(new PhabricatorOAuthServerClientQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$client) {
return new Aphront404Response();
}
$view_uri = $client->getViewURI();
// Look for an existing authorization.
$authorization = id(new PhabricatorOAuthClientAuthorizationQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->withClientPHIDs(array($client->getPHID()))->executeOne();
if ($authorization) {
return $this->newDialog()->setTitle(pht('Already Authorized'))->appendParagraph(pht('You have already authorized this application to access your ' . 'account.'))->addCancelButton($view_uri, pht('Close'));
}
if ($request->isFormPost()) {
$server = id(new PhabricatorOAuthServer())->setUser($viewer)->setClient($client);
$scope = array();
$authorization = $server->authorizeClient($scope);
$id = $authorization->getID();
$panel_uri = '/settings/panel/oauthorizations/?id=' . $id;
return id(new AphrontRedirectResponse())->setURI($panel_uri);
}
// TODO: It would be nice to put scope options in this dialog, maybe?
return $this->newDialog()->setTitle(pht('Authorize Application?'))->appendParagraph(pht('This will create an authorization, permitting %s to access ' . 'your account.', phutil_tag('strong', array(), $client->getName())))->addCancelButton($view_uri)->addSubmitButton(pht('Authorize Application'));
}
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:PhabricatorOAuthServerTestController.php
示例12: 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
示例13: execute
/**
* @param string $date
*/
public function execute($tasks, $recently_closed, $date)
{
$result = array();
$leftover = array();
foreach ($tasks as $task) {
$phids = $task->getProjectPHIDs();
if ($phids) {
foreach ($phids as $project_phid) {
$result[$project_phid][] = $task;
}
} else {
$leftover[] = $task;
}
}
$result_closed = array();
$leftover_closed = array();
foreach ($recently_closed as $task) {
$phids = $task->getProjectPHIDs();
if ($phids) {
foreach ($phids as $project_phid) {
$result_closed[$project_phid][] = $task;
}
} else {
$leftover_closed[] = $task;
}
}
$base_link = '/maniphest/?allProjects=';
$leftover_name = phutil_tag('em', array(), pht('(No Project)'));
$col_header = pht('Project');
$header = pht('Open Tasks by Project and Priority (%s)', $date);
return array($leftover, $base_link, $leftover_name, $col_header, $header, $result_closed, $leftover_closed, $result);
}
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:35,代码来源:ProjectOpenTasksView.php
示例14: linkRevision
public static final function linkRevision($id)
{
if (!$id) {
return null;
}
return phutil_tag('a', array('href' => "/D{$id}"), "D{$id}");
}
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:DiffusionView.php
示例15: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$limit = 500;
$offset = $request->getInt('offset', 0);
$drequest = $this->getDiffusionRequest();
$branch = $drequest->loadBranch();
$messages = $this->loadLintMessages($branch, $limit, $offset);
$is_dir = substr('/' . $drequest->getPath(), -1) == '/';
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
$rows = array();
foreach ($messages as $message) {
$path = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'lint', 'path' => $message['path']))), substr($message['path'], strlen($drequest->getPath()) + 1));
$line = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'path' => $message['path'], 'line' => $message['line'], 'commit' => $branch->getLintCommit()))), $message['line']);
$author = $message['authorPHID'];
if ($author && $authors[$author]) {
$author = $authors[$author]->renderLink();
}
$rows[] = array($path, $line, $author, ArcanistLintSeverity::getStringForSeverity($message['severity']), $message['name'], $message['description']);
}
$table = id(new AphrontTableView($rows))->setHeaders(array(pht('Path'), pht('Line'), pht('Author'), pht('Severity'), pht('Name'), pht('Description')))->setColumnClasses(array('', 'n'))->setColumnVisibility(array($is_dir));
$content = array();
$pager = id(new AphrontPagerView())->setPageSize($limit)->setOffset($offset)->setHasMorePages(count($messages) >= $limit)->setURI($request->getRequestURI(), 'offset');
$content[] = id(new PHUIObjectBoxView())->setHeaderText(pht('Lint Details'))->appendChild($table);
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'lint'));
return $this->buildApplicationPage(array($crumbs, $content, $pager), array('title' => array(pht('Lint'), $drequest->getRepository()->getCallsign())));
}
开发者ID:hrb518,项目名称:phabricator,代码行数:26,代码来源:DiffusionLintDetailsController.php
示例16: markupText
public function markupText($text, $children)
{
$text = $this->applyRules($text);
if ($this->getEngine()->isTextMode()) {
$children = phutil_split_lines($children, true);
foreach ($children as $key => $child) {
if (strlen(trim($child))) {
$children[$key] = '> ' . $child;
} else {
$children[$key] = '>' . $child;
}
}
$children = implode('', $children);
return $text . "\n\n" . $children;
}
if ($this->getEngine()->isHTMLMailMode()) {
$block_attributes = array('style' => 'border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;');
$head_attributes = array('style' => 'font-style: normal;
padding-bottom: 4px;');
$reply_attributes = array('style' => 'margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);');
} else {
$block_attributes = array('class' => 'remarkup-reply-block');
$head_attributes = array('class' => 'remarkup-reply-head');
$reply_attributes = array('class' => 'remarkup-reply-body');
}
return phutil_tag('blockquote', $block_attributes, array("\n", phutil_tag('div', $head_attributes, $text), "\n", phutil_tag('div', $reply_attributes, $children), "\n"));
}
开发者ID:barcelonascience,项目名称:libphutil,代码行数:35,代码来源:PhutilRemarkupReplyBlockRule.php
示例17: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$query = id(new PhabricatorNotificationQuery())->setViewer($user)->withUserPHIDs(array($user->getPHID()))->setLimit(15);
$stories = $query->execute();
$clear_ui_class = 'phabricator-notification-clear-all';
$clear_uri = id(new PhutilURI('/notification/clear/'));
if ($stories) {
$builder = new PhabricatorNotificationBuilder($stories);
$notifications_view = $builder->buildView();
$content = $notifications_view->render();
$clear_uri->setQueryParam('chronoKey', head($stories)->getChronologicalKey());
} else {
$content = phutil_tag_div('phabricator-notification no-notifications', pht('You have no notifications.'));
$clear_ui_class .= ' disabled';
}
$clear_ui = javelin_tag('a', array('sigil' => 'workflow', 'href' => (string) $clear_uri, 'class' => $clear_ui_class), pht('Mark All Read'));
$notifications_link = phutil_tag('a', array('href' => '/notification/'), pht('Notifications'));
if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
$connection_status = new PhabricatorNotificationStatusView();
} else {
$connection_status = phutil_tag('a', array('href' => PhabricatorEnv::getDoclink('Notifications User Guide: Setup and Configuration')), pht('Notification Server not enabled.'));
}
$connection_ui = phutil_tag('div', array('class' => 'phabricator-notification-footer'), $connection_status);
$header = phutil_tag('div', array('class' => 'phabricator-notification-header'), array($notifications_link, $clear_ui));
$content = hsprintf('%s%s%s', $header, $content, $connection_ui);
$unread_count = id(new PhabricatorFeedStoryNotification())->countUnread($user);
$json = array('content' => $content, 'number' => (int) $unread_count);
return id(new AphrontAjaxResponse())->setContent($json);
}
开发者ID:hrb518,项目名称:phabricator,代码行数:31,代码来源:PhabricatorNotificationPanelController.php
示例18: render
public function render()
{
$messages = $this->lintMessages;
$messages = msort($messages, 'getSortKey');
if ($this->limit) {
$messages = array_slice($messages, 0, $this->limit);
}
$rows = array();
foreach ($messages as $message) {
$path = $message->getPath();
$line = $message->getLine();
$href = null;
if (strlen(idx($this->pathURIMap, $path))) {
$href = $this->pathURIMap[$path] . max($line, 1);
}
$severity = $this->renderSeverity($message->getSeverity());
$location = $path . ':' . $line;
if (strlen($href)) {
$location = phutil_tag('a', array('href' => $href), $location);
}
$rows[] = array($severity, $location, $message->getCode(), $message->getName());
}
$table = id(new AphrontTableView($rows))->setHeaders(array(pht('Severity'), pht('Location'), pht('Code'), pht('Message')))->setColumnClasses(array(null, 'pri', null, 'wide'));
return $table;
}
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:HarbormasterLintPropertyView.php
示例19: getCardAttributes
private function getCardAttributes()
{
$pointslabel = 'Points:';
$pointsvalue = phutil_tag('dd', array('class' => 'phui-card-list-value'), array($this->points, ' '));
$pointskey = phutil_tag('dt', array('class' => 'phui-card-list-key'), array($pointslabel, ' '));
return phutil_tag('dl', array('class' => 'phui-property-list-container'), array($pointskey, $pointsvalue));
}
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:7,代码来源:SprintBoardTaskCard.php
示例20: getTagContent
protected function getTagContent()
{
require_celerity_resource('phui-document-view-css');
require_celerity_resource('phui-document-view-pro-css');
Javelin::initBehavior('phabricator-reveal-content');
$classes = array();
$classes[] = 'phui-document-view';
$classes[] = 'phui-document-view-pro';
$book = null;
if ($this->bookname) {
$book = pht('%s (%s)', $this->bookname, $this->bookdescription);
}
$main_content = $this->renderChildren();
if ($book) {
$this->header->setSubheader($book);
}
$table_of_contents = null;
if ($this->toc) {
$toc = array();
$toc_id = celerity_generate_unique_node_id();
$toc[] = id(new PHUIButtonView())->setTag('a')->setIconFont('fa-align-left')->setColor(PHUIButtonView::SIMPLE)->addClass('phui-document-toc')->addSigil('jx-toggle-class')->setMetaData(array('map' => array($toc_id => 'phui-document-toc-open')));
$toc[] = phutil_tag('div', array('class' => 'phui-list-sidenav phui-document-toc-list'), $this->toc);
$table_of_contents = phutil_tag('div', array('class' => 'phui-document-toc-container', 'id' => $toc_id), $toc);
}
$content_inner = phutil_tag('div', array('class' => 'phui-document-inner'), array($table_of_contents, $this->header, $main_content));
$content = phutil_tag('div', array('class' => 'phui-document-content'), $content_inner);
$view = phutil_tag('div', array('class' => implode(' ', $classes)), $content);
$list = null;
if ($this->propertyList) {
$list = phutil_tag_div('phui-document-properties', $this->propertyList);
}
return array($view, $list);
}
开发者ID:Escalation,项目名称:phabricator,代码行数:33,代码来源:PHUIDocumentViewPro.php
注:本文中的phutil_tag函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论