Version Description
- Adding
offset
,speed
,tweet_length
,no_emoji
andshow_media
options to the shortcode
=
Download this release
Release Info
Developer | mpntod |
Plugin | Rotating Tweets (Twitter widget and shortcode) |
Version | 1.7.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.11 to 1.7.0
- css/style.css +8 -0
- js/rotatingtweets_v2_cyclone.js +88 -0
- readme.txt +20 -6
- rotatingtweets.php +154 -22
css/style.css
CHANGED
@@ -84,6 +84,14 @@ div.rtw_timestamp {
|
|
84 |
border-bottom: 1px solid #DDD;
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
/* This sets the style for tweets in articles or posts */
|
89 |
#content .rotatingtweets,
|
84 |
border-bottom: 1px solid #DDD;
|
85 |
}
|
86 |
|
87 |
+
.rtw_media {
|
88 |
+
clear: both;
|
89 |
+
}
|
90 |
+
.rtw_media img {
|
91 |
+
margin: auto;
|
92 |
+
height: 150px;
|
93 |
+
max-height: 150px;
|
94 |
+
}
|
95 |
|
96 |
/* This sets the style for tweets in articles or posts */
|
97 |
#content .rotatingtweets,
|
js/rotatingtweets_v2_cyclone.js
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Add some transitions
|
3 |
+
*/
|
4 |
+
(function($) {
|
5 |
+
"use strict";
|
6 |
+
|
7 |
+
$.fn.cycle.transitions.scrollDown = {
|
8 |
+
before: function( opts, curr, next, fwd ) {
|
9 |
+
opts.API.stackSlides( opts, curr, next, fwd );
|
10 |
+
var width = opts.container.css('overflow','visible').width();
|
11 |
+
var height = opts.container.css('overflow','hidden').height();
|
12 |
+
opts.cssBefore = { top: fwd ? -height : height, left: 0, opacity: 1, display: 'block' ,width:width };
|
13 |
+
opts.animIn = { top: 0 };
|
14 |
+
opts.animOut = { top: fwd ? height : -height };
|
15 |
+
}
|
16 |
+
};
|
17 |
+
$.fn.cycle.transitions.scrollUp = {
|
18 |
+
before: function( opts, curr, next, fwd ) {
|
19 |
+
opts.API.stackSlides( opts, curr, next, fwd );
|
20 |
+
var width = opts.container.css('overflow','visible').width();
|
21 |
+
var height = opts.container.css('overflow','hidden').height();
|
22 |
+
opts.cssBefore = { top: fwd ? height : -height, left: 0, opacity: 1, display: 'block' ,width:width };
|
23 |
+
opts.animIn = { top: 0 };
|
24 |
+
opts.animOut = { top: fwd ? -height : height };
|
25 |
+
}
|
26 |
+
};
|
27 |
+
$.fn.cycle.transitions.scrollLeft = {
|
28 |
+
before: function( opts, curr, next, fwd ) {
|
29 |
+
opts.API.stackSlides( opts, curr, next, fwd );
|
30 |
+
var width = opts.container.css('overflow','hidden').width();
|
31 |
+
opts.cssBefore = { width: width, left : width+20, top: 0, opacity: 1, display: 'block' };
|
32 |
+
opts.animIn = { left: 0 };
|
33 |
+
opts.animOut = { left : -width-20,width:width };
|
34 |
+
}
|
35 |
+
};
|
36 |
+
|
37 |
+
$.fn.cycle.transitions.scrollRight = {
|
38 |
+
before: function( opts, curr, next, fwd ) {
|
39 |
+
opts.API.stackSlides( opts, curr, next, fwd );
|
40 |
+
var width = opts.container.css('overflow','hidden').width();
|
41 |
+
opts.cssBefore = { width: width, left : -width-20, top: 0, opacity: 1, display: 'block' };
|
42 |
+
opts.animIn = { left: 0 };
|
43 |
+
opts.animOut = { left : width+20 };
|
44 |
+
}
|
45 |
+
};
|
46 |
+
|
47 |
+
$.fn.cycle.transitions.toss = {
|
48 |
+
before: function( opts, curr, next, fwd ) {
|
49 |
+
opts.API.stackSlides( opts, curr, next, fwd );
|
50 |
+
var width = opts.container.css('overflow','visible').width();
|
51 |
+
var height = opts.container.css('overflow','visible').height();
|
52 |
+
opts.cssBefore = { left: 0, top: 0, opacity: 1, display: 'block',width:width };
|
53 |
+
opts.animIn = { left: 0 };
|
54 |
+
opts.animOut = { left : width*2, top:-height/2 , opacity:0, width:width, display:'block' };
|
55 |
+
}
|
56 |
+
};
|
57 |
+
|
58 |
+
})(jQuery);
|
59 |
+
/*
|
60 |
+
Script to cycle the rotating tweets
|
61 |
+
*/
|
62 |
+
jQuery(document).ready(function() {
|
63 |
+
// Not at all sure we need this
|
64 |
+
jQuery('.rotatingtweets').cycle();
|
65 |
+
// Script to show mouseover effects when going over the Twitter intents
|
66 |
+
jQuery('.rtw_intents a').hover(function() {
|
67 |
+
var rtw_src = jQuery(this).find('img').attr('src');
|
68 |
+
var clearOutHovers = /_hover.png$/;
|
69 |
+
jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
|
70 |
+
var rtw_src = jQuery(this).find('img').attr('src');
|
71 |
+
var srcReplacePattern = /.png$/;
|
72 |
+
jQuery(this).find('img').attr('src',rtw_src.replace(srcReplacePattern,"_hover.png"));
|
73 |
+
},function() {
|
74 |
+
var rtw_src = jQuery(this).find('img').attr('src');
|
75 |
+
var clearOutHovers = /_hover.png/;
|
76 |
+
jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
|
77 |
+
});
|
78 |
+
jQuery('.rtw_wide .rtw_intents').hide();
|
79 |
+
jQuery('.rtw_expand').show();
|
80 |
+
jQuery('.rotatingtweets').has('.rtw_wide').hover(function() {
|
81 |
+
jQuery(this).find('.rtw_intents').show();
|
82 |
+
},function() {
|
83 |
+
jQuery(this).find('.rtw_intents').hide();
|
84 |
+
});
|
85 |
+
});
|
86 |
+
/* And call the Twitter script while we're at it! */
|
87 |
+
/* Standard script to call Twitter */
|
88 |
+
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: mpntod
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9XCNM4QSVHYT8
|
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.9
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -69,9 +69,12 @@ Possible variables for the shortcode include:
|
|
69 |
* `tweet_count` = number of tweets to show - optional - default is `5`
|
70 |
* `get_favorites` = `'0'` or `'1'` - show someone's favorites rather than their timeline - default is `'0'`
|
71 |
* `list` = `'list-slug'` - the 'slug' used by someone's list (something like `my-list`)
|
|
|
72 |
* **Display options**
|
73 |
* `official_format` = `'1'` or `'2'` - show official format - optional - default is `'0'`
|
74 |
* `timeout` = time that each tweet is shown in milliseconds - optional - default is `'4000'` (i.e. 4 seconds)
|
|
|
|
|
75 |
* `links_in_new_window` = `'0'` or `'1'` - show links in a new tab or window - default is `'0'`
|
76 |
* `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'`
|
77 |
* `url_length` = sets the length that the URL should be trimmed to...
|
@@ -83,8 +86,12 @@ Possible variables for the shortcode include:
|
|
83 |
* `show_meta_prev_next` = `'0'` or `'1'` - show 'next', 'prev' links - optional - default is `'0'`
|
84 |
* `prev` = content for the prev button (default `'prev'`)
|
85 |
* `next` = content for the next button (default `'next'`)
|
86 |
-
* `middot` = content for the space between the buttons (default `' &
|
87 |
* `np_pos` = position for 'next' and 'prev' buttons - `'top'`, `'bottom'` or `'tweets'` (default `'top'`)
|
|
|
|
|
|
|
|
|
88 |
* **Twitter follow button**
|
89 |
* `show_follow` = `'0'` or `'1'` - show follow button - optional - default is `'0'`
|
90 |
* `no_show_count` = `'0'` or `'1'` - remove the follower count from the Twitter follow button - optional - default is `'0'`
|
@@ -94,7 +101,7 @@ Possible variables for the shortcode include:
|
|
94 |
Most of this is my own work, but special thanks are owed to:
|
95 |
|
96 |
* The [jQuery](http://jquery.com/) team
|
97 |
-
* [Mike Alsup](http://jquery.malsup.com/cycle/) for [jQuery.Cycle](http://jquery.malsup.com/cycle/)
|
98 |
* [Syd Lawrence](http://sydlawrence.com/) for introducing me to jQuery and jQuery.Cycle
|
99 |
* [Abraham Williams](http://abrah.am) for [TwitterOAuth](https://github.com/abraham/twitteroauth)
|
100 |
* [Liam Gaddy](http://profiles.wordpress.org/lgladdy/) at [Storm Consultancy](http://www.stormconsultancy.co.uk/) for [his work](http://www.stormconsultancy.co.uk/blog/development/tools-plugins/oauth-twitter-feed-for-developers-library-and-wordpress-plugin/) on [oAuth Twitter Feed for Developers](http://wordpress.org/extend/plugins/oauth-twitter-feed-for-developers/) (although I ended up using it for inspiration rather than plugging it in directly).
|
@@ -163,10 +170,17 @@ into your CSS - changing `123px;` to the width you're aiming at - either via put
|
|
163 |
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.
|
164 |
|
165 |
== Upgrade notice ==
|
166 |
-
= 1.
|
167 |
-
*
|
168 |
|
169 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
= 1.6.11 =
|
171 |
* Fixing cache bug with 'user_mentions'
|
172 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9XCNM4QSVHYT8
|
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.9.1
|
7 |
+
Stable tag: 1.7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
69 |
* `tweet_count` = number of tweets to show - optional - default is `5`
|
70 |
* `get_favorites` = `'0'` or `'1'` - show someone's favorites rather than their timeline - default is `'0'`
|
71 |
* `list` = `'list-slug'` - the 'slug' used by someone's list (something like `my-list`)
|
72 |
+
* `offset` = ''number'' - default is `'0'` - enables you to start on a later tweet - `'1'` starts on the 2nd tweet, `'2'` starts on the 3rd tweet, etc.
|
73 |
* **Display options**
|
74 |
* `official_format` = `'1'` or `'2'` - show official format - optional - default is `'0'`
|
75 |
* `timeout` = time that each tweet is shown in milliseconds - optional - default is `'4000'` (i.e. 4 seconds)
|
76 |
+
* `speed` = time it takes to change from one tweet to the next in milliseconds - optional - default is `'1000'` (i.e. 1 second)
|
77 |
+
* `offset` = start displaying an earlier tweet one or more places before the current tweet - option - default is `'0'`
|
78 |
* `links_in_new_window` = `'0'` or `'1'` - show links in a new tab or window - default is `'0'`
|
79 |
* `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'`
|
80 |
* `url_length` = sets the length that the URL should be trimmed to...
|
86 |
* `show_meta_prev_next` = `'0'` or `'1'` - show 'next', 'prev' links - optional - default is `'0'`
|
87 |
* `prev` = content for the prev button (default `'prev'`)
|
88 |
* `next` = content for the next button (default `'next'`)
|
89 |
+
* `middot` = content for the space between the buttons (default `' · '`)
|
90 |
* `np_pos` = position for 'next' and 'prev' buttons - `'top'`, `'bottom'` or `'tweets'` (default `'top'`)
|
91 |
+
* `show_media` = `'0'` or `'1'` - experimental option that shows images with the tweet - default is `'0'`
|
92 |
+
* `screen_name_plural` = `'0'` or `'1'` - experimental option that allows you to have a plural possessive in the default display format (e.g. *British Lions' Twitter*) - default is `'0'`
|
93 |
+
* `tweet_length` = maximum number of characters to show in tweet - experimental - default is `'0'` which allows whole tweet to be shown
|
94 |
+
* `no_emoji` = `'0'` or `'1'` - experimental option that removes emoji from the feed - default is `'0'`
|
95 |
* **Twitter follow button**
|
96 |
* `show_follow` = `'0'` or `'1'` - show follow button - optional - default is `'0'`
|
97 |
* `no_show_count` = `'0'` or `'1'` - remove the follower count from the Twitter follow button - optional - default is `'0'`
|
101 |
Most of this is my own work, but special thanks are owed to:
|
102 |
|
103 |
* The [jQuery](http://jquery.com/) team
|
104 |
+
* [Mike Alsup](http://jquery.malsup.com/cycle/) for [jQuery.Cycle](http://jquery.malsup.com/cycle/) and [jQuery.Cycle2](http://jquery.malsup.com/cycle2/)
|
105 |
* [Syd Lawrence](http://sydlawrence.com/) for introducing me to jQuery and jQuery.Cycle
|
106 |
* [Abraham Williams](http://abrah.am) for [TwitterOAuth](https://github.com/abraham/twitteroauth)
|
107 |
* [Liam Gaddy](http://profiles.wordpress.org/lgladdy/) at [Storm Consultancy](http://www.stormconsultancy.co.uk/) for [his work](http://www.stormconsultancy.co.uk/blog/development/tools-plugins/oauth-twitter-feed-for-developers-library-and-wordpress-plugin/) on [oAuth Twitter Feed for Developers](http://wordpress.org/extend/plugins/oauth-twitter-feed-for-developers/) (although I ended up using it for inspiration rather than plugging it in directly).
|
170 |
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.
|
171 |
|
172 |
== Upgrade notice ==
|
173 |
+
= 1.7.0 =
|
174 |
+
* Adding `offset`, `speed`, `tweet_length`, `no_emoji` and `show_media` options to the shortcode
|
175 |
|
176 |
== Changelog ==
|
177 |
+
= 1.7.0 =
|
178 |
+
* Adding `offset`, `speed`, `tweet_length`, `no_emoji` and `show_media` options to the shortcode
|
179 |
+
* Solves clash with [Cyclone Slider 2](http://wordpress.org/plugins/cyclone-slider-2/)
|
180 |
+
* Adds script version details to the JavaScript
|
181 |
+
* Removal of excess spaces from `middot` shortcode option
|
182 |
+
* Adds option for 'custom' display layoot with user-defined display function `rotatingtweets_display_override()`
|
183 |
+
|
184 |
= 1.6.11 =
|
185 |
* Fixing cache bug with 'user_mentions'
|
186 |
|
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.
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
@@ -138,7 +138,7 @@ class rotatingtweets_Widget extends WP_Widget {
|
|
138 |
'tw_tweet_count' => array('tw_tweet_count',5,'number'),
|
139 |
'tw_show_follow' => array('tw_show_follow',false, 'boolean'),
|
140 |
'tw_shorten_links' => array('tw_shorten_links',false, 'boolean'),
|
141 |
-
'tw_official_format' => array('tw_official_format',0,'
|
142 |
'tw_show_type' => array('tw_show_type',0,'number'),
|
143 |
'tw_links_in_new_window' => array('tw_links_in_new_window',false, 'boolean'),
|
144 |
'tw_hide_meta_timestamp' => array('tw_show_meta_timestamp',true, 'notboolean',true),
|
@@ -155,6 +155,13 @@ class rotatingtweets_Widget extends WP_Widget {
|
|
155 |
case "string":
|
156 |
$$val[0] = esc_attr(trim($instance[$var]));
|
157 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
case "number":
|
159 |
case "boolean":
|
160 |
$$val[0] = absint($instance[$var]);
|
@@ -271,6 +278,9 @@ class rotatingtweets_Widget extends WP_Widget {
|
|
271 |
1 => __("<a target='_blank' href='https://dev.twitter.com/terms/display-guidelines'>Official Twitter guidelines</a> (regular)",'rotatingtweets'),
|
272 |
2 => __("<a target='_blank' href='https://dev.twitter.com/terms/display-guidelines'>Official Twitter guidelines</a> (wide)",'rotatingtweets'),
|
273 |
);
|
|
|
|
|
|
|
274 |
foreach ($officialoptions as $val => $html) {
|
275 |
echo "<input type='radio' value='$val' id='".$this->get_field_id('tw_official_format_'.$val)."' name= '".$this->get_field_name('tw_official_format')."'";
|
276 |
if($tw_official_format==$val): ?> checked="checked" <?php endif;
|
@@ -387,6 +397,7 @@ function rotatingtweets_intents($twitter_object,$lang, $icons = 1,$targetvalue='
|
|
387 |
}
|
388 |
// Produces a link to someone's name, icon or screen name (or to the text of your choice) using the 'intent' format for linking
|
389 |
function rotatingtweets_user_intent($person,$lang,$linkcontent,$targetvalue='') {
|
|
|
390 |
$return = "<a href='https://twitter.com/intent/user?user_id={$person['id']}' title='".esc_attr($person['name'])."' lang='{$lang}'{$targetvalue}>";
|
391 |
switch($linkcontent){
|
392 |
case 'icon':
|
@@ -484,8 +495,17 @@ function rotatingtweets_display_shortcode( $atts, $content=null, $code="", $prin
|
|
484 |
'prev' => __('prev','rotatingtweets'),
|
485 |
'middot' => ' · ',
|
486 |
'np_pos' => 'top',
|
|
|
|
|
487 |
'link_all_text' => FALSE,
|
488 |
-
'no_rotate' => FALSE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
), $atts ) ;
|
490 |
extract($args);
|
491 |
if(empty($screen_name) && empty($search) && !empty($url)):
|
@@ -849,7 +869,11 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
|
|
849 |
delete_option('rotatingtweets_api_error');
|
850 |
endif;
|
851 |
else:
|
852 |
-
if(WP_DEBUG && ! is_admin() )
|
|
|
|
|
|
|
|
|
853 |
$errorstring[0]['code']= 999;
|
854 |
$errorstring[0]['message']= 'Failed to read valid data from Twitter: problem with wp_remote_request()';
|
855 |
$errorstring[0]['type'] = 'Wordpress';
|
@@ -1079,6 +1103,7 @@ function rotatingtweets_shrink_json($json) {
|
|
1079 |
return($return);
|
1080 |
}
|
1081 |
function rotatingtweets_shrink_element($json) {
|
|
|
1082 |
$rt_top_elements = array('text','retweeted_status','user','entities','source','id_str','created_at');
|
1083 |
$return = array();
|
1084 |
foreach($rt_top_elements as $rt_element):
|
@@ -1094,7 +1119,18 @@ function rotatingtweets_shrink_element($json) {
|
|
1094 |
$return[$rt_element]=rotatingtweets_shrink_element($json[$rt_element]);
|
1095 |
break;
|
1096 |
default:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1097 |
$return[$rt_element]=$json[$rt_element];
|
|
|
1098 |
break;
|
1099 |
};
|
1100 |
endif;
|
@@ -1228,6 +1264,11 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1228 |
else:
|
1229 |
$urllength = $defaulturllength;
|
1230 |
endif;
|
|
|
|
|
|
|
|
|
|
|
1231 |
# Check that the rotation type is valid. If not, leave it as 'scrollUp'
|
1232 |
$rotation_type = 'scrollUp';
|
1233 |
# Get Twitter language string
|
@@ -1251,9 +1292,10 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1251 |
# Create an ID that has all the relevant info in - rotation type and speed of rotation
|
1252 |
$id = uniqid('rotatingtweets_'.$timeout.'_'.$rotation_type.'_');
|
1253 |
$result = '';
|
|
|
1254 |
# Put in the 'next / prev' buttons - although not very styled!
|
1255 |
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next']):
|
1256 |
-
$nextprev = '<a href="#" class="'.$id.'_rtw_prev rtw_prev">'.wp_kses_post($args['prev']).'</a>
|
1257 |
if(strtolower($args['np_pos'])=='top'):
|
1258 |
$result .= '<div class="rotatingtweets_nextprev">'.$nextprev.'</div>';
|
1259 |
endif;
|
@@ -1271,7 +1313,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1271 |
'fx' => $rotation_type,
|
1272 |
'pause-on-hover' => 'true',
|
1273 |
'timeout' => $timeout,
|
1274 |
-
'speed' =>
|
1275 |
'easing' => 'swing',
|
1276 |
'slides'=> 'div.rotatingtweet'
|
1277 |
);
|
@@ -1281,8 +1323,21 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1281 |
endif;
|
1282 |
if(! WP_DEBUG) $v2options['log'] = 'false';
|
1283 |
if($rotation_type == 'carousel'):
|
1284 |
-
$
|
1285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1286 |
endif;
|
1287 |
$v2stringelements = array();
|
1288 |
foreach ($v2options as $name => $value) {
|
@@ -1360,6 +1415,12 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1360 |
$firstelement = reset($json);
|
1361 |
$json[] = $firstelement;
|
1362 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
1363 |
foreach($json as $twitter_object):
|
1364 |
if ( ! ( ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@') || (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) ):
|
1365 |
// if (! ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@')): // This works to exlude replies
|
@@ -1393,7 +1454,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1393 |
$rt_user = $rt_data['user'];
|
1394 |
// The version numbers in this array remove RT and use the original text
|
1395 |
$rt_replace_array = array(1,2,3);
|
1396 |
-
if(in_array($args['official_format'],$rt_replace_array)):
|
1397 |
$main_text = $rt_data['text'];
|
1398 |
$retweeter = $user;
|
1399 |
$tweetuser = $rt_user;
|
@@ -1405,6 +1466,25 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1405 |
$entities = $rt_data['entities'];
|
1406 |
endif;
|
1407 |
# First the user mentions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1408 |
if(isset($entities['user_mentions'])):
|
1409 |
$user_mentions = $entities['user_mentions'];
|
1410 |
else:
|
@@ -1439,8 +1519,14 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1439 |
endif;
|
1440 |
if(isset($entities['media'])):
|
1441 |
$media = $entities['media'];
|
|
|
|
|
|
|
|
|
|
|
1442 |
else:
|
1443 |
unset($media);
|
|
|
1444 |
endif;
|
1445 |
if(!empty($media)):
|
1446 |
foreach($media as $medium):
|
@@ -1457,7 +1543,13 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1457 |
# This is designed to find hashtags and turn them into links...
|
1458 |
$before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
|
1459 |
$after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
|
1460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1461 |
$new_text = iconv("UTF-8",DB_CHARSET . '//TRANSLIT',$main_text);
|
1462 |
if(empty($main_text)):
|
1463 |
if(WP_DEBUG):
|
@@ -1502,18 +1594,34 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1502 |
endif;
|
1503 |
$main_text = $twitter_object['text'];
|
1504 |
endif;
|
1505 |
-
# Now for the
|
1506 |
switch ($args['official_format']) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1507 |
case 0:
|
1508 |
# This is the original Rotating Tweets display routine
|
1509 |
$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
|
1510 |
$meta = '';
|
|
|
|
|
|
|
1511 |
if($args['show_meta_timestamp']):
|
1512 |
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1513 |
endif;
|
1514 |
if($args['show_meta_screen_name']):
|
1515 |
if(!empty($meta)) $meta .= ' ';
|
1516 |
-
|
|
|
|
|
|
|
|
|
|
|
1517 |
endif;
|
1518 |
if($args['show_meta_via']):
|
1519 |
if(!empty($meta)) $meta .= ' ';
|
@@ -1540,6 +1648,9 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1540 |
$result .= "\n\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1541 |
$result .= "\n\t</div>";
|
1542 |
$result .= "\n\t<p class='rtw_main'>".$main_text."</p>";
|
|
|
|
|
|
|
1543 |
$result .= "\n\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1544 |
$result .= "\n\t<div class='rtw_timestamp'>".rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1545 |
if(isset($retweeter)) {
|
@@ -1562,6 +1673,9 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
|
|
1562 |
$result .= "\n\t\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1563 |
$result .= "\n\t\t</div>";
|
1564 |
$result .= "\n\t\t<p class='rtw_main'>".$main_text."</p>";
|
|
|
|
|
|
|
1565 |
// $result .= "\n\t\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1).'</div>';
|
1566 |
if(isset($retweeter)) {
|
1567 |
$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>";
|
@@ -1735,20 +1849,38 @@ function rotatingtweets_enqueue_scripts() {
|
|
1735 |
$api = get_option('rotatingtweets-api-settings');
|
1736 |
if(!isset($api['js_in_footer'])) $api['js_in_footer'] = FALSE;
|
1737 |
$style = strtolower(get_stylesheet());
|
|
|
|
|
1738 |
// Fixes a problem with the magazino template
|
1739 |
if($style == 'magazino' || (isset($api['jquery_cycle_version']) && $api['jquery_cycle_version']==2)):
|
1740 |
/*
|
1741 |
'jquery-easing' => 'http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js',
|
1742 |
-
*/
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1750 |
foreach($rt_enqueue_script_list as $scriptname => $scriptlocation):
|
1751 |
-
|
|
|
|
|
|
|
|
|
|
|
1752 |
$dependence[] = $scriptname;
|
1753 |
endforeach;
|
1754 |
else:
|
@@ -1780,7 +1912,7 @@ function rotatingtweets_enqueue_scripts() {
|
|
1780 |
$dependence[]='jquery-cycle';
|
1781 |
break;
|
1782 |
endswitch;
|
1783 |
-
wp_enqueue_script( 'rotating_tweet', plugins_url($rotatingtweetsjsfile, __FILE__),$dependence
|
1784 |
endif;
|
1785 |
}
|
1786 |
function rotatingtweets_enqueue_style() {
|
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.7.0
|
6 |
Text Domain: rotatingtweets
|
7 |
Author: Martin Tod
|
8 |
Author URI: http://www.martintod.org.uk
|
138 |
'tw_tweet_count' => array('tw_tweet_count',5,'number'),
|
139 |
'tw_show_follow' => array('tw_show_follow',false, 'boolean'),
|
140 |
'tw_shorten_links' => array('tw_shorten_links',false, 'boolean'),
|
141 |
+
'tw_official_format' => array('tw_official_format',0,'format'),
|
142 |
'tw_show_type' => array('tw_show_type',0,'number'),
|
143 |
'tw_links_in_new_window' => array('tw_links_in_new_window',false, 'boolean'),
|
144 |
'tw_hide_meta_timestamp' => array('tw_show_meta_timestamp',true, 'notboolean',true),
|
155 |
case "string":
|
156 |
$$val[0] = esc_attr(trim($instance[$var]));
|
157 |
break;
|
158 |
+
case "format":
|
159 |
+
if($instance[$var]==='custom'):
|
160 |
+
$$val[0] = 'custom';
|
161 |
+
else:
|
162 |
+
$$val[0] = absint($instance[$var]);
|
163 |
+
endif;
|
164 |
+
break;
|
165 |
case "number":
|
166 |
case "boolean":
|
167 |
$$val[0] = absint($instance[$var]);
|
278 |
1 => __("<a target='_blank' href='https://dev.twitter.com/terms/display-guidelines'>Official Twitter guidelines</a> (regular)",'rotatingtweets'),
|
279 |
2 => __("<a target='_blank' href='https://dev.twitter.com/terms/display-guidelines'>Official Twitter guidelines</a> (wide)",'rotatingtweets'),
|
280 |
);
|
281 |
+
if (function_exists('rotatingtweets_display_override')) {
|
282 |
+
$officialoptions['custom'] = __('Custom display layout','rotatingtweets');
|
283 |
+
}
|
284 |
foreach ($officialoptions as $val => $html) {
|
285 |
echo "<input type='radio' value='$val' id='".$this->get_field_id('tw_official_format_'.$val)."' name= '".$this->get_field_name('tw_official_format')."'";
|
286 |
if($tw_official_format==$val): ?> checked="checked" <?php endif;
|
397 |
}
|
398 |
// Produces a link to someone's name, icon or screen name (or to the text of your choice) using the 'intent' format for linking
|
399 |
function rotatingtweets_user_intent($person,$lang,$linkcontent,$targetvalue='') {
|
400 |
+
if(!is_array($person)) return;
|
401 |
$return = "<a href='https://twitter.com/intent/user?user_id={$person['id']}' title='".esc_attr($person['name'])."' lang='{$lang}'{$targetvalue}>";
|
402 |
switch($linkcontent){
|
403 |
case 'icon':
|
495 |
'prev' => __('prev','rotatingtweets'),
|
496 |
'middot' => ' · ',
|
497 |
'np_pos' => 'top',
|
498 |
+
'speed' => 1000,
|
499 |
+
'offset' => 0,
|
500 |
'link_all_text' => FALSE,
|
501 |
+
'no_rotate' => FALSE,
|
502 |
+
'show_media' => FALSE,
|
503 |
+
'screen_name_plural' => 0,
|
504 |
+
'tweet_length' => 0,
|
505 |
+
'carousel_horizontal' => 0,
|
506 |
+
'carousel_count' => 0,
|
507 |
+
'carousel_responsive' => 0,
|
508 |
+
'no_emoji' => 0
|
509 |
), $atts ) ;
|
510 |
extract($args);
|
511 |
if(empty($screen_name) && empty($search) && !empty($url)):
|
869 |
delete_option('rotatingtweets_api_error');
|
870 |
endif;
|
871 |
else:
|
872 |
+
if(WP_DEBUG && ! is_admin() ):
|
873 |
+
echo "<!-- Failed to read valid data from Twitter: problem with wp_remote_request(). Data read was: ";
|
874 |
+
print_r($result);
|
875 |
+
echo "\n-->";
|
876 |
+
endif;
|
877 |
$errorstring[0]['code']= 999;
|
878 |
$errorstring[0]['message']= 'Failed to read valid data from Twitter: problem with wp_remote_request()';
|
879 |
$errorstring[0]['type'] = 'Wordpress';
|
1103 |
return($return);
|
1104 |
}
|
1105 |
function rotatingtweets_shrink_element($json) {
|
1106 |
+
global $args;
|
1107 |
$rt_top_elements = array('text','retweeted_status','user','entities','source','id_str','created_at');
|
1108 |
$return = array();
|
1109 |
foreach($rt_top_elements as $rt_element):
|
1119 |
$return[$rt_element]=rotatingtweets_shrink_element($json[$rt_element]);
|
1120 |
break;
|
1121 |
default:
|
1122 |
+
if(isset($args['no_emoji']) && $args['no_emoji']):
|
1123 |
+
$before='/\\p{C}/u'; # Removed all 'other' characters - http://php.net/manual/en/regexp.reference.unicode.php
|
1124 |
+
$after='';
|
1125 |
+
$json[$rt_element] = str_replace($before,$after,$json[$rt_element]);
|
1126 |
+
endif;
|
1127 |
+
/* Experiment to deal with problem caused by emoji crashing a poorly configured database
|
1128 |
+
if(function_exists("mb_convert_encoding")):
|
1129 |
+
$return[$rt_element]=mb_convert_encoding($json[$rt_element], "UTF-8");
|
1130 |
+
else:
|
1131 |
+
*/
|
1132 |
$return[$rt_element]=$json[$rt_element];
|
1133 |
+
// endif;
|
1134 |
break;
|
1135 |
};
|
1136 |
endif;
|
1264 |
else:
|
1265 |
$urllength = $defaulturllength;
|
1266 |
endif;
|
1267 |
+
if(isset($args['speed'])):
|
1268 |
+
$speed = max(100,intval($args['speed']));
|
1269 |
+
else:
|
1270 |
+
$speed = 1000;
|
1271 |
+
endif;
|
1272 |
# Check that the rotation type is valid. If not, leave it as 'scrollUp'
|
1273 |
$rotation_type = 'scrollUp';
|
1274 |
# Get Twitter language string
|
1292 |
# Create an ID that has all the relevant info in - rotation type and speed of rotation
|
1293 |
$id = uniqid('rotatingtweets_'.$timeout.'_'.$rotation_type.'_');
|
1294 |
$result = '';
|
1295 |
+
$nextprev = '';
|
1296 |
# Put in the 'next / prev' buttons - although not very styled!
|
1297 |
if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next']):
|
1298 |
+
$nextprev = '<a href="#" class="'.$id.'_rtw_prev rtw_prev">'.wp_kses_post($args['prev']).'</a>'.wp_kses_post($args['middot']).'<a href="#" class="'.$id.'_rtw_next rtw_next">'.wp_kses_post($args['next']).'</a>';
|
1299 |
if(strtolower($args['np_pos'])=='top'):
|
1300 |
$result .= '<div class="rotatingtweets_nextprev">'.$nextprev.'</div>';
|
1301 |
endif;
|
1313 |
'fx' => $rotation_type,
|
1314 |
'pause-on-hover' => 'true',
|
1315 |
'timeout' => $timeout,
|
1316 |
+
'speed' => $speed,
|
1317 |
'easing' => 'swing',
|
1318 |
'slides'=> 'div.rotatingtweet'
|
1319 |
);
|
1323 |
endif;
|
1324 |
if(! WP_DEBUG) $v2options['log'] = 'false';
|
1325 |
if($rotation_type == 'carousel'):
|
1326 |
+
if(empty($args['carousel_horizontal'])):
|
1327 |
+
$v2options['carousel-vertical'] = true;
|
1328 |
+
if(isset($args['carousel_count'])):
|
1329 |
+
$v2options['carousel-visible'] = max(2,intval($args['carousel_count']));
|
1330 |
+
else:
|
1331 |
+
$v2options['carousel-visible'] = 3;
|
1332 |
+
endif;
|
1333 |
+
else:
|
1334 |
+
if(isset($args['carousel_count'])):
|
1335 |
+
$v2options['carousel-visible'] = max(2,intval($args['carousel_count']));
|
1336 |
+
endif;
|
1337 |
+
if(isset($args['carousel_responsive'])):
|
1338 |
+
$v2options['carousel-fluid'] = true;
|
1339 |
+
endif;
|
1340 |
+
endif;
|
1341 |
endif;
|
1342 |
$v2stringelements = array();
|
1343 |
foreach ($v2options as $name => $value) {
|
1415 |
$firstelement = reset($json);
|
1416 |
$json[] = $firstelement;
|
1417 |
endif;
|
1418 |
+
if(isset($args['offset']) && $args['offset']>=1 && count($json)>1):
|
1419 |
+
for ($i = 1; $i <= $args['offset']; $i++) {
|
1420 |
+
$firstelement = array_shift($json);
|
1421 |
+
array_push($json,$firstelement);
|
1422 |
+
}
|
1423 |
+
endif;
|
1424 |
foreach($json as $twitter_object):
|
1425 |
if ( ! ( ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@') || (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) ):
|
1426 |
// if (! ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@')): // This works to exlude replies
|
1454 |
$rt_user = $rt_data['user'];
|
1455 |
// The version numbers in this array remove RT and use the original text
|
1456 |
$rt_replace_array = array(1,2,3);
|
1457 |
+
if(in_array($args['official_format'],$rt_replace_array) || $args['official_format'] === 'custom' ):
|
1458 |
$main_text = $rt_data['text'];
|
1459 |
$retweeter = $user;
|
1460 |
$tweetuser = $rt_user;
|
1466 |
$entities = $rt_data['entities'];
|
1467 |
endif;
|
1468 |
# First the user mentions
|
1469 |
+
if(isset($args['tweet_length']) && $args['tweet_length']>0 ):
|
1470 |
+
$tweetwords = explode(" ",$main_text);
|
1471 |
+
$new_main_text = array_shift($tweetwords);
|
1472 |
+
foreach($tweetwords as $tweetword):
|
1473 |
+
if(strlen($new_main_text." ".$tweetword)<$args['tweet_length']):
|
1474 |
+
$new_main_text .= " ".$tweetword;
|
1475 |
+
if(WP_DEBUG):
|
1476 |
+
echo "<!-- adding '$tweetword' -->";
|
1477 |
+
endif;
|
1478 |
+
else:
|
1479 |
+
$new_main_text .= "…";
|
1480 |
+
if(WP_DEBUG):
|
1481 |
+
echo "<!-- finishing and adding '…' -->";
|
1482 |
+
endif;
|
1483 |
+
break;
|
1484 |
+
endif;
|
1485 |
+
endforeach;
|
1486 |
+
$main_text = $new_main_text;
|
1487 |
+
endif;
|
1488 |
if(isset($entities['user_mentions'])):
|
1489 |
$user_mentions = $entities['user_mentions'];
|
1490 |
else:
|
1519 |
endif;
|
1520 |
if(isset($entities['media'])):
|
1521 |
$media = $entities['media'];
|
1522 |
+
$media_data = $media[0];
|
1523 |
+
if(isset($args['show_media']) && $args['show_media']):
|
1524 |
+
$alt = esc_html(trim(str_replace($media_data['url'],'',strip_tags($main_text))));
|
1525 |
+
$show_media = "<a href='{$media_data['url']}' title='{$alt}'><img src='{$media_data['media_url_https']}' alt='{$alt}' /></a>";
|
1526 |
+
endif;
|
1527 |
else:
|
1528 |
unset($media);
|
1529 |
+
$show_media='';
|
1530 |
endif;
|
1531 |
if(!empty($media)):
|
1532 |
foreach($media as $medium):
|
1543 |
# This is designed to find hashtags and turn them into links...
|
1544 |
$before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
|
1545 |
$after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
|
1546 |
+
# Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
|
1547 |
+
if(isset($args['no_emoji']) && $args['no_emoji']):
|
1548 |
+
// $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.php
|
1549 |
+
$before[]='/\\p{C}/u'; # Removed all 'other' characters - http://php.net/manual/en/regexp.reference.unicode.php
|
1550 |
+
$after[]='';
|
1551 |
+
endif;
|
1552 |
+
if( defined('DB_CHARSET') && strtoupper(DB_CHARSET) !='UTF-8' && strtoupper(DB_CHARSET)!= 'UTF8' && strtoupper(DB_CHARSET)!= '' ):
|
1553 |
$new_text = iconv("UTF-8",DB_CHARSET . '//TRANSLIT',$main_text);
|
1554 |
if(empty($main_text)):
|
1555 |
if(WP_DEBUG):
|
1594 |
endif;
|
1595 |
$main_text = $twitter_object['text'];
|
1596 |
endif;
|
1597 |
+
# Now for the different display options
|
1598 |
switch ($args['official_format']) {
|
1599 |
+
case 'custom':
|
1600 |
+
# This first option lets you use your own function to display tweets
|
1601 |
+
if (function_exists('rotatingtweets_display_override')) {
|
1602 |
+
if(!isset($retweeter)) $retweeter = '';
|
1603 |
+
$result .= rotatingtweets_display_override(
|
1604 |
+
$args, $tweetuser, $main_text, $twitter_object, $twitterlocale, $targetvalue, $retweeter, $show_media, $nextprev );
|
1605 |
+
break;
|
1606 |
+
}
|
1607 |
case 0:
|
1608 |
# This is the original Rotating Tweets display routine
|
1609 |
$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
|
1610 |
$meta = '';
|
1611 |
+
if(isset($args['show_media']) && !empty($show_media)):
|
1612 |
+
$result .= "<div class='rtw_media'>$show_media</div>";
|
1613 |
+
endif;
|
1614 |
if($args['show_meta_timestamp']):
|
1615 |
$meta .= rotatingtweets_timestamp_link($twitter_object,'default',$targetvalue);
|
1616 |
endif;
|
1617 |
if($args['show_meta_screen_name']):
|
1618 |
if(!empty($meta)) $meta .= ' ';
|
1619 |
+
if(isset($args['screen_name_plural'])):
|
1620 |
+
$screennamecount = max(1,$args['screen_name_plural']+1);
|
1621 |
+
else:
|
1622 |
+
$screennamecount = 1;
|
1623 |
+
endif;
|
1624 |
+
$meta .= sprintf(_n('from <a href=\'%1$s\' title=\'%2$s\'>%2$s\'s Twitter</a>','from <a href=\'%1$s\' title=\'%2$s\'>%2$s\' Twitter</a>',$screennamecount,'rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']);
|
1625 |
endif;
|
1626 |
if($args['show_meta_via']):
|
1627 |
if(!empty($meta)) $meta .= ' ';
|
1648 |
$result .= "\n\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1649 |
$result .= "\n\t</div>";
|
1650 |
$result .= "\n\t<p class='rtw_main'>".$main_text."</p>";
|
1651 |
+
if(isset($args['show_media']) && !empty($show_media)):
|
1652 |
+
$result .= "<div class='rtw_media'>$show_media</div>";
|
1653 |
+
endif;
|
1654 |
$result .= "\n\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
|
1655 |
$result .= "\n\t<div class='rtw_timestamp'>".rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
|
1656 |
if(isset($retweeter)) {
|
1673 |
$result .= "\n\t\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
|
1674 |
$result .= "\n\t\t</div>";
|
1675 |
$result .= "\n\t\t<p class='rtw_main'>".$main_text."</p>";
|
1676 |
+
if(isset($args['show_media']) && !empty($show_media)):
|
1677 |
+
$result .= "<div class='rtw_media'>$show_media</div>";
|
1678 |
+
endif;
|
1679 |
// $result .= "\n\t\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1).'</div>';
|
1680 |
if(isset($retweeter)) {
|
1681 |
$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>";
|
1849 |
$api = get_option('rotatingtweets-api-settings');
|
1850 |
if(!isset($api['js_in_footer'])) $api['js_in_footer'] = FALSE;
|
1851 |
$style = strtolower(get_stylesheet());
|
1852 |
+
$rt_data = get_plugin_data( __FILE__ );
|
1853 |
+
$rt_cycleversion = $rt_data;
|
1854 |
// Fixes a problem with the magazino template
|
1855 |
if($style == 'magazino' || (isset($api['jquery_cycle_version']) && $api['jquery_cycle_version']==2)):
|
1856 |
/*
|
1857 |
'jquery-easing' => 'http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js',
|
1858 |
+
*/
|
1859 |
+
if (is_plugin_active('cyclone-slider-2/cyclone-slider.php')):
|
1860 |
+
$cyclepath = str_replace('rotatingtweets/','cyclone-slider-2/cyclone-slider.php',plugin_dir_path( __FILE__ ));
|
1861 |
+
$rt_cycleversion = get_plugin_data( $cyclepath );
|
1862 |
+
$rt_enqueue_script_list = array(
|
1863 |
+
'jquery-cycle2' => plugins_url('cyclone-slider-2/libs/cycle2/jquery.cycle2.min.js'),
|
1864 |
+
'jquery-cycle2-carousel' => plugins_url('cyclone-slider-2/libs/cycle2/jquery.cycle2.carousel.min.js'),
|
1865 |
+
'jquery-cycle2-scrollvert' => plugins_url('cyclone-slider-2/libs/cycle2/jquery.cycle2.scrollVert.min.js'),
|
1866 |
+
'rotating_tweet' => plugins_url('js/rotatingtweets_v2_cyclone.js', __FILE__)
|
1867 |
+
);
|
1868 |
+
else:
|
1869 |
+
$rt_enqueue_script_list = array(
|
1870 |
+
'jquery-cycle2-renamed' => plugins_url('js/jquery.cycle2.renamed.js', __FILE__),
|
1871 |
+
'jquery-cycle2-scrollvert-renamed' => plugins_url('js/jquery.cycle2.scrollVert.renamed.js', __FILE__),
|
1872 |
+
'jquery-cycle2-carousel-renamed' => plugins_url('js/jquery.cycle2.carousel.renamed.js', __FILE__),
|
1873 |
+
'rotating_tweet' => plugins_url('js/rotatingtweets_v2.js', __FILE__)
|
1874 |
+
);
|
1875 |
+
// $dependence[]='jquery-effects-core';
|
1876 |
+
endif;
|
1877 |
foreach($rt_enqueue_script_list as $scriptname => $scriptlocation):
|
1878 |
+
if( $scriptname == 'rotating_tweet' ):
|
1879 |
+
$scriptver = $rt_data['Version'];
|
1880 |
+
else:
|
1881 |
+
$scriptver = $rt_cycleversion['Version'];
|
1882 |
+
endif;
|
1883 |
+
wp_enqueue_script($scriptname,$scriptlocation,$dependence,$scriptver,$api['js_in_footer']);
|
1884 |
$dependence[] = $scriptname;
|
1885 |
endforeach;
|
1886 |
else:
|
1912 |
$dependence[]='jquery-cycle';
|
1913 |
break;
|
1914 |
endswitch;
|
1915 |
+
wp_enqueue_script( 'rotating_tweet', plugins_url($rotatingtweetsjsfile, __FILE__),$dependence,$rt_data['Version'],$api['js_in_footer'] );
|
1916 |
endif;
|
1917 |
}
|
1918 |
function rotatingtweets_enqueue_style() {
|