diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php
index e73a34f..58e5d25 100644
--- a/core/lib/Drupal/Core/Field/WidgetBase.php
+++ b/core/lib/Drupal/Core/Field/WidgetBase.php
@@ -9,6 +9,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\SortArray;
+use Drupal\Component\Utility\String;
use Symfony\Component\Validator\ConstraintViolationInterface;
/**
@@ -74,7 +75,7 @@ public function form(FieldItemListInterface $items, array &$form, array &$form_s
if ($this->handlesMultipleValues() || isset($get_delta)) {
$delta = isset($get_delta) ? $get_delta : 0;
$element = array(
- '#title' => check_plain($this->fieldDefinition->getLabel()),
+ '#title' => String::checkPlain($this->fieldDefinition->getLabel()),
'#description' => field_filter_xss(\Drupal::token()->replace($this->fieldDefinition->getDescription())),
);
$element = $this->formSingleElement($items, $delta, $element, $form, $form_state);
@@ -161,7 +162,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
$id_prefix = implode('-', array_merge($parents, array($field_name)));
$wrapper_id = drupal_html_id($id_prefix . '-add-more-wrapper');
- $title = check_plain($this->fieldDefinition->getLabel());
+ $title = String::checkPlain($this->fieldDefinition->getLabel());
$description = field_filter_xss(\Drupal::token()->replace($this->fieldDefinition->getDescription()));
$elements = array();
diff --git a/core/modules/action/action.views_execution.inc b/core/modules/action/action.views_execution.inc
index 859cffd..400d738 100644
--- a/core/modules/action/action.views_execution.inc
+++ b/core/modules/action/action.views_execution.inc
@@ -5,12 +5,14 @@
* Provides views runtime hooks for action.module.
*/
+use Drupal\Component\Utility\String;
+
/**
* Implements hook_views_form_substitutions().
*/
function action_views_form_substitutions() {
// Views check_plain()s the column label, so we need to match that.
- $select_all_placeholder = check_plain('');
+ $select_all_placeholder = String::checkPlain('');
$select_all = array(
'#type' => 'checkbox',
'#default_value' => FALSE,
diff --git a/core/modules/aggregator/aggregator.theme.inc b/core/modules/aggregator/aggregator.theme.inc
index 5531dd6..07806e0 100644
--- a/core/modules/aggregator/aggregator.theme.inc
+++ b/core/modules/aggregator/aggregator.theme.inc
@@ -5,6 +5,7 @@
* Preprocessors and theme functions of Aggregator module.
*/
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
/**
@@ -21,7 +22,7 @@ function template_preprocess_aggregator_item(&$variables) {
$item = $variables['aggregator_item'];
$variables['feed_url'] = check_url($item->getLink());
- $variables['feed_title'] = check_plain($item->getTitle());
+ $variables['feed_title'] = String::checkPlain($item->getTitle());
$variables['content'] = aggregator_filter_xss($item->getDescription());
$variables['source_url'] = '';
@@ -29,7 +30,7 @@ function template_preprocess_aggregator_item(&$variables) {
$fid = $item->getFeedId();
if (isset($item->ftitle) && $fid !== NULL) {
$variables['source_url'] = url('aggregator/sources/' . $fid);
- $variables['source_title'] = check_plain($item->ftitle);
+ $variables['source_title'] = String::checkPlain($item->ftitle);
}
if (date('Ymd', $item->getPostedTime()) == date('Ymd')) {
$variables['source_date'] = t('%ago ago', array('%ago' => format_interval(REQUEST_TIME - $item->getPostedTime())));
@@ -59,12 +60,12 @@ function theme_aggregator_page_opml($variables) {
$output = "\n";
$output .= "\n";
$output .= "\n";
- $output .= '' . check_plain(\Drupal::config('system.site')->get('name')) . "\n";
+ $output .= '' . String::checkPlain(\Drupal::config('system.site')->get('name')) . "\n";
$output .= '' . gmdate(DATE_RFC2822, REQUEST_TIME) . "\n";
$output .= "\n";
$output .= "\n";
foreach ($feeds as $feed) {
- $output .= '\n";
+ $output .= '\n";
}
$output .= "\n";
$output .= "\n";
@@ -84,7 +85,7 @@ function theme_aggregator_page_opml($variables) {
* - summary_items: An array of feed items.
*/
function template_preprocess_aggregator_summary_items(&$variables) {
- $variables['title'] = check_plain($variables['source'] instanceof EntityInterface ? $variables['source']->label() : $variables['source']->title);
+ $variables['title'] = String::checkPlain($variables['source'] instanceof EntityInterface ? $variables['source']->label() : $variables['source']->title);
$summary_items = array();
foreach (element_children($variables['summary_items']) as $key) {
$summary_items[] = $variables['summary_items'][$key];
@@ -109,7 +110,7 @@ function template_preprocess_aggregator_summary_items(&$variables) {
function template_preprocess_aggregator_summary_item(&$variables) {
$item = $variables['aggregator_item'];
- $variables['url'] = l(check_plain($item->label()), check_url(url($item->getLink(), array('absolute' => TRUE))), array(
+ $variables['url'] = l(String::checkPlain($item->label()), check_url(url($item->getLink(), array('absolute' => TRUE))), array(
'attributes' => array(
'class' => array('feed-item-url'),
),
@@ -186,5 +187,5 @@ function template_preprocess_aggregator_feed_source(&$variables) {
function template_preprocess_aggregator_block_item(&$variables) {
// Display the external link to the item.
$variables['url'] = check_url($variables['item']->link);
- $variables['title'] = check_plain($variables['item']->title);
+ $variables['title'] = String::checkPlain($variables['item']->title);
}
diff --git a/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php b/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
index 6807cce..af82055 100644
--- a/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
+++ b/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
@@ -7,12 +7,12 @@
namespace Drupal\ban\EventSubscriber;
+use Drupal\Component\Utility\String;
+use Drupal\ban\BanIpManager;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-use Drupal\ban\BanIpManager;
+use Symfony\Component\HttpKernel\KernelEvents;
/**
* Ban subscriber for controller requests.
@@ -45,7 +45,7 @@ public function __construct(BanIpManager $manager) {
public function onKernelRequestBannedIpCheck(GetResponseEvent $event) {
$ip = $event->getRequest()->getClientIp();
if ($this->manager->isDenied($ip)) {
- $response = new Response('Sorry, ' . check_plain($ip) . ' has been banned.', 403);
+ $response = new Response('Sorry, ' . String::checkPlain($ip) . ' has been banned.', 403);
$event->setResponse($response);
}
}
diff --git a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
index 200b428..9f72afb 100644
--- a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
+++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
@@ -7,9 +7,10 @@
namespace Drupal\block;
+use Drupal\Component\Utility\String;
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\Core\Entity\EntityViewBuilderInterface;
-use Drupal\Core\Entity\EntityInterface;
/**
* Provides a Block view builder.
@@ -61,7 +62,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
'#base_plugin_id' => $base_id,
'#derivative_plugin_id' => $derivative_id,
);
- $build[$key]['#configuration']['label'] = check_plain($configuration['label']);
+ $build[$key]['#configuration']['label'] = String::checkPlain($configuration['label']);
// Place the $content returned by the block plugin into a 'content'
// child element, as a way to allow the plugin to have complete control
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 8fe9e41..ddceaa5 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -5,12 +5,13 @@
* Allows users to create and organize related content in an outline.
*/
+use Drupal\Component\Utility\String;
+use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
-use Drupal\node\NodeInterface;
-use Drupal\node\NodeTypeInterface;
use Drupal\Core\Language\Language;
-use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Template\Attribute;
+use Drupal\node\NodeInterface;
+use Drupal\node\NodeTypeInterface;
/**
* Implements hook_help().
@@ -661,7 +662,7 @@ function template_preprocess_book_navigation(&$variables) {
// Provide extra variables for themers. Not needed by default.
$variables['book_id'] = $book_link['bid'];
- $variables['book_title'] = check_plain($book_link['link_title']);
+ $variables['book_title'] = String::checkPlain($book_link['link_title']);
$variables['book_url'] = 'node/' . $book_link['bid'];
$variables['current_depth'] = $book_link['depth'];
$variables['tree'] = '';
@@ -678,7 +679,7 @@ function template_preprocess_book_navigation(&$variables) {
'href' => $prev_href,
);
$variables['prev_url'] = $prev_href;
- $variables['prev_title'] = check_plain($prev['title']);
+ $variables['prev_title'] = String::checkPlain($prev['title']);
}
if ($book_link['plid'] && $parent = book_link_load($book_link['plid'])) {
@@ -688,7 +689,7 @@ function template_preprocess_book_navigation(&$variables) {
'href' => $parent_href,
);
$variables['parent_url'] = $parent_href;
- $variables['parent_title'] = check_plain($parent['title']);
+ $variables['parent_title'] = String::checkPlain($parent['title']);
}
if ($next = book_next($book_link)) {
@@ -698,7 +699,7 @@ function template_preprocess_book_navigation(&$variables) {
'href' => $next_href,
);
$variables['next_url'] = $next_href;
- $variables['next_title'] = check_plain($next['title']);
+ $variables['next_title'] = String::checkPlain($next['title']);
}
}
@@ -736,7 +737,7 @@ function template_preprocess_book_export_html(&$variables) {
global $base_url;
$language_interface = language(Language::TYPE_INTERFACE);
- $variables['title'] = check_plain($variables['title']);
+ $variables['title'] = String::checkPlain($variables['title']);
$variables['base_url'] = $base_url;
$variables['language'] = $language_interface;
$variables['language_rtl'] = ($language_interface->direction == Language::DIRECTION_RTL);
@@ -762,7 +763,7 @@ function template_preprocess_book_export_html(&$variables) {
*/
function template_preprocess_book_node_export_html(&$variables) {
$variables['depth'] = $variables['node']->book['depth'];
- $variables['title'] = check_plain($variables['node']->label());
+ $variables['title'] = String::checkPlain($variables['node']->label());
$variables['content'] = $variables['node']->rendered;
}
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index aaf0ba6..592b418 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -4,6 +4,7 @@
* Allows users to change the color scheme of themes.
*/
+use Drupal\Component\Utility\String;
use Drupal\Core\Asset\CssOptimizer;
/**
@@ -214,7 +215,7 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
if (isset($names[$name])) {
$form['palette'][$name] = array(
'#type' => 'textfield',
- '#title' => check_plain($names[$name]),
+ '#title' => String::checkPlain($names[$name]),
'#value_callback' => 'color_palette_color_value',
'#default_value' => $value,
'#size' => 8,
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 5d9900f..85456c5 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;
@@ -1299,7 +1300,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/contact/lib/Drupal/contact/CategoryListController.php b/core/modules/contact/lib/Drupal/contact/CategoryListController.php
index 1e62630..e68789b 100644
--- a/core/modules/contact/lib/Drupal/contact/CategoryListController.php
+++ b/core/modules/contact/lib/Drupal/contact/CategoryListController.php
@@ -6,6 +6,7 @@
namespace Drupal\contact;
+use Drupal\Component\Utility\String;
use Drupal\Core\Config\Entity\ConfigEntityListController;
use Drupal\Core\Entity\EntityInterface;
@@ -35,7 +36,7 @@ public function buildRow(EntityInterface $entity) {
$row['selected'] = t('No');
}
else {
- $row['recipients'] = check_plain(implode(', ', $entity->recipients));
+ $row['recipients'] = String::checkPlain(implode(', ', $entity->recipients));
$default_category = \Drupal::config('contact.settings')->get('default_category');
$row['selected'] = ($default_category == $entity->id() ? t('Yes') : t('No'));
}
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index e7012b6..953ecaa 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -7,6 +7,7 @@
namespace Drupal\contact;
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\ContentEntityFormController;
use Drupal\Core\Language\Language;
use Drupal\user\UserInterface;
@@ -61,12 +62,12 @@ public function form(array $form, array &$form_state) {
$form['name']['#type'] = 'item';
$form['name']['#value'] = $user->getUsername();
$form['name']['#required'] = FALSE;
- $form['name']['#markup'] = check_plain($user->getUsername());
+ $form['name']['#markup'] = String::checkPlain($user->getUsername());
$form['mail']['#type'] = 'item';
$form['mail']['#value'] = $user->getEmail();
$form['mail']['#required'] = FALSE;
- $form['mail']['#markup'] = check_plain($user->getEmail());
+ $form['mail']['#markup'] = String::checkPlain($user->getEmail());
}
// The user contact form has a preset recipient.
diff --git a/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php b/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php
index 4feeb4f..aa38a35 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php
@@ -7,6 +7,7 @@
namespace Drupal\contact;
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
@@ -28,7 +29,7 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
$entity->content['message'] = array(
'#type' => 'item',
'#title' => t('Message'),
- '#markup' => check_plain($entity->getMessage()),
+ '#markup' => String::checkPlain($entity->getMessage()),
);
}
}
diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc
index a8a88ed..13c81eb 100644
--- a/core/modules/content_translation/content_translation.admin.inc
+++ b/core/modules/content_translation/content_translation.admin.inc
@@ -5,6 +5,7 @@
* The content translation administration forms.
*/
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Language\Language;
@@ -194,10 +195,10 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
'bundle' => array(
'#prefix' => '',
'#suffix' => ' ',
- '#markup' => check_plain($element[$bundle]['settings']['#label']),
+ '#markup' => String::checkPlain($element[$bundle]['settings']['#label']),
),
'field' => array(
- '#markup' => check_plain($field_element['#label']),
+ '#markup' => String::checkPlain($field_element['#label']),
),
),
'class' => array('field'),
@@ -228,15 +229,15 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
'bundle' => array(
'#prefix' => '',
'#suffix' => ' ',
- '#markup' => check_plain($element[$bundle]['settings']['#label']),
+ '#markup' => String::checkPlain($element[$bundle]['settings']['#label']),
),
'field' => array(
'#prefix' => '',
'#suffix' => ' ',
- '#markup' => check_plain($field_element['#label']),
+ '#markup' => String::checkPlain($field_element['#label']),
),
'columns' => array(
- '#markup' => check_plain($column_label),
+ '#markup' => String::checkPlain($column_label),
),
),
'class' => array('column'),
diff --git a/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php b/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
index 2fd63ed..89ae1d9 100644
--- a/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
+++ b/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
@@ -8,6 +8,7 @@
namespace Drupal\edit;
use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\edit\Access\EditEntityFieldAccessCheckInterface;
@@ -88,7 +89,7 @@ public function generateFieldMetadata(FieldItemListInterface $items, $view_mode)
$label = $items->getFieldDefinition()->getLabel();
$editor = $this->editorManager->createInstance($editor_id);
$metadata = array(
- 'label' => check_plain($label),
+ 'label' => String::checkPlain($label),
'access' => TRUE,
'editor' => $editor_id,
'aria' => t('Entity @type @id, field @field', array('@type' => $entity->getEntityTypeId(), '@id' => $entity->id(), '@field' => $label)),
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..a67ad29 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php
@@ -184,7 +184,7 @@ public function instanceSettingsForm(array $form, array &$form_state) {
// entity type specific plugins (e.g. 'default_node', 'default_user',
// ...).
if (in_array($plugin_id, $handler_groups)) {
- $handlers_options[$plugin_id] = check_plain($plugin['label']);
+ $handlers_options[$plugin_id] = String::checkPlain($plugin['label']);
}
}
diff --git a/core/modules/entity_reference/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 e50152b..4936ca1 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..76b5a7d 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;
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(String::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 b359976..1e2e884 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..d318eb2 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -939,8 +939,8 @@ function _filter_url_parse_full_links($match) {
$i = 1;
$match[$i] = decode_entities($match[$i]);
- $caption = check_plain(_filter_url_trim($match[$i]));
- $match[$i] = check_plain($match[$i]);
+ $caption = String::checkPlain(_filter_url_trim($match[$i]));
+ $match[$i] = String::checkPlain($match[$i]);
return '' . $caption . '';
}
@@ -954,8 +954,8 @@ function _filter_url_parse_email_links($match) {
$i = 0;
$match[$i] = decode_entities($match[$i]);
- $caption = check_plain(_filter_url_trim($match[$i]));
- $match[$i] = check_plain($match[$i]);
+ $caption = String::checkPlain(_filter_url_trim($match[$i]));
+ $match[$i] = String::checkPlain($match[$i]);
return '' . $caption . '';
}
@@ -969,8 +969,8 @@ function _filter_url_parse_partial_links($match) {
$i = 1;
$match[$i] = decode_entities($match[$i]);
- $caption = check_plain(_filter_url_trim($match[$i]));
- $match[$i] = check_plain($match[$i]);
+ $caption = String::checkPlain(_filter_url_trim($match[$i]));
+ $match[$i] = String::checkPlain($match[$i]);
return '' . $caption . '';
}
@@ -1102,7 +1102,7 @@ function _filter_autop($text) {
* Escapes all HTML tags, so they will be visible instead of being effective.
*/
function _filter_html_escape($text) {
- return trim(check_plain($text));
+ return trim(String::checkPlain($text));
}
/**
diff --git a/core/modules/filter/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: