Twitter Widget Pro - Version 1.4.0

Version Description

  • Make translatable
  • Include POT file
  • Remove JS submitted for for stats and use HTTP class instead
Download this release

Release Info

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

Code changes from version 1.3.7 to 1.4.0

Files changed (3) hide show
  1. languages/twitter-widget-pro.pot +152 -0
  2. readme.txt +88 -2
  3. wp-twitter-widget.php +65 -149
languages/twitter-widget-pro.pot ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 20:33+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:135
19
+ msgid "Twitter Widget Pro"
20
+ msgstr ""
21
+
22
+ #: wp-twitter-widget.php:151
23
+ msgid "Twitter Widget Pro Options"
24
+ msgstr ""
25
+
26
+ #: wp-twitter-widget.php:157
27
+ msgid "Click for Help!"
28
+ msgstr ""
29
+
30
+ #: wp-twitter-widget.php:158
31
+ msgid "System Information:"
32
+ msgstr ""
33
+
34
+ #: wp-twitter-widget.php:162
35
+ msgid "I agree to send anonymous system information"
36
+ msgstr ""
37
+
38
+ #: wp-twitter-widget.php:164
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:165
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:171
51
+ msgid "Update Options &raquo;"
52
+ msgstr ""
53
+
54
+ #: wp-twitter-widget.php:202
55
+ msgid "errmsg"
56
+ msgstr ""
57
+
58
+ #: wp-twitter-widget.php:359
59
+ msgid "Syndicate this content"
60
+ msgstr ""
61
+
62
+ #: wp-twitter-widget.php:372
63
+ msgid "No Tweets Available"
64
+ msgstr ""
65
+
66
+ #: wp-twitter-widget.php:393
67
+ msgid "from"
68
+ msgstr ""
69
+
70
+ #: wp-twitter-widget.php:416
71
+ msgid "Powered by"
72
+ msgstr ""
73
+
74
+ #: wp-twitter-widget.php:418
75
+ msgid "WordPress Twitter Widget Pro"
76
+ msgstr ""
77
+
78
+ #: wp-twitter-widget.php:529
79
+ msgid "Follow a Twitter Feed"
80
+ msgstr ""
81
+
82
+ #: wp-twitter-widget.php:531
83
+ msgid "Twitter Feed"
84
+ msgstr ""
85
+
86
+ #: wp-twitter-widget.php:573
87
+ msgid "Twitter username:"
88
+ msgstr ""
89
+
90
+ #: wp-twitter-widget.php:577
91
+ msgid "Give the feed a title (optional):"
92
+ msgstr ""
93
+
94
+ #: wp-twitter-widget.php:581
95
+ msgid "How many items would you like to display?"
96
+ msgstr ""
97
+
98
+ #: wp-twitter-widget.php:591
99
+ msgid "What to display when Twitter is down (optional):"
100
+ msgstr ""
101
+
102
+ #: wp-twitter-widget.php:595
103
+ msgid "Number of seconds to wait for a response from Twitter (default 2):"
104
+ msgstr ""
105
+
106
+ #: wp-twitter-widget.php:599
107
+ msgid "Show date/time of Tweet (rather than 2 ____ ago):"
108
+ msgstr ""
109
+
110
+ #: wp-twitter-widget.php:601
111
+ msgid "Always"
112
+ msgstr ""
113
+
114
+ #: wp-twitter-widget.php:602
115
+ msgid "If over an hour old"
116
+ msgstr ""
117
+
118
+ #: wp-twitter-widget.php:603
119
+ msgid "If over a day old"
120
+ msgstr ""
121
+
122
+ #: wp-twitter-widget.php:604
123
+ msgid "If over a week old"
124
+ msgstr ""
125
+
126
+ #: wp-twitter-widget.php:605
127
+ msgid "If over a month old"
128
+ msgstr ""
129
+
130
+ #: wp-twitter-widget.php:606
131
+ msgid "If over a year old"
132
+ msgstr ""
133
+
134
+ #: wp-twitter-widget.php:607
135
+ msgid "Never"
136
+ msgstr ""
137
+
138
+ #: wp-twitter-widget.php:611
139
+ msgid "Hide RSS Icon and Link"
140
+ msgstr ""
141
+
142
+ #: wp-twitter-widget.php:614
143
+ msgid "Show Profile Image"
144
+ msgstr ""
145
+
146
+ #: wp-twitter-widget.php:618
147
+ msgid "Show Link to Twitter Widget Pro"
148
+ msgstr ""
149
+
150
+ #: wp-twitter-widget.php:731
151
+ msgid "Settings"
152
+ 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,89 @@ 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.0
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
+ * Make translatable
51
+ * Include POT file
52
+ * Remove JS submitted for for stats and use HTTP class instead
53
+
54
+ = 1.3.7 =
55
+ * Added some spans with classes to make styling to meta data easier
56
+
57
+ = 1.3.6 =
58
+ * Fixes issue with linking URLs containing a ~
59
+ * Removed some debugging stuff
60
+
61
+ = 1.3.5 =
62
+ * #Hashtags are now linked to twitter search
63
+
64
+ = 1.3.4 =
65
+ * Added convert_chars filter to the tweet text to properly handle special characters
66
+ * Fixed "in reply to" text which stopped working when Twitter changed their API
67
+
68
+ = 1.3.3 =
69
+ * Some configs still couldn't turn off the link to Twitter Widget Pro page
70
+
71
+ = 1.3.2 =
72
+ * Fixed problem with link to Twitter Widget Pro page not turning off
73
+
74
+ = 1.3.1 =
75
+ * Added error handling after wp_remote_request call
76
+ * Added link to Twitter Widget Pro page and option to turn it off per widget
77
+
78
+ = 1.3.0 =
79
+ * Updated to use HTTP class and phased out Snoopy
80
+ * No longer relies on user having a caching solution in place. Caches for 5 minutes using blog options
81
+ * Allow HTML in title and error message if user can
82
+
83
+ = 1.2.2 =
84
+ * Fixed minor issue with Zend JSON Decoder
85
+ * Added an option for Twitter timeout. 2 seconds wasn't enough for some people
86
+
87
+ = 1.2.1 =
88
+ * Fixed some minor errors in the collection code
89
+ * Added the admin options page (how did that get missed?!?)
90
+
91
+ = 1.2.0 =
92
+ * Removed friends feed option, twitter removed this functionality
93
+ * Added an option to set your own message to display when twitter is down
94
+ * Added optional anonymous statistics collection
95
+
96
+ = 1.1.4 =
97
+ * Added an error if there was a problem connecting to Twitter.
98
+ * Added some text if there are no tweets.
99
+
100
+ = 1.1.3 =
101
+ * Fixed validation problems if source is a link containg an &
102
+
103
+ = 1.1.2 =
104
+ * Title link always links to correct username, rather than the last person to tweet on that feed
105
+ * Added option to hide RSS icon/link
106
+
107
+ = 1.1.1 =
108
+ * Fixed issue with @username parsing of two names with one space between them (@test @ing)
109
+ * Fixed readme typo
110
+
111
+ = 1.1.0 =
112
+ * 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
113
+ * Fixed problem with displaying a useless li when profile images aren't displayed on a single user widget
114
+ * Default title is now set to "Twitter: UserName"
115
+
116
+ = 1.0.0 =
117
+ * Released to wordpress.org repository
118
+
119
+ = 0.0.3 =
120
+ * Fixed some of the settings used with Snoopy
121
+ * Set a read timeout for fetching the files
122
+
123
+ = 0.0.2 =
124
+ * Changed some function names
125
+ * Moved form display to a separate function (_showForm)
126
+ * Now uses wp_parse_args to handle defaults
127
+ * Added comments
128
+ * Added seconds to the _timeSince function so you can have something like "about 25 seconds ago"
129
+
130
+ = 0.0.1 =
131
+ * 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" />
@@ -187,7 +112,7 @@ class wpTwitterWidget
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,7 +303,7 @@ 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)) {
@@ -401,9 +326,9 @@ 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>
@@ -514,9 +439,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 +483,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 +501,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 +579,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 +589,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 +598,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 +641,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 +654,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.0
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.0');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $plugin_dir = basename(dirname(__FILE__));
53
+ load_plugin_textdomain('twitter-widget-pro', 'wp-content/plugins/' . $plugin_dir, $plugin_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" />
112
  if (empty($widgetOptions['errmsg'])) {
113
  $widgetOptions['errmsg'] = 'Could not connect to Twitter';
114
  }
115
+ throw new wpTwitterWidgetException(__($widgetOptions['errmsg'], 'twitter-widget-pro'));
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 __('from', 'twitter-widget-pro') . ' ' . str_replace('&', '&amp;', $tweet->source); ?>
307
  </span>
308
  <?php
309
  if (!empty($tweet->in_reply_to_screen_name)) {
326
  ?>
327
  <li class="xavisys-link">
328
  <span class="xavisys-link-text">
329
+ <?php _e('Powered by', 'twitter-widget-pro');?>
330
  <a href="http://xavisys.com/2008/04/wordpress-twitter-widget/">
331
+ <?php _e('WordPress Twitter Widget Pro', 'twitter-widget-pro');?>
332
  </a>
333
  </span>
334
  </li>
439
  public function register() {
440
  if ( !$options = get_option('widget_twitter') )
441
  $options = array();
442
+ $widget_ops = array('classname' => 'widget_twitter', 'description' => __('Follow a Twitter Feed', 'twitter-widget-pro'));
443
  $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'twitter');
444
+ $name = __('Twitter Feed', 'twitter-widget-pro');
445
 
446
  $id = false;
447
  foreach ( array_keys($options) as $o ) {
483
  extract( $args );
484
  ?>
485
  <p>
486
+ <label for="twitter-username-<?php echo $number; ?>"><?php _e('Twitter username:', 'twitter-widget-pro'); ?></label>
487
  <input class="widefat" id="twitter-username-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][username]" type="text" value="<?php echo $username; ?>" />
488
  </p>
489
  <p>
490
+ <label for="twitter-title-<?php echo $number; ?>"><?php _e('Give the feed a title (optional):', 'twitter-widget-pro'); ?></label>
491
  <input class="widefat" id="twitter-title-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
492
  </p>
493
  <p>
494
+ <label for="twitter-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?', 'twitter-widget-pro'); ?></label>
495
  <select id="twitter-items-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][items]">
496
  <?php
497
  for ( $i = 1; $i <= 20; ++$i ) {
501
  </select>
502
  </p>
503
  <p>
504
+ <label for="twitter-errmsg-<?php echo $number; ?>"><?php _e('What to display when Twitter is down (optional):', 'twitter-widget-pro'); ?></label>
505
  <input class="widefat" id="twitter-errmsg-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][errmsg]" type="text" value="<?php echo $errmsg; ?>" />
506
  </p>
507
  <p>
508
+ <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>
509
  <input class="widefat" id="twitter-fetchTimeOut-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][fetchTimeOut]" type="text" value="<?php echo $fetchTimeOut; ?>" />
510
  </p>
511
  <p>
512
+ <label for="twitter-showts-<?php echo $number; ?>"><?php _e('Show date/time of Tweet (rather than 2 ____ ago):', 'twitter-widget-pro'); ?></label>
513
  <select id="twitter-showts-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][showts]">
514
+ <option value="0" <?php echo selected($showts, '0'); ?>><?php _e('Always', 'twitter-widget-pro');?></a>
515
+ <option value="3600" <?php echo selected($showts, '3600'); ?>><?php _e('If over an hour old', 'twitter-widget-pro');?></a>
516
+ <option value="86400" <?php echo selected($showts, '86400'); ?>><?php _e('If over a day old', 'twitter-widget-pro');?></a>
517
+ <option value="604800" <?php echo selected($showts, '604800'); ?>><?php _e('If over a week old', 'twitter-widget-pro');?></a>
518
+ <option value="2592000" <?php echo selected($showts, '2592000'); ?>><?php _e('If over a month old', 'twitter-widget-pro');?></a>
519
+ <option value="31536000" <?php echo selected($showts, '31536000'); ?>><?php _e('If over a year old', 'twitter-widget-pro');?></a>
520
+ <option value="-1" <?php echo selected($showts, '-1'); ?>><?php _e('Never', 'twitter-widget-pro');?></a>
521
  </select>
522
  </p>
523
  <p>
524
+ <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>
525
  </p>
526
  <p>
527
+ <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>
528
  </p>
529
  <p>
530
  <input type="hidden" name="widget-twitter[<?php echo $number; ?>][showXavisysLink]" value="false" />
531
+ <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>
532
  </p>
533
  <?php
534
  }
579
  return "about {$print} ago";
580
  }
581
 
582
+ public function activatePlugin() {
583
  // If the wga-id has not been generated, generate one and store it.
584
  $id = $this->get_id();
585
  $o = get_option('twitter_widget_pro');
589
  }
590
  }
591
 
592
+ public function get_id() {
593
  $id = get_option('twitter_widget_pro-id');
594
  if ($id === false) {
595
  $id = sha1( get_bloginfo('url') . mt_rand() );
598
  return $id;
599
  }
600
  /**
601
+ * if user agrees to send system information and the last sent info is
602
+ * outdated then send the stats
603
  */
604
+ public function sendSysInfo() {
 
605
  $o = get_option('twitter_widget_pro');
606
  if ($o['user_agreed_to_send_system_information'] == 'true') {
607
  $lastSent = get_option('twp-sysinfo');
608
+ $sysinfo = $this->_get_sysinfo();
609
+ if (serialize($lastSent) != serialize($sysinfo)) {
610
+ $params = array(
611
+ 'method' => 'POST',
612
+ 'blocking' => false,
613
+ 'body' => $sysinfo,
614
+ );
615
+ $resp = wp_remote_request( 'http://xavisys.com/plugin-info.php', $params );
616
+ update_option( 'twp-sysinfo', $sysinfo );
617
+ }
618
+ }
 
 
 
 
 
 
 
 
 
 
619
  }
620
+
621
+ private function _get_sysinfo()
622
  {
623
  global $wpdb;
624
  $s = array();
641
 
642
  if ( $file == $this->_pluginBasename ) {
643
  // Add settings link to our plugin
644
+ $link = '<a href="options-general.php?page=TwitterWidgetPro">' . __('Settings', 'twitter-widget-pro') . '</a>';
645
  array_unshift( $links, $link );
646
  }
647
  return $links;
648
  }
 
649
  }
650
  // Instantiate our class
651
  $wpTwitterWidget = new wpTwitterWidget();
654
  * Add filters and actions
655
  */
656
  add_action( 'admin_menu', array($wpTwitterWidget,'admin_menu') );
657
+ add_filter( 'init', array( $wpTwitterWidget, 'init_locale') );
658
+ add_filter( 'admin_init', array( $wpTwitterWidget, 'sendSysInfo') );
659
  add_action( 'widgets_init', array($wpTwitterWidget, 'register') );
660
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkTwitterUsers') );
661
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkUrls') );
662
  add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkHashtags') );
663
  add_filter( 'widget_twitter_content', 'convert_chars' );
664
  add_action( 'activate_twitter-widget-pro/wp-twitter-widget.php', array($wpTwitterWidget, 'activatePlugin') );
 
665
  add_filter( 'plugin_action_links', array($wpTwitterWidget, 'addSettingLink'), 10, 2 );