Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…URLs in links using window.open(...)
  • Loading branch information...
commit ce197abbefd05efd2333bb251cd2f93eca3f4528 1 parent 9036033
authored June 26, 2007

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  mod/hotpot/lib.php
7  mod/hotpot/lib.php
@@ -1535,6 +1535,13 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
1535 1535
                 $this->source = preg_replace($search, $replace, $this->source);
1536 1536
 
1537 1537
             } else {
  1538
+
  1539
+                // relative URLs in <a ... onclick="window.open('...')...">...</a>
  1540
+                $search = '|'.'(?<='.'onclick=&quot;'."window.open\\(&apos;".')'."(.*?)".'(?='."&apos;\\);return false;".'&quot;)'.'|ise';
  1541
+                $replace = "hotpot_convert_url('".$this->get_baseurl()."','".$this->reference."','\\1')";
  1542
+                $this->source = preg_replace($search, $replace, $this->source);
  1543
+
  1544
+
1538 1545
                 if ($this->parse_xml) {
1539 1546
 
1540 1547
                     $this->filetype = 'xml';

0 notes on commit ce197ab

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