/** * Is the given token valid and has never been used before? Throws an * exception otherwise. * * @param string $token The signed token. * @param string $seed The unique ID of the token. * * @return NULL * * @throws Horde_Token_Exception If the token was invalid or has been * used before. */ public function validateUnique($token, $seed = '') { if (!$this->isValid($token, $seed)) { throw new Horde_Token_Exception_Used(Horde_Token_Translation::t('This token is invalid!')); } if (!$this->verify($token)) { throw new Horde_Token_Exception_Used(Horde_Token_Translation::t('This token has been used before!')); } }
/** * 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_Token'; self::$_directory = '@data_dir@' == '@' . 'data_dir' . '@' ? __DIR__ . '/../../../locale' : '@data_dir@/Horde_Token/locale'; return parent::ngettext($singular, $plural, $number); }