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 ca8c7db commit 226c671af7770d63f76b1138ad15f2446dbd5f67 gbateson committed Jun 26, 2007
Showing with 7 additions and 1 deletion.
  1. +7 −1 mod/hotpot/lib.php
View
@@ -1534,7 +1534,13 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
$replace = "hotpot_convert_url('".$this->get_baseurl()."','".$this->reference."','\\1')";
$this->source = preg_replace($search, $replace, $this->source);
- } else {
+ } 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 226c671

Please sign in to comment.