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
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
Changes
1
Hide 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 @
a6977813
...
@@ -26,8 +26,16 @@ class Blade {
...
@@ -26,8 +26,16 @@ class Blade {
'yield_sections'
,
'yield_sections'
,
'section_start'
,
'section_start'
,
'section_end'
,
'section_end'
,
'extensions'
,
);
);
/**
* An array of user defined compilers.
*
* @var array
*/
protected
static
$extensions
=
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::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.
* 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_extensions
(
$value
)
{
foreach
(
static
::
$extensions
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