Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

remove duplicate id attribute from body tag; microincrement version t…

…o 2006082902 (release 2.1.25)
  • Loading branch information...
commit b3f9b5c1c29c54fa84c44d3a02f3b0fd9b4434ac 1 parent 81ee42c
gbateson authored
2  mod/hotpot/README.TXT
... ... @@ -1,5 +1,5 @@
1 1 ===============================================
2   -This is v2.1.24 of the HotPot module for Moodle
  2 +This is v2.1.25 of the HotPot module for Moodle
3 3 ===============================================
4 4
5 5 This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
4 mod/hotpot/version.php
@@ -3,8 +3,8 @@
3 3 /// Code fragment to define the version of hotpot
4 4 /// This fragment is called by moodle_needs_upgrading() and /admin/index.php
5 5 /////////////////////////////////////////////////////////////////////////////////
6   -$module->version = 2006082901; // change only last two digits in 1.6.x!!
7   -$module->release = 'v2.1.24'; // human-friendly version name (used in mod/hotpot/lib.php)
  6 +$module->version = 2006082902; // change only last two digits in 1.6.x!!
  7 +$module->release = 'v2.1.25'; // human-friendly version name (used in mod/hotpot/lib.php)
8 8 $module->requires = 2003091111; // replace with 2005060241 if you want to use it with latest 1.5.4+
9 9 $module->cron = 0; // period for cron to check this module (secs)
10 10 // interpretation of YYYYMMDDXY version numbers
24 mod/hotpot/view.php
@@ -259,6 +259,12 @@
259 259 }
260 260 // insert hot-potatoes.js
261 261 $hp->insert_script(HOTPOT_JS);
  262 + // get Moodle pageid and pageclass
  263 + $pageid = '';
  264 + $pageclass = '';
  265 + if (function_exists('page_id_and_class')) {
  266 + page_id_and_class($pageid, $pageclass);
  267 + }
262 268 // extract first <head> tag
263 269 $head = '';
264 270 $pattern = '|<head([^>]*)>(.*?)</head>|is';
@@ -273,8 +279,10 @@
273 279 if (preg_match_all($pattern, $head, $matches)) {
274 280 $count = count($matches[0]);
275 281 for ($i=0; $i<$count; $i++) {
276   - $styles .= $matches[0][$i]."\n";
277   - $head = str_replace($matches[0][$i], '', $head);
  282 + if ($pageid) {
  283 + $styles .= str_replace('TheBody', $pageid, $matches[0][$i])."\n";
  284 + }
  285 + $head = str_replace($matches[0][$i], '', $head);
278 286 }
279 287 }
280 288 // extract <script> tags (and remove from $head)
@@ -283,8 +291,10 @@
283 291 if (preg_match_all($pattern, $head, $matches)) {
284 292 $count = count($matches[0]);
285 293 for ($i=0; $i<$count; $i++) {
286   - $scripts .= $matches[0][$i]."\n";
287   - $head = str_replace($matches[0][$i], '', $head);
  294 + if ($pageid) {
  295 + $scripts .= str_replace('TheBody', $pageid, $matches[0][$i])."\n";
  296 + }
  297 + $head = str_replace($matches[0][$i], '', $head);
288 298 }
289 299 }
290 300 // extract <body> tags
@@ -294,8 +304,10 @@
294 304 // HP6 and some HP5 (v6 and v4)
295 305 if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
296 306 $body = $matches[5]; // contents of first <body onload="StartUp()">...</body> block
297   - $body_tags = $matches[1];
298   - // workaround to ensure javascript onload routine for quiz is always executed
  307 + if ($pageid) {
  308 + $body_tags = str_replace(' id="TheBody"', '', $matches[1]);
  309 + }
  310 + // workaround to ensure javascript onload routine for quiz is always executed
299 311 // $body_tags will only be inserted into the <body ...> tag
300 312 // if it is included in the theme/$CFG->theme/header.html,
301 313 // so some old or modified themes may not insert $body_tags

0 comments on commit b3f9b5c

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