Skip to content
Browse files

change relative URLs to absolute URLs in window.open(...)

  • Loading branch information...
1 parent edbbeb0 commit a0001e3a6d3e65e7b7ea8521a15a662b0c3e34a5 gbateson committed Jun 26, 2007
Showing with 6 additions and 1 deletion.
  1. +6 −1 mod/hotpot/lib.php
View
7 mod/hotpot/lib.php
@@ -1532,7 +1532,12 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
$replace = "hotpot_convert_navbutton_url('".$this->get_baseurl()."','".$this->reference."','\\1','".$this->course."')";
$this->source = preg_replace($search, $replace, $this->source);
- } else {
+ // relative URLs in <a ... onclick="window.open('...')...">...</a>
+ $search = '|'.'(?<='.'onclick="'."window.open\\('".')'."([^']*)".'(?='."'\\);return false;".'")'.'|ise';
+ $replace = "hotpot_convert_url('".$this->get_baseurl()."','".$this->reference."','\\1')";
+ $this->source = preg_replace($search, $replace, $this->source);
+
+ } else {
if ($this->parse_xml) {
$this->filetype = 'xml';

0 comments on commit a0001e3

Please sign in to comment.
Something went wrong with that request. Please try again.