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
a6977813
Commit
a6977813
authored
May 04, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #628 from daylerees/custom-blade
Blade::register() custom blade compilers.
parents
0824c871
b870807e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
laravel/blade.php
+40
-0
No files found.
laravel/blade.php
View file @
a6977813
...
...
@@ -26,9 +26,17 @@ class Blade {
'yield_sections'
,
'section_start'
,
'section_end'
,
'extensions'
,
);
/**
* An array of user defined compilers.
*
* @var array
*/
protected
static
$extensions
=
array
();
/**
* Register the Blade view engine with Laravel.
*
* @return void
...
...
@@ -65,6 +73,22 @@ class Blade {
}
/**
* Register a new blade compiler.
*
* <code>
* Blade::extend(function($view) {
* return str_replace('thing', 'another_thing', $view);
* });
* </code>
*
* @param closure $compiler
*/
public
static
function
extend
(
$compiler
)
{
static
::
$extensions
[]
=
$compiler
;
}
/**
* Determine if a view is "expired" and needs to be re-compiled.
*
* @param string $view
...
...
@@ -387,6 +411,22 @@ class Blade {
}
/**
* Execute user defined compilers.
*
* @param string $value
* @return string
*/
protected
static
function
compile_extensions
(
$value
)
{
foreach
(
static
::
$extensions
as
$compiler
)
{
$value
=
$compiler
(
$value
);
}
return
$value
;
}
/**
* Get the regular expression for a generic Blade function.
*
* @param string $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