public static function filterText($text) { global $injector, $prefs; if ($prefs->getValue('filtering') && strlen($text)) { try { return $injector->getInstance('Horde_Core_Factory_TextFilter')->filter($text, 'words', $injector->getInstance('Horde_Core_Hooks')->callHook('msg_filter', 'imp')); } catch (Horde_Exception_HookNotSet $e) { } } return $text; }
/** * Format output text with IMP additions. * * @param string $text The HTML text. * * @return string The text with extra IMP formatting applied. */ protected function _IMPformat($text) { // Highlight quoted parts of an email. if ($GLOBALS['prefs']->getValue('highlight_text')) { $text = implode("\n", preg_replace('|^(\\s*>.+)$|', '<span class="quoted1">\\1</span>', explode("\n", $text))); $indent = 1; while (preg_match('|>(\\s?>){' . $indent . '}|', $text)) { $text = implode("\n", preg_replace('|^<span class="quoted' . (($indent - 1) % 5 + 1) . '">(\\s*>(\\s?>){' . $indent . '}.+)$|', '<span class="quoted' . ($indent % 5 + 1) . '">\\1', explode("\n", $text))); ++$indent; } } // Dim signatures. if ($GLOBALS['prefs']->getValue('dim_signature')) { $parts = preg_split('|(\\n--\\s*\\n)|', $text, 2, PREG_SPLIT_DELIM_CAPTURE); $text = array_shift($parts); if (count($parts)) { $text .= '<span class="signature">' . $parts[0] . preg_replace('|class="[^"]+"|', 'class="signature-fixed"', $parts[1]) . '</span>'; } } // Filter bad language. return IMP::filterText($text); }