Merge branch 'MDL-29995' of git://github.com/stronk7/moodle

This commit is contained in:
Aparup Banerjee 2011-11-23 13:47:52 +08:00
commit d7de1c8a62
2 changed files with 17 additions and 1 deletions

11
filter/upgrade.txt Normal file
View File

@ -0,0 +1,11 @@
This file describes API changes in core filter API and plugins,
information provided here is intended especially for developers.
=== 2.2 ===
* legacy filters and legacy locations have been deprecated, so any
old filter should be updated to use the new moodle_text_filter,
and any filter bundled under mod/xxxx directories be moved to
/filter/xxxx (MDL-29995). They will stop working completely in
Moodle 2.3 (MDL-29996). See the glossary or data filters for
examples of legacy module filters and locations already updated.

View File

@ -136,6 +136,7 @@ class filter_manager {
return new $filterclassname($context, $localconfig);
}
// TODO: deprecated since 2.2, will be out in 2.3, see MDL-29996
$legacyfunctionname = basename($filtername) . '_filter';
if (function_exists($legacyfunctionname)) {
return new legacy_filter($legacyfunctionname, $context, $localconfig);
@ -370,6 +371,8 @@ abstract class moodle_text_filter {
* moodle_text_filter implementation that encapsulates an old-style filter that
* only defines a function, not a class.
*
* @deprecated since 2.2, see MDL-29995
* @todo will be out in 2.3, see MDL-29996
* @package core
* @subpackage filter
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
@ -475,6 +478,7 @@ class filterobject {
* @return string the human-readable name for this filter.
*/
function filter_get_name($filter) {
// TODO: should we be using pluginname here instead?
list($type, $filter) = explode('/', $filter);
switch ($type) {
case 'filter':
@ -485,6 +489,7 @@ function filter_get_name($filter) {
}
// Fall through to try the legacy location.
// TODO: deprecated since 2.2, will be out in 2.3, see MDL-29996
case 'mod':
$strfiltername = get_string('filtername', $filter);
if (substr($strfiltername, 0, 2) == '[[') {
@ -508,7 +513,7 @@ function filter_get_name($filter) {
function filter_get_all_installed() {
global $CFG;
$filternames = array();
// TODO: deprecated in 2.2, delete support for "mod" legacy filters location in 2.3. MDL-29996
// TODO: deprecated since 2.2, will be out in 2.3, see MDL-29996
$filterlocations = array('mod', 'filter');
foreach ($filterlocations as $filterlocation) {
// TODO: move get_list_of_plugins() to get_plugin_list()