Version Description
- Passing additional params to widget_title filter
- Stripping four-byte Unicode sequences before wp cache inserts
Download this release
Release Info
Developer | timwhitlock |
Plugin | Latest Tweets Widget |
Version | 1.0.15 |
Comparing to | |
See all releases |
Code changes from version 1.0.14 to 1.0.15
- latest-tweets.php +8 -4
- lib/twitter-api-utils.php +4 -15
- readme.txt +6 -2
latest-tweets.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Latest Tweets
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/latest-tweets-widget/
|
5 |
Description: Provides a sidebar widget showing latest tweets - compatible with the new Twitter API 1.1
|
6 |
Author: Tim Whitlock
|
7 |
-
Version: 1.0.
|
8 |
Author URI: http://timwhitlock.info/
|
9 |
*/
|
10 |
|
@@ -82,7 +82,7 @@ function latest_tweets_render( $screen_name, $count, $rts, $ats ){
|
|
82 |
if( $os_timezone !== $wp_timezone ){
|
83 |
date_default_timezone_set( $wp_timezone );
|
84 |
}
|
85 |
-
// render each tweet as a
|
86 |
$rendered = array();
|
87 |
foreach( $tweets as $tweet ){
|
88 |
extract( $tweet );
|
@@ -105,9 +105,13 @@ function latest_tweets_render( $screen_name, $count, $rts, $ats ){
|
|
105 |
if( ! empty($entities['urls']) || ! empty($entities['media']) ){
|
106 |
$text = twitter_api_expand_urls( $text, $entities );
|
107 |
}
|
|
|
|
|
|
|
|
|
108 |
$html = twitter_api_html( $text );
|
109 |
}
|
110 |
-
// piece together the whole tweet, allowing
|
111 |
$final = apply_filters('latest_tweets_render_tweet', $html, $date, $link, $tweet );
|
112 |
if( $final === $html ){
|
113 |
$final = '<p class="tweet-text">'.$html.'</p>'.
|
@@ -235,7 +239,7 @@ class Latest_Tweets_Widget extends WP_Widget {
|
|
235 |
public function widget( $args, $instance ) {
|
236 |
extract( $this->check_instance($instance) );
|
237 |
// title is themed via Wordpress widget theming techniques
|
238 |
-
$title = $args['before_title'] . apply_filters('widget_title', $title) . $args['after_title'];
|
239 |
// by default tweets are rendered as an unordered list
|
240 |
$items = latest_tweets_render( $screen_name, $num, $rts, $ats );
|
241 |
$list = apply_filters('latest_tweets_render_list', $items, $screen_name );
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/latest-tweets-widget/
|
5 |
Description: Provides a sidebar widget showing latest tweets - compatible with the new Twitter API 1.1
|
6 |
Author: Tim Whitlock
|
7 |
+
Version: 1.0.15
|
8 |
Author URI: http://timwhitlock.info/
|
9 |
*/
|
10 |
|
82 |
if( $os_timezone !== $wp_timezone ){
|
83 |
date_default_timezone_set( $wp_timezone );
|
84 |
}
|
85 |
+
// render each tweet as a block of html for the widget list items
|
86 |
$rendered = array();
|
87 |
foreach( $tweets as $tweet ){
|
88 |
extract( $tweet );
|
105 |
if( ! empty($entities['urls']) || ! empty($entities['media']) ){
|
106 |
$text = twitter_api_expand_urls( $text, $entities );
|
107 |
}
|
108 |
+
// strip characters that will choke Wordpress cache.
|
109 |
+
if( $cachettl && ! TWITTER_CACHE_APC ){
|
110 |
+
$text = twitter_api_strip_emoji($text);
|
111 |
+
}
|
112 |
$html = twitter_api_html( $text );
|
113 |
}
|
114 |
+
// piece together the whole tweet, allowing override
|
115 |
$final = apply_filters('latest_tweets_render_tweet', $html, $date, $link, $tweet );
|
116 |
if( $final === $html ){
|
117 |
$final = '<p class="tweet-text">'.$html.'</p>'.
|
239 |
public function widget( $args, $instance ) {
|
240 |
extract( $this->check_instance($instance) );
|
241 |
// title is themed via Wordpress widget theming techniques
|
242 |
+
$title = $args['before_title'] . apply_filters('widget_title', $title, $instance, $this->id_base ) . $args['after_title'];
|
243 |
// by default tweets are rendered as an unordered list
|
244 |
$items = latest_tweets_render( $screen_name, $num, $rts, $ats );
|
245 |
$list = apply_filters('latest_tweets_render_list', $items, $screen_name );
|
lib/twitter-api-utils.php
CHANGED
@@ -102,23 +102,12 @@ function twitter_api_relative_date( $strdate ){
|
|
102 |
|
103 |
|
104 |
/**
|
105 |
-
* Clean Emoji icons out of tweet text.
|
106 |
-
*
|
107 |
*/
|
108 |
function twitter_api_strip_emoji( $text ){
|
109 |
-
//
|
110 |
-
return
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
/**
|
116 |
-
* @internal
|
117 |
-
*/
|
118 |
-
function _twitter_api_strip_emoji_replace( array $r ){
|
119 |
-
// emoticons start at U+1F601 (\xF0\x9F\x98\x81)
|
120 |
-
// @todo plain text mappings for common smileys
|
121 |
-
return '';
|
122 |
}
|
123 |
|
124 |
|
102 |
|
103 |
|
104 |
/**
|
105 |
+
* Clean four-byte Emoji icons out of tweet text.
|
106 |
+
* MySQL utf8 columns cannot store four byte Unicode sequences
|
107 |
*/
|
108 |
function twitter_api_strip_emoji( $text ){
|
109 |
+
// four byte utf8: 11110www 10xxxxxx 10yyyyyy 10zzzzzz
|
110 |
+
return preg_replace('/[\xF0-\xF7][\x80-\xBF]{3}/', '', $text );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://timwhitlock.info/donate-to-a-project/
|
|
4 |
Tags: twitter, tweets, oauth, api, rest, api, widget, sidebar
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 3.5.1
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -75,6 +75,10 @@ Do so at your own risk.
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
78 |
= 1.0.14 =
|
79 |
* Timezone fixes
|
80 |
* Fixed bad status link
|
@@ -133,7 +137,7 @@ Do so at your own risk.
|
|
133 |
|
134 |
== Upgrade Notice ==
|
135 |
|
136 |
-
= 1.0.
|
137 |
* Bug fixes and improvements available.
|
138 |
|
139 |
|
4 |
Tags: twitter, tweets, oauth, api, rest, api, widget, sidebar
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 3.5.1
|
7 |
+
Stable tag: 1.0.15
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
75 |
|
76 |
== Changelog ==
|
77 |
|
78 |
+
= 1.0.15 =
|
79 |
+
* Passing additional params to widget_title filter
|
80 |
+
* Stripping four-byte Unicode sequences before wp cache inserts
|
81 |
+
|
82 |
= 1.0.14 =
|
83 |
* Timezone fixes
|
84 |
* Fixed bad status link
|
137 |
|
138 |
== Upgrade Notice ==
|
139 |
|
140 |
+
= 1.0.15 =
|
141 |
* Bug fixes and improvements available.
|
142 |
|
143 |
|