1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Delete some phutil_safe_html()

Test Plan: Displayed revision.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4829
This commit is contained in:
vrana 2013-02-05 15:14:18 -08:00
parent 6bb7a282b1
commit 2f508bf0dc
12 changed files with 47 additions and 49 deletions

View file

@ -264,7 +264,7 @@ abstract class PhabricatorController extends AphrontController {
*/
protected function renderHandlesForPHIDs(array $phids, $style = "\n") {
$style_map = array(
"\n" => '<br />',
"\n" => phutil_tag('br'),
',' => ', ',
);
@ -277,7 +277,7 @@ abstract class PhabricatorController extends AphrontController {
$items[] = $this->getHandle($phid)->renderLink();
}
return phutil_safe_html(implode($style_map[$style], $items));
return array_interleave($style_map[$style], $items);
}
protected function buildApplicationMenu() {

View file

@ -53,20 +53,20 @@ final class PhabricatorSetupIssueView extends AphrontView {
$install_these = pht(
"Install these %d PHP extension(s):", count($extensions));
$install_info = phutil_safe_html(pht(
"You can usually install a PHP extension using <tt>apt-get</tt> or ".
"<tt>yum</tt>. Common package names are ".
"<tt>php-<em>extname</em></tt> or <tt>php5-<em>extname</em></tt>. ".
"Try commands like these:"));
$install_info = pht(
"You can usually install a PHP extension using %s or %s. Common ".
"package names are %s or %s. Try commands like these:",
phutil_tag('tt', array(), 'apt-get'),
phutil_tag('tt', array(), 'yum'),
hsprintf('<tt>php-<em>%s</em></tt>', pht('extname')),
hsprintf('<tt>php5-<em>%s</em></tt>', pht('extname')));
// TODO: We should do a better job of detecting how to install extensions
// on the current system.
$install_commands = array(
"$ sudo apt-get install php5-<em>extname</em> # Debian / Ubuntu",
"$ sudo yum install php-<em>extname</em> # Red Hat / Derivatives",
$install_commands = hsprintf(
"\$ sudo apt-get install php5-<em>extname</em> # Debian / Ubuntu\n".
"\$ sudo yum install php-<em>extname</em> # Red Hat / Derivatives"
);
$install_commands = implode("\n", $install_commands);
$install_commands = phutil_safe_html($install_commands);
$fallback_info = pht(
"If those commands don't work, try Google. The process of installing ".
@ -76,8 +76,8 @@ final class PhabricatorSetupIssueView extends AphrontView {
$restart_info = pht(
"After installing new PHP extensions, <strong>restart your webserver ".
"for the changes to take effect</strong>.");
$restart_info = phutil_safe_html($restart_info);
"for the changes to take effect</strong>.",
hsprintf(''));
$description[] = phutil_tag(
'div',
@ -274,17 +274,19 @@ final class PhabricatorSetupIssueView extends AphrontView {
$info[] = phutil_tag(
'p',
array(),
phutil_safe_html(pht(
pht(
'You can find more information about PHP configuration values in the '.
'<a href="%s">PHP Documentation</a>.',
'http://php.net/manual/ini.list.php')));
'http://php.net/manual/ini.list.php',
hsprintf('')));
$info[] = phutil_tag(
'p',
array(),
phutil_safe_html(pht(
pht(
"After editing the PHP configuration, <strong>restart your ".
"webserver for the changes to take effect</strong>.")));
"webserver for the changes to take effect</strong>.",
hsprintf('')));
return phutil_tag(
'div',

View file

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

View file

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

View file

@ -43,7 +43,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array(
'style' => 'star',
'name' => phutil_safe_html($lstar),
'name' => $lstar,
'value' => $lmsg,
'show' => true,
);
@ -53,7 +53,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array(
'style' => 'excuse',
'name' => 'Excuse',
'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))),
'value' => phutil_escape_html_newlines($excuse),
'show' => true,
);
}
@ -131,10 +131,7 @@ final class DifferentialLintFieldSpecification
if (strlen($description)) {
$rows[] = array(
'style' => 'details',
'value' =>
phutil_safe_html(
nl2br(
phutil_escape_html($description))),
'value' => phutil_escape_html_newlines($description),
'show' => false,
);
if (empty($hidden['details'])) {

View file

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

View file

@ -37,7 +37,7 @@ final class DifferentialUnitFieldSpecification
$rows[] = array(
'style' => 'star',
'name' => phutil_safe_html($ustar),
'name' => $ustar,
'value' => $umsg,
'show' => true,
);
@ -47,7 +47,7 @@ final class DifferentialUnitFieldSpecification
$rows[] = array(
'style' => 'excuse',
'name' => 'Excuse',
'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))),
'value' => phutil_escape_html_newlines($excuse),
'show' => true,
);
}

View file

@ -293,10 +293,10 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
private static function renderDiffStar($star) {
$class = 'diff-star-'.$star;
return
'<span class="'.$class.'">'.
"\xE2\x98\x85".
'</span>';
return phutil_tag(
'span',
array('class' => $class),
"\xE2\x98\x85");
}
private function renderBaseRevision(DifferentialDiff $diff) {

View file

@ -247,8 +247,7 @@ abstract class DiffusionController extends PhabricatorController {
case 'change':
$view_name = 'Change';
$crumb_list[] = $crumb->setName(
phutil_safe_html(
phutil_escape_html($path).' ('.$commit_link.')'));
hsprintf('%s (%s)', $path, $commit_link));
return $crumb_list;
}
@ -278,6 +277,7 @@ abstract class DiffusionController extends PhabricatorController {
$thus_far = '';
foreach ($path_parts as $path_part) {
$thus_far .= $path_part.'/';
$path_sections[] = '/';
$path_sections[] = phutil_tag(
'a',
array(
@ -289,11 +289,10 @@ abstract class DiffusionController extends PhabricatorController {
$path_part);
}
$path_sections[] = phutil_escape_html($last);
$path_sections = '/'.implode('/', $path_sections);
$path_sections[] = '/'.$last;
$crumb_list[] = id(new PhabricatorCrumbView())
->setName(phutil_safe_html($path_sections));
->setName($path_sections);
}
$last_crumb = array_pop($crumb_list);
@ -310,11 +309,11 @@ abstract class DiffusionController extends PhabricatorController {
'Jump to HEAD');
$name = $last_crumb->getName();
$name = phutil_safe_html($name." @ {$commit_link} ({$jump_link})");
$name = hsprintf('%s @ %s (%s)', $name, $commit_link, $jump_link);
$last_crumb->setName($name);
} else if ($spec['view'] != 'lint') {
$name = $last_crumb->getName();
$name = phutil_safe_html($name.' @ HEAD');
$name = hsprintf('%s @ HEAD', $name);
$last_crumb->setName($name);
}

View file

@ -134,8 +134,7 @@ final class HeraldRuleController extends HeraldController {
),
'Create New Condition'))
->setDescription(
phutil_safe_html(
'When '.$must_match_selector.' these conditions are met:'))
hsprintf('When %s these conditions are met:', $must_match_selector))
->setContent(javelin_tag(
'table',
array(

View file

@ -162,15 +162,16 @@ final class PhamePostView extends AphrontView {
'');
$c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id;
$fb_js = phutil_safe_html(
$fb_js = hsprintf(
'<script>%s</script>',
jsprintf(
'<script>(function(d, s, id) {'.
'(function(d, s, id) {'.
' var js, fjs = d.getElementsByTagName(s)[0];'.
' if (d.getElementById(id)) return;'.
' js = d.createElement(s); js.id = id;'.
' js.src = %s;'.
' fjs.parentNode.insertBefore(js, fjs);'.
'}(document, \'script\', \'facebook-jssdk\'));</script>',
'}(document, \'script\', \'facebook-jssdk\'));',
$c_uri));
@ -211,9 +212,9 @@ final class PhamePostView extends AphrontView {
);
// protip - try some var disqus_developer = 1; action to test locally
$disqus_js = phutil_safe_html(
$disqus_js = hsprintf(
'<script>%s</script>',
jsprintf(
'<script>'.
' var disqus_shortname = "phabricator";'.
' var disqus_identifier = %s;'.
' var disqus_url = %s;'.
@ -225,7 +226,7 @@ final class PhamePostView extends AphrontView {
' dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";'.
'(document.getElementsByTagName("head")[0] ||'.
' document.getElementsByTagName("body")[0]).appendChild(dsq);'.
'})(); </script>',
'})();',
$post->getPHID(),
$this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()),
$post->getTitle()));

View file

@ -49,7 +49,7 @@ final class PhabricatorPropertyListExample extends PhabricatorUIExample {
$view->addSectionHeader('Haiku About Pasta');
$view->addTextContent(
phutil_safe_html(
hsprintf(
'this is a pasta<br />'.
'haiku. it is very bad.<br />'.
'what did you expect?'));