MDL-29995 filters - consider leacy filters and locations deprecated in 2.2

Support for them will be dropped in 2.3 thanks to MDL-29996
This commit is contained in:
Eloy Lafuente (stronk7)
2011-11-18 13:00:57 +01:00
parent fe41ba7489
commit dd3fafbda5
2 changed files with 17 additions and 1 deletions
+6 -1
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()