Version Description
- New support for reading from multiple accounts. Addition of settings options for timeout and caching.
=
Download this release
Release Info
Developer | mpntod |
Plugin | Rotating Tweets (Twitter widget and shortcode) |
Version | 1.6.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.6.0
- css/style.css +3 -0
- lib/wp_twitteroauth.php +20 -3
- readme.txt +14 -4
- rotatingtweets.php +200 -39
css/style.css
CHANGED
@@ -67,6 +67,9 @@ div.rtw_intents {
|
|
67 |
float:right;
|
68 |
margin-left: 0.5em;
|
69 |
}
|
|
|
|
|
|
|
70 |
.rotatingtweet p.rtw_main {
|
71 |
clear: both;
|
72 |
}
|
67 |
float:right;
|
68 |
margin-left: 0.5em;
|
69 |
}
|
70 |
+
div.rtw_timestamp {
|
71 |
+
display: inline;
|
72 |
+
}
|
73 |
.rotatingtweet p.rtw_main {
|
74 |
clear: both;
|
75 |
}
|
lib/wp_twitteroauth.php
CHANGED
@@ -200,15 +200,31 @@ class wp_TwitterOAuth {
|
|
200 |
* @return API results
|
201 |
*/
|
202 |
function http($url, $method, $postfields = NULL) {
|
203 |
-
|
204 |
-
if(
|
|
|
|
|
|
|
|
|
205 |
$args['body'] = $postfields;
|
206 |
endif;
|
207 |
$args['timeout'] = $this->timeout;
|
208 |
$args['sslverify'] = $this->ssl_verifypeer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
$response = wp_remote_request($url,$args);
|
|
|
210 |
return($response);
|
|
|
211 |
/*
|
|
|
212 |
$this->http_info = array();
|
213 |
$ci = curl_init();
|
214 |
# Curl settings
|
@@ -241,7 +257,8 @@ class wp_TwitterOAuth {
|
|
241 |
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
|
242 |
$this->url = $url;
|
243 |
curl_close ($ci);
|
244 |
-
|
|
|
245 |
*/
|
246 |
}
|
247 |
|
200 |
* @return API results
|
201 |
*/
|
202 |
function http($url, $method, $postfields = NULL) {
|
203 |
+
|
204 |
+
if(WP_DEBUG) echo "<!-- wp_remote_request() variables in lib/wp_twitteroauth.php: \n\n\$url = ".esc_url($url)."\n";
|
205 |
+
if(!empty($method)):
|
206 |
+
$args['method']=$method;
|
207 |
+
endif;
|
208 |
+
if(is_array($postfields)):
|
209 |
$args['body'] = $postfields;
|
210 |
endif;
|
211 |
$args['timeout'] = $this->timeout;
|
212 |
$args['sslverify'] = $this->ssl_verifypeer;
|
213 |
+
if(WP_DEBUG):
|
214 |
+
echo "\n\$args = ";
|
215 |
+
if(isset($args)):
|
216 |
+
print_r($args);
|
217 |
+
else:
|
218 |
+
echo "NULL";
|
219 |
+
endif;
|
220 |
+
echo "\n-->\n";
|
221 |
+
endif;
|
222 |
$response = wp_remote_request($url,$args);
|
223 |
+
if(WP_DEBUG) echo "<!-- wp_remote_request() in lib/wp_twitteroauth.php successfully completed -->\n";
|
224 |
return($response);
|
225 |
+
|
226 |
/*
|
227 |
+
if(WP_DEBUG) echo "<!-- Using curl API to access data directly -->";
|
228 |
$this->http_info = array();
|
229 |
$ci = curl_init();
|
230 |
# Curl settings
|
257 |
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
|
258 |
$this->url = $url;
|
259 |
curl_close ($ci);
|
260 |
+
$return = array('body' => $response);
|
261 |
+
return $return;
|
262 |
*/
|
263 |
}
|
264 |
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -72,7 +72,7 @@ Possible variables for the shortcode include:
|
|
72 |
* `official_format` = `'1'` or `'2'` - show official format - optional - default is `'0'`
|
73 |
* `timeout` = time that each tweet is shown in milliseconds - optional - default is `'4000'` (i.e. 4 seconds)
|
74 |
* `links_in_new_window` = `'0'` or `'1'` - show links in a new tab or window - default is `'0'`
|
75 |
-
* `rotation_type` = any of the options listed on the [jQuery.cycle website](http://jquery.malsup.com/cycle/browser.html) - default is `'scrollUp'`
|
76 |
* `url_length` = sets the length that the URL should be trimmed to...
|
77 |
* `show_meta_timestamp` = `'0'` or `'1'` - show the time and date of each tweet - optional - default is `'1'`
|
78 |
* `show_meta_screen_name` = `'0'` or `'1'` - show who posted each tweet - optional - default is `'1'`
|
@@ -162,10 +162,20 @@ 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.
|
166 |
-
*
|
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)
|
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.6.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
72 |
* `official_format` = `'1'` or `'2'` - show official format - optional - default is `'0'`
|
73 |
* `timeout` = time that each tweet is shown in milliseconds - optional - default is `'4000'` (i.e. 4 seconds)
|
74 |
* `links_in_new_window` = `'0'` or `'1'` - show links in a new tab or window - default is `'0'`
|
75 |
+
* `rotation_type` = If you are using version 1 of the JavaScript, you can use any of the options listed on the [jQuery.cycle website](http://jquery.malsup.com/cycle/browser.html) - default is `'scrollUp'.` If you are using version 2 of the JavaScript, then the options are `'scrollUp'`,`'scrollDown'`,`'scrollHorz'`,`'scrollLeft'`,`'scrollRight'`,`'toss'`,`'scrollVert'`,`'fade'` and `'carousel'`
|
76 |
* `url_length` = sets the length that the URL should be trimmed to...
|
77 |
* `show_meta_timestamp` = `'0'` or `'1'` - show the time and date of each tweet - optional - default is `'1'`
|
78 |
* `show_meta_screen_name` = `'0'` or `'1'` - show who posted each tweet - optional - default is `'1'`
|
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.6.0 =
|
166 |
+
* New support for reading from multiple accounts. Addition of settings options for timeout and caching.
|
167 |
|
168 |
== Changelog ==
|
169 |
+
= 1.6.0 =
|
170 |
+
* New support for reading from multiple accounts
|
171 |
+
* Improved clean-up on uninstallation or deactivation
|
172 |
+
* Addition of settings page option for timeout of connection to Twitter
|
173 |
+
* Addition of settings page option for placement of JavaScript at the bottom of the page
|
174 |
+
* Addition of settings page option for duration of cache
|
175 |
+
* Fixed problem with hashtags and accents
|
176 |
+
* Improved error messages for connection problems
|
177 |
+
* Tidying up settings page text
|
178 |
+
|
179 |
= 1.5.1 =
|
180 |
* Enforce rules on replies and retweets even if the Twitter API doesn't
|
181 |
* Fixed problem with [Magazino template](http://wordpress.org/themes/magazino)
|
rotatingtweets.php
CHANGED
@@ -2,13 +2,13 @@
|
|
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.
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
9 |
License: GPL2
|
10 |
*/
|
11 |
-
/* Copyright
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -535,15 +535,21 @@ function rotatingtweets_call_twitter_API_options() {
|
|
535 |
if ( !current_user_can( 'manage_options' ) ) {
|
536 |
wp_die( __( 'You do not have sufficient permissions to access this page.','rotatingtweets' ) );
|
537 |
}
|
538 |
-
echo sprintf(__('<p>Twitter <a href="%s">
|
539 |
echo sprintf(__('<h3>Step 1:</h3><p>Go to the <a href="%s">My applications page</a> on the Twitter website to set up your website as a new Twitter \'application\'. You may need to log-in using your Twitter user name and password.</p>','rotatingtweets'),'https://dev.twitter.com/apps');
|
540 |
echo sprintf(__('<h3>Step 2:</h3><p>If you don\'t already have a suitable \'application\' that you can use for your website, set one up on the <a href="%s">Create an Application page</a>.</p> <p>It\'s normally best to use the name, description and website URL of the website where you plan to use Rotating Tweets.</p><p>You don\'t need a Callback URL.</p>','rotatingtweets'),'https://dev.twitter.com/apps/new');
|
541 |
_e('<h3>Step 3:</h3><p>After clicking <strong>Create your Twitter application</strong>, on the following page, click on <strong>Create my access token</strong>.</p>','rotatingtweets');
|
542 |
_e('<h3>Step 4:</h3><p>Copy the <strong>Consumer key</strong>, <strong>Consumer secret</strong>, <strong>Access token</strong> and <strong>Access token secret</strong> from your Twitter application page into the settings below.</p>','rotatingtweets');
|
543 |
_e('<h3>Step 5:</h3><p>Click on <strong>Save Changes</strong>.','rotatingtweets');
|
544 |
_e('<h3>If there are any problems:</h3><p>If there are any problems, you should get an error message from Twitter displayed as a "rotating tweet" which should help diagnose the problem.</p>','rotatingtweets');
|
545 |
-
|
546 |
-
_e('
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
_e('<p>Even though you are only entering one set of Twitter API data, Rotating Tweets will continue to support multiple widgets and shortcodes pulling from a variety of different Twitter accounts.</p>','rotatingtweets');
|
548 |
echo '<form method="post" action="options.php">';
|
549 |
settings_fields( 'rotatingtweets_options' );
|
@@ -554,17 +560,22 @@ function rotatingtweets_call_twitter_API_options() {
|
|
554 |
add_action('admin_init', 'rotatingtweets_admin_init');
|
555 |
|
556 |
function rotatingtweets_admin_init(){
|
|
|
557 |
register_setting( 'rotatingtweets_options', 'rotatingtweets-api-settings', 'rotatingtweets_api_validate' );
|
558 |
add_settings_section('rotatingtweets_api_main', __('Twitter API Settings','rotatingtweets'), 'rotatingtweets_api_explanation', 'rotatingtweets_api_settings');
|
559 |
add_settings_field('rotatingtweets_key', __('Twitter API Consumer Key','rotatingtweets'), 'rotatingtweets_option_show_key', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
560 |
add_settings_field('rotatingtweets_secret', __('Twitter API Consumer Secret','rotatingtweets'), 'rotatingtweets_option_show_secret', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
561 |
add_settings_field('rotatingtweets_token', __('Twitter API Access Token','rotatingtweets'), 'rotatingtweets_option_show_token', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
562 |
add_settings_field('rotatingtweets_token_secret', __('Twitter API Access Token Secret','rotatingtweets'), 'rotatingtweets_option_show_token_secret', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
|
|
|
|
|
|
|
|
568 |
}
|
569 |
function rotatingtweets_option_show_key() {
|
570 |
$options = get_option('rotatingtweets-api-settings');
|
@@ -599,17 +610,77 @@ function rotatingtweets_option_show_ssl_verify() {
|
|
599 |
}
|
600 |
echo "\n</select>";
|
601 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
function rotatingtweets_option_show_cycle_version() {
|
603 |
$options = get_option('rotatingtweets-api-settings');
|
604 |
$choice = array(
|
605 |
1 => _x('Version 1 (default)','Version of JQuery Cycle','rotatingtweets'),
|
606 |
2 => _x('Version 2 (beta)','Version of JQuery Cycle','rotatingtweets')
|
607 |
);
|
608 |
-
echo "\n<select id='
|
609 |
if(!isset($options['jquery_cycle_version'])) $options['jquery_cycle_version'] = 1;
|
610 |
foreach($choice as $value => $text) {
|
611 |
if($options['jquery_cycle_version'] == $value ) {
|
612 |
-
$selected = 'selected = "selected"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
} else {
|
614 |
$selected = '';
|
615 |
}
|
@@ -620,6 +691,10 @@ function rotatingtweets_option_show_cycle_version() {
|
|
620 |
// Explanatory text
|
621 |
function rotatingtweets_api_explanation() {
|
622 |
|
|
|
|
|
|
|
|
|
623 |
};
|
624 |
// Explanatory text
|
625 |
function rotatingtweets_jquery_explanation() {
|
@@ -663,18 +738,43 @@ function rotatingtweets_api_validate($input) {
|
|
663 |
else:
|
664 |
$options['ssl_verify_off']=false;
|
665 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
// Check 'jquery_cycle_version'
|
667 |
if(isset($input['jquery_cycle_version'])):
|
668 |
$options['jquery_cycle_version']=max(min(absint($input['jquery_cycle_version']),2),1);
|
669 |
else:
|
670 |
$options['jquery_cycle_version']=1;
|
671 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
672 |
// Now a proper test
|
673 |
if(empty($error)):
|
674 |
-
$
|
675 |
-
$
|
676 |
-
|
677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
endif;
|
679 |
endif;
|
680 |
return $options;
|
@@ -702,6 +802,13 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
|
|
702 |
endif;
|
703 |
$connection->ssl_verifypeer = TRUE;
|
704 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
$result = $connection->get($command , $options);
|
706 |
else:
|
707 |
// Construct old style API command
|
@@ -725,18 +832,30 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
|
|
725 |
$result = wp_remote_request($apicall);
|
726 |
endif;
|
727 |
if(!is_wp_error($result)):
|
728 |
-
|
729 |
-
|
730 |
-
$data['errors']
|
731 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
else:
|
733 |
-
|
|
|
|
|
|
|
|
|
734 |
endif;
|
735 |
else:
|
736 |
$errorstring = array();
|
737 |
$errorstring[0]['code']= $result->get_error_code();
|
738 |
$errorstring[0]['message']= $result->get_error_message();
|
739 |
$errorstring[0]['type'] = 'Wordpress';
|
|
|
740 |
update_option('rotatingtweets_api_error',$errorstring);
|
741 |
endif;
|
742 |
return($result);
|
@@ -785,10 +904,24 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
|
|
785 |
if($tw_list):
|
786 |
$tw_list = strtolower(sanitize_file_name( $tw_list ));
|
787 |
endif;
|
788 |
-
if($tw_search)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
$tw_search = trim($tw_search);
|
790 |
-
|
791 |
-
$
|
|
|
|
|
|
|
|
|
|
|
792 |
if($tw_include_rts != 1) $tw_include_rts = 0;
|
793 |
if($tw_exclude_replies != 1) $tw_exclude_replies = 0;
|
794 |
|
@@ -1241,7 +1374,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
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']):
|
@@ -1286,12 +1419,14 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
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 .=
|
1295 |
endif;
|
1296 |
$result .= "\n</div>";
|
1297 |
break;
|
@@ -1410,7 +1545,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1410 |
$result .= "</div>";
|
1411 |
endif;
|
1412 |
*/
|
1413 |
-
if($args['show_follow'] && !empty($args['screen_name'])):
|
1414 |
$shortenvariables = '';
|
1415 |
if($args['no_show_count']) $shortenvariables = ' data-show-count="false"';
|
1416 |
if($args['no_show_screen_name']) $shortenvariables .= ' data-show-screen-name="false"';
|
@@ -1476,6 +1611,7 @@ function rotatingtweets_enqueue_scripts() {
|
|
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)):
|
@@ -1490,7 +1626,7 @@ function rotatingtweets_enqueue_scripts() {
|
|
1490 |
);
|
1491 |
// $dependence[]='jquery-effects-core';
|
1492 |
foreach($rt_enqueue_script_list as $scriptname => $scriptlocation):
|
1493 |
-
wp_enqueue_script($scriptname,$scriptlocation,$dependence,FALSE
|
1494 |
$dependence[] = $scriptname;
|
1495 |
endforeach;
|
1496 |
else:
|
@@ -1500,12 +1636,12 @@ function rotatingtweets_enqueue_scripts() {
|
|
1500 |
case 'zeebizzcard':
|
1501 |
// case 'zeeStyle':
|
1502 |
wp_dequeue_script( 'zee_jquery-cycle');
|
1503 |
-
wp_enqueue_script( 'zee_jquery-cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE
|
1504 |
$dependence[]='zee_jquery-cycle';
|
1505 |
break;
|
1506 |
case 'oxygen':
|
1507 |
wp_dequeue_script( 'oxygen_cycle');
|
1508 |
-
wp_enqueue_script( 'oxygen_cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE
|
1509 |
$dependence[]='oxygen_cycle';
|
1510 |
break;
|
1511 |
case 'avada':
|
@@ -1514,15 +1650,15 @@ function rotatingtweets_enqueue_scripts() {
|
|
1514 |
case 'avada child theme':
|
1515 |
case 'a52cars':
|
1516 |
wp_dequeue_script( 'jquery.cycle');
|
1517 |
-
wp_enqueue_script( 'jquery.cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE
|
1518 |
$dependence[]='jquery.cycle';
|
1519 |
break;
|
1520 |
default:
|
1521 |
-
wp_enqueue_script( 'jquery-cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE
|
1522 |
$dependence[]='jquery-cycle';
|
1523 |
break;
|
1524 |
endswitch;
|
1525 |
-
wp_enqueue_script( 'rotating_tweet', plugins_url($rotatingtweetsjsfile, __FILE__),$dependence,FALSE
|
1526 |
endif;
|
1527 |
}
|
1528 |
function rotatingtweets_enqueue_style() {
|
@@ -1543,9 +1679,9 @@ function rotatingtweets_enqueue_style() {
|
|
1543 |
endforeach;
|
1544 |
}
|
1545 |
function rotatingtweets_enqueue_admin_scripts($hook) {
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
}
|
1550 |
add_action( 'admin_enqueue_scripts', 'rotatingtweets_enqueue_admin_scripts' );
|
1551 |
|
@@ -1558,4 +1694,29 @@ $style = strtolower(get_stylesheet());
|
|
1558 |
if($style == 'gleam'):
|
1559 |
add_action('wp_enqueue_scripts','rotatingtweets_enqueue_scripts');
|
1560 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1561 |
?>
|
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.6.0
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
9 |
License: GPL2
|
10 |
*/
|
11 |
+
/* Copyright 2014 Martin Tod email : martin@martintod.org.uk)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License, version 2, as
|
535 |
if ( !current_user_can( 'manage_options' ) ) {
|
536 |
wp_die( __( 'You do not have sufficient permissions to access this page.','rotatingtweets' ) );
|
537 |
}
|
538 |
+
echo sprintf(__('<p>Twitter <a href="%s">has changed</a> the way that they allow people to use the information in their tweets.</p><p>You need to take the following steps to make sure that Rotating Tweets can access the information it needs from Twitter:</p>','rotatingtweets'),'https://dev.twitter.com/blog/changes-coming-to-twitter-api');
|
539 |
echo sprintf(__('<h3>Step 1:</h3><p>Go to the <a href="%s">My applications page</a> on the Twitter website to set up your website as a new Twitter \'application\'. You may need to log-in using your Twitter user name and password.</p>','rotatingtweets'),'https://dev.twitter.com/apps');
|
540 |
echo sprintf(__('<h3>Step 2:</h3><p>If you don\'t already have a suitable \'application\' that you can use for your website, set one up on the <a href="%s">Create an Application page</a>.</p> <p>It\'s normally best to use the name, description and website URL of the website where you plan to use Rotating Tweets.</p><p>You don\'t need a Callback URL.</p>','rotatingtweets'),'https://dev.twitter.com/apps/new');
|
541 |
_e('<h3>Step 3:</h3><p>After clicking <strong>Create your Twitter application</strong>, on the following page, click on <strong>Create my access token</strong>.</p>','rotatingtweets');
|
542 |
_e('<h3>Step 4:</h3><p>Copy the <strong>Consumer key</strong>, <strong>Consumer secret</strong>, <strong>Access token</strong> and <strong>Access token secret</strong> from your Twitter application page into the settings below.</p>','rotatingtweets');
|
543 |
_e('<h3>Step 5:</h3><p>Click on <strong>Save Changes</strong>.','rotatingtweets');
|
544 |
_e('<h3>If there are any problems:</h3><p>If there are any problems, you should get an error message from Twitter displayed as a "rotating tweet" which should help diagnose the problem.</p>','rotatingtweets');
|
545 |
+
echo "<ol>\n\t<li>";
|
546 |
+
_e('If you are getting problems with "rate limiting", try changing the first connection setting below to increase the time that Rotating Tweets waits before trying to get new data from Twitter.','rotatingtweets');
|
547 |
+
echo "</li>\n\t<li>";
|
548 |
+
_e('If you are getting time-out problems, try changing the second connection setting below to increase how long Rotating Tweets waits when connecting to Twitter before timing out.','rotatingtweets');
|
549 |
+
echo "</li>\n\t<li>";
|
550 |
+
_e('If the error message references SSL, try changing the "Verify SSL connection to Twitter" setting below to "No".','rotatingtweets');
|
551 |
+
echo "\n</ol>";
|
552 |
+
_e('<h3>Getting information from more than one Twitter account</h3>','rotatingtweets');
|
553 |
_e('<p>Even though you are only entering one set of Twitter API data, Rotating Tweets will continue to support multiple widgets and shortcodes pulling from a variety of different Twitter accounts.</p>','rotatingtweets');
|
554 |
echo '<form method="post" action="options.php">';
|
555 |
settings_fields( 'rotatingtweets_options' );
|
560 |
add_action('admin_init', 'rotatingtweets_admin_init');
|
561 |
|
562 |
function rotatingtweets_admin_init(){
|
563 |
+
// API settings
|
564 |
register_setting( 'rotatingtweets_options', 'rotatingtweets-api-settings', 'rotatingtweets_api_validate' );
|
565 |
add_settings_section('rotatingtweets_api_main', __('Twitter API Settings','rotatingtweets'), 'rotatingtweets_api_explanation', 'rotatingtweets_api_settings');
|
566 |
add_settings_field('rotatingtweets_key', __('Twitter API Consumer Key','rotatingtweets'), 'rotatingtweets_option_show_key', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
567 |
add_settings_field('rotatingtweets_secret', __('Twitter API Consumer Secret','rotatingtweets'), 'rotatingtweets_option_show_secret', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
568 |
add_settings_field('rotatingtweets_token', __('Twitter API Access Token','rotatingtweets'), 'rotatingtweets_option_show_token', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
569 |
add_settings_field('rotatingtweets_token_secret', __('Twitter API Access Token Secret','rotatingtweets'), 'rotatingtweets_option_show_token_secret', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
|
570 |
+
// Connection settings
|
571 |
+
add_settings_section('rotatingtweets_connection_main', __('Connection Settings','rotatingtweets'), 'rotatingtweets_connection_explanation', 'rotatingtweets_api_settings');
|
572 |
+
add_settings_field('rotatingtweets_cache_delay', __('How often should Rotating Tweets try to get the latest tweets from Twitter?','rotatingtweets'), 'rotatingtweets_option_show_cache_delay','rotatingtweets_api_settings','rotatingtweets_connection_main');
|
573 |
+
add_settings_field('rotatingtweets_timeout', __("When connecting to Twitter, how long should Rotating Tweets wait before timing out?",'rotatingtweets'), 'rotatingtweets_option_show_timeout','rotatingtweets_api_settings','rotatingtweets_connection_main');
|
574 |
+
add_settings_field('rotatingtweets_ssl_verify', __('Verify SSL connection to Twitter','rotatingtweets'), 'rotatingtweets_option_show_ssl_verify','rotatingtweets_api_settings','rotatingtweets_connection_main');
|
575 |
+
// JQuery settings
|
576 |
+
add_settings_section('rotatingtweets_jquery_main', __('JavaScript Settings','rotatingtweets'), 'rotatingtweets_jquery_explanation', 'rotatingtweets_api_settings');
|
577 |
+
add_settings_field('rotatingtweets_jquery_cycle_version', __('Version of JQuery Cycle','rotatingtweets'), 'rotatingtweets_option_show_cycle_version','rotatingtweets_api_settings','rotatingtweets_jquery_main');
|
578 |
+
add_settings_field('rotatingtweets_js_in_footer', __('Where to load Rotating Tweets JavaScript','rotatingtweets'), 'rotatingtweets_option_show_in_footer','rotatingtweets_api_settings','rotatingtweets_jquery_main');
|
579 |
}
|
580 |
function rotatingtweets_option_show_key() {
|
581 |
$options = get_option('rotatingtweets-api-settings');
|
610 |
}
|
611 |
echo "\n</select>";
|
612 |
}
|
613 |
+
function rotatingtweets_option_show_timeout() {
|
614 |
+
$options = get_option('rotatingtweets-api-settings');
|
615 |
+
$choice = array(
|
616 |
+
1 => _x('1 second','Connection timeout','rotatingtweets'),
|
617 |
+
3 => _x('3 seconds (default)','Connection timeout','rotatingtweets'),
|
618 |
+
5 => _x('5 seconds','Connection timeout','rotatingtweets'),
|
619 |
+
7 => _x('7 seconds','Connection timeout','rotatingtweets'),
|
620 |
+
20 => _x('20 seconds','Connection timeout','rotatingtweets')
|
621 |
+
);
|
622 |
+
echo "\n<select id='rotatingtweets_api_timeout_input' name='rotatingtweets-api-settings[timeout]'>";
|
623 |
+
if(!isset($options['timeout'])) $options['timeout'] = 3;
|
624 |
+
foreach($choice as $value => $text) {
|
625 |
+
if($options['timeout'] == $value ) {
|
626 |
+
$selected = ' selected = "selected"';
|
627 |
+
} else {
|
628 |
+
$selected = '';
|
629 |
+
}
|
630 |
+
echo "\n\t<option value='".$value."'".$selected.">".$text."</option>";
|
631 |
+
}
|
632 |
+
echo "\n</select>";
|
633 |
+
}
|
634 |
+
function rotatingtweets_option_show_cache_delay() {
|
635 |
+
$options = get_option('rotatingtweets-api-settings');
|
636 |
+
$choice = array(
|
637 |
+
60 => _x('1 minute','Cache Delay','rotatingtweets'),
|
638 |
+
120 => _x('2 minutes (default)','Cache Delay','rotatingtweets'),
|
639 |
+
300 => _x('5 minutes','Cache Delay','rotatingtweets'),
|
640 |
+
3600 => _x('1 hour','Cache Delay','rotatingtweets'),
|
641 |
+
86400 => _x('24 hours','Cache Delay','rotatingtweets')
|
642 |
+
);
|
643 |
+
echo "\n<select id='rotatingtweets_cache_delay_input' name='rotatingtweets-api-settings[cache_delay]'>";
|
644 |
+
if(!isset($options['cache_delay'])) $options['cache_delay'] = 120;
|
645 |
+
foreach($choice as $value => $text) {
|
646 |
+
if($options['cache_delay'] == $value ) {
|
647 |
+
$selected = ' selected = "selected"';
|
648 |
+
} else {
|
649 |
+
$selected = '';
|
650 |
+
}
|
651 |
+
echo "\n\t<option value='".$value."'".$selected.">".$text."</option>";
|
652 |
+
}
|
653 |
+
echo "\n</select>";
|
654 |
+
}
|
655 |
function rotatingtweets_option_show_cycle_version() {
|
656 |
$options = get_option('rotatingtweets-api-settings');
|
657 |
$choice = array(
|
658 |
1 => _x('Version 1 (default)','Version of JQuery Cycle','rotatingtweets'),
|
659 |
2 => _x('Version 2 (beta)','Version of JQuery Cycle','rotatingtweets')
|
660 |
);
|
661 |
+
echo "\n<select id='rotatingtweets_api_jquery_cycle_version_input' name='rotatingtweets-api-settings[jquery_cycle_version]'>";
|
662 |
if(!isset($options['jquery_cycle_version'])) $options['jquery_cycle_version'] = 1;
|
663 |
foreach($choice as $value => $text) {
|
664 |
if($options['jquery_cycle_version'] == $value ) {
|
665 |
+
$selected = ' selected = "selected"';
|
666 |
+
} else {
|
667 |
+
$selected = '';
|
668 |
+
}
|
669 |
+
echo "\n\t<option value='".$value."'".$selected.">".$text."</option>";
|
670 |
+
}
|
671 |
+
echo "\n</select>";
|
672 |
+
}
|
673 |
+
function rotatingtweets_option_show_in_footer() {
|
674 |
+
$options = get_option('rotatingtweets-api-settings');
|
675 |
+
$choice = array(
|
676 |
+
0 => _x('Load in header (default)','Location of JavaScript','rotatingtweets'),
|
677 |
+
1 => _x('Load in footer','Location of JavaScript','rotatingtweets')
|
678 |
+
);
|
679 |
+
echo "\n<select id='rotatingtweets_api_js_in_footer_input' name='rotatingtweets-api-settings[js_in_footer]'>";
|
680 |
+
if(!isset($options['js_in_footer'])) $options['js_in_footer'] = FALSE;
|
681 |
+
foreach($choice as $value => $text) {
|
682 |
+
if($options['js_in_footer'] == $value ) {
|
683 |
+
$selected = ' selected = "selected"';
|
684 |
} else {
|
685 |
$selected = '';
|
686 |
}
|
691 |
// Explanatory text
|
692 |
function rotatingtweets_api_explanation() {
|
693 |
|
694 |
+
};
|
695 |
+
// Explanatory text
|
696 |
+
function rotatingtweets_connection_explanation() {
|
697 |
+
|
698 |
};
|
699 |
// Explanatory text
|
700 |
function rotatingtweets_jquery_explanation() {
|
738 |
else:
|
739 |
$options['ssl_verify_off']=false;
|
740 |
endif;
|
741 |
+
// Check 'timeout'
|
742 |
+
if(isset($input['timeout'])):
|
743 |
+
$options['timeout'] = max(1,intval($input['timeout']));
|
744 |
+
endif;
|
745 |
+
// Check 'cache delay'
|
746 |
+
if(isset($input['cache_delay'])):
|
747 |
+
$options['cache_delay'] = max(60,intval($input['cache_delay']));
|
748 |
+
else:
|
749 |
+
$options['cache_delay']=120;
|
750 |
+
endif;
|
751 |
// Check 'jquery_cycle_version'
|
752 |
if(isset($input['jquery_cycle_version'])):
|
753 |
$options['jquery_cycle_version']=max(min(absint($input['jquery_cycle_version']),2),1);
|
754 |
else:
|
755 |
$options['jquery_cycle_version']=1;
|
756 |
+
endif;
|
757 |
+
// Check 'in footer'
|
758 |
+
if(isset($input['js_in_footer'])):
|
759 |
+
$options['js_in_footer'] = (bool) $input['js_in_footer'];
|
760 |
+
else:
|
761 |
+
$options['js_in_footer'] = FALSE;
|
762 |
+
endif;
|
763 |
// Now a proper test
|
764 |
if(empty($error)):
|
765 |
+
$transientname = 'rotatingtweets_check_wp_remote_request'; // This whole code is to help someone who has a problem with wp_remote_request
|
766 |
+
if(!get_transient($transientname)):
|
767 |
+
set_transient($transientname,true,24*60*60);
|
768 |
+
$test = rotatingtweets_call_twitter_API('statuses/user_timeline',NULL,$options);
|
769 |
+
delete_transient($transientname);
|
770 |
+
$error = get_option('rotatingtweets_api_error');
|
771 |
+
if(!empty($error)):
|
772 |
+
if($error[0]['type'] == 'Twitter'):
|
773 |
+
add_settings_error( 'rotatingtweets', esc_attr('rotatingtweets-api-'.$error[0]['code']), sprintf(__('Error message received from Twitter: %1$s. <a href="%2$s">Please check your API key, secret, token and secret token on the Twitter website</a>.','rotatingtweets'),$error[0]['message'],'https://dev.twitter.com/apps'), 'error' );
|
774 |
+
else:
|
775 |
+
add_settings_error( 'rotatingtweets', esc_attr('rotatingtweets-api-'.$error[0]['code']), sprintf(__('Error message received from Wordpress: %1$s. Please check your connection settings.','rotatingtweets'),$error[0]['message']), 'error' );
|
776 |
+
endif;
|
777 |
+
endif;
|
778 |
endif;
|
779 |
endif;
|
780 |
return $options;
|
802 |
endif;
|
803 |
$connection->ssl_verifypeer = TRUE;
|
804 |
endif;
|
805 |
+
if(isset($api['timeout'])):
|
806 |
+
$timeout = max(1,intval($api['timeout']));
|
807 |
+
if(WP_DEBUG && ! is_admin() ):
|
808 |
+
echo "\n<!-- Setting timeout to $timeout seconds -->\n";
|
809 |
+
endif;
|
810 |
+
$connection->timeout = $timeout;
|
811 |
+
endif;
|
812 |
$result = $connection->get($command , $options);
|
813 |
else:
|
814 |
// Construct old style API command
|
832 |
$result = wp_remote_request($apicall);
|
833 |
endif;
|
834 |
if(!is_wp_error($result)):
|
835 |
+
if(isset($result['body'])):
|
836 |
+
$data = json_decode($result['body'],true);
|
837 |
+
if(isset($data['errors'])):
|
838 |
+
$data['errors'][0]['type'] = 'Twitter';
|
839 |
+
if( empty($api) ) $errorstring[0]['message'] = 'Please enter valid Twitter API Settings on the Rotating Tweets settings page';
|
840 |
+
if(WP_DEBUG && ! is_admin() ) echo "<!-- Error message from Twitter - {$data['errors']} -->";
|
841 |
+
update_option('rotatingtweets_api_error',$data['errors']);
|
842 |
+
else:
|
843 |
+
if(WP_DEBUG && ! is_admin() ) echo "<!-- Successfully read data from Twitter -->";
|
844 |
+
delete_option('rotatingtweets_api_error');
|
845 |
+
endif;
|
846 |
else:
|
847 |
+
if(WP_DEBUG && ! is_admin() ) echo "<!-- Failed to read valid data from Twitter: problem with wp_remote_request() -->";
|
848 |
+
$errorstring[0]['code']= 999;
|
849 |
+
$errorstring[0]['message']= 'Failed to read valid data from Twitter: problem with wp_remote_request()';
|
850 |
+
$errorstring[0]['type'] = 'Wordpress';
|
851 |
+
update_option('rotatingtweets_api_error',$errorstring);
|
852 |
endif;
|
853 |
else:
|
854 |
$errorstring = array();
|
855 |
$errorstring[0]['code']= $result->get_error_code();
|
856 |
$errorstring[0]['message']= $result->get_error_message();
|
857 |
$errorstring[0]['type'] = 'Wordpress';
|
858 |
+
if(WP_DEBUG && ! is_admin() ) echo "<!-- Error message from Wordpress - {$errorstring[0]['message']} -->";
|
859 |
update_option('rotatingtweets_api_error',$errorstring);
|
860 |
endif;
|
861 |
return($result);
|
904 |
if($tw_list):
|
905 |
$tw_list = strtolower(sanitize_file_name( $tw_list ));
|
906 |
endif;
|
907 |
+
if(empty($tw_search)):
|
908 |
+
$possibledividers = array(' ',';',',');
|
909 |
+
$rt_namesarray = false;
|
910 |
+
foreach($possibledividers as $possibledivider):
|
911 |
+
if(strpos($tw_screen_name,$possibledivider) !== false ):
|
912 |
+
$rt_namesarray = explode(' ',$tw_screen_name);
|
913 |
+
$tw_search = 'from:'.implode(' OR from:',$rt_namesarray);
|
914 |
+
endif;
|
915 |
+
endforeach;
|
916 |
+
else:
|
917 |
$tw_search = trim($tw_search);
|
918 |
+
endif;
|
919 |
+
$cacheoption = get_option('rotatingtweets-api-settings');
|
920 |
+
if(!isset($cacheoption['cache_delay'])):
|
921 |
+
$cache_delay = 120;
|
922 |
+
else:
|
923 |
+
$cache_delay = max(60,intval($cacheoption['cache_delay']));
|
924 |
+
endif;
|
925 |
if($tw_include_rts != 1) $tw_include_rts = 0;
|
926 |
if($tw_exclude_replies != 1) $tw_exclude_replies = 0;
|
927 |
|
1374 |
endif;
|
1375 |
// $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
|
1376 |
# This is designed to find hashtags and turn them into links...
|
1377 |
+
$before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
|
1378 |
$after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
|
1379 |
$main_text = preg_replace($before,$after,$main_text);
|
1380 |
if(isset($args['link_all_text']) && $args['link_all_text']):
|
1419 |
$result .= "\n\t</div>";
|
1420 |
$result .= "\n\t<p class='rtw_main'>".$main_text."</p>";
|
1421 |
$result .= "\n\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1422 |
+
$result .= "\n\t<div class='rtw_timestamp'>".rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1423 |
if(isset($retweeter)) {
|
1424 |
+
$result .= " · </div>".rotatingtweets_user_intent($retweeter,$twitterlocale,sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name']),$targetvalue);
|
1425 |
+
} else {
|
1426 |
+
$result .= "</div>";
|
1427 |
}
|
1428 |
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
|
1429 |
+
$result .= " · ".$nextprev;
|
1430 |
endif;
|
1431 |
$result .= "\n</div>";
|
1432 |
break;
|
1545 |
$result .= "</div>";
|
1546 |
endif;
|
1547 |
*/
|
1548 |
+
if($args['show_follow'] && !empty($args['screen_name']) && !strpos($args['screen_name'],' ') && !strpos($args['screen_name'],',') && !strpos($args['screen_name'],';')):
|
1549 |
$shortenvariables = '';
|
1550 |
if($args['no_show_count']) $shortenvariables = ' data-show-count="false"';
|
1551 |
if($args['no_show_screen_name']) $shortenvariables .= ' data-show-screen-name="false"';
|
1611 |
}
|
1612 |
# Check if we're using jQuery Cycle 1 or 2
|
1613 |
$api = get_option('rotatingtweets-api-settings');
|
1614 |
+
if(!isset($api['js_in_footer'])) $api['js_in_footer'] = FALSE;
|
1615 |
$style = strtolower(get_stylesheet());
|
1616 |
// Fixes a problem with the magazino template
|
1617 |
if($style == 'magazino' || (isset($api['jquery_cycle_version']) && $api['jquery_cycle_version']==2)):
|
1626 |
);
|
1627 |
// $dependence[]='jquery-effects-core';
|
1628 |
foreach($rt_enqueue_script_list as $scriptname => $scriptlocation):
|
1629 |
+
wp_enqueue_script($scriptname,$scriptlocation,$dependence,FALSE,$api['js_in_footer']);
|
1630 |
$dependence[] = $scriptname;
|
1631 |
endforeach;
|
1632 |
else:
|
1636 |
case 'zeebizzcard':
|
1637 |
// case 'zeeStyle':
|
1638 |
wp_dequeue_script( 'zee_jquery-cycle');
|
1639 |
+
wp_enqueue_script( 'zee_jquery-cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,$api['js_in_footer']);
|
1640 |
$dependence[]='zee_jquery-cycle';
|
1641 |
break;
|
1642 |
case 'oxygen':
|
1643 |
wp_dequeue_script( 'oxygen_cycle');
|
1644 |
+
wp_enqueue_script( 'oxygen_cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,$api['js_in_footer']);
|
1645 |
$dependence[]='oxygen_cycle';
|
1646 |
break;
|
1647 |
case 'avada':
|
1650 |
case 'avada child theme':
|
1651 |
case 'a52cars':
|
1652 |
wp_dequeue_script( 'jquery.cycle');
|
1653 |
+
wp_enqueue_script( 'jquery.cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,$api['js_in_footer'] );
|
1654 |
$dependence[]='jquery.cycle';
|
1655 |
break;
|
1656 |
default:
|
1657 |
+
wp_enqueue_script( 'jquery-cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,$api['js_in_footer'] );
|
1658 |
$dependence[]='jquery-cycle';
|
1659 |
break;
|
1660 |
endswitch;
|
1661 |
+
wp_enqueue_script( 'rotating_tweet', plugins_url($rotatingtweetsjsfile, __FILE__),$dependence,FALSE,$api['js_in_footer'] );
|
1662 |
endif;
|
1663 |
}
|
1664 |
function rotatingtweets_enqueue_style() {
|
1679 |
endforeach;
|
1680 |
}
|
1681 |
function rotatingtweets_enqueue_admin_scripts($hook) {
|
1682 |
+
if( 'widgets.php' != $hook ) return;
|
1683 |
+
wp_enqueue_script( 'jquery' );
|
1684 |
+
wp_enqueue_script( 'rotating_tweet_admin', plugins_url('js/rotating_tweet_admin.js', __FILE__),array('jquery'),FALSE,FALSE );
|
1685 |
}
|
1686 |
add_action( 'admin_enqueue_scripts', 'rotatingtweets_enqueue_admin_scripts' );
|
1687 |
|
1694 |
if($style == 'gleam'):
|
1695 |
add_action('wp_enqueue_scripts','rotatingtweets_enqueue_scripts');
|
1696 |
endif;
|
1697 |
+
|
1698 |
+
// Add the deactivation and uninstallation functions
|
1699 |
+
function rotatingtweets_deactivate() {
|
1700 |
+
// Gets rid of the cache - but not the settings
|
1701 |
+
delete_option('rotatingtweets_api_error');
|
1702 |
+
delete_option('rotatingtweets-cache');
|
1703 |
+
delete_option('rotatingtweets-twitter-languages');
|
1704 |
+
}
|
1705 |
+
function rotatingtweets_uninstall() {
|
1706 |
+
// Gets rid of all data stored - including settings
|
1707 |
+
rotatingtweets_deactivate();
|
1708 |
+
delete_option('rotatingtweets-api-settings');
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
register_deactivation_hook( __FILE__, 'rotatingtweets_deactivate' );
|
1712 |
+
register_uninstall_hook( __FILE__, 'rotatingtweets_uninstall' );
|
1713 |
+
|
1714 |
+
// Filters that can be used to adjust transports - if you have problems with connecting to Twitter, try commenting in one of the following lines
|
1715 |
+
// From a brilliant post by Sam Wood http://wordpress.org/support/topic/warning-curl_exec-has-been-disabled?replies=6#post-920787
|
1716 |
+
function rotatingtweets_block_transport() { return false; }
|
1717 |
+
// add_filter('use_http_extension_transport', 'rotatingtweets_block_transport');
|
1718 |
+
// add_filter('use_curl_transport', 'rotatingtweets_block_transport');
|
1719 |
+
// add_filter('use_streams_transport', 'rotatingtweets_block_transport');
|
1720 |
+
// add_filter('use_fopen_transport', 'rotatingtweets_block_transport');
|
1721 |
+
// add_filter('use_fsockopen_transport', 'rotatingtweets_block_transport');
|
1722 |
?>
|