Recent Tweets Widget - Version 1.3

Version Description

  • Fix for special 4 byte UTF8 characters
Download this release

Release Info

Developer ThemePrince
Plugin Icon 128x128 Recent Tweets Widget
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

assets/banner-772x250.png CHANGED
Binary file
readme.txt CHANGED
@@ -3,12 +3,12 @@ Contributors: themeprince
3
  Donate link: http://themeprince.com/
4
  Tags: recent tweets, twitter widget, twitter api v1.1, cache
5
  Requires at least: 3.4.1
6
- Tested up to: 3.6
7
- Stable tag: 1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Recent Tweets Widget WordPress plugin for new Twitter API v1.1 with cache, so you won't be rate limited at Twitter!
12
 
13
  == Description ==
14
 
@@ -39,6 +39,9 @@ You will need to visit [this link](https://dev.twitter.com/apps/ "Twitter"), sig
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 1.2 =
43
  * Header output issue fix
44
 
3
  Donate link: http://themeprince.com/
4
  Tags: recent tweets, twitter widget, twitter api v1.1, cache
5
  Requires at least: 3.4.1
6
+ Tested up to: 3.6.1
7
+ Stable tag: 1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Recent Tweets Widget plugin for new Twitter API v1.1 with CACHE, so you won't be rate limited at Twitter!
12
 
13
  == Description ==
14
 
39
 
40
  == Changelog ==
41
 
42
+ = 1.3 =
43
+ * Fix for special 4 byte UTF8 characters
44
+
45
  = 1.2 =
46
  * Header output issue fix
47
 
recent-tweets.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Recent Tweets Widget
5
  Plugin URI: http://wordpress.org/extend/plugins/recent-tweets-widget/
6
  Description: Recent Tweets Widget plugin for Twitter API v1.1 with Cache. It uses the new Twitter API v1.1 and stores tweets in the cache. It means that it will read status messages from your database and it doesn't query Twitter.com for every page load so you won't be rate limited. You can set how often you want to update the cache.
7
- Version: 1.2
8
  Author: Theme Prince
9
  Author URI: http://themeprince.com
10
  */
4
  Plugin Name: Recent Tweets Widget
5
  Plugin URI: http://wordpress.org/extend/plugins/recent-tweets-widget/
6
  Description: Recent Tweets Widget plugin for Twitter API v1.1 with Cache. It uses the new Twitter API v1.1 and stores tweets in the cache. It means that it will read status messages from your database and it doesn't query Twitter.com for every page load so you won't be rate limited. You can set how often you want to update the cache.
7
+ Version: 1.3
8
  Author: Theme Prince
9
  Author URI: http://themeprince.com
10
  */
tp_twitter_plugin.css CHANGED
@@ -1,11 +1,11 @@
1
 
2
- .widget .tp_recent_tweets {
3
  float: left;
4
  clear: left;
5
 
6
  }
7
 
8
- .widget .tp_recent_tweets li {
9
  background-image: url('assets/tweet.png');
10
  background-repeat: no-repeat;
11
  background-position: 0px 4px;
@@ -17,11 +17,11 @@
17
  list-style-type: none;
18
  }
19
 
20
- .widget .tp_recent_tweets li a {
21
  font-weight: bold;
22
  }
23
 
24
- .widget .tp_recent_tweets .twitter_time {
25
  color: #999;
26
  font-size: 12px;
27
  font-style: italic;
1
 
2
+ .tp_recent_tweets {
3
  float: left;
4
  clear: left;
5
 
6
  }
7
 
8
+ .tp_recent_tweets li {
9
  background-image: url('assets/tweet.png');
10
  background-repeat: no-repeat;
11
  background-position: 0px 4px;
17
  list-style-type: none;
18
  }
19
 
20
+ .tp_recent_tweets li a {
21
  font-weight: bold;
22
  }
23
 
24
+ .tp_recent_tweets .twitter_time {
25
  color: #999;
26
  font-size: 12px;
27
  font-style: italic;
widget.php CHANGED
@@ -60,11 +60,17 @@
60
  return;
61
  }
62
 
 
63
  for($i = 0;$i <= count($tweets); $i++){
64
  if(!empty($tweets[$i])){
65
  $tweets_array[$i]['created_at'] = $tweets[$i]->created_at;
66
- $tweets_array[$i]['text'] = $tweets[$i]->text;
67
- $tweets_array[$i]['status_id'] = $tweets[$i]->id_str;
 
 
 
 
 
68
  }
69
  }
70
 
@@ -84,10 +90,15 @@
84
  <div class="tp_recent_tweets">
85
  <ul>';
86
  $fctr = '1';
87
- foreach($tp_twitter_plugin_tweets as $tweet){
88
- print '<li><span>'.tp_convert_links($tweet['text']).'</span><br /><a class="twitter_time" target="_blank" href="http://twitter.com/'.$instance['username'].'/statuses/'.$tweet['status_id'].'">'.tp_relative_time($tweet['created_at']).'</a></li>';
89
- if($fctr == $instance['tweetstoshow']){ break; }
90
- $fctr++;
 
 
 
 
 
91
  }
92
 
93
  print '
60
  return;
61
  }
62
 
63
+ $tweets_array = array();
64
  for($i = 0;$i <= count($tweets); $i++){
65
  if(!empty($tweets[$i])){
66
  $tweets_array[$i]['created_at'] = $tweets[$i]->created_at;
67
+
68
+ //clean tweet text
69
+ $tweets_array[$i]['text'] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $tweets[$i]->text);
70
+
71
+ if(!empty($tweets[$i]->id_str)){
72
+ $tweets_array[$i]['status_id'] = $tweets[$i]->id_str;
73
+ }
74
  }
75
  }
76
 
90
  <div class="tp_recent_tweets">
91
  <ul>';
92
  $fctr = '1';
93
+ foreach($tp_twitter_plugin_tweets as $tweet){
94
+ if(!empty($tweet['text'])){
95
+ if(empty($tweet['status_id'])){ $tweet['status_id'] = ''; }
96
+ if(empty($tweet['created_at'])){ $tweet['created_at'] = ''; }
97
+
98
+ print '<li><span>'.tp_convert_links($tweet['text']).'</span><br /><a class="twitter_time" target="_blank" href="http://twitter.com/'.$instance['username'].'/statuses/'.$tweet['status_id'].'">'.tp_relative_time($tweet['created_at']).'</a></li>';
99
+ if($fctr == $instance['tweetstoshow']){ break; }
100
+ $fctr++;
101
+ }
102
  }
103
 
104
  print '