diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 6d7d9a5..c5ca01e 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -10,10 +10,11 @@ * book page, user etc. */ -use Drupal\Core\Entity\EntityInterface; +use Drupal\Component\Utility\String; +use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityChangedInterface; +use Drupal\Core\Entity\EntityInterface; use Drupal\comment\CommentInterface; -use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInterface; use Drupal\file\FileInterface; @@ -1300,7 +1301,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 ecff337..bf5a3e2 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -5,6 +5,8 @@ * Builds placeholder replacement tokens for comment-related data. */ +use Drupal\Component\Utility\String; + /** * Implements hook_token_info(). */ @@ -139,7 +141,7 @@ 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 'name': @@ -149,7 +151,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = 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/lib/Drupal/comment/Plugin/views/argument/UserUid.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php index 7f58b18..4534076 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php +++ b/core/modules/comment/lib/Drupal/comment/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/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index 081775f..3134406 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -7,6 +7,7 @@ namespace Drupal\comment\Tests; +use Drupal\Component\Utility\String; use Drupal\Core\Language\Language; /** @@ -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]'] = filter_xss($comment->getAuthorName()); $tests['[comment:author]'] = filter_xss($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]'] = filter_xss($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/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php index f2eb699..4b320cc 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php @@ -8,6 +8,7 @@ namespace Drupal\entity_reference; use Drupal\Component\Utility\String; +use Drupal\Component\Utility\String as StringUtil; use Drupal\Core\Field\ConfigFieldItemInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem; @@ -184,7 +185,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] = StringUtil::checkPlain($plugin['label']); } } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php index 6df0d11..41a8995 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php @@ -7,6 +7,7 @@ namespace Drupal\entity_reference\Plugin\Field\FieldFormatter; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldItemListInterface; /** @@ -35,7 +36,7 @@ public function viewElements(FieldItemListInterface $items) { continue; } if (!empty($item->entity) && !empty($item->target_id)) { - $elements[$delta] = array('#markup' => check_plain($item->target_id)); + $elements[$delta] = array('#markup' => String::checkPlain($item->target_id)); } } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php index ea13e17..7b0b0ef 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/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; /** @@ -74,7 +75,7 @@ public function viewElements(FieldItemListInterface $items) { ); } else { - $elements[$delta] = array('#markup' => check_plain($label)); + $elements[$delta] = array('#markup' => String::checkPlain($label)); } } } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php index f7b74e4..97b5973 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php @@ -7,11 +7,12 @@ namespace Drupal\entity_reference\Plugin\entity_reference\selection; +use Drupal\Component\Utility\NestedArray; +use Drupal\Component\Utility\String; use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Database\Query\SelectInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Component\Utility\NestedArray; use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface; /** @@ -174,7 +175,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/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php index 987919d..5b78296 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php @@ -7,10 +7,10 @@ namespace Drupal\entity_reference\Tests; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Tags; use Drupal\entity_reference\EntityReferenceController; use Drupal\system\Tests\Entity\EntityUnitTestBase; - use Symfony\Component\HttpFoundation\Request; /** @@ -80,8 +80,8 @@ function testEntityReferenceAutocompletion() { // We should get both entities in a JSON encoded string. $input = '10/'; $data = $this->getAutocompleteResult('single', $input); - $this->assertIdentical($data[0]['label'], check_plain($entity_1->name->value), 'Autocomplete returned the first matching entity'); - $this->assertIdentical($data[1]['label'], check_plain($entity_2->name->value), 'Autocomplete returned the second matching entity'); + $this->assertIdentical($data[0]['label'], String::checkPlain($entity_1->name->value), 'Autocomplete returned the first matching entity'); + $this->assertIdentical($data[1]['label'], String::checkPlain($entity_2->name->value), 'Autocomplete returned the second matching entity'); // Try to autocomplete a entity label that matches the first entity. // We should only get the first entity in a JSON encoded string. @@ -89,7 +89,7 @@ function testEntityReferenceAutocompletion() { $data = $this->getAutocompleteResult('single', $input); $target = array( 'value' => $entity_1->name->value . ' (1)', - 'label' => check_plain($entity_1->name->value), + 'label' => String::checkPlain($entity_1->name->value), ); $this->assertIdentical(reset($data), $target, 'Autocomplete returns only the expected matching entity.'); @@ -97,7 +97,7 @@ function testEntityReferenceAutocompletion() { // the first entity is already typed in the autocomplete (tags) widget. $input = $entity_1->name->value . ' (1), 10/17'; $data = $this->getAutocompleteResult('tags', $input); - $this->assertIdentical($data[0]['label'], check_plain($entity_2->name->value), 'Autocomplete returned the second matching entity'); + $this->assertIdentical($data[0]['label'], String::checkPlain($entity_2->name->value), 'Autocomplete returned the second matching entity'); // Try to autocomplete a entity label with both a comma and a slash. $input = '"label with, and / t'; @@ -107,7 +107,7 @@ function testEntityReferenceAutocompletion() { $n = Tags::encode($n); $target = array( 'value' => $n, - 'label' => check_plain($entity_3->name->value), + 'label' => String::checkPlain($entity_3->name->value), ); $this->assertIdentical(reset($data), $target, 'Autocomplete returns an entity label containing a comma and a slash.'); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php index 0178a25..daf7915 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/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\Language; use Drupal\comment\CommentInterface; @@ -115,7 +116,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. @@ -262,7 +263,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. @@ -442,7 +443,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/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php index 43fd7ee..d30777b 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/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/field.api.php b/core/modules/field/field.api.php index 58f374a..bd08b35 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\NestedArray; +use Drupal\Component\Utility\String; use Drupal\field\FieldUpdateForbiddenException; /** @@ -50,7 +51,7 @@ function hook_field_extra_fields() { foreach (node_type_get_types() as $bundle) { if ($bundle->has_title) { $extra['node'][$bundle->type]['form']['title'] = array( - 'label' => check_plain($bundle->title_label), + 'label' => String::checkPlain($bundle->title_label), 'description' => $description, 'weight' => -5, ); diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 0c775c8..17cf875 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -5,6 +5,7 @@ */ use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Template\Attribute; @@ -506,7 +507,7 @@ function template_preprocess_field(&$variables, $hook) { // label, it needs to supply a preprocess function that sets it to the // sanitized element title or whatever else is wanted in its place. $variables['label_hidden'] = ($element['#label_display'] == 'hidden'); - $variables['label'] = check_plain($element['#title']); + $variables['label'] = String::checkPlain($element['#title']); // We want other preprocess functions and the theme implementation to have // fast access to the field item render arrays. The item render array keys diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php b/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php index d29319d..4b780f6 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php @@ -7,9 +7,10 @@ namespace Drupal\field\Plugin\views\argument; -use Drupal\views\ViewExecutable; -use Drupal\views\Plugin\views\display\DisplayPluginBase; +use Drupal\Component\Utility\String; use Drupal\views\Plugin\views\argument\Numeric; +use Drupal\views\Plugin\views\display\DisplayPluginBase; +use Drupal\views\ViewExecutable; /** * Argument handler for list field to show the human readable name in the @@ -68,7 +69,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/lib/Drupal/field/Plugin/views/argument/ListString.php b/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php index cc43140..ebc6183 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php @@ -7,9 +7,10 @@ namespace Drupal\field\Plugin\views\argument; -use Drupal\views\ViewExecutable; -use Drupal\views\Plugin\views\display\DisplayPluginBase; +use Drupal\Component\Utility\String as StringUtil; use Drupal\views\Plugin\views\argument\String; +use Drupal\views\Plugin\views\display\DisplayPluginBase; +use Drupal\views\ViewExecutable; /** * Argument handler for list field to show the human readable name in the @@ -70,7 +71,7 @@ public function summaryName($data) { } // else fallback to the key. else { - return $this->caseTransform(check_plain($value), $this->options['case']); + return $this->caseTransform(StringUtil::checkPlain($value), $this->options['case']); } } diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php index 5de1d0a..1a5afcd 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php @@ -7,6 +7,7 @@ namespace Drupal\field\Tests; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; class FormTest extends FieldTestBase { @@ -104,7 +105,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/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php index 2ed54e8..2b6ed40 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -8,6 +8,7 @@ namespace Drupal\field_ui; use Drupal\Component\Plugin\PluginManagerBase; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Field\FieldDefinitionInterface; @@ -268,7 +269,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/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php index 2b03c6f..8aa4e91 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php @@ -7,12 +7,13 @@ namespace Drupal\field_ui; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldTypePluginManagerInterface; +use Drupal\field\Entity\FieldConfig; use Drupal\field_ui\OverviewBase; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\field\Entity\FieldConfig; /** * Field UI field overview form. @@ -131,7 +132,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 8a64332..0ea3c8e 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\field\FieldInterface; /** @@ -197,7 +198,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 6a1e86a..9faed30 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -5,11 +5,12 @@ * Defines a "managed_file" Form API field and a "file" field for Field module. */ -use Drupal\file\Entity\File; use Drupal\Component\Utility\NestedArray; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Unicode; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Template\Attribute; +use Drupal\file\Entity\File; use Drupal\file\FileUsage\FileUsageInterface; // Load all Field module hooks for File. @@ -1018,15 +1019,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': @@ -1034,7 +1035,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. @@ -1048,7 +1049,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; } } @@ -1596,7 +1597,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( @@ -1624,7 +1625,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/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php index 5c976ed..51178d4 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php +++ b/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php @@ -7,10 +7,11 @@ namespace Drupal\file\Plugin\Field\FieldWidget; +use Drupal\Component\Utility\NestedArray; +use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Field\WidgetBase; use Drupal\Core\Field\FieldItemListInterface; -use Drupal\Component\Utility\NestedArray; +use Drupal\Core\Field\WidgetBase; use Drupal\field\Field; /** @@ -88,7 +89,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/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php index 03aedcb..b8c7784 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php @@ -7,6 +7,7 @@ namespace Drupal\file\Tests; +use Drupal\Component\Utility\String; use Drupal\Core\Language\Language; /** @@ -48,16 +49,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 e9c04d4..ab24ce1 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\String as StringUtil; use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; use Drupal\Core\Language\Language; @@ -939,8 +940,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 = StringUtil::checkPlain(_filter_url_trim($match[$i])); + $match[$i] = StringUtil::checkPlain($match[$i]); return '' . $caption . ''; } @@ -954,8 +955,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 = StringUtil::checkPlain(_filter_url_trim($match[$i])); + $match[$i] = StringUtil::checkPlain($match[$i]); return '' . $caption . ''; } @@ -969,8 +970,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 = StringUtil::checkPlain(_filter_url_trim($match[$i])); + $match[$i] = StringUtil::checkPlain($match[$i]); return '' . $caption . ''; } @@ -1102,7 +1103,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(StringUtil::checkPlain($text)); } /** diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php index a49f5f4..f0a7ec8 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Plugin\Filter; +use Drupal\Component\Utility\String; use Drupal\filter\Plugin\FilterBase; /** @@ -99,7 +100,7 @@ public function tips($long = FALSE) { $output .= '

' . 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 .= '

' . 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(t('Anchors are used to make links to other pages.'), '' . check_plain(\Drupal::config('system.site')->get('name')) . ''), + 'a' => array(t('Anchors are used to make links to other pages.'), '' . String::checkPlain(\Drupal::config('system.site')->get('name')) . ''), 'br' => array(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'), t('Text with
line break')), 'p' => array(t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '

' . t('Paragraph one.') . '

' . t('Paragraph two.') . '

'), 'strong' => array(t('Strong', array(), array('context' => 'Font weight')), '' . t('Strong', array(), array('context' => 'Font weight')) . ''), @@ -141,7 +142,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')) ); } @@ -172,7 +173,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/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php index e10c5ca..8d13d86 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Tests; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; /** @@ -254,7 +255,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/lib/Drupal/filter/Tests/FilterUnitTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php index a51d6b9..ee92929 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php @@ -8,8 +8,9 @@ namespace Drupal\filter\Tests; use Drupal\Component\Utility\Html; -use Drupal\simpletest\DrupalUnitTestBase; +use Drupal\Component\Utility\String; use Drupal\filter\FilterBag; +use Drupal\simpletest\DrupalUnitTestBase; /** * Unit tests for core filters. @@ -692,10 +693,10 @@ function assertFilteredString($filter, $tests) { ))); } if (!$success) { - $this->verbose('Source:
' . check_plain(var_export($source, TRUE)) . '
' - . '
' . 'Result:
' . check_plain(var_export($result, TRUE)) . '
' + $this->verbose('Source:
' . String::checkPlain(var_export($source, TRUE)) . '
' + . '
' . 'Result:
' . String::checkPlain(var_export($result, TRUE)) . '
' . '
' . ($is_expected ? 'Expected:' : 'Not expected:') - . '
' . check_plain(var_export($value, TRUE)) . '
' + . '
' . String::checkPlain(var_export($value, TRUE)) . '
' ); } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php index 1e9e7ff..aa99f62 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -7,16 +7,17 @@ namespace Drupal\node\Plugin\Search; +use Drupal\Component\Utility\String; +use Drupal\Core\Access\AccessibleInterface; use Drupal\Core\Config\Config; use Drupal\Core\Database\Connection; +use Drupal\Core\Database\Query\Condition; use Drupal\Core\Database\Query\SelectExtender; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\KeyValueStore\StateInterface; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Access\AccessibleInterface; -use Drupal\Core\Database\Query\Condition; use Drupal\node\NodeInterface; use Drupal\search\Plugin\ConfigurableSearchPluginBase; use Drupal\search\Plugin\SearchIndexingInterface; @@ -254,7 +255,7 @@ public function execute() { ); $results[] = array( 'link' => $node->url('canonical', array('absolute' => TRUE, 'language' => $language)), - 'type' => check_plain($this->entityManager->getStorageController('node_type')->load($node->bundle())->label()), + 'type' => String::checkPlain($this->entityManager->getStorageController('node_type')->load($node->bundle())->label()), 'title' => $node->label(), 'user' => drupal_render($username), 'date' => $node->getChangedTime(), @@ -339,7 +340,7 @@ protected function indexNode(NodeInterface $node) { unset($build['#theme']); $node->rendered = drupal_render($build); - $text = '

' . check_plain($node->label($language->id)) . '

' . $node->rendered; + $text = '

' . String::checkPlain($node->label($language->id)) . '

' . $node->rendered; // Fetch extra data normally not visible. $extra = $this->moduleHandler->invokeAll('node_update_index', array($node, $language->id)); diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php index e7f0e1d..07649d6 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\views\argument; +use Drupal\Component\Utility\String; use Drupal\views\Plugin\views\argument\Numeric; /** @@ -24,7 +25,7 @@ public function titleQuery() { $nodes = node_load_multiple($this->value); foreach ($nodes as $node) { - $titles[] = check_plain($node->label()); + $titles[] = String::checkPlain($node->label()); } return $titles; } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php index cc88b9f..f709122 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\views\argument; +use Drupal\Component\Utility\String as StringUtil; use Drupal\views\Plugin\views\argument\String; /** @@ -35,7 +36,7 @@ function title() { function node_type($type_name) { $type = entity_load('node_type', $type_name); $output = $type ? $type->label() : t('Unknown content type'); - return check_plain($output); + return StringUtil::checkPlain($output); } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php index 4f117f6..a5c9e72 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\views\argument; +use Drupal\Component\Utility\String; use Drupal\Core\Database\Connection; use Drupal\views\Plugin\views\argument\Numeric; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -66,7 +67,7 @@ public function titleQuery() { foreach ($results as $result) { $nodes[$result['nid']]->set('title', $result['title']); - $titles[] = check_plain($nodes[$result['nid']]->label()); + $titles[] = String::checkPlain($nodes[$result['nid']]->label()); } return $titles; diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php index fdb3415..07ece93 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\views\argument_validator; +use Drupal\Component\Utility\String; use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase; /** @@ -33,7 +34,7 @@ public function buildOptionsForm(&$form, &$form_state) { $types = node_type_get_types(); $options = array(); foreach ($types as $type => $info) { - $options[$type] = check_plain(t($info->name)); + $options[$type] = String::checkPlain(t($info->name)); } $form['types'] = array( @@ -97,7 +98,7 @@ public function validateArgument($argument) { } // Save the title() handlers some work. - $this->argument->validated_title = check_plain($node->label()); + $this->argument->validated_title = String::checkPlain($node->label()); if (empty($types)) { return TRUE; @@ -128,7 +129,7 @@ public function validateArgument($argument) { } } - $titles[] = check_plain($node->label()); + $titles[] = String::checkPlain($node->label()); unset($test[$node->id()]); } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php b/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php index ce50508..a21055d 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\views\row; +use Drupal\Component\Utility\String; use Drupal\views\Plugin\views\row\RowPluginBase; /** @@ -74,7 +75,7 @@ public function buildOptionsForm_summary_options() { public function summaryTitle() { $options = $this->buildOptionsForm_summary_options(); - return check_plain($options[$this->options['item_length']]); + return String::checkPlain($options[$this->options['item_length']]); } public function preRender($values) { diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php index 717abcc..c521912 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php @@ -7,8 +7,9 @@ namespace Drupal\node\Tests; -use Drupal\system\Tests\System\TokenReplaceUnitTestBase; +use Drupal\Component\Utility\String as StringUtil; use Drupal\Component\Utility\String; +use Drupal\system\Tests\System\TokenReplaceUnitTestBase; /** * Test node token replacement in strings. @@ -73,10 +74,10 @@ function testNodeTokenReplacement() { $tests['[node:vid]'] = $node->getRevisionId(); $tests['[node:type]'] = 'article'; $tests['[node:type-name]'] = 'Article'; - $tests['[node:title]'] = check_plain($node->getTitle()); + $tests['[node:title]'] = StringUtil::checkPlain($node->getTitle()); $tests['[node:body]'] = $node->body->processed; $tests['[node:summary]'] = $node->body->summary_processed; - $tests['[node:langcode]'] = check_plain($node->language()->id); + $tests['[node:langcode]'] = StringUtil::checkPlain($node->language()->id); $tests['[node:url]'] = url('node/' . $node->id(), $url_options); $tests['[node:edit-url]'] = url('node/' . $node->id() . '/edit', $url_options); $tests['[node:author]'] = String::checkPlain($account->getUsername()); diff --git a/core/modules/node/node.tokens.inc b/core/modules/node/node.tokens.inc index dbf668c..cb0e271 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\Language; /** @@ -116,16 +117,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': @@ -165,7 +166,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': @@ -179,7 +180,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/picture/lib/Drupal/picture/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php index 9c11628..263c604 100644 --- a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php @@ -7,6 +7,7 @@ namespace Drupal\picture\Entity; +use Drupal\Component\Utility\String; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\picture\PictureMappingInterface; @@ -114,7 +115,7 @@ public function save() { public function createDuplicate() { return entity_create('picture_mapping', array( 'id' => '', - 'label' => t('Clone of !label', array('!label' => check_plain($this->label()))), + 'label' => t('Clone of !label', array('!label' => String::checkPlain($this->label()))), 'mappings' => $this->mappings, )); } diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php index 1e4b106..6ab7f0e 100644 --- a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php +++ b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php @@ -7,6 +7,7 @@ namespace Drupal\picture; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityFormController; /** @@ -77,7 +78,7 @@ public function form(array $form, array &$form_state) { $label = $multiplier . ' ' . $breakpoint->name . ' [' . $breakpoint->mediaQuery . ']'; $form['mappings'][$breakpoint_id][$multiplier] = array( '#type' => 'select', - '#title' => check_plain($label), + '#title' => String::checkPlain($label), '#options' => $image_styles, '#default_value' => $image_style, '#description' => $this->t('Select an image style for this breakpoint.'), diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php index 09111bf..2f13cc3 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php @@ -8,11 +8,12 @@ namespace Drupal\rest\Plugin\views\display; +use Drupal\Component\Utility\String; +use Drupal\Core\ContentNegotiation; use Drupal\Core\KeyValueStore\StateInterface; use Drupal\Core\Routing\RouteProviderInterface; -use Drupal\Core\ContentNegotiation; -use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\PathPluginBase; +use Drupal\views\ViewExecutable; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -295,7 +296,7 @@ public function render() { // Wrap the output in a pre tag if this is for a live preview. if (!empty($this->view->live_preview)) { $build['#prefix'] = '
';
-      $build['#markup'] = check_plain($build['#markup']);
+      $build['#markup'] = String::checkPlain($build['#markup']);
       $build['#suffix'] = '
'; } diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php index 5903780..646f2ac 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php @@ -7,6 +7,7 @@ namespace Drupal\rest\Tests\Views; +use Drupal\Component\Utility\String; use Drupal\views\Tests\Plugin\PluginTestBase; use Drupal\views\Tests\ViewTestData; @@ -279,7 +280,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/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php index e3977cb..702577b 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php @@ -7,6 +7,7 @@ namespace Drupal\search\Tests; +use Drupal\Component\Utility\String; use Drupal\field\Field; /** @@ -110,7 +111,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/search/search.module b/core/modules/search/search.module index 600dc83..bb154b2 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; /** @@ -719,7 +720,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. @@ -760,7 +761,7 @@ function search_excerpt($keys, $text, $langcode = NULL) { // translated. Let translators have the ... separator text as one chunk. $dots = explode('!excerpt', t('... !excerpt ... !excerpt ...')); $text = (isset($new_ranges[0]) ? '' : $dots[0]) . implode($dots[1], $out) . (($max_end < strlen($text) - 1) ? $dots[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 ec71855..9fe5efb 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\Language; /** @@ -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'] != Language::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/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index 8e8b721..74d8486 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -5,6 +5,8 @@ * Administrative page callbacks for the shortcut module. */ +use Drupal\Component\Utility\String; + /** * Form callback: builds the form for switching shortcut sets. * @@ -39,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/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index ccefb31..e899a92 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -9,15 +9,16 @@ use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\NestedArray; +use Drupal\Component\Utility\String as StringUtil; use Drupal\Component\Utility\String; -use Drupal\Core\DrupalKernel; -use Drupal\Core\Database\Database; use Drupal\Core\Database\ConnectionNotDefinedException; +use Drupal\Core\Database\Database; +use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\Core\DrupalKernel; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\UserSession; use Drupal\Core\StreamWrapper\PublicStream; -use Drupal\Core\Datetime\DrupalDateTime; use Drupal\block\Entity\Block; use Symfony\Component\HttpFoundation\Request; @@ -1402,7 +1403,7 @@ protected function drupalGet($path, array $options = array(), array $headers = a $verbose = 'GET request to: ' . $path . '
Ending URL: ' . $this->getUrl(); if ($this->dumpHeaders) { - $verbose .= '
Headers:
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '
'; + $verbose .= '
Headers:
' . StringUtil::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . '
'; } $verbose .= '
' . $out; @@ -1592,7 +1593,7 @@ protected function drupalPostForm($path, $edit, $submit, array $options = array( $verbose = 'POST request to: ' . $path; $verbose .= '
Ending URL: ' . $this->getUrl(); if ($this->dumpHeaders) { - $verbose .= '
Headers:
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '
'; + $verbose .= '
Headers:
' . StringUtil::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . '
'; } $verbose .= '
Fields: ' . highlight_string('' . $out; @@ -1992,7 +1993,7 @@ protected function drupalHead($path, array $options = array(), array $headers = if ($this->dumpHeaders) { $this->verbose('GET request to: ' . $path . '
Ending URL: ' . $this->getUrl() . - '
Headers:
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '
'); + '
Headers:
' . StringUtil::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . '
'); } return $out; @@ -2995,9 +2996,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)) . '
' - . '
' . 'Result:' . '
' .  check_plain(var_export($output, TRUE)) . '
' - . '
' . 'Expected:' . '
' .  check_plain(var_export($expected, TRUE)) . '
' + $this->verbose('Variables:' . '
' .  StringUtil::checkPlain(var_export($variables, TRUE)) . '
' + . '
' . 'Result:' . '
' .  StringUtil::checkPlain(var_export($output, TRUE)) . '
' + . '
' . 'Expected:' . '
' .  StringUtil::checkPlain(var_export($expected, TRUE)) . '
' . '
' . $output ); if (!$message) { diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install index 917a938..6236675 100644 --- a/core/modules/simpletest/simpletest.install +++ b/core/modules/simpletest/simpletest.install @@ -5,6 +5,8 @@ * Install, update and uninstall functions for the simpletest module. */ +use Drupal\Component\Utility\String; + /** * Minimum value of PHP memory_limit for SimpleTest. */ @@ -65,7 +67,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) . '', )), ); } @@ -75,7 +77,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/system/form.api.php b/core/modules/system/form.api.php index 5ae2d69..33d2b11 100644 --- a/core/modules/system/form.api.php +++ b/core/modules/system/form.api.php @@ -5,6 +5,8 @@ * Calbacks provided by the form system. */ +use Drupal\Component\Utility\String; + /** * @addtogroup callbacks * @{ @@ -74,7 +76,7 @@ function callback_batch_operation($MULTIPLE_PARAMS, &$context) { node_save($node); // Store some result for post-processing in the finished callback. - $context['results'][] = check_plain($node->title); + $context['results'][] = String::checkPlain($node->title); // Update our progress information. $context['sandbox']['progress']++; diff --git a/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php b/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php index 2d51684..56e779d 100644 --- a/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php +++ b/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php @@ -7,8 +7,9 @@ namespace Drupal\system\Form; -use Drupal\Core\StreamWrapper\PublicStream; +use Drupal\Component\Utility\String; use Drupal\Core\Form\ConfigFormBase; +use Drupal\Core\StreamWrapper\PublicStream; /** * Configure file system settings for this site. @@ -55,7 +56,7 @@ public function buildForm(array $form, array &$form_state) { // Any visible, writeable wrapper can potentially be used for the files // directory, including a remote file system that integrates with a CDN. foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $info) { - $options[$scheme] = check_plain($info['description']); + $options[$scheme] = String::checkPlain($info['description']); } if (!empty($options)) { diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php index a090c67..5a88e31 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php @@ -7,12 +7,13 @@ namespace Drupal\system\Form; +use Drupal\Component\Utility\String; use Drupal\Component\Utility\Unicode; +use Drupal\Core\Access\AccessManager; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Access\AccessManager; /** * Provides module installation interface. @@ -77,7 +78,7 @@ public function getFormId() { */ public function buildForm(array $form, array &$form_state) { require_once DRUPAL_ROOT . '/core/includes/install.inc'; - $distribution = check_plain(drupal_install_profile_distribution_name()); + $distribution = String::checkPlain(drupal_install_profile_distribution_name()); // Include system.admin.inc so we can use the sort callbacks. $this->moduleHandler->loadInclude('system', 'inc', 'system.admin'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php index 5c016ce..536868f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Common; +use Drupal\Component\Utility\String; use Drupal\Core\Language\Language; use Drupal\simpletest\DrupalUnitTestBase; @@ -79,7 +80,7 @@ function testRenderFile() { $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.'); // Verify that newlines are properly added inside style tags. $query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - $css_processed = ''; + $css_processed = ''; $this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.'); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php index c42997d..3b7b857 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Common; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; /** @@ -151,8 +152,8 @@ function testDrupalRenderFormElements() { protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) { $original_element = $element; $this->drupalSetContent(drupal_render($element)); - $this->verbose('
' .  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)) . '
' . '
' . $this->drupalGetContent() ); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php index 59eca4a..6876e94 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Common; +use Drupal\Component\Utility\String; use Drupal\simpletest\UnitTestBase; use Symfony\Component\HttpFoundation\Request; @@ -43,7 +44,7 @@ function testTableSortInit() { $request->query->replace(array()); \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 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/lib/Drupal/system/Tests/Form/FormTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php index c261031..53f5cec 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\Form; use Drupal\Component\Utility\String; +use Drupal\Component\Utility\String as StringUtil; use Drupal\simpletest\WebTestBase; class FormTest extends WebTestBase { @@ -606,7 +607,7 @@ function testDisabledMarkup() { $path = strtr($path, array('!type' => $type)); // Verify that the element exists. $element = $this->xpath($path, array( - ':name' => check_plain($name), + ':name' => StringUtil::checkPlain($name), ':div-class' => $class, ':value' => isset($item['#value']) ? $item['#value'] : '', )); diff --git a/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php index 751bf0c..cf4524c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Mail; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; /** @@ -36,7 +37,7 @@ protected function stringToHtml($text) { str_replace( array("\n", ' '), array('\n', ' '), - check_plain($text) + String::checkPlain($text) ) . '"'; } @@ -58,7 +59,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)
       . '

' . 'result =
' . $this->stringToHtml($result)
       . '

' . 'expected =
' . $this->stringToHtml($text)
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index d7e51c4..6df5800 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Menu;
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Unicode;
 
 /**
@@ -271,7 +272,7 @@ function testBreadCrumbs() {
         $link['link_path'] => $link['link_title'],
       );
       $this->assertBreadcrumb($link['link_path'], $trail, $term->label(), $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/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
index 4dd3e1a..490b7d4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Menu;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -120,7 +121,7 @@ protected function doTestDescriptionMenuItems() {
     // Verify that the menu router item title is output as page title.
     $this->drupalGet('menu_callback_description');
     $this->assertText(t('Menu item description text'));
-    $this->assertRaw(check_plain('Menu item description arguments'));
+    $this->assertRaw(String::checkPlain('Menu item description arguments'));
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php
index d205b13..fc896d8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php
+++ b/core/modules/system/lib/Drupal/system/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/lib/Drupal/system/Tests/System/PageTitleTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
index 33f2f47..f3e3e5e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\System;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Utility\Title;
 use Drupal\simpletest\WebTestBase;
 
@@ -80,7 +81,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.');
   }
   /**
    * Test if the title of the site is XSS proof.
@@ -88,7 +89,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 = filter_xss_admin($slogan);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
index 586e1eb..d01f68e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
+++ b/core/modules/system/lib/Drupal/system/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 .= '';
 
     // Verify that passing a string as heading works.
@@ -234,10 +235,10 @@ function testLinks() {
     );
     $expected_links = '';
     $expected_links .= '';
     $expected = $expected_heading . $expected_links;
     $this->assertThemeOutput('links', $variables, $expected);
@@ -247,10 +248,10 @@ function testLinks() {
     $variables['set_active_class'] = TRUE;
     $expected_links = '';
     $expected_links .= '';
     $expected = $expected_heading . $expected_links;
     $this->assertThemeOutput('links', $variables, $expected);
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 3664623..8c60356 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -5,6 +5,7 @@
  * Hooks provided by Drupal core and the System module.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Utility\UpdateException;
 
 /**
@@ -2729,7 +2730,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'title':
-          $replacements[$original] = $sanitize ? check_plain($node->getTitle()) : $node->getTitle();
+          $replacements[$original] = $sanitize ? String::checkPlain($node->getTitle()) : $node->getTitle();
           break;
 
         case 'edit-url':
@@ -2739,7 +2740,7 @@ function hook_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/system/system.tokens.inc b/core/modules/system/system.tokens.inc
index 4c27e2c..05e35ac 100644
--- a/core/modules/system/system.tokens.inc
+++ b/core/modules/system/system.tokens.inc
@@ -7,6 +7,8 @@
  * This file handles tokens for the global 'site' and 'date' tokens.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -104,7 +106,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
       switch ($name) {
         case 'name':
           $site_name = \Drupal::config('system.site')->get('name');
-          $replacements[$original] = $sanitize ? check_plain($site_name) : $site_name;
+          $replacements[$original] = $sanitize ? String::checkPlain($site_name) : $site_name;
           break;
 
         case 'slogan':
@@ -158,7 +160,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
           break;
 
         case 'raw':
-          $replacements[$original] = $sanitize ? check_plain($date) : $date;
+          $replacements[$original] = $sanitize ? String::checkPlain($date) : $date;
           break;
       }
     }
diff --git a/core/modules/system/tests/modules/database_test/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module
index f41ad30..981d215 100644
--- a/core/modules/system/tests/modules/database_test/database_test.module
+++ b/core/modules/system/tests/modules/database_test/database_test.module
@@ -1,6 +1,7 @@
 id()] = array(
       'title' => array('data' => array('#title' => String::checkPlain($account->getUsername()))),
-      'username' => check_plain($account->getUsername()),
+      'username' => StringUtil::checkPlain($account->getUsername()),
       'status' =>  $account->isActive() ? t('active') : t('blocked'),
     );
   }
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php
index 6805765..8f5efad 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_test;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityViewBuilder;
 
 /**
@@ -24,13 +25,13 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
 
     foreach ($entities as $entity) {
       $entity->content['label'] = array(
-        '#markup' => check_plain($entity->label()),
+        '#markup' => String::checkPlain($entity->label()),
       );
       $entity->content['separator'] = array(
         '#markup' => ' | ',
       );
       $entity->content['view_mode'] = array(
-        '#markup' => check_plain($view_mode),
+        '#markup' => String::checkPlain($view_mode),
       );
     }
   }
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index 0e8bdb9..13a1cd7 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -6,13 +6,14 @@
  */
 
 use Drupal\Component\Utility\Json;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Connection;
 use Drupal\Core\Database\Database;
+use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\Core\Language\Language;
 use Drupal\form_test\Callbacks;
 use Drupal\form_test\FormTestObject;
 use Drupal\form_test\SystemConfigFormTestForm;
-use Drupal\Core\Datetime\DrupalDateTime;
 use Symfony\Component\HttpFoundation\JsonResponse;
 
 /**
@@ -643,7 +644,7 @@ function form_storage_test_form_continue_submit($form, &$form_state) {
  * Form submit handler to finish multi-step form.
  */
 function form_test_storage_form_submit($form, &$form_state) {
-  drupal_set_message("Title: " . check_plain($form_state['values']['title']));
+  drupal_set_message("Title: " . String::checkPlain($form_state['values']['title']));
   drupal_set_message("Form constructions: " . $_SESSION['constructions']);
   if (isset($form_state['storage']['thing']['changed'])) {
     drupal_set_message("The thing has been changed.");
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php
index f7d0325..52d92e7 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -33,7 +34,7 @@ public function viewElements(FieldItemListInterface $items) {
     foreach ($items as $delta => $item) {
       if (!$item->target_id) {
         $elements[$delta] = array(
-          '#markup' => check_plain($item->entity->label()),
+          '#markup' => String::checkPlain($item->entity->label()),
         );
       }
       else {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php
index 826db27..61bc262 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -30,7 +31,7 @@ public function viewElements(FieldItemListInterface $items) {
 
     foreach ($items as $delta => $item) {
       $elements[$delta] = array(
-        '#markup' => check_plain($item->entity->label()),
+        '#markup' => String::checkPlain($item->entity->label()),
       );
     }
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php
index abe16ea..f0fd94c 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\ManyToOne;
 
 /**
@@ -25,7 +26,7 @@ public function titleQuery() {
       ->condition('td.tid', $this->value)
       ->execute();
     foreach ($result as $term) {
-      $titles[] = check_plain($term->name);
+      $titles[] = String::checkPlain($term->name);
     }
     return $titles;
   }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php
index 84c9415..faf76a8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
 
 /**
@@ -121,7 +122,7 @@ public function query($group_by = FALSE) {
   function title() {
     $term = entity_load('taxonomy_term', $this->argument);
     if (!empty($term)) {
-      return check_plain($term->label());
+      return String::checkPlain($term->label());
     }
     // TODO review text
     return t('No name');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php
index d1f75c6..a8ee992 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\Numeric;
 
 /**
@@ -26,7 +27,7 @@ function title() {
     if ($this->argument) {
       $term = entity_load('taxonomy_term', $this->argument);
       if (!empty($term)) {
-        return check_plain($term->label());
+        return String::checkPlain($term->label());
       }
     }
     // TODO review text
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php
index aa9a582..b1f1a71 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\Numeric;
 
 /**
@@ -24,7 +25,7 @@ class VocabularyVid extends Numeric {
   function title() {
     $vocabulary = entity_load('taxonomy_vocabulary', $this->argument);
     if ($vocabulary) {
-      return check_plain($vocabulary->label());
+      return String::checkPlain($vocabulary->label());
     }
 
     return t('No vocabulary');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
index bb6d43b..a4c4a3b 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\taxonomy\Plugin\views\field;
 
-use Drupal\views\ViewExecutable;
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\field\PrerenderList;
+use Drupal\views\ViewExecutable;
 
 /**
  * Field handler to display all taxonomy terms of a node.
@@ -116,10 +117,10 @@ public function preRender(&$values) {
       $result = $query->execute();
 
       foreach ($result as $term) {
-        $this->items[$term->node_nid][$term->tid]['name'] = check_plain($term->name);
+        $this->items[$term->node_nid][$term->tid]['name'] = String::checkPlain($term->name);
         $this->items[$term->node_nid][$term->tid]['tid'] = $term->tid;
         $this->items[$term->node_nid][$term->tid]['vocabulary_vid'] = $term->vid;
-        $this->items[$term->node_nid][$term->tid]['vocabulary'] = check_plain($vocabularies[$term->vid]->label());
+        $this->items[$term->node_nid][$term->tid]['vocabulary'] = String::checkPlain($vocabularies[$term->vid]->label());
 
         if (!empty($this->options['link_to_taxonomy'])) {
           $this->items[$term->node_nid][$term->tid]['make_link'] = TRUE;
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index 5a53567..64b24f6 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\taxonomy\Tests;
 
 use Drupal\Component\Utility\Json;
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
 use Drupal\Core\Field\FieldDefinitionInterface;
 
@@ -263,8 +264,8 @@ function testTermAutocompletion() {
     // The result order is not guaranteed, so check each term separately.
     $result = $this->drupalGet($path, array('query' => array('q' => $input)));
     $data = drupal_json_decode($result);
-    $this->assertEqual($data[0]['label'], check_plain($first_term->label()), 'Autocomplete returned the first matching term');
-    $this->assertEqual($data[1]['label'], check_plain($second_term->label()), 'Autocomplete returned the second matching term');
+    $this->assertEqual($data[0]['label'], String::checkPlain($first_term->label()), 'Autocomplete returned the first matching term');
+    $this->assertEqual($data[1]['label'], String::checkPlain($second_term->label()), 'Autocomplete returned the second matching term');
 
     // Try to autocomplete a term name that matches first term.
     // We should only get the first term in a json encoded string.
@@ -272,7 +273,7 @@ function testTermAutocompletion() {
     $path = 'taxonomy/autocomplete/node/taxonomy_' . $this->vocabulary->id();
     $this->drupalGet($path, array('query' => array('q' => $input)));
     $target = array(array(
-      'value' => check_plain($first_term->label()),
+      'value' => String::checkPlain($first_term->label()),
       'label' => $first_term->label(),
     ));
     $this->assertRaw(Json::encode($target), 'Autocomplete returns only the expected matching term.');
@@ -285,7 +286,7 @@ function testTermAutocompletion() {
     $n = Tags::encode($third_term->label());
     $target = array(array(
       'value' => $n,
-      'label' => check_plain($third_term->label()),
+      'label' => String::checkPlain($third_term->label()),
     ));
     $this->assertRaw(Json::encode($target), 'Autocomplete returns a term containing a comma and a slash.');
   }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
index e22b97e..d206287 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Language\Language;
 
@@ -87,12 +88,12 @@ function testTaxonomyTokenReplacement() {
     // Generate and test sanitized tokens for term1.
     $tests = array();
     $tests['[term:tid]'] = $term1->id();
-    $tests['[term:name]'] = check_plain($term1->name->value);
+    $tests['[term:name]'] = String::checkPlain($term1->name->value);
     $tests['[term:description]'] = $term1->description->processed;
     $tests['[term:url]'] = url('taxonomy/term/' . $term1->id(), array('absolute' => TRUE));
     $tests['[term:node-count]'] = 0;
     $tests['[term:parent:name]'] = '[term:parent:name]';
-    $tests['[term:vocabulary:name]'] = check_plain($this->vocabulary->name);
+    $tests['[term:vocabulary:name]'] = String::checkPlain($this->vocabulary->name);
 
     foreach ($tests as $input => $expected) {
       $output = $token_service->replace($input, array('term' => $term1), array('langcode' => $language_interface->id));
@@ -102,14 +103,14 @@ function testTaxonomyTokenReplacement() {
     // Generate and test sanitized tokens for term2.
     $tests = array();
     $tests['[term:tid]'] = $term2->id();
-    $tests['[term:name]'] = check_plain($term2->name->value);
+    $tests['[term:name]'] = String::checkPlain($term2->name->value);
     $tests['[term:description]'] = $term2->description->processed;
     $tests['[term:url]'] = url('taxonomy/term/' . $term2->id(), array('absolute' => TRUE));
     $tests['[term:node-count]'] = 1;
-    $tests['[term:parent:name]'] = check_plain($term1->name->value);
+    $tests['[term:parent:name]'] = String::checkPlain($term1->name->value);
     $tests['[term:parent:url]'] = url('taxonomy/term/' . $term1->id(), array('absolute' => TRUE));
     $tests['[term:parent:parent:name]'] = '[term:parent:parent:name]';
-    $tests['[term:vocabulary:name]'] = check_plain($this->vocabulary->name);
+    $tests['[term:vocabulary:name]'] = String::checkPlain($this->vocabulary->name);
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
@@ -133,7 +134,7 @@ function testTaxonomyTokenReplacement() {
     // Generate and test sanitized tokens.
     $tests = array();
     $tests['[vocabulary:vid]'] = $this->vocabulary->id();
-    $tests['[vocabulary:name]'] = check_plain($this->vocabulary->name);
+    $tests['[vocabulary:name]'] = String::checkPlain($this->vocabulary->name);
     $tests['[vocabulary:description]'] = filter_xss($this->vocabulary->description);
     $tests['[vocabulary:node-count]'] = 1;
     $tests['[vocabulary:term-count]'] = 2;
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 5783b4d..380cdd3 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -5,9 +5,10 @@
  * Enables the organization of content into categories.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
-use Drupal\Core\Entity\FieldableDatabaseStorageController;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\FieldableDatabaseStorageController;
 use Drupal\file\FileInterface;
 use Drupal\node\Entity\Node;
 use Drupal\taxonomy\Entity\Term;
@@ -404,7 +405,7 @@ function template_preprocess_taxonomy_term(&$variables) {
 
   $variables['url'] = $term->url();
   // We use name here because that is what appears in the UI.
-  $variables['name'] = check_plain($term->label());
+  $variables['name'] = String::checkPlain($term->label());
   $variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
 
   // Helpful $content variable for templates.
diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc
index eec9d73..1234361 100644
--- a/core/modules/taxonomy/taxonomy.tokens.inc
+++ b/core/modules/taxonomy/taxonomy.tokens.inc
@@ -5,6 +5,8 @@
  * Builds placeholder replacement tokens for taxonomy terms and vocabularies.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -104,7 +106,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
           break;
 
         case 'name':
-          $replacements[$original] = $sanitize ? check_plain($term->name->value) : $term->name->value;
+          $replacements[$original] = $sanitize ? String::checkPlain($term->name->value) : $term->name->value;
           break;
 
         case 'description':
@@ -125,13 +127,13 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
 
         case 'vocabulary':
           $vocabulary = entity_load('taxonomy_vocabulary', $term->bundle());
-          $replacements[$original] = check_plain($vocabulary->name);
+          $replacements[$original] = String::checkPlain($vocabulary->name);
           break;
 
         case 'parent':
           if ($parents = taxonomy_term_load_parents($term->id())) {
             $parent = array_pop($parents);
-            $replacements[$original] = check_plain($parent->name->value);
+            $replacements[$original] = String::checkPlain($parent->name->value);
           }
           break;
       }
@@ -158,7 +160,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
           break;
 
         case 'name':
-          $replacements[$original] = $sanitize ? check_plain($vocabulary->name) : $vocabulary->name;
+          $replacements[$original] = $sanitize ? String::checkPlain($vocabulary->name) : $vocabulary->name;
           break;
 
         case 'description':
diff --git a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php
index 6c15bf5..22bb681 100644
--- a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php
+++ b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php
@@ -7,8 +7,9 @@
 
 namespace Drupal\text\Plugin\Field\FieldFormatter;
 
-use Drupal\Core\Field\FormatterBase;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\FormatterBase;
 
 /**
  * Plugin implementation of the 'text_plain' formatter.
@@ -37,7 +38,7 @@ public function viewElements(FieldItemListInterface $items) {
     foreach ($items as $delta => $item) {
       // The text value has no text format assigned to it, so the user input
       // should equal the output, including newlines.
-      $elements[$delta] = array('#markup' => nl2br(check_plain($item->value)));
+      $elements[$delta] = array('#markup' => nl2br(String::checkPlain($item->value)));
     }
 
     return $elements;
diff --git a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
index d1ff5d2..b29a3da 100644
--- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\text\Tests\Formatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\Core\Language\Language;
@@ -305,7 +306,7 @@ function testPlainText() {
     $this->renderEntityFields($entity, $this->display);
     $this->assertText($value);
     $this->assertNoRaw($value);
-    $this->assertRaw(nl2br(check_plain($value)));
+    $this->assertRaw(nl2br(String::checkPlain($value)));
   }
 
 }
diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
index e1efa12..ddb567f 100644
--- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\text\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -215,7 +216,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     $content = $display->build($entity);
     $this->drupalSetContent(drupal_render($content));
     $this->assertNoRaw($value, 'HTML tags are not displayed.');
-    $this->assertRaw(check_plain($value), 'Escaped HTML is displayed correctly.');
+    $this->assertRaw(String::checkPlain($value), 'Escaped HTML is displayed correctly.');
 
     // Create a new text format that does not escape HTML, and grant the user
     // access to it.
diff --git a/core/modules/text/lib/Drupal/text/TextProcessed.php b/core/modules/text/lib/Drupal/text/TextProcessed.php
index d07a196..414dace 100644
--- a/core/modules/text/lib/Drupal/text/TextProcessed.php
+++ b/core/modules/text/lib/Drupal/text/TextProcessed.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\text;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\TypedData\DataDefinitionInterface;
-use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedData;
+use Drupal\Core\TypedData\TypedDataInterface;
 
 /**
  * A computed property for processing text with a format.
@@ -58,7 +59,7 @@ public function getValue($langcode = NULL) {
     else {
       // Escape all HTML and retain newlines.
       // @see \Drupal\text\Plugin\field\formatter\TextPlainFormatter
-      $this->processed = nl2br(check_plain($text));
+      $this->processed = nl2br(String::checkPlain($text));
     }
     return $this->processed;
   }
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index d91527b..574d0e2 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -5,14 +5,15 @@
  * Administration toolbar for quick access to top level administration items.
  */
 
+use Drupal\Component\Utility\Crypt;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Template\Attribute;
-use Drupal\Component\Utility\Crypt;
-use Symfony\Component\HttpFoundation\Response;
 use Drupal\menu_link\MenuLinkInterface;
 use Drupal\user\RoleInterface;
 use Drupal\user\UserInterface;
+use Symfony\Component\HttpFoundation\Response;
 
 /**
  * Implements hook_help().
@@ -457,7 +458,7 @@ function toolbar_menu_navigation_links(&$tree) {
         'toolbar-icon',
         'toolbar-icon-' . strtolower(str_replace(' ', '-', $item['link']['link_title'])),
       ),
-      'title' => check_plain($item['link']['description']),
+      'title' => String::checkPlain($item['link']['description']),
     );
   }
 }
diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php b/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php
index d883490..74ad089 100644
--- a/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php
+++ b/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\tour\Plugin\tour\tip;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Utility\Token;
 use Drupal\tour\TipPluginBase;
@@ -118,7 +119,7 @@ public function getAttributes() {
    * Implements \Drupal\tour\TipPluginInterface::getOutput().
    */
   public function getOutput() {
-    $output = '

' . check_plain($this->getLabel()) . '

'; + $output = '

' . String::checkPlain($this->getLabel()) . '

'; $output .= '

' . filter_xss_admin($this->token->replace($this->getBody())) . '

'; return array('#markup' => $output); } diff --git a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php index 79ed03c..89f051a 100644 --- a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php +++ b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/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 = '

' . check_plain($this->get('label')) . '

'; + $output = '

' . String::checkPlain($this->get('label')) . '

'; $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 e94c163..6c794d0 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 b0d0483..44c4684 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -36,8 +36,9 @@ * root. */ -use Drupal\Core\Updater\Updater; +use Drupal\Component\Utility\String; use Drupal\Core\FileTransfer\Local; +use Drupal\Core\Updater\Updater; 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 51da7dd..579f461 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 = '
'; $update_status_label = array('#theme' => 'update_status_label', '#status' => $project['status']); $status_label = drupal_render($update_status_label); - $row .= !empty($status_label) ? $status_label : check_plain($project['reason']); + $row .= !empty($status_label) ? $status_label : String::checkPlain($project['reason']); $row .= '' . drupal_render($icon) . ''; $row .= "
\n"; @@ -93,13 +95,13 @@ function theme_update_report($variables) { $row .= l($project['title'], $project['link']); } else { - $row .= check_plain($project['title']); + $row .= String::checkPlain($project['title']); } } else { - $row .= check_plain($project['name']); + $row .= String::checkPlain($project['name']); } - $row .= ' ' . check_plain($project['existing_version']); + $row .= ' ' . String::checkPlain($project['existing_version']); if ($project['install_type'] == 'dev' && !empty($project['datestamp'])) { $row .= ' (' . format_date($project['datestamp'], 'custom', 'Y-M-d') . ')'; } @@ -201,7 +203,7 @@ function theme_update_report($variables) { $row .= '
' . "\n"; foreach ($project['extra'] as $value) { $row .= '
'; - $row .= check_plain($value['label']) . ': '; + $row .= String::checkPlain($value['label']) . ': '; $row .= drupal_placeholder($value['data']); $row .= "
\n"; } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php b/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php index a50ac39..507b2db 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php @@ -7,9 +7,10 @@ namespace Drupal\user\Plugin\views\access; +use Drupal\Component\Utility\String; +use Drupal\Core\Session\AccountInterface; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\Routing\Route; -use Drupal\Core\Session\AccountInterface; /** * Access plugin that provides role-based access control. @@ -56,7 +57,7 @@ public function summaryTitle() { else { $rids = user_role_names(); $rid = reset($this->options['role']); - return check_plain($rids[$rid]); + return String::checkPlain($rids[$rid]); } } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php index d385236..1402bde 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php @@ -7,6 +7,7 @@ namespace Drupal\user\Plugin\views\argument_validator; +use Drupal\Component\Utility\String; use Drupal\Core\Database\Connection; use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -157,7 +158,7 @@ public function validateArgument($argument) { } $this->argument->argument = $account->id(); - $this->argument->validated_title = check_plain(user_format_name($account)); + $this->argument->validated_title = String::checkPlain(user_format_name($account)); return TRUE; } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php index 7b189aa..7861dbc 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php @@ -7,6 +7,7 @@ namespace Drupal\user\Plugin\views\field; +use Drupal\Component\Utility\String; use Drupal\user\Plugin\views\field\User; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ResultRow; @@ -84,7 +85,7 @@ protected function renderLink($data, ResultRow $values) { if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) { if (!empty($this->options['overwrite_anonymous']) && !$account->id()) { // This is an anonymous user, and we're overriting the text. - return check_plain($this->options['anonymous_text']); + return String::checkPlain($this->options['anonymous_text']); } elseif (!empty($this->options['link_to_user'])) { $account->name = $this->getValue($values); diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php index ec9df99..a355ecc 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php @@ -7,10 +7,11 @@ namespace Drupal\user\Plugin\views\field; +use Drupal\Component\Utility\String; use Drupal\Core\Database\Connection; use Drupal\views\Plugin\views\display\DisplayPluginBase; -use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\PrerenderList; +use Drupal\views\ViewExecutable; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -80,7 +81,7 @@ public function preRender(&$values) { $roles = user_roles(); $result = $this->database->query('SELECT u.uid, u.rid FROM {users_roles} u WHERE u.uid IN (:uids) AND u.rid IN (:rids)', array(':uids' => $uids, ':rids' => array_keys($roles))); foreach ($result as $role) { - $this->items[$role->uid][$role->rid]['role'] = check_plain($roles[$role->rid]->label()); + $this->items[$role->uid][$role->rid]['role'] = String::checkPlain($roles[$role->rid]->label()); $this->items[$role->uid][$role->rid]['rid'] = $role->rid; } // Sort the roles for each user by role weight. diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php index de8062e..d205b51 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php @@ -7,6 +7,7 @@ namespace Drupal\user\Tests; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; /** @@ -53,7 +54,7 @@ function testUserAutocomplete() { // Test that anonymous username is in the result when requested and escaped // with check_plain(). $users = $this->drupalGetJSON('user/autocomplete/anonymous', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4)))); - $this->assertEqual(check_plain($anonymous_name), $users[0]['label'], 'The anonymous name found in autocompletion results.'); + $this->assertEqual(String::checkPlain($anonymous_name), $users[0]['label'], 'The anonymous name found in autocompletion results.'); $users = $this->drupalGetJSON('user/autocomplete', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4)))); $this->assertTrue(empty($users), 'The anonymous name not found in autocompletion results without enabling anonymous username.'); } diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php index cc706ba..a99b4fb 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php @@ -7,8 +7,9 @@ namespace Drupal\user\Tests; -use Drupal\simpletest\WebTestBase; +use Drupal\Component\Utility\String; use Drupal\Core\Language\Language; +use Drupal\simpletest\WebTestBase; /** * Test user token replacement in strings. @@ -62,15 +63,15 @@ function testUserTokenReplacement() { // Generate and test sanitized tokens. $tests = array(); $tests['[user:uid]'] = $account->id(); - $tests['[user:name]'] = check_plain(user_format_name($account)); - $tests['[user:mail]'] = check_plain($account->getEmail()); + $tests['[user:name]'] = String::checkPlain(user_format_name($account)); + $tests['[user:mail]'] = String::checkPlain($account->getEmail()); $tests['[user:url]'] = url("user/" . $account->id(), $url_options); $tests['[user:edit-url]'] = url("user/" . $account->id() . "/edit", $url_options); $tests['[user:last-login]'] = format_date($account->getLastLoginTime(), 'medium', '', NULL, $language_interface->id); $tests['[user:last-login:short]'] = format_date($account->getLastLoginTime(), 'short', '', NULL, $language_interface->id); $tests['[user:created]'] = format_date($account->getCreatedTime(), 'medium', '', NULL, $language_interface->id); $tests['[user:created:short]'] = format_date($account->getCreatedTime(), 'short', '', NULL, $language_interface->id); - $tests['[current-user:name]'] = check_plain(user_format_name($global_account)); + $tests['[current-user:name]'] = String::checkPlain(user_format_name($global_account)); // 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/user/user.module b/core/modules/user/user.module index d07ebd4..a54fc58 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1,18 +1,19 @@ 20) { $name = drupal_substr($name, 0, 15) . '...'; } - $variables['name'] = check_plain($name); + $variables['name'] = String::checkPlain($name); $variables['profile_access'] = \Drupal::currentUser()->hasPermission('access user profiles'); // Populate link path and attributes if appropriate. diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc index 5412a38..bd8d841 100644 --- a/core/modules/user/user.tokens.inc +++ b/core/modules/user/user.tokens.inc @@ -5,6 +5,8 @@ * Builds placeholder replacement tokens for user-related data. */ +use Drupal\Component\Utility\String; + /** * Implements hook_token_info(). */ @@ -88,11 +90,11 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr case 'name': $name = user_format_name($account); - $replacements[$original] = $sanitize ? check_plain($name) : $name; + $replacements[$original] = $sanitize ? String::checkPlain($name) : $name; break; case 'mail': - $replacements[$original] = $sanitize ? check_plain($account->getEmail()) : $account->getEmail(); + $replacements[$original] = $sanitize ? String::checkPlain($account->getEmail()) : $account->getEmail(); break; case 'url': diff --git a/core/modules/xmlrpc/xmlrpc.inc b/core/modules/xmlrpc/xmlrpc.inc index 445993a..8f39217 100644 --- a/core/modules/xmlrpc/xmlrpc.inc +++ b/core/modules/xmlrpc/xmlrpc.inc @@ -11,6 +11,7 @@ * This version is made available under the GNU GPL License */ +use Drupal\Component\Utility\String; use Guzzle\Http\Exception\BadResponseException; use Guzzle\Http\Exception\RequestException; @@ -123,7 +124,7 @@ function xmlrpc_value_get_xml($xmlrpc_value) { case 'struct': $return = '' . "\n"; foreach ($xmlrpc_value->data as $name => $value) { - $return .= " " . check_plain($name) . ""; + $return .= " " . String::checkPlain($name) . ""; $return .= xmlrpc_value_get_xml($value) . "\n"; } $return .= '';