public static function rewrite_answers_urls($answer, $rewriteanswer = true) {
        global $PAGE;

        $context = context_module::instance($PAGE->cm->id);
        if ($rewriteanswer) {
            $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id,
                    'mod_lesson', 'page_answers', $answer->id);
        }
        $answer->response = file_rewrite_pluginfile_urls($answer->response, 'pluginfile.php', $context->id,
                'mod_lesson', 'page_responses', $answer->id);

        return $answer;
    }
public static function rewrite_answers_urls($answer, $rewriteanswer = true) {
        global $PAGE;

        $context = context_module::instance($PAGE->cm->id);
        if ($rewriteanswer) {
            $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id,
                    'mod_lesson', 'page_answers', $answer->id);
        }
        $answer->response = file_rewrite_pluginfile_urls($answer->response, 'pluginfile.php', $context->id,
                'mod_lesson', 'page_responses', $answer->id);

        return $answer;
    }
public static function rewrite_answers_urls ( $ answer , $ rewriteanswer = true ) { global $ PAGE ; $ context = context_module :: instance ( $ PAGE -> cm -> id ) ; if ( $ rewriteanswer ) { $ answer -> answer = file_rewrite_pluginfile_urls ( $ answer -> answer , 'pluginfile.php' , $ context -> id , 'mod_lesson' , 'page_answers' , $ answer -> id ) ; } $ answer -> response = file_rewrite_pluginfile_urls ( $ answer -> response , 'pluginfile.php' , $ context -> id , 'mod_lesson' , 'page_responses' , $ answer -> id ) ; return $ answer ; }
Rewrite urls in response and optionality answer of a question answer

@param object $answer
@param bool $rewriteanswer must rewrite answer
@return object answer with rewritten urls
Rewrite urls in response and optionality answer of a question answer