Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
41ca8169
Commit
41ca8169
authored
Nov 11, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring the blade class.
parent
f9ec36d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
laravel/blade.php
+18
-6
No files found.
laravel/blade.php
View file @
41ca8169
...
...
@@ -73,9 +73,9 @@ class Blade {
*/
protected
static
function
compile_structure_openings
(
$value
)
{
$pattern
=
'/@(if|elseif|foreach|for|while)(\s*\(.*?\))/'
;
$pattern
=
'/
(\s*)
@(if|elseif|foreach|for|while)(\s*\(.*?\))/'
;
return
preg_replace
(
$pattern
,
'
<?php $1$2
: ?>'
,
$value
);
return
preg_replace
(
$pattern
,
'
$1<?php $2$3
: ?>'
,
$value
);
}
/**
...
...
@@ -86,9 +86,9 @@ class Blade {
*/
protected
static
function
compile_structure_closings
(
$value
)
{
$pattern
=
'/@(endif|endforeach|endfor|endwhile)(\s*)/'
;
$pattern
=
'/
(\s*)
@(endif|endforeach|endfor|endwhile)(\s*)/'
;
return
preg_replace
(
$pattern
,
'
<?php $1; ?>$2
'
,
$value
);
return
preg_replace
(
$pattern
,
'
$1<?php $2; ?>$3
'
,
$value
);
}
/**
...
...
@@ -112,7 +112,7 @@ class Blade {
*/
protected
static
function
compile_yields
(
$value
)
{
$pattern
=
'/(\s*)@yield(\s*\(.*?\))/'
;
$pattern
=
static
::
matcher
(
'yield'
)
;
return
preg_replace
(
$pattern
,
'$1<?php echo \\Laravel\\Section::yield$2; ?>'
,
$value
);
}
...
...
@@ -127,7 +127,7 @@ class Blade {
*/
protected
static
function
compile_section_start
(
$value
)
{
$pattern
=
'/(\s*)@section(\s*\(.*?\))/'
;
$pattern
=
static
::
matcher
(
'section'
)
;
return
preg_replace
(
$pattern
,
'$1<?php \\Laravel\\Section::start$2; ?>'
,
$value
);
}
...
...
@@ -145,4 +145,15 @@ class Blade {
return
preg_replace
(
'/@endsection/'
,
'<?php \\Laravel\\Section::stop(); ?>'
,
$value
);
}
/**
* Get the regular expression for a generic Blade function.
*
* @param string $function
* @return string
*/
protected
static
function
matcher
(
$function
)
{
return
'/(\s*)@'
.
$function
.
'(\s*\(.*?\))/'
;
}
}
\ No newline at end of file
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