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
d2de301e
Commit
d2de301e
authored
May 04, 2012
by
Dayle Rees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added custom compilers to blade
Signed-off-by:
Dayle Rees
<
thepunkfan@gmail.com
>
parent
0824c871
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
blade.php
laravel/blade.php
+40
-0
No files found.
laravel/blade.php
View file @
d2de301e
...
@@ -26,8 +26,16 @@ class Blade {
...
@@ -26,8 +26,16 @@ class Blade {
'yield_sections'
,
'yield_sections'
,
'section_start'
,
'section_start'
,
'section_end'
,
'section_end'
,
'extra'
,
);
);
/**
* An array of user defined compilers.
*
* @var array
*/
protected
static
$registered
=
array
();
/**
/**
* Register the Blade view engine with Laravel.
* Register the Blade view engine with Laravel.
*
*
...
@@ -64,6 +72,22 @@ class Blade {
...
@@ -64,6 +72,22 @@ class Blade {
});
});
}
}
/**
* Register a new blade compiler.
*
* <code>
* Blade::register(function($view) {
* return str_replace('thing', 'another_thing', $view);
* });
* </code>
*
* @param closure $compiler
*/
public
static
function
register
(
$compiler
)
{
static
::
$registered
[]
=
$compiler
;
}
/**
/**
* Determine if a view is "expired" and needs to be re-compiled.
* Determine if a view is "expired" and needs to be re-compiled.
*
*
...
@@ -386,6 +410,22 @@ class Blade {
...
@@ -386,6 +410,22 @@ class Blade {
return
preg_replace
(
'/@endsection/'
,
'<?php \\Laravel\\Section::stop(); ?>'
,
$value
);
return
preg_replace
(
'/@endsection/'
,
'<?php \\Laravel\\Section::stop(); ?>'
,
$value
);
}
}
/**
* Execute user defined compilers.
*
* @param string $value
* @return string
*/
protected
static
function
compile_extra
(
$value
)
{
foreach
(
static
::
$registered
as
$compiler
)
{
$value
=
$compiler
(
$value
);
}
return
$value
;
}
/**
/**
* Get the regular expression for a generic Blade function.
* Get the regular expression for a generic Blade function.
*
*
...
...
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