Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
packagist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Modulus
packagist
Commits
cc9c3778
Commit
cc9c3778
authored
Feb 23, 2022
by
Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiler - garder les messages Flash à la compilation
parent
7416d9cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
src/app/Http/Middleware/Compiler.php
src/app/Http/Middleware/Compiler.php
+24
-1
src/app/Http/Services/Parser/Parser.php
src/app/Http/Services/Parser/Parser.php
+4
-2
No files found.
src/app/Http/Middleware/Compiler.php
View file @
cc9c3778
...
...
@@ -18,8 +18,18 @@ class Compiler
*/
public
function
handle
(
$request
,
Closure
$next
,
$guard
=
null
)
{
$reflash
=
$request
->
session
()
->
get
(
'reflash'
);
if
(
SettingService
::
get
(
'cache'
)
!=
1
)
{
// Sauvegarde des messages flash
$availables_flash
=
[
'errors'
,
'_old_input'
,
'alert-success'
,
'alert-error'
,
'success'
,
'info'
,
'warning'
,
'error'
,
'danger'
];
$messages_flash
=
[];
foreach
(
$availables_flash
as
$key
)
{
if
(
$request
->
session
()
->
has
(
$key
))
{
$messages_flash
[
$key
]
=
$request
->
session
()
->
get
(
$key
);
}
}
if
(
setting
(
'cache'
)
!=
1
)
{
CompilerService
::
clearAll
();
}
...
...
@@ -31,6 +41,19 @@ class Compiler
CompilerService
::
createBackCSSIfNotExists
();
CompilerService
::
createBackJSIfNotExists
();
if
(
count
(
$messages_flash
)
>
0
&&
!
$reflash
)
{
// Préserve les messages flash
foreach
(
$messages_flash
as
$key
=>
$message
)
{
$request
->
session
()
->
flash
(
$key
,
$message
);
}
// Evite la récursivité
$request
->
session
()
->
flash
(
'reflash'
,
true
);
}
else
{
$request
->
session
()
->
forget
(
'reflash'
);
}
return
$next
(
$request
);
}
}
src/app/Http/Services/Parser/Parser.php
View file @
cc9c3778
...
...
@@ -127,8 +127,10 @@ class Parser
*/
private
function
replaceTagNoRender
(
&
$html
)
{
$html
=
str_replace
(
'{#'
,
'{!!'
,
$html
);
$html
=
str_replace
(
'#}'
,
'!!}'
,
$html
);
$html
=
str_replace
(
'{#'
,
'{{'
,
$html
);
$html
=
str_replace
(
'#}'
,
'}}'
,
$html
);
$html
=
str_replace
(
'{##'
,
'{!!'
,
$html
);
$html
=
str_replace
(
'##}'
,
'!!}'
,
$html
);
$html
=
str_replace
(
'{@}'
,
'@'
,
$html
);
$html
=
str_replace
(
'<#php'
,
'<?php'
,
$html
);
...
...
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