Permalink
Browse files

allow non alphanumeric chars in filenames when searching for relative…

… URLs, and added $HOTPOT_QUIZTYPE array to map numeric quiz type to text description
  • Loading branch information...
1 parent 6bf1d27 commit 1ebc0e62388f7fbe603d66027b0330d6e7b38bb7 gbateson committed Oct 12, 2005
Showing with 17 additions and 1 deletion.
  1. +17 −1 mod/hotpot/lib.php
View
@@ -101,6 +101,17 @@
define("HOTPOT_TEXTOYS_RHUBARB", "7");
define("HOTPOT_TEXTOYS_SEQUITUR", "8");
+$HOTPOT_QUIZTYPE = array(
+ HOTPOT_JCB => 'JCB',
+ HOTPOT_JCLOZE => 'JCloze',
+ HOTPOT_JCROSS => 'JCross',
+ HOTPOT_JMATCH => 'JMatch',
+ HOTPOT_JMIX => 'JMix',
+ HOTPOT_JQUIZ => 'JQuiz',
+ HOTPOT_TEXTOYS_RHUBARB => 'Rhubarb',
+ HOTPOT_TEXTOYS_SEQUITUR => 'Sequitur'
+);
+
define("HOTPOT_JQUIZ_MULTICHOICE", "1");
define("HOTPOT_JQUIZ_SHORTANSWER", "2");
define("HOTPOT_JQUIZ_HYBRID", "3");
@@ -1511,11 +1522,15 @@ function hotpot_convert_relative_urls(&$str) {
$quoteopen = '("|"|")'; // open quote
$quoteclose = '\\5'; // close quote (to match open quote)
- $url = '\S+?\.\S+?'; // '.*?'
$replace = "hotpot_convert_relative_url('".$this->get_baseurl()."', '".$this->reference."', '\\1', '\\6', '\\7')";
$tags = array('script'=>'src', 'link'=>'href', 'a'=>'href','img'=>'src','param'=>'value');
foreach ($tags as $tag=>$attribute) {
+ if ($tag=='param') {
+ $url = '\S+?\.\S+?'; // must include a filename and have no spaces
+ } else {
+ $url = '.*?';
+ }
$search = "%($tagopen$tag$space$anychar$attribute=$quoteopen)($url)($quoteclose$anychar$tagclose)%ise";
$str = preg_replace($search, $replace, $str);
}
@@ -1673,6 +1688,7 @@ function hotpot_convert_navbutton_url($baseurl, $reference, $url, $course) {
function hotpot_convert_relative_url($baseurl, $reference, $opentag, $url, $closetag) {
+ // catch <PARAM name="FlashVars" value="TheSound=soundfile.mp3">
if (preg_match('|^'.'\w+=[^&]+'.'([&]\w+=[^&]+)*'.'$|', $url)) {
$query = $url;
$url = '';

0 comments on commit 1ebc0e6

Please sign in to comment.