Skip to content

Commit

Permalink
add option for double encode
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 5, 2018
1 parent 74a8738 commit 61f8477
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,15 +568,16 @@ function dd(...$args)
* Escape HTML special characters in a string.
*
* @param \Illuminate\Contracts\Support\Htmlable|string $value
* @param bool $doubleEncode
* @return string
*/
function e($value)
function e($value, $doubleEncode = false)
{
if ($value instanceof Htmlable) {
return $value->toHtml();
}

return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode);
}
}

Expand Down

1 comment on commit 61f8477

@reinink
Copy link
Contributor

@reinink reinink commented on 61f8477 Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taylorotwell ❤️

Please sign in to comment.