make compatible with PHP 5.1.2 by removing variable assignments in calls to functions e.g. myfunction($a=1); Micro-incremented version number to 2.1.15

This commit is contained in:
gbateson 2006-03-30 03:17:51 +00:00
parent 475e9de86f
commit c20b623804
6 changed files with 772 additions and 759 deletions

View file

@ -1,10 +1,10 @@
This is v2.1.14 of the HotPot module This is v2.1.15 of the HotPot module
This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle. This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
It has been tested on: It has been tested on:
- Hot Potatoes 6 - Hot Potatoes 6
- Moodle 1.1 thru 1.6 - Moodle 1.1 thru 1.6
- PHP 4.1 thru 5.0 - PHP 4.1 thru 5.1.2
- MySQL and PostgreSQL databases - MySQL and PostgreSQL databases
This module may be distributed under the terms of the General Public License This module may be distributed under the terms of the General Public License

View file

@ -1296,7 +1296,7 @@ class hotpot_xml_tree {
// encode unicode characters as HTML entities // encode unicode characters as HTML entities
// (in particular, accented charaters that have not been encoded by HP) // (in particular, accented charaters that have not been encoded by HP)
// unicode characetsr can be detected by checking the hex value of a character // unicode characters can be detected by checking the hex value of a character
// 00 - 7F : ascii char (roman alphabet + punctuation) // 00 - 7F : ascii char (roman alphabet + punctuation)
// 80 - BF : byte 2, 3 or 4 of a unicode char // 80 - BF : byte 2, 3 or 4 of a unicode char
// C0 - DF : 1st byte of 2-byte char // C0 - DF : 1st byte of 2-byte char
@ -1306,20 +1306,6 @@ class hotpot_xml_tree {
// 80 - FF : single-byte, non-ascii char // 80 - FF : single-byte, non-ascii char
$search = '#('.'[\xc0-\xdf][\x80-\xbf]'.'|'.'[\xe0-\xef][\x80-\xbf]{2}'.'|'.'[\xf0-\xff][\x80-\xbf]{3}'.'|'.'[\x80-\xff]'.')#se'; $search = '#('.'[\xc0-\xdf][\x80-\xbf]'.'|'.'[\xe0-\xef][\x80-\xbf]{2}'.'|'.'[\xf0-\xff][\x80-\xbf]{3}'.'|'.'[\x80-\xff]'.')#se';
$value = preg_replace($search, "hotpot_utf8_to_html_entity('\\1')", $value); $value = preg_replace($search, "hotpot_utf8_to_html_entity('\\1')", $value);
// NOTICE
// ======
// the following lines have been removed because
// the final "preg_replace" takes several SECONDS to run
// encode any orphaned angle brackets back to html entities
//if (empty($this->tag_pattern)) {
// $q = "'"; // single quote
// $qq = '"'; // double quote
// $this->tag_pattern = '<(([^>'.$q.$qq.']*)|('."{$q}[^$q]*$q".')|('."{$qq}[^$qq]*$qq".'))*>';
//}
//$value = preg_replace('/<([^>]*'.$this->tag_pattern.')/', '&lt;$1', $value);
//$value = preg_replace('/('.$this->tag_pattern.'[^<]*)>/', '$1&gt;', $value);
} }
return $value; return $value;
} }

View file

@ -3,9 +3,10 @@
class hotpot_report extends hotpot_default_report { class hotpot_report extends hotpot_default_report {
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) { function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
global $CFG; global $CFG;
// create the table // create the tables
$this->create_clickreport_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables=array()); $tables = array();
// print the table $this->create_clickreport_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables);
// print the tables
$this->print_report($course, $hotpot, $tables, $options); $this->print_report($course, $hotpot, $tables, $options);
return true; return true;
} }

View file

@ -1,8 +1,10 @@
<?php // $Id$ <?php // $Id$
/// Overview report just displays a big table of all the attempts /// Overview report just displays a big table of all the attempts
class hotpot_report extends hotpot_default_report { class hotpot_report extends hotpot_default_report {
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) { function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
$this->create_overview_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables=array()); $tables = array();
$this->create_overview_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables);
$this->print_report($course, $hotpot, $tables, $options); $this->print_report($course, $hotpot, $tables, $options);
return true; return true;
} }

View file

@ -411,9 +411,9 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return $i; return $i;
} }
function v6_expand_MatchDivItems() { function v6_expand_MatchDivItems() {
$str = ''; $l_items = array();
$r_items = array();
$this->get_jmatch_items($l_items=array(), $r_items = array()); $this->get_jmatch_items($l_items, $r_items);
$l_keys = $this->shuffle_jmatch_items($l_items); $l_keys = $this->shuffle_jmatch_items($l_items);
$r_keys = $this->shuffle_jmatch_items($r_items); $r_keys = $this->shuffle_jmatch_items($r_items);
@ -422,6 +422,8 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
foreach ($r_keys as $key) { foreach ($r_keys as $key) {
$options .= '<option value="'.$key.'">'.$r_items[$key]['text'][0]['#'].'</option>'."\n"; $options .= '<option value="'.$key.'">'.$r_items[$key]['text'][0]['#'].'</option>'."\n";
} }
$str = '';
foreach ($l_keys as $key) { foreach ($l_keys as $key) {
$str .= '<tr><td class="LeftItem">'.$l_items[$key]['text'][0]['#'].'</td>'; $str .= '<tr><td class="LeftItem">'.$l_items[$key]['text'][0]['#'].'</td>';
$str .= '<td class="RightItem"><select id="s'.$key.'_'.$key.'">'.$options.'</select></td>'; $str .= '<td class="RightItem"><select id="s'.$key.'_'.$key.'">'.$options.'</select></td>';
@ -693,8 +695,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
// specials (JMatch) // specials (JMatch)
function v6_expand_FixedArray() { function v6_expand_FixedArray() {
$l_items = array();
$r_items = array();
$this->get_jmatch_items($l_items, $r_items);
$str = ''; $str = '';
$this->get_jmatch_items($l_items=array(), $r_items = array());
foreach ($l_items as $i=>$item) { foreach ($l_items as $i=>$item) {
$str .= "F[$i] = new Array();\n"; $str .= "F[$i] = new Array();\n";
$str .= "F[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n"; $str .= "F[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n";
@ -703,8 +708,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return $str; return $str;
} }
function v6_expand_DragArray() { function v6_expand_DragArray() {
$l_items = array();
$r_items = array();
$this->get_jmatch_items($l_items, $r_items);
$str = ''; $str = '';
$this->get_jmatch_items($l_items=array(), $r_items = array());
foreach ($r_items as $i=>$item) { foreach ($r_items as $i=>$item) {
$str .= "D[$i] = new Array();\n"; $str .= "D[$i] = new Array();\n";
$str .= "D[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n"; $str .= "D[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n";
@ -1085,7 +1093,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
// jcross6.js_ // jcross6.js_
function v6_expand_LetterArray() { function v6_expand_LetterArray() {
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0); $row=NULL;
$r_max=0;
$c_max=0;
$this->v6_get_jcross_grid($row, $r_max, $c_max);
$str = ''; $str = '';
for($r=0; $r<=$r_max; $r++) { for($r=0; $r<=$r_max; $r++) {
$str .= "L[$r] = new Array("; $str .= "L[$r] = new Array(";
@ -1097,7 +1109,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return $str; return $str;
} }
function v6_expand_GuessArray() { function v6_expand_GuessArray() {
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0); $row=NULL;
$r_max=0;
$c_max=0;
$this->v6_get_jcross_grid($row, $r_max, $c_max);
$str = ''; $str = '';
for($r=0; $r<=$r_max; $r++) { for($r=0; $r<=$r_max; $r++) {
$str .= "G[$r] = new Array('".str_repeat("','", $c_max)."');\n"; $str .= "G[$r] = new Array('".str_repeat("','", $c_max)."');\n";
@ -1105,7 +1121,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return $str; return $str;
} }
function v6_expand_ClueNumArray() { function v6_expand_ClueNumArray() {
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0); $row=NULL;
$r_max=0;
$c_max=0;
$this->v6_get_jcross_grid($row, $r_max, $c_max);
$i = 0; // clue index $i = 0; // clue index
$str = ''; $str = '';
for($r=0; $r<=$r_max; $r++) { for($r=0; $r<=$r_max; $r++) {
@ -1128,7 +1148,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return $str; return $str;
} }
function v6_expand_GridBody() { function v6_expand_GridBody() {
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0); $row=NULL;
$r_max=0;
$c_max=0;
$this->v6_get_jcross_grid($row, $r_max, $c_max);
$i = 0; // clue index; $i = 0; // clue index;
$str = ''; $str = '';
for($r=0; $r<=$r_max; $r++) { for($r=0; $r<=$r_max; $r++) {

View file

@ -3,8 +3,8 @@
/// Code fragment to define the version of hotpot /// Code fragment to define the version of hotpot
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php /// This fragment is called by moodle_needs_upgrading() and /admin/index.php
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
$module->version = 2005090714; // release date of this version (see note below) $module->version = 2005090715; // release date of this version (see note below)
$module->release = 'v2.1.14'; // human-friendly version name (used in mod/hotpot/lib.php) $module->release = 'v2.1.15'; // human-friendly version name (used in mod/hotpot/lib.php)
$module->cron = 0; // period for cron to check this module (secs) $module->cron = 0; // period for cron to check this module (secs)
// interpretation of YYYYMMDDXY version numbers // interpretation of YYYYMMDDXY version numbers
// YYYY : year // YYYY : year