|
Project Information
Links
|
AboutTwittReader is the PHP class for putting twits on your site. Features: - you can set up any count of twits to display
- highlighting of URLs, e-mails, users, hashtags
- caching
- you can set up encoding
- customizable
Requirements: PHP5, cURL, DOMDocument. Properties| Property | Default | Description | | cacheFile | twitter.txt | The cache file path | | cachePeriod | 1800 | How long is cache actual? (in seconds) | | timeout | 5 | The Twitter server availability timeout (in seconds) | | twittsMaxCount | 9 | The count of twits to display (1-9) | | twittWrapper | <li><p>[status]</p><p><a href=\"[link]\">[date]</a></p></li>\n | The twitt template. You can use the [status], [link] and [date] variables | | dateFormat | d.m.Y H:i:s | The date format of the date variable | | errorNotAvailable | The service isn't available. | The error message, that displays when the Twitter isn't available | | errorNoStatuses | No statuses found for this user. | The error message, that displays when user haven't created any posts yet | | curlOptions | array() | cURL additional options | | charset | UTF-8 | The character set | | highlightUrls | FALSE | Will class highlight URLs? | | highlightEmails | FALSE | Will class highlight e-mails? | | highlightUsers | FALSE | Will class highlight users? | | highlightHashtags | FALSE | Will class highlight hashtags? |
ExamplesThe simple usage: $tr = new TwittReader('user');
echo '<ul>' . $tr->getTwitts() . '</ul>';The advanced usage: $tr = new TwittReader('user');
$tr->dateFormat = 'H:i';
$tr->twittWrapper = "<li><strong>[date]</strong> [status]</li>";
$tr->twittsMaxCount = 3;
$tr->cachePeriod = 60;
$tr->highlightUsers = TRUE;
$tr->highlightUrls = TRUE;
$tr->highlightHashtags = TRUE;
$tr->curlOptions = array(
CURLOPT_PROXY => "127.0.0.1:3128"
);
echo '<ul>' . $tr->getTwitts() . '</ul>';
|