/** * Reads in a tweet to be parsed and hit highlighted. * * We take this opportunity to ensure that we escape user input. * * @see htmlspecialchars() * * @param string $tweet The tweet to be hit highlighted. * @param bool $escape Whether to escape the tweet (default: true). * @param bool $full_encode Whether to encode all special characters. */ public function __construct($tweet, $escape = true, $full_encode = false) { if ($escape) { if ($full_encode) { parent::__construct(htmlentities($tweet, ENT_QUOTES, 'UTF-8', false)); } else { parent::__construct(htmlspecialchars($tweet, ENT_QUOTES, 'UTF-8', false)); } } else { parent::__construct($tweet); } }
/** * Reads in a tweet to be parsed and validates it. * * @param string $tweet The tweet to validate. */ public function __construct($tweet) { parent::__construct($tweet); }