Permalink
Browse files

in XML source files of HP quizzes, convert relative URLs to absolute …

…URLs in links using window.open(...)
  • Loading branch information...
1 parent 9036033 commit ce197abbefd05efd2333bb251cd2f93eca3f4528 gbateson committed Jun 26, 2007
Showing with 7 additions and 0 deletions.
  1. +7 −0 mod/hotpot/lib.php
View
7 mod/hotpot/lib.php
@@ -1535,6 +1535,13 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
$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';

0 comments on commit ce197ab

Please sign in to comment.