/** * fix_js_CheckPair_JMemori * * @param xxx $str (passed by reference) * @param xxx $start * @param xxx $length */ function fix_js_CheckPair_JMemori(&$str, $start, $length) { $substr = substr($str, $start, $length); // surround main body of function with if (id>=0) { ... } $search = '/(?<={)(.*)(?=if \\(Pairs == F\\.length\\))/s'; $replace = "\n\t" . 'if (id>=0) {$1}' . "\n\t"; $substr = preg_replace($search, $replace, $substr, 1); parent::fix_js_CheckAnswers($substr, 0, strlen($substr)); $str = substr_replace($str, $substr, $start, $length); }
/** * fix_js_CheckFinished * * @param xxx $str (passed by reference) * @param xxx $start * @param xxx $length */ function fix_js_CheckFinished(&$str, $start, $length) { parent::fix_js_CheckAnswers($str, $start, $length); }