mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Better name for testing safe mode and strict mode state
Add a nice named constructor
This commit is contained in:
@@ -78,7 +78,7 @@ final class Comment implements ContinuableBlock
|
||||
return new Handler(
|
||||
/** @return Text|RawHtml */
|
||||
function (State $State) {
|
||||
if ($State->getOrDefault(SafeMode::class)->enabled()) {
|
||||
if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
|
||||
return new Text($this->html);
|
||||
} else {
|
||||
return new RawHtml($this->html);
|
||||
|
||||
@@ -56,7 +56,7 @@ final class Header implements Block
|
||||
|
||||
$StrictMode = $State->getOrDefault(StrictMode::class);
|
||||
|
||||
if ($StrictMode->enabled() && isset($text[0]) and $text[0] !== ' ') {
|
||||
if ($StrictMode->isEnabled() && isset($text[0]) and $text[0] !== ' ') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ final class Markup implements ContinuableBlock
|
||||
function (State $State) {
|
||||
$SafeMode = $State->getOrDefault(SafeMode::class);
|
||||
|
||||
if ($SafeMode->enabled()) {
|
||||
if ($SafeMode->isEnabled()) {
|
||||
return new Element('p', [], [new Text($this->html)]);
|
||||
} else {
|
||||
return new RawHtml($this->html);
|
||||
|
||||
@@ -83,7 +83,7 @@ final class Image implements Inline
|
||||
$attributes['title'] = $title;
|
||||
}
|
||||
|
||||
if ($State->getOrDefault(SafeMode::class)->enabled()) {
|
||||
if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
|
||||
$attributes['src'] = Element::filterUnsafeUrl($attributes['src']);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ final class Link implements Inline
|
||||
$attributes['title'] = $this->title;
|
||||
}
|
||||
|
||||
if ($State->getOrDefault(SafeMode::class)->enabled()) {
|
||||
if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
|
||||
$attributes['href'] = Element::filterUnsafeUrl($attributes['href']);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ final class Markup implements Inline
|
||||
function (State $State) {
|
||||
$SafeMode = $State->getOrDefault(SafeMode::class);
|
||||
|
||||
if ($SafeMode->enabled()) {
|
||||
if ($SafeMode->isEnabled()) {
|
||||
return new Text($this->html);
|
||||
} else {
|
||||
return new RawHtml($this->html);
|
||||
|
||||
Reference in New Issue
Block a user