Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
8ff052cb
Commit
8ff052cb
authored
Dec 03, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1180 from unikent/master
Performance enhancement for HTML Class.
parents
6140089e
f02e7dc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
html.php
laravel/html.php
+20
-3
No files found.
laravel/html.php
View file @
8ff052cb
...
@@ -9,6 +9,13 @@ class HTML {
...
@@ -9,6 +9,13 @@ class HTML {
*/
*/
public
static
$macros
=
array
();
public
static
$macros
=
array
();
/**
* Cache application encoding locally to save expensive calls to config::get().
*
* @var string
*/
public
static
$encoding
=
null
;
/**
/**
* Registers a custom macro.
* Registers a custom macro.
*
*
...
@@ -31,7 +38,7 @@ class HTML {
...
@@ -31,7 +38,7 @@ class HTML {
*/
*/
public
static
function
entities
(
$value
)
public
static
function
entities
(
$value
)
{
{
return
htmlentities
(
$value
,
ENT_QUOTES
,
Config
::
get
(
'application.encoding'
),
false
);
return
htmlentities
(
$value
,
ENT_QUOTES
,
static
::
encoding
(
),
false
);
}
}
/**
/**
...
@@ -42,7 +49,7 @@ class HTML {
...
@@ -42,7 +49,7 @@ class HTML {
*/
*/
public
static
function
decode
(
$value
)
public
static
function
decode
(
$value
)
{
{
return
html_entity_decode
(
$value
,
ENT_QUOTES
,
Config
::
get
(
'application.encoding'
));
return
html_entity_decode
(
$value
,
ENT_QUOTES
,
static
::
encoding
(
));
}
}
/**
/**
...
@@ -55,7 +62,7 @@ class HTML {
...
@@ -55,7 +62,7 @@ class HTML {
*/
*/
public
static
function
specialchars
(
$value
)
public
static
function
specialchars
(
$value
)
{
{
return
htmlspecialchars
(
$value
,
ENT_QUOTES
,
Config
::
get
(
'application.encoding'
),
false
);
return
htmlspecialchars
(
$value
,
ENT_QUOTES
,
static
::
encoding
(
),
false
);
}
}
/**
/**
...
@@ -431,6 +438,16 @@ class HTML {
...
@@ -431,6 +438,16 @@ class HTML {
return
$safe
;
return
$safe
;
}
}
/**
* Get the appliction.encoding without needing to request it from Config::get() each time.
*
* @return string
*/
protected
static
function
encoding
()
{
return
static
::
$encoding
?:
static
::
$encoding
=
Config
::
get
(
'application.encoding'
);
}
/**
/**
* Dynamically handle calls to custom macros.
* Dynamically handle calls to custom macros.
*
*
...
...
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