Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…URLs in links using window.open(...)
  • Loading branch information...
commit 226c671af7770d63f76b1138ad15f2446dbd5f67 1 parent ca8c7db
gbateson authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 mod/hotpot/lib.php
View
8 mod/hotpot/lib.php
@@ -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';
Please sign in to comment.
Something went wrong with that request. Please try again.