Commit f493700c authored by webchick's avatar webchick

Issue #2089461 by thedavidmeister, deneo, Alan D., dsdeiz, stpaultim: Convert...

Issue #2089461 by thedavidmeister, deneo, Alan D., dsdeiz, stpaultim: Convert all calls to check_plain() in core to Drupal\Component\Utility\String::checkPlain() in core/lib.
parent bcd6c63f
......@@ -964,10 +964,10 @@ function _HWLDF_WordAccumulator() {
function _flushGroup($new_tag) {
if ($this->_group !== '') {
if ($this->_tag == 'mark') {
$this->_line .= '<span class="diffchange">' . check_plain($this->_group) . '</span>';
$this->_line .= '<span class="diffchange">' . String::checkPlain($this->_group) . '</span>';
}
else {
$this->_line .= check_plain($this->_group);
$this->_line .= String::checkPlain($this->_group);
}
}
$this->_group = '';
......@@ -1191,19 +1191,19 @@ function emptyLine() {
function _added($lines) {
foreach ($lines as $line) {
$this->rows[] = array_merge($this->emptyLine(), $this->addedLine(check_plain($line)));
$this->rows[] = array_merge($this->emptyLine(), $this->addedLine(String::checkPlain($line)));
}
}
function _deleted($lines) {
foreach ($lines as $line) {
$this->rows[] = array_merge($this->deletedLine(check_plain($line)), $this->emptyLine());
$this->rows[] = array_merge($this->deletedLine(String::checkPlain($line)), $this->emptyLine());
}
}
function _context($lines) {
foreach ($lines as $line) {
$this->rows[] = array_merge($this->contextLine(check_plain($line)), $this->contextLine(check_plain($line)));
$this->rows[] = array_merge($this->contextLine(String::checkPlain($line)), $this->contextLine(String::checkPlain($line)));
}
}
......
......@@ -88,7 +88,8 @@ public static function filter($string, $allowed_tags = array('a', 'em', 'strong'
*
* Use only for fields where it is impractical to use the
* whole filter system, but where some (mainly inline) mark-up
* is desired (so check_plain() is not acceptable).
* is desired (so \Drupal\Component\Utility\String::checkPlain() is
* not acceptable).
*
* Allows all tags that can be used inside an HTML body, save
* for scripts and styles.
......
......@@ -13,6 +13,7 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Drupal\Component\Utility\String;
use Drupal\Core\ContentNegotiation;
......@@ -136,7 +137,7 @@ public function on403Html(FlattenException $exception, Request $request) {
* The request object that triggered this exception.
*/
public function on404Html(FlattenException $exception, Request $request) {
watchdog('page not found', check_plain($request->attributes->get('_system_path')), NULL, WATCHDOG_WARNING);
watchdog('page not found', String::checkPlain($request->attributes->get('_system_path')), NULL, WATCHDOG_WARNING);
// Check for and return a fast 404 page if configured.
$config = \Drupal::config('system.performance');
......@@ -146,7 +147,7 @@ public function on404Html(FlattenException $exception, Request $request) {
$fast_paths = $config->get('fast_404.paths');
if ($fast_paths && preg_match($fast_paths, $request->getPathInfo())) {
$fast_404_html = $config->get('fast_404.html');
$fast_404_html = strtr($fast_404_html, array('@path' => check_plain($request->getUri())));
$fast_404_html = strtr($fast_404_html, array('@path' => String::checkPlain($request->getUri())));
return new Response($fast_404_html, 404);
}
}
......@@ -353,7 +354,7 @@ protected function decodeException(FlattenException $exception) {
'%type' => $exception->getClass(),
// The standard PHP exception handler considers that the exception message
// is plain-text. We mimick this behavior here.
'!message' => check_plain($message),
'!message' => String::checkPlain($message),
'%function' => $caller['function'],
'%file' => $caller['file'],
'%line' => $caller['line'],
......
......@@ -7,6 +7,7 @@
namespace Drupal\Core\Entity;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\Plugin\DataType\EntityReference;
use Drupal\Core\Language\Language;
use Drupal\Core\Session\AccountInterface;
......@@ -395,7 +396,7 @@ protected function getTranslatedField($name, $langcode) {
if (!isset($this->fields[$name][$langcode])) {
$definition = $this->getPropertyDefinition($name);
if (!$definition) {
throw new \InvalidArgumentException('Field ' . check_plain($name) . ' is unknown.');
throw new \InvalidArgumentException('Field ' . String::checkPlain($name) . ' is unknown.');
}
// Non-translatable fields are always stored with
// Language::LANGCODE_DEFAULT as key.
......
......@@ -120,7 +120,8 @@ public function getPreferredAdminLangcode($default = NULL);
*
* @return
* An unsanitized string with the username to display. The code receiving
* this result must ensure that check_plain() is called on it before it is
* this result must ensure that \Drupal\Component\Utility\String::checkPlain()
* is called on it before it is
* printed to the page.
*/
public function getUsername();
......
......@@ -8,6 +8,7 @@
namespace Drupal\Core\TypedData;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\Component\Utility\String;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManager;
......@@ -218,7 +219,7 @@ public function getPropertyInstance(TypedDataInterface $object, $property_name,
}
// Make sure we have got a valid definition.
if (!$definition) {
throw new \InvalidArgumentException('Property ' . check_plain($property_name) . ' is unknown.');
throw new \InvalidArgumentException('Property ' . String::checkPlain($property_name) . ' is unknown.');
}
// Now create the prototype using the definition, but do not pass the
// given value as it will serve as prototype for any further instance.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment