From 2a9e5ba70a0ac9b0e98e359f82692cfd14dc3f90 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Tue, 5 May 2020 09:31:18 +0800 Subject: [PATCH] MDL-68563 filter_urltolink: enable filter uppon install Every major system that people use these days turns URLs into links automatically. This filter was turned off by default a decade ago because of performance concerns that do not apply any more, specially on fresh new installations. In order to improve user experience on text editing features, the urltolink filter will be now enabled by default in new installations. --- filter/urltolink/db/install.php | 32 ++++++++++++++++++++++++++++++++ filter/urltolink/settings.php | 2 +- filter/urltolink/version.php | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 filter/urltolink/db/install.php diff --git a/filter/urltolink/db/install.php b/filter/urltolink/db/install.php new file mode 100644 index 0000000000000..01ded270aedf5 --- /dev/null +++ b/filter/urltolink/db/install.php @@ -0,0 +1,32 @@ +. + +/** + * URL to link filter post install hook. + * + * @package filter_urltolink + * @copyright 2020 Simey Lameze + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +function xmldb_filter_urltolink_install() { + global $CFG; + require_once($CFG->libdir . "/filterlib.php"); + + filter_set_global_state('urltolink', TEXTFILTER_ON, -1); +} diff --git a/filter/urltolink/settings.php b/filter/urltolink/settings.php index 82b7432307c09..44ecff2b9b810 100644 --- a/filter/urltolink/settings.php +++ b/filter/urltolink/settings.php @@ -29,7 +29,7 @@ $settings->add(new admin_setting_configmulticheckbox('filter_urltolink/formats', get_string('settingformats', 'filter_urltolink'), get_string('settingformats_desc', 'filter_urltolink'), - array(FORMAT_MOODLE => 1), format_text_menu())); + [FORMAT_HTML => 1, FORMAT_MARKDOWN => 1, FORMAT_MOODLE => 1], format_text_menu())); $settings->add(new admin_setting_configcheckbox('filter_urltolink/embedimages', get_string('embedimages', 'filter_urltolink'), diff --git a/filter/urltolink/version.php b/filter/urltolink/version.php index 471eff425613a..ffbb623180c3c 100644 --- a/filter/urltolink/version.php +++ b/filter/urltolink/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2019111800; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2020051200; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2019111200; // Requires this Moodle version $plugin->component = 'filter_urltolink'; // Full name of the plugin (used for diagnostics)