1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 17:28:51 +02: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") { protected function renderHandlesForPHIDs(array $phids, $style = "\n") {
$style_map = array( $style_map = array(
"\n" => '<br />', "\n" => phutil_tag('br'),
',' => ', ', ',' => ', ',
); );
@ -277,7 +277,7 @@ abstract class PhabricatorController extends AphrontController {
$items[] = $this->getHandle($phid)->renderLink(); $items[] = $this->getHandle($phid)->renderLink();
} }
return phutil_safe_html(implode($style_map[$style], $items)); return array_interleave($style_map[$style], $items);
} }
protected function buildApplicationMenu() { protected function buildApplicationMenu() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -134,8 +134,7 @@ final class HeraldRuleController extends HeraldController {
), ),
'Create New Condition')) 'Create New Condition'))
->setDescription( ->setDescription(
phutil_safe_html( hsprintf('When %s these conditions are met:', $must_match_selector))
'When '.$must_match_selector.' these conditions are met:'))
->setContent(javelin_tag( ->setContent(javelin_tag(
'table', 'table',
array( 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; $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( jsprintf(
'<script>(function(d, s, id) {'. '(function(d, s, id) {'.
' var js, fjs = d.getElementsByTagName(s)[0];'. ' var js, fjs = d.getElementsByTagName(s)[0];'.
' if (d.getElementById(id)) return;'. ' if (d.getElementById(id)) return;'.
' js = d.createElement(s); js.id = id;'. ' js = d.createElement(s); js.id = id;'.
' js.src = %s;'. ' js.src = %s;'.
' fjs.parentNode.insertBefore(js, fjs);'. ' fjs.parentNode.insertBefore(js, fjs);'.
'}(document, \'script\', \'facebook-jssdk\'));</script>', '}(document, \'script\', \'facebook-jssdk\'));',
$c_uri)); $c_uri));
@ -211,9 +212,9 @@ final class PhamePostView extends AphrontView {
); );
// protip - try some var disqus_developer = 1; action to test locally // protip - try some var disqus_developer = 1; action to test locally
$disqus_js = phutil_safe_html( $disqus_js = hsprintf(
'<script>%s</script>',
jsprintf( jsprintf(
'<script>'.
' var disqus_shortname = "phabricator";'. ' var disqus_shortname = "phabricator";'.
' var disqus_identifier = %s;'. ' var disqus_identifier = %s;'.
' var disqus_url = %s;'. ' var disqus_url = %s;'.
@ -225,7 +226,7 @@ final class PhamePostView extends AphrontView {
' dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";'. ' dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";'.
'(document.getElementsByTagName("head")[0] ||'. '(document.getElementsByTagName("head")[0] ||'.
' document.getElementsByTagName("body")[0]).appendChild(dsq);'. ' document.getElementsByTagName("body")[0]).appendChild(dsq);'.
'})(); </script>', '})();',
$post->getPHID(), $post->getPHID(),
$this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()), $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()),
$post->getTitle())); $post->getTitle()));

View file

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