diff --git a/filter.php b/filter.php index 10ff43a9eef553cd6a55b28ce89788b3c90b9586..95a8cb1b8c61b7ad0e8a63b50059a3b036f41594 100644 --- a/filter.php +++ b/filter.php @@ -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);