/** * Safely sanitise html content, if enabled * * @param string $content Raw html * @return string Safely sanitised html */ protected function sanitiseContent($content) { // Check if sanitisation is enabled if (!HtmlEditorField::config()->sanitise_server_side) { return $content; } // Perform sanitisation $htmlValue = Injector::inst()->create('HTMLValue', $content); $santiser = Injector::inst()->create('HtmlEditorSanitiser', $this->getEditorConfig()); $santiser->sanitise($htmlValue); return $htmlValue->getContent(); }