commit 76457cae91af49b2845bf33defcd2eb5351a0a0c Author: Joel Pittet Date: Thu Aug 13 14:44:34 2015 -0500 remove unrelated changes diff --git a/core/modules/filter/src/Plugin/Filter/FilterHtml.php b/core/modules/filter/src/Plugin/Filter/FilterHtml.php index 7cfd499..8fdd8d9 100644 --- a/core/modules/filter/src/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/src/Plugin/Filter/FilterHtml.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Plugin\Filter; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Form\FormStateInterface; use Drupal\filter\FilterProcessResult; use Drupal\filter\Plugin\FilterBase; @@ -101,7 +102,7 @@ public function tips($long = FALSE) { $output .= '

' . $this->t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') . '

'; $output .= '

' . $this->t('For more information see W3C\'s HTML Specifications or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '

'; $tips = array( - 'a' => array($this->t('Anchors are used to make links to other pages.'), '' . htmlspecialchars(\Drupal::config('system.site')->get('name'), ENT_QUOTES, 'UTF-8') . ''), + 'a' => array($this->t('Anchors are used to make links to other pages.'), '' . SafeMarkup::checkPlain(\Drupal::config('system.site')->get('name')) . ''), 'br' => array($this->t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), $this->t('Text with
line break')), 'p' => array($this->t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '

' . $this->t('Paragraph one.') . '

' . $this->t('Paragraph two.') . '

'), 'strong' => array($this->t('Strong', array(), array('context' => 'Font weight')), '' . $this->t('Strong', array(), array('context' => 'Font weight')) . ''), @@ -143,9 +144,7 @@ public function tips($long = FALSE) { if (!empty($tips[$tag])) { $rows[] = array( array('data' => $tips[$tag][0], 'class' => array('description')), - // The markup must be escaped because this is the example code for the - // user. - array('data' => ['#prefix' => '', '#markup' => htmlspecialchars($tips[$tag][1], ENT_QUOTES, 'UTF-8'), '#suffix' => ''], 'class' => array('type')), + array('data' => SafeMarkup::format('@var', array('@var' => $tips[$tag][1])), 'class' => array('type')), // The markup must not be escaped because this is the example output // for the user. array('data' => ['#markup' => $tips[$tag][1]], 'class' => array('get')) @@ -178,9 +177,7 @@ public function tips($long = FALSE) { foreach ($entities as $entity) { $rows[] = array( array('data' => $entity[0], 'class' => array('description')), - // The markup must be escaped because this is the example code for the - // user. - array('data' => ['#prefix' => '', '#markup' => htmlspecialchars($entity[1], ENT_QUOTES, 'UTF-8'), '#suffix' => ''], 'class' => array('type')), + array('data' => SafeMarkup::format('@var', array('@var' => $entity[1])), 'class' => array('type')), // The markup must not be escaped because this is the example output // for the user. array('data' => ['#markup' => $entity[1]], 'class' => array('get')) diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php index d512f8f..7e6a2d3 100644 --- a/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/core/modules/filter/src/Tests/FilterAdminTest.php @@ -368,15 +368,12 @@ function testFilterTipHtmlEscape() { $this->drupalLogin($this->adminUser); global $base_url; - $site_name_with_markup = 'Filter test site name'; - $this->config('system.site')->set('name', $site_name_with_markup)->save(); - // It is not possible to test the whole filter tip page. // Therefore we test only some parts. - $link = '' . htmlspecialchars($site_name_with_markup, ENT_QUOTES, 'UTF-8') . ''; + $link = '' . SafeMarkup::checkPlain(\Drupal::config('system.site')->get('name')) . ''; $ampersand = '&'; - $link_as_code = '' . htmlspecialchars($link, ENT_QUOTES, 'UTF-8') . ''; - $ampersand_as_code = '' . htmlspecialchars($ampersand, ENT_QUOTES, 'UTF-8') . ''; + $link_as_code = '' . $link . ''; + $ampersand_as_code = '' . $ampersand . ''; $this->drupalGet('filter/tips');