Skip to content

Commit

Permalink
MDL-29995 filters - consider leacy filters and locations deprecated i…
Browse files Browse the repository at this point in the history
…n 2.2

Support for them will be dropped in 2.3 thanks to MDL-29996
  • Loading branch information
stronk7 committed Nov 18, 2011
1 parent fe41ba7 commit dd3fafb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions filter/upgrade.txt
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 6 additions & 1 deletion lib/filterlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ protected function make_filter_object($filtername, $context, $localconfig) {
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);
Expand Down Expand Up @@ -370,6 +371,8 @@ public abstract function filter($text, array $options = array());
* 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}
Expand Down Expand Up @@ -475,6 +478,7 @@ function filterobject($phrase, $hreftagbegin = '<span class="highlight">',
* @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':
Expand All @@ -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) == '[[') {
Expand All @@ -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()
Expand Down

0 comments on commit dd3fafb

Please sign in to comment.