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
iena
iena-modale-activity-filter
Commits
968ce373
Commit
968ce373
authored
Jun 03, 2020
by
BETTENFELD Vincent
Browse files
comments on filter.php
parent
d12cbbf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
filter.php
View file @
968ce373
...
...
@@ -124,6 +124,8 @@ public function filter_iena_add_delimiters($pieces)
* @param $text
* @param array $options
* @return string
*
* Transform code for links into code for pop-up buttons
*/
function
filter
(
$text
,
array
$options
=
array
())
{
...
...
@@ -131,7 +133,7 @@ function filter($text, array $options = array())
global
$CFG
;
global
$PAGE
;
//
Récupérer le style pour appliquer le même
//
Apply context style to buttons
if
(
$CFG
->
color_btn
)
{
$this
->
color_btn
=
$CFG
->
color_btn
;
}
...
...
@@ -151,17 +153,22 @@ function filter($text, array $options = array())
}
}
/* Looks for link(s) in the argument text and place them in the array named
matches */
preg_match_all
(
'/<a href="(.*?)">(.*?)<\/a>/s'
,
$text
,
$matches
);
// ? remove tags opening links in new tab from $text ?
for
(
$i
=
0
;
$i
<
count
(
$matches
[
0
]);
$i
++
)
{
if
(
strcmp
(
$matches
[
1
][
$i
],
$matches
[
2
][
$i
])
==
0
)
{
$text
=
str_replace
(
$matches
[
0
][
$i
],
$matches
[
1
][
$i
],
$text
);
}
}
// ? add start and end tags around links in $text ?
$pieces
=
explode
(
$CFG
->
wwwroot
.
'/mod'
,
$text
);
$pieces
=
$this
->
filter_iena_add_delimiters
(
$pieces
);
//
for
(
$i
=
0
;
$i
<
count
(
$pieces
);
$i
++
)
{
$pieces
[
$i
]
=
' '
.
$pieces
[
$i
];
$ini
=
strpos
(
$pieces
[
$i
],
$this
->
start
);
...
...
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