1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Replace array_interleave() by phutil_implode_html()

Summary:
I like this abstraction better.
Result of `phutil_implode_html()` may be also used as a param of `hsprintf()`.

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4904
This commit is contained in:
vrana 2013-02-11 11:17:14 -08:00
parent c3ae8286db
commit 37b98450a5
20 changed files with 27 additions and 29 deletions

View file

@ -73,7 +73,7 @@ final class PhabricatorAuditCommitListView extends AphrontView {
$commit->getCommitData()->getSummary(),
PhabricatorAuditCommitStatusConstants::getStatusName(
$commit->getAuditStatus()),
array_interleave(', ', $auditors),
phutil_implode_html(', ', $auditors),
phabricator_datetime($commit->getEpoch(), $this->user),
);
}

View file

@ -129,7 +129,7 @@ final class PhabricatorAuditListView extends AphrontView {
}
$reasons = $audit->getAuditReasons();
$reasons = array_interleave(phutil_tag('br'), $reasons);
$reasons = phutil_implode_html(phutil_tag('br'), $reasons);
$status_code = $audit->getAuditStatus();
$status = PhabricatorAuditStatusConstants::getStatusName($status_code);

View file

@ -277,7 +277,7 @@ abstract class PhabricatorController extends AphrontController {
$items[] = $this->getHandle($phid)->renderLink();
}
return array_interleave($style_map[$style], $items);
return phutil_implode_html($style_map[$style], $items);
}
protected function buildApplicationMenu() {

View file

@ -44,7 +44,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
),
array(
phutil_tag('p', array(), $run_these),
phutil_tag('pre', array(), array_interleave("\n", $commands)),
phutil_tag('pre', array(), phutil_implode_html("\n", $commands)),
));
}
@ -155,7 +155,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
'<tt>phabricator/ $</tt> ./bin/config set %s <em>value</em>',
$key);
}
$update = phutil_tag('pre', array(), array_interleave("\n", $update));
$update = phutil_tag('pre', array(), phutil_implode_html("\n", $update));
} else {
$update = array();
foreach ($configs as $config) {

View file

@ -26,7 +26,7 @@ final class DifferentialCommitsFieldSpecification
$links[] = $this->getHandle($commit_phid)->renderLink();
}
return array_interleave(phutil_tag('br'), $links);
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getCommitPHIDs() {

View file

@ -26,7 +26,7 @@ final class DifferentialDependenciesFieldSpecification
$links[] = $this->getHandle($revision_phids)->renderLink();
}
return array_interleave(phutil_tag('br'), $links);
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getDependentRevisionPHIDs() {

View file

@ -26,7 +26,7 @@ final class DifferentialDependsOnFieldSpecification
$links[] = $this->getHandle($revision_phids)->renderLink();
}
return array_interleave(phutil_tag('br'), $links);
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getDependentRevisionPHIDs() {

View file

@ -283,7 +283,7 @@ abstract class DifferentialFieldSpecification {
$links[] = $handle->renderLink();
}
return array_interleave(', ', $links);
return phutil_implode_html(', ', $links);
}

View file

@ -29,7 +29,7 @@ final class DifferentialManiphestTasksFieldSpecification
$links[] = $this->getHandle($task_phid)->renderLink();
}
return array_interleave(phutil_tag('br'), $links);
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getManiphestTaskPHIDs() {

View file

@ -160,7 +160,7 @@ final class DifferentialChangesetTwoUpRenderer
'colspan' => 2,
'class' => 'show-more',
),
array_interleave(
phutil_implode_html(
" \xE2\x80\xA2 ", // Bullet
$contents)),
phutil_tag(

View file

@ -178,7 +178,7 @@ final class DifferentialInlineCommentView extends AphrontView {
$links = phutil_tag(
'span',
array('class' => 'differential-inline-comment-links'),
array_interleave(" \xC2\xB7 ", $links));
phutil_implode_html(" \xC2\xB7 ", $links));
} else {
$links = null;
}

View file

@ -74,7 +74,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
}
$parents[$k] = substr($parent, 0, 16);
}
$parents = array_interleave(phutil_tag('br'), $parents);
$parents = phutil_implode_html(phutil_tag('br'), $parents);
$row[] = phutil_tag('td', array(), $parents);
$author = nonempty(

View file

@ -449,9 +449,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($parents as $parent) {
$parent_links[] = $handles[$parent->getPHID()]->renderLink();
}
$props['Parents'] = array_interleave(
" \xC2\xB7 ",
$parent_links);
$props['Parents'] = phutil_implode_html(" \xC2\xB7 ", $parent_links);
}
$request = $this->getDiffusionRequest();
@ -488,7 +486,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($task_phids as $phid) {
$task_list[] = $handles[$phid]->renderLink();
}
$task_list = array_interleave(phutil_tag('br'), $task_list);
$task_list = phutil_implode_html(phutil_tag('br'), $task_list);
$props['Tasks'] = $task_list;
}
@ -497,7 +495,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($proj_phids as $phid) {
$proj_list[] = $handles[$phid]->renderLink();
}
$proj_list = array_interleave(phutil_tag('br'), $proj_list);
$proj_list = phutil_implode_html(phutil_tag('br'), $proj_list);
$props['Projects'] = $proj_list;
}
@ -938,7 +936,7 @@ final class DiffusionCommitController extends DiffusionController {
$ref);
}
return array_interleave(', ', $ref_links);
return phutil_implode_html(', ', $ref_links);
}
private function buildRawDiffResponse(DiffusionRequest $drequest) {

View file

@ -27,7 +27,7 @@ final class PhabricatorHelpKeyboardShortcutController
foreach ($shortcut['keys'] as $stroke) {
$keystrokes[] = phutil_tag('kbd', array(), $stroke);
}
$keystrokes = array_interleave(' or ', $keystrokes);
$keystrokes = phutil_implode_html(' or ', $keystrokes);
$rows[] = phutil_tag(
'tr',
array(),

View file

@ -147,7 +147,7 @@ final class PhabricatorMacroViewController
foreach ($subscribers as $subscriber) {
$sub_view[] = $this->getHandle($subscriber)->renderLink();
}
$sub_view = array_interleave(', ', $sub_view);
$sub_view = phutil_implode_html(', ', $sub_view);
} else {
$sub_view = phutil_tag('em', array(), pht('None'));
}

View file

@ -456,7 +456,7 @@ final class ManiphestTaskEditController extends ManiphestController {
if ($files) {
$file_display = mpull($files, 'getName');
$file_display = array_interleave(phutil_tag('br'), $file_display);
$file_display = phutil_implode_html(phutil_tag('br'), $file_display);
$form->appendChild(
id(new AphrontFormMarkupControl())

View file

@ -64,7 +64,7 @@ final class PhabricatorOwnersDetailController
foreach ($owners as $owner) {
$owner_links[] = $handles[$owner->getUserPHID()]->renderLink();
}
$owner_links = array_interleave(phutil_tag('br'), $owner_links);
$owner_links = phutil_implode_html(phutil_tag('br'), $owner_links);
$rows[] = array('Owners', $owner_links);
$rows[] = array(
@ -98,7 +98,7 @@ final class PhabricatorOwnersDetailController
$repo_name,
$path_link);
}
$path_links = array_interleave(phutil_tag('br'), $path_links);
$path_links = phutil_implode_html(phutil_tag('br'), $path_links);
$rows[] = array('Paths', $path_links);
$table = new AphrontTableView($rows);

View file

@ -238,7 +238,7 @@ final class PhabricatorOwnersListController
$pkg_owners[$key] = phutil_tag('strong', array(), $pkg_owners[$key]);
}
}
$pkg_owners = array_interleave(phutil_tag('br'), $pkg_owners);
$pkg_owners = phutil_implode_html(phutil_tag('br'), $pkg_owners);
$pkg_paths = idx($paths, $package->getID(), array());
foreach ($pkg_paths as $key => $path) {
@ -265,7 +265,7 @@ final class PhabricatorOwnersListController
$pkg_paths[$key] = $path->getPath();
}
}
$pkg_paths = array_interleave(phutil_tag('br'), $pkg_paths);
$pkg_paths = phutil_implode_html(phutil_tag('br'), $pkg_paths);
$rows[] = array(
phutil_tag(

View file

@ -108,13 +108,13 @@ must to maintain backward compatibility.)
If you need to build a list of items with some element in between each of them
(like a middot, comma, or vertical bar) you can use
@{function:array_interleave}:
@{function:phutil_implode_html}:
// Render links with commas between them.
phutil_tag(
'div',
array(),
array_interleave(', ', $list_of_links));
phutil_implode_html(', ', $list_of_links));
= AphrontView Classes =

View file

@ -296,7 +296,7 @@ final class PhabricatorTimelineEventView extends AphrontView {
array(
'class' => 'phabricator-timeline-extra',
),
array_interleave(" \xC2\xB7 ", $extra));
phutil_implode_html(" \xC2\xB7 ", $extra));
}
return $extra;