Version Description
- Deletes old cache entries if unused for more than 30 days
- Fixes a jQuery cycle clash with the Oxygen theme.
Download this release
Release Info
Developer | mpntod |
Plugin | Rotating Tweets (Twitter widget and shortcode) |
Version | 1.4.5 |
Comparing to | |
See all releases |
Code changes from version 1.4.4 to 1.4.5
- readme.txt +15 -3
- rotatingtweets.php +46 -4
- screenshot-2.png +0 -0
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.5.1
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -141,14 +141,26 @@ If there is only one copy of `jquery` and of `jquery.cycle` on your page, the be
|
|
141 |
1. In Chrome or IE, select the tab marked 'console'.
|
142 |
1. Read the diagnostics and look for any problems that relate to JavaScript. This will normally tell you which JavaScript (if any) is having problems.
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
== Upgrade notice ==
|
145 |
-
= 1.4.
|
146 |
-
*
|
|
|
147 |
|
148 |
= 0.700 (1.3.0) =
|
149 |
* Upgrade needed for Rotating Tweets to keep working after May 2013. Supports version 1.1 of the Twitter API.
|
150 |
|
151 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
152 |
= 1.4.4 =
|
153 |
* Adds an option to switch off verification of SSL connections to Twitter
|
154 |
* Adds a short code option (`no_rotate`) to switch off rotation
|
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.5.1
|
7 |
+
Stable tag: 1.4.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
141 |
1. In Chrome or IE, select the tab marked 'console'.
|
142 |
1. Read the diagnostics and look for any problems that relate to JavaScript. This will normally tell you which JavaScript (if any) is having problems.
|
143 |
|
144 |
+
= What can I do if I get the WordPress error code: `http_request_failed - name lookup timed out`? =
|
145 |
+
|
146 |
+
Try installing the [Core Control plug-in](http://wordpress.org/extend/plugins/core-control/) and disabling cURL. You can read more about the problem via [this support page](http://wordpress.org/support/topic/wp-351-wordpress-error-code-http_request_failed-name-lookup-timed-out).
|
147 |
+
|
148 |
+
Thank you to [darkiko](http://wordpress.org/support/profile/darkiko) for sharing their solution to this problem.
|
149 |
+
|
150 |
== Upgrade notice ==
|
151 |
+
= 1.4.5 =
|
152 |
+
* Deletes old cache entries if unused for more than 30 days
|
153 |
+
* Fixes a jQuery cycle clash with the [Oxygen theme](http://wordpress.org/extend/themes/oxygen/).
|
154 |
|
155 |
= 0.700 (1.3.0) =
|
156 |
* Upgrade needed for Rotating Tweets to keep working after May 2013. Supports version 1.1 of the Twitter API.
|
157 |
|
158 |
== Changelog ==
|
159 |
+
= 1.4.5 =
|
160 |
+
* Deletes old cache entries if unused for more than 30 days
|
161 |
+
* Fixes a jQuery cycle clash with the [Oxygen theme](http://wordpress.org/extend/themes/oxygen/).
|
162 |
+
* Added `readme.txt` instructions for dealing with the WordPress error code: `http_request_failed - name lookup timed out`.
|
163 |
+
|
164 |
= 1.4.4 =
|
165 |
* Adds an option to switch off verification of SSL connections to Twitter
|
166 |
* Adds a short code option (`no_rotate`) to switch off rotation
|
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.4.
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
@@ -710,9 +710,45 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
|
|
710 |
endif;
|
711 |
return($result);
|
712 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
|
714 |
# Get the latest data from Twitter (or from a cache if it's been less than 2 minutes since the last load)
|
715 |
function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites = FALSE,$tw_search = FALSE,$tw_list = FALSE ) {
|
|
|
|
|
716 |
# Clear up variables
|
717 |
$tw_screen_name = trim(remove_accents(str_replace('@','',$tw_screen_name)));
|
718 |
if($tw_list):
|
@@ -1303,10 +1339,16 @@ function rotatingtweets_enqueue_scripts() {
|
|
1303 |
$dependence[]='zee_jquery-cycle';
|
1304 |
wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
|
1305 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
1306 |
default:
|
1307 |
wp_enqueue_script( 'jquery-cycle', plugins_url('js/jquery.cycle.all.min.js', __FILE__),$dependence,FALSE,FALSE );
|
1308 |
$dependence[]='jquery-cycle';
|
1309 |
-
wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),
|
1310 |
break;
|
1311 |
endswitch;
|
1312 |
wp_enqueue_style( 'rotatingtweets', plugins_url('css/style.css', __FILE__));
|
@@ -1316,11 +1358,11 @@ function rotatingtweets_enqueue_scripts() {
|
|
1316 |
$uploads['basedir'].'/rotatingtweets.css' => $uploads['baseurl'].'/rotatingtweets.css'
|
1317 |
);
|
1318 |
$scriptname = 'rotatingtweet-yourstyle';
|
1319 |
-
$scriptcounter =
|
1320 |
foreach($personalstyle as $dir => $url):
|
1321 |
if(file_exists( $dir )):
|
1322 |
wp_enqueue_style( $scriptname, $url);
|
1323 |
-
$scriptname = '
|
1324 |
$scriptcounter ++;
|
1325 |
endif;
|
1326 |
endforeach;
|
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.4.5
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
710 |
endif;
|
711 |
return($result);
|
712 |
}
|
713 |
+
# Clear tweets (if too much memory used)
|
714 |
+
function rotatingtweets_shrink_cache() {
|
715 |
+
# Solves a problem that 40+ caches can overload the memory - cuts it to fewer without risking deletion of the tweets on display
|
716 |
+
$optionname = "rotatingtweets-cache";
|
717 |
+
$option = get_option($optionname);
|
718 |
+
$numberidentities = count($option);
|
719 |
+
if(WP_DEBUG) echo "<!-- There are currently ".$numberidentities." identities cached -->";
|
720 |
+
# If there are fewer than 10 sets of information cached - just return (for speed)
|
721 |
+
if($numberidentities < 10) return;
|
722 |
+
# Now make sure that we don't overwrite 'live' tweets
|
723 |
+
$minageindays = 1000000;
|
724 |
+
$totalcachesize = 0;
|
725 |
+
# Get the age and size of tweets remaining
|
726 |
+
foreach($option as $stringname => $contents) {
|
727 |
+
$ageindays = (time()-$contents['datetime'])/60/60/24;
|
728 |
+
if($ageindays < $minageindays) $minageindays = $ageindays;
|
729 |
+
if(WP_DEBUG):
|
730 |
+
$cachesize = strlen(json_encode($contents));
|
731 |
+
echo "\n<!-- $stringname -- $cachesize --".date('d-m-Y',$contents['datetime'])." -- ".number_format($ageindays,1)." days -->";
|
732 |
+
$totalcachesize = $totalcachesize + $cachesize;
|
733 |
+
endif;
|
734 |
+
};
|
735 |
+
if(WP_DEBUG) echo "\n<!-- The youngest age of any cache is ".number_format($minageindays*24*60,2)." minutes (".number_format($minageindays,8)." days) and total cache size is ".$totalcachesize.". -->";
|
736 |
+
# Set the goal of deleting all the tweets more than 30 days older than the most recent tweets
|
737 |
+
$targetageindays = $minageindays + 30;
|
738 |
+
# Now run through and delete
|
739 |
+
foreach($option as $stringname => $contents) {
|
740 |
+
$ageindays = (time()-$contents['datetime'])/60/60/24;
|
741 |
+
if($ageindays > $targetageindays) unset($option[$stringname]);
|
742 |
+
};
|
743 |
+
$numberidentities = count($option);
|
744 |
+
if(WP_DEBUG) echo "<!-- There are now ".$numberidentities." identities cached -->";
|
745 |
+
update_option($optionname,$option);
|
746 |
+
}
|
747 |
|
748 |
# Get the latest data from Twitter (or from a cache if it's been less than 2 minutes since the last load)
|
749 |
function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites = FALSE,$tw_search = FALSE,$tw_list = FALSE ) {
|
750 |
+
# Check cache
|
751 |
+
rotatingtweets_shrink_cache();
|
752 |
# Clear up variables
|
753 |
$tw_screen_name = trim(remove_accents(str_replace('@','',$tw_screen_name)));
|
754 |
if($tw_list):
|
1339 |
$dependence[]='zee_jquery-cycle';
|
1340 |
wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
|
1341 |
break;
|
1342 |
+
case 'oxygen':
|
1343 |
+
wp_dequeue_script( 'oxygen_cycle');
|
1344 |
+
wp_enqueue_script( 'oxygen_cycle', plugins_url('js/jquery.cycle.all.min.js', __FILE__),$dependence,FALSE,FALSE );
|
1345 |
+
$dependence[]='oxygen_cycle';
|
1346 |
+
wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
|
1347 |
+
break;
|
1348 |
default:
|
1349 |
wp_enqueue_script( 'jquery-cycle', plugins_url('js/jquery.cycle.all.min.js', __FILE__),$dependence,FALSE,FALSE );
|
1350 |
$dependence[]='jquery-cycle';
|
1351 |
+
wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
|
1352 |
break;
|
1353 |
endswitch;
|
1354 |
wp_enqueue_style( 'rotatingtweets', plugins_url('css/style.css', __FILE__));
|
1358 |
$uploads['basedir'].'/rotatingtweets.css' => $uploads['baseurl'].'/rotatingtweets.css'
|
1359 |
);
|
1360 |
$scriptname = 'rotatingtweet-yourstyle';
|
1361 |
+
$scriptcounter = 1;
|
1362 |
foreach($personalstyle as $dir => $url):
|
1363 |
if(file_exists( $dir )):
|
1364 |
wp_enqueue_style( $scriptname, $url);
|
1365 |
+
$scriptname = 'rotatingtweet-yourstyle-'.$scriptcounter;
|
1366 |
$scriptcounter ++;
|
1367 |
endif;
|
1368 |
endforeach;
|
screenshot-2.png
CHANGED
Binary file
|