Skip to content

Commit

Permalink
in XML source files of HP quizzes, convert relative URLs to absolute …
Browse files Browse the repository at this point in the history
…URLs in links using window.open(...)
  • Loading branch information
gbateson committed Jun 26, 2007
1 parent ca8c7db commit 226c671
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mod/hotpot/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 226c671

Please sign in to comment.