Example #1
1
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div id="MainDiv" class="StdDiv">')) {
         // not an hp6 file
         return false;
     }
     if (!strpos($content, 'function Create_StateArray()')) {
         // not a Rottmeier file
         return false;
     }
     if (!strpos($content, 'this.ErrorFound = false;')) {
         // not a Rottmeier FindIt file
         return false;
     }
     if (strpos($content, 'this.GapSolved = false;')) {
         // oops - a Rottmeier FindIt (b) file
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div class="Feedback" id="DivIntroPage">')) {
         // not a jmatch-intro file
         return false;
     }
     if (strpos($content, '<div id="MainDiv" class="StdDiv">')) {
         if (strpos($content, '<div id="MatchDiv" align="center">')) {
             // jmatch-intro v6
             return true;
         }
     }
     if (strpos($content, '<div class="StdDiv" id="CheckButtonDiv">')) {
         if (strpos($content, 'F = new Array();')) {
             if (strpos($content, 'D = new Array();')) {
                 // overkill?
                 // jmatch-intro v6+ (drag and drop)
                 return true;
             }
         }
     }
     // not a jmatch-intro file
     return false;
 }
Example #3
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div id="MainDiv" class="StdDiv">')) {
         // not an hp6 file
         return false;
     }
     if (!strpos($content, '<div id="ClozeDiv">')) {
         // not a jcloze file
         return false;
     }
     if (strpos($content, 'function Create_StateArray()')) {
         // a Rottmeier DropDown or FindIt file
         return false;
     }
     if (strpos($content, 'function Add_GlossFunctionality()')) {
         // a Rottmeier JGloss file
         return false;
     }
     return true;
 }
Example #4
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!preg_match('/<!--\\s*<!DOCTYPE[^>]*>\\s*-->/', $content)) {
         // no fancy DOCTYPE workarounds for IE6
         return false;
     }
     // detect <object ...>, <embed ...> and self-closing <script ... /> tags
     if (!preg_match('/<object[^>]*id="presentation"[^>]*>/', $content)) {
         return false;
     }
     if (!preg_match('/<embed[^>]*name="presentation"[^>]*>/', $content)) {
         return false;
     }
     if (!preg_match('/<script[^>]*src="[^">]*fixprompt.js"[^>]*\\/>/', $content)) {
         return false;
     }
     return true;
 }
Example #5
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, 'div id="MainDiv" class="StdDiv"')) {
         // not a HP file
         return false;
     }
     if (!strpos($content, 'div id="MatchDiv"')) {
         // not a jmatch file
         return false;
     }
     if (strpos($content, 'function CheckPair(id){')) {
         if (strpos($content, 'M = new Array();')) {
             if (strpos($content, 'clickarray = new Array();')) {
                 // jmemori
                 return true;
             }
         }
     }
     // not a jmemori file
     return false;
 }
Example #6
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div id="MainDiv" class="StdDiv">')) {
         if (!strpos($content, '<div class="StdDiv" id="CheckButtonDiv">')) {
             // not a hp6 file
             return false;
         }
     }
     if (!strpos($content, '<div id="SegmentDiv">')) {
         // drop-down
         if (!strpos($content, '<div id="Drop')) {
             // drag-and-drop
             // not a jmix file
             return false;
         }
     }
     return true;
 }
Example #7
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (strpos($content, '<div id="MainDiv" class="StdDiv">')) {
         if (strpos($content, '<table class="FlashcardTable" border="0" cellspacing="0">')) {
             // hp6 jmatch flashcard
             return true;
         }
     }
     // not a jmatch-intro file
     return false;
 }
Example #8
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div id="MainDiv" class="StdDiv">')) {
         // not an hp6 file
         return false;
     }
     if (!strpos($content, '<div id="QNav" class="QuestionNavigation">')) {
         // not a jquiz file
         return false;
     }
     return true;
 }
Example #9
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div class="StdDiv">')) {
         // not an tt3 file
         return false;
     }
     if (!strpos($content, '<form id="Rhubarb" action="" onsubmit="CheckGuess(); return false">')) {
         // not an rhubarb file
         return false;
     }
     return true;
 }
Example #10
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (strpos($content, '<!-- JMatch_Sort v')) {
         if (strpos($content, 'var hauteurUserDefined1')) {
             if (strpos($content, 'var largeurUserDefined2')) {
                 // jmatch-sort
                 return true;
             }
         }
     }
     // not a jmatch-sort file
     return false;
 }
Example #11
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     if (!preg_match('/\\.html?$/', $sourcefile->get_filename())) {
         // wrong file type
         return false;
     }
     if (!($content = self::get_content($sourcefile))) {
         // empty or non-existant file
         return false;
     }
     if (!strpos($content, '<div class="StdDiv">')) {
         // not an tt3 file
         return false;
     }
     if (!strpos($content, '<div id="ChoiceDiv">')) {
         // not an sequitur file
         return false;
     }
     if (!strpos($content, '<div class="Story" id="Story">')) {
         // not an sequitur file
         return false;
     }
     return true;
 }
Example #12
0
 /**
  * is_quizfile
  *
  * @param xxx $sourcefile
  * @return xxx
  */
 public static function is_quizfile($sourcefile)
 {
     return preg_match('/\\.jcl$/', $sourcefile->get_filename());
 }