Replace all htmlentities() calls with esc_html()
This avoids the need to explicitly specify the flags and the character set. WordPress will use predefined flags and detect the character set used by the site. Prompted by #597
This commit is contained in:
parent
60ec73fddc
commit
e39f84488e
|
|
@ -41,11 +41,11 @@ if ( !class_exists(Panel::class, false) && class_exists('Debug_Bar_Panel', false
|
||||||
echo '<h3>Configuration</h3>';
|
echo '<h3>Configuration</h3>';
|
||||||
echo '<table class="puc-debug-data">';
|
echo '<table class="puc-debug-data">';
|
||||||
$this->displayConfigHeader();
|
$this->displayConfigHeader();
|
||||||
$this->row('Slug', htmlentities($this->updateChecker->slug));
|
$this->row('Slug', esc_html($this->updateChecker->slug));
|
||||||
$this->row('DB option', htmlentities($this->updateChecker->optionName));
|
$this->row('DB option', esc_html($this->updateChecker->optionName));
|
||||||
|
|
||||||
$requestInfoButton = $this->getMetadataButton();
|
$requestInfoButton = $this->getMetadataButton();
|
||||||
$this->row('Metadata URL', htmlentities($this->updateChecker->metadataUrl) . ' ' . $requestInfoButton . $this->responseBox);
|
$this->row('Metadata URL', esc_html($this->updateChecker->metadataUrl) . ' ' . $requestInfoButton . $this->responseBox);
|
||||||
|
|
||||||
$scheduler = $this->updateChecker->scheduler;
|
$scheduler = $this->updateChecker->scheduler;
|
||||||
if ( $scheduler->checkPeriod > 0 ) {
|
if ( $scheduler->checkPeriod > 0 ) {
|
||||||
|
|
@ -115,10 +115,10 @@ if ( !class_exists(Panel::class, false) && class_exists('Debug_Bar_Panel', false
|
||||||
$this->row('Next automatic check', $this->formatTimeWithDelta($nextCheck));
|
$this->row('Next automatic check', $this->formatTimeWithDelta($nextCheck));
|
||||||
|
|
||||||
if ( $state->getCheckedVersion() !== '' ) {
|
if ( $state->getCheckedVersion() !== '' ) {
|
||||||
$this->row('Checked version', htmlentities($state->getCheckedVersion()));
|
$this->row('Checked version', esc_html($state->getCheckedVersion()));
|
||||||
$this->row('Cached update', $state->getUpdate());
|
$this->row('Cached update', $state->getUpdate());
|
||||||
}
|
}
|
||||||
$this->row('Update checker class', htmlentities(get_class($this->updateChecker)));
|
$this->row('Update checker class', esc_html(get_class($this->updateChecker)));
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,7 +132,7 @@ if ( !class_exists(Panel::class, false) && class_exists('Debug_Bar_Panel', false
|
||||||
if ( property_exists($update, $field) ) {
|
if ( property_exists($update, $field) ) {
|
||||||
$this->row(
|
$this->row(
|
||||||
ucwords(str_replace('_', ' ', $field)),
|
ucwords(str_replace('_', ' ', $field)),
|
||||||
isset($update->$field) ? htmlentities($update->$field) : null
|
isset($update->$field) ? esc_html($update->$field) : null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ if ( !class_exists(Panel::class, false) && class_exists('Debug_Bar_Panel', false
|
||||||
if ( is_object($value) || is_array($value) ) {
|
if ( is_object($value) || is_array($value) ) {
|
||||||
//This is specifically for debugging, so print_r() is fine.
|
//This is specifically for debugging, so print_r() is fine.
|
||||||
//phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
|
//phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
|
||||||
$value = '<pre>' . htmlentities(print_r($value, true)) . '</pre>';
|
$value = '<pre>' . esc_html(print_r($value, true)) . '</pre>';
|
||||||
} else if ($value === null) {
|
} else if ($value === null) {
|
||||||
$value = '<code>null</code>';
|
$value = '<code>null</code>';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ if ( !class_exists(PluginPanel::class, false) ):
|
||||||
protected $updateChecker;
|
protected $updateChecker;
|
||||||
|
|
||||||
protected function displayConfigHeader() {
|
protected function displayConfigHeader() {
|
||||||
$this->row('Plugin file', htmlentities($this->updateChecker->pluginFile));
|
$this->row('Plugin file', esc_html($this->updateChecker->pluginFile));
|
||||||
parent::displayConfigHeader();
|
parent::displayConfigHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ if ( !class_exists(ThemePanel::class, false) ):
|
||||||
protected $updateChecker;
|
protected $updateChecker;
|
||||||
|
|
||||||
protected function displayConfigHeader() {
|
protected function displayConfigHeader() {
|
||||||
$this->row('Theme directory', htmlentities($this->updateChecker->directoryName));
|
$this->row('Theme directory', esc_html($this->updateChecker->directoryName));
|
||||||
parent::displayConfigHeader();
|
parent::displayConfigHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ if ( !class_exists(PucFactory::class, false) ):
|
||||||
throw new \RuntimeException(sprintf(
|
throw new \RuntimeException(sprintf(
|
||||||
'The update checker cannot determine if "%s" is a plugin or a theme. ' .
|
'The update checker cannot determine if "%s" is a plugin or a theme. ' .
|
||||||
'This is a bug. Please contact the PUC developer.',
|
'This is a bug. Please contact the PUC developer.',
|
||||||
htmlentities($fullPath)
|
esc_html($fullPath)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ if ( !class_exists(PucFactory::class, false) ):
|
||||||
|
|
||||||
//URI was not found so throw an error.
|
//URI was not found so throw an error.
|
||||||
throw new \RuntimeException(
|
throw new \RuntimeException(
|
||||||
sprintf('Unable to locate URI in header of "%s"', htmlentities($fullPath))
|
sprintf('Unable to locate URI in header of "%s"', esc_html($fullPath))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1044,7 +1044,7 @@ if ( !class_exists(UpdateChecker::class, false) ):
|
||||||
sprintf(
|
sprintf(
|
||||||
'The directory structure of the update was incorrect. All files should be inside ' .
|
'The directory structure of the update was incorrect. All files should be inside ' .
|
||||||
'a directory named <span class="code">%s</span>, not at the root of the ZIP archive. Plugin Update Checker tried to fix the directory structure, but failed.',
|
'a directory named <span class="code">%s</span>, not at the root of the ZIP archive. Plugin Update Checker tried to fix the directory structure, but failed.',
|
||||||
htmlentities($this->slug)
|
esc_html($this->slug)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue