Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
6444124a
Commit
6444124a
authored
Jul 01, 2011
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added escaping to the examples in the doc
parent
89f1087a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
README.md
README.md
+2
-2
doc/intro.rst
doc/intro.rst
+2
-2
src/Silex/Application.php
src/Silex/Application.php
+2
-2
No files found.
README.md
View file @
6444124a
...
...
@@ -11,8 +11,8 @@ require_once __DIR__.'/silex.phar';
$app
=
new
Silex\Application
();
$app
->
get
(
'/hello/{name}'
,
function
(
$name
)
{
return
"Hello
$name
"
;
$app
->
get
(
'/hello/{name}'
,
function
(
$name
)
use
(
$app
)
{
return
'Hello '
.
$app
->
escape
(
$name
)
;
});
$app
->
run
();
...
...
doc/intro.rst
View file @
6444124a
...
...
@@ -26,8 +26,8 @@ step.
$app = new Silex\Application();
$app->get('/hello/{name}', function ($name) {
return
"Hello $name"
;
$app->get('/hello/{name}', function ($name)
use ($app)
{
return
'Hello '.$app->escape($name)
;
});
$app->run();
...
...
src/Silex/Application.php
View file @
6444124a
...
...
@@ -257,9 +257,9 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* @param string $text The input text to be escaped
* @return string Escaped text
*/
public
function
escape
(
$text
)
public
function
escape
(
$text
,
$flags
=
ENT_COMPAT
,
$charset
=
'UTF-8'
,
$doubleEncode
=
true
)
{
return
htmlspecialchars
(
$text
,
ENT_COMPAT
,
'UTF-8'
);
return
htmlspecialchars
(
$text
,
$flags
,
$charset
,
$doubleEncode
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment