]> git.mjollnir.org Git - moodle.git/commitdiff
in XML source files of HP quizzes, convert relative URLs to absolute URLs in links...
authorgbateson <gbateson>
Tue, 26 Jun 2007 05:05:06 +0000 (05:05 +0000)
committergbateson <gbateson>
Tue, 26 Jun 2007 05:05:06 +0000 (05:05 +0000)
mod/hotpot/lib.php

index 6fd5fab74c7438c998837f10f91662a0461c50d4..97d9fc6fdf6ecfc8957a18c9fa03891db3964a50 100644 (file)
@@ -1535,6 +1535,12 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
                 $this->source = preg_replace($search, $replace, $this->source);
 
             } else {
+
+                // relative URLs in <a ... onclick="window.open('...')...">...</a>
+                $search = '|'.'(?<='.'onclick=&quot;'."window.open\\(&apos;".')'."(.*?)".'(?='."&apos;\\);return false;".'&quot;)'.'|ise';
+                $replace = "hotpot_convert_url('".$this->get_baseurl()."','".$this->reference."','\\1')";
+                $this->source = preg_replace($search, $replace, $this->source);
+
                 if ($this->parse_xml) {
 
                     $this->filetype = 'xml';