mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-32427 fix suport for extra schemes in links in HTML Purifier
This commit is contained in:
parent
ead4f180a0
commit
590abcf801
105
lib/htmlpurifier/locallib.php
Normal file
105
lib/htmlpurifier/locallib.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Extra classes needed for HTMLPurifier customisation for Moodle.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL 3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**
|
||||
* Validates RTSP defined by RFC 2326
|
||||
*/
|
||||
class HTMLPurifier_URIScheme_rtsp extends HTMLPurifier_URIScheme {
|
||||
|
||||
public $browsable = true;
|
||||
public $hierarchical = true;
|
||||
|
||||
public function doValidate(&$uri, $config, $context) {
|
||||
$uri->userinfo = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates IRC defined by IETF Draft
|
||||
*/
|
||||
class HTMLPurifier_URIScheme_irc extends HTMLPurifier_URIScheme {
|
||||
|
||||
public $browsable = true;
|
||||
public $hierarchical = true;
|
||||
|
||||
public function doValidate(&$uri, $config, $context) {
|
||||
$uri->userinfo = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates MMS defined by Microsoft
|
||||
*/
|
||||
class HTMLPurifier_URIScheme_mms extends HTMLPurifier_URIScheme {
|
||||
|
||||
public $browsable = true;
|
||||
public $hierarchical = true;
|
||||
|
||||
public function doValidate(&$uri, $config, $context) {
|
||||
$uri->userinfo = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates Gopher defined by RFC 4266
|
||||
*/
|
||||
class HTMLPurifier_URIScheme_gopher extends HTMLPurifier_URIScheme {
|
||||
|
||||
public $browsable = true;
|
||||
public $hierarchical = true;
|
||||
|
||||
public function doValidate(&$uri, $config, $context) {
|
||||
$uri->userinfo = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates TeamSpeak defined by TeamSpeak
|
||||
*/
|
||||
class HTMLPurifier_URIScheme_teamspeak extends HTMLPurifier_URIScheme {
|
||||
|
||||
public $browsable = true;
|
||||
public $hierarchical = true;
|
||||
|
||||
public function doValidate(&$uri, $config, $context) {
|
||||
$uri->userinfo = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
Description of HTML Purifier v4.4.0+ library import into Moodle
|
||||
(Includes _blank fix 8c9d461a6259d7b8ac4ae5c9c9e95ab176cfcda3.)
|
||||
|
||||
No Changes..
|
||||
Changes:
|
||||
* added locallib.php with Moodle specific extensions
|
||||
|
||||
skodak
|
||||
|
@ -1540,6 +1540,7 @@ function purify_html($text, $options = array()) {
|
||||
check_dir_exists($cachedir);
|
||||
|
||||
require_once $CFG->libdir.'/htmlpurifier/HTMLPurifier.safe-includes.php';
|
||||
require_once $CFG->libdir.'/htmlpurifier/locallib.php';
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
$config->set('HTML.DefinitionID', 'moodlehtml');
|
||||
|
Loading…
x
Reference in New Issue
Block a user