1

My question originates from this post: Using Laravel 4's Input class outside the framework

At the moment, when I post some JS, the JS is executed when I print the input to the screen.

Right now I use:

$post = Input::createFromGlobals();

I would like to know how I can filter the user input. Is this something I have to do manually, or with some other class?

Community
  • 1
  • 1
Meddie
  • 571
  • 1
  • 7
  • 22
  • 1
    While I don't know the answer to your question, I should mention that the ``createFromGlobals`` method actually comes from ``Symfony\Component\HttpFoundation\Request`` and not from Laravel in itself. I've added a tag to reflect this. Hope you get the answer from somebody! – Joel Hinz Jun 05 '14 at 13:51

1 Answers1

1

You'll have to do this manually. Laravel support helpers provides function e which will run the input through htmlentities and escape html tags.

If you dont want to use illuminate/support package then you can manually send the input through htmlentities function.

Here is the method from Illuminate/Support helper.php file:

function e($value)
{
    return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
}
Gufran
  • 747
  • 6
  • 14