Latest Tweets Widget - Version 1.0.9

Version Description

  • Fixed pluralisation bug in date printing
  • Now expanding t.co links unless render_text filter is used
Download this release

Release Info

Developer timwhitlock
Plugin Icon 128x128 Latest Tweets Widget
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.8 to 1.0.9

lang/twitter-api-pt_BR.mo CHANGED
Binary file
lang/twitter-api-pt_BR.po CHANGED
@@ -3,296 +3,296 @@ msgstr ""
3
  "Project-Id-Version: Twitter API Wordpress plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: Fri, 22 Feb 2013 17:50:38 +0000\n"
6
- "PO-Revision-Date: Wed, 19 Jun 2013 15:17:13 +0100\n"
7
- "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "Language: Portuguese (Brazil)\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
- "X-Generator: Loco http://localise.biz \n"
15
  "X-Loco-Author: Tim Whitlock\n"
16
- "X-Loco-Source-Locale: en_GB\n"
17
- "X-Loco-Target-Locale: pt_BR\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
-
20
- #: Asset admin-fatal-denied
21
- msgid "You don't have permission to manage Twitter API settings"
22
- msgstr "Você não tem permissão para gerenciar a API do Twitter"
23
-
24
- #: Asset admin-notice-authenticated
25
- msgid "Authenticated as @%s"
26
- msgstr "Autenticado como @%s"
27
-
28
- #: Asset admin-notice-unauthed
29
- msgid "Plugin not yet authenticated with Twitter"
30
- msgstr "Plugin ainda não autenticado com o Twitter"
31
-
32
- #: Asset admin-notice-unconfigured
33
- msgid "Twitter application not fully configured"
34
- msgstr "Aplicação do Twitter não totalmente configurada"
35
-
36
- #: Asset error-oauth-empty-key
37
- msgid "Key required even if secret is empty"
38
- msgstr ""
39
-
40
- #: Asset error-oauth-invalid-token
41
- msgid "Invalid OAuth token"
42
- msgstr ""
43
-
44
- #: Asset error-twitter-generic
45
- msgid "Twitter error #%d"
46
- msgstr ""
47
-
48
- #: Asset error-twitter-invalid-param
49
- msgid "Invalid Twitter parameter"
50
- msgstr ""
51
-
52
- #: Asset error-twitter-malformed
53
- msgid "Malformed response from Twitter"
54
- msgstr ""
55
-
56
- #: Asset error-wordpress-http
57
- msgid "Wordpress HTTP request failure"
58
- msgstr ""
59
-
60
- #: Asset hours-ago-singular
61
- msgid "About an hour ago"
62
- msgid_plural "About %u hours ago"
63
- msgstr[0] "Cerca de uma hora atrás"
64
- msgstr[1] "Cerca de %u horas atrás"
65
-
66
- #: Asset http-status-100
67
- msgid "Continue"
68
- msgstr "Continuar"
69
-
70
- #: Asset http-status-101
71
- msgid "Switching Protocols"
72
- msgstr "Trocando protocolos"
73
-
74
- #: Asset http-status-200
75
- msgid "OK"
76
- msgstr "OK"
77
-
78
- #: Asset http-status-201
79
- msgid "Created"
80
- msgstr "Criado"
81
-
82
- #: Asset http-status-202
83
- msgid "Accepted"
84
- msgstr "Aceito"
85
-
86
- #: Asset http-status-203
87
- msgid "Non-Authoritative Information"
88
- msgstr "Informação não-autoritativa"
89
-
90
- #: Asset http-status-204
91
- msgid "No Content"
92
- msgstr "Sem conteúdo"
93
-
94
- #: Asset http-status-205
95
- msgid "Reset Content"
96
- msgstr "Resetar conteúdo"
97
-
98
- #: Asset http-status-206
99
- msgid "Partial Content"
100
- msgstr "Conteúdo parcial"
101
-
102
- #: Asset http-status-300
103
- msgid "Multiple Choices"
104
- msgstr "Múltipla escolha"
105
-
106
- #: Asset http-status-301
107
- msgid "Moved Permanently"
108
- msgstr "Movido permanentemente"
109
-
110
- #: Asset http-status-302
111
- msgid "Found"
112
- msgstr "Encontrado(a)"
113
-
114
- #: Asset http-status-303
115
- msgid "See Other"
116
- msgstr "Ver outros"
117
-
118
- #: Asset http-status-304
119
- msgid "Not Modified"
120
- msgstr "Não modificado"
121
-
122
- #: Asset http-status-305
123
- msgid "Use Proxy"
124
- msgstr ""
125
-
126
- #: Asset http-status-307
127
- msgid "Temporary Redirect"
128
- msgstr ""
129
-
130
- #: Asset http-status-400
131
- msgid "Bad Request"
132
- msgstr ""
133
-
134
- #: Asset http-status-401
135
- msgid "Authorization Required"
136
- msgstr ""
137
-
138
- #: Asset http-status-402
139
- msgid "Payment Required"
140
- msgstr ""
141
-
142
- #: Asset http-status-403
143
- msgid "Forbidden"
144
- msgstr ""
145
-
146
- #: Asset http-status-404
147
- msgid "Not Found"
148
- msgstr ""
149
-
150
- #: Asset http-status-405
151
- msgid "Method Not Allowed"
152
- msgstr ""
153
-
154
- #: Asset http-status-406
155
- msgid "Not Acceptable"
156
- msgstr ""
157
-
158
- #: Asset http-status-407
159
- msgid "Proxy Authentication Required"
160
- msgstr ""
161
-
162
- #: Asset http-status-408
163
- msgid "Request Time-out"
164
- msgstr ""
165
-
166
- #: Asset http-status-409
167
- msgid "Conflict"
168
- msgstr ""
169
-
170
- #: Asset http-status-410
171
- msgid "Gone"
172
- msgstr ""
173
-
174
- #: Asset http-status-411
175
- msgid "Length Required"
176
- msgstr ""
177
-
178
- #: Asset http-status-412
179
- msgid "Precondition Failed"
180
- msgstr ""
181
-
182
- #: Asset http-status-413
183
- msgid "Request Entity Too Large"
184
- msgstr ""
185
-
186
- #: Asset http-status-414
187
- msgid "Request-URI Too Large"
188
- msgstr ""
189
-
190
- #: Asset http-status-415
191
- msgid "Unsupported Media Type"
192
- msgstr ""
193
-
194
- #: Asset http-status-416
195
- msgid "Requested range not satisfiable"
196
- msgstr ""
197
-
198
- #: Asset http-status-417
199
- msgid "Expectation Failed"
200
- msgstr ""
201
-
202
- #: Asset http-status-429
203
- msgid "Twitter API rate limit exceeded"
204
- msgstr ""
205
-
206
- #: Asset http-status-500
207
- msgid "Twitter server error"
208
- msgstr ""
209
-
210
- #: Asset http-status-501
211
- msgid "Not Implemented"
212
- msgstr ""
213
-
214
- #: Asset http-status-502
215
- msgid "Twitter is not responding"
216
- msgstr ""
217
-
218
- #: Asset http-status-503
219
- msgid "Twitter is too busy to respond"
220
- msgstr ""
221
-
222
- #: Asset http-status-504
223
- msgid "Gateway Time-out"
224
- msgstr ""
225
-
226
- #: Asset http-status-505
227
- msgid "HTTP Version not supported"
228
- msgstr ""
229
-
230
- #: Asset just-now
231
- msgid "Just now"
232
- msgstr "Agora mesmo"
233
-
234
- #: Asset label-details-available-in
235
- msgid "These details are available in"
236
- msgstr "Detalhes disponíveis em"
237
-
238
- #: Asset label-twitter-api
239
- msgid "Twitter API"
240
- msgstr "API do Twitter"
241
-
242
- #: Asset label-your-twitter-dashboard
243
- msgid "your Twitter dashboard"
244
- msgstr "seu painel do Twitter"
245
-
246
- #: Asset latest-tweets
247
- msgid "Latest Tweets"
248
- msgstr ""
249
-
250
- #: Asset minutes-ago-singular
251
- msgid "%u minute ago"
252
- msgid_plural "%u minutes ago"
253
- msgstr[0] "1 minuto atrás"
254
- msgstr[1] "%u minutos atrás"
255
-
256
- #: Asset notice-unconfigured
257
- msgid "Twitter application is not fully configured"
258
- msgstr ""
259
-
260
- #: Asset number-of-tweets
261
- msgid "Number of tweets"
262
- msgstr ""
263
-
264
- #: Asset save-settings
265
- msgid "Save settings"
266
- msgstr "Salvar"
267
-
268
- #: Asset show-replies
269
- msgid "Show Replies"
270
- msgstr ""
271
-
272
- #: Asset show-retweets
273
- msgid "Show Retweets"
274
- msgstr ""
275
-
276
- #: Asset twitter-api-authentication-settings
277
- msgid "Twitter API Authentication Settings"
278
- msgstr ""
279
-
280
- #: Asset twitter-handle
281
- msgid "Twitter handle"
282
- msgstr ""
283
-
284
- #: Asset warning-no-apc
285
- msgid "Cannot enable Twitter API cache without APC extension"
286
- msgstr ""
287
-
288
- #: Asset warning-unauthed
289
- msgid "Twitter client not authenticated"
290
- msgstr ""
291
-
292
- #: Asset widget-title
293
- msgid "Widget title"
294
- msgstr ""
295
-
296
- #: Asset yesterday-at
297
- msgid "Yesterday at "
298
- msgstr "Ontem às"
3
  "Project-Id-Version: Twitter API Wordpress plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: Fri, 22 Feb 2013 17:50:38 +0000\n"
6
+ "PO-Revision-Date: 2013-06-21 10:00-0000\n"
7
+ "Last-Translator: Tim Whitlock <tim@timwhitlock.info>\n"
8
  "Language-Team: \n"
9
  "Language: Portuguese (Brazil)\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
+ "X-Generator: Poedit 1.5.3\n"
15
  "X-Loco-Author: Tim Whitlock\n"
16
+ "X-Loco-Source-Locale: en_GB\n"
17
+ "X-Loco-Target-Locale: pt_BR\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
+
20
+ #: Asset admin-fatal-denied
21
+ msgid "You don't have permission to manage Twitter API settings"
22
+ msgstr "Você não tem permissão para gerenciar a API do Twitter"
23
+
24
+ #: Asset admin-notice-authenticated
25
+ msgid "Authenticated as @%s"
26
+ msgstr "Autenticado como @%s"
27
+
28
+ #: Asset admin-notice-unauthed
29
+ msgid "Plugin not yet authenticated with Twitter"
30
+ msgstr "Plugin ainda não autenticado com o Twitter"
31
+
32
+ #: Asset admin-notice-unconfigured
33
+ msgid "Twitter application not fully configured"
34
+ msgstr "Aplicação do Twitter não totalmente configurada"
35
+
36
+ #: Asset error-oauth-empty-key
37
+ msgid "Key required even if secret is empty"
38
+ msgstr "Chave exigida mesmo se o secret estiver vazio"
39
+
40
+ #: Asset error-oauth-invalid-token
41
+ msgid "Invalid OAuth token"
42
+ msgstr "Token OAuth inválido"
43
+
44
+ #: Asset error-twitter-generic
45
+ msgid "Twitter error #%d"
46
+ msgstr "Erro no Twitter #%d"
47
+
48
+ #: Asset error-twitter-invalid-param
49
+ msgid "Invalid Twitter parameter"
50
+ msgstr "Parâmetro do Twitter inválido"
51
+
52
+ #: Asset error-twitter-malformed
53
+ msgid "Malformed response from Twitter"
54
+ msgstr "Resposta \"malformed\" do Twitter"
55
+
56
+ #: Asset error-wordpress-http
57
+ msgid "Wordpress HTTP request failure"
58
+ msgstr "Falha no HTTP request do Wordpress"
59
+
60
+ #: Asset hours-ago-singular
61
+ msgid "About an hour ago"
62
+ msgid_plural "About %u hours ago"
63
+ msgstr[0] "Cerca de uma hora atrás"
64
+ msgstr[1] "Cerca de %u horas atrás"
65
+
66
+ #: Asset http-status-100
67
+ msgid "Continue"
68
+ msgstr "Continuar"
69
+
70
+ #: Asset http-status-101
71
+ msgid "Switching Protocols"
72
+ msgstr "Trocando protocolos"
73
+
74
+ #: Asset http-status-200
75
+ msgid "OK"
76
+ msgstr "OK"
77
+
78
+ #: Asset http-status-201
79
+ msgid "Created"
80
+ msgstr "Criado"
81
+
82
+ #: Asset http-status-202
83
+ msgid "Accepted"
84
+ msgstr "Aceito"
85
+
86
+ #: Asset http-status-203
87
+ msgid "Non-Authoritative Information"
88
+ msgstr "Informação não-autoritativa"
89
+
90
+ #: Asset http-status-204
91
+ msgid "No Content"
92
+ msgstr "Sem conteúdo"
93
+
94
+ #: Asset http-status-205
95
+ msgid "Reset Content"
96
+ msgstr "Resetar conteúdo"
97
+
98
+ #: Asset http-status-206
99
+ msgid "Partial Content"
100
+ msgstr "Conteúdo parcial"
101
+
102
+ #: Asset http-status-300
103
+ msgid "Multiple Choices"
104
+ msgstr "Múltipla escolha"
105
+
106
+ #: Asset http-status-301
107
+ msgid "Moved Permanently"
108
+ msgstr "Movido permanentemente"
109
+
110
+ #: Asset http-status-302
111
+ msgid "Found"
112
+ msgstr "Encontrado(a)"
113
+
114
+ #: Asset http-status-303
115
+ msgid "See Other"
116
+ msgstr "Ver outros"
117
+
118
+ #: Asset http-status-304
119
+ msgid "Not Modified"
120
+ msgstr "Não modificado"
121
+
122
+ #: Asset http-status-305
123
+ msgid "Use Proxy"
124
+ msgstr "Usar Proxy"
125
+
126
+ #: Asset http-status-307
127
+ msgid "Temporary Redirect"
128
+ msgstr "Redirecionamento Temporário"
129
+
130
+ #: Asset http-status-400
131
+ msgid "Bad Request"
132
+ msgstr "Bad Request"
133
+
134
+ #: Asset http-status-401
135
+ msgid "Authorization Required"
136
+ msgstr "Autorização exigida"
137
+
138
+ #: Asset http-status-402
139
+ msgid "Payment Required"
140
+ msgstr "Pagamento Exigido"
141
+
142
+ #: Asset http-status-403
143
+ msgid "Forbidden"
144
+ msgstr "Proibido"
145
+
146
+ #: Asset http-status-404
147
+ msgid "Not Found"
148
+ msgstr "Não Encontrado"
149
+
150
+ #: Asset http-status-405
151
+ msgid "Method Not Allowed"
152
+ msgstr "Método Não Permitido"
153
+
154
+ #: Asset http-status-406
155
+ msgid "Not Acceptable"
156
+ msgstr "Não Aceitável"
157
+
158
+ #: Asset http-status-407
159
+ msgid "Proxy Authentication Required"
160
+ msgstr "Autenticação Proxy Exigida"
161
+
162
+ #: Asset http-status-408
163
+ msgid "Request Time-out"
164
+ msgstr "Request Time-out"
165
+
166
+ #: Asset http-status-409
167
+ msgid "Conflict"
168
+ msgstr "Conflito"
169
+
170
+ #: Asset http-status-410
171
+ msgid "Gone"
172
+ msgstr "Já era"
173
+
174
+ #: Asset http-status-411
175
+ msgid "Length Required"
176
+ msgstr "Comprimento exigido"
177
+
178
+ #: Asset http-status-412
179
+ msgid "Precondition Failed"
180
+ msgstr "Falha na pré-condição"
181
+
182
+ #: Asset http-status-413
183
+ msgid "Request Entity Too Large"
184
+ msgstr "Entidade do request muito grande"
185
+
186
+ #: Asset http-status-414
187
+ msgid "Request-URI Too Large"
188
+ msgstr "URI de Request muito grande"
189
+
190
+ #: Asset http-status-415
191
+ msgid "Unsupported Media Type"
192
+ msgstr "Tipo de mídia não suportado"
193
+
194
+ #: Asset http-status-416
195
+ msgid "Requested range not satisfiable"
196
+ msgstr "Range solicitado não satisfatório"
197
+
198
+ #: Asset http-status-417
199
+ msgid "Expectation Failed"
200
+ msgstr "Falha na expectativa"
201
+
202
+ #: Asset http-status-429
203
+ msgid "Twitter API rate limit exceeded"
204
+ msgstr "Taxa de limite da API do Twitter excedida"
205
+
206
+ #: Asset http-status-500
207
+ msgid "Twitter server error"
208
+ msgstr "Erro no Servidor do Twitter"
209
+
210
+ #: Asset http-status-501
211
+ msgid "Not Implemented"
212
+ msgstr "Não Implementado"
213
+
214
+ #: Asset http-status-502
215
+ msgid "Twitter is not responding"
216
+ msgstr "Twitter não está respondendo"
217
+
218
+ #: Asset http-status-503
219
+ msgid "Twitter is too busy to respond"
220
+ msgstr "Twitter muito ocupado para responder"
221
+
222
+ #: Asset http-status-504
223
+ msgid "Gateway Time-out"
224
+ msgstr "Timeout no Gateway"
225
+
226
+ #: Asset http-status-505
227
+ msgid "HTTP Version not supported"
228
+ msgstr "Versão HTTP não suportada"
229
+
230
+ #: Asset just-now
231
+ msgid "Just now"
232
+ msgstr "Agora mesmo"
233
+
234
+ #: Asset label-details-available-in
235
+ msgid "These details are available in"
236
+ msgstr "Detalhes disponíveis em"
237
+
238
+ #: Asset label-twitter-api
239
+ msgid "Twitter API"
240
+ msgstr "API do Twitter"
241
+
242
+ #: Asset label-your-twitter-dashboard
243
+ msgid "your Twitter dashboard"
244
+ msgstr "seu painel do Twitter"
245
+
246
+ #: Asset latest-tweets
247
+ msgid "Latest Tweets"
248
+ msgstr "Últimos Tweets"
249
+
250
+ #: Asset minutes-ago-singular
251
+ msgid "%u minute ago"
252
+ msgid_plural "%u minutes ago"
253
+ msgstr[0] "1 minuto atrás"
254
+ msgstr[1] "%u minutos atrás"
255
+
256
+ #: Asset notice-unconfigured
257
+ msgid "Twitter application is not fully configured"
258
+ msgstr "Aplicação do Twitter não está totalmente configurada"
259
+
260
+ #: Asset number-of-tweets
261
+ msgid "Number of tweets"
262
+ msgstr "Número de tweets"
263
+
264
+ #: Asset save-settings
265
+ msgid "Save settings"
266
+ msgstr "Salvar"
267
+
268
+ #: Asset show-replies
269
+ msgid "Show Replies"
270
+ msgstr "Mostrar Replies"
271
+
272
+ #: Asset show-retweets
273
+ msgid "Show Retweets"
274
+ msgstr "Mostrar RTs"
275
+
276
+ #: Asset twitter-api-authentication-settings
277
+ msgid "Twitter API Authentication Settings"
278
+ msgstr "Configurações de Autenticação da API do Twitter"
279
+
280
+ #: Asset twitter-handle
281
+ msgid "Twitter handle"
282
+ msgstr "Login no Twitter"
283
+
284
+ #: Asset warning-no-apc
285
+ msgid "Cannot enable Twitter API cache without APC extension"
286
+ msgstr "Não é possível habilitar o cache da API do Twiiter sem APC..."
287
+
288
+ #: Asset warning-unauthed
289
+ msgid "Twitter client not authenticated"
290
+ msgstr "Cliente do Twitter não autenticado"
291
+
292
+ #: Asset widget-title
293
+ msgid "Widget title"
294
+ msgstr "Título do Widget"
295
+
296
+ #: Asset yesterday-at
297
+ msgid "Yesterday at "
298
+ msgstr "Ontem às"
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
8
  Author URI: http://timwhitlock.info/
9
  */
10
 
@@ -56,7 +56,12 @@ function latest_tweets_render( $screen_name, $count, $rts, $ats ){
56
  // render and linkify tweet, unless theme overrides with filter
57
  $html = apply_filters('latest_tweets_render_text', $text );
58
  if( $html === $text ){
59
- function_exists('twitter_api_html') or twitter_api_include('utils');
 
 
 
 
 
60
  $html = twitter_api_html( $text );
61
  }
62
  // piece together the whole tweet, allowing overide
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.9
8
  Author URI: http://timwhitlock.info/
9
  */
10
 
56
  // render and linkify tweet, unless theme overrides with filter
57
  $html = apply_filters('latest_tweets_render_text', $text );
58
  if( $html === $text ){
59
+ if( ! function_exists('twitter_api_html') ){
60
+ twitter_api_include('utils');
61
+ }
62
+ if( ! empty($entities['urls']) || ! empty($entities['media']) ){
63
+ $text = twitter_api_expand_urls( $text, $entities );
64
+ }
65
  $html = twitter_api_html( $text );
66
  }
67
  // piece together the whole tweet, allowing overide
lib/twitter-api-utils.php CHANGED
@@ -18,8 +18,11 @@ function twitter_api_html( $src, $target = '_blank', $alreadyhtml = false ){
18
  if( ! $alreadyhtml ){
19
  $src = esc_html( $src );
20
  }
21
- // linkify URLs
22
- $src = preg_replace('!https?://\S+!', '<a href="\\0" target="'.$target.'">\\0</a>', $src );
 
 
 
23
  // linkify @names
24
  $src = preg_replace('!@([a-z0-9_]{1,15})!i', '<a class="twitter-screen-name" href="https://twitter.com/\\1" target="'.$target.'">\\0</a>', $src );
25
  // linkify #hashtags
@@ -29,6 +32,20 @@ function twitter_api_html( $src, $target = '_blank', $alreadyhtml = false ){
29
 
30
 
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  /**
34
  * Utility converts the date [of a tweet] to relative time descriprion, e.g. about 2 minutes ago
@@ -60,7 +77,7 @@ function twitter_api_relative_date( $strdate ){
60
  // within last hour? X minutes ago
61
  if( $tdiff < 3600 ){
62
  $idiff = (int) floor( $tdiff / 60 );
63
- return sprintf( _n( '1 minute ago', '%u minutes ago', $idiff ), $idiff );
64
  }
65
  // within same day? About X hours ago
66
  $samey = ($y === $yy) and
@@ -103,3 +120,29 @@ function _twitter_api_strip_emoji_replace( array $r ){
103
  }
104
 
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  if( ! $alreadyhtml ){
19
  $src = esc_html( $src );
20
  }
21
+ // linkify URLs (restricting to 30 chars as per twitter.com)
22
+ $src = preg_replace_callback('!https?://(\S+)!', 'twitter_api_html_linkify_callback', $src );
23
+ if( '_blank' !== $target ){
24
+ $src = str_replace( '"_blank"', '"'.$target.'"', $src );
25
+ }
26
  // linkify @names
27
  $src = preg_replace('!@([a-z0-9_]{1,15})!i', '<a class="twitter-screen-name" href="https://twitter.com/\\1" target="'.$target.'">\\0</a>', $src );
28
  // linkify #hashtags
32
 
33
 
34
 
35
+ /**
36
+ * @internal
37
+ */
38
+ function twitter_api_html_linkify_callback( array $r ){
39
+ list( $href, $text ) = $r;
40
+ if( isset($text{30}) ){
41
+ $text = substr_replace( $text, '&hellip;', 30 );
42
+ }
43
+ return '<a href="'.$href.'" target="_blank">'.$text.'</a>';
44
+ }
45
+
46
+
47
+
48
+
49
 
50
  /**
51
  * Utility converts the date [of a tweet] to relative time descriprion, e.g. about 2 minutes ago
77
  // within last hour? X minutes ago
78
  if( $tdiff < 3600 ){
79
  $idiff = (int) floor( $tdiff / 60 );
80
+ return sprintf( _n( '%u minute ago', '%u minutes ago', $idiff ), $idiff );
81
  }
82
  // within same day? About X hours ago
83
  $samey = ($y === $yy) and
120
  }
121
 
122
 
123
+
124
+ /**
125
+ * Resolve shortened url fields via entities
126
+ * @return string
127
+ */
128
+ function twitter_api_expand_urls( $text, array $entities ){
129
+ if( isset($entities['urls']) && is_array($entities['urls']) ){
130
+ foreach( $entities['urls'] as $r ){
131
+ $text = str_replace( $r['url'], $r['expanded_url'], $text );
132
+ }
133
+ }
134
+ if( isset($entities['media']) && is_array($entities['media']) ){
135
+ foreach( $entities['media'] as $r ){
136
+ if( 0 === strpos($r['display_url'], 'pic.twitter.com' ) ) {
137
+ $text = str_replace( $r['url'], 'https://'.$r['display_url'], $text );
138
+ }
139
+ else {
140
+ $text = str_replace( $r['url'], $r['expanded_url'], $text );
141
+ }
142
+ }
143
+ }
144
+ return $text;
145
+ }
146
+
147
+
148
+
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
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.8 =
79
  * Added `latest_tweets_cache_seconds` filter
80
  * Added German translations
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.9
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.9 =
79
+ * Fixed pluralisation bug in date printing
80
+ * Now expanding t.co links unless render_text filter is used
81
+
82
  = 1.0.8 =
83
  * Added `latest_tweets_cache_seconds` filter
84
  * Added German translations