Rotating Tweets (Twitter widget and shortcode) - Version 1.7.10

Version Description

  • Addition of 'pager' option. Fix 'speed' bug.

=

Download this release

Release Info

Developer mpntod
Plugin Icon wp plugin Rotating Tweets (Twitter widget and shortcode)
Version 1.7.10
Comparing to
See all releases

Code changes from version 1.7.9 to 1.7.10

css/style.css CHANGED
@@ -97,7 +97,18 @@ div.rtw_timestamp {
97
  height: 150px;
98
  max-height: 150px;
99
  }
100
-
 
 
 
 
 
 
 
 
 
 
 
101
  /* This sets the style for tweets in articles or posts */
102
  #content .rotatingtweets,
103
  #content .norotatingtweets {
97
  height: 150px;
98
  max-height: 150px;
99
  }
100
+ /* Pager CSS */
101
+ .rtw_pager {
102
+ text-align: center;
103
+ font-size: 2em;
104
+ }
105
+ .rtw_pager a {
106
+ text-decoration: none !important;
107
+ }
108
+ .rtw_pager .cycle-pager-active,
109
+ .rtw_pager .activeSlide {
110
+ color: #DDD;
111
+ }
112
  /* This sets the style for tweets in articles or posts */
113
  #content .rotatingtweets,
114
  #content .norotatingtweets {
js/rotating_tweet.js CHANGED
@@ -4,12 +4,14 @@
4
  jQuery(document).ready(function() {
5
  jQuery('.rotatingtweets').each(function() {
6
  /* Get the ID of the rotating tweets div - and parse it to get rotation speed and rotation fx */
7
- var rotate_id = "#"+this.id;
8
- var rotate_id_split = rotate_id.split('_');
9
- var rotate_class = "."+this.id;
10
- var rotate_timeout = rotate_id_split[1];
11
- var rotate_fx = rotate_id_split[2];
12
- var rotate_wp_debug = jQuery(this).hasClass('wp_debug');
 
 
13
  if( typeof console == "undefined" || typeof console.log == "undefined" ) {
14
  rotate_wp_debug = false;
15
  }
@@ -18,13 +20,12 @@ jQuery(document).ready(function() {
18
  var rt_height_px = 'auto';
19
  /* Now find the widget container width */
20
  // Take the smaller of the parent and grandparent
21
- var rt_parent = jQuery(rotate_id).parent();
22
- var rt_grandparent = jQuery(rotate_id).parent().parent();
23
  var rt_target_container_width = Math.min (
24
- rt_parent.innerWidth() - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')),
25
- rt_grandparent.innerWidth() - parseFloat(rt_grandparent.css('padding-left')) - parseFloat(rt_grandparent.css('padding-right')) - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')) - parseFloat(rt_parent.css('margin-left')) - parseFloat(rt_parent.css('margin-right'))
26
- );
27
-
28
  // Get the size of the parent box and subtract any padding
29
  var rt_target_width = rt_target_container_width - parseFloat(jQuery(this).css('padding-left')) - parseFloat(jQuery(this).css('padding-right')) - parseFloat(jQuery(this).css('margin-left')) - parseFloat(jQuery(this).css('margin-right')) - parseFloat(jQuery(this).css('border-left')) - parseFloat(jQuery(this).css('border-right') ) ;
30
  var rt_fit = 1;
@@ -39,13 +40,16 @@ jQuery(document).ready(function() {
39
  console.log('rt_target_container_width = '+rt_target_container_width);
40
  console.log('rt_target_width = '+rt_target_width);
41
  console.log('rotate_timeout = '+rotate_timeout);
42
- };
 
 
 
 
43
  /* If we're displaying an 'official' tweet, reset all the heights - this option is currently switched off! */
44
  // var rt_official_child = rotate_id + ' .twitter-tweet';
45
  // var rt_official_num = jQuery(rt_official_child).length;
46
  // if (rt_official_num > 0) rt_height_px = '211px';
47
- /* Call the rotation */
48
- jQuery(rotate_id).cycle({
49
  pause: 1,
50
  height: rt_height_px,
51
  timeout: rotate_timeout,
@@ -54,13 +58,33 @@ jQuery(document).ready(function() {
54
  prev: rotate_class + '_rtw_prev',
55
  next: rotate_class + '_rtw_next',
56
  fx: rotate_fx,
57
- fit: rt_fit
58
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  /* If the height of the rotating tweet box is zero - kill the box and start again */
60
  var rt_height = jQuery(rotate_id).height();
61
  if(rotate_wp_debug) {
62
  console.log('Initial height: '+rt_height );
63
- };
64
  if( rt_height < 1 ) {
65
  var rt_children_id = rotate_id + ' .rotatingtweet';
66
  var rt_height = 0;
@@ -73,21 +97,12 @@ jQuery(document).ready(function() {
73
  });
74
  rt_height = rt_height + 20;
75
  var rt_height_px = rt_height + 'px';
 
76
  if(rotate_wp_debug) {
77
  console.log('Resetting height to rt_height_px '+rt_height_px);
78
- };
79
  jQuery(rotate_id).cycle('destroy');
80
- jQuery(rotate_id).cycle({
81
- pause: 1,
82
- height: rt_height_px,
83
- timeout: rotate_timeout,
84
- width: rt_target_width,
85
- cleartypeNoBg: true,
86
- fit: rt_fit,
87
- prev: rotate_class + '_rtw_prev',
88
- next: rotate_class + '_rtw_next',
89
- fx: rotate_fx
90
- });
91
  }
92
 
93
  /* Only do this if we're showing the official tweets - the first select is the size of the info box at the top of the tweet */
@@ -149,17 +164,17 @@ jQuery(document).ready(function() {
149
  };
150
  // Now the responsiveness code
151
  // First get the measures we will use to track change
152
- var rt_resize_width_old_parent = rt_parent.innerWidth();
153
- var rt_resize_width_old_grandparent = rt_grandparent.innerWidth();
154
- var rt_resize_width_new_parent = rt_resize_width_old_parent;
155
- var rt_resize_width_new_grandparent = rt_resize_width_old_grandparent;
156
- var rt_resize_parent_change = 0;
157
- var rt_resize_grandparent_change = 0;
158
  // Now get the starting measures
159
- var rt_resize_target_width = jQuery(rotate_id).width();
160
- var rt_resize_target_main = jQuery(rotate_id + ' .rtw_main').width();
161
- var rt_resize_target_tweet = jQuery(rotate_id + ' .rotatingtweet').width();
162
- var rt_resize_target_meta = jQuery(rotate_id + ' .rtw_meta').width();
163
  jQuery(window).resize(function() {
164
  rt_parent = jQuery(rotate_id).parent();
165
  rt_grandparent = rt_parent.parent();
4
  jQuery(document).ready(function() {
5
  jQuery('.rotatingtweets').each(function() {
6
  /* Get the ID of the rotating tweets div - and parse it to get rotation speed and rotation fx */
7
+ var rotate_id = "#"+this.id,
8
+ rotate_class = "."+this.id,
9
+ rotate_timeout = jQuery(this).data('cycle-timeout'),
10
+ rotate_fx = jQuery(this).data('cycle-fx'),
11
+ rotate_speed = jQuery(this).data('cycle-speed'),
12
+ rotate_pager = jQuery(this).data('cycle-pager'),
13
+ rotate_pager_template = jQuery(this).data('cycle-pager-template'),
14
+ rotate_wp_debug = jQuery(this).hasClass('wp_debug');
15
  if( typeof console == "undefined" || typeof console.log == "undefined" ) {
16
  rotate_wp_debug = false;
17
  }
20
  var rt_height_px = 'auto';
21
  /* Now find the widget container width */
22
  // Take the smaller of the parent and grandparent
23
+ var rt_parent = jQuery(rotate_id).parent(),
24
+ rt_grandparent = jQuery(rotate_id).parent().parent();
25
  var rt_target_container_width = Math.min (
26
+ rt_parent.innerWidth() - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')),
27
+ rt_grandparent.innerWidth() - parseFloat(rt_grandparent.css('padding-left')) - parseFloat(rt_grandparent.css('padding-right')) - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')) - parseFloat(rt_parent.css('margin-left')) - parseFloat(rt_parent.css('margin-right'))
28
+ );
 
29
  // Get the size of the parent box and subtract any padding
30
  var rt_target_width = rt_target_container_width - parseFloat(jQuery(this).css('padding-left')) - parseFloat(jQuery(this).css('padding-right')) - parseFloat(jQuery(this).css('margin-left')) - parseFloat(jQuery(this).css('margin-right')) - parseFloat(jQuery(this).css('border-left')) - parseFloat(jQuery(this).css('border-right') ) ;
31
  var rt_fit = 1;
40
  console.log('rt_target_container_width = '+rt_target_container_width);
41
  console.log('rt_target_width = '+rt_target_width);
42
  console.log('rotate_timeout = '+rotate_timeout);
43
+ console.log('rotate_speed = '+rotate_speed);
44
+ console.log('rotate_fx = '+rotate_fx);
45
+ console.log('rotate_pager = '+rotate_pager);
46
+ console.log('rotate_pager_template = '+rotate_pager_template);
47
+ }
48
  /* If we're displaying an 'official' tweet, reset all the heights - this option is currently switched off! */
49
  // var rt_official_child = rotate_id + ' .twitter-tweet';
50
  // var rt_official_num = jQuery(rt_official_child).length;
51
  // if (rt_official_num > 0) rt_height_px = '211px';
52
+ var rotate_vars = {
 
53
  pause: 1,
54
  height: rt_height_px,
55
  timeout: rotate_timeout,
58
  prev: rotate_class + '_rtw_prev',
59
  next: rotate_class + '_rtw_next',
60
  fx: rotate_fx,
61
+ fit: rt_fit,
62
+ speed: rotate_speed
63
+ }
64
+ if( rotate_timeout > 0) {
65
+ rotate_vars.timeout = rotate_timeout;
66
+ } else {
67
+ rotate_vars.continuous = true;
68
+ rotate_vars.easing = 'linear';
69
+ }
70
+ if(typeof rotate_pager !== "undefined" ) {
71
+ rotate_vars.pager = rotate_id + '_rtw_pager';
72
+ if(typeof rotate_pager_template !== "undefined") {
73
+ rotate_vars.pagerAnchorBuilder = function(idx, slide) {
74
+ return rotate_pager_template;
75
+ }
76
+ }
77
+ }
78
+ if(rotate_wp_debug) {
79
+ console.log(rotate_vars);
80
+ }
81
+ /* Call the rotation */
82
+ jQuery(rotate_id).cycle(rotate_vars);
83
  /* If the height of the rotating tweet box is zero - kill the box and start again */
84
  var rt_height = jQuery(rotate_id).height();
85
  if(rotate_wp_debug) {
86
  console.log('Initial height: '+rt_height );
87
+ }
88
  if( rt_height < 1 ) {
89
  var rt_children_id = rotate_id + ' .rotatingtweet';
90
  var rt_height = 0;
97
  });
98
  rt_height = rt_height + 20;
99
  var rt_height_px = rt_height + 'px';
100
+ rotate_vars.rt_height_px = rt_height_px;
101
  if(rotate_wp_debug) {
102
  console.log('Resetting height to rt_height_px '+rt_height_px);
103
+ }
104
  jQuery(rotate_id).cycle('destroy');
105
+ jQuery(rotate_id).cycle(rotate_vars);
 
 
 
 
 
 
 
 
 
 
106
  }
107
 
108
  /* Only do this if we're showing the official tweets - the first select is the size of the info box at the top of the tweet */
164
  };
165
  // Now the responsiveness code
166
  // First get the measures we will use to track change
167
+ var rt_resize_width_old_parent = rt_parent.innerWidth(),
168
+ rt_resize_width_old_grandparent = rt_grandparent.innerWidth(),
169
+ rt_resize_width_new_parent = rt_resize_width_old_parent,
170
+ rt_resize_width_new_grandparent = rt_resize_width_old_grandparent,
171
+ rt_resize_parent_change = 0,
172
+ rt_resize_grandparent_change = 0;
173
  // Now get the starting measures
174
+ var rt_resize_target_width = jQuery(rotate_id).width(),
175
+ rt_resize_target_main = jQuery(rotate_id + ' .rtw_main').width(),
176
+ rt_resize_target_tweet = jQuery(rotate_id + ' .rotatingtweet').width(),
177
+ rt_resize_target_meta = jQuery(rotate_id + ' .rtw_meta').width();
178
  jQuery(window).resize(function() {
179
  rt_parent = jQuery(rotate_id).parent();
180
  rt_grandparent = rt_parent.parent();
js/rotating_tweet.min.js CHANGED
@@ -1,10 +1 @@
1
- jQuery(document).ready(function(){jQuery(".rotatingtweets").c(function(){var a="#"+this.id,c=a.split("_"),h="."+this.id,f=c[1],c=c[2],b=jQuery(this).k("wp_debug");if("undefined"==typeof console||"undefined"==typeof console.log)b=!1;null==c&&(c="scrollUp");var p="auto",e=jQuery(a).parent(),k=jQuery(a).parent().parent(),A=Math.min(e.innerWidth()-parseFloat(e.a("padding-left"))-parseFloat(e.a("padding-right")),k.innerWidth()-parseFloat(k.a("padding-left"))-parseFloat(k.a("padding-right"))-parseFloat(e.a("padding-left"))-
2
- parseFloat(e.a("padding-right"))-parseFloat(e.a("margin-left"))-parseFloat(e.a("margin-right"))),q=A-parseFloat(jQuery(this).a("padding-left"))-parseFloat(jQuery(this).a("padding-right"))-parseFloat(jQuery(this).a("margin-left"))-parseFloat(jQuery(this).a("margin-right"))-parseFloat(jQuery(this).a("border-left"))-parseFloat(jQuery(this).a("border-right")),t=1;null==q&&(t=0);b&&(console.log("============================"),console.log("self_width = "+jQuery(a).innerWidth()),console.log("parent_width = "+
3
- e.innerWidth()),console.log("grandparent_width = "+k.innerWidth()),console.log("rt_target_container_width = "+A),console.log("rt_target_width = "+q),console.log("rotate_timeout = "+f));jQuery(a).d({pause:1,height:p,timeout:f,e:!0,width:q,j:h+"_rtw_prev",next:h+"_rtw_next",g:c,f:t});var d=jQuery(a).height();b&&console.log("Initial height: "+d);if(1>d){var m=a+" .rotatingtweet",d=0;jQuery(m).c(function(){var a=jQuery(this).height();a>d&&(d=a)});d+=20;p=d+"px";b&&console.log("Resetting height to rt_height_px "+
4
- p);jQuery(a).d("destroy");jQuery(a).d({pause:1,height:p,timeout:f,width:q,e:!0,f:t,j:h+"_rtw_prev",next:h+"_rtw_next",g:c})}var m=a+" .rtw_info",h=a+" .rtw_wide_icon a img",f=a+" .rtw_wide_block",c=jQuery(m).length,B=a+" .rtw_meta";if(0<c){if(0<jQuery(h).length){b&&(console.log("Adjusting widths for 'Official Twitter Version 2'"),console.log("- Width of Rotating Tweets container: "+jQuery(this).width()),console.log("- Width of the icon container: "+jQuery(h).show().width()));var n=0;jQuery(h).c(function(){newiconsize=
5
- jQuery(this).width();newiconsize>n&&(n=newiconsize)});b&&console.log("- Width of the icon: "+n);0<n&&jQuery(f).a("padding-left",n+10+"px")}b&&(console.log("Now check for 'padding-left'"),console.log("- leftpadding - text : "+jQuery(f).a("padding-left")+" and value: "+parseFloat(jQuery(f).a("padding-left"))));var g=jQuery(a).width();"undefined"!=typeof jQuery(f).a("padding-left")?(g=g-parseFloat(jQuery(f).a("padding-left"))-1,b&&console.log("- Padding is not undefined")):b&&console.log("- Padding IS undefined - leave width unchanged");
6
- b&&console.log("- rt_max_width: "+g);jQuery(m).width(g);jQuery(B).width(g)}var u=e.innerWidth(),v=k.innerWidth(),C=u,D=v,w=0,x=0,l=jQuery(a).width(),y=jQuery(a+" .rtw_main").width(),r=jQuery(a+" .rotatingtweet").width(),z=jQuery(a+" .rtw_meta").width();jQuery(window).resize(function(){e=jQuery(a).parent();k=e.parent();C=e.innerWidth();D=k.innerWidth();w=C-u;x=D-v;rt_resize_change=w;0==rt_resize_change&&(rt_resize_change=x);b&&(console.log("Parent change: "+w),console.log("Grandparent change: "+x),
7
- console.log("Old box width: "+l),console.log("New target width: "+(l+rt_resize_change)),console.log("rt_max_width: "+(l+rt_resize_change)));null==g&&(g=r);if(0!=rt_resize_change){var c=0,f=jQuery(a).height();jQuery(a+" .rotatingtweet").height("auto");jQuery(a+" .rotatingtweet").c(function(){var a=jQuery(this).height();b&&console.log("Old tweet height: "+a);a>c&&(c=a)});b&&(console.log("Old container height: "+f),console.log("Old height: "+c));var h=jQuery(a).height();b&&console.log("Old container height"+
8
- h);jQuery(m).width(g+rt_resize_change);jQuery(B).width(g+rt_resize_change);jQuery(a+" .rtw_main").width(y+rt_resize_change);jQuery(a+" .rotatingtweet").width(r+rt_resize_change);jQuery(a+" .rtw_meta").width(z+rt_resize_change);jQuery(a).width(l+rt_resize_change);l+=rt_resize_change;y+=rt_resize_change;r+=rt_resize_change;g+=rt_resize_change;z+=rt_resize_change;u=e.innerWidth();v=k.innerWidth();var d=0;jQuery(a+" .rotatingtweet").height("auto");jQuery(a+" .rotatingtweet").c(function(){var a=jQuery(this).height();
9
- b&&console.log("New tweet height: "+a);a>d&&(d=a)});b&&console.log("New height: "+d);0<d&&jQuery(a).height(f+d-c)}})});jQuery(".rtw_intents a").i(function(){var a=jQuery(this).find("img").b("src");jQuery(this).find("img").b("src",a.replace(/_hover.png$/,".png"));a=jQuery(this).find("img").b("src");jQuery(this).find("img").b("src",a.replace(/.png$/,"_hover.png"))},function(){var a=jQuery(this).find("img").b("src");jQuery(this).find("img").b("src",a.replace(/_hover.png/,".png"))});jQuery(".rtw_wide .rtw_intents").h();
10
- jQuery(".rtw_expand").show();jQuery(".rotatingtweets").has(".rtw_wide").i(function(){jQuery(this).find(".rtw_intents").show()},function(){jQuery(this).find(".rtw_intents").h()})});var s,E=document.getElementsByTagName("script")[0];document.getElementById("twitter-wjs")||(s=document.createElement("script"),s.id="twitter-wjs",s.src="https://platform.twitter.com/widgets.js",E.parentNode.insertBefore(s,E));!0;
1
+ jQuery(document).ready(function(){jQuery(".rotatingtweets").each(function(){var e="#"+this.id,t="."+this.id,r=jQuery(this).data("cycle-timeout"),i=jQuery(this).data("cycle-fx"),n=jQuery(this).data("cycle-speed"),o=jQuery(this).data("cycle-pager"),a=jQuery(this).data("cycle-pager-template"),s=jQuery(this).hasClass("wp_debug");("undefined"==typeof console||"undefined"==typeof console.log)&&(s=!1),null==i&&(i="scrollUp");var h="auto",g=jQuery(e).parent(),c=jQuery(e).parent().parent(),l=Math.min(g.innerWidth()-parseFloat(g.css("padding-left"))-parseFloat(g.css("padding-right")),c.innerWidth()-parseFloat(c.css("padding-left"))-parseFloat(c.css("padding-right"))-parseFloat(g.css("padding-left"))-parseFloat(g.css("padding-right"))-parseFloat(g.css("margin-left"))-parseFloat(g.css("margin-right"))),d=l-parseFloat(jQuery(this).css("padding-left"))-parseFloat(jQuery(this).css("padding-right"))-parseFloat(jQuery(this).css("margin-left"))-parseFloat(jQuery(this).css("margin-right"))-parseFloat(jQuery(this).css("border-left"))-parseFloat(jQuery(this).css("border-right")),u=1;null==d&&(u=0),s&&(console.log("============================"),console.log("self_width = "+jQuery(e).innerWidth()),console.log("parent_width = "+g.innerWidth()),console.log("grandparent_width = "+c.innerWidth()),console.log("rt_target_container_width = "+l),console.log("rt_target_width = "+d),console.log("rotate_timeout = "+r),console.log("rotate_speed = "+n),console.log("rotate_fx = "+i),console.log("rotate_pager = "+o),console.log("rotate_pager_template = "+a));var y={pause:1,height:h,timeout:r,cleartypeNoBg:!0,width:d,prev:t+"_rtw_prev",next:t+"_rtw_next",fx:i,fit:u,speed:n};r>0?y.timeout=r:(y.continuous=!0,y.easing="linear"),"undefined"!=typeof o&&(y.pager=e+"_rtw_pager","undefined"!=typeof a&&(y.pagerAnchorBuilder=function(){return a})),s&&console.log(y),jQuery(e).cycle(y);var _=jQuery(e).height();if(s&&console.log("Initial height: "+_),1>_){var p=e+" .rotatingtweet",_=0;jQuery(p).each(function(){var e=jQuery(this).height();e>_&&(_=e)}),_+=20;var h=_+"px";y.rt_height_px=h,s&&console.log("Resetting height to rt_height_px "+h),jQuery(e).cycle("destroy"),jQuery(e).cycle(y)}var p=e+" .rtw_info",w=e+" .rtw_wide_icon a img",j=e+" .rtw_wide_block",Q=jQuery(p).length,f=e+" .rtw_meta";if(Q>0){if(jQuery(w).length>0){s&&(console.log("Adjusting widths for 'Official Twitter Version 2'"),console.log("- Width of Rotating Tweets container: "+jQuery(this).width()),console.log("- Width of the icon container: "+jQuery(w).show().width()));var m=0;jQuery(w).each(function(){newiconsize=jQuery(this).width(),newiconsize>m&&(m=newiconsize)}),s&&console.log("- Width of the icon: "+m),m>0&&jQuery(j).css("padding-left",m+10+"px")}s&&(console.log("Now check for 'padding-left'"),console.log("- leftpadding - text : "+jQuery(j).css("padding-left")+" and value: "+parseFloat(jQuery(j).css("padding-left"))));var v=jQuery(e).width();"undefined"!=typeof jQuery(j).css("padding-left")?(v=v-parseFloat(jQuery(j).css("padding-left"))-1,s&&console.log("- Padding is not undefined")):s&&console.log("- Padding IS undefined - leave width unchanged"),s&&console.log("- rt_max_width: "+v),jQuery(p).width(v),jQuery(f).width(v)}var z=g.innerWidth(),F=c.innerWidth(),x=z,W=F,N=0,O=0,b=jQuery(e).width(),B=jQuery(e+" .rtw_main").width(),E=jQuery(e+" .rotatingtweet").width(),I=jQuery(e+" .rtw_meta").width();jQuery(window).resize(function(){if(g=jQuery(e).parent(),c=g.parent(),x=g.innerWidth(),W=c.innerWidth(),N=x-z,O=W-F,rt_resize_change=N,0==rt_resize_change&&(rt_resize_change=O),s&&(console.log("Parent change: "+N),console.log("Grandparent change: "+O),console.log("Old box width: "+b),console.log("New target width: "+(b+rt_resize_change)),console.log("rt_max_width: "+(b+rt_resize_change))),null==v&&(v=E),0!=rt_resize_change){var t=0,r=jQuery(e).height();jQuery(e+" .rotatingtweet").height("auto"),jQuery(e+" .rotatingtweet").each(function(){var e=jQuery(this).height();s&&console.log("Old tweet height: "+e),e>t&&(t=e)}),s&&(console.log("Old container height: "+r),console.log("Old height: "+t));var i=jQuery(e).height();s&&console.log("Old container height"+i),jQuery(p).width(v+rt_resize_change),jQuery(f).width(v+rt_resize_change),jQuery(e+" .rtw_main").width(B+rt_resize_change),jQuery(e+" .rotatingtweet").width(E+rt_resize_change),jQuery(e+" .rtw_meta").width(I+rt_resize_change),jQuery(e).width(b+rt_resize_change),b+=rt_resize_change,B+=rt_resize_change,E+=rt_resize_change,v+=rt_resize_change,I+=rt_resize_change,z=g.innerWidth(),F=c.innerWidth();var n=0;jQuery(e+" .rotatingtweet").height("auto"),jQuery(e+" .rotatingtweet").each(function(){var e=jQuery(this).height();s&&console.log("New tweet height: "+e),e>n&&(n=e)}),s&&console.log("New height: "+n),n>0&&jQuery(e).height(r+n-t)}})}),jQuery(".rtw_intents a").hover(function(){var e=jQuery(this).find("img").attr("src"),t=/_hover.png$/;jQuery(this).find("img").attr("src",e.replace(t,".png"));var e=jQuery(this).find("img").attr("src"),r=/.png$/;jQuery(this).find("img").attr("src",e.replace(r,"_hover.png"))},function(){var e=jQuery(this).find("img").attr("src"),t=/_hover.png/;jQuery(this).find("img").attr("src",e.replace(t,".png"))}),jQuery(".rtw_wide .rtw_intents").hide(),jQuery(".rtw_expand").show(),jQuery(".rotatingtweets").has(".rtw_wide").hover(function(){jQuery(this).find(".rtw_intents").show()},function(){jQuery(this).find(".rtw_intents").hide()})}),!function(e,t,r){var i,n=e.getElementsByTagName(t)[0];e.getElementById(r)||(i=e.createElement(t),i.id=r,i.src="https://platform.twitter.com/widgets.js",n.parentNode.insertBefore(i,n))}(document,"script","twitter-wjs");
 
 
 
 
 
 
 
 
 
js/rotatingtweets_v2.js CHANGED
@@ -72,18 +72,16 @@ $.fn.cycle2.transitions.scrollLeftGap = {
72
  jQuery(document).ready(function() {
73
  // Not at all sure we need this
74
  jQuery('.rotatingtweets').cycle2();
75
- // alert(opts.container.width);
76
  // Script to show mouseover effects when going over the Twitter intents
 
 
 
77
  jQuery('.rtw_intents a').hover(function() {
78
- var rtw_src = jQuery(this).find('img').attr('src');
79
- var clearOutHovers = /_hover.png$/;
80
  jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
81
- var rtw_src = jQuery(this).find('img').attr('src');
82
- var srcReplacePattern = /.png$/;
83
  jQuery(this).find('img').attr('src',rtw_src.replace(srcReplacePattern,"_hover.png"));
84
  },function() {
85
- var rtw_src = jQuery(this).find('img').attr('src');
86
- var clearOutHovers = /_hover.png/;
87
  jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
88
  });
89
  jQuery('.rotatingtweets').children().not('.cycle-carousel-wrap').has('.rtw_wide').find('.rtw_wide .rtw_intents').hide();
72
  jQuery(document).ready(function() {
73
  // Not at all sure we need this
74
  jQuery('.rotatingtweets').cycle2();
 
75
  // Script to show mouseover effects when going over the Twitter intents
76
+ var rtw_src,
77
+ clearOutHovers = /_hover.png$/,
78
+ srcReplacePattern = /.png$/;
79
  jQuery('.rtw_intents a').hover(function() {
80
+ rtw_src = jQuery(this).find('img').attr('src');
 
81
  jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
 
 
82
  jQuery(this).find('img').attr('src',rtw_src.replace(srcReplacePattern,"_hover.png"));
83
  },function() {
84
+ rtw_src = jQuery(this).find('img').attr('src');
 
85
  jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
86
  });
87
  jQuery('.rotatingtweets').children().not('.cycle-carousel-wrap').has('.rtw_wide').find('.rtw_wide .rtw_intents').hide();
js/rotatingtweets_v2_cyclone.js CHANGED
@@ -55,6 +55,16 @@ $.fn.cycle.transitions.toss = {
55
  }
56
  };
57
 
 
 
 
 
 
 
 
 
 
 
58
  })(jQuery);
59
  /*
60
  Script to cycle the rotating tweets
@@ -63,16 +73,16 @@ 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('.rotatingtweets').children().not('.cycle-carousel-wrap').has('.rtw_wide').find('.rtw_wide .rtw_intents').hide();
55
  }
56
  };
57
 
58
+ $.fn.cycle.transitions.scrollLeftGap = {
59
+ before: function( opts, curr, next, fwd ) {
60
+ opts.API.stackSlides( opts, curr, next, fwd );
61
+ var width = opts.container.css('overflow','hidden').width();
62
+ opts.cssBefore = { width: width, left : width+100, top: 0, opacity: 1, display: 'block' };
63
+ opts.animIn = { left: 0 };
64
+ opts.animOut = { left : -width-100,width:width };
65
+ }
66
+ };
67
+
68
  })(jQuery);
69
  /*
70
  Script to cycle the rotating tweets
73
  // Not at all sure we need this
74
  jQuery('.rotatingtweets').cycle();
75
  // Script to show mouseover effects when going over the Twitter intents
76
+ var rtw_src,
77
+ clearOutHovers = /_hover.png$/,
78
+ srcReplacePattern = /.png$/;
79
  jQuery('.rtw_intents a').hover(function() {
80
+ rtw_src = jQuery(this).find('img').attr('src');
 
81
  jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
82
+ rtw_src = jQuery(this).find('img').attr('src');
 
83
  jQuery(this).find('img').attr('src',rtw_src.replace(srcReplacePattern,"_hover.png"));
84
  },function() {
85
+ rtw_src = jQuery(this).find('img').attr('src');
 
86
  jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
87
  });
88
  jQuery('.rotatingtweets').children().not('.cycle-carousel-wrap').has('.rtw_wide').find('.rtw_wide .rtw_intents').hide();
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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: 4.1
7
- Stable tag: 1.7.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -73,7 +73,7 @@ Possible variables for the shortcode include:
73
  * `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.
74
  * **Display options**
75
  * `official_format` = `'1'`, `'2'` or `'custom'` - show one of the two official formats or a custom format if you have written your own `rotatingtweets_display_override()` function - default is `'0'`
76
- * `timeout` = time that each tweet is shown in milliseconds - default is `'4000'` (i.e. 4 seconds)
77
  * `speed` = time it takes to change from one tweet to the next in milliseconds - default is `'1000'` (i.e. 1 second)
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'`
@@ -92,6 +92,8 @@ Possible variables for the shortcode include:
92
  * `next` = content for the next button (default `'next'`)
93
  * `middot` = content for the space between the buttons (default `' &middot; '`)
94
  * `np_pos` = position for 'next' and 'prev' buttons - `'top'`, `'bottom'`, `'insidebottom'`, `'beforeafter'` or `'tweets'` (default `'top'`)
 
 
95
  * `show_media` = `'0'` or `'1'` - experimental option that shows images with the tweet - default is `'0'`
96
  * `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'`
97
  * `tweet_length` = maximum number of characters to show in tweet - default is `'0'` which allows whole tweet to be shown
@@ -99,7 +101,7 @@ Possible variables for the shortcode include:
99
  * `official_format_override` = `'0'` or `'1'` - enables you to change the settings for `show_meta_reply_retweet_favorite` and `show_meta_timestamp` on the 'official formats'.
100
 
101
  * **Caching**
102
- * `w3tc_render_to` = 'your_choice_of_random_string' - used to support 'fragment caching' by [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/). For this to work, you also need to ensure that `W3TC_DYNAMIC_SECURITY` is defined in your `wp-config.php` file and that you not using 'HTTP Compression' on the 'Browser Cache' settings page or 'Enhanced Disk caching' on the 'Page Cache' settings page.
103
 
104
  * **Twitter follow button**
105
  * `show_follow` = `'0'` or `'1'` - show follow button - default is `'0'`
@@ -180,10 +182,17 @@ into your CSS - changing `123px;` to the width you're aiming at - either via put
180
  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.
181
 
182
  == Upgrade notice ==
183
- = 1.7.9 =
184
- * Fixing Tweet time/date display problems.
185
 
186
  == Changelog ==
 
 
 
 
 
 
 
187
  = 1.7.9 =
188
  * Fixing Tweet timezone display problem
189
  * Restoring Tweet time display by default for 'Official Twitter Guidelines (wide)'
2
  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: 3.2
6
+ Tested up to: 4.1.1
7
+ Stable tag: 1.7.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
73
  * `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.
74
  * **Display options**
75
  * `official_format` = `'1'`, `'2'` or `'custom'` - show one of the two official formats or a custom format if you have written your own `rotatingtweets_display_override()` function - default is `'0'`
76
+ * `timeout` = time that each tweet is shown in milliseconds - default is `'4000'` (i.e. 4 seconds). `timeout=0` allows for continuous scrolling.
77
  * `speed` = time it takes to change from one tweet to the next in milliseconds - default is `'1000'` (i.e. 1 second)
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'`
92
  * `next` = content for the next button (default `'next'`)
93
  * `middot` = content for the space between the buttons (default `' &middot; '`)
94
  * `np_pos` = position for 'next' and 'prev' buttons - `'top'`, `'bottom'`, `'insidebottom'`, `'beforeafter'` or `'tweets'` (default `'top'`)
95
+ * `show_meta_pager` = `'0'` or `'1'` - show pager blobs below the tweets - default is `'0'`
96
+ * `show_meta_pager_blob` = content for your pager blob - default is `'<a href="#">&bull;</a>'`
97
  * `show_media` = `'0'` or `'1'` - experimental option that shows images with the tweet - default is `'0'`
98
  * `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'`
99
  * `tweet_length` = maximum number of characters to show in tweet - default is `'0'` which allows whole tweet to be shown
101
  * `official_format_override` = `'0'` or `'1'` - enables you to change the settings for `show_meta_reply_retweet_favorite` and `show_meta_timestamp` on the 'official formats'.
102
 
103
  * **Caching**
104
+ * `w3tc_render_to` = 'your_choice_of_random_string' - used to support 'fragment caching' by [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/). For this to work, you also need to ensure that `W3TC_DYNAMIC_SECURITY` is defined in your `wp-config.php` file and that you not using 'HTTP Compression' on the W3 Total Cache 'Browser Cache' settings page or 'Enhanced Disk caching' on the W3 Total Cache 'Page Cache' settings page.
105
 
106
  * **Twitter follow button**
107
  * `show_follow` = `'0'` or `'1'` - show follow button - default is `'0'`
182
  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.
183
 
184
  == Upgrade notice ==
185
+ = 1.7.10 =
186
+ * Addition of 'pager' option. Fix 'speed' bug.
187
 
188
  == Changelog ==
189
+ = 1.7.10 =
190
+ * Move to using HTML5 custom data attributes and `data()` functions to transfer variable values to version 1 of JavaScript - including 'speed' variable
191
+ * Addition of 'pager' via `show_meta_pager` and `show_meta_pager_blob` variables
192
+ * Addition of `rtw_hashtag_link` class to hashtag links
193
+ * `timeout=0` now allows continuous scrolling
194
+ * Updating object code for the widget
195
+
196
  = 1.7.9 =
197
  * Fixing Tweet timezone display problem
198
  * Restoring Tweet time display by default for 'Official Twitter Guidelines (wide)'
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.7.9
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
@@ -37,14 +37,19 @@ require_once('lib/wp_twitteroauth.php');
37
  */
38
  class rotatingtweets_Widget extends WP_Widget {
39
  /** constructor */
40
- function rotatingtweets_Widget() {
41
- parent::WP_Widget(false, $name = 'Rotating Tweets',array('description'=>__('A widget to show tweets for a particular user in rotation.','rotatingtweets')));
42
- if ( is_active_widget( false, false, $this->id_base ) )
 
 
 
 
43
  rotatingtweets_enqueue_scripts();
44
  }
 
45
 
46
  /** @see WP_Widget::widget */
47
- function widget($args, $instance) {
48
  extract( $args );
49
  $title = apply_filters('widget_title', $instance['title']);
50
  $positive_variables = array('screen_name','shorten_links','include_rts','exclude_replies','links_in_new_window','tweet_count','show_follow','timeout','rotation_type','show_meta_reply_retweet_favorite','official_format','show_type','list_tag','search');
@@ -109,7 +114,7 @@ class rotatingtweets_Widget extends WP_Widget {
109
  }
110
 
111
  /** @see WP_Widget::update */
112
- function update($new_instance, $old_instance) {
113
  $instance = $old_instance;
114
  $instance['title'] = strip_tags($new_instance['title']);
115
  $instance['tw_screen_name'] = strip_tags(trim($new_instance['tw_screen_name']));
@@ -134,7 +139,7 @@ class rotatingtweets_Widget extends WP_Widget {
134
  }
135
 
136
  /** @see WP_Widget::form */
137
- function form($instance) {
138
  $variables = array(
139
  'title' => array('title','','string'),
140
  'tw_screen_name' => array ('tw_screen_name','', 'string'),
@@ -341,7 +346,9 @@ class rotatingtweets_Widget extends WP_Widget {
341
  } // class rotatingtweets_Widget
342
 
343
  // register rotatingtweets_Widget widget
344
- add_action('widgets_init', create_function('', 'return register_widget("rotatingtweets_Widget");'));
 
 
345
 
346
  # Converts Tweet timestamp into a time description
347
  function rotatingtweets_contextualtime($small_ts, $large_ts=false) {
@@ -509,6 +516,8 @@ function rotatingtweets_display_shortcode( $atts, $content=null, $code="", $prin
509
  'show_meta_reply_retweet_favorite' => FALSE,
510
  'show_meta_prev_next' => FALSE,
511
  'show_meta_tweet_counter' => FALSE,
 
 
512
  'rotation_type' => 'scrollUp',
513
  'official_format' => FALSE,
514
  'links_in_new_window' => FALSE,
@@ -1367,7 +1376,8 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1367
  if(strtolower($args['rotation_type']) == strtolower($possibleRotation)) $rotation_type = $possibleRotation;
1368
  endforeach;
1369
  # Create an ID that has all the relevant info in - rotation type and speed of rotation
1370
- $id = uniqid('rotatingtweets_'.$timeout.'_'.$rotation_type.'_');
 
1371
  $result = '';
1372
  $nextprev = '';
1373
  # Put in the 'next / prev' buttons - although not very styled!
@@ -1388,21 +1398,21 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1388
  endif;
1389
  # Now set all the version 2 options
1390
  $v2string = '';
1391
- if( strtolower(get_stylesheet()) == 'magazino' || isset($api['jquery_cycle_version']) && $api['jquery_cycle_version'] == 2):
1392
- $v2options = array(
1393
- 'auto-height' => 'calc',
1394
- 'fx' => $rotation_type,
1395
- 'pause-on-hover' => 'true',
1396
- 'timeout' => $timeout,
1397
- 'speed' => $speed,
1398
- 'easing' => 'swing',
1399
- 'slides'=> 'div.rotatingtweet'
1400
- );
1401
- if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next']):
1402
- $v2options['prev'] = '.'.$id.'_rtw_prev';
1403
- $v2options['next'] = '.'.$id.'_rtw_next';
 
1404
  endif;
1405
- if(! WP_DEBUG) $v2options['log'] = 'false';
1406
  if($rotation_type == 'carousel'):
1407
  if(empty($args['carousel_horizontal'])):
1408
  $v2options['carousel-vertical'] = true;
@@ -1420,17 +1430,27 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1420
  endif;
1421
  endif;
1422
  endif;
1423
- $v2stringelements = array();
1424
- foreach ($v2options as $name => $value) {
1425
- $v2stringelements[] = ' data-cycle-'.$name.'="'.$value.'"';
1426
- }
1427
- $v2string = implode(' ',$v2stringelements);
1428
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1429
  # Now finalise things
1430
  if(WP_DEBUG):
1431
- $result .= "\n<div class='$rotclass wp_debug rotatingtweets_format_".+intval($args['official_format'])."' id='$id'$v2string>";
1432
  else:
1433
- $result .= "\n<div class='$rotclass rotatingtweets_format_".+intval($args['official_format'])."' id='$id'$v2string>";
1434
  endif;
1435
  $error = get_option('rotatingtweets_api_error');
1436
  if(!empty($error)):
@@ -1629,7 +1649,7 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1629
  // $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
1630
  # This is designed to find hashtags and turn them into links...
1631
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
1632
- $after[]='<a href="http://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
1633
  # Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
1634
  if(isset($args['no_emoji']) && $args['no_emoji']):
1635
  // $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.php
@@ -1897,6 +1917,10 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1897
  $result .= $nextprev;
1898
  endif;
1899
  $result .= "\n</div>";
 
 
 
 
1900
  if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && isset($args['np_pos'])):
1901
  if(strtolower($args['np_pos'])=='bottom'):
1902
  $result .= '<div class="rotatingtweets_nextprev">'.$nextprev.'</div>';
@@ -1904,15 +1928,6 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1904
  $result .= '<div class="rotatingtweets_nextprev">'.$nextprev_next.'</div>';
1905
  endif;
1906
  endif;
1907
- /*
1908
- if($args['show_meta_progress_blobs']):
1909
- $result .= "<div id='".$id."_nav' class='rtw_nav'>";
1910
- for ($i = 1; $i <= $tweet_count; $i++) {
1911
- $result .= '<a href="#">&bull;</a> ';
1912
- }
1913
- $result .= "</div>";
1914
- endif;
1915
- */
1916
  if($args['show_follow'] && !empty($args['screen_name']) && !strpos($args['screen_name'],' ') && !strpos($args['screen_name'],',') && !strpos($args['screen_name'],';')):
1917
  $shortenvariables = '';
1918
  if($args['no_show_count']) $shortenvariables = ' data-show-count="false"';
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.10
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
37
  */
38
  class rotatingtweets_Widget extends WP_Widget {
39
  /** constructor */
40
+ public function __construct() {
41
+ parent::__construct(
42
+ 'rotatingtweets_widget', // Base ID
43
+ __( 'Rotating Tweets', 'rotatingtweets' ), // Name
44
+ array( 'description' => __('A widget to show tweets for a particular user in rotation.', 'rotatingtweets'), ) // Args
45
+ );
46
+ if ( is_active_widget( false, false, $this->id_base, true ) ) {
47
  rotatingtweets_enqueue_scripts();
48
  }
49
+ }
50
 
51
  /** @see WP_Widget::widget */
52
+ public function widget($args, $instance) {
53
  extract( $args );
54
  $title = apply_filters('widget_title', $instance['title']);
55
  $positive_variables = array('screen_name','shorten_links','include_rts','exclude_replies','links_in_new_window','tweet_count','show_follow','timeout','rotation_type','show_meta_reply_retweet_favorite','official_format','show_type','list_tag','search');
114
  }
115
 
116
  /** @see WP_Widget::update */
117
+ public function update($new_instance, $old_instance) {
118
  $instance = $old_instance;
119
  $instance['title'] = strip_tags($new_instance['title']);
120
  $instance['tw_screen_name'] = strip_tags(trim($new_instance['tw_screen_name']));
139
  }
140
 
141
  /** @see WP_Widget::form */
142
+ public function form($instance) {
143
  $variables = array(
144
  'title' => array('title','','string'),
145
  'tw_screen_name' => array ('tw_screen_name','', 'string'),
346
  } // class rotatingtweets_Widget
347
 
348
  // register rotatingtweets_Widget widget
349
+ add_action('widgets_init',
350
+ create_function('', 'return register_widget("rotatingtweets_Widget");')
351
+ );
352
 
353
  # Converts Tweet timestamp into a time description
354
  function rotatingtweets_contextualtime($small_ts, $large_ts=false) {
516
  'show_meta_reply_retweet_favorite' => FALSE,
517
  'show_meta_prev_next' => FALSE,
518
  'show_meta_tweet_counter' => FALSE,
519
+ 'show_meta_pager' => FALSE,
520
+ 'show_meta_pager_blob' => '<a href="#">&bull;</a>',
521
  'rotation_type' => 'scrollUp',
522
  'official_format' => FALSE,
523
  'links_in_new_window' => FALSE,
1376
  if(strtolower($args['rotation_type']) == strtolower($possibleRotation)) $rotation_type = $possibleRotation;
1377
  endforeach;
1378
  # Create an ID that has all the relevant info in - rotation type and speed of rotation
1379
+ // $id = uniqid('rotatingtweets_'.$timeout.'_'.$rotation_type.'_'.$speed."_");
1380
+ $id = uniqid('rotatingtweets_');
1381
  $result = '';
1382
  $nextprev = '';
1383
  # Put in the 'next / prev' buttons - although not very styled!
1398
  endif;
1399
  # Now set all the version 2 options
1400
  $v2string = '';
1401
+ $v2options = array(
1402
+ 'auto-height' => 'calc',
1403
+ 'fx' => $rotation_type,
1404
+ 'pause-on-hover' => 'true',
1405
+ 'timeout' => $timeout,
1406
+ 'speed' => $speed,
1407
+ 'easing' => 'swing',
1408
+ 'slides'=> 'div.rotatingtweet'
1409
+ );
1410
+ // Uses the continuous settings recommended at http://jquery.malsup.com/cycle2/demo/continuous.php for cycle2
1411
+ if ( strtolower(get_stylesheet()) == 'magazino' || (isset($api['jquery_cycle_version']) && $api['jquery_cycle_version'] == 2) ):
1412
+ if($timeout == 0):
1413
+ $v2options['timeout'] = 1;
1414
+ $v2options['easing'] = 'linear';
1415
  endif;
 
1416
  if($rotation_type == 'carousel'):
1417
  if(empty($args['carousel_horizontal'])):
1418
  $v2options['carousel-vertical'] = true;
1430
  endif;
1431
  endif;
1432
  endif;
 
 
 
 
 
1433
  endif;
1434
+ if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next']):
1435
+ $v2options['prev'] = '.'.$id.'_rtw_prev';
1436
+ $v2options['next'] = '.'.$id.'_rtw_next';
1437
+ endif;
1438
+ if(isset($args['show_meta_pager']) && $args['show_meta_pager']):
1439
+ $v2options['pager'] = '#'.$id.'_rtw_pager';
1440
+ $v2options['pager-template'] = $args['show_meta_pager_blob'];
1441
+ endif;
1442
+ if(! WP_DEBUG) $v2options['log'] = 'false';
1443
+
1444
+ $v2stringelements = array();
1445
+ foreach ($v2options as $name => $value) {
1446
+ $v2stringelements[] = 'data-cycle-'.$name.'="'.esc_attr($value).'"';
1447
+ }
1448
+ $v2string = implode(' ',$v2stringelements);
1449
  # Now finalise things
1450
  if(WP_DEBUG):
1451
+ $result .= "\n<div class='$rotclass wp_debug rotatingtweets_format_".+intval($args['official_format'])."' id='$id' $v2string>";
1452
  else:
1453
+ $result .= "\n<div class='$rotclass rotatingtweets_format_".+intval($args['official_format'])."' id='$id' $v2string>";
1454
  endif;
1455
  $error = get_option('rotatingtweets_api_error');
1456
  if(!empty($error)):
1649
  // $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
1650
  # This is designed to find hashtags and turn them into links...
1651
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
1652
+ $after[]='<a href="http://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.' class="rtw_hashtag_link">#$1</a>';
1653
  # Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
1654
  if(isset($args['no_emoji']) && $args['no_emoji']):
1655
  // $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.php
1917
  $result .= $nextprev;
1918
  endif;
1919
  $result .= "\n</div>";
1920
+ // Show meta progress blobs
1921
+ if(isset($args['show_meta_pager']) && $args['show_meta_pager']):
1922
+ $result .= "<div id='".$id."_rtw_pager' class='rtw_pager'></div>";
1923
+ endif;
1924
  if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && isset($args['np_pos'])):
1925
  if(strtolower($args['np_pos'])=='bottom'):
1926
  $result .= '<div class="rotatingtweets_nextprev">'.$nextprev.'</div>';
1928
  $result .= '<div class="rotatingtweets_nextprev">'.$nextprev_next.'</div>';
1929
  endif;
1930
  endif;
 
 
 
 
 
 
 
 
 
1931
  if($args['show_follow'] && !empty($args['screen_name']) && !strpos($args['screen_name'],' ') && !strpos($args['screen_name'],',') && !strpos($args['screen_name'],';')):
1932
  $shortenvariables = '';
1933
  if($args['no_show_count']) $shortenvariables = ' data-show-count="false"';