Property | Default value | Description |
---|---|---|
cacheFile | twitter.txt | the file where the class will store the cache |
cachePeriod | 1800 | the time after which the cache will expire and the tweets will be updated (in seconds) |
timeout | five | time in seconds after which it will be considered that the server is unavailable |
twittsMaxCount | 9 | the number of tweets that display |
twittWrapper | <li> <p> [status] </ p> <p> <a href= \" [link \ \> [date] </a> </ p> </ li> \ n | Tweet template with [status], [link] and [date] variables |
dateFormat | dmY H: i: s | date format |
errorNotAvailable | Service not available. | message that is displayed when the server is unavailable and there is no cache |
errorNoStatuses | No statuses found for this user. | message that is displayed when a user has no tweets detected |
curlOptions | array (), that is, an empty array | if you want to set additional properties for CURL, for example work through a proxy |
charset | FALSE, that is, UTF-8 encoding remains | if set, then the tweet will be encoded into the appropriate encoding |
highlightUrls | FALSE | highlight links |
highlightEmails | FALSE | highlight the e-mail (I do not recommend, of course, because of the spammers, but maybe someone will come in handy :) |
highlightUsers | FALSE | Highlight Twitter users like |
highlightHashtags | FALSE | highlight the so-called hashtags like #tag |
$ tr = new TwittReader ( 'user' ) ;
echo '<ul>' . $ tr -> getTwitts ( ) . '</ ul>' ;
$ tr = new TwittReader ( 'user' ) ;
$ tr -> dateFormat = 'H: i' ; // show only tweet time
$ tr -> twittWrapper = "<li> <strong> [date] </ strong> [status] </ li>" ; // change the tweet template
$ tr -> twittsMaxCount = 3 ; // display the last three tweets
$ tr -> cachePeriod = 60 ; // cache expires after one minute
$ tr -> highlightUsers = TRUE ; // highlight users
$ tr -> highlightUrls = TRUE ; // highlight links
$ tr -> highlightHashtags = TRUE ; // highlight hashtags
$ tr -> charset = 'windows-1251' ; // encoding
// possible mistakes
$ tr -> errorNotAvailable = '<span class = "error"> Server is not available. </ span>' ;
$ tr -> errorNoStatuses = '<span class = "error"> No tweets. </ span>' ;
// use proxy
$ tr -> curlOptions = array (
CURLOPT_PROXY => "127.0.0.1 ل128 "
) ;
echo '<ul>' . $ tr -> getTwitts ( ) . '</ ul>' ;
Source: https://habr.com/ru/post/72144/
All Articles