__construct() protected method

This constructor is used to populate some variables.
protected __construct ( string $tweet )
$tweet string The tweet to parse.
 /**
  * Reads in a tweet to be parsed and validates it.
  *
  * @param  string  $tweet  The tweet to validate.
  */
 public function __construct($tweet = null, $config = null)
 {
     parent::__construct($tweet);
     if (!empty($config)) {
         $this->setConfiguration($config);
     }
     $this->extractor = Twitter_Extractor::create();
 }
示例#2
0
 /**
  * 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);
     }
 }
示例#3
0
 /**
  * Reads in a tweet to be parsed and extracts elements from it.
  *
  * Extracts various parts of a tweet including URLs, usernames, hashtags...
  *
  * @param  string  $tweet  The tweet to extract.
  */
 public function __construct($tweet)
 {
     parent::__construct($tweet);
 }
 /**
  * Reads in a tweet to be parsed and converted to contain links.
  *
  * As the intent is to produce links and output the modified tweet to the
  * user, we take this opportunity to ensure that we escape user input.
  *
  * @see  htmlspecialchars()
  *
  * @param  string  $tweet        The tweet to be converted.
  * @param  bool    $escape       Whether to escape the tweet (default: true).
  * @param  bool    $full_encode  Whether to encode all special characters.
  */
 public function __construct($tweet = null, $escape = true, $full_encode = false)
 {
     if ($escape && !empty($tweet)) {
         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);
     }
     $this->extractor = Twitter_Extractor::create();
 }