Twitter Widget Pro - Version 1.4.1

Version Description

Download this release

Release Info

Developer aaroncampbell
Plugin Icon wp plugin Twitter Widget Pro
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.3.7 to 1.4.1

Files changed (3) hide show
  1. languages/twitter-widget-pro.pot +157 -0
  2. readme.txt +92 -2
  3. wp-twitter-widget.php +67 -153
languages/twitter-widget-pro.pot ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # This file is put in the public domain.
3
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+ #
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE VERSION\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/twitter-widget-pro\n"
10
+ "POT-Creation-Date: 2009-06-24 21:46+0000\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=CHARSET\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+
18
+ #: wp-twitter-widget.php:48
19
+ msgid "Twitter Widget Pro"
20
+ msgstr ""
21
+
22
+ #: wp-twitter-widget.php:64
23
+ msgid "Twitter Widget Pro Options"
24
+ msgstr ""
25
+
26
+ #: wp-twitter-widget.php:70
27
+ msgid "Click for Help!"
28
+ msgstr ""
29
+
30
+ #: wp-twitter-widget.php:71
31
+ msgid "System Information:"
32
+ msgstr ""
33
+
34
+ #: wp-twitter-widget.php:75
35
+ msgid "I agree to send anonymous system information"
36
+ msgstr ""
37
+
38
+ #: wp-twitter-widget.php:77
39
+ msgid ""
40
+ "You can help by sending anonymous system information that will help Xavisys "
41
+ "make better decisions about new features."
42
+ msgstr ""
43
+
44
+ #: wp-twitter-widget.php:78
45
+ msgid ""
46
+ "The information will be sent anonymously, but a unique identifier will be "
47
+ "sent to prevent duplicate entries from the same installation."
48
+ msgstr ""
49
+
50
+ #: wp-twitter-widget.php:84
51
+ msgid "Update Options &raquo;"
52
+ msgstr ""
53
+
54
+ #: wp-twitter-widget.php:113
55
+ msgid "Could not connect to Twitter"
56
+ msgstr ""
57
+
58
+ #: wp-twitter-widget.php:272
59
+ msgid "Syndicate this content"
60
+ msgstr ""
61
+
62
+ #: wp-twitter-widget.php:285
63
+ msgid "No Tweets Available"
64
+ msgstr ""
65
+
66
+ #: wp-twitter-widget.php:306
67
+ #, php-format
68
+ msgid "from %s"
69
+ msgstr ""
70
+
71
+ #: wp-twitter-widget.php:310
72
+ #, php-format
73
+ msgid "in reply to %s"
74
+ msgstr ""
75
+
76
+ #: wp-twitter-widget.php:330
77
+ #, php-format
78
+ msgid ""
79
+ "Powered by <a href=\"%s\" title=\"Get Twitter Widget for your WordPress site"
80
+ "\">WordPress Twitter Widget Pro</a>"
81
+ msgstr ""
82
+
83
+ #: wp-twitter-widget.php:440
84
+ msgid "Follow a Twitter Feed"
85
+ msgstr ""
86
+
87
+ #: wp-twitter-widget.php:442
88
+ msgid "Twitter Feed"
89
+ msgstr ""
90
+
91
+ #: wp-twitter-widget.php:484
92
+ msgid "Twitter username:"
93
+ msgstr ""
94
+
95
+ #: wp-twitter-widget.php:488
96
+ msgid "Give the feed a title (optional):"
97
+ msgstr ""
98
+
99
+ #: wp-twitter-widget.php:492
100
+ msgid "How many items would you like to display?"
101
+ msgstr ""
102
+
103
+ #: wp-twitter-widget.php:502
104
+ msgid "What to display when Twitter is down (optional):"
105
+ msgstr ""
106
+
107
+ #: wp-twitter-widget.php:506
108
+ msgid "Number of seconds to wait for a response from Twitter (default 2):"
109
+ msgstr ""
110
+
111
+ #: wp-twitter-widget.php:510
112
+ msgid "Show date/time of Tweet (rather than 2 ____ ago):"
113
+ msgstr ""
114
+
115
+ #: wp-twitter-widget.php:512
116
+ msgid "Always"
117
+ msgstr ""
118
+
119
+ #: wp-twitter-widget.php:513
120
+ msgid "If over an hour old"
121
+ msgstr ""
122
+
123
+ #: wp-twitter-widget.php:514
124
+ msgid "If over a day old"
125
+ msgstr ""
126
+
127
+ #: wp-twitter-widget.php:515
128
+ msgid "If over a week old"
129
+ msgstr ""
130
+
131
+ #: wp-twitter-widget.php:516
132
+ msgid "If over a month old"
133
+ msgstr ""
134
+
135
+ #: wp-twitter-widget.php:517
136
+ msgid "If over a year old"
137
+ msgstr ""
138
+
139
+ #: wp-twitter-widget.php:518
140
+ msgid "Never"
141
+ msgstr ""
142
+
143
+ #: wp-twitter-widget.php:522
144
+ msgid "Hide RSS Icon and Link"
145
+ msgstr ""
146
+
147
+ #: wp-twitter-widget.php:525
148
+ msgid "Show Profile Image"
149
+ msgstr ""
150
+
151
+ #: wp-twitter-widget.php:529
152
+ msgid "Show Link to Twitter Widget Pro"
153
+ msgstr ""
154
+
155
+ #: wp-twitter-widget.php:642
156
+ msgid "Settings"
157
+ msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%4
4
  Tags: twitter, widget, feed
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
- Stable tag: 1.3.7
8
 
9
  A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links. Requires PHP5.
10
 
@@ -25,7 +25,7 @@ You may also be interested in WordPress tips and tricks at <a href="http://wpinf
25
 
26
  == Frequently Asked Questions ==
27
 
28
- = Can I have use than one instance of this widget? =
29
 
30
  Yes, Twitter Widget Pro employs the multi-widget pattern, which allows you to not only have more than one instance of this widget on your site, but even allows more than one instance of this widget in a single sidebar.
31
 
@@ -43,3 +43,93 @@ Aparently the database queries required to display the friends feed was causing
43
  2. Each widget has settings that need to be set, so the next step is to click "edit" on the newly added widget and adjust all the settings. When you're done click "Save Changes"
44
  3. This is what the widget looks like in the default theme with no added styles.
45
  4. By using some (X)HTML in the title element and adding a few styles and a background image, you could make it look like this.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  Tags: twitter, widget, feed
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
+ Stable tag: 1.4.1
8
 
9
  A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links. Requires PHP5.
10
 
25
 
26
  == Frequently Asked Questions ==
27
 
28
+ = Can I use more than one instance of this widget? =
29
 
30
  Yes, Twitter Widget Pro employs the multi-widget pattern, which allows you to not only have more than one instance of this widget on your site, but even allows more than one instance of this widget in a single sidebar.
31
 
43
  2. Each widget has settings that need to be set, so the next step is to click "edit" on the newly added widget and adjust all the settings. When you're done click "Save Changes"
44
  3. This is what the widget looks like in the default theme with no added styles.
45
  4. By using some (X)HTML in the title element and adding a few styles and a background image, you could make it look like this.
46
+
47
+ == Changelog ==
48
+
49
+ = 1.4.0 =
50
+ * Fixed some translatable strings
51
+ * Fixed readme text
52
+
53
+ = 1.4.0 =
54
+ * Make translatable
55
+ * Include POT file
56
+ * Remove JS submitted for for stats and use HTTP class instead
57
+
58
+ = 1.3.7 =
59
+ * Added some spans with classes to make styling to meta data easier
60
+
61
+ = 1.3.6 =
62
+ * Fixes issue with linking URLs containing a ~
63
+ * Removed some debugging stuff
64
+
65
+ = 1.3.5 =
66
+ * #Hashtags are now linked to twitter search
67
+
68
+ = 1.3.4 =
69
+ * Added convert_chars filter to the tweet text to properly handle special characters
70
+ * Fixed "in reply to" text which stopped working when Twitter changed their API
71
+
72
+ = 1.3.3 =
73
+ * Some configs still couldn't turn off the link to Twitter Widget Pro page
74
+
75
+ = 1.3.2 =
76
+ * Fixed problem with link to Twitter Widget Pro page not turning off
77
+
78
+ = 1.3.1 =
79
+ * Added error handling after wp_remote_request call
80
+ * Added link to Twitter Widget Pro page and option to turn it off per widget
81
+
82
+ = 1.3.0 =
83
+ * Updated to use HTTP class and phased out Snoopy
84
+ * No longer relies on user having a caching solution in place. Caches for 5 minutes using blog options
85
+ * Allow HTML in title and error message if user can
86
+
87
+ = 1.2.2 =
88
+ * Fixed minor issue with Zend JSON Decoder
89
+ * Added an option for Twitter timeout. 2 seconds wasn't enough for some people
90
+
91
+ = 1.2.1 =
92
+ * Fixed some minor errors in the collection code
93
+ * Added the admin options page (how did that get missed?!?)
94
+
95
+ = 1.2.0 =
96
+ * Removed friends feed option, twitter removed this functionality
97
+ * Added an option to set your own message to display when twitter is down
98
+ * Added optional anonymous statistics collection
99
+
100
+ = 1.1.4 =
101
+ * Added an error if there was a problem connecting to Twitter.
102
+ * Added some text if there are no tweets.
103
+
104
+ = 1.1.3 =
105
+ * Fixed validation problems if source is a link containg an &
106
+
107
+ = 1.1.2 =
108
+ * Title link always links to correct username, rather than the last person to tweet on that feed
109
+ * Added option to hide RSS icon/link
110
+
111
+ = 1.1.1 =
112
+ * Fixed issue with @username parsing of two names with one space between them (@test @ing)
113
+ * Fixed readme typo
114
+
115
+ = 1.1.0 =
116
+ * Most major fix is the inclusion of json_decode.php for users that don't have json_decode() which was added in PHP 5.2.0
117
+ * Fixed problem with displaying a useless li when profile images aren't displayed on a single user widget
118
+ * Default title is now set to "Twitter: UserName"
119
+
120
+ = 1.0.0 =
121
+ * Released to wordpress.org repository
122
+
123
+ = 0.0.3 =
124
+ * Fixed some of the settings used with Snoopy
125
+ * Set a read timeout for fetching the files
126
+
127
+ = 0.0.2 =
128
+ * Changed some function names
129
+ * Moved form display to a separate function (_showForm)
130
+ * Now uses wp_parse_args to handle defaults
131
+ * Added comments
132
+ * Added seconds to the _timeSince function so you can have something like "about 25 seconds ago"
133
+
134
+ = 0.0.1 =
135
+ * Original Version
wp-twitter-widget.php CHANGED
@@ -3,94 +3,13 @@
3
  * Plugin Name: Twitter Widget Pro
4
  * Plugin URI: http://xavisys.com/wordpress-twitter-widget/
5
  * Description: A widget that properly handles twitter feeds, including @username, #hashtag, and link parsing. It can even display profile images for the users. Requires PHP5.
6
- * Version: 1.3.7
7
  * Author: Aaron D. Campbell
8
  * Author URI: http://xavisys.com/
 
9
  */
10
 
11
- define('TWP_VERSION', '1.3.7');
12
-
13
- /**
14
- * Changelog:
15
- * 06/08/2009: 1.3.7
16
- * - Added some spans with classes to make styling to meta data easier
17
- *
18
- * 06/08/2009: 1.3.6
19
- * - Fixes issue with linking URLs containing a ~
20
- * - Removed some debugging stuff
21
- *
22
- * 06/04/2009: 1.3.5
23
- * - #Hashtags are now linked to twitter search
24
- *
25
- * 05/02/2009: 1.3.4
26
- * - Added convert_chars filter to the tweet text to properly handle special characters
27
- * - Fixed "in reply to" text which stopped working when Twitter changed their API
28
- *
29
- * 04/28/2009: 1.3.3
30
- * - Some configs still couldn't turn off the link to Twitter Widget Pro page
31
- *
32
- * 04/22/2009: 1.3.2
33
- * - Fixed problem with link to Twitter Widget Pro page not turning off
34
- *
35
- * 04/22/2009: 1.3.1
36
- * - Added error handling after wp_remote_request call
37
- * - Added link to Twitter Widget Pro page and option to turn it off per widget
38
- *
39
- * 04/10/2009: 1.3.0
40
- * - Updated to use HTTP class and phased out Snoopy
41
- * - No longer relies on user having a caching solution in place. Caches for 5 minutes using blog options
42
- * - Allow HTML in title and error message if user can
43
- *
44
- * 06/09/2008: 1.2.2
45
- * - Fixed minor issue with Zend JSON Decoder
46
- * - Added an option for Twitter timeout. 2 seconds wasn't enough for some people
47
- *
48
- * 06/09/2008: 1.2.1
49
- * - Fixed some minor errors in the collection code
50
- * - Added the admin options page (how did that get missed?!?)
51
- *
52
- * 06/09/2008: 1.2.0
53
- * - Removed friends feed option, twitter removed this functionality
54
- * - Added an option to set your own message to display when twitter is down
55
- * - Added optional anonymous statistics collection
56
- *
57
- * 05/14/2008: 1.1.4
58
- * - Added an error if there was a problem connecting to Twitter.
59
- * - Added some text if there are no tweets.
60
- *
61
- * 05/08/2008: 1.1.3
62
- * - Fixed validation problems if source is a link containg an &
63
- *
64
- * 04/29/2008: 1.1.2
65
- * - Title link always links to correct username, rather than the last person to tweet on that feed
66
- * - Added option to hide RSS icon/link
67
- *
68
- * 04/23/2008: 1.1.1
69
- * - Fixed issue with @username parsing of two names with one space between them (@test @ing)
70
- * - Fixed readme typo
71
- *
72
- * 04/23/2008: 1.1.0
73
- * - Most major fix is the inclusion of json_decode.php for users that don't have json_decode() which was added in PHP 5.2.0
74
- * - Fixed problem with displaying a useless li when profile images aren't displayed on a single user widget
75
- * - Default title is now set to "Twitter: UserName"
76
- *
77
- * 04/17/2008: 1.0.0
78
- * - Released to wordpress.org repository
79
- *
80
- * 04/14/2008: 0.0.3
81
- * - Fixed some of the settings used with Snoopy
82
- * - Set a read timeout for fetching the files
83
- *
84
- * 04/14/2008: 0.0.2
85
- * - Changed some function names
86
- * - Moved form display to a separate function (_showForm)
87
- * - Now uses wp_parse_args to handle defaults
88
- * - Added comments
89
- * - Added seconds to the _timeSince function so you can have something like "about 25 seconds ago"
90
- *
91
- * 04/11/2008: 0.0.1
92
- * - Original Version
93
- */
94
 
95
  /* Copyright 2006 Aaron D. Campbell (email : wp_plugins@xavisys.com)
96
 
@@ -125,38 +44,44 @@ class wpTwitterWidget
125
 
126
  public function __construct() {}
127
 
128
- function admin_menu() {
129
- add_options_page(__('Twitter Widget Pro'), __('Twitter Widget Pro'), 'manage_options', 'TwitterWidgetPro', array($this, 'options'));
130
  }
 
 
 
 
 
 
131
  /**
132
  * This is used to display the options page for this plugin
133
  */
134
- function options() {
135
  //Get our options
136
  $o = get_option('twitter_widget_pro');
137
  ?>
138
  <div class="wrap">
139
- <h2><?php _e('Twitter Widget Pro Options') ?></h2>
140
  <form action="options.php" method="post" id="wp_twitter_widget_pro">
141
  <?php wp_nonce_field('update-options'); ?>
142
  <table class="form-table">
143
  <tr valign="top">
144
  <th scope="row">
145
- <a title="<?php _e('Click for Help!'); ?>" href="#" onclick="jQuery('#twp_user_agreed_to_send_system_information_help').toggle(); return false;">
146
- <?php _e('System Information:') ?>
147
  </a>
148
  </th>
149
  <td>
150
- <label for="twp_user_agreed_to_send_system_information"><input type="checkbox" name="twitter_widget_pro[user_agreed_to_send_system_information]" value="true" id="twp_user_agreed_to_send_system_information"<?php checked('true', $o['user_agreed_to_send_system_information']); ?> /> <?php _e('I agree to send anonymous system information'); ?></label><br />
151
  <small id="twp_user_agreed_to_send_system_information_help" style="display:none;">
152
- <?php _e('You can help by sending anonymous system information that will help Xavisys make better decisions about new features.'); ?><br />
153
- <?php _e('The information will be sent anonymously, but a unique identifier will be sent to prevent duplicate entries from the same installation.'); ?>
154
  </small>
155
  </td>
156
  </tr>
157
  </table>
158
  <p class="submit">
159
- <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;'); ?>" />
160
  </p>
161
  <input type="hidden" name="action" value="update" />
162
  <input type="hidden" name="page_options" value="twitter_widget_pro" />
@@ -185,9 +110,9 @@ class wpTwitterWidget
185
  } else {
186
  // Failed to fetch url;
187
  if (empty($widgetOptions['errmsg'])) {
188
- $widgetOptions['errmsg'] = 'Could not connect to Twitter';
189
  }
190
- throw new wpTwitterWidgetException(__($widgetOptions['errmsg']));
191
  }
192
  }
193
 
@@ -344,7 +269,7 @@ class wpTwitterWidget
344
  $icon = get_option('siteurl').'/wp-includes/images/rss.png';
345
  }
346
  $feedUrl = $this->_getFeedUrl($options[$number], 'rss', false);
347
- $before_title .= "<a class='twitterwidget' href='{$feedUrl}' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='{$icon}' alt='RSS' /></a> ";
348
  }
349
  $twitterLink = 'http://twitter.com/' . $options[$number]['username'];
350
  $before_title .= "<a class='twitterwidget' href='{$twitterLink}' title='" . attribute_escape("Twitter: {$options[$number]['username']}") . "'>";
@@ -357,12 +282,12 @@ class wpTwitterWidget
357
  if (is_a($tweets, 'wpTwitterWidgetException')) {
358
  echo '<li class="wpTwitterWidgetError">' . $tweets->getMessage() . '</li>';
359
  } else if (count($tweets) == 0) {
360
- echo '<li class="wpTwitterWidgetEmpty">' . __('No Tweets Available') . '</li>';
361
  } else {
362
  if (!empty($tweets) && $options[$number]['avatar']) {
363
  echo '<li>';
364
  echo $this->_getProfileImage($tweets[0]->user);
365
- echo '<div class="clear" />';
366
  echo '</li>';
367
  }
368
  foreach ($tweets as $tweet) {
@@ -378,14 +303,15 @@ class wpTwitterWidget
378
  </a>
379
  </span>
380
  <span class="from-meta">
381
- from <?php echo str_replace('&', '&amp;', $tweet->source); ?>
382
  </span>
383
  <?php
384
  if (!empty($tweet->in_reply_to_screen_name)) {
 
385
  echo <<<replyTo
386
  <span class="in-reply-to-meta">
387
  <a href="http://twitter.com/{$tweet->in_reply_to_screen_name}/statuses/{$tweet->in_reply_to_status_id}" class="reply-to">
388
- in reply to {$tweet->in_reply_to_screen_name}
389
  </a>
390
  </span>
391
  replyTo;
@@ -401,10 +327,7 @@ replyTo;
401
  ?>
402
  <li class="xavisys-link">
403
  <span class="xavisys-link-text">
404
- Powered by
405
- <a href="http://xavisys.com/2008/04/wordpress-twitter-widget/">
406
- WordPress Twitter Widget Pro
407
- </a>
408
  </span>
409
  </li>
410
  <?php
@@ -514,9 +437,9 @@ profileImage;
514
  public function register() {
515
  if ( !$options = get_option('widget_twitter') )
516
  $options = array();
517
- $widget_ops = array('classname' => 'widget_twitter', 'description' => __('Follow a Twitter Feed'));
518
  $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'twitter');
519
- $name = __('Twitter Feed');
520
 
521
  $id = false;
522
  foreach ( array_keys($options) as $o ) {
@@ -558,15 +481,15 @@ profileImage;
558
  extract( $args );
559
  ?>
560
  <p>
561
- <label for="twitter-username-<?php echo $number; ?>"><?php _e('Twitter username:'); ?></label>
562
  <input class="widefat" id="twitter-username-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][username]" type="text" value="<?php echo $username; ?>" />
563
  </p>
564
  <p>
565
- <label for="twitter-title-<?php echo $number; ?>"><?php _e('Give the feed a title (optional):'); ?></label>
566
  <input class="widefat" id="twitter-title-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
567
  </p>
568
  <p>
569
- <label for="twitter-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?'); ?></label>
570
  <select id="twitter-items-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][items]">
571
  <?php
572
  for ( $i = 1; $i <= 20; ++$i ) {
@@ -576,34 +499,34 @@ profileImage;
576
  </select>
577
  </p>
578
  <p>
579
- <label for="twitter-errmsg-<?php echo $number; ?>"><?php _e('What to display when Twitter is down (optional):'); ?></label>
580
  <input class="widefat" id="twitter-errmsg-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][errmsg]" type="text" value="<?php echo $errmsg; ?>" />
581
  </p>
582
  <p>
583
- <label for="twitter-fetchTimeOut-<?php echo $number; ?>"><?php _e('Number of seconds to wait for a response from Twitter (default 2):'); ?></label>
584
  <input class="widefat" id="twitter-fetchTimeOut-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][fetchTimeOut]" type="text" value="<?php echo $fetchTimeOut; ?>" />
585
  </p>
586
  <p>
587
- <label for="twitter-showts-<?php echo $number; ?>"><?php _e('Show date/time of Tweet (rather than 2 ____ ago):'); ?></label>
588
  <select id="twitter-showts-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][showts]">
589
- <option value="0" <?php echo selected($showts, '0'); ?>>Always</a>
590
- <option value="3600" <?php echo selected($showts, '3600'); ?>>If over an hour old</a>
591
- <option value="86400" <?php echo selected($showts, '86400'); ?>>If over a day old</a>
592
- <option value="604800" <?php echo selected($showts, '604800'); ?>>If over a week old</a>
593
- <option value="2592000" <?php echo selected($showts, '2592000'); ?>>If over a month old</a>
594
- <option value="31536000" <?php echo selected($showts, '31536000'); ?>>If over a year old</a>
595
- <option value="-1" <?php echo selected($showts, '-1'); ?>>Never</a>
596
  </select>
597
  </p>
598
  <p>
599
- <label for="twitter-hiderss-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-hiderss-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][hiderss]"<?php checked($hiderss, true); ?> /> <?php _e('Hide RSS Icon and Link'); ?></label>
600
  </p>
601
  <p>
602
- <label for="twitter-avatar-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-avatar-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][avatar]"<?php checked($avatar, true); ?> /> <?php _e('Show Profile Image'); ?></label>
603
  </p>
604
  <p>
605
  <input type="hidden" name="widget-twitter[<?php echo $number; ?>][showXavisysLink]" value="false" />
606
- <label for="twitter-showXavisysLink-<?php echo $number; ?>"><input class="checkbox" type="checkbox" value="true" id="twitter-showXavisysLink-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][showXavisysLink]"<?php checked($showXavisysLink, true); ?> /> <?php _e('Show Link to Twitter Widget Pro'); ?></label>
607
  </p>
608
  <?php
609
  }
@@ -654,7 +577,7 @@ profileImage;
654
  return "about {$print} ago";
655
  }
656
 
657
- function activatePlugin() {
658
  // If the wga-id has not been generated, generate one and store it.
659
  $id = $this->get_id();
660
  $o = get_option('twitter_widget_pro');
@@ -664,7 +587,7 @@ profileImage;
664
  }
665
  }
666
 
667
- function get_id() {
668
  $id = get_option('twitter_widget_pro-id');
669
  if ($id === false) {
670
  $id = sha1( get_bloginfo('url') . mt_rand() );
@@ -673,36 +596,27 @@ profileImage;
673
  return $id;
674
  }
675
  /**
676
- * if user agrees to send system information and the last sent info is outdated outputs a bunch of stuff that sends sysinfo without interrupting
 
677
  */
678
- function outputSendInfoForm()
679
- {
680
  $o = get_option('twitter_widget_pro');
681
  if ($o['user_agreed_to_send_system_information'] == 'true') {
682
  $lastSent = get_option('twp-sysinfo');
683
- $sysinfo = $this->get_sysinfo();
684
- //if (serialize($lastSent) != serialize($sysinfo)) {
685
- ?>
686
- <iframe id="hidden_frame" name="hidden_frame" style="width:0px; height:0px; border: 0px" src="about:blank"></iframe>
687
- <form id="twp_send_info_form" target="hidden_frame" method="post" action="http://xavisys.com/plugin-info.php">
688
- <?php
689
- foreach($sysinfo as $k=>$v)
690
- {
691
- ?>
692
- <input type="hidden" name="<?php echo attribute_escape($k); ?>" value="<?php echo attribute_escape($v);?>"></input>
693
- <?php
694
- }
695
- ?>
696
- </form>
697
- <script type='text/javascript'>
698
- jQuery('#twp_send_info_form').submit();
699
- </script>
700
- <?php
701
- update_option('twp-sysinfo', $sysinfo);
702
- //}
703
- }
704
  }
705
- function get_sysinfo()
 
706
  {
707
  global $wpdb;
708
  $s = array();
@@ -725,12 +639,11 @@ profileImage;
725
 
726
  if ( $file == $this->_pluginBasename ) {
727
  // Add settings link to our plugin
728
- $link = '<a href="options-general.php?page=TwitterWidgetPro">' . __('Settings') . '</a>';
729
  array_unshift( $links, $link );
730
  }
731
  return $links;
732
  }
733
-
734
  }
735
  // Instantiate our class
736
  $wpTwitterWidget = new wpTwitterWidget();
@@ -739,11 +652,12 @@ $wpTwitterWidget = new wpTwitterWidget();
739
  * Add filters and actions
740
  */
741
  add_action( 'admin_menu', array($wpTwitterWidget,'admin_menu') );
 
 
742
  add_action( 'widgets_init', array($wpTwitterWidget, 'register') );
743
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkTwitterUsers') );
744
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkUrls') );
745
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkHashtags') );
746
  add_filter( 'widget_twitter_content', 'convert_chars' );
747
  add_action( 'activate_twitter-widget-pro/wp-twitter-widget.php', array($wpTwitterWidget, 'activatePlugin') );
748
- add_action( 'admin_footer', array($wpTwitterWidget, 'outputSendInfoForm') );
749
  add_filter( 'plugin_action_links', array($wpTwitterWidget, 'addSettingLink'), 10, 2 );
3
  * Plugin Name: Twitter Widget Pro
4
  * Plugin URI: http://xavisys.com/wordpress-twitter-widget/
5
  * Description: A widget that properly handles twitter feeds, including @username, #hashtag, and link parsing. It can even display profile images for the users. Requires PHP5.
6
+ * Version: 1.4.1
7
  * Author: Aaron D. Campbell
8
  * Author URI: http://xavisys.com/
9
+ * Text Domain: twitter-widget-pro
10
  */
11
 
12
+ define('TWP_VERSION', '1.4.1');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  /* Copyright 2006 Aaron D. Campbell (email : wp_plugins@xavisys.com)
15
 
44
 
45
  public function __construct() {}
46
 
47
+ public function admin_menu() {
48
+ add_options_page(__('Twitter Widget Pro', 'twitter-widget-pro'), __('Twitter Widget Pro', 'twitter-widget-pro'), 'manage_options', 'TwitterWidgetPro', array($this, 'options'));
49
  }
50
+
51
+ public function init_locale(){
52
+ $lang_dir = basename(dirname(__FILE__)) . '/languages';
53
+ load_plugin_textdomain('twitter-widget-pro', 'wp-content/plugins/' . $lang_dir, $lang_dir);
54
+ }
55
+
56
  /**
57
  * This is used to display the options page for this plugin
58
  */
59
+ public function options() {
60
  //Get our options
61
  $o = get_option('twitter_widget_pro');
62
  ?>
63
  <div class="wrap">
64
+ <h2><?php _e('Twitter Widget Pro Options', 'twitter-widget-pro') ?></h2>
65
  <form action="options.php" method="post" id="wp_twitter_widget_pro">
66
  <?php wp_nonce_field('update-options'); ?>
67
  <table class="form-table">
68
  <tr valign="top">
69
  <th scope="row">
70
+ <a title="<?php _e('Click for Help!', 'twitter-widget-pro'); ?>" href="#" onclick="jQuery('#twp_user_agreed_to_send_system_information_help').toggle(); return false;">
71
+ <?php _e('System Information:', 'twitter-widget-pro') ?>
72
  </a>
73
  </th>
74
  <td>
75
+ <label for="twp_user_agreed_to_send_system_information"><input type="checkbox" name="twitter_widget_pro[user_agreed_to_send_system_information]" value="true" id="twp_user_agreed_to_send_system_information"<?php checked('true', $o['user_agreed_to_send_system_information']); ?> /> <?php _e('I agree to send anonymous system information', 'twitter-widget-pro'); ?></label><br />
76
  <small id="twp_user_agreed_to_send_system_information_help" style="display:none;">
77
+ <?php _e('You can help by sending anonymous system information that will help Xavisys make better decisions about new features.', 'twitter-widget-pro'); ?><br />
78
+ <?php _e('The information will be sent anonymously, but a unique identifier will be sent to prevent duplicate entries from the same installation.', 'twitter-widget-pro'); ?>
79
  </small>
80
  </td>
81
  </tr>
82
  </table>
83
  <p class="submit">
84
+ <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;', 'twitter-widget-pro'); ?>" />
85
  </p>
86
  <input type="hidden" name="action" value="update" />
87
  <input type="hidden" name="page_options" value="twitter_widget_pro" />
110
  } else {
111
  // Failed to fetch url;
112
  if (empty($widgetOptions['errmsg'])) {
113
+ $widgetOptions['errmsg'] = __('Could not connect to Twitter', 'twitter-widget-pro');
114
  }
115
+ throw new wpTwitterWidgetException($widgetOptions['errmsg']);
116
  }
117
  }
118
 
269
  $icon = get_option('siteurl').'/wp-includes/images/rss.png';
270
  }
271
  $feedUrl = $this->_getFeedUrl($options[$number], 'rss', false);
272
+ $before_title .= "<a class='twitterwidget' href='{$feedUrl}' title='" . attribute_escape(__('Syndicate this content', 'twitter-widget-pro')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='{$icon}' alt='RSS' /></a> ";
273
  }
274
  $twitterLink = 'http://twitter.com/' . $options[$number]['username'];
275
  $before_title .= "<a class='twitterwidget' href='{$twitterLink}' title='" . attribute_escape("Twitter: {$options[$number]['username']}") . "'>";
282
  if (is_a($tweets, 'wpTwitterWidgetException')) {
283
  echo '<li class="wpTwitterWidgetError">' . $tweets->getMessage() . '</li>';
284
  } else if (count($tweets) == 0) {
285
+ echo '<li class="wpTwitterWidgetEmpty">' . __('No Tweets Available', 'twitter-widget-pro') . '</li>';
286
  } else {
287
  if (!empty($tweets) && $options[$number]['avatar']) {
288
  echo '<li>';
289
  echo $this->_getProfileImage($tweets[0]->user);
290
+ echo '<div class="clear"></div>';
291
  echo '</li>';
292
  }
293
  foreach ($tweets as $tweet) {
303
  </a>
304
  </span>
305
  <span class="from-meta">
306
+ <?php echo sprintf(__('from %s', 'twitter-widget-pro'), str_replace('&', '&amp;', $tweet->source)); ?>
307
  </span>
308
  <?php
309
  if (!empty($tweet->in_reply_to_screen_name)) {
310
+ $rtLinkText = sprintf( __('in reply to %s', 'twitter-widget-pro'), $tweet->in_reply_to_screen_name );
311
  echo <<<replyTo
312
  <span class="in-reply-to-meta">
313
  <a href="http://twitter.com/{$tweet->in_reply_to_screen_name}/statuses/{$tweet->in_reply_to_status_id}" class="reply-to">
314
+ {$rtLinkText}
315
  </a>
316
  </span>
317
  replyTo;
327
  ?>
328
  <li class="xavisys-link">
329
  <span class="xavisys-link-text">
330
+ <?php echo sprintf(__('Powered by <a href="%s" title="Get Twitter Widget for your WordPress site">WordPress Twitter Widget Pro</a>', 'twitter-widget-pro'), 'http://xavisys.com/2008/04/wordpress-twitter-widget/' );?>
 
 
 
331
  </span>
332
  </li>
333
  <?php
437
  public function register() {
438
  if ( !$options = get_option('widget_twitter') )
439
  $options = array();
440
+ $widget_ops = array('classname' => 'widget_twitter', 'description' => __('Follow a Twitter Feed', 'twitter-widget-pro'));
441
  $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'twitter');
442
+ $name = __('Twitter Feed', 'twitter-widget-pro');
443
 
444
  $id = false;
445
  foreach ( array_keys($options) as $o ) {
481
  extract( $args );
482
  ?>
483
  <p>
484
+ <label for="twitter-username-<?php echo $number; ?>"><?php _e('Twitter username:', 'twitter-widget-pro'); ?></label>
485
  <input class="widefat" id="twitter-username-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][username]" type="text" value="<?php echo $username; ?>" />
486
  </p>
487
  <p>
488
+ <label for="twitter-title-<?php echo $number; ?>"><?php _e('Give the feed a title (optional):', 'twitter-widget-pro'); ?></label>
489
  <input class="widefat" id="twitter-title-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
490
  </p>
491
  <p>
492
+ <label for="twitter-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?', 'twitter-widget-pro'); ?></label>
493
  <select id="twitter-items-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][items]">
494
  <?php
495
  for ( $i = 1; $i <= 20; ++$i ) {
499
  </select>
500
  </p>
501
  <p>
502
+ <label for="twitter-errmsg-<?php echo $number; ?>"><?php _e('What to display when Twitter is down (optional):', 'twitter-widget-pro'); ?></label>
503
  <input class="widefat" id="twitter-errmsg-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][errmsg]" type="text" value="<?php echo $errmsg; ?>" />
504
  </p>
505
  <p>
506
+ <label for="twitter-fetchTimeOut-<?php echo $number; ?>"><?php _e('Number of seconds to wait for a response from Twitter (default 2):', 'twitter-widget-pro'); ?></label>
507
  <input class="widefat" id="twitter-fetchTimeOut-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][fetchTimeOut]" type="text" value="<?php echo $fetchTimeOut; ?>" />
508
  </p>
509
  <p>
510
+ <label for="twitter-showts-<?php echo $number; ?>"><?php _e('Show date/time of Tweet (rather than 2 ____ ago):', 'twitter-widget-pro'); ?></label>
511
  <select id="twitter-showts-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][showts]">
512
+ <option value="0" <?php echo selected($showts, '0'); ?>><?php _e('Always', 'twitter-widget-pro');?></a>
513
+ <option value="3600" <?php echo selected($showts, '3600'); ?>><?php _e('If over an hour old', 'twitter-widget-pro');?></a>
514
+ <option value="86400" <?php echo selected($showts, '86400'); ?>><?php _e('If over a day old', 'twitter-widget-pro');?></a>
515
+ <option value="604800" <?php echo selected($showts, '604800'); ?>><?php _e('If over a week old', 'twitter-widget-pro');?></a>
516
+ <option value="2592000" <?php echo selected($showts, '2592000'); ?>><?php _e('If over a month old', 'twitter-widget-pro');?></a>
517
+ <option value="31536000" <?php echo selected($showts, '31536000'); ?>><?php _e('If over a year old', 'twitter-widget-pro');?></a>
518
+ <option value="-1" <?php echo selected($showts, '-1'); ?>><?php _e('Never', 'twitter-widget-pro');?></a>
519
  </select>
520
  </p>
521
  <p>
522
+ <label for="twitter-hiderss-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-hiderss-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][hiderss]"<?php checked($hiderss, true); ?> /> <?php _e('Hide RSS Icon and Link', 'twitter-widget-pro'); ?></label>
523
  </p>
524
  <p>
525
+ <label for="twitter-avatar-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-avatar-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][avatar]"<?php checked($avatar, true); ?> /> <?php _e('Show Profile Image', 'twitter-widget-pro'); ?></label>
526
  </p>
527
  <p>
528
  <input type="hidden" name="widget-twitter[<?php echo $number; ?>][showXavisysLink]" value="false" />
529
+ <label for="twitter-showXavisysLink-<?php echo $number; ?>"><input class="checkbox" type="checkbox" value="true" id="twitter-showXavisysLink-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][showXavisysLink]"<?php checked($showXavisysLink, true); ?> /> <?php _e('Show Link to Twitter Widget Pro', 'twitter-widget-pro'); ?></label>
530
  </p>
531
  <?php
532
  }
577
  return "about {$print} ago";
578
  }
579
 
580
+ public function activatePlugin() {
581
  // If the wga-id has not been generated, generate one and store it.
582
  $id = $this->get_id();
583
  $o = get_option('twitter_widget_pro');
587
  }
588
  }
589
 
590
+ public function get_id() {
591
  $id = get_option('twitter_widget_pro-id');
592
  if ($id === false) {
593
  $id = sha1( get_bloginfo('url') . mt_rand() );
596
  return $id;
597
  }
598
  /**
599
+ * if user agrees to send system information and the last sent info is
600
+ * outdated then send the stats
601
  */
602
+ public function sendSysInfo() {
 
603
  $o = get_option('twitter_widget_pro');
604
  if ($o['user_agreed_to_send_system_information'] == 'true') {
605
  $lastSent = get_option('twp-sysinfo');
606
+ $sysinfo = $this->_get_sysinfo();
607
+ if (serialize($lastSent) != serialize($sysinfo)) {
608
+ $params = array(
609
+ 'method' => 'POST',
610
+ 'blocking' => false,
611
+ 'body' => $sysinfo,
612
+ );
613
+ $resp = wp_remote_request( 'http://xavisys.com/plugin-info.php', $params );
614
+ update_option( 'twp-sysinfo', $sysinfo );
615
+ }
616
+ }
 
 
 
 
 
 
 
 
 
 
617
  }
618
+
619
+ private function _get_sysinfo()
620
  {
621
  global $wpdb;
622
  $s = array();
639
 
640
  if ( $file == $this->_pluginBasename ) {
641
  // Add settings link to our plugin
642
+ $link = '<a href="options-general.php?page=TwitterWidgetPro">' . __('Settings', 'twitter-widget-pro') . '</a>';
643
  array_unshift( $links, $link );
644
  }
645
  return $links;
646
  }
 
647
  }
648
  // Instantiate our class
649
  $wpTwitterWidget = new wpTwitterWidget();
652
  * Add filters and actions
653
  */
654
  add_action( 'admin_menu', array($wpTwitterWidget,'admin_menu') );
655
+ add_filter( 'init', array( $wpTwitterWidget, 'init_locale') );
656
+ add_filter( 'admin_init', array( $wpTwitterWidget, 'sendSysInfo') );
657
  add_action( 'widgets_init', array($wpTwitterWidget, 'register') );
658
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkTwitterUsers') );
659
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkUrls') );
660
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkHashtags') );
661
  add_filter( 'widget_twitter_content', 'convert_chars' );
662
  add_action( 'activate_twitter-widget-pro/wp-twitter-widget.php', array($wpTwitterWidget, 'activatePlugin') );
 
663
  add_filter( 'plugin_action_links', array($wpTwitterWidget, 'addSettingLink'), 10, 2 );