Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory
Commits
50461200
Commit
50461200
authored
Mar 15, 2017
by
Côme Chilliet
Browse files
Fixes
#5428
Added parameter to p modifier to be able to do substitutions
parent
c0ae88ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/class_templateHandling.inc
View file @
50461200
...
...
@@ -272,6 +272,20 @@ class templateHandling
return
array_unique
(
$ret
);
}
private
static
function
modifierPregReplace
(
array
$args
,
$str
)
{
$pattern
=
'/\s/'
;
$replace
=
''
;
if
(
count
(
$args
)
>=
1
)
{
$pattern
=
$args
[
0
];
if
(
count
(
$args
)
>=
2
)
{
$replace
=
$args
[
1
];
}
}
return
array
(
preg_replace
(
$pattern
.
'u'
,
$replace
,
$str
));
}
private
static
function
modifierSubString
(
array
$args
,
$str
)
{
if
(
count
(
$args
)
<
1
)
{
...
...
@@ -408,7 +422,7 @@ class templateHandling
break
;
case
'p'
:
// spaces
$result
=
array
(
p
reg
_r
eplace
(
'/\s/u'
,
''
,
$str
)
)
;
$result
=
static
::
modifierP
reg
R
eplace
(
$args
,
$str
);
break
;
case
's'
:
// substring
...
...
agallavardin
@agallavardin
mentioned in issue
#1736 (closed)
·
Sep 02, 2017
mentioned in issue
#1736 (closed)
mentioned in issue #1736
Toggle commit list
Write
Preview
Supports
Markdown
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