/** * Returns the plural translation of a message. * * @param string $singular The singular version to translate. * @param string $plural The plural version to translate. * @param integer $number The number that determines singular vs. plural. * * @return string The string translation, or the original string if no * translation exists. */ public static function ngettext($singular, $plural, $number) { self::$_domain = 'Horde_Text_Filter'; self::$_directory = '@data_dir@' == '@' . 'data_dir' . '@' ? __DIR__ . '/../../../../locale' : '@data_dir@/Horde_Text_Filter/locale'; return parent::ngettext($singular, $plural, $number); }
/** * Executes any code necessary after applying the filter patterns. * * @param string $text The text after the filtering. * * @return string The modified text. */ public function postProcess($text) { try { $dom = new Horde_Domhtml($text, $this->_params['charset']); // Add two to take into account the <html> and <body> nodes. if (!empty($this->_params['nestingLimit'])) { $this->_params['nestingLimit'] += 2; } $text = Horde_String::convertCharset($this->_node($dom->dom, $dom->dom), 'UTF-8', $this->_params['charset']); } catch (Exception $e) { $text = strip_tags(preg_replace("/\\<br\\s*\\/?\\>/i", "\n", $text)); } /* Bring down number of empty lines to 2 max, and remove trailing * ws. */ $text = preg_replace(array("/\\s*\n{3,}/", "/ +\n/"), array("\n\n", "\n"), $text); /* Wrap the text to a readable format. */ if ($this->_params['width']) { $text = wordwrap($text, $this->_params['width']); } /* Add link list. */ if (!empty($this->_linkList)) { $text .= "\n\n" . Horde_Text_Filter_Translation::t("Links") . ":\n" . str_repeat('-', Horde_String::length(Horde_Text_Filter_Translation::t("Links")) + 1) . "\n"; foreach ($this->_linkList as $key => $val) { $text .= '[' . ($key + 1) . '] ' . $val . "\n"; } } return ltrim(rtrim($text), "\n"); }