@@ -201,15 +201,15 @@ protected static function buildFormOpen(string $options): string
201201 $ input .= "\n" .static ::$ indent .' @if (strtoupper( ' .$ method .') !== \'GET \') ' ;
202202 $ input .= "\n" .static ::$ indent .' @csrf ' ;
203203 $ input .= "\n" .static ::$ indent .' @if (strtoupper( ' .$ method .') !== \'POST \') ' ;
204- $ input .= "\n" .static ::$ indent .' @method ( ' .$ method .') ' ;
204+ $ input .= "\n" .static ::$ indent .' @method( ' .$ method .') ' ;
205205 $ input .= "\n" .static ::$ indent .' @endif ' ;
206206 $ input .= "\n" .static ::$ indent .' @endif ' ;
207207
208208 } elseif ($ method !== 'GET ' ) {
209209 $ input .= "\n" .static ::$ indent .' @csrf ' ;
210210
211211 if ($ method !== 'POST ' ) {
212- $ input .= "\n" .static ::$ indent .' @method ( \'' .$ method .'\') ' ;
212+ $ input .= "\n" .static ::$ indent .' @method( \'' .$ method .'\') ' ;
213213 }
214214 }
215215
@@ -366,9 +366,9 @@ protected static function buildSelect(string $name, string $list, string $select
366366 $ input .= $ placeholderOption ;
367367 $ input .= static ::$ indent .' @foreach ( ' .$ list .' as $optionValue => $optionText) ' ."\n" ;
368368 $ input .= static ::$ indent .' <option ' ."\n" ;
369- $ input .= static ::$ indent .' value="{!! e( $optionValue, false) !!} " ' ."\n" ;
370- $ input .= static ::$ indent .' @selected (in_array($optionValue, (array) ( ' .static ::withOldHelperIfNeeded ($ name , $ selectedValue ).'))) ' ."\n" ;
371- $ input .= static ::$ indent .' >{!! e( $optionText, false) !!} </option> ' ."\n" ;
369+ $ input .= static ::$ indent .' value=" ' . static :: escapedEcho ( ' $optionValue ' ). ' " ' ."\n" ;
370+ $ input .= static ::$ indent .' @selected(in_array($optionValue, (array) ( ' .static ::withOldHelperIfNeeded ($ name , $ selectedValue ).'))) ' ."\n" ;
371+ $ input .= static ::$ indent .' > ' . static :: escapedEcho ( ' $optionText ' ). ' </option> ' ."\n" ;
372372 $ input .= static ::$ indent .' @endforeach ' ."\n" ;
373373 $ input .= static ::$ indent .'</select> ' ;
374374
@@ -432,7 +432,7 @@ protected static function buildHtmlTagAttributes(array $attributes): string
432432 } elseif ($ attrName === 'multiple ' ) {
433433 $ attr = '@if ( ' .$ attrValue .') multiple @endif ' ;
434434 } else {
435- $ attr = '@ ' .$ attrName .' ( ' .$ attrValue .') ' ;
435+ $ attr = '@ ' .$ attrName .'( ' .$ attrValue .') ' ;
436436 }
437437
438438 } elseif ($ attrName === 'class ' && preg_match ('/^\s*(\[\s*.*\s*\])\s*$/Us ' , $ attrValue , $ matches )) {
@@ -461,6 +461,15 @@ protected static function isEmpty(string $value): bool
461461 return \in_array (strtolower ($ value ), ['' , "'' " , '"" ' , 'false ' , 'null ' ]);
462462 }
463463
464+ protected static function escapedEcho (string $ value ): string
465+ {
466+ if (static ::$ escapeWithoutDoubleEncode ) {
467+ return '{!! e( ' .$ value .', false) !!} ' ;
468+ }
469+
470+ return '{{ ' .$ value .' }} ' ;
471+ }
472+
464473 /**
465474 * Examples:
466475 *
@@ -492,11 +501,7 @@ protected static function withEchoIfNeeded(string $value, bool $escape): string
492501 }
493502
494503 if ($ escape ) {
495- if (static ::$ escapeWithoutDoubleEncode ) {
496- return '{!! e( ' .$ value .', false) !!} ' ;
497- }
498-
499- return '{{ ' .$ value .' }} ' ;
504+ return static ::escapedEcho ($ value );
500505 }
501506
502507 return '{!! ' .$ value .' !!} ' ;
0 commit comments