diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
index fd70314..e319ab1 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
@@ -169,7 +169,7 @@ public function isOptional() {
*/
public function adminLabel($short = FALSE) {
if (!empty($this->options['admin_label'])) {
- $title = check_plain($this->options['admin_label']);
+ $title = String::checkPlain($this->options['admin_label']);
return $title;
}
$title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title'];
@@ -216,7 +216,7 @@ public function getField($field = NULL) {
* @param $value
* The value being rendered.
* @param $type
- * The type of sanitization needed. If not provided, check_plain() is used.
+ * The type of sanitization needed. If not provided, String::checkPlain() is used.
*
* @return string
* Returns the safe value.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
index 3d77633..087c9ab 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views;
+use Drupal\Component\Utility\String;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginBase as ComponentPluginBase;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
@@ -266,9 +267,9 @@ public function summaryTitle() {
public function pluginTitle() {
// Short_title is optional so its defaults to an empty string.
if (!empty($this->definition['short_title'])) {
- return check_plain($this->definition['short_title']);
+ return String::checkPlain($this->definition['short_title']);
}
- return check_plain($this->definition['title']);
+ return String::checkPlain($this->definition['title']);
}
/**
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
index de8a22f..fc68703 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\argument;
+use Drupal\Component\Utility\String as UtilityString;
use Drupal\views\Plugin\views\PluginBase;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
@@ -864,7 +865,7 @@ public function summaryName($data) {
if (empty($value) && !empty($this->definition['empty field name'])) {
$value = $this->definition['empty field name'];
}
- return check_plain($value);
+ return UtilityString::checkPlain($value);
}
/**
@@ -883,7 +884,7 @@ public function query($group_by = FALSE) {
* This usually needs to be overridden to provide a proper title.
*/
function title() {
- return check_plain($this->argument);
+ return UtilityString::checkPlain($this->argument);
}
/**
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
index 88266d1..a2dd29b 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
@@ -284,7 +284,7 @@ function title() {
* Override for specific title lookups.
*/
public function titleQuery() {
- return drupal_map_assoc($this->value, 'check_plain');
+ return drupal_map_assoc($this->value, '\Drupal\Component\Utility\String::checkPlain');
}
public function summaryName($data) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
index bd62f35..9673e55 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\display;
+use Drupal\Component\Utility\String;
use Drupal\views\ViewExecutable;
/**
@@ -90,7 +91,7 @@ public function optionsSummary(&$categories, &$options) {
elseif (count($displays) == 1) {
$display = array_shift($displays);
if ($display = $this->view->storage->getDisplay($display)) {
- $attach_to = check_plain($display['display_title']);
+ $attach_to = String::checkPlain($display['display_title']);
}
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index e371f7d..bd2ad68 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -1042,7 +1042,7 @@ public function getArgumentsTokens() {
}
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
- // were removed by check_plain().
+ // were removed by String::checkPlain().
$tokens["!$count"] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
}
@@ -1103,12 +1103,12 @@ public function optionsSummary(&$categories, &$options) {
$options['display_id'] = array(
'category' => 'other',
'title' => t('Machine Name'),
- 'value' => !empty($this->display['new_id']) ? check_plain($this->display['new_id']) : check_plain($this->display['id']),
+ 'value' => !empty($this->display['new_id']) ? String::checkPlain($this->display['new_id']) : String::checkPlain($this->display['id']),
'desc' => t('Change the machine name of this display.'),
);
}
- $display_comment = check_plain(drupal_substr($this->getOption('display_comment'), 0, 10));
+ $display_comment = String::checkPlain(drupal_substr($this->getOption('display_comment'), 0, 10));
$options['display_comment'] = array(
'category' => 'other',
'title' => t('Administrative comment'),
@@ -1349,7 +1349,7 @@ public function optionsSummary(&$categories, &$options) {
$options['exposed_form']['links']['exposed_form_options'] = t('Exposed form settings for this exposed form style.');
}
- $css_class = check_plain(trim($this->getOption('css_class')));
+ $css_class = String::checkPlain(trim($this->getOption('css_class')));
if (!$css_class) {
$css_class = t('None');
}
@@ -1381,7 +1381,7 @@ public function buildOptionsForm(&$form, &$form_state) {
if ($this->defaultableSections($form_state['section'])) {
views_ui_standard_display_dropdown($form, $form_state, $form_state['section']);
}
- $form['#title'] = check_plain($this->display['display_title']) . ': ';
+ $form['#title'] = String::checkPlain($this->display['display_title']) . ': ';
// Set the 'section' to hilite on the form.
// If it's the item we're looking at is pulling from the default display,
@@ -1904,7 +1904,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
else {
$output .= '
' . t('This is the default theme template used for this display.') . '
';
- $output .= '' . check_plain(file_get_contents('./' . $this->definition['theme_path'] . '/' . strtr($this->definition['theme'], '_', '-') . '.tpl.php')) . '
';
+ $output .= '' . String::checkPlain(file_get_contents('./' . $this->definition['theme_path'] . '/' . strtr($this->definition['theme'], '_', '-') . '.tpl.php')) . '
';
}
$form['analysis'] = array(
@@ -1924,7 +1924,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
else {
$output .= '' . t('This is the default theme template used for this style.') . '
';
- $output .= '' . check_plain(file_get_contents('./' . $plugin->definition['theme_path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
';
+ $output .= '' . String::checkPlain(file_get_contents('./' . $plugin->definition['theme_path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
';
}
$form['analysis'] = array(
@@ -1944,7 +1944,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
else {
$output .= '' . t('This is the default theme template used for this row style.') . '
';
- $output .= '' . check_plain(file_get_contents('./' . $plugin->definition['theme_path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
';
+ $output .= '' . String::checkPlain(file_get_contents('./' . $plugin->definition['theme_path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
';
}
$form['analysis'] = array(
@@ -1961,7 +1961,7 @@ public function buildOptionsForm(&$form, &$form_state) {
// Field templates aren't registered the normal way...and they're always
// this one, anyhow.
- $output .= '' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/templates/views-view-field.tpl.php')) . '
';
+ $output .= '' . String::checkPlain(file_get_contents(drupal_get_path('module', 'views') . '/templates/views-view-field.tpl.php')) . '
';
$form['analysis'] = array(
'#markup' => '' . $output . '
',
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
index ddcc1fa..d50e976 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
@@ -174,7 +174,7 @@ public function optionsSummary(&$categories, &$options) {
$display = array_shift($displays);
$displays = $this->view->storage->get('display');
if (!empty($displays[$display])) {
- $attach_to = check_plain($displays[$display]['display_title']);
+ $attach_to = String::checkPlain($displays[$display]['display_title']);
}
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
index f917ca5..28c55cf 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\exposed_form;
+use Drupal\Component\Utility\String;
use Drupal\views\Form\ViewsExposedForm;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
@@ -199,7 +200,7 @@ public function exposedFormAlter(&$form, &$form_state) {
$exposed_sorts = array();
foreach ($this->view->sort as $id => $handler) {
if ($handler->canExpose() && $handler->isExposed()) {
- $exposed_sorts[$id] = check_plain($handler->options['expose']['label']);
+ $exposed_sorts[$id] = String::checkPlain($handler->options['expose']['label']);
}
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
index db4a5d8..1a58bb3 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\field;
+use Drupal\Component\Utility\String;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ResultRow;
@@ -206,7 +207,7 @@ public function elementType($none_supported = FALSE, $default_empty = FALSE, $in
}
}
if ($this->options['element_type']) {
- return check_plain($this->options['element_type']);
+ return String::checkPlain($this->options['element_type']);
}
if ($default_empty) {
@@ -234,7 +235,7 @@ public function elementLabelType($none_supported = FALSE, $default_empty = FALSE
}
}
if ($this->options['element_label_type']) {
- return check_plain($this->options['element_label_type']);
+ return String::checkPlain($this->options['element_label_type']);
}
if ($default_empty) {
@@ -254,7 +255,7 @@ public function elementWrapperType($none_supported = FALSE, $default_empty = FAL
}
}
if ($this->options['element_wrapper_type']) {
- return check_plain($this->options['element_wrapper_type']);
+ return String::checkPlain($this->options['element_wrapper_type']);
}
if ($default_empty) {
@@ -1329,7 +1330,7 @@ protected function renderAsLink($alter, $text, $tokens) {
if ($path != '') {
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
- // were removed by check_plain().
+ // were removed by String::checkPlain().
$path = strip_tags(decode_entities(strtr($path, $tokens)));
if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
@@ -1405,7 +1406,7 @@ protected function renderAsLink($alter, $text, $tokens) {
$options['attributes']['rel'] = $rel;
}
- $target = check_plain(trim(strtr($alter['target'], $tokens)));
+ $target = String::checkPlain(trim(strtr($alter['target'], $tokens)));
if (!empty($target)) {
$options['attributes']['target'] = $target;
}
@@ -1480,7 +1481,7 @@ public function getRenderTokens($item) {
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
- // were removed by check_plain().
+ // were removed by String::checkPlain().
$tokens['!' . $count] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php
index 8117e7a..0ed3610 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\field;
+use Drupal\Component\Utility\String;
use Drupal\views\ResultRow;
/**
@@ -72,7 +73,7 @@ public function preRender(&$values) {
public function render(ResultRow $values) {
$value = $values->{$this->field_alias};
if (!empty($this->options['machine_name']) || !isset($this->valueOptions[$value])) {
- $result = check_plain($value);
+ $result = String::checkPlain($value);
}
else {
$result = $this->valueOptions[$value];
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php
index 9d541fd..cf11cb7 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\field;
+use Drupal\Component\Utility\String;
use Drupal\views\ResultRow;
/**
@@ -66,11 +67,11 @@ public function render(ResultRow $values) {
$value = $values->{$this->field_alias};
if ($this->options['format'] == 'unserialized') {
- return check_plain(print_r(unserialize($value), TRUE));
+ return String::checkPlain(print_r(unserialize($value), TRUE));
}
elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
$value = (array) unserialize($value);
- return check_plain($value[$this->options['key']]);
+ return String::checkPlain($value[$this->options['key']]);
}
return $value;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
index 9e94d24..042b8a0 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
@@ -8,7 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\views\Plugin\views\HandlerBase;
-use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\String as UtilityString;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
@@ -163,7 +163,7 @@ protected function defineOptions() {
* Display the filter on the administrative summary
*/
public function adminSummary() {
- return check_plain((string) $this->operator) . ' ' . check_plain((string) $this->value);
+ return UtilityString::checkPlain((string) $this->operator) . ' ' . UtilityString::checkPlain((string) $this->value);
}
/**
@@ -574,7 +574,7 @@ public function buildExposeForm(&$form, &$form_state) {
'#default_value' => $this->options['expose']['remember'],
);
- $role_options = array_map('check_plain', user_role_names());
+ $role_options = array_map('\Drupal\Component\Utility\String::checkPlain', user_role_names());
$form['expose']['remember_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('User roles'),
@@ -745,7 +745,7 @@ public function groupForm(&$form, &$form_state) {
$value = $this->options['group_info']['identifier'];
$form[$value] = array(
- '#title' => String::checkPlain($this->options['group_info']['label']),
+ '#title' => UtilityString::checkPlain($this->options['group_info']['label']),
'#type' => $this->options['group_info']['widget'],
'#default_value' => $this->group_info,
'#options' => $groups,
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php
index 84d8723..75b40fd 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\filter;
+use Drupal\Component\Utility\String as UtilityString;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
@@ -321,7 +322,7 @@ public function adminSummary() {
return;
}
- $operator = check_plain($info[$this->operator]['short']);
+ $operator = UtilityString::checkPlain($info[$this->operator]['short']);
$values = '';
if (in_array($this->operator, $this->operatorValues(1))) {
// Remove every element which is not known.
@@ -337,13 +338,13 @@ public function adminSummary() {
else if (count($this->value) == 1) {
// If any, use the 'single' short name of the operator instead.
if (isset($info[$this->operator]['short_single'])) {
- $operator = check_plain($info[$this->operator]['short_single']);
+ $operator = UtilityString::checkPlain($info[$this->operator]['short_single']);
}
$keys = $this->value;
$value = array_shift($keys);
if (isset($this->value_options[$value])) {
- $values = check_plain($this->value_options[$value]);
+ $values = UtilityString::checkPlain($this->value_options[$value]);
}
else {
$values = '';
@@ -359,7 +360,7 @@ public function adminSummary() {
break;
}
if (isset($this->value_options[$value])) {
- $values .= check_plain($this->value_options[$value]);
+ $values .= UtilityString::checkPlain($this->value_options[$value]);
}
}
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/Numeric.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/Numeric.php
index 18590d3..230a7de 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/Numeric.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/Numeric.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\filter;
+use Drupal\Component\Utility\String as UtilityString;
use Drupal\Core\Database\Database;
/**
@@ -287,12 +288,12 @@ public function adminSummary() {
}
$options = $this->operatorOptions('short');
- $output = check_plain($options[$this->operator]);
+ $output = UtilityString::checkPlain($options[$this->operator]);
if (in_array($this->operator, $this->operatorValues(2))) {
$output .= ' ' . t('@min and @max', array('@min' => $this->value['min'], '@max' => $this->value['max']));
}
elseif (in_array($this->operator, $this->operatorValues(1))) {
- $output .= ' ' . check_plain($this->value['value']);
+ $output .= ' ' . UtilityString::checkPlain($this->value['value']);
}
return $output;
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/String.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/String.php
index 3c6735e..ec66ec2 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/String.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/String.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\filter;
+use Drupal\Component\Utility\String as UtilityString;
use Drupal\Core\Database\Database;
/**
@@ -160,10 +161,10 @@ public function adminSummary() {
$options = $this->operatorOptions('short');
$output = '';
if (!empty($options[$this->operator])) {
- $output = check_plain($options[$this->operator]);
+ $output = UtilityString::checkPlain($options[$this->operator]);
}
if (in_array($this->operator, $this->operatorValues(1))) {
- $output .= ' ' . check_plain($this->value);
+ $output .= ' ' . UtilityString::checkPlain($this->value);
}
return $output;
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php
index dab155d..401c977 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\row;
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
@@ -133,7 +134,7 @@ protected function buildViewModeOptions() {
public function summaryTitle() {
$options = $this->buildViewModeOptions();
if (isset($options[$this->options['view_mode']])) {
- return check_plain($options[$this->options['view_mode']]);
+ return String::checkPlain($options[$this->options['view_mode']]);
}
else {
return t('No view mode selected');
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php
index df73f40..6dd5575 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php
@@ -7,6 +7,7 @@
namespace Drupal\views\Tests;
+use Drupal\Component\Utility\String;
use Drupal\views\Tests\ViewTestBase;
use Drupal\Core\Language\Language;
@@ -82,7 +83,7 @@ public function testTaxonomyAutocomplete() {
$label = $this->term1->label();
$expected = array(array(
'value' => $label,
- 'label' => check_plain($label),
+ 'label' => String::checkPlain($label),
));
$this->assertIdentical($expected, $this->drupalGetJSON($base_autocomplete_path, array('query' => array('q' => $label))));
// Test a term by partial name.
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 1959cd8..1cd9faa 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -1128,7 +1128,7 @@ function views_get_view_result($name, $display_id = NULL) {
}
/**
- * #process callback to see if we need to check_plain() the options.
+ * #process callback to see if we need to String::checkPlain() the options.
*
* Since FAPI is inconsistent, the #options are sanitized for you in all cases
* _except_ checkboxes. We have form elements that are sometimes 'select' and
@@ -1138,7 +1138,7 @@ function views_get_view_result($name, $display_id = NULL) {
*/
function views_process_check_options($element, &$form_state) {
if ($element['#type'] == 'checkboxes' || $element['#type'] == 'checkbox') {
- $element['#options'] = array_map('check_plain', $element['#options']);
+ $element['#options'] = array_map('\Drupal\Component\Utility\String::checkPlain', $element['#options']);
}
return $element;
}
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index 6c6cd0a..0185cdf 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -5,6 +5,7 @@
* Preprocessors and helper functions to make theming easier.
*/
+use Drupal\Component\Utility\String;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Language\Language;
use Drupal\Core\Template\Attribute;
@@ -114,8 +115,8 @@ function template_preprocess_views_view(&$variables) {
'views_dom_id:' . $variables['dom_id'] => array(
'view_name' => $view->storage->id(),
'view_display_id' => $view->current_display,
- 'view_args' => check_plain(implode('/', $view->args)),
- 'view_path' => check_plain(current_path()),
+ 'view_args' => String::checkPlain(implode('/', $view->args)),
+ 'view_path' => String::checkPlain(current_path()),
'view_base_path' => $view->getPath(),
'view_dom_id' => $variables['dom_id'],
// To fit multiple views on a page, the programmer may have
@@ -254,7 +255,7 @@ function template_preprocess_views_view_fields(&$variables) {
// Set up the label for the value and the HTML to make it easier
// on the template.
- $object->label = check_plain($view->field[$id]->label());
+ $object->label = String::checkPlain($view->field[$id]->label());
$object->label_html = '';
if ($object->label) {
$object->label_html .= $object->label;
@@ -541,7 +542,7 @@ function template_preprocess_views_view_table(&$variables) {
// Render the header labels.
if ($field == $column && empty($fields[$field]->options['exclude'])) {
- $label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : '');
+ $label = String::checkPlain(!empty($fields[$field]) ? $fields[$field]->label() : '');
if (empty($options['info'][$field]['sortable']) || !$fields[$field]->clickSortable()) {
$variables['header'][$field]['content'] = $label;
}
@@ -973,7 +974,7 @@ function template_preprocess_views_view_rss(&$variables) {
// The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
// We strip all HTML tags, but need to prevent double encoding from properly
// escaped source data (such as & becoming &).
- $variables['description'] = check_plain(decode_entities(strip_tags($style->getDescription())));
+ $variables['description'] = String::checkPlain(decode_entities(strip_tags($style->getDescription())));
if ($view->display_handler->getOption('sitename_title')) {
$title = $config->get('name');
@@ -984,7 +985,7 @@ function template_preprocess_views_view_rss(&$variables) {
else {
$title = $view->getTitle();
}
- $variables['title'] = check_plain($title);
+ $variables['title'] = String::checkPlain($title);
// Figure out which display which has a path we're using for this feed. If
// there isn't one, use the global $base_url
@@ -1009,7 +1010,7 @@ function template_preprocess_views_view_rss(&$variables) {
$variables['link'] = check_url(url($path, $url_options));
}
- $variables['langcode'] = check_plain(language(Language::TYPE_INTERFACE)->id);
+ $variables['langcode'] = String::checkPlain(language(Language::TYPE_INTERFACE)->id);
$variables['namespaces'] = new Attribute($style->namespaces);
$variables['items'] = $items;
$variables['channel_elements'] = format_xml_elements($style->channel_elements);
@@ -1033,9 +1034,9 @@ function template_preprocess_views_view_rss(&$variables) {
function template_preprocess_views_view_row_rss(&$variables) {
$item = $variables['row'];
- $variables['title'] = check_plain($item->title);
+ $variables['title'] = String::checkPlain($item->title);
$variables['link'] = check_url($item->link);
- $variables['description'] = check_plain($item->description);
+ $variables['description'] = String::checkPlain($item->description);
$variables['item_elements'] = empty($item->elements) ? '' : format_xml_elements($item->elements);
}
diff --git a/core/modules/views/views.tokens.inc b/core/modules/views/views.tokens.inc
index bb198eb..f6e2539 100644
--- a/core/modules/views/views.tokens.inc
+++ b/core/modules/views/views.tokens.inc
@@ -5,6 +5,8 @@
* Token integration for the views module.
*/
+use Drupal\Component\Utility\String;
+
/**
* Implements hook_token_info().
*/
@@ -83,11 +85,11 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
foreach ($tokens as $name => $original) {
switch ($name) {
case 'label':
- $replacements[$original] = $sanitize ? check_plain($view->storage->label()) : $view->storage->label();
+ $replacements[$original] = $sanitize ? String::checkPlain($view->storage->label()) : $view->storage->label();
break;
case 'description':
- $replacements[$original] = $sanitize ? check_plain($view->storage->get('description')) : $view->storage->get('description');
+ $replacements[$original] = $sanitize ? String::checkPlain($view->storage->get('description')) : $view->storage->get('description');
break;
case 'id':
@@ -96,7 +98,7 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
case 'title':
$title = $view->getTitle();
- $replacements[$original] = $sanitize ? check_plain($title) : $title;
+ $replacements[$original] = $sanitize ? String::checkPlain($title) : $title;
break;
case 'url':
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php b/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php
index 1e3575d..f7548be 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php
@@ -7,6 +7,7 @@
namespace Drupal\views_ui\Controller;
+use Drupal\Component\Utility\String;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\views\ViewExecutable;
@@ -98,7 +99,7 @@ public function reportFields() {
$header = array(t('Field name'), t('Used in'));
$rows = array();
foreach ($fields as $field_name => $views) {
- $rows[$field_name]['data'][0] = check_plain($field_name);
+ $rows[$field_name]['data'][0] = String::checkPlain($field_name);
foreach ($views as $view) {
$rows[$field_name]['data'][1][] = $this->l($view, 'views_ui.edit', array('view' => $view));
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
index 4c7ea95..b07663b 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
@@ -11,6 +11,7 @@
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\String;
use Drupal\user\TempStoreFactory;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -469,7 +470,7 @@ public function getDisplayDetails($view, $display) {
$build['top']['display_title'] = array(
'#theme' => 'views_ui_display_tab_setting',
'#description' => $this->t('Display name'),
- '#link' => $view->getExecutable()->displayHandlers->get($display['id'])->optionLink(check_plain($display_title), 'display_title'),
+ '#link' => $view->getExecutable()->displayHandlers->get($display['id'])->optionLink(String::checkPlain($display_title), 'display_title'),
);
}
@@ -1038,7 +1039,7 @@ public function getFormBucket(ViewUI $view, $type, $display) {
continue;
}
- $field_name = check_plain($handler->adminLabel(TRUE));
+ $field_name = String::checkPlain($handler->adminLabel(TRUE));
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$field_name = '(' . $relationships[$field['relationship']] . ') ' . $field_name;
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index b63b76d..965f676 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -7,6 +7,7 @@
namespace Drupal\views_ui;
+use Drupal\Component\Utility\String;
use Drupal\Component\Utility\Timer;
use Drupal\views\Views;
use Drupal\Core\Entity\EntityStorageControllerInterface;
@@ -654,7 +655,7 @@ public function renderPreview($display_id, $args = array()) {
}
}
}
- $rows['query'][] = array('' . t('Query') . '', '' . check_plain(strtr($query_string, $quoted)) . '
');
+ $rows['query'][] = array('' . t('Query') . '', '' . String::checkPlain(strtr($query_string, $quoted)) . '
');
if (!empty($this->additionalQueries)) {
$queries = '' . t('These queries were run during view rendering:') . '';
foreach ($this->additionalQueries as $query) {