This commit is contained in:
Eloy Lafuente (stronk7)
2018-07-04 00:54:44 +02:00
2 changed files with 28 additions and 12 deletions
+1 -5
View File
@@ -79,10 +79,8 @@ class filter_mathjaxloader extends moodle_text_filter {
* @param context $context The current context.
*/
public function setup($page, $context) {
// This only requires execution once per request.
static $jsinitialised = false;
if (empty($jsinitialised)) {
if ($page->requires->should_create_one_time_item_now('filter_mathjaxloader-scripts')) {
$url = get_config('filter_mathjaxloader', 'httpsurl');
$lang = $this->map_language_code(current_language());
$url = new moodle_url($url, array('delayStartupUntil' => 'configured'));
@@ -102,8 +100,6 @@ class filter_mathjaxloader extends moodle_text_filter {
$params = array('mathjaxconfig' => $config, 'lang' => $lang);
$page->requires->yui_module('moodle-filter_mathjaxloader-loader', 'M.filter_mathjaxloader.configure', array($params));
$jsinitialised = true;
}
}
+27 -7
View File
@@ -302,15 +302,36 @@ class filter_manager {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class null_filter_manager {
/**
* As for the equivalent {@link filter_manager} method.
*
* @param string $text The text to filter
* @param context $context not used.
* @param array $options not used
* @param array $skipfilters not used
* @return string resulting text.
*/
public function filter_text($text, $context, array $options = array(),
array $skipfilters = null) {
return $text;
}
/**
* As for the equivalent {@link filter_manager} method.
*
* @param string $string The text to filter
* @param context $context not used.
* @return string resulting string
*/
public function filter_string($string, $context) {
return $string;
}
/**
* As for the equivalent {@link filter_manager} method.
*
* @deprecated Since Moodle 3.0 MDL-50491.
*/
public function text_filtering_hash() {
throw new coding_exception('filter_manager::text_filtering_hash() can not be used any more');
}
@@ -429,9 +450,9 @@ abstract class moodle_text_filter {
/**
* Override this function to actually implement the filtering.
*
* @param $text some HTML content.
* @param string $text some HTML content to process.
* @param array $options options passed to the filters
* @return the HTML content after the filtering has been applied.
* @return string the HTML content after the filtering has been applied.
*/
public abstract function filter($text, array $options = array());
}
@@ -520,8 +541,6 @@ function filter_get_name($filter) {
* sorted in alphabetical order of name.
*/
function filter_get_all_installed() {
global $CFG;
$filternames = array();
foreach (core_component::get_plugin_list('filter') as $filter => $fulldir) {
if (is_readable("$fulldir/filter.php")) {
@@ -1433,9 +1452,10 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
}
/**
* @todo Document this function
* @param array $linkarray
* @return array
* Remove duplicate from a list of {@link filterobject}.
*
* @param filterobject[] $linkarray a list of filterobject.
* @return filterobject[] the same list, but with dupicates removed.
*/
function filter_remove_duplicates($linkarray) {