diff --git a/core/modules/block/src/BlockForm.php b/core/modules/block/src/BlockForm.php index 866f1b8..9631404 100644 --- a/core/modules/block/src/BlockForm.php +++ b/core/modules/block/src/BlockForm.php @@ -195,7 +195,7 @@ public function form(array $form, array &$form_state) { } // Per-role visibility. - $role_options = array_map('check_plain', user_role_names()); + $role_options = array_map(array('\Drupal\Component\Utility\String', 'checkPlain'), user_role_names()); $form['visibility']['role'] = array( '#type' => 'details', '#title' => $this->t('Roles'), diff --git a/core/modules/block/src/BlockViewBuilder.php b/core/modules/block/src/BlockViewBuilder.php index 9e3b1b5..43bbdbf 100644 --- a/core/modules/block/src/BlockViewBuilder.php +++ b/core/modules/block/src/BlockViewBuilder.php @@ -65,7 +65,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la // @todo Remove after fixing http://drupal.org/node/1989568. '#block' => $entity, ); - $build[$entity_id]['#configuration']['label'] = check_plain($configuration['label']); + $build[$entity_id]['#configuration']['label'] = String::checkPlain($configuration['label']); // Set cache tags; these always need to be set, whether the block is // cacheable or not, so that the page cache is correctly informed. diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 8fc5537..09bbaa9 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -13,6 +13,7 @@ use Drupal\comment\CommentInterface; use Drupal\comment\Entity\Comment; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\entity\Entity\EntityViewDisplay; @@ -1265,7 +1266,7 @@ function comment_preview(CommentInterface $comment, array &$form_state) { if (!empty($account) && $account->isAuthenticated()) { $comment->setOwner($account); - $comment->setAuthorName(check_plain($account->getUsername())); + $comment->setAuthorName(String::checkPlain($account->getUsername())); } elseif (empty($author_name)) { $comment->setAuthorName(\Drupal::config('user.settings')->get('anonymous')); diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc index 058bdc5..8d0620e 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -5,6 +5,7 @@ * Builds placeholder replacement tokens for comment-related data. */ +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; /** @@ -141,12 +142,12 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = // Poster identity information for comments. case 'hostname': - $replacements[$original] = $sanitize ? check_plain($comment->getHostname()) : $comment->getHostname(); + $replacements[$original] = $sanitize ? String::checkPlain($comment->getHostname()) : $comment->getHostname(); break; case 'mail': $mail = $comment->getAuthorEmail(); - $replacements[$original] = $sanitize ? check_plain($mail) : $mail; + $replacements[$original] = $sanitize ? String::checkPlain($mail) : $mail; break; case 'homepage': diff --git a/core/modules/comment/src/Plugin/views/argument/UserUid.php b/core/modules/comment/src/Plugin/views/argument/UserUid.php index 674c3b6..6e15d66 100644 --- a/core/modules/comment/src/Plugin/views/argument/UserUid.php +++ b/core/modules/comment/src/Plugin/views/argument/UserUid.php @@ -7,6 +7,7 @@ namespace Drupal\comment\Plugin\views\argument; +use Drupal\Component\Utility\String; use Drupal\Core\Database\Connection; use Drupal\views\Plugin\views\argument\ArgumentPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -64,7 +65,7 @@ function title() { return t('No user'); } - return check_plain($title); + return String::checkPlain($title); } protected function defaultActions($which = NULL) { diff --git a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php index 4a7b908..ec76fb4 100644 --- a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php @@ -7,6 +7,7 @@ namespace Drupal\comment\Tests; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; /** @@ -53,10 +54,10 @@ function testCommentTokenReplacement() { // Generate and test sanitized tokens. $tests = array(); $tests['[comment:cid]'] = $comment->id(); - $tests['[comment:hostname]'] = check_plain($comment->getHostname()); + $tests['[comment:hostname]'] = String::checkPlain($comment->getHostname()); $tests['[comment:name]'] = Xss::filter($comment->getAuthorName()); $tests['[comment:author]'] = Xss::filter($comment->getAuthorName()); - $tests['[comment:mail]'] = check_plain($this->admin_user->getEmail()); + $tests['[comment:mail]'] = String::checkPlain($this->admin_user->getEmail()); $tests['[comment:homepage]'] = check_url($comment->getHomepage()); $tests['[comment:title]'] = Xss::filter($comment->getSubject()); $tests['[comment:body]'] = $comment->comment_body->processed; @@ -65,11 +66,11 @@ function testCommentTokenReplacement() { $tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->getCreatedTime(), 2, $language_interface->id); $tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->getChangedTime(), 2, $language_interface->id); $tests['[comment:parent:cid]'] = $comment->hasParentComment() ? $comment->getParentComment()->id() : NULL; - $tests['[comment:parent:title]'] = check_plain($parent_comment->getSubject()); + $tests['[comment:parent:title]'] = String::checkPlain($parent_comment->getSubject()); $tests['[comment:node:nid]'] = $comment->getCommentedEntityId(); - $tests['[comment:node:title]'] = check_plain($node->getTitle()); + $tests['[comment:node:title]'] = String::checkPlain($node->getTitle()); $tests['[comment:author:uid]'] = $comment->getOwnerId(); - $tests['[comment:author:name]'] = check_plain($this->admin_user->getUsername()); + $tests['[comment:author:name]'] = String::checkPlain($this->admin_user->getUsername()); // Test to make sure that we generated something for each token. $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); diff --git a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php index e5ad209..8dd6f13 100644 --- a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php +++ b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php @@ -190,7 +190,7 @@ public function instanceSettingsForm(array $form, array &$form_state) { // entity type specific plugins (e.g. 'default_node', 'default_user', // ...). if (in_array($plugin_id, $handler_groups)) { - $handlers_options[$plugin_id] = check_plain($plugin['label']); + $handlers_options[$plugin_id] = String::checkPlain($plugin['label']); } } diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php index bc305cd..992da6a 100644 --- a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php +++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php @@ -7,6 +7,7 @@ namespace Drupal\entity_reference\Plugin\Field\FieldFormatter; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldItemListInterface; /** @@ -77,7 +78,7 @@ public function viewElements(FieldItemListInterface $items) { ) + $uri->toRenderArray(); } else { - $elements[$delta] = array('#markup' => check_plain($label)); + $elements[$delta] = array('#markup' => String::checkPlain($label)); } $elements[$delta]['#cache']['tags'] = $referenced_entity->getCacheTag(); } diff --git a/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php index 650486c..1d18deb 100644 --- a/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php +++ b/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php @@ -7,6 +7,7 @@ namespace Drupal\entity_reference\Plugin\entity_reference\selection; +use Drupal\Component\Utility\String; use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Database\Query\SelectInterface; use Drupal\Core\Entity\EntityInterface; @@ -183,7 +184,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA $entities = entity_load_multiple($target_type, $result); foreach ($entities as $entity_id => $entity) { $bundle = $entity->bundle(); - $options[$bundle][$entity_id] = check_plain($entity->label()); + $options[$bundle][$entity_id] = String::checkPlain($entity->label()); } return $options; diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php index 8f9ce99..4f7b28a 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php @@ -7,6 +7,7 @@ namespace Drupal\entity_reference\Tests; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; @@ -114,7 +115,7 @@ public function testNodeHandler() { $node = entity_create('node', $values); $node->save(); $nodes[$key] = $node; - $node_labels[$key] = check_plain($node->label()); + $node_labels[$key] = String::checkPlain($node->label()); } // Test as a non-admin. @@ -260,7 +261,7 @@ public function testUserHandler() { $account = $values; } $users[$key] = $account; - $user_labels[$key] = check_plain($account->getUsername()); + $user_labels[$key] = String::checkPlain($account->getUsername()); } // Test as a non-admin. @@ -439,7 +440,7 @@ public function testCommentHandler() { $comment = entity_create('comment', $values); $comment->save(); $comments[$key] = $comment; - $comment_labels[$key] = check_plain($comment->label()); + $comment_labels[$key] = String::checkPlain($comment->label()); } // Test as a non-admin. diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionSortTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionSortTest.php index 43ce3a2..a0ab8db 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionSortTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionSortTest.php @@ -7,6 +7,7 @@ namespace Drupal\entity_reference\Tests; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; /** @@ -115,7 +116,7 @@ public function testSort() { $node = entity_create('node', $values); $node->save(); $nodes[$key] = $node; - $node_labels[$key] = check_plain($node->label()); + $node_labels[$key] = String::checkPlain($node->label()); } // Test as a non-admin. diff --git a/core/modules/field/src/Plugin/views/argument/FieldList.php b/core/modules/field/src/Plugin/views/argument/FieldList.php index 6b6a5c5..d55ca6a 100644 --- a/core/modules/field/src/Plugin/views/argument/FieldList.php +++ b/core/modules/field/src/Plugin/views/argument/FieldList.php @@ -7,6 +7,7 @@ namespace Drupal\field\Plugin\views\argument; +use Drupal\Component\Utility\String; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\argument\Numeric; @@ -69,7 +70,7 @@ public function summaryName($data) { } // else fallback to the key. else { - return check_plain($value); + return String::checkPlain($value); } } diff --git a/core/modules/field/src/Plugin/views/argument/ListString.php b/core/modules/field/src/Plugin/views/argument/ListString.php index 678f1d1..742a151 100644 --- a/core/modules/field/src/Plugin/views/argument/ListString.php +++ b/core/modules/field/src/Plugin/views/argument/ListString.php @@ -7,6 +7,7 @@ namespace Drupal\field\Plugin\views\argument; +use Drupal\Component\Utility\String as UtilityString; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\argument\String; @@ -71,7 +72,7 @@ public function summaryName($data) { } // else fallback to the key. else { - return $this->caseTransform(check_plain($value), $this->options['case']); + return $this->caseTransform(UtilityString::checkPlain($value), $this->options['case']); } } diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php index ba4ebd3..a18ea91 100644 --- a/core/modules/field/src/Tests/FormTest.php +++ b/core/modules/field/src/Tests/FormTest.php @@ -7,6 +7,7 @@ namespace Drupal\field\Tests; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; /** @@ -107,7 +108,7 @@ function testFieldFormSingle() { $this->drupalGet('entity_test/add'); // Create token value expected for description. - $token_description = check_plain(\Drupal::config('system.site')->get('name')) . '_description'; + $token_description = String::checkPlain(\Drupal::config('system.site')->get('name')) . '_description'; $this->assertText($token_description, 'Token replacement for description is displayed'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed'); diff --git a/core/modules/field_ui/src/DisplayOverviewBase.php b/core/modules/field_ui/src/DisplayOverviewBase.php index 2a6f46f..5fc7240 100644 --- a/core/modules/field_ui/src/DisplayOverviewBase.php +++ b/core/modules/field_ui/src/DisplayOverviewBase.php @@ -8,6 +8,7 @@ namespace Drupal\field_ui; use Drupal\Component\Plugin\PluginManagerBase; +use Drupal\Component\Utility\String; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\EntityManagerInterface; @@ -275,7 +276,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent 'defaultPlugin' => $this->getDefaultPlugin($field_definition->getType()), ), 'human_name' => array( - '#markup' => check_plain($label), + '#markup' => String::checkPlain($label), ), 'weight' => array( '#type' => 'textfield', diff --git a/core/modules/field_ui/src/FieldOverview.php b/core/modules/field_ui/src/FieldOverview.php index 46dff17..e249eb0 100644 --- a/core/modules/field_ui/src/FieldOverview.php +++ b/core/modules/field_ui/src/FieldOverview.php @@ -7,6 +7,7 @@ namespace Drupal\field_ui; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityListBuilderInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -125,7 +126,7 @@ public function buildForm(array $form, array &$form_state, $entity_type_id = NUL 'id' => drupal_html_class($name), ), 'label' => array( - '#markup' => check_plain($instance->getLabel()), + '#markup' => String::checkPlain($instance->getLabel()), ), 'field_name' => array( '#markup' => $instance->getName(), diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc index 67db185..510966c 100644 --- a/core/modules/file/file.field.inc +++ b/core/modules/file/file.field.inc @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Render\Element; @@ -188,7 +189,7 @@ function theme_file_upload_help($variables) { $descriptions[] = t('!size limit.', array('!size' => format_size($upload_validators['file_validate_size'][0]))); } if (isset($upload_validators['file_validate_extensions'])) { - $descriptions[] = t('Allowed types: !extensions.', array('!extensions' => check_plain($upload_validators['file_validate_extensions'][0]))); + $descriptions[] = t('Allowed types: !extensions.', array('!extensions' => String::checkPlain($upload_validators['file_validate_extensions'][0]))); } if (isset($upload_validators['file_validate_image_resolution'])) { diff --git a/core/modules/file/file.module b/core/modules/file/file.module index eaa5e12..d7bb3ee 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -5,6 +5,7 @@ * Defines a "managed_file" Form API field and a "file" field for Field module. */ +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Render\Element; use Drupal\file\Entity\File; @@ -1048,15 +1049,15 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr // Essential file data case 'name': - $replacements[$original] = $sanitize ? check_plain($file->getFilename()) : $file->getFilename(); + $replacements[$original] = $sanitize ? String::checkPlain($file->getFilename()) : $file->getFilename(); break; case 'path': - $replacements[$original] = $sanitize ? check_plain($file->getFileUri()) : $file->getFileUri(); + $replacements[$original] = $sanitize ? String::checkPlain($file->getFileUri()) : $file->getFileUri(); break; case 'mime': - $replacements[$original] = $sanitize ? check_plain($file->getMimeType()) : $file->getMimeType(); + $replacements[$original] = $sanitize ? String::checkPlain($file->getMimeType()) : $file->getMimeType(); break; case 'size': @@ -1064,7 +1065,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr break; case 'url': - $replacements[$original] = $sanitize ? check_plain(file_create_url($file->getFileUri())) : file_create_url($file->getFileUri()); + $replacements[$original] = $sanitize ? String::checkPlain(file_create_url($file->getFileUri())) : file_create_url($file->getFileUri()); break; // These tokens are default variations on the chained tokens handled below. @@ -1078,7 +1079,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr case 'owner': $name = $file->getOwner()->label(); - $replacements[$original] = $sanitize ? check_plain($name) : $name; + $replacements[$original] = $sanitize ? String::checkPlain($name) : $name; break; } } @@ -1626,7 +1627,7 @@ function theme_file_link($variables) { } else { $link_text = $variables['description']; - $options['attributes']['title'] = check_plain($file->getFilename()); + $options['attributes']['title'] = String::checkPlain($file->getFilename()); } $file_icon = array( @@ -1654,7 +1655,7 @@ function theme_file_icon($variables) { $file = $variables['file']; $icon_directory = $variables['icon_directory']; - $mime = check_plain($file->getMimeType()); + $mime = String::checkPlain($file->getMimeType()); $icon_url = file_icon_url($file, $icon_directory); return ''; } diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php index 0d052c5..4fa4e04 100644 --- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php +++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php @@ -7,6 +7,7 @@ namespace Drupal\file\Plugin\Field\FieldWidget; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\WidgetBase; use Drupal\Core\Field\FieldItemListInterface; @@ -94,7 +95,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f break; } - $title = check_plain($this->fieldDefinition->getLabel()); + $title = String::checkPlain($this->fieldDefinition->getLabel()); $description = field_filter_xss($this->fieldDefinition->getDescription()); $elements = array(); diff --git a/core/modules/file/src/Tests/FileTokenReplaceTest.php b/core/modules/file/src/Tests/FileTokenReplaceTest.php index e385934..3198681 100644 --- a/core/modules/file/src/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/src/Tests/FileTokenReplaceTest.php @@ -7,6 +7,8 @@ namespace Drupal\file\Tests; +use Drupal\Component\Utility\String; + /** * Tests the file token replacement in strings. */ @@ -46,16 +48,16 @@ function testFileTokenReplacement() { // Generate and test sanitized tokens. $tests = array(); $tests['[file:fid]'] = $file->id(); - $tests['[file:name]'] = check_plain($file->getFilename()); - $tests['[file:path]'] = check_plain($file->getFileUri()); - $tests['[file:mime]'] = check_plain($file->getMimeType()); + $tests['[file:name]'] = String::checkPlain($file->getFilename()); + $tests['[file:path]'] = String::checkPlain($file->getFileUri()); + $tests['[file:mime]'] = String::checkPlain($file->getMimeType()); $tests['[file:size]'] = format_size($file->getSize()); - $tests['[file:url]'] = check_plain(file_create_url($file->getFileUri())); + $tests['[file:url]'] = String::checkPlain(file_create_url($file->getFileUri())); $tests['[file:created]'] = format_date($file->getCreatedTime(), 'medium', '', NULL, $language_interface->id); $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->id); $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id); $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id); - $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user)); + $tests['[file:owner]'] = String::checkPlain(user_format_name($this->admin_user)); $tests['[file:owner:uid]'] = $file->getOwnerId(); // Test to make sure that we generated something for each token. diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index f5a76a8..e2b0907 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -984,8 +984,8 @@ function _filter_url_parse_full_links($match) { $i = 1; $match[$i] = decode_entities($match[$i]); - $caption = check_plain(_filter_url_trim($match[$i])); - $match[$i] = check_plain($match[$i]); + $caption = String::checkPlain(_filter_url_trim($match[$i])); + $match[$i] = String::checkPlain($match[$i]); return '' . $caption . ''; } @@ -999,8 +999,8 @@ function _filter_url_parse_email_links($match) { $i = 0; $match[$i] = decode_entities($match[$i]); - $caption = check_plain(_filter_url_trim($match[$i])); - $match[$i] = check_plain($match[$i]); + $caption = String::checkPlain(_filter_url_trim($match[$i])); + $match[$i] = String::checkPlain($match[$i]); return '' . $caption . ''; } @@ -1014,8 +1014,8 @@ function _filter_url_parse_partial_links($match) { $i = 1; $match[$i] = decode_entities($match[$i]); - $caption = check_plain(_filter_url_trim($match[$i])); - $match[$i] = check_plain($match[$i]); + $caption = String::checkPlain(_filter_url_trim($match[$i])); + $match[$i] = String::checkPlain($match[$i]); return '' . $caption . ''; } @@ -1147,7 +1147,7 @@ function _filter_autop($text) { * Escapes all HTML tags, so they will be visible instead of being effective. */ function _filter_html_escape($text) { - return trim(check_plain($text)); + return trim(String::checkPlain($text)); } /** diff --git a/core/modules/filter/src/Plugin/Filter/FilterHtml.php b/core/modules/filter/src/Plugin/Filter/FilterHtml.php index 543f147..6549168 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\String; use Drupal\filter\FilterProcessResult; use Drupal\filter\Plugin\FilterBase; @@ -100,7 +101,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.'), '' . check_plain(\Drupal::config('system.site')->get('name')) . ''), + 'a' => array($this->t('Anchors are used to make links to other pages.'), '' . String::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' . $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')) . ''), @@ -142,7 +143,7 @@ public function tips($long = FALSE) { if (!empty($tips[$tag])) { $rows[] = array( array('data' => $tips[$tag][0], 'class' => array('description')), - array('data' => '' . check_plain($tips[$tag][1]) . '
', 'class' => array('type')),
+ array('data' => '' . String::checkPlain($tips[$tag][1]) . '
', 'class' => array('type')),
array('data' => $tips[$tag][1], 'class' => array('get'))
);
}
@@ -173,7 +174,7 @@ public function tips($long = FALSE) {
foreach ($entities as $entity) {
$rows[] = array(
array('data' => $entity[0], 'class' => array('description')),
- array('data' => '' . check_plain($entity[1]) . '
', 'class' => array('type')),
+ array('data' => '' . String::checkPlain($entity[1]) . '
', 'class' => array('type')),
array('data' => $entity[1], 'class' => array('get'))
);
}
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index 9e6d74b..4437c8a 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -7,6 +7,7 @@
namespace Drupal\filter\Tests;
+use Drupal\Component\Utility\String;
use Drupal\simpletest\WebTestBase;
/**
@@ -304,7 +305,7 @@ function testFilterAdmin() {
$edit['body[0][format]'] = $plain;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->drupalGet('node/' . $node->id());
- $this->assertText(check_plain($text), 'The "Plain text" text format escapes all HTML tags.');
+ $this->assertText(String::checkPlain($text), 'The "Plain text" text format escapes all HTML tags.');
\Drupal::config('filter.settings')
->set('always_show_fallback_choice', FALSE)
->save();
diff --git a/core/modules/filter/src/Tests/FilterUnitTest.php b/core/modules/filter/src/Tests/FilterUnitTest.php
index b15f0a0..832257d 100644
--- a/core/modules/filter/src/Tests/FilterUnitTest.php
+++ b/core/modules/filter/src/Tests/FilterUnitTest.php
@@ -8,6 +8,7 @@
namespace Drupal\filter\Tests;
use Drupal\Component\Utility\Html;
+use Drupal\Component\Utility\String;
use Drupal\simpletest\DrupalUnitTestBase;
use Drupal\filter\FilterBag;
@@ -360,7 +361,7 @@ function testNoFollowFilter() {
/**
* Tests the HTML escaping filter.
*
- * check_plain() is not tested here.
+ * \Drupal\Component\Utility\String::checkPlain() is not tested here.
*/
function testHtmlEscapeFilter() {
// Get FilterHtmlEscape object.
@@ -726,10 +727,10 @@ function assertFilteredString($filter, $tests) {
)));
}
if (!$success) {
- $this->verbose('Source:' . check_plain(var_export($source, TRUE)) . '' - . '
' . check_plain(var_export($result, TRUE)) . '' + $this->verbose('Source:
' . String::checkPlain(var_export($source, TRUE)) . '' + . '
' . String::checkPlain(var_export($result, TRUE)) . '' . '
' . check_plain(var_export($value, TRUE)) . '' + . '
' . String::checkPlain(var_export($value, TRUE)) . '' ); } } diff --git a/core/modules/node/node.tokens.inc b/core/modules/node/node.tokens.inc index 7362ebb..4e0f300 100644 --- a/core/modules/node/node.tokens.inc +++ b/core/modules/node/node.tokens.inc @@ -5,6 +5,7 @@ * Builds placeholder replacement tokens for node-related data. */ +use Drupal\Component\Utility\String; use Drupal\Core\Language\LanguageInterface; /** @@ -112,16 +113,16 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr break; case 'type': - $replacements[$original] = $sanitize ? check_plain($node->getType()) : $node->getType(); + $replacements[$original] = $sanitize ? String::checkPlain($node->getType()) : $node->getType(); break; case 'type-name': $type_name = node_get_type_label($node); - $replacements[$original] = $sanitize ? check_plain($type_name) : $type_name; + $replacements[$original] = $sanitize ? String::checkPlain($type_name) : $type_name; break; case 'title': - $replacements[$original] = $sanitize ? check_plain($node->getTitle()) : $node->getTitle(); + $replacements[$original] = $sanitize ? String::checkPlain($node->getTitle()) : $node->getTitle(); break; case 'body': @@ -160,7 +161,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr break; case 'langcode': - $replacements[$original] = $sanitize ? check_plain($node->language()->id) : $node->language()->id; + $replacements[$original] = $sanitize ? String::checkPlain($node->language()->id) : $node->language()->id; break; case 'url': @@ -174,7 +175,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr // Default values for the chained tokens handled below. case 'author': $account = $node->getOwner() ? $node->getOwner() : user_load(0); - $replacements[$original] = $sanitize ? check_plain($account->label()) : $account->label(); + $replacements[$original] = $sanitize ? String::checkPlain($account->label()) : $account->label(); break; case 'created': diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index ecb01d6..78cdedf 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\Search; +use Drupal\Component\Utility\String; use Drupal\Core\Config\Config; use Drupal\Core\Database\Connection; use Drupal\Core\Database\Query\SelectExtender; @@ -279,7 +280,7 @@ public function execute() { ); $results[] = array( 'link' => $node->url('canonical', array('absolute' => TRUE, 'language' => $language)), - 'type' => check_plain($this->entityManager->getStorage('node_type')->load($node->bundle())->label()), + 'type' => String::checkPlain($this->entityManager->getStorage('node_type')->load($node->bundle())->label()), 'title' => $node->label(), 'user' => drupal_render($username), 'date' => $node->getChangedTime(), @@ -358,7 +359,7 @@ protected function indexNode(NodeInterface $node) { unset($build['#theme']); $node->rendered = drupal_render($build); - $text = '
'; - $build['#markup'] = check_plain($build['#markup']); + $build['#markup'] = String::checkPlain($build['#markup']); $build['#suffix'] = ''; } diff --git a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php index 2a72be5..e2ff66e 100644 --- a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php @@ -7,6 +7,7 @@ namespace Drupal\rest\Tests\Views; +use Drupal\Component\Utility\String; use Drupal\views\Views; use Drupal\views\Tests\Plugin\PluginTestBase; use Drupal\views\Tests\ViewTestData; @@ -280,7 +281,7 @@ public function testPreview() { $entities[] = $row->_entity; } - $expected = check_plain($serializer->serialize($entities, 'json')); + $expected = String::checkPlain($serializer->serialize($entities, 'json')); $view->display_handler->setContentType('json'); $view->live_preview = TRUE; diff --git a/core/modules/search/search.module b/core/modules/search/search.module index 3d5631b..a6e48d8 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -5,6 +5,7 @@ * Enables site-wide keyword searching. */ +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Unicode; use Symfony\Component\HttpFoundation\Request; @@ -675,7 +676,7 @@ function search_excerpt($keys, $text, $langcode = NULL) { // We didn't find any keyword matches, so just return the first part of the // text. We also need to re-encode any HTML special characters that we // entity-decoded above. - return check_plain(truncate_utf8($text, 256, TRUE, TRUE)); + return String::checkPlain(truncate_utf8($text, 256, TRUE, TRUE)); } // Sort the text ranges by starting position. @@ -716,7 +717,7 @@ function search_excerpt($keys, $text, $langcode = NULL) { // translated. Let translators have the … separator text as one chunk. $ellipses = explode('!excerpt', t('… !excerpt … !excerpt …')); $text = (isset($new_ranges[0]) ? '' : $ellipses[0]) . implode($ellipses[1], $out) . (($max_end < strlen($text) - 1) ? $ellipses[2] : ''); - $text = check_plain($text); + $text = String::checkPlain($text); // Highlight keywords. Must be done at once to prevent conflicts ('strong' // and ''). diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc index 10c498f..6590b90 100644 --- a/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -5,6 +5,7 @@ * User page callbacks for the Search module. */ +use Drupal\Component\Utility\String; use Drupal\Core\Language\LanguageInterface; /** @@ -35,7 +36,7 @@ function template_preprocess_search_result(&$variables) { $result = $variables['result']; $variables['url'] = check_url($result['link']); - $variables['title'] = check_plain($result['title']); + $variables['title'] = String::checkPlain($result['title']); if (isset($result['language']) && $result['language'] != $language_interface->id && $result['language'] != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $variables['title_attributes']['lang'] = $result['language']; $variables['content_attributes']['lang'] = $result['language']; @@ -43,7 +44,7 @@ function template_preprocess_search_result(&$variables) { $info = array(); if (!empty($result['plugin_id'])) { - $info['plugin_id'] = check_plain($result['plugin_id']); + $info['plugin_id'] = String::checkPlain($result['plugin_id']); } if (!empty($result['user'])) { $info['user'] = $result['user']; diff --git a/core/modules/search/src/Tests/SearchCommentTest.php b/core/modules/search/src/Tests/SearchCommentTest.php index 896bf7b..c825d2a 100644 --- a/core/modules/search/src/Tests/SearchCommentTest.php +++ b/core/modules/search/src/Tests/SearchCommentTest.php @@ -8,6 +8,7 @@ namespace Drupal\search\Tests; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; +use Drupal\Component\Utility\String; use Drupal\field\Entity\FieldInstanceConfig; /** @@ -124,7 +125,7 @@ function testSearchResultsComment() { // Verify that comment is rendered using proper format. $this->assertText($comment_body, 'Comment body text found in search results.'); $this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.'); - $this->assertNoRaw(check_plain($edit_comment['comment_body[0][value]']), 'HTML in comment body is not escaped.'); + $this->assertNoRaw(String::checkPlain($edit_comment['comment_body[0][value]']), 'HTML in comment body is not escaped.'); // Hide comments. $this->drupalLogin($this->admin_user); diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index 2444eec..52783d4 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -4,6 +4,7 @@ * @file * Administrative page callbacks for the shortcut module. */ +use Drupal\Component\Utility\String; use Drupal\shortcut\Entity\ShortcutSet; /** @@ -40,7 +41,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) { $options = array(); foreach ($sets as $name => $set) { - $options[$name] = check_plain($set->label()); + $options[$name] = String::checkPlain($set->label()); } // Only administrators can add shortcut sets. diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install index 3cb1217..3b2226e 100644 --- a/core/modules/simpletest/simpletest.install +++ b/core/modules/simpletest/simpletest.install @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Environment; +use Drupal\Component\Utility\String; /** * Minimum value of PHP memory_limit for SimpleTest. @@ -67,7 +68,7 @@ function simpletest_requirements($phase) { 'value' => is_dir(DRUPAL_ROOT . '/' . $site_directory) ? t('Not writable') : t('Missing'), 'severity' => REQUIREMENT_ERROR, 'description' => t('The testing framework requires the !sites-simpletest directory to exist and be writable in order to run tests.', array( - '!sites-simpletest' => '
./' . check_plain($site_directory) . '
',
+ '!sites-simpletest' => './' . String::checkPlain($site_directory) . '
',
)),
);
}
@@ -77,7 +78,7 @@ function simpletest_requirements($phase) {
'value' => t('Not protected'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The file !file does not exist and could not be created automatically, which poses a security risk. Ensure that the directory is writable.', array(
- '!file' => './' . check_plain($site_directory) . '/.htaccess
',
+ '!file' => './' . String::checkPlain($site_directory) . '/.htaccess
',
)),
);
}
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index 3bd1d86..5be5eb7 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -1518,7 +1518,7 @@ protected function drupalGet($path, array $options = array(), array $headers = a
$verbose = 'GET request to: ' . $path .
'' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . ''; + $verbose .= '
' . String::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . ''; } $verbose .= '
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . ''; + $verbose .= '
' . String::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . ''; } $verbose .= '
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . ''); + '
' . String::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . ''); } return $out; @@ -3129,9 +3129,9 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') { */ protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') { $output = _theme($callback, $variables); - $this->verbose('Variables:' . '
' . check_plain(var_export($variables, TRUE)) . '' - . '
' . check_plain(var_export($output, TRUE)) . '' - . '
' . check_plain(var_export($expected, TRUE)) . '' + $this->verbose('Variables:' . '
' . String::checkPlain(var_export($variables, TRUE)) . '' + . '
' . String::checkPlain(var_export($output, TRUE)) . '' + . '
' . String::checkPlain(var_export($expected, TRUE)) . '' . '
' . check_plain(var_export($original_element, TRUE)) . '' - . '
' . check_plain(var_export($element, TRUE)) . '' + $this->verbose('
' . String::checkPlain(var_export($original_element, TRUE)) . '' + . '
' . String::checkPlain(var_export($element, TRUE)) . '' . '
!ts', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->verbose(strtr('$ts:
!ts', array('!ts' => String::checkPlain(var_export($ts, TRUE))))); $this->assertEqual($ts, $expected_ts, 'Simple table headers sorted correctly.'); // Test with simple table headers plus $_GET parameters that should _not_ @@ -56,7 +57,7 @@ function testTableSortInit() { )); \Drupal::getContainer()->set('request', $request); $ts = tablesort_init($headers); - $this->verbose(strtr('$ts:
!ts', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->verbose(strtr('$ts:
!ts', array('!ts' => String::checkPlain(var_export($ts, TRUE))))); $this->assertEqual($ts, $expected_ts, 'Simple table headers plus non-overriding $_GET parameters sorted correctly.'); // Test with simple table headers plus $_GET parameters that _should_ @@ -72,7 +73,7 @@ function testTableSortInit() { $expected_ts['sort'] = 'desc'; $expected_ts['query'] = array('alpha' => 'beta'); $ts = tablesort_init($headers); - $this->verbose(strtr('$ts:
!ts', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->verbose(strtr('$ts:
!ts', array('!ts' => String::checkPlain(var_export($ts, TRUE))))); $this->assertEqual($ts, $expected_ts, 'Simple table headers plus $_GET parameters sorted correctly.'); // Test complex table headers. @@ -104,7 +105,7 @@ function testTableSortInit() { 'sort' => 'desc', 'query' => array(), ); - $this->verbose(strtr('$ts:
!ts', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->verbose(strtr('$ts:
!ts', array('!ts' => String::checkPlain(var_export($ts, TRUE))))); $this->assertEqual($ts, $expected_ts, 'Complex table headers sorted correctly.'); // Test complex table headers plus $_GET parameters that should _not_ @@ -123,7 +124,7 @@ function testTableSortInit() { 'sort' => 'asc', 'query' => array(), ); - $this->verbose(strtr('$ts:
!ts', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->verbose(strtr('$ts:
!ts', array('!ts' => String::checkPlain(var_export($ts, TRUE))))); $this->assertEqual($ts, $expected_ts, 'Complex table headers plus non-overriding $_GET parameters sorted correctly.'); // Test complex table headers plus $_GET parameters that _should_ @@ -144,7 +145,7 @@ function testTableSortInit() { 'query' => array('alpha' => 'beta'), ); $ts = tablesort_init($headers); - $this->verbose(strtr('$ts:
!ts', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->verbose(strtr('$ts:
!ts', array('!ts' => String::checkPlain(var_export($ts, TRUE))))); $this->assertEqual($ts, $expected_ts, 'Complex table headers plus $_GET parameters sorted correctly.'); } } diff --git a/core/modules/system/src/Tests/Form/FormTest.php b/core/modules/system/src/Tests/Form/FormTest.php index e45defc..098751a 100644 --- a/core/modules/system/src/Tests/Form/FormTest.php +++ b/core/modules/system/src/Tests/Form/FormTest.php @@ -610,7 +610,7 @@ function testDisabledMarkup() { $path = strtr($path, array('!type' => $type)); // Verify that the element exists. $element = $this->xpath($path, array( - ':name' => check_plain($name), + ':name' => String::checkPlain($name), ':div-class' => $class, ':value' => isset($item['#value']) ? $item['#value'] : '', )); diff --git a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php index e55e0563..0f17ede 100644 --- a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php +++ b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Mail; +use Drupal\Component\Utility\String; use Drupal\Core\Site\Settings; use Drupal\simpletest\WebTestBase; @@ -37,7 +38,7 @@ protected function stringToHtml($text) { str_replace( array("\n", ' '), array('\n', ' '), - check_plain($text) + String::checkPlain($text) ) . '"'; } @@ -59,7 +60,7 @@ protected function assertHtmlToText($html, $text, $message, $allowed_tags = NULL $tested_tags = implode(', ', array_unique($matches[1])); $message .= ' (' . $tested_tags . ')'; $result = drupal_html_to_text($html, $allowed_tags); - $pass = $this->assertEqual($result, $text, check_plain($message)); + $pass = $this->assertEqual($result, $text, String::checkPlain($message)); $verbose = 'html =
' . $this->stringToHtml($html) . '
' . $this->stringToHtml($result) . '
' . $this->stringToHtml($text) diff --git a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php index 849aadc..b3378e2 100644 --- a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Menu; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Unicode; /** @@ -272,7 +273,7 @@ function testBreadCrumbs() { $link['link_path'] => $link['link_title'], ); $this->assertBreadcrumb($link['link_path'], $trail, $term->getName(), $tree); - $this->assertRaw(check_plain($parent->getTitle()), 'Tagged node found.'); + $this->assertRaw(String::checkPlain($parent->getTitle()), 'Tagged node found.'); // Additionally make sure that this link appears only once; i.e., the // untranslated menu links automatically generated from menu router items diff --git a/core/modules/system/src/Tests/Menu/MenuTestBase.php b/core/modules/system/src/Tests/Menu/MenuTestBase.php index d205b13..fc896d8 100644 --- a/core/modules/system/src/Tests/Menu/MenuTestBase.php +++ b/core/modules/system/src/Tests/Menu/MenuTestBase.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Menu; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; abstract class MenuTestBase extends WebTestBase { @@ -65,7 +66,7 @@ protected function assertBreadcrumbParts($trail) { foreach ($trail as $path => $title) { $url = url($path); $part = array_shift($parts); - $pass = ($pass && $part['href'] === $url && $part['text'] === check_plain($title)); + $pass = ($pass && $part['href'] === $url && $part['text'] === String::checkPlain($title)); } } // No parts must be left, or an expected "Home" will always pass. diff --git a/core/modules/system/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php index 87c4edb..977b60d 100644 --- a/core/modules/system/src/Tests/System/PageTitleTest.php +++ b/core/modules/system/src/Tests/System/PageTitleTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\System; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; use Drupal\Core\Utility\Title; use Drupal\simpletest\WebTestBase; @@ -65,7 +66,7 @@ function testTitleTags() { $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $this->assertNotNull($node, 'Node created and found in database'); $this->drupalGet("node/" . $node->id()); - $this->assertText(check_plain($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.'); + $this->assertText(String::checkPlain($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.'); } /** @@ -74,7 +75,7 @@ function testTitleTags() { function testTitleXSS() { // Set some title with JavaScript and HTML chars to escape. $title = ' & < > " \' '; - $title_filtered = check_plain($title); + $title_filtered = String::checkPlain($title); $slogan = ''; $slogan_filtered = Xss::filterAdmin($slogan); diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index 7aa294c..c1b0433 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Theme; +use Drupal\Component\Utility\String; use Drupal\Core\Session\UserSession; use Drupal\simpletest\WebTestBase; use Symfony\Cmf\Component\Routing\RouteObjectInterface; @@ -198,10 +199,10 @@ function testLinks() { $expected_links = ''; $expected_links .= '
' . Xss::filterAdmin($this->token->replace($this->getBody())) . '
'; return array('#markup' => $output); } diff --git a/core/modules/tour/tests/tour_test/src/Plugin/tour/tip/TipPluginImage.php b/core/modules/tour/tests/tour_test/src/Plugin/tour/tip/TipPluginImage.php index 79ed03c..89f051a 100644 --- a/core/modules/tour/tests/tour_test/src/Plugin/tour/tip/TipPluginImage.php +++ b/core/modules/tour/tests/tour_test/src/Plugin/tour/tip/TipPluginImage.php @@ -7,6 +7,7 @@ namespace Drupal\tour_test\Plugin\tour\tip; +use Drupal\Component\Utility\String; use Drupal\tour\TipPluginBase; /** @@ -44,7 +45,7 @@ public function getOutput() { '#uri' => $this->get('url'), '#alt' => $this->get('alt'), ); - $output = '' . drupal_render($image) . '
'; return array('#markup' => $output); } diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index 30c7915..aa05f2b 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -5,6 +5,8 @@ * User page callbacks for tracker.module. */ +use Drupal\Component\Utility\String; + /** * Page callback: Generates a page of tracked nodes for the site. @@ -86,7 +88,7 @@ function tracker_page($account = NULL) { ); $row = array( - 'type' => check_plain(node_get_type_label($node)), + 'type' => String::checkPlain(node_get_type_label($node)), 'title' => array('data' => l($node->getTitle(), 'node/' . $node->id()) . ' ' . drupal_render($mark_build)), 'author' => array('data' => array('#theme' => 'username', '#account' => $node->getOwner())), 'replies' => array('class' => array('replies'), 'data' => $comments), diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index 83203ae..38611bf 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -36,6 +36,7 @@ * root. */ +use Drupal\Component\Utility\String; use Drupal\Core\Updater\Updater; use Drupal\Core\FileTransfer\Local; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -108,14 +109,14 @@ function update_manager_update_form($form, $form_state = array(), $context) { $project_name = l($project['title'], $project['link']); } else { - $project_name = check_plain($project['title']); + $project_name = String::checkPlain($project['title']); } } elseif (!empty($project['info']['name'])) { - $project_name = check_plain($project['info']['name']); + $project_name = String::checkPlain($project['info']['name']); } else { - $project_name = check_plain($name); + $project_name = String::checkPlain($name); } if ($project['project_type'] == 'theme' || $project['project_type'] == 'theme-disabled') { $project_name .= ' ' . t('(Theme)'); diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 6a06cbe..b4410e0 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -5,6 +5,8 @@ * Code required only when rendering the available updates report. */ +use Drupal\Component\Utility\String; + /** * Returns HTML for the project status report. * @@ -83,7 +85,7 @@ function theme_update_report($variables) { $row = '