From fba0abdc228f79c91982e84aadcefaecb53f4c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 30 Dec 2012 12:04:29 +0100 Subject: [PATCH] MDL-29996 remove legacy_filter support --- lib/filterlib.php | 50 ----------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/lib/filterlib.php b/lib/filterlib.php index 1e2e34a1891..b87cef68e37 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -136,12 +136,6 @@ 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); - } - return null; } @@ -408,50 +402,6 @@ abstract class moodle_text_filter { 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} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class legacy_filter extends moodle_text_filter { - /** @var string */ - protected $filterfunction; - protected $courseid; - - /** - * Set any context-specific configuration for this filter. - * - * @param string $filterfunction - * @param object $context The current context. - * @param array $config Any context-specific configuration for this filter. - */ - public function __construct($filterfunction, $context, array $localconfig) { - parent::__construct($context, $localconfig); - $this->filterfunction = $filterfunction; - $this->courseid = get_courseid_from_context($this->context); - } - - /** - * @param string $text - * @param array $options options - not supported for legacy filters - * @return mixed - */ - public function filter($text, array $options = array()) { - if ($this->courseid) { - // old filters are called only when inside courses - return call_user_func($this->filterfunction, $this->courseid, $text); - } else { - return $text; - } - } -} - /** * This is just a little object to define a phrase and some instructions * for how to process it. Filters can create an array of these to pass