public function filterContent($name, FilterInfo $info, $arg) { $lname = strtolower($name); $args = func_get_args(); array_shift($args); if (!isset($this->_static[$lname])) { $hint = ($t = Helpers::getSuggestion(array_keys($this->_static), $name)) ? ", did you mean '{$t}'?" : '.'; throw new \LogicException("Filter |{$name} is not defined{$hint}"); } list($callback, $aware) = $this->prepareFilter($lname); if ($aware) { // FilterInfo aware filter return call_user_func_array($callback, $args); } else { // classic filter array_shift($args); if ($info->contentType !== Engine::CONTENT_TEXT) { trigger_error("Filter |{$name} is called with incompatible content type " . strtoupper($info->contentType) . ($info->contentType === Engine::CONTENT_HTML ? ', try to prepend |stripHtml.' : '.'), E_USER_WARNING); } $res = call_user_func_array($this->{$name}, $args); if ($res instanceof IHtmlString) { trigger_error("Filter |{$name} should be changed to content-aware filter."); $info->contentType = Engine::CONTENT_HTML; $res = $res->__toString(); } return $res; } }