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
8e80756b
Commit
8e80756b
authored
Apr 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/http-foundation
parents
963426cb
d41b1db7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
+33
-8
changes.md
changes.md
+1
-0
view.php
laravel/view.php
+32
-8
No files found.
changes.md
View file @
8e80756b
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
-
Added "to_array" method to the base Eloquent model.
-
Added "to_array" method to the base Eloquent model.
-
Added "$hidden" static variable to the base Eloquent model.
-
Added "$hidden" static variable to the base Eloquent model.
-
Added "sync" method to has_many_and_belongs_to Eloquent relationship.
-
Added "sync" method to has_many_and_belongs_to Eloquent relationship.
-
Improved View performance by only loading contents from file once.
<a
name=
"upgrade-3.2"
></a>
<a
name=
"upgrade-3.2"
></a>
## Upgrading From 3.1
## Upgrading From 3.1
...
...
laravel/view.php
View file @
8e80756b
...
@@ -37,6 +37,13 @@ class View implements ArrayAccess {
...
@@ -37,6 +37,13 @@ class View implements ArrayAccess {
*/
*/
public
static
$names
=
array
();
public
static
$names
=
array
();
/**
* The cache content of loaded view files.
*
* @var array
*/
public
static
$cache
=
array
();
/**
/**
* The Laravel view loader event name.
* The Laravel view loader event name.
*
*
...
@@ -286,12 +293,7 @@ class View implements ArrayAccess {
...
@@ -286,12 +293,7 @@ class View implements ArrayAccess {
*/
*/
public
function
render
()
public
function
render
()
{
{
// To allow bundles or other pieces of the application to modify the
Event
::
fire
(
"laravel.composing:
{
$this
->
view
}
"
,
array
(
$this
));
// view before it is rendered, we'll fire an event, passing in the
// view instance so it can modified.
$composer
=
"laravel.composing:
{
$this
->
view
}
"
;
Event
::
fire
(
$composer
,
array
(
$this
));
// If there are listeners to the view engine event, we'll pass them
// If there are listeners to the view engine event, we'll pass them
// the view so they can render it according to their needs, which
// the view so they can render it according to their needs, which
...
@@ -315,6 +317,11 @@ class View implements ArrayAccess {
...
@@ -315,6 +317,11 @@ class View implements ArrayAccess {
{
{
$__data
=
$this
->
data
();
$__data
=
$this
->
data
();
// The contents of each view file is cached in an array for the
// request since partial views may be rendered inside of for
// loops which could incur performance penalties.
$__contents
=
$this
->
load
();
ob_start
()
and
extract
(
$__data
,
EXTR_SKIP
);
ob_start
()
and
extract
(
$__data
,
EXTR_SKIP
);
// We'll include the view contents for parsing within a catcher
// We'll include the view contents for parsing within a catcher
...
@@ -322,12 +329,12 @@ class View implements ArrayAccess {
...
@@ -322,12 +329,12 @@ class View implements ArrayAccess {
// will throw it out to the exception handler.
// will throw it out to the exception handler.
try
try
{
{
include
$this
->
path
;
eval
(
'?>'
.
$__contents
)
;
}
}
// If we caught an exception, we'll silently flush the output
// If we caught an exception, we'll silently flush the output
// buffer so that no partially rendered views get thrown out
// buffer so that no partially rendered views get thrown out
// to the client and confuse the user.
// to the client and confuse the user
with junk
.
catch
(
\Exception
$e
)
catch
(
\Exception
$e
)
{
{
ob_get_clean
();
throw
$e
;
ob_get_clean
();
throw
$e
;
...
@@ -336,6 +343,23 @@ class View implements ArrayAccess {
...
@@ -336,6 +343,23 @@ class View implements ArrayAccess {
return
ob_get_clean
();
return
ob_get_clean
();
}
}
/**
* Get the contents of the view file from disk.
*
* @return string
*/
protected
function
load
()
{
if
(
isset
(
static
::
$cache
[
$this
->
path
]))
{
return
static
::
$cache
[
$this
->
path
];
}
else
{
return
static
::
$cache
[
$this
->
path
]
=
include
$this
->
path
;
}
}
/**
/**
* Get the array of view data for the view instance.
* Get the array of view data for the view instance.
*
*
...
...
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