Skip to content

Commit 11d7183

Browse files
committed
Reverse behavior of "Escaped echo without double-encode" (WIP)
1 parent 701e458 commit 11d7183

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Console/RunCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class RunCommand extends Command
1010
{
1111
protected $signature = 'laravelcollective-form-to-raw-html:run
1212
{target=resources/views : Target path to scan (directory or single file relative to the project root)}
13-
{--escape-with-double-encode : Use regular Blade echo syntax instead of the one without double-encode (see README for more info)}';
13+
{--escape-without-double-encode : Use without double-encode instead of regular Blade echo syntax (see README for more info)}';
1414

1515
protected $description = 'Replaces LaravelCollective `Form::` syntax by raw HTML';
1616

@@ -44,7 +44,7 @@ public function handle(): int
4444

4545
$files = iterator_to_array($finder, false);
4646

47-
Converter::$escapeWithDoubleEncode = $this->option('escape-with-double-encode');
47+
Converter::$escapeWithoutDoubleEncode = $this->option('escape-without-double-encode');
4848

4949
$nbReplacements = Converter::execute($files);
5050

src/Converter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Converter
1010

1111
public const CHECK_OPTIONS_TAG = '@TODO CHECK OPTIONS';
1212

13-
public static bool $escapeWithDoubleEncode = false;
13+
public static bool $escapeWithoutDoubleEncode = false;
1414

1515
protected static string $indent = '';
1616

@@ -477,11 +477,11 @@ protected static function withEchoIfNeeded(string $value, bool $escape): string
477477
}
478478

479479
if ($escape) {
480-
if (static::$escapeWithDoubleEncode) {
481-
return '{{ '.$value.' }}';
480+
if (static::$escapeWithoutDoubleEncode) {
481+
return '{!! e('.$value.', false) !!}';
482482
}
483483

484-
return '{!! e('.$value.', false) !!}';
484+
return '{{ '.$value.' }}';
485485
}
486486

487487
return '{!! '.$value.' !!}';

0 commit comments

Comments
 (0)