Version Description
- Includes Carousel rotation. Enforces rules on replies and retweets even if the Twitter API doesn't.
=
Download this release
Release Info
Developer | mpntod |
Plugin | Rotating Tweets (Twitter widget and shortcode) |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.5.0 to 1.5.1
- readme.txt +8 -3
- rotatingtweets.php +237 -232
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets,animation,jquery,jquery cycle,cycle,multilingual,responsive
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.6
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -162,10 +162,15 @@ into your CSS - changing `123px;` to the width you're aiming at - either via put
|
|
162 |
You can do this by going to the `rotatingtweets/css` directory and renaming `rotatingtweets-sample.css` to `rotatingtweets.css` and putting it in the `wp-content/uploads/` directory. This displays a Twitter bird to the left of your tweets. Any CSS you put into `rotatingtweets.css` won't be overwritten when the plug-in is upgraded to the latest version.
|
163 |
|
164 |
== Upgrade notice ==
|
165 |
-
= 1.5.
|
166 |
-
*
|
167 |
|
168 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
169 |
= 1.5.0 =
|
170 |
* Added `Carousel` rotation option and beta support for [version 2 of JQuery Cycle](http://jquery.malsup.com/cycle2/)
|
171 |
* Added `link_all_text` shortcode tag and functionality
|
4 |
Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets,animation,jquery,jquery cycle,cycle,multilingual,responsive
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.6
|
7 |
+
Stable tag: 1.5.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
162 |
You can do this by going to the `rotatingtweets/css` directory and renaming `rotatingtweets-sample.css` to `rotatingtweets.css` and putting it in the `wp-content/uploads/` directory. This displays a Twitter bird to the left of your tweets. Any CSS you put into `rotatingtweets.css` won't be overwritten when the plug-in is upgraded to the latest version.
|
163 |
|
164 |
== Upgrade notice ==
|
165 |
+
= 1.5.1 =
|
166 |
+
* Includes Carousel rotation. Enforces rules on replies and retweets even if the Twitter API doesn't.
|
167 |
|
168 |
== Changelog ==
|
169 |
+
= 1.5.1 =
|
170 |
+
* Enforce rules on replies and retweets even if the Twitter API doesn't
|
171 |
+
* Fixed problem with [Magazino template](http://wordpress.org/themes/magazino)
|
172 |
+
* Fixed incorrect message on settings page
|
173 |
+
|
174 |
= 1.5.0 =
|
175 |
* Added `Carousel` rotation option and beta support for [version 2 of JQuery Cycle](http://jquery.malsup.com/cycle2/)
|
176 |
* Added `link_all_text` shortcode tag and functionality
|
rotatingtweets.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Rotating Tweets (Twitter widget & shortcode)
|
4 |
Description: Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
|
5 |
-
Version: 1.5.
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
@@ -623,7 +623,7 @@ function rotatingtweets_api_explanation() {
|
|
623 |
};
|
624 |
// Explanatory text
|
625 |
function rotatingtweets_jquery_explanation() {
|
626 |
-
_e('This section is experimental and currently only displays if WP_DEBUG is set','rotatingtweets');
|
627 |
};
|
628 |
// validate our options
|
629 |
function rotatingtweets_api_validate($input) {
|
@@ -1059,7 +1059,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1059 |
endif;
|
1060 |
# Now set all the version 2 options
|
1061 |
$v2string = '';
|
1062 |
-
if(isset($api['jquery_cycle_version']) && $api['jquery_cycle_version'] == 2):
|
1063 |
$v2options = array(
|
1064 |
'auto-height' => 'calc',
|
1065 |
'fx' => $rotation_type,
|
@@ -1147,249 +1147,253 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1147 |
$targetvalue = '';
|
1148 |
}
|
1149 |
foreach($json as $twitter_object):
|
1150 |
-
$
|
1151 |
-
if($
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
$
|
1156 |
-
|
1157 |
-
# Now to process the text
|
1158 |
-
// print_r($twitter_object);
|
1159 |
-
$main_text = $twitter_object['text'];
|
1160 |
-
if(!empty($main_text)):
|
1161 |
-
$user = $twitter_object['user'];
|
1162 |
-
$tweetuser = $user;
|
1163 |
-
# Now the substitutions
|
1164 |
-
$entities = $twitter_object['entities'];
|
1165 |
-
# Fix up retweets, links, hashtags and use names
|
1166 |
-
unset($before);
|
1167 |
-
unset($after);
|
1168 |
-
unset($retweeter);
|
1169 |
-
# First clean up the retweets
|
1170 |
-
if(isset($twitter_object['retweeted_status'])):
|
1171 |
-
$rt_data = $twitter_object['retweeted_status'];
|
1172 |
else:
|
1173 |
-
|
1174 |
endif;
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1183 |
else:
|
1184 |
-
$
|
1185 |
endif;
|
1186 |
-
$
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
if(!empty($user_mentions)):
|
1197 |
-
foreach($user_mentions as $user_mention):
|
1198 |
-
$before[] = "*@".$user_mention['screen_name']."\b*i";
|
1199 |
-
$after[] = rotatingtweets_user_intent($user_mention,$twitterlocale,'screen_name',$targetvalue);
|
1200 |
-
endforeach;
|
1201 |
-
# Clearing up duplicates to avoid strange result (possibly risky?)
|
1202 |
-
$before = array_unique($before);
|
1203 |
-
$after = array_unique($after);
|
1204 |
-
endif;
|
1205 |
-
# Now the URLs
|
1206 |
-
if(isset($entities['urls'])):
|
1207 |
-
$urls = $entities['urls'];
|
1208 |
-
else:
|
1209 |
-
unset($urls);
|
1210 |
-
endif;
|
1211 |
-
if(!empty($urls)):
|
1212 |
-
foreach($urls as $url):
|
1213 |
-
$before[] = "*".$url['url']."*";
|
1214 |
-
$displayurl = $url['display_url'];
|
1215 |
-
if(strlen($displayurl)>$urllength):
|
1216 |
-
# PHP sometimes has a really hard time with unicode characters - this one removes the ellipsis
|
1217 |
-
$displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
|
1218 |
-
$displayurl = substr($displayurl,0,$urllength)."…";
|
1219 |
-
endif;
|
1220 |
-
$after[] = "<a href='".$url['url']."' title='".$url['expanded_url']."'".$targetvalue.">".esc_html($displayurl)."</a>";
|
1221 |
-
endforeach;
|
1222 |
-
endif;
|
1223 |
-
if(isset($entities['media'])):
|
1224 |
-
$media = $entities['media'];
|
1225 |
-
else:
|
1226 |
-
unset($media);
|
1227 |
-
endif;
|
1228 |
-
if(!empty($media)):
|
1229 |
-
foreach($media as $medium):
|
1230 |
-
$before[] = "*".$medium['url']."*";
|
1231 |
-
$displayurl = $medium['display_url'];
|
1232 |
-
if(strlen($displayurl)>$urllength):
|
1233 |
-
$displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
|
1234 |
-
$displayurl = substr($displayurl,0,$urllength)."…";
|
1235 |
endif;
|
1236 |
-
$
|
1237 |
-
|
1238 |
-
|
1239 |
-
// $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
|
1240 |
-
# This is designed to find hashtags and turn them into links...
|
1241 |
-
$before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%";
|
1242 |
-
$after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
|
1243 |
-
$main_text = preg_replace($before,$after,$main_text);
|
1244 |
-
if(isset($args['link_all_text']) && $args['link_all_text']):
|
1245 |
-
$main_text = rotatingtweets_user_intent($tweetuser,$twitterlocale,$main_text,$targetvalue);
|
1246 |
-
endif;
|
1247 |
-
# Now for the meta text
|
1248 |
-
switch ($args['official_format']) {
|
1249 |
-
case 0:
|
1250 |
-
# This is the original Rotating Tweets display routine
|
1251 |
-
$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
|
1252 |
-
$meta = '';
|
1253 |
-
if($args['show_meta_timestamp']):
|
1254 |
-
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1255 |
-
endif;
|
1256 |
-
if($args['show_meta_screen_name']):
|
1257 |
-
if(!empty($meta)) $meta .= ' ';
|
1258 |
-
$meta .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']);
|
1259 |
-
endif;
|
1260 |
-
if($args['show_meta_via']):
|
1261 |
-
if(!empty($meta)) $meta .= ' ';
|
1262 |
-
$meta .=sprintf(__("via %s",'rotatingtweets'),$twitter_object['source']);
|
1263 |
-
endif;
|
1264 |
-
if($args['show_meta_reply_retweet_favorite']):
|
1265 |
-
if(!empty($meta)) $meta .= ' · ';
|
1266 |
-
$meta .= rotatingtweets_intents($twitter_object,$twitterlocale, 0,$targetvalue);
|
1267 |
-
endif;
|
1268 |
-
|
1269 |
-
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1270 |
-
if(!empty($meta)) $meta .= ' · ';
|
1271 |
-
$meta .= $nextprev;
|
1272 |
endif;
|
1273 |
-
|
1274 |
-
if(
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
$result .= "\n\t<div class='rtw_info'>";
|
1279 |
-
$result .= "\n\t\t<div class='rtw_twitter_icon'><img src='".plugins_url('images/bird_16_blue.png', __FILE__)."' alt='".__('Twitter','rotatingtweets')."' /></div>";
|
1280 |
-
$result .= "\n\t\t<div class='rtw_icon'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'icon',$targetvalue)."</div>";
|
1281 |
-
$result .= "\n\t\t<div class='rtw_name'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'name',$targetvalue)."</div>";
|
1282 |
-
$result .= "\n\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1283 |
-
$result .= "\n\t</div>";
|
1284 |
-
$result .= "\n\t<p class='rtw_main'>".$main_text."</p>";
|
1285 |
-
$result .= "\n\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1286 |
-
$result .= rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1287 |
-
if(isset($retweeter)) {
|
1288 |
-
$result .= " · ".rotatingtweets_user_intent($retweeter,$twitterlocale,sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name']),$targetvalue);
|
1289 |
-
}
|
1290 |
-
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1291 |
-
$result .= ' · '.$nextprev;
|
1292 |
-
endif;
|
1293 |
-
$result .= "\n</div>";
|
1294 |
-
break;
|
1295 |
-
case 2:
|
1296 |
-
# This is a slightly adjusted version of the original tweet - designed for wide boxes - consistent with Twitter guidelines
|
1297 |
-
$result .= "\n\t\t<div class='rtw_wide'>";
|
1298 |
-
$result .= "\n\t\t<div class='rtw_wide_icon'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'icon',$targetvalue)."</div>";
|
1299 |
-
$result .= "\n\t\t<div class='rtw_wide_block'><div class='rtw_info'>";
|
1300 |
-
$result .= "\n\t\t\t<div class='rtw_time_short'>".rotatingtweets_timestamp_link($twitter_object,'short',$targetvalue).'</div>';
|
1301 |
-
$result .= "\n\t\t\t<div class='rtw_name'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'name',$targetvalue)."</div>";
|
1302 |
-
$result .= "\n\t\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1303 |
-
$result .= "\n\t\t</div>";
|
1304 |
-
$result .= "\n\t\t<p class='rtw_main'>".$main_text."</p>";
|
1305 |
-
// $result .= "\n\t\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1).'</div>';
|
1306 |
-
if(isset($retweeter)) {
|
1307 |
-
$result .= "\n\t\t<div class='rtw_rt_meta'>".rotatingtweets_user_intent($retweeter,$twitterlocale,"<img src='".plugins_url('images/retweet_on.png',__FILE__)."' width='16' height='16' alt='".sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name'])."' />".sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name']),$targetvalue)."</div>";
|
1308 |
-
}
|
1309 |
-
$result .= "\n\t\t<div class='rtw_meta'><span class='rtw_expand' style='display:none;'>".__('Expand','rotatingtweets')."</span><span class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 2,$targetvalue);
|
1310 |
-
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1311 |
-
$result .= wp_kses_post($args['middot']).$nextprev;
|
1312 |
-
endif;
|
1313 |
-
$result .= "</span></div></div></div>";
|
1314 |
-
break;
|
1315 |
-
case 3:
|
1316 |
-
# This one uses the twitter standard approach for embedding via their javascript API - unfortunately I can't work out how to make it work with the rotating tweet javascript! If anyone can work out how to calculate the height of a oEmbed Twitter tweet, I will be very grateful! :-)
|
1317 |
-
$result .= '<blockquote class="twitter-tweet">';
|
1318 |
-
$result .= "<p>".$main_text."</p>";
|
1319 |
-
$result .= '— '.$user['name'].' (@'.$user['screen_name'].') <a href="https://twitter.com/twitterapi/status/'.$twitter_object['id_str'].'" data-datetime="'.date('c',strtotime($twitter_object['created_at'])).'"'.$targetvalue.'>'.date_i18n(get_option('date_format') ,strtotime($twitter_object['created_at'])).'</a>';
|
1320 |
-
$result .= '</blockquote>';
|
1321 |
-
break;
|
1322 |
-
case 4:
|
1323 |
-
$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
|
1324 |
-
$result .= "\n\t<div class='rtw_meta rtw_info'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1325 |
-
if($args['show_meta_screen_name']):
|
1326 |
-
$result .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']).' · ';
|
1327 |
-
endif;
|
1328 |
-
$result .= rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1329 |
-
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1330 |
-
$result .= ' · '.$nextprev;
|
1331 |
-
endif;
|
1332 |
-
$result .= "\n</div>";
|
1333 |
-
break;
|
1334 |
-
case 5:
|
1335 |
-
# This is an adjusted Rotating Tweets display routine
|
1336 |
-
$result .= "\n\t\t<p class='rtw_main'><img src='".plugins_url('images/bird_16_black.png', __FILE__)."' alt='Twitter' /> $main_text ";
|
1337 |
-
$meta = '';
|
1338 |
-
if($args['show_meta_timestamp']):
|
1339 |
-
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1340 |
-
endif;
|
1341 |
-
if($args['show_meta_screen_name']):
|
1342 |
-
if(!empty($meta)) $meta .= ' ';
|
1343 |
-
$meta .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']);
|
1344 |
-
endif;
|
1345 |
-
if($args['show_meta_via']):
|
1346 |
-
if(!empty($meta)) $meta .= ' ';
|
1347 |
-
$meta .=sprintf(__("via %s",'rotatingtweets'),$twitter_object['source']);
|
1348 |
endif;
|
1349 |
-
if($
|
1350 |
-
|
1351 |
-
|
|
|
|
|
|
|
|
|
|
|
1352 |
endif;
|
1353 |
-
|
1354 |
-
|
1355 |
-
$
|
|
|
|
|
1356 |
endif;
|
1357 |
-
if(!empty($
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
|
|
|
|
|
|
1365 |
endif;
|
1366 |
-
if($
|
1367 |
-
|
1368 |
-
|
|
|
1369 |
endif;
|
1370 |
-
if($
|
1371 |
-
|
1372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1373 |
endif;
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
|
|
|
|
|
|
|
|
1377 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1378 |
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1391 |
endif;
|
1392 |
-
$result .= "</div>";
|
1393 |
endif;
|
1394 |
endforeach;
|
1395 |
endif;
|
@@ -1472,7 +1476,9 @@ function rotatingtweets_enqueue_scripts() {
|
|
1472 |
}
|
1473 |
# Check if we're using jQuery Cycle 1 or 2
|
1474 |
$api = get_option('rotatingtweets-api-settings');
|
1475 |
-
|
|
|
|
|
1476 |
/*
|
1477 |
'jquery-easing' => 'http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js',
|
1478 |
*/
|
@@ -1489,7 +1495,6 @@ function rotatingtweets_enqueue_scripts() {
|
|
1489 |
endforeach;
|
1490 |
else:
|
1491 |
# Get Stylesheet
|
1492 |
-
$style = strtolower(get_stylesheet());
|
1493 |
switch ($style):
|
1494 |
case 'bremen_theme':
|
1495 |
case 'zeebizzcard':
|
2 |
/*
|
3 |
Plugin Name: Rotating Tweets (Twitter widget & shortcode)
|
4 |
Description: Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
|
5 |
+
Version: 1.5.1
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
623 |
};
|
624 |
// Explanatory text
|
625 |
function rotatingtweets_jquery_explanation() {
|
626 |
+
// _e('This section is experimental and currently only displays if WP_DEBUG is set','rotatingtweets');
|
627 |
};
|
628 |
// validate our options
|
629 |
function rotatingtweets_api_validate($input) {
|
1059 |
endif;
|
1060 |
# Now set all the version 2 options
|
1061 |
$v2string = '';
|
1062 |
+
if( strtolower(get_stylesheet()) == 'magazino' || isset($api['jquery_cycle_version']) && $api['jquery_cycle_version'] == 2):
|
1063 |
$v2options = array(
|
1064 |
'auto-height' => 'calc',
|
1065 |
'fx' => $rotation_type,
|
1147 |
$targetvalue = '';
|
1148 |
}
|
1149 |
foreach($json as $twitter_object):
|
1150 |
+
if ( ! ( ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@') || (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) ):
|
1151 |
+
// if (! ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@')): // This works to exlude replies
|
1152 |
+
// if (! (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) : // This works to exclude retweets
|
1153 |
+
$tweet_counter++;
|
1154 |
+
if($tweet_counter <= $tweet_count):
|
1155 |
+
if($tweet_counter == 1 || ( isset($args['no_rotate']) && $args['no_rotate'] ) || $rotation_type == 'carousel' ):
|
1156 |
+
$result .= "\n\t<div class = 'rotatingtweet'>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1157 |
else:
|
1158 |
+
$result .= "\n\t<div class = 'rotatingtweet' style='display:none'>";
|
1159 |
endif;
|
1160 |
+
# Now to process the text
|
1161 |
+
// print_r($twitter_object);
|
1162 |
+
$main_text = $twitter_object['text'];
|
1163 |
+
if(!empty($main_text)):
|
1164 |
+
$user = $twitter_object['user'];
|
1165 |
+
$tweetuser = $user;
|
1166 |
+
# Now the substitutions
|
1167 |
+
$entities = $twitter_object['entities'];
|
1168 |
+
# Fix up retweets, links, hashtags and use names
|
1169 |
+
unset($before);
|
1170 |
+
unset($after);
|
1171 |
+
unset($retweeter);
|
1172 |
+
# First clean up the retweets
|
1173 |
+
if(isset($twitter_object['retweeted_status'])):
|
1174 |
+
$rt_data = $twitter_object['retweeted_status'];
|
1175 |
else:
|
1176 |
+
unset($rt_data);
|
1177 |
endif;
|
1178 |
+
if(!empty($rt_data)):
|
1179 |
+
$rt_user = $rt_data['user'];
|
1180 |
+
// These versions remove RT and use the original text
|
1181 |
+
$rt_replace_array = array(1,2,3);
|
1182 |
+
if(in_array($args['official_format'],$rt_replace_array)):
|
1183 |
+
$main_text = $rt_data['text'];
|
1184 |
+
$retweeter = $user;
|
1185 |
+
$tweetuser = $rt_user;
|
1186 |
+
else:
|
1187 |
+
$main_text = "RT @".$rt_user['screen_name'] . " " . $rt_data['text'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1188 |
endif;
|
1189 |
+
$before[] = "*@".$rt_user['screen_name']."\b*i";
|
1190 |
+
$after[] = rotatingtweets_user_intent($rt_user,$twitterlocale,'screen_name',$targetvalue);
|
1191 |
+
$entities = $rt_data['entities'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1192 |
endif;
|
1193 |
+
# First the user mentions
|
1194 |
+
if(isset($entities['user_mentions'])):
|
1195 |
+
$user_mentions = $entities['user_mentions'];
|
1196 |
+
else:
|
1197 |
+
unset($user_mentions);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1198 |
endif;
|
1199 |
+
if(!empty($user_mentions)):
|
1200 |
+
foreach($user_mentions as $user_mention):
|
1201 |
+
$before[] = "*@".$user_mention['screen_name']."\b*i";
|
1202 |
+
$after[] = rotatingtweets_user_intent($user_mention,$twitterlocale,'screen_name',$targetvalue);
|
1203 |
+
endforeach;
|
1204 |
+
# Clearing up duplicates to avoid strange result (possibly risky?)
|
1205 |
+
$before = array_unique($before);
|
1206 |
+
$after = array_unique($after);
|
1207 |
endif;
|
1208 |
+
# Now the URLs
|
1209 |
+
if(isset($entities['urls'])):
|
1210 |
+
$urls = $entities['urls'];
|
1211 |
+
else:
|
1212 |
+
unset($urls);
|
1213 |
endif;
|
1214 |
+
if(!empty($urls)):
|
1215 |
+
foreach($urls as $url):
|
1216 |
+
$before[] = "*".$url['url']."*";
|
1217 |
+
$displayurl = $url['display_url'];
|
1218 |
+
if(strlen($displayurl)>$urllength):
|
1219 |
+
# PHP sometimes has a really hard time with unicode characters - this one removes the ellipsis
|
1220 |
+
$displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
|
1221 |
+
$displayurl = substr($displayurl,0,$urllength)."…";
|
1222 |
+
endif;
|
1223 |
+
$after[] = "<a href='".$url['url']."' title='".$url['expanded_url']."'".$targetvalue.">".esc_html($displayurl)."</a>";
|
1224 |
+
endforeach;
|
1225 |
endif;
|
1226 |
+
if(isset($entities['media'])):
|
1227 |
+
$media = $entities['media'];
|
1228 |
+
else:
|
1229 |
+
unset($media);
|
1230 |
endif;
|
1231 |
+
if(!empty($media)):
|
1232 |
+
foreach($media as $medium):
|
1233 |
+
$before[] = "*".$medium['url']."*";
|
1234 |
+
$displayurl = $medium['display_url'];
|
1235 |
+
if(strlen($displayurl)>$urllength):
|
1236 |
+
$displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
|
1237 |
+
$displayurl = substr($displayurl,0,$urllength)."…";
|
1238 |
+
endif;
|
1239 |
+
$after[] = "<a href='".$medium['url']."' title='".$medium['expanded_url']."'".$targetvalue.">".esc_html($displayurl)."</a>";
|
1240 |
+
endforeach;
|
1241 |
endif;
|
1242 |
+
// $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
|
1243 |
+
# This is designed to find hashtags and turn them into links...
|
1244 |
+
$before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%";
|
1245 |
+
$after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
|
1246 |
+
$main_text = preg_replace($before,$after,$main_text);
|
1247 |
+
if(isset($args['link_all_text']) && $args['link_all_text']):
|
1248 |
+
$main_text = rotatingtweets_user_intent($tweetuser,$twitterlocale,$main_text,$targetvalue);
|
1249 |
endif;
|
1250 |
+
# Now for the meta text
|
1251 |
+
switch ($args['official_format']) {
|
1252 |
+
case 0:
|
1253 |
+
# This is the original Rotating Tweets display routine
|
1254 |
+
$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
|
1255 |
+
$meta = '';
|
1256 |
+
if($args['show_meta_timestamp']):
|
1257 |
+
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1258 |
+
endif;
|
1259 |
+
if($args['show_meta_screen_name']):
|
1260 |
+
if(!empty($meta)) $meta .= ' ';
|
1261 |
+
$meta .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']);
|
1262 |
+
endif;
|
1263 |
+
if($args['show_meta_via']):
|
1264 |
+
if(!empty($meta)) $meta .= ' ';
|
1265 |
+
$meta .=sprintf(__("via %s",'rotatingtweets'),$twitter_object['source']);
|
1266 |
+
endif;
|
1267 |
+
if($args['show_meta_reply_retweet_favorite']):
|
1268 |
+
if(!empty($meta)) $meta .= ' · ';
|
1269 |
+
$meta .= rotatingtweets_intents($twitter_object,$twitterlocale, 0,$targetvalue);
|
1270 |
+
endif;
|
1271 |
|
1272 |
+
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1273 |
+
if(!empty($meta)) $meta .= ' · ';
|
1274 |
+
$meta .= $nextprev;
|
1275 |
+
endif;
|
1276 |
|
1277 |
+
if(!empty($meta)) $result .= "\n\t\t<p class='rtw_meta'>".ucfirst($meta)."</p>";
|
1278 |
+
break;
|
1279 |
+
case 1:
|
1280 |
+
# This is an attempt to replicate the original Tweet
|
1281 |
+
$result .= "\n\t<div class='rtw_info'>";
|
1282 |
+
$result .= "\n\t\t<div class='rtw_twitter_icon'><img src='".plugins_url('images/bird_16_blue.png', __FILE__)."' alt='".__('Twitter','rotatingtweets')."' /></div>";
|
1283 |
+
$result .= "\n\t\t<div class='rtw_icon'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'icon',$targetvalue)."</div>";
|
1284 |
+
$result .= "\n\t\t<div class='rtw_name'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'name',$targetvalue)."</div>";
|
1285 |
+
$result .= "\n\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1286 |
+
$result .= "\n\t</div>";
|
1287 |
+
$result .= "\n\t<p class='rtw_main'>".$main_text."</p>";
|
1288 |
+
$result .= "\n\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1289 |
+
$result .= rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1290 |
+
if(isset($retweeter)) {
|
1291 |
+
$result .= " · ".rotatingtweets_user_intent($retweeter,$twitterlocale,sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name']),$targetvalue);
|
1292 |
+
}
|
1293 |
+
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1294 |
+
$result .= ' · '.$nextprev;
|
1295 |
+
endif;
|
1296 |
+
$result .= "\n</div>";
|
1297 |
+
break;
|
1298 |
+
case 2:
|
1299 |
+
# This is a slightly adjusted version of the original tweet - designed for wide boxes - consistent with Twitter guidelines
|
1300 |
+
$result .= "\n\t\t<div class='rtw_wide'>";
|
1301 |
+
$result .= "\n\t\t<div class='rtw_wide_icon'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'icon',$targetvalue)."</div>";
|
1302 |
+
$result .= "\n\t\t<div class='rtw_wide_block'><div class='rtw_info'>";
|
1303 |
+
$result .= "\n\t\t\t<div class='rtw_time_short'>".rotatingtweets_timestamp_link($twitter_object,'short',$targetvalue).'</div>';
|
1304 |
+
$result .= "\n\t\t\t<div class='rtw_name'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'name',$targetvalue)."</div>";
|
1305 |
+
$result .= "\n\t\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1306 |
+
$result .= "\n\t\t</div>";
|
1307 |
+
$result .= "\n\t\t<p class='rtw_main'>".$main_text."</p>";
|
1308 |
+
// $result .= "\n\t\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1).'</div>';
|
1309 |
+
if(isset($retweeter)) {
|
1310 |
+
$result .= "\n\t\t<div class='rtw_rt_meta'>".rotatingtweets_user_intent($retweeter,$twitterlocale,"<img src='".plugins_url('images/retweet_on.png',__FILE__)."' width='16' height='16' alt='".sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name'])."' />".sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name']),$targetvalue)."</div>";
|
1311 |
+
}
|
1312 |
+
$result .= "\n\t\t<div class='rtw_meta'><span class='rtw_expand' style='display:none;'>".__('Expand','rotatingtweets')."</span><span class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 2,$targetvalue);
|
1313 |
+
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1314 |
+
$result .= wp_kses_post($args['middot']).$nextprev;
|
1315 |
+
endif;
|
1316 |
+
$result .= "</span></div></div></div>";
|
1317 |
+
break;
|
1318 |
+
case 3:
|
1319 |
+
# This one uses the twitter standard approach for embedding via their javascript API - unfortunately I can't work out how to make it work with the rotating tweet javascript! If anyone can work out how to calculate the height of a oEmbed Twitter tweet, I will be very grateful! :-)
|
1320 |
+
$result .= '<blockquote class="twitter-tweet">';
|
1321 |
+
$result .= "<p>".$main_text."</p>";
|
1322 |
+
$result .= '— '.$user['name'].' (@'.$user['screen_name'].') <a href="https://twitter.com/twitterapi/status/'.$twitter_object['id_str'].'" data-datetime="'.date('c',strtotime($twitter_object['created_at'])).'"'.$targetvalue.'>'.date_i18n(get_option('date_format') ,strtotime($twitter_object['created_at'])).'</a>';
|
1323 |
+
$result .= '</blockquote>';
|
1324 |
+
break;
|
1325 |
+
case 4:
|
1326 |
+
$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
|
1327 |
+
$result .= "\n\t<div class='rtw_meta rtw_info'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1328 |
+
if($args['show_meta_screen_name']):
|
1329 |
+
$result .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']).' · ';
|
1330 |
+
endif;
|
1331 |
+
$result .= rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1332 |
+
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1333 |
+
$result .= ' · '.$nextprev;
|
1334 |
+
endif;
|
1335 |
+
$result .= "\n</div>";
|
1336 |
+
break;
|
1337 |
+
case 5:
|
1338 |
+
# This is an adjusted Rotating Tweets display routine
|
1339 |
+
$result .= "\n\t\t<p class='rtw_main'><img src='".plugins_url('images/bird_16_black.png', __FILE__)."' alt='Twitter' /> $main_text ";
|
1340 |
+
$meta = '';
|
1341 |
+
if($args['show_meta_timestamp']):
|
1342 |
+
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1343 |
+
endif;
|
1344 |
+
if($args['show_meta_screen_name']):
|
1345 |
+
if(!empty($meta)) $meta .= ' ';
|
1346 |
+
$meta .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']);
|
1347 |
+
endif;
|
1348 |
+
if($args['show_meta_via']):
|
1349 |
+
if(!empty($meta)) $meta .= ' ';
|
1350 |
+
$meta .=sprintf(__("via %s",'rotatingtweets'),$twitter_object['source']);
|
1351 |
+
endif;
|
1352 |
+
if($args['show_meta_reply_retweet_favorite']):
|
1353 |
+
if(!empty($meta)) $meta .= ' · ';
|
1354 |
+
$meta .= rotatingtweets_intents($twitter_object,$twitterlocale, 0,$targetvalue);
|
1355 |
+
endif;
|
1356 |
+
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1357 |
+
if(!empty($meta)) $meta .= ' · ';
|
1358 |
+
$meta .= $nextprev;
|
1359 |
+
endif;
|
1360 |
+
if(!empty($meta)) $result .= "\n\t\t<span class='rtw_meta'>".ucfirst($meta)."</span></p>";
|
1361 |
+
break;
|
1362 |
+
case 6:
|
1363 |
+
# This is the original Rotating Tweets display routine - adjusted for a user
|
1364 |
+
$result .= "\n\t\t<p class='rtw_main'>".rotatingtweets_user_intent($user,$twitterlocale,'blue_bird',$targetvalue).$main_text."</p>";
|
1365 |
+
$meta = '';
|
1366 |
+
if($args['show_meta_timestamp']):
|
1367 |
+
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1368 |
+
endif;
|
1369 |
+
if($args['show_meta_screen_name']):
|
1370 |
+
if(!empty($meta)) $meta .= ' ';
|
1371 |
+
$meta .= sprintf(__('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']);
|
1372 |
+
endif;
|
1373 |
+
if($args['show_meta_via']):
|
1374 |
+
if(!empty($meta)) $meta .= ' ';
|
1375 |
+
$meta .=sprintf(__("via %s",'rotatingtweets'),$twitter_object['source']);
|
1376 |
+
endif;
|
1377 |
+
if($args['show_meta_reply_retweet_favorite']):
|
1378 |
+
if(!empty($meta)) $meta .= ' · ';
|
1379 |
+
$meta .= rotatingtweets_intents($twitter_object,$twitterlocale, 0,$targetvalue);
|
1380 |
+
endif;
|
1381 |
+
|
1382 |
+
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1383 |
+
if(!empty($meta)) $meta .= ' · ';
|
1384 |
+
$meta .= $nextprev;
|
1385 |
+
endif;
|
1386 |
+
|
1387 |
+
if(!empty($meta)) $result .= "\n\t\t<p class='rtw_meta'>".ucfirst($meta)."</p>";
|
1388 |
+
break;
|
1389 |
+
}
|
1390 |
+
else:
|
1391 |
+
$result .= "\n\t\t<p class='rtw_main'>".__("Problem retrieving data from Twitter.",'rotatingtweets')."</p></div>";
|
1392 |
+
$result .= "<!-- rotatingtweets plugin was unable to parse this data: ".print_r($json,TRUE)." -->";
|
1393 |
+
$result .= "\n\t\t<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".__("Please check the comments on this page's HTML to understand more.",'rotatingtweets')."</p>";
|
1394 |
+
endif;
|
1395 |
+
$result .= "</div>";
|
1396 |
endif;
|
|
|
1397 |
endif;
|
1398 |
endforeach;
|
1399 |
endif;
|
1476 |
}
|
1477 |
# Check if we're using jQuery Cycle 1 or 2
|
1478 |
$api = get_option('rotatingtweets-api-settings');
|
1479 |
+
$style = strtolower(get_stylesheet());
|
1480 |
+
// Fixes a problem with the magazino template
|
1481 |
+
if($style == 'magazino' || (isset($api['jquery_cycle_version']) && $api['jquery_cycle_version']==2)):
|
1482 |
/*
|
1483 |
'jquery-easing' => 'http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js',
|
1484 |
*/
|
1495 |
endforeach;
|
1496 |
else:
|
1497 |
# Get Stylesheet
|
|
|
1498 |
switch ($style):
|
1499 |
case 'bremen_theme':
|
1500 |
case 'zeebizzcard':
|