Permalink
Browse files

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

  • Loading branch information...
1 parent 1239139 commit ca8c7dbc5203547995e9c78c464e995adadda697 gbateson committed Jun 26, 2007
Showing with 6 additions and 1 deletion.
  1. +6 −1 mod/hotpot/lib.php
View
@@ -1529,7 +1529,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 ca8c7db

Please sign in to comment.