/** * Calls {@link question_rewrite_question_urls()} with appropriate parameters * for content belonging to this question. * @param string $text the content to output. * @param string $component the component name (normally 'question' or 'qtype_...') * @param string $filearea the name of the file area. * @param int $itemid the item id. * @return srting the content with the URLs rewritten. */ public function rewrite_pluginfile_urls($text, $component, $filearea, $itemid) { return question_rewrite_question_urls($text, 'pluginfile.php', $this->question->contextid, $component, $filearea, $this->extra_file_path_components(), $itemid); }
/** * Rewrite the @@PLUGINFILE@@ tokens in a response variable from this step * that contains links to file. Normally you should probably call * {@link question_attempt::rewrite_response_pluginfile_urls()} instead of * calling this method directly. * * @param string $text the text to update the URLs in. * @param int $contextid the id of the context the quba belongs to. * @param string $name the variable name the files belong to. * @param array $extra extra file path components. * @return string the rewritten text. */ public function rewrite_response_pluginfile_urls($text, $contextid, $name, $extras) { return question_rewrite_question_urls($text, 'pluginfile.php', $contextid, 'question', 'response_' . $name, $extras, $this->id); }