Twitter Widget Pro - Version 2.8.0

Version Description

Updates to make the plugin translatable with the new translate.wordpress.org

Download this release

Release Info

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

Code changes from version 2.7.0 to 2.8.0

aaron-plugin-framework.php DELETED
@@ -1,411 +0,0 @@
1
- <?php
2
- /**
3
- * Version: 1.2.1
4
- */
5
- /**
6
- * Changelog:
7
- *
8
- * 1.2.1:
9
- * - Fix leftover bluedog link to point to aarondcampbell.com
10
- *
11
- * 1.2.0:
12
- * - Complete change to Aaron framework
13
- *
14
- * 1.1.0:
15
- * - Complete change to Range framework
16
- * - Coding standards
17
- * - Move from camelCase to underscores for function names
18
- * - Drop support for WP 2.8 & 2.9
19
- *
20
- * 1.0.15:
21
- * - Fix support forum link
22
- * - Update feed to Ran.ge
23
- *
24
- * 1.0.14:
25
- * - Fix sidebar alignment on settings page
26
- * - Fix forum link by passing it to the http://wordpress.org/tags/{slug}?forum_id=10
27
- *
28
- * 1.0.13:
29
- * - Add the 'xpf-dashboard-widget' filter
30
- *
31
- * 1.0.12:
32
- * - Add the xpf-show-general-settings-submit filter
33
- *
34
- * 1.0.11:
35
- * - Add the xpf-pre-main-metabox action
36
- *
37
- * 1.0.10:
38
- * - Allow the screen icon to be overridden
39
- *
40
- * 1.0.9:
41
- * - Allow removal of Xavisys sidebar boxes
42
- *
43
- * 1.0.8:
44
- * - Allow an auto-created options page that doesn't have a main meta box
45
- *
46
- * 1.0.7:
47
- * - Add the ability to modify the form action on the options page
48
- * - Add an action in the options page form tag
49
- *
50
- * 1.0.6:
51
- * - Add ability to not have a settings page
52
- *
53
- * 1.0.5:
54
- * - Added XavisysPlugin::_feed_url
55
- * - Changed feed to the feed burner URL because of a redirect issue with 2.9.x
56
- *
57
- * 1.0.4:
58
- * - Added donate link to the plugin meta
59
- *
60
- * 1.0.3:
61
- * - Changed to use new cdn for images
62
- */
63
- if (!class_exists('AaronPlugin')) {
64
- /**
65
- * Abstract class AaronPlugin used as a WordPress Plugin framework
66
- *
67
- * @abstract
68
- */
69
- abstract class AaronPlugin {
70
- /**
71
- * @var array Plugin settings
72
- */
73
- protected $_settings;
74
-
75
- /**
76
- * @var string - The options page name used in the URL
77
- */
78
- protected $_hook = '';
79
-
80
- /**
81
- * @var string - The filename for the main plugin file
82
- */
83
- protected $_file = '';
84
-
85
- /**
86
- * @var string - The options page title
87
- */
88
- protected $_pageTitle = '';
89
-
90
- /**
91
- * @var string - The options page menu title
92
- */
93
- protected $_menuTitle = '';
94
-
95
- /**
96
- * @var string - The access level required to see the options page
97
- */
98
- protected $_accessLevel = '';
99
-
100
- /**
101
- * @var string - The option group to register
102
- */
103
- protected $_optionGroup = '';
104
-
105
- /**
106
- * @var array - An array of options to register to the option group
107
- */
108
- protected $_optionNames = array();
109
-
110
- /**
111
- * @var array - An associated array of callbacks for the options, option name should be index, callback should be value
112
- */
113
- protected $_optionCallbacks = array();
114
-
115
- /**
116
- * @var string - The plugin slug used on WordPress.org
117
- */
118
- protected $_slug = '';
119
-
120
- /**
121
- * @var string - The feed URL for AaronDCampbell.com
122
- */
123
- protected $_feed_url = 'http://aarondcampbell.com/feed/';
124
-
125
- /**
126
- * @var string - The button ID for the PayPal button, override this generic one with a plugin-specific one
127
- */
128
- protected $_paypalButtonId = '9925248';
129
-
130
- protected $_optionsPageAction = 'options.php';
131
-
132
- /**
133
- * This is our constructor, which is private to force the use of getInstance()
134
- * @return void
135
- */
136
- protected function __construct() {
137
- if ( is_callable( array($this, '_init') ) )
138
- $this->_init();
139
-
140
- $this->_get_settings();
141
- if ( is_callable( array($this, '_post_settings_init') ) )
142
- $this->_post_settings_init();
143
-
144
- add_filter( 'init', array( $this, 'init_locale' ) );
145
- add_action( 'admin_init', array( $this, 'register_options' ) );
146
- add_filter( 'plugin_action_links', array( $this, 'add_plugin_page_links' ), 10, 2 );
147
- add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2 );
148
- add_action( 'admin_menu', array( $this, 'register_options_page' ) );
149
- if ( is_callable(array( $this, 'add_options_meta_boxes' )) )
150
- add_action( 'admin_init', array( $this, 'add_options_meta_boxes' ) );
151
-
152
- add_action( 'admin_init', array( $this, 'add_default_options_meta_boxes' ) );
153
- add_action( 'admin_print_scripts', array( $this,'admin_print_scripts' ) );
154
- add_action( 'admin_enqueue_scripts', array( $this,'admin_enqueue_scripts' ) );
155
-
156
- add_action ( 'in_plugin_update_message-'.$this->_file , array ( $this , 'changelog' ), null, 2 );
157
- }
158
-
159
- public function init_locale() {
160
- $lang_dir = basename(dirname(__FILE__)) . '/languages';
161
- load_plugin_textdomain( $this->_slug, 'wp-content/plugins/' . $lang_dir, $lang_dir);
162
- }
163
-
164
- protected function _get_settings() {
165
- foreach ( $this->_optionNames as $opt ) {
166
- $this->_settings[$opt] = apply_filters($this->_slug.'-opt-'.$opt, get_option($opt));
167
- }
168
- }
169
-
170
- public function register_options() {
171
- foreach ( $this->_optionNames as $opt ) {
172
- if ( !empty($this->_optionCallbacks[$opt]) && is_callable( $this->_optionCallbacks[$opt] ) ) {
173
- $callback = $this->_optionCallbacks[$opt];
174
- } else {
175
- $callback = '';
176
- }
177
- register_setting( $this->_optionGroup, $opt, $callback );
178
- }
179
- }
180
-
181
- public function changelog ($pluginData, $newPluginData) {
182
- require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
183
-
184
- $plugin = plugins_api( 'plugin_information', array( 'slug' => $newPluginData->slug ) );
185
-
186
- if ( !$plugin || is_wp_error( $plugin ) || empty( $plugin->sections['changelog'] ) ) {
187
- return;
188
- }
189
-
190
- $changes = $plugin->sections['changelog'];
191
- $pos = strpos( $changes, '<h4>' . preg_replace('/[^\d\.]/', '', $pluginData['Version'] ) );
192
- if ( $pos !== false ) {
193
- $changes = trim( substr( $changes, 0, $pos ) );
194
- }
195
-
196
- $replace = array(
197
- '<ul>' => '<ul style="list-style: disc inside; padding-left: 15px; font-weight: normal;">',
198
- '<h4>' => '<h4 style="margin-bottom:0;">',
199
- );
200
- echo str_replace( array_keys($replace), $replace, $changes );
201
- }
202
-
203
- public function register_options_page() {
204
- if ( apply_filters( 'rpf-options_page-'.$this->_slug, true ) && is_callable( array( $this, 'options_page' ) ) )
205
- add_options_page( $this->_pageTitle, $this->_menuTitle, $this->_accessLevel, $this->_hook, array( $this, 'options_page' ) );
206
- }
207
-
208
- protected function _filter_boxes_main($boxName) {
209
- if ( 'main' == strtolower($boxName) )
210
- return false;
211
-
212
- return $this->_filter_boxes_helper($boxName, 'main');
213
- }
214
-
215
- protected function _filter_boxes_sidebar($boxName) {
216
- return $this->_filter_boxes_helper($boxName, 'sidebar');
217
- }
218
-
219
- protected function _filter_boxes_helper($boxName, $test) {
220
- return ( strpos( strtolower($boxName), strtolower($test) ) !== false );
221
- }
222
-
223
- public function options_page() {
224
- global $wp_meta_boxes;
225
- $allBoxes = array_keys( $wp_meta_boxes['aaron-'.$this->_slug] );
226
- $mainBoxes = array_filter( $allBoxes, array( $this, '_filter_boxes_main' ) );
227
- unset($mainBoxes['main']);
228
- sort($mainBoxes);
229
- $sidebarBoxes = array_filter( $allBoxes, array( $this, '_filter_boxes_sidebar' ) );
230
- unset($sidebarBoxes['sidebar']);
231
- sort($sidebarBoxes);
232
-
233
- $main_width = empty( $sidebarBoxes )? '100%' : '75%';
234
- ?>
235
- <div class="wrap">
236
- <?php $this->screen_icon_link(); ?>
237
- <h2><?php echo esc_html($this->_pageTitle); ?></h2>
238
- <div class="metabox-holder">
239
- <div class="postbox-container" style="width:<?php echo $main_width; ?>;">
240
- <?php
241
- do_action( 'rpf-pre-main-metabox', $main_width );
242
- if ( in_array( 'main', $allBoxes ) ) {
243
- ?>
244
- <form action="<?php esc_attr_e( $this->_optionsPageAction ); ?>" method="post"<?php do_action( 'rpf-options-page-form-tag' ) ?>>
245
- <?php
246
- settings_fields( $this->_optionGroup );
247
- do_meta_boxes( 'aaron-' . $this->_slug, 'main', '' );
248
- if ( apply_filters( 'rpf-show-general-settings-submit'.$this->_slug, true ) ) {
249
- ?>
250
- <p class="submit">
251
- <input type="submit" name="Submit" value="<?php esc_attr_e('Update Options &raquo;', $this->_slug); ?>" />
252
- </p>
253
- <?php
254
- }
255
- ?>
256
- </form>
257
- <?php
258
- }
259
- foreach( $mainBoxes as $context ) {
260
- do_meta_boxes( 'aaron-' . $this->_slug, $context, '' );
261
- }
262
- ?>
263
- </div>
264
- <?php
265
- if ( !empty( $sidebarBoxes ) ) {
266
- ?>
267
- <div class="alignright" style="width:24%;">
268
- <?php
269
- foreach( $sidebarBoxes as $context ) {
270
- do_meta_boxes( 'aaron-' . $this->_slug, $context, '' );
271
- }
272
- ?>
273
- </div>
274
- <?php
275
- }
276
- ?>
277
- </div>
278
- </div>
279
- <?php
280
- }
281
-
282
- public function add_plugin_page_links( $links, $file ){
283
- if ( $file == $this->_file ) {
284
- // Add Widget Page link to our plugin
285
- $link = $this->get_options_link();
286
- array_unshift( $links, $link );
287
-
288
- // Add Support Forum link to our plugin
289
- $link = $this->get_support_forum_link();
290
- array_unshift( $links, $link );
291
- }
292
- return $links;
293
- }
294
-
295
- public function add_plugin_meta_links( $meta, $file ){
296
- if ( $file == $this->_file )
297
- $meta[] = $this->get_plugin_link(__('Rate Plugin'));
298
- return $meta;
299
- }
300
-
301
- public function get_support_forum_link( $linkText = '' ) {
302
- if ( empty($linkText) ) {
303
- $linkText = __( 'Support', $this->_slug );
304
- }
305
- return '<a href="' . $this->get_support_forum_url() . '">' . $linkText . '</a>';
306
- }
307
-
308
- public function get_donate_link( $linkText = '' ) {
309
- $url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=' . $this->_paypalButtonId;
310
- if ( empty($linkText) ) {
311
- $linkText = __( 'Donate to show your appreciation.', $this->_slug );
312
- }
313
- return "<a href='{$url}'>{$linkText}</a>";
314
- }
315
-
316
- public function get_support_forum_url() {
317
- return 'http://wordpress.org/support/plugin/' . $this->_slug;
318
- }
319
-
320
- public function get_plugin_link( $linkText = '' ) {
321
- if ( empty($linkText) )
322
- $linkText = __( 'Give it a good rating on WordPress.org.', $this->_slug );
323
- return "<a href='" . $this->get_plugin_url() . "'>{$linkText}</a>";
324
- }
325
-
326
- public function get_plugin_url() {
327
- return 'http://wordpress.org/extend/plugins/' . $this->_slug;
328
- }
329
-
330
- public function get_options_link( $linkText = '' ) {
331
- if ( empty($linkText) ) {
332
- $linkText = __( 'Settings', $this->_slug );
333
- }
334
- return '<a href="' . $this->get_options_url() . '">' . $linkText . '</a>';
335
- }
336
-
337
- public function get_options_url() {
338
- return admin_url( 'options-general.php?page=' . $this->_hook );
339
- }
340
-
341
- public function admin_enqueue_scripts() {
342
- if (isset($_GET['page']) && $_GET['page'] == $this->_hook) {
343
- wp_enqueue_style('dashboard');
344
- }
345
- }
346
-
347
- public function add_default_options_meta_boxes() {
348
- if ( apply_filters( 'show-aaron-like-this', true ) )
349
- add_meta_box( $this->_slug . '-like-this', __('Like this Plugin?', $this->_slug), array($this, 'like_this_meta_box'), 'aaron-' . $this->_slug, 'sidebar');
350
-
351
- if ( apply_filters( 'show-aaron-support', true ) )
352
- add_meta_box( $this->_slug . '-support', __('Need Support?', $this->_slug), array($this, 'support_meta_box'), 'aaron-' . $this->_slug, 'sidebar');
353
-
354
- if ( apply_filters( 'show-aaron-feed', true ) )
355
- add_meta_box( $this->_slug . '-aaron-feed', __('Latest news from Aaron', $this->_slug), array($this, 'aaron_feed_meta_box'), 'aaron-' . $this->_slug, 'sidebar');
356
- }
357
-
358
- public function like_this_meta_box() {
359
- echo '<p>';
360
- _e('Then please do any or all of the following:', $this->_slug);
361
- echo '</p><ul>';
362
-
363
- $url = apply_filters('aaron-plugin-url-'.$this->_slug, 'https://aarondcampbell.com/wordpress-plugin/'.$this->_slug);
364
- echo "<li><a href='{$url}'>";
365
- _e('Link to it so others can find out about it.', $this->_slug);
366
- echo "</a></li>";
367
-
368
- echo '<li>' . $this->get_plugin_link() . '</li>';
369
-
370
- echo '<li>' . $this->get_donate_link() . '</li>';
371
-
372
- echo '</ul>';
373
- }
374
-
375
- public function support_meta_box() {
376
- echo '<p>';
377
- echo sprintf(__('If you have any problems with this plugin or ideas for improvements or enhancements, please use the <a href="%s">Support Forums</a>.', $this->_slug), $this->get_support_forum_url() );
378
- echo '</p>';
379
- }
380
-
381
- public function aaron_feed_meta_box() {
382
- $args = array(
383
- 'url' => $this->_feed_url,
384
- 'items' => '5',
385
- );
386
- echo '<div class="rss-widget">';
387
- wp_widget_rss_output( $args );
388
- echo "</div>";
389
- }
390
-
391
- public function screen_icon_link($name = 'aaron') {
392
- $link = '<a href="http://aarondcampbell.com">';
393
- if ( function_exists( 'get_screen_icon' ) ) {
394
- $link .= get_screen_icon( $name );
395
- } else {
396
- ob_start();
397
- screen_icon($name);
398
- $link .= ob_get_clean();
399
- }
400
- $link .= '</a>';
401
- echo apply_filters('rpf-screen_icon_link', $link, $name );
402
- }
403
-
404
- public function admin_print_scripts() {
405
- if (isset($_GET['page']) && $_GET['page'] == $this->_hook) {
406
- wp_enqueue_script('postbox');
407
- wp_enqueue_script('dashboard');
408
- }
409
- }
410
- }
411
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class.wp_widget_twitter_pro.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP_Widget_Twitter_Pro is the class that handles the main widget.
4
+ */
5
+ class WP_Widget_Twitter_Pro extends WP_Widget {
6
+ public function __construct () {
7
+ $wpTwitterWidget = wpTwitterWidget::getInstance();
8
+ $widget_ops = array(
9
+ 'classname' => 'widget_twitter',
10
+ 'description' => __( 'Follow a Twitter Feed', 'twitter-widget-pro' )
11
+ );
12
+ $control_ops = array(
13
+ 'width' => 400,
14
+ 'height' => 350,
15
+ 'id_base' => 'twitter'
16
+ );
17
+ $name = __( 'Twitter Widget Pro', 'twitter-widget-pro' );
18
+
19
+ parent::__construct( 'twitter', $name, $widget_ops, $control_ops );
20
+ }
21
+
22
+ private function _getInstanceSettings ( $instance ) {
23
+ $wpTwitterWidget = wpTwitterWidget::getInstance();
24
+ return $wpTwitterWidget->getSettings( $instance );
25
+ }
26
+
27
+ public function form( $instance ) {
28
+ $instance = $this->_getInstanceSettings( $instance );
29
+ $wpTwitterWidget = wpTwitterWidget::getInstance();
30
+ $users = $wpTwitterWidget->get_users_list( true );
31
+ $lists = $wpTwitterWidget->get_lists();
32
+
33
+ ?>
34
+ <p>
35
+ <label for="<?php echo $this->get_field_id( 'username' ); ?>"><?php _e( 'Twitter username:', 'twitter-widget-pro' ); ?></label>
36
+ <select id="<?php echo $this->get_field_id( 'username' ); ?>" name="<?php echo $this->get_field_name( 'username' ); ?>">
37
+ <option></option>
38
+ <?php
39
+ $selected = false;
40
+ foreach ( $users as $u ) {
41
+ ?>
42
+ <option value="<?php echo esc_attr( strtolower( $u['screen_name'] ) ); ?>"<?php $s = selected( strtolower( $u['screen_name'] ), strtolower( $instance['username'] ) ) ?>><?php echo esc_html( $u['screen_name'] ); ?></option>
43
+ <?php
44
+ if ( ! empty( $s ) )
45
+ $selected = true;
46
+ }
47
+ ?>
48
+ </select>
49
+ </p>
50
+ <p>
51
+ <label for="<?php echo $this->get_field_id( 'list' ); ?>"><?php _e( 'Twitter list:', 'twitter-widget-pro' ); ?></label>
52
+ <select id="<?php echo $this->get_field_id( 'list' ); ?>" name="<?php echo $this->get_field_name( 'list' ); ?>">
53
+ <option></option>
54
+ <?php
55
+ foreach ( $lists as $user => $user_lists ) {
56
+ echo '<optgroup label="' . esc_attr( $user ) . '">';
57
+ foreach ( $user_lists as $list_id => $list_name ) {
58
+ ?>
59
+ <option value="<?php echo esc_attr( $user . '::' . $list_id ); ?>"<?php $s = selected( $user . '::' . $list_id, strtolower( $instance['list'] ) ) ?>><?php echo esc_html( $list_name ); ?></option>
60
+ <?php
61
+ }
62
+ echo '</optgroup>';
63
+ }
64
+ ?>
65
+ </select>
66
+ </p>
67
+ <?php
68
+ if ( ! $selected && ! empty( $instance['username'] ) ) {
69
+ $query_args = array(
70
+ 'action' => 'authorize',
71
+ 'screen_name' => $instance['username'],
72
+ );
73
+ $authorize_user_url = wp_nonce_url( add_query_arg( $query_args, $wpTwitterWidget->get_options_url() ), 'authorize' );
74
+ ?>
75
+ <p>
76
+ <a href="<?php echo esc_url( $authorize_user_url ); ?>" style="color:red;">
77
+ <?php _e( 'You need to authorize this account.', 'twitter-widget-pro' ); ?>
78
+ </a>
79
+ </p>
80
+ <?php
81
+ }
82
+ ?>
83
+ <p>
84
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Give the feed a title ( optional ):', 'twitter-widget-pro' ); ?></label>
85
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $instance['title'] ); ?>" />
86
+ </p>
87
+ <p>
88
+ <label for="<?php echo $this->get_field_id( 'items' ); ?>"><?php _e( 'How many items would you like to display?', 'twitter-widget-pro' ); ?></label>
89
+ <select id="<?php echo $this->get_field_id( 'items' ); ?>" name="<?php echo $this->get_field_name( 'items' ); ?>">
90
+ <?php
91
+ for ( $i = 1; $i <= 20; ++$i ) {
92
+ echo "<option value='$i' ". selected( $instance['items'], $i, false ). ">$i</option>";
93
+ }
94
+ ?>
95
+ </select>
96
+ </p>
97
+ <p>
98
+ <label for="<?php echo $this->get_field_id( 'avatar' ); ?>"><?php _e( 'Display profile image?', 'twitter-widget-pro' ); ?></label>
99
+ <select id="<?php echo $this->get_field_id( 'avatar' ); ?>" name="<?php echo $this->get_field_name( 'avatar' ); ?>">
100
+ <option value=""<?php selected( $instance['avatar'], '' ) ?>><?php _e( 'Do not show', 'twitter-widget-pro' ); ?></option>
101
+ <option value="mini"<?php selected( $instance['avatar'], 'mini' ) ?>><?php _e( 'Mini - 24px by 24px', 'twitter-widget-pro' ); ?></option>
102
+ <option value="normal"<?php selected( $instance['avatar'], 'normal' ) ?>><?php _e( 'Normal - 48px by 48px', 'twitter-widget-pro' ); ?></option>
103
+ <option value="bigger"<?php selected( $instance['avatar'], 'bigger' ) ?>><?php _e( 'Bigger - 73px by 73px', 'twitter-widget-pro' ); ?></option>
104
+ <option value="original"<?php selected( $instance['avatar'], 'original' ) ?>><?php _e( 'Original', 'twitter-widget-pro' ); ?></option>
105
+ </select>
106
+ </p>
107
+ <p>
108
+ <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'showretweets' ); ?>" />
109
+ <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'showretweets' ); ?>" name="<?php echo $this->get_field_name( 'showretweets' ); ?>"<?php checked( $instance['showretweets'], 'true' ); ?> />
110
+ <label for="<?php echo $this->get_field_id( 'showretweets' ); ?>"><?php _e( 'Include retweets', 'twitter-widget-pro' ); ?></label>
111
+ </p>
112
+ <p>
113
+ <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'hidereplies' ); ?>" />
114
+ <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'hidereplies' ); ?>" name="<?php echo $this->get_field_name( 'hidereplies' ); ?>"<?php checked( $instance['hidereplies'], 'true' ); ?> />
115
+ <label for="<?php echo $this->get_field_id( 'hidereplies' ); ?>"><?php _e( 'Hide @replies', 'twitter-widget-pro' ); ?></label>
116
+ </p>
117
+ <p>
118
+ <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'hidefrom' ); ?>" />
119
+ <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'hidefrom' ); ?>" name="<?php echo $this->get_field_name( 'hidefrom' ); ?>"<?php checked( $instance['hidefrom'], 'true' ); ?> />
120
+ <label for="<?php echo $this->get_field_id( 'hidefrom' ); ?>"><?php _e( 'Hide sending applications', 'twitter-widget-pro' ); ?></label>
121
+ </p>
122
+ <p>
123
+ <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'showintents' ); ?>" />
124
+ <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'showintents' ); ?>" name="<?php echo $this->get_field_name( 'showintents' ); ?>"<?php checked( $instance['showintents'], 'true' ); ?> />
125
+ <label for="<?php echo $this->get_field_id( 'showintents' ); ?>"><?php _e( 'Show Tweet Intents (reply, retweet, favorite)', 'twitter-widget-pro' ); ?></label>
126
+ </p>
127
+ <p>
128
+ <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'showfollow' ); ?>" />
129
+ <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'showfollow' ); ?>" name="<?php echo $this->get_field_name( 'showfollow' ); ?>"<?php checked( $instance['showfollow'], 'true' ); ?> />
130
+ <label for="<?php echo $this->get_field_id( 'showfollow' ); ?>"><?php _e( 'Show Follow Link', 'twitter-widget-pro' ); ?></label>
131
+ </p>
132
+ <p>
133
+ <label for="<?php echo $this->get_field_id( 'errmsg' ); ?>"><?php _e( 'What to display when Twitter is down ( optional ):', 'twitter-widget-pro' ); ?></label>
134
+ <input class="widefat" id="<?php echo $this->get_field_id( 'errmsg' ); ?>" name="<?php echo $this->get_field_name( 'errmsg' ); ?>" type="text" value="<?php esc_attr_e( $instance['errmsg'] ); ?>" />
135
+ </p>
136
+ <p>
137
+ <label for="<?php echo $this->get_field_id( 'showts' ); ?>"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', 'twitter-widget-pro' ); ?></label>
138
+ <select id="<?php echo $this->get_field_id( 'showts' ); ?>" name="<?php echo $this->get_field_name( 'showts' ); ?>">
139
+ <option value="0" <?php selected( $instance['showts'], '0' ); ?>><?php _e( 'Always', 'twitter-widget-pro' );?></option>
140
+ <option value="3600" <?php selected( $instance['showts'], '3600' ); ?>><?php _e( 'If over an hour old', 'twitter-widget-pro' );?></option>
141
+ <option value="86400" <?php selected( $instance['showts'], '86400' ); ?>><?php _e( 'If over a day old', 'twitter-widget-pro' );?></option>
142
+ <option value="604800" <?php selected( $instance['showts'], '604800' ); ?>><?php _e( 'If over a week old', 'twitter-widget-pro' );?></option>
143
+ <option value="2592000" <?php selected( $instance['showts'], '2592000' ); ?>><?php _e( 'If over a month old', 'twitter-widget-pro' );?></option>
144
+ <option value="31536000" <?php selected( $instance['showts'], '31536000' ); ?>><?php _e( 'If over a year old', 'twitter-widget-pro' );?></option>
145
+ <option value="-1" <?php selected( $instance['showts'], '-1' ); ?>><?php _e( 'Never', 'twitter-widget-pro' );?></option>
146
+ </select>
147
+ </p>
148
+ <p>
149
+ <label for="<?php echo $this->get_field_id( 'dateFormat' ); ?>"><?php echo sprintf( __( 'Format to display the date in, uses <a href="%s">PHP date()</a> format:', 'twitter-widget-pro' ), 'http://php.net/date' ); ?></label>
150
+ <input class="widefat" id="<?php echo $this->get_field_id( 'dateFormat' ); ?>" name="<?php echo $this->get_field_name( 'dateFormat' ); ?>" type="text" value="<?php esc_attr_e( $instance['dateFormat'] ); ?>" />
151
+ </p>
152
+ <p>
153
+ <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'targetBlank' ); ?>" />
154
+ <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'targetBlank' ); ?>" name="<?php echo $this->get_field_name( 'targetBlank' ); ?>"<?php checked( $instance['targetBlank'], 'true' ); ?> />
155
+ <label for="<?php echo $this->get_field_id( 'targetBlank' ); ?>"><?php _e( 'Open links in a new window', 'twitter-widget-pro' ); ?></label>
156
+ </p>
157
+ <p><?php echo $wpTwitterWidget->get_support_forum_link(); ?></p>
158
+ <script type="text/javascript">
159
+ jQuery( '#<?php echo $this->get_field_id( 'username' ) ?>' ).on( 'change', function() {
160
+ jQuery('#<?php echo $this->get_field_id( 'list' ) ?>' ).val(0);
161
+ });
162
+ jQuery( '#<?php echo $this->get_field_id( 'list' ) ?>' ).on( 'change', function() {
163
+ jQuery('#<?php echo $this->get_field_id( 'username' ) ?>' ).val(0);
164
+ });
165
+ </script>
166
+ <?php
167
+ return;
168
+ }
169
+
170
+ public function update( $new_instance, $old_instance ) {
171
+ $instance = $this->_getInstanceSettings( $new_instance );
172
+
173
+ // Clean up the free-form areas
174
+ $instance['title'] = stripslashes( $new_instance['title'] );
175
+ $instance['errmsg'] = stripslashes( $new_instance['errmsg'] );
176
+
177
+ // If the current user isn't allowed to use unfiltered HTML, filter it
178
+ if ( !current_user_can( 'unfiltered_html' ) ) {
179
+ $instance['title'] = strip_tags( $new_instance['title'] );
180
+ $instance['errmsg'] = strip_tags( $new_instance['errmsg'] );
181
+ }
182
+
183
+ return $instance;
184
+ }
185
+
186
+ public function flush_widget_cache() {
187
+ wp_cache_delete( 'widget_twitter_widget_pro', 'widget' );
188
+ }
189
+
190
+ public function widget( $args, $instance ) {
191
+ $instance = $this->_getInstanceSettings( $instance );
192
+ $wpTwitterWidget = wpTwitterWidget::getInstance();
193
+ echo $wpTwitterWidget->display( wp_parse_args( $instance, $args ) );
194
+ }
195
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: twitter, widget, feed
5
  Requires at least: 3.0
6
  Tested up to: 4.3
7
- Stable tag: 2.7.0
8
 
9
  A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links.
10
 
@@ -12,8 +12,7 @@ A widget that properly handles twitter feeds, including parsing @username, #hash
12
 
13
  A widget that properly handles twitter feeds, including parsing @username, #hashtag, and URLs into links. It supports displaying profiles images, and even lets you control whether to display the time and date of a tweet or how log ago it happened (about 5 hours ago, etc).
14
 
15
- <a href="http://ran.ge/wordpress-plugin/twitter-widget-pro/">Twitter Widget Pro</a>
16
- Brought to you by <a href="http://ran.ge/" title="WordPress Development">Ran.ge</a>
17
 
18
  == Installation ==
19
 
@@ -120,7 +119,7 @@ There are plenty of CSS classes throughout the HTML that is generated, and you c
120
 
121
  = Why can't I display a friends feed anymore? =
122
 
123
- Aparently the database queries required to display the friends feed was causing twitter to crash, so they removed it. Unfortunately, this is outside my control.
124
 
125
  == Screenshots ==
126
 
@@ -131,6 +130,9 @@ Aparently the database queries required to display the friends feed was causing
131
 
132
  == Upgrade Notice ==
133
 
 
 
 
134
  = 2.7.0 =
135
  Updates to avoid notices in WordPress 4.3 and PHP 7
136
 
@@ -154,6 +156,11 @@ Upgrade to the new Twitter API and add support for lists
154
 
155
  == Changelog ==
156
 
 
 
 
 
 
157
  = 2.7.0 =
158
  * Use __contrsuct instead of WP_Widget->WP_Widget
159
  * Move away from Range
4
  Tags: twitter, widget, feed
5
  Requires at least: 3.0
6
  Tested up to: 4.3
7
+ Stable tag: 2.8.0
8
 
9
  A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links.
10
 
12
 
13
  A widget that properly handles twitter feeds, including parsing @username, #hashtag, and URLs into links. It supports displaying profiles images, and even lets you control whether to display the time and date of a tweet or how log ago it happened (about 5 hours ago, etc).
14
 
15
+ <a href="http://aarondcampbell.com/wordpress-plugin/twitter-widget-pro/">Twitter Widget Pro</a>
 
16
 
17
  == Installation ==
18
 
119
 
120
  = Why can't I display a friends feed anymore? =
121
 
122
+ Apparently the database queries required to display the friends feed was causing twitter to crash, so they removed it. Unfortunately, this is outside my control.
123
 
124
  == Screenshots ==
125
 
130
 
131
  == Upgrade Notice ==
132
 
133
+ = 2.8.0 =
134
+ Updates to make the plugin translatable with the new translate.wordpress.org
135
+
136
  = 2.7.0 =
137
  Updates to avoid notices in WordPress 4.3 and PHP 7
138
 
156
 
157
  == Changelog ==
158
 
159
+ = 2.8.0 =
160
+ * Move to a static text domain
161
+ * Move away from my plugin framework
162
+ * Fix a leftover Range link
163
+
164
  = 2.7.0 =
165
  * Use __contrsuct instead of WP_Widget->WP_Widget
166
  * Move away from Range
wp-twitter-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Twitter Widget Pro
4
  * Plugin URI: https://aarondcampbell.com/wordpress-plugin/twitter-widget-pro/
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: 2.7.0
7
  * Author: Aaron D. Campbell
8
  * Author URI: https://aarondcampbell.com/
9
  * License: GPLv2 or later
@@ -29,235 +29,96 @@
29
  */
30
 
31
  require_once( 'tlc-transients.php' );
32
- require_once( 'aaron-plugin-framework.php' );
33
- define( 'TWP_VERSION', '2.7.0' );
34
 
35
  /**
36
- * WP_Widget_Twitter_Pro is the class that handles the main widget.
 
 
37
  */
38
- class WP_Widget_Twitter_Pro extends WP_Widget {
39
- public function __construct () {
40
- $this->_slug = 'twitter-widget-pro';
41
- $wpTwitterWidget = wpTwitterWidget::getInstance();
42
- $widget_ops = array(
43
- 'classname' => 'widget_twitter',
44
- 'description' => __( 'Follow a Twitter Feed', $wpTwitterWidget->get_slug() )
45
- );
46
- $control_ops = array(
47
- 'width' => 400,
48
- 'height' => 350,
49
- 'id_base' => 'twitter'
50
- );
51
- $name = __( 'Twitter Widget Pro', $wpTwitterWidget->get_slug() );
52
 
53
- parent::__construct( 'twitter', $name, $widget_ops, $control_ops );
54
- }
 
 
55
 
56
- private function _getInstanceSettings ( $instance ) {
57
- $wpTwitterWidget = wpTwitterWidget::getInstance();
58
- return $wpTwitterWidget->getSettings( $instance );
59
- }
60
 
61
- public function form( $instance ) {
62
- $instance = $this->_getInstanceSettings( $instance );
63
- $wpTwitterWidget = wpTwitterWidget::getInstance();
64
- $users = $wpTwitterWidget->get_users_list( true );
65
- $lists = $wpTwitterWidget->get_lists();
66
-
67
- ?>
68
- <p>
69
- <label for="<?php echo $this->get_field_id( 'username' ); ?>"><?php _e( 'Twitter username:', $this->_slug ); ?></label>
70
- <select id="<?php echo $this->get_field_id( 'username' ); ?>" name="<?php echo $this->get_field_name( 'username' ); ?>">
71
- <option></option>
72
- <?php
73
- $selected = false;
74
- foreach ( $users as $u ) {
75
- ?>
76
- <option value="<?php echo esc_attr( strtolower( $u['screen_name'] ) ); ?>"<?php $s = selected( strtolower( $u['screen_name'] ), strtolower( $instance['username'] ) ) ?>><?php echo esc_html( $u['screen_name'] ); ?></option>
77
- <?php
78
- if ( ! empty( $s ) )
79
- $selected = true;
80
- }
81
- ?>
82
- </select>
83
- </p>
84
- <p>
85
- <label for="<?php echo $this->get_field_id( 'list' ); ?>"><?php _e( 'Twitter list:', $this->_slug ); ?></label>
86
- <select id="<?php echo $this->get_field_id( 'list' ); ?>" name="<?php echo $this->get_field_name( 'list' ); ?>">
87
- <option></option>
88
- <?php
89
- foreach ( $lists as $user => $user_lists ) {
90
- echo '<optgroup label="' . esc_attr( $user ) . '">';
91
- foreach ( $user_lists as $list_id => $list_name ) {
92
- ?>
93
- <option value="<?php echo esc_attr( $user . '::' . $list_id ); ?>"<?php $s = selected( $user . '::' . $list_id, strtolower( $instance['list'] ) ) ?>><?php echo esc_html( $list_name ); ?></option>
94
- <?php
95
- }
96
- echo '</optgroup>';
97
- }
98
- ?>
99
- </select>
100
- </p>
101
- <?php
102
- if ( ! $selected && ! empty( $instance['username'] ) ) {
103
- $query_args = array(
104
- 'action' => 'authorize',
105
- 'screen_name' => $instance['username'],
106
- );
107
- $authorize_user_url = wp_nonce_url( add_query_arg( $query_args, $wpTwitterWidget->get_options_url() ), 'authorize' );
108
- ?>
109
- <p>
110
- <a href="<?php echo esc_url( $authorize_user_url ); ?>" style="color:red;">
111
- <?php _e( 'You need to authorize this account.', $this->_slug ); ?>
112
- </a>
113
- </p>
114
- <?php
115
- }
116
- ?>
117
- <p>
118
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Give the feed a title ( optional ):', $this->_slug ); ?></label>
119
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $instance['title'] ); ?>" />
120
- </p>
121
- <p>
122
- <label for="<?php echo $this->get_field_id( 'items' ); ?>"><?php _e( 'How many items would you like to display?', $this->_slug ); ?></label>
123
- <select id="<?php echo $this->get_field_id( 'items' ); ?>" name="<?php echo $this->get_field_name( 'items' ); ?>">
124
- <?php
125
- for ( $i = 1; $i <= 20; ++$i ) {
126
- echo "<option value='$i' ". selected( $instance['items'], $i, false ). ">$i</option>";
127
- }
128
- ?>
129
- </select>
130
- </p>
131
- <p>
132
- <label for="<?php echo $this->get_field_id( 'avatar' ); ?>"><?php _e( 'Display profile image?', $this->_slug ); ?></label>
133
- <select id="<?php echo $this->get_field_id( 'avatar' ); ?>" name="<?php echo $this->get_field_name( 'avatar' ); ?>">
134
- <option value=""<?php selected( $instance['avatar'], '' ) ?>><?php _e( 'Do not show', $this->_slug ); ?></option>
135
- <option value="mini"<?php selected( $instance['avatar'], 'mini' ) ?>><?php _e( 'Mini - 24px by 24px', $this->_slug ); ?></option>
136
- <option value="normal"<?php selected( $instance['avatar'], 'normal' ) ?>><?php _e( 'Normal - 48px by 48px', $this->_slug ); ?></option>
137
- <option value="bigger"<?php selected( $instance['avatar'], 'bigger' ) ?>><?php _e( 'Bigger - 73px by 73px', $this->_slug ); ?></option>
138
- <option value="original"<?php selected( $instance['avatar'], 'original' ) ?>><?php _e( 'Original', $this->_slug ); ?></option>
139
- </select>
140
- </p>
141
- <p>
142
- <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'showretweets' ); ?>" />
143
- <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'showretweets' ); ?>" name="<?php echo $this->get_field_name( 'showretweets' ); ?>"<?php checked( $instance['showretweets'], 'true' ); ?> />
144
- <label for="<?php echo $this->get_field_id( 'showretweets' ); ?>"><?php _e( 'Include retweets', $this->_slug ); ?></label>
145
- </p>
146
- <p>
147
- <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'hidereplies' ); ?>" />
148
- <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'hidereplies' ); ?>" name="<?php echo $this->get_field_name( 'hidereplies' ); ?>"<?php checked( $instance['hidereplies'], 'true' ); ?> />
149
- <label for="<?php echo $this->get_field_id( 'hidereplies' ); ?>"><?php _e( 'Hide @replies', $this->_slug ); ?></label>
150
- </p>
151
- <p>
152
- <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'hidefrom' ); ?>" />
153
- <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'hidefrom' ); ?>" name="<?php echo $this->get_field_name( 'hidefrom' ); ?>"<?php checked( $instance['hidefrom'], 'true' ); ?> />
154
- <label for="<?php echo $this->get_field_id( 'hidefrom' ); ?>"><?php _e( 'Hide sending applications', $this->_slug ); ?></label>
155
- </p>
156
- <p>
157
- <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'showintents' ); ?>" />
158
- <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'showintents' ); ?>" name="<?php echo $this->get_field_name( 'showintents' ); ?>"<?php checked( $instance['showintents'], 'true' ); ?> />
159
- <label for="<?php echo $this->get_field_id( 'showintents' ); ?>"><?php _e( 'Show Tweet Intents (reply, retweet, favorite)', $this->_slug ); ?></label>
160
- </p>
161
- <p>
162
- <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'showfollow' ); ?>" />
163
- <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'showfollow' ); ?>" name="<?php echo $this->get_field_name( 'showfollow' ); ?>"<?php checked( $instance['showfollow'], 'true' ); ?> />
164
- <label for="<?php echo $this->get_field_id( 'showfollow' ); ?>"><?php _e( 'Show Follow Link', $this->_slug ); ?></label>
165
- </p>
166
- <p>
167
- <label for="<?php echo $this->get_field_id( 'errmsg' ); ?>"><?php _e( 'What to display when Twitter is down ( optional ):', $this->_slug ); ?></label>
168
- <input class="widefat" id="<?php echo $this->get_field_id( 'errmsg' ); ?>" name="<?php echo $this->get_field_name( 'errmsg' ); ?>" type="text" value="<?php esc_attr_e( $instance['errmsg'] ); ?>" />
169
- </p>
170
- <p>
171
- <label for="<?php echo $this->get_field_id( 'showts' ); ?>"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', $this->_slug ); ?></label>
172
- <select id="<?php echo $this->get_field_id( 'showts' ); ?>" name="<?php echo $this->get_field_name( 'showts' ); ?>">
173
- <option value="0" <?php selected( $instance['showts'], '0' ); ?>><?php _e( 'Always', $this->_slug );?></option>
174
- <option value="3600" <?php selected( $instance['showts'], '3600' ); ?>><?php _e( 'If over an hour old', $this->_slug );?></option>
175
- <option value="86400" <?php selected( $instance['showts'], '86400' ); ?>><?php _e( 'If over a day old', $this->_slug );?></option>
176
- <option value="604800" <?php selected( $instance['showts'], '604800' ); ?>><?php _e( 'If over a week old', $this->_slug );?></option>
177
- <option value="2592000" <?php selected( $instance['showts'], '2592000' ); ?>><?php _e( 'If over a month old', $this->_slug );?></option>
178
- <option value="31536000" <?php selected( $instance['showts'], '31536000' ); ?>><?php _e( 'If over a year old', $this->_slug );?></option>
179
- <option value="-1" <?php selected( $instance['showts'], '-1' ); ?>><?php _e( 'Never', $this->_slug );?></option>
180
- </select>
181
- </p>
182
- <p>
183
- <label for="<?php echo $this->get_field_id( 'dateFormat' ); ?>"><?php echo sprintf( __( 'Format to display the date in, uses <a href="%s">PHP date()</a> format:', $this->_slug ), 'http://php.net/date' ); ?></label>
184
- <input class="widefat" id="<?php echo $this->get_field_id( 'dateFormat' ); ?>" name="<?php echo $this->get_field_name( 'dateFormat' ); ?>" type="text" value="<?php esc_attr_e( $instance['dateFormat'] ); ?>" />
185
- </p>
186
- <p>
187
- <input type="hidden" value="false" name="<?php echo $this->get_field_name( 'targetBlank' ); ?>" />
188
- <input class="checkbox" type="checkbox" value="true" id="<?php echo $this->get_field_id( 'targetBlank' ); ?>" name="<?php echo $this->get_field_name( 'targetBlank' ); ?>"<?php checked( $instance['targetBlank'], 'true' ); ?> />
189
- <label for="<?php echo $this->get_field_id( 'targetBlank' ); ?>"><?php _e( 'Open links in a new window', $this->_slug ); ?></label>
190
- </p>
191
- <p><?php echo $wpTwitterWidget->get_support_forum_link(); ?></p>
192
- <script type="text/javascript">
193
- jQuery( '#<?php echo $this->get_field_id( 'username' ) ?>' ).on( 'change', function() {
194
- jQuery('#<?php echo $this->get_field_id( 'list' ) ?>' ).val(0);
195
- });
196
- jQuery( '#<?php echo $this->get_field_id( 'list' ) ?>' ).on( 'change', function() {
197
- jQuery('#<?php echo $this->get_field_id( 'username' ) ?>' ).val(0);
198
- });
199
- </script>
200
- <?php
201
- return;
202
- }
203
 
204
- public function update( $new_instance, $old_instance ) {
205
- $instance = $this->_getInstanceSettings( $new_instance );
 
 
206
 
207
- // Clean up the free-form areas
208
- $instance['title'] = stripslashes( $new_instance['title'] );
209
- $instance['errmsg'] = stripslashes( $new_instance['errmsg'] );
 
210
 
211
- // If the current user isn't allowed to use unfiltered HTML, filter it
212
- if ( !current_user_can( 'unfiltered_html' ) ) {
213
- $instance['title'] = strip_tags( $new_instance['title'] );
214
- $instance['errmsg'] = strip_tags( $new_instance['errmsg'] );
215
- }
216
 
217
- return $instance;
218
- }
 
 
219
 
220
- public function flush_widget_cache() {
221
- wp_cache_delete( 'widget_twitter_widget_pro', 'widget' );
222
- }
 
223
 
224
- public function widget( $args, $instance ) {
225
- $instance = $this->_getInstanceSettings( $instance );
226
- $wpTwitterWidget = wpTwitterWidget::getInstance();
227
- echo $wpTwitterWidget->display( wp_parse_args( $instance, $args ) );
228
- }
229
- }
230
 
 
 
 
 
231
 
232
- /**
233
- * wpTwitterWidget is the class that handles everything outside the widget. This
234
- * includes filters that modify tweet content for things like linked usernames.
235
- * It also helps us avoid name collisions.
236
- */
237
- class wpTwitterWidget extends AaronPlugin {
238
  /**
239
- * @var wpTwitter
240
  */
241
- private $_wp_twitter_oauth;
242
 
243
  /**
244
- * @var wpTwitterWidget - Static property to hold our singleton instance
245
  */
246
- static $instance = false;
 
 
247
 
248
- protected function _init() {
 
 
 
 
249
  require_once( 'lib/wp-twitter.php' );
250
 
251
- $this->_hook = 'twitterWidgetPro';
252
  $this->_file = plugin_basename( __FILE__ );
253
- $this->_pageTitle = __( 'Twitter Widget Pro', $this->_slug );
254
- $this->_menuTitle = __( 'Twitter Widget', $this->_slug );
255
- $this->_accessLevel = 'manage_options';
256
- $this->_optionGroup = 'twp-options';
257
- $this->_optionNames = array( 'twp' );
258
- $this->_optionCallbacks = array();
259
- $this->_slug = 'twitter-widget-pro';
260
- $this->_paypalButtonId = '9993090';
261
 
262
  /**
263
  * Add filters and actions
@@ -270,13 +131,27 @@ class wpTwitterWidget extends AaronPlugin {
270
  add_filter( 'widget_twitter_content', array( $this, 'linkUrls' ) );
271
  add_filter( 'widget_twitter_content', array( $this, 'linkHashtags' ) );
272
  add_filter( 'widget_twitter_content', 'convert_chars' );
273
- add_filter( $this->_slug .'-opt-twp', array( $this, 'filterSettings' ) );
274
- add_filter( $this->_slug .'-opt-twp-authed-users', array( $this, 'authed_users_option' ) );
275
  add_shortcode( 'twitter-widget', array( $this, 'handleShortcodes' ) );
276
 
277
- $twp_version = get_option( 'twp_version' );
278
- if ( TWP_VERSION != $twp_version )
279
- update_option( 'twp_version', TWP_VERSION );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  }
281
 
282
  protected function _post_settings_init() {
@@ -287,7 +162,7 @@ class wpTwitterWidget extends AaronPlugin {
287
  $this->_wp_twitter_oauth = new wpTwitter( $oauth_settings );
288
 
289
  // We want to fill 'twp-authed-users' but not overwrite them when saving
290
- $this->_settings['twp-authed-users'] = apply_filters($this->_slug.'-opt-twp-authed-users', get_option('twp-authed-users'));
291
  }
292
 
293
  /**
@@ -300,10 +175,6 @@ class wpTwitterWidget extends AaronPlugin {
300
  return self::$instance;
301
  }
302
 
303
- public function get_slug() {
304
- return $this->_slug;
305
- }
306
-
307
  public function handle_actions() {
308
  if ( empty( $_GET['action'] ) || empty( $_GET['page'] ) || $_GET['page'] != $this->_hook )
309
  return;
@@ -372,19 +243,19 @@ class wpTwitterWidget extends AaronPlugin {
372
  if ( ! empty( $_GET['message'] ) ) {
373
  if ( 'clear-locks' == $_GET['message'] ) {
374
  if ( empty( $_GET['locks_cleared'] ) || 0 == $_GET['locks_cleared'] )
375
- $msg = __( 'There were no locks to clear!', $this->_slug );
376
  else
377
- $msg = sprintf( _n( 'Successfully cleared %d lock.', 'Successfully cleared %d locks.', $_GET['locks_cleared'], $this->_slug ), $_GET['locks_cleared'] );
378
  } elseif ( 'authorized' == $_GET['message'] ) {
379
  if ( ! empty( $_GET['authorized'] ) )
380
- $msg = sprintf( __( 'Successfully authorized @%s', $this->_slug ), $_GET['authorized'] );
381
  else
382
- $msg = __( 'There was a problem authorizing your account.', $this->_slug );
383
  } elseif ( 'removed' == $_GET['message'] ) {
384
  if ( ! empty( $_GET['removed'] ) )
385
- $msg = sprintf( __( 'Successfully removed @%s', $this->_slug ), $_GET['removed'] );
386
  else
387
- $msg = __( 'There was a problem removing your account.', $this->_slug );
388
  }
389
  if ( ! empty( $msg ) )
390
  echo "<div class='updated'><p>" . esc_html( $msg ) . '</p></div>';
@@ -396,20 +267,20 @@ class wpTwitterWidget extends AaronPlugin {
396
  }
397
 
398
  if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
399
- $msg = sprintf( __( 'You need to <a href="%s">set up your Twitter app keys</a>.', $this->_slug ), $this->get_options_url() );
400
  echo '<div class="error"><p>' . $msg . '</p></div>';
401
  }
402
 
403
  if ( empty( $this->_settings['twp-authed-users'] ) ) {
404
- $msg = sprintf( __( 'You need to <a href="%s">authorize your Twitter accounts</a>.', $this->_slug ), $this->get_options_url() );
405
  echo '<div class="error"><p>' . $msg . '</p></div>';
406
  }
407
  }
408
 
409
  public function add_options_meta_boxes() {
410
- add_meta_box( $this->_slug . '-oauth', __( 'Authenticated Twitter Accounts', $this->_slug ), array( $this, 'oauth_meta_box' ), 'aaron-' . $this->_slug, 'main' );
411
- add_meta_box( $this->_slug . '-general-settings', __( 'General Settings', $this->_slug ), array( $this, 'general_settings_meta_box' ), 'aaron-' . $this->_slug, 'main' );
412
- add_meta_box( $this->_slug . '-defaults', __( 'Default Settings for Shortcodes', $this->_slug ), array( $this, 'default_settings_meta_box' ), 'aaron-' . $this->_slug, 'main' );
413
  }
414
 
415
  public function oauth_meta_box() {
@@ -420,13 +291,13 @@ class wpTwitterWidget extends AaronPlugin {
420
  <thead>
421
  <tr valign="top">
422
  <th scope="row">
423
- <?php _e( 'Username', $this->_slug );?>
424
  </th>
425
  <th scope="row">
426
- <?php _e( 'Lists Rate Usage', $this->_slug );?>
427
  </th>
428
  <th scope="row">
429
- <?php _e( 'Statuses Rate Usage', $this->_slug );?>
430
  </th>
431
  </tr>
432
  </thead>
@@ -442,7 +313,7 @@ class wpTwitterWidget extends AaronPlugin {
442
  );
443
  $authorize_user_url = wp_nonce_url( add_query_arg( $query_args ), 'authorize' );
444
  $style = 'color:red;';
445
- $auth_link = ' - <a href="' . esc_url( $authorize_user_url ) . '">' . __( 'Reauthorize', $this->_slug ) . '</a>';
446
  }
447
  $query_args = array(
448
  'action' => 'remove',
@@ -453,26 +324,26 @@ class wpTwitterWidget extends AaronPlugin {
453
  <tr valign="top">
454
  <th scope="row" style="<?php echo esc_attr( $style ); ?>">
455
  <strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link;?></strong>
456
- <br /><a href="<?php echo esc_url( $remove_user_url ) ?>"><?php _e( 'Remove', $this->_slug ) ?></a>
457
  </th>
458
  <?php
459
  if ( ! is_wp_error( $rates ) ) {
460
  $display_rates = array(
461
- __( 'Lists', $this->_slug ) => $rates->resources->lists->{'/lists/statuses'},
462
- __( 'Statuses', $this->_slug ) => $rates->resources->statuses->{'/statuses/user_timeline'},
463
  );
464
  foreach ( $display_rates as $title => $rate ) {
465
  ?>
466
  <td>
467
  <strong><?php echo esc_html( $title ); ?></strong>
468
  <p>
469
- <?php echo sprintf( __( 'Used: %d', $this->_slug ), $rate->limit - $rate->remaining ); ?><br />
470
- <?php echo sprintf( __( 'Remaining: %d', $this->_slug ), $rate->remaining ); ?><br />
471
  <?php
472
  $minutes = ceil( ( $rate->reset - gmdate( 'U' ) ) / 60 );
473
- echo sprintf( _n( 'Limits reset in: %d minutes', 'Limits reset in: %d minutes', $minutes, $this->_slug ), $minutes );
474
  ?><br />
475
- <small><?php _e( 'This is overall usage, not just usage from Twitter Widget Pro', $this->_slug ); ?></small>
476
  </p>
477
  </td>
478
  <?php
@@ -480,10 +351,10 @@ class wpTwitterWidget extends AaronPlugin {
480
  } else {
481
  ?>
482
  <td>
483
- <p><?php _e( 'There was an error checking your rate limit.', $this->_slug ); ?></p>
484
  </td>
485
  <td>
486
- <p><?php _e( 'There was an error checking your rate limit.', $this->_slug ); ?></p>
487
  </td>
488
  <?php
489
  }
@@ -497,13 +368,13 @@ class wpTwitterWidget extends AaronPlugin {
497
  if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
498
  ?>
499
  <p>
500
- <strong><?php _e( 'You need to fill in the Consumer key and Consumer secret before you can authorize accounts.', $this->_slug ) ?></strong>
501
  </p>
502
  <?php
503
  } else {
504
  ?>
505
  <p>
506
- <a href="<?php echo esc_url( $authorize_url );?>" class="button button-large button-primary"><?php _e( 'Authorize New Account', $this->_slug ); ?></a>
507
  </p>
508
  <?php
509
  }
@@ -514,7 +385,7 @@ class wpTwitterWidget extends AaronPlugin {
514
  <table class="form-table">
515
  <tr valign="top">
516
  <th scope="row">
517
- <label for="twp_consumer_key"><?php _e( 'Consumer key', $this->_slug );?></label>
518
  </th>
519
  <td>
520
  <input id="twp_consumer_key" name="twp[consumer-key]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['consumer-key'] ); ?>" size="40" />
@@ -522,7 +393,7 @@ class wpTwitterWidget extends AaronPlugin {
522
  </tr>
523
  <tr valign="top">
524
  <th scope="row">
525
- <label for="twp_consumer_secret"><?php _e( 'Consumer secret', $this->_slug );?></label>
526
  </th>
527
  <td>
528
  <input id="twp_consumer_secret" name="twp[consumer-secret]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['consumer-secret'] ); ?>" size="40" />
@@ -534,9 +405,9 @@ class wpTwitterWidget extends AaronPlugin {
534
  <tr valign="top">
535
  <th scope="row">&nbsp;</th>
536
  <td>
537
- <strong><?php _e( 'Directions to get the Consumer Key and Consumer Secret', $this->_slug ) ?></strong>
538
  <ol>
539
- <li><a href="https://dev.twitter.com/apps/new"><?php _e( 'Add a new Twitter application', $this->_slug ) ?></a></li>
540
  <li><?php _e( "Fill in Name, Description, Website, and Callback URL (don't leave any blank) with anything you want" ) ?></a></li>
541
  <li><?php _e( "Agree to rules, fill out captcha, and submit your application" ) ?></a></li>
542
  <li><?php _e( "Copy the Consumer key and Consumer secret into the fields above" ) ?></a></li>
@@ -549,16 +420,16 @@ class wpTwitterWidget extends AaronPlugin {
549
  ?>
550
  <tr>
551
  <th scope="row">
552
- <?php _e( "Clear Update Locks", $this->_slug );?>
553
  </th>
554
  <td>
555
- <a href="<?php echo esc_url( $clear_locks_url ); ?>"><?php _e( 'Clear Update Locks', $this->_slug ); ?></a><br />
556
- <small><?php _e( "A small percentage of servers seem to have issues where an update lock isn't getting cleared. If you're experiencing issues with your feed not updating, try clearing the update locks.", $this->_slug ); ?></small>
557
  </td>
558
  </tr>
559
  <tr>
560
  <th scope="row">
561
- <?php _e( 'Local requests:', $this->_slug ); ?>
562
  </th>
563
  <td>
564
  <?php
@@ -569,11 +440,11 @@ class wpTwitterWidget extends AaronPlugin {
569
  $resp = wp_remote_post( $server_url, array( 'body' => array( '_twp-test-local-request' => 'test' ), 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );
570
  if ( !is_wp_error( $resp ) && $resp['response']['code'] >= 200 && $resp['response']['code'] < 300 ) {
571
  if ( 'success' === wp_remote_retrieve_body( $resp ) )
572
- _e( '<p style="color:green;">Local requests appear to be functioning normally.</p>', $this->_slug );
573
  else
574
- _e( '<p style="color:red;">The request went through, but an unexpected response was received.</p>', $this->_slug );
575
  } else {
576
- printf( __( '<p style="color:red;">Failed. Your server said: %s</p>', $this->_slug ), $resp['response']['message'] );
577
  }
578
  }
579
  $query_args = array(
@@ -582,9 +453,9 @@ class wpTwitterWidget extends AaronPlugin {
582
  $test_local_url = wp_nonce_url( add_query_arg( $query_args, $this->get_options_url() ), 'test-local-request' );
583
  ?>
584
  <a href="<?php echo esc_url( $test_local_url ); ?>" class="button">
585
- <?php _e( 'Test local requests', $this->_slug ); ?>
586
  </a><br />
587
- <small><?php _e( "Twitter Widget Pro updates tweets in the background by placing a local request to your server. If your Tweets aren't updating, test this. If it fails, let your host know that loopback requests aren't working on your site.", $this->_slug ); ?></small>
588
  </td>
589
  </tr>
590
  </table>
@@ -594,11 +465,11 @@ class wpTwitterWidget extends AaronPlugin {
594
  $users = $this->get_users_list( true );
595
  $lists = $this->get_lists();
596
  ?>
597
- <p><?php _e( 'These settings are the default for the shortcodes and all of them can be overridden by specifying a different value in the shortcode itself. All settings for widgets are locate in the individual widget.', $this->_slug ) ?></p>
598
  <table class="form-table">
599
  <tr valign="top">
600
  <th scope="row">
601
- <label for="twp_username"><?php _e( 'Twitter username:', $this->_slug ); ?></label>
602
  </th>
603
  <td>
604
  <select id="twp_username" name="twp[username]">
@@ -624,7 +495,7 @@ class wpTwitterWidget extends AaronPlugin {
624
  ?>
625
  <p>
626
  <a href="<?php echo esc_url( $authorize_user_url ); ?>" style="color:red;">
627
- <?php _e( 'You need to authorize this account.', $this->_slug ); ?>
628
  </a>
629
  </p>
630
  <?php
@@ -634,7 +505,7 @@ class wpTwitterWidget extends AaronPlugin {
634
  </tr>
635
  <tr valign="top">
636
  <th scope="row">
637
- <label for="twp_list"><?php _e( 'Twitter list:', $this->_slug ); ?></label>
638
  </th>
639
  <td>
640
  <select id="twp_list" name="twp[list]">
@@ -655,7 +526,7 @@ class wpTwitterWidget extends AaronPlugin {
655
  </tr>
656
  <tr valign="top">
657
  <th scope="row">
658
- <label for="twp_title"><?php _e( 'Give the feed a title ( optional ):', $this->_slug ); ?></label>
659
  </th>
660
  <td>
661
  <input id="twp_title" name="twp[title]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['title'] ); ?>" size="40" />
@@ -663,7 +534,7 @@ class wpTwitterWidget extends AaronPlugin {
663
  </tr>
664
  <tr valign="top">
665
  <th scope="row">
666
- <label for="twp_items"><?php _e( 'How many items would you like to display?', $this->_slug ); ?></label>
667
  </th>
668
  <td>
669
  <select id="twp_items" name="twp[items]">
@@ -677,21 +548,21 @@ class wpTwitterWidget extends AaronPlugin {
677
  </tr>
678
  <tr valign="top">
679
  <th scope="row">
680
- <label for="twp_avatar"><?php _e( 'Display profile image?', $this->_slug ); ?></label>
681
  </th>
682
  <td>
683
  <select id="twp_avatar" name="twp[avatar]">
684
- <option value=""<?php selected( $this->_settings['twp']['avatar'], '' ) ?>><?php _e( 'Do not show', $this->_slug ); ?></option>
685
- <option value="mini"<?php selected( $this->_settings['twp']['avatar'], 'mini' ) ?>><?php _e( 'Mini - 24px by 24px', $this->_slug ); ?></option>
686
- <option value="normal"<?php selected( $this->_settings['twp']['avatar'], 'normal' ) ?>><?php _e( 'Normal - 48px by 48px', $this->_slug ); ?></option>
687
- <option value="bigger"<?php selected( $this->_settings['twp']['avatar'], 'bigger' ) ?>><?php _e( 'Bigger - 73px by 73px', $this->_slug ); ?></option>
688
- <option value="original"<?php selected( $this->_settings['twp']['avatar'], 'original' ) ?>><?php _e( 'Original', $this->_slug ); ?></option>
689
  </select>
690
  </td>
691
  </tr>
692
  <tr valign="top">
693
  <th scope="row">
694
- <label for="twp_errmsg"><?php _e( 'What to display when Twitter is down ( optional ):', $this->_slug ); ?></label>
695
  </th>
696
  <td>
697
  <input id="twp_errmsg" name="twp[errmsg]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['errmsg'] ); ?>" size="40" />
@@ -699,23 +570,23 @@ class wpTwitterWidget extends AaronPlugin {
699
  </tr>
700
  <tr valign="top">
701
  <th scope="row">
702
- <label for="twp_showts"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', $this->_slug ); ?></label>
703
  </th>
704
  <td>
705
  <select id="twp_showts" name="twp[showts]">
706
- <option value="0" <?php selected( $this->_settings['twp']['showts'], '0' ); ?>><?php _e( 'Always', $this->_slug );?></option>
707
- <option value="3600" <?php selected( $this->_settings['twp']['showts'], '3600' ); ?>><?php _e( 'If over an hour old', $this->_slug );?></option>
708
- <option value="86400" <?php selected( $this->_settings['twp']['showts'], '86400' ); ?>><?php _e( 'If over a day old', $this->_slug );?></option>
709
- <option value="604800" <?php selected( $this->_settings['twp']['showts'], '604800' ); ?>><?php _e( 'If over a week old', $this->_slug );?></option>
710
- <option value="2592000" <?php selected( $this->_settings['twp']['showts'], '2592000' ); ?>><?php _e( 'If over a month old', $this->_slug );?></option>
711
- <option value="31536000" <?php selected( $this->_settings['twp']['showts'], '31536000' ); ?>><?php _e( 'If over a year old', $this->_slug );?></option>
712
- <option value="-1" <?php selected( $this->_settings['twp']['showts'], '-1' ); ?>><?php _e( 'Never', $this->_slug );?></option>
713
  </select>
714
  </td>
715
  </tr>
716
  <tr valign="top">
717
  <th scope="row">
718
- <label for="twp_dateFormat"><?php echo sprintf( __( 'Format to display the date in, uses <a href="%s">PHP date()</a> format:', $this->_slug ), 'http://php.net/date' ); ?></label>
719
  </th>
720
  <td>
721
  <input id="twp_dateFormat" name="twp[dateFormat]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['dateFormat'] ); ?>" size="40" />
@@ -723,32 +594,32 @@ class wpTwitterWidget extends AaronPlugin {
723
  </tr>
724
  <tr valign="top">
725
  <th scope="row">
726
- <?php _e( "Other Setting:", $this->_slug );?>
727
  </th>
728
  <td>
729
  <input type="hidden" value="false" name="twp[showretweets]" />
730
  <input class="checkbox" type="checkbox" value="true" id="twp_showretweets" name="twp[showretweets]"<?php checked( $this->_settings['twp']['showretweets'], 'true' ); ?> />
731
- <label for="twp_showretweets"><?php _e( 'Include retweets', $this->_slug ); ?></label>
732
  <br />
733
  <input type="hidden" value="false" name="twp[hidereplies]" />
734
  <input class="checkbox" type="checkbox" value="true" id="twp_hidereplies" name="twp[hidereplies]"<?php checked( $this->_settings['twp']['hidereplies'], 'true' ); ?> />
735
- <label for="twp_hidereplies"><?php _e( 'Hide @replies', $this->_slug ); ?></label>
736
  <br />
737
  <input type="hidden" value="false" name="twp[hidefrom]" />
738
  <input class="checkbox" type="checkbox" value="true" id="twp_hidefrom" name="twp[hidefrom]"<?php checked( $this->_settings['twp']['hidefrom'], 'true' ); ?> />
739
- <label for="twp_hidefrom"><?php _e( 'Hide sending applications', $this->_slug ); ?></label>
740
  <br />
741
  <input type="hidden" value="false" name="twp[showintents]" />
742
  <input class="checkbox" type="checkbox" value="true" id="twp_showintents" name="twp[showintents]"<?php checked( $this->_settings['twp']['showintents'], 'true' ); ?> />
743
- <label for="twp_showintents"><?php _e( 'Show Tweet Intents (reply, retweet, favorite)', $this->_slug ); ?></label>
744
  <br />
745
  <input type="hidden" value="false" name="twp[showfollow]" />
746
  <input class="checkbox" type="checkbox" value="true" id="twp_showfollow" name="twp[showfollow]"<?php checked( $this->_settings['twp']['showfollow'], 'true' ); ?> />
747
- <label for="twp_showfollow"><?php _e( 'Show Follow Link', $this->_slug ); ?></label>
748
  <br />
749
  <input type="hidden" value="false" name="twp[targetBlank]" />
750
  <input class="checkbox" type="checkbox" value="true" id="twp_targetBlank" name="twp[targetBlank]"<?php checked( $this->_settings['twp']['targetBlank'], 'true' ); ?> />
751
- <label for="twp_targetBlank"><?php _e( 'Open links in a new window', $this->_slug ); ?></label>
752
  </td>
753
  </tr>
754
  </table>
@@ -925,7 +796,7 @@ class wpTwitterWidget extends AaronPlugin {
925
  $widgetContent = $args['before_widget'] . '<div>';
926
 
927
  if ( empty( $args['title'] ) )
928
- $args['title'] = sprintf( __( 'Twitter: %s', $this->_slug ), $args['username'] );
929
 
930
  $args['title'] = apply_filters( 'twitter-widget-title', $args['title'], $args );
931
  $args['title'] = "<span class='twitterwidget twitterwidget-title'>{$args['title']}</span>";
@@ -937,7 +808,7 @@ class wpTwitterWidget extends AaronPlugin {
937
  }
938
  $widgetContent .= '<ul>';
939
  if ( ! is_array( $tweets ) || count( $tweets ) == 0 ) {
940
- $widgetContent .= '<li class="wpTwitterWidgetEmpty">' . __( 'No Tweets Available', $this->_slug ) . '</li>';
941
  } else {
942
  $count = 0;
943
  foreach ( $tweets as $tweet ) {
@@ -955,11 +826,11 @@ class wpTwitterWidget extends AaronPlugin {
955
  $widgetContent .= '</span>';
956
 
957
  if ( 'true' != $args['hidefrom'] ) {
958
- $from = sprintf( __( 'from %s', $this->_slug ), str_replace( '&', '&amp;', $tweet->source ) );
959
  $widgetContent .= " <span class='from-meta'>{$from}</span>";
960
  }
961
  if ( !empty( $tweet->in_reply_to_screen_name ) ) {
962
- $rtLinkText = sprintf( __( 'in reply to %s', $this->_slug ), $tweet->in_reply_to_screen_name );
963
  $widgetContent .= ' <span class="in-reply-to-meta">';
964
  $linkAttrs = array(
965
  'href' => "http://twitter.com/{$tweet->in_reply_to_screen_name}/statuses/{$tweet->in_reply_to_status_id_str}",
@@ -976,19 +847,19 @@ class wpTwitterWidget extends AaronPlugin {
976
  if ( !empty( $lang ) )
977
  $linkAttrs['data-lang'] = $lang;
978
 
979
- $linkText = __( 'Reply', $this->_slug );
980
  $linkAttrs['href'] = "http://twitter.com/intent/tweet?in_reply_to={$tweet->id_str}";
981
  $linkAttrs['class'] = 'in-reply-to';
982
  $linkAttrs['title'] = $linkText;
983
  $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
984
 
985
- $linkText = __( 'Retweet', $this->_slug );
986
  $linkAttrs['href'] = "http://twitter.com/intent/retweet?tweet_id={$tweet->id_str}";
987
  $linkAttrs['class'] = 'retweet';
988
  $linkAttrs['title'] = $linkText;
989
  $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
990
 
991
- $linkText = __( 'Favorite', $this->_slug );
992
  $linkAttrs['href'] = "http://twitter.com/intent/favorite?tweet_id={$tweet->id_str}";
993
  $linkAttrs['class'] = 'favorite';
994
  $linkAttrs['title'] = $linkText;
@@ -1009,7 +880,7 @@ class wpTwitterWidget extends AaronPlugin {
1009
  $linkAttrs = array(
1010
  'href' => "http://twitter.com/{$args['username']}",
1011
  'class' => 'twitter-follow-button',
1012
- 'title' => sprintf( __( 'Follow %s', $this->_slug ), "@{$args['username']}" ),
1013
  );
1014
  $lang = $this->_getTwitterLang();
1015
  if ( !empty( $lang ) )
@@ -1084,7 +955,7 @@ class wpTwitterWidget extends AaronPlugin {
1084
  if ( ! empty( $parameters['screen_name'] ) ) {
1085
  if ( empty( $this->_settings['twp-authed-users'][strtolower( $parameters['screen_name'] )] ) ) {
1086
  if ( empty( $widgetOptions['errmsg'] ) )
1087
- $widgetOptions['errmsg'] = __( 'Account needs to be authorized', $this->_slug );
1088
  } else {
1089
  $this->_wp_twitter_oauth->set_token( $this->_settings['twp-authed-users'][strtolower( $parameters['screen_name'] )] );
1090
  $response = $this->_wp_twitter_oauth->send_authed_request( 'statuses/user_timeline', 'GET', $parameters );
@@ -1102,7 +973,7 @@ class wpTwitterWidget extends AaronPlugin {
1102
  }
1103
 
1104
  if ( empty( $widgetOptions['errmsg'] ) )
1105
- $widgetOptions['errmsg'] = __( 'Invalid Twitter Response.', $this->_slug );
1106
  do_action( 'widget_twitter_parsefeed_error', $response, $parameters, $widgetOptions );
1107
  throw new Exception( $widgetOptions['errmsg'] );
1108
  }
@@ -1184,13 +1055,13 @@ class wpTwitterWidget extends AaronPlugin {
1184
  }
1185
 
1186
  $messages = array(
1187
- 'year' => _n( 'about %s year ago', 'about %s years ago', $count, $this->_slug ),
1188
- 'month' => _n( 'about %s month ago', 'about %s months ago', $count, $this->_slug ),
1189
- 'week' => _n( 'about %s week ago', 'about %s weeks ago', $count, $this->_slug ),
1190
- 'day' => _n( 'about %s day ago', 'about %s days ago', $count, $this->_slug ),
1191
- 'hour' => _n( 'about %s hour ago', 'about %s hours ago', $count, $this->_slug ),
1192
- 'minute' => _n( 'about %s minute ago', 'about %s minutes ago', $count, $this->_slug ),
1193
- 'second' => _n( 'about %s second ago', 'about %s seconds ago', $count, $this->_slug ),
1194
  );
1195
 
1196
  return sprintf( $messages[$key], $count );
@@ -1240,7 +1111,7 @@ class wpTwitterWidget extends AaronPlugin {
1240
  'targetBlank' => 'false',
1241
  'items' => 10,
1242
  'showts' => 60 * 60 * 24,
1243
- 'dateFormat' => __( 'h:i:s A F d, Y', $this->_slug ),
1244
  );
1245
 
1246
  /**
@@ -1310,7 +1181,7 @@ class wpTwitterWidget extends AaronPlugin {
1310
  'targetBlank' => 'false',
1311
  'items' => 10,
1312
  'showts' => 60 * 60 * 24,
1313
- 'dateFormat' => __( 'h:i:s A F d, Y', $this->_slug ),
1314
  );
1315
 
1316
  return $this->fixAvatar( wp_parse_args( $settings, $defaultArgs ) );
@@ -1373,6 +1244,241 @@ class wpTwitterWidget extends AaronPlugin {
1373
  }
1374
  }
1375
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1376
  }
1377
  // Instantiate our class
1378
  $wpTwitterWidget = wpTwitterWidget::getInstance();
3
  * Plugin Name: Twitter Widget Pro
4
  * Plugin URI: https://aarondcampbell.com/wordpress-plugin/twitter-widget-pro/
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: 2.8.0
7
  * Author: Aaron D. Campbell
8
  * Author URI: https://aarondcampbell.com/
9
  * License: GPLv2 or later
29
  */
30
 
31
  require_once( 'tlc-transients.php' );
32
+ require_once( 'class.wp_widget_twitter_pro.php' );
 
33
 
34
  /**
35
+ * wpTwitterWidget is the class that handles everything outside the widget. This
36
+ * includes filters that modify tweet content for things like linked usernames.
37
+ * It also helps us avoid name collisions.
38
  */
39
+ class wpTwitterWidget {
40
+ /**
41
+ * @var wpTwitter
42
+ */
43
+ private $_wp_twitter_oauth;
 
 
 
 
 
 
 
 
 
44
 
45
+ /**
46
+ * @var wpTwitterWidget - Static property to hold our singleton instance
47
+ */
48
+ static $instance = false;
49
 
50
+ /**
51
+ * @var array Plugin settings
52
+ */
53
+ protected $_settings;
54
 
55
+ /**
56
+ * @var string - The options page name used in the URL
57
+ */
58
+ protected $_hook = 'twitterWidgetPro';
59
+
60
+ /**
61
+ * @var string - The filename for the main plugin file
62
+ */
63
+ protected $_file = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
+ /**
66
+ * @var string - The options page title
67
+ */
68
+ protected $_pageTitle = '';
69
 
70
+ /**
71
+ * @var string - The options page menu title
72
+ */
73
+ protected $_menuTitle = '';
74
 
75
+ /**
76
+ * @var string - The access level required to see the options page
77
+ */
78
+ protected $_accessLevel = 'manage_options';
 
79
 
80
+ /**
81
+ * @var string - The option group to register
82
+ */
83
+ protected $_optionGroup = 'twp-options';
84
 
85
+ /**
86
+ * @var array - An array of options to register to the option group
87
+ */
88
+ protected $_optionNames = array( 'twp' );
89
 
90
+ /**
91
+ * @var array - An associated array of callbacks for the options, option name should be index, callback should be value
92
+ */
93
+ protected $_optionCallbacks = array();
 
 
94
 
95
+ /**
96
+ * @var string - The plugin slug used on WordPress.org
97
+ */
98
+ protected $_slug = '';
99
 
 
 
 
 
 
 
100
  /**
101
+ * @var string - The feed URL for AaronDCampbell.com
102
  */
103
+ protected $_feed_url = 'http://aarondcampbell.com/feed/';
104
 
105
  /**
106
+ * @var string - The button ID for the PayPal button, override this generic one with a plugin-specific one
107
  */
108
+ protected $_paypalButtonId = '9993090';
109
+
110
+ protected $_optionsPageAction = 'options.php';
111
 
112
+ /**
113
+ * This is our constructor, which is private to force the use of getInstance()
114
+ * @return void
115
+ */
116
+ protected function __construct() {
117
  require_once( 'lib/wp-twitter.php' );
118
 
 
119
  $this->_file = plugin_basename( __FILE__ );
120
+ $this->_pageTitle = __( 'Twitter Widget Pro', 'twitter-widget-pro' );
121
+ $this->_menuTitle = __( 'Twitter Widget', 'twitter-widget-pro' );
 
 
 
 
 
 
122
 
123
  /**
124
  * Add filters and actions
131
  add_filter( 'widget_twitter_content', array( $this, 'linkUrls' ) );
132
  add_filter( 'widget_twitter_content', array( $this, 'linkHashtags' ) );
133
  add_filter( 'widget_twitter_content', 'convert_chars' );
134
+ add_filter( 'twitter-widget-pro-opt-twp', array( $this, 'filterSettings' ) );
135
+ add_filter( 'twitter-widget-pro-opt-twp-authed-users', array( $this, 'authed_users_option' ) );
136
  add_shortcode( 'twitter-widget', array( $this, 'handleShortcodes' ) );
137
 
138
+ $this->_get_settings();
139
+ if ( is_callable( array($this, '_post_settings_init') ) )
140
+ $this->_post_settings_init();
141
+
142
+ add_filter( 'init', array( $this, 'init_locale' ) );
143
+ add_action( 'admin_init', array( $this, 'register_options' ) );
144
+ add_filter( 'plugin_action_links', array( $this, 'add_plugin_page_links' ), 10, 2 );
145
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2 );
146
+ add_action( 'admin_menu', array( $this, 'register_options_page' ) );
147
+ if ( is_callable(array( $this, 'add_options_meta_boxes' )) )
148
+ add_action( 'admin_init', array( $this, 'add_options_meta_boxes' ) );
149
+
150
+ add_action( 'admin_init', array( $this, 'add_default_options_meta_boxes' ) );
151
+ add_action( 'admin_print_scripts', array( $this,'admin_print_scripts' ) );
152
+ add_action( 'admin_enqueue_scripts', array( $this,'admin_enqueue_scripts' ) );
153
+
154
+ add_action ( 'in_plugin_update_message-'.$this->_file , array ( $this , 'changelog' ), null, 2 );
155
  }
156
 
157
  protected function _post_settings_init() {
162
  $this->_wp_twitter_oauth = new wpTwitter( $oauth_settings );
163
 
164
  // We want to fill 'twp-authed-users' but not overwrite them when saving
165
+ $this->_settings['twp-authed-users'] = apply_filters('twitter-widget-pro-opt-twp-authed-users', get_option('twp-authed-users'));
166
  }
167
 
168
  /**
175
  return self::$instance;
176
  }
177
 
 
 
 
 
178
  public function handle_actions() {
179
  if ( empty( $_GET['action'] ) || empty( $_GET['page'] ) || $_GET['page'] != $this->_hook )
180
  return;
243
  if ( ! empty( $_GET['message'] ) ) {
244
  if ( 'clear-locks' == $_GET['message'] ) {
245
  if ( empty( $_GET['locks_cleared'] ) || 0 == $_GET['locks_cleared'] )
246
+ $msg = __( 'There were no locks to clear!', 'twitter-widget-pro' );
247
  else
248
+ $msg = sprintf( _n( 'Successfully cleared %d lock.', 'Successfully cleared %d locks.', $_GET['locks_cleared'], 'twitter-widget-pro' ), $_GET['locks_cleared'] );
249
  } elseif ( 'authorized' == $_GET['message'] ) {
250
  if ( ! empty( $_GET['authorized'] ) )
251
+ $msg = sprintf( __( 'Successfully authorized @%s', 'twitter-widget-pro' ), $_GET['authorized'] );
252
  else
253
+ $msg = __( 'There was a problem authorizing your account.', 'twitter-widget-pro' );
254
  } elseif ( 'removed' == $_GET['message'] ) {
255
  if ( ! empty( $_GET['removed'] ) )
256
+ $msg = sprintf( __( 'Successfully removed @%s', 'twitter-widget-pro' ), $_GET['removed'] );
257
  else
258
+ $msg = __( 'There was a problem removing your account.', 'twitter-widget-pro' );
259
  }
260
  if ( ! empty( $msg ) )
261
  echo "<div class='updated'><p>" . esc_html( $msg ) . '</p></div>';
267
  }
268
 
269
  if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
270
+ $msg = sprintf( __( 'You need to <a href="%s">set up your Twitter app keys</a>.', 'twitter-widget-pro' ), $this->get_options_url() );
271
  echo '<div class="error"><p>' . $msg . '</p></div>';
272
  }
273
 
274
  if ( empty( $this->_settings['twp-authed-users'] ) ) {
275
+ $msg = sprintf( __( 'You need to <a href="%s">authorize your Twitter accounts</a>.', 'twitter-widget-pro' ), $this->get_options_url() );
276
  echo '<div class="error"><p>' . $msg . '</p></div>';
277
  }
278
  }
279
 
280
  public function add_options_meta_boxes() {
281
+ add_meta_box( 'twitter-widget-pro-oauth', __( 'Authenticated Twitter Accounts', 'twitter-widget-pro' ), array( $this, 'oauth_meta_box' ), 'aaron-twitter-widget-pro', 'main' );
282
+ add_meta_box( 'twitter-widget-pro-general-settings', __( 'General Settings', 'twitter-widget-pro' ), array( $this, 'general_settings_meta_box' ), 'aaron-twitter-widget-pro', 'main' );
283
+ add_meta_box( 'twitter-widget-pro-defaults', __( 'Default Settings for Shortcodes', 'twitter-widget-pro' ), array( $this, 'default_settings_meta_box' ), 'aaron-twitter-widget-pro', 'main' );
284
  }
285
 
286
  public function oauth_meta_box() {
291
  <thead>
292
  <tr valign="top">
293
  <th scope="row">
294
+ <?php _e( 'Username', 'twitter-widget-pro' );?>
295
  </th>
296
  <th scope="row">
297
+ <?php _e( 'Lists Rate Usage', 'twitter-widget-pro' );?>
298
  </th>
299
  <th scope="row">
300
+ <?php _e( 'Statuses Rate Usage', 'twitter-widget-pro' );?>
301
  </th>
302
  </tr>
303
  </thead>
313
  );
314
  $authorize_user_url = wp_nonce_url( add_query_arg( $query_args ), 'authorize' );
315
  $style = 'color:red;';
316
+ $auth_link = ' - <a href="' . esc_url( $authorize_user_url ) . '">' . __( 'Reauthorize', 'twitter-widget-pro' ) . '</a>';
317
  }
318
  $query_args = array(
319
  'action' => 'remove',
324
  <tr valign="top">
325
  <th scope="row" style="<?php echo esc_attr( $style ); ?>">
326
  <strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link;?></strong>
327
+ <br /><a href="<?php echo esc_url( $remove_user_url ) ?>"><?php _e( 'Remove', 'twitter-widget-pro' ) ?></a>
328
  </th>
329
  <?php
330
  if ( ! is_wp_error( $rates ) ) {
331
  $display_rates = array(
332
+ __( 'Lists', 'twitter-widget-pro' ) => $rates->resources->lists->{'/lists/statuses'},
333
+ __( 'Statuses', 'twitter-widget-pro' ) => $rates->resources->statuses->{'/statuses/user_timeline'},
334
  );
335
  foreach ( $display_rates as $title => $rate ) {
336
  ?>
337
  <td>
338
  <strong><?php echo esc_html( $title ); ?></strong>
339
  <p>
340
+ <?php echo sprintf( __( 'Used: %d', 'twitter-widget-pro' ), $rate->limit - $rate->remaining ); ?><br />
341
+ <?php echo sprintf( __( 'Remaining: %d', 'twitter-widget-pro' ), $rate->remaining ); ?><br />
342
  <?php
343
  $minutes = ceil( ( $rate->reset - gmdate( 'U' ) ) / 60 );
344
+ echo sprintf( _n( 'Limits reset in: %d minutes', 'Limits reset in: %d minutes', $minutes, 'twitter-widget-pro' ), $minutes );
345
  ?><br />
346
+ <small><?php _e( 'This is overall usage, not just usage from Twitter Widget Pro', 'twitter-widget-pro' ); ?></small>
347
  </p>
348
  </td>
349
  <?php
351
  } else {
352
  ?>
353
  <td>
354
+ <p><?php _e( 'There was an error checking your rate limit.', 'twitter-widget-pro' ); ?></p>
355
  </td>
356
  <td>
357
+ <p><?php _e( 'There was an error checking your rate limit.', 'twitter-widget-pro' ); ?></p>
358
  </td>
359
  <?php
360
  }
368
  if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
369
  ?>
370
  <p>
371
+ <strong><?php _e( 'You need to fill in the Consumer key and Consumer secret before you can authorize accounts.', 'twitter-widget-pro' ) ?></strong>
372
  </p>
373
  <?php
374
  } else {
375
  ?>
376
  <p>
377
+ <a href="<?php echo esc_url( $authorize_url );?>" class="button button-large button-primary"><?php _e( 'Authorize New Account', 'twitter-widget-pro' ); ?></a>
378
  </p>
379
  <?php
380
  }
385
  <table class="form-table">
386
  <tr valign="top">
387
  <th scope="row">
388
+ <label for="twp_consumer_key"><?php _e( 'Consumer key', 'twitter-widget-pro' );?></label>
389
  </th>
390
  <td>
391
  <input id="twp_consumer_key" name="twp[consumer-key]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['consumer-key'] ); ?>" size="40" />
393
  </tr>
394
  <tr valign="top">
395
  <th scope="row">
396
+ <label for="twp_consumer_secret"><?php _e( 'Consumer secret', 'twitter-widget-pro' );?></label>
397
  </th>
398
  <td>
399
  <input id="twp_consumer_secret" name="twp[consumer-secret]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['consumer-secret'] ); ?>" size="40" />
405
  <tr valign="top">
406
  <th scope="row">&nbsp;</th>
407
  <td>
408
+ <strong><?php _e( 'Directions to get the Consumer Key and Consumer Secret', 'twitter-widget-pro' ) ?></strong>
409
  <ol>
410
+ <li><a href="https://dev.twitter.com/apps/new"><?php _e( 'Add a new Twitter application', 'twitter-widget-pro' ) ?></a></li>
411
  <li><?php _e( "Fill in Name, Description, Website, and Callback URL (don't leave any blank) with anything you want" ) ?></a></li>
412
  <li><?php _e( "Agree to rules, fill out captcha, and submit your application" ) ?></a></li>
413
  <li><?php _e( "Copy the Consumer key and Consumer secret into the fields above" ) ?></a></li>
420
  ?>
421
  <tr>
422
  <th scope="row">
423
+ <?php _e( "Clear Update Locks", 'twitter-widget-pro' );?>
424
  </th>
425
  <td>
426
+ <a href="<?php echo esc_url( $clear_locks_url ); ?>"><?php _e( 'Clear Update Locks', 'twitter-widget-pro' ); ?></a><br />
427
+ <small><?php _e( "A small percentage of servers seem to have issues where an update lock isn't getting cleared. If you're experiencing issues with your feed not updating, try clearing the update locks.", 'twitter-widget-pro' ); ?></small>
428
  </td>
429
  </tr>
430
  <tr>
431
  <th scope="row">
432
+ <?php _e( 'Local requests:', 'twitter-widget-pro' ); ?>
433
  </th>
434
  <td>
435
  <?php
440
  $resp = wp_remote_post( $server_url, array( 'body' => array( '_twp-test-local-request' => 'test' ), 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );
441
  if ( !is_wp_error( $resp ) && $resp['response']['code'] >= 200 && $resp['response']['code'] < 300 ) {
442
  if ( 'success' === wp_remote_retrieve_body( $resp ) )
443
+ _e( '<p style="color:green;">Local requests appear to be functioning normally.</p>', 'twitter-widget-pro' );
444
  else
445
+ _e( '<p style="color:red;">The request went through, but an unexpected response was received.</p>', 'twitter-widget-pro' );
446
  } else {
447
+ printf( __( '<p style="color:red;">Failed. Your server said: %s</p>', 'twitter-widget-pro' ), $resp['response']['message'] );
448
  }
449
  }
450
  $query_args = array(
453
  $test_local_url = wp_nonce_url( add_query_arg( $query_args, $this->get_options_url() ), 'test-local-request' );
454
  ?>
455
  <a href="<?php echo esc_url( $test_local_url ); ?>" class="button">
456
+ <?php _e( 'Test local requests', 'twitter-widget-pro' ); ?>
457
  </a><br />
458
+ <small><?php _e( "Twitter Widget Pro updates tweets in the background by placing a local request to your server. If your Tweets aren't updating, test this. If it fails, let your host know that loopback requests aren't working on your site.", 'twitter-widget-pro' ); ?></small>
459
  </td>
460
  </tr>
461
  </table>
465
  $users = $this->get_users_list( true );
466
  $lists = $this->get_lists();
467
  ?>
468
+ <p><?php _e( 'These settings are the default for the shortcodes and all of them can be overridden by specifying a different value in the shortcode itself. All settings for widgets are locate in the individual widget.', 'twitter-widget-pro' ) ?></p>
469
  <table class="form-table">
470
  <tr valign="top">
471
  <th scope="row">
472
+ <label for="twp_username"><?php _e( 'Twitter username:', 'twitter-widget-pro' ); ?></label>
473
  </th>
474
  <td>
475
  <select id="twp_username" name="twp[username]">
495
  ?>
496
  <p>
497
  <a href="<?php echo esc_url( $authorize_user_url ); ?>" style="color:red;">
498
+ <?php _e( 'You need to authorize this account.', 'twitter-widget-pro' ); ?>
499
  </a>
500
  </p>
501
  <?php
505
  </tr>
506
  <tr valign="top">
507
  <th scope="row">
508
+ <label for="twp_list"><?php _e( 'Twitter list:', 'twitter-widget-pro' ); ?></label>
509
  </th>
510
  <td>
511
  <select id="twp_list" name="twp[list]">
526
  </tr>
527
  <tr valign="top">
528
  <th scope="row">
529
+ <label for="twp_title"><?php _e( 'Give the feed a title ( optional ):', 'twitter-widget-pro' ); ?></label>
530
  </th>
531
  <td>
532
  <input id="twp_title" name="twp[title]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['title'] ); ?>" size="40" />
534
  </tr>
535
  <tr valign="top">
536
  <th scope="row">
537
+ <label for="twp_items"><?php _e( 'How many items would you like to display?', 'twitter-widget-pro' ); ?></label>
538
  </th>
539
  <td>
540
  <select id="twp_items" name="twp[items]">
548
  </tr>
549
  <tr valign="top">
550
  <th scope="row">
551
+ <label for="twp_avatar"><?php _e( 'Display profile image?', 'twitter-widget-pro' ); ?></label>
552
  </th>
553
  <td>
554
  <select id="twp_avatar" name="twp[avatar]">
555
+ <option value=""<?php selected( $this->_settings['twp']['avatar'], '' ) ?>><?php _e( 'Do not show', 'twitter-widget-pro' ); ?></option>
556
+ <option value="mini"<?php selected( $this->_settings['twp']['avatar'], 'mini' ) ?>><?php _e( 'Mini - 24px by 24px', 'twitter-widget-pro' ); ?></option>
557
+ <option value="normal"<?php selected( $this->_settings['twp']['avatar'], 'normal' ) ?>><?php _e( 'Normal - 48px by 48px', 'twitter-widget-pro' ); ?></option>
558
+ <option value="bigger"<?php selected( $this->_settings['twp']['avatar'], 'bigger' ) ?>><?php _e( 'Bigger - 73px by 73px', 'twitter-widget-pro' ); ?></option>
559
+ <option value="original"<?php selected( $this->_settings['twp']['avatar'], 'original' ) ?>><?php _e( 'Original', 'twitter-widget-pro' ); ?></option>
560
  </select>
561
  </td>
562
  </tr>
563
  <tr valign="top">
564
  <th scope="row">
565
+ <label for="twp_errmsg"><?php _e( 'What to display when Twitter is down ( optional ):', 'twitter-widget-pro' ); ?></label>
566
  </th>
567
  <td>
568
  <input id="twp_errmsg" name="twp[errmsg]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['errmsg'] ); ?>" size="40" />
570
  </tr>
571
  <tr valign="top">
572
  <th scope="row">
573
+ <label for="twp_showts"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', 'twitter-widget-pro' ); ?></label>
574
  </th>
575
  <td>
576
  <select id="twp_showts" name="twp[showts]">
577
+ <option value="0" <?php selected( $this->_settings['twp']['showts'], '0' ); ?>><?php _e( 'Always', 'twitter-widget-pro' );?></option>
578
+ <option value="3600" <?php selected( $this->_settings['twp']['showts'], '3600' ); ?>><?php _e( 'If over an hour old', 'twitter-widget-pro' );?></option>
579
+ <option value="86400" <?php selected( $this->_settings['twp']['showts'], '86400' ); ?>><?php _e( 'If over a day old', 'twitter-widget-pro' );?></option>
580
+ <option value="604800" <?php selected( $this->_settings['twp']['showts'], '604800' ); ?>><?php _e( 'If over a week old', 'twitter-widget-pro' );?></option>
581
+ <option value="2592000" <?php selected( $this->_settings['twp']['showts'], '2592000' ); ?>><?php _e( 'If over a month old', 'twitter-widget-pro' );?></option>
582
+ <option value="31536000" <?php selected( $this->_settings['twp']['showts'], '31536000' ); ?>><?php _e( 'If over a year old', 'twitter-widget-pro' );?></option>
583
+ <option value="-1" <?php selected( $this->_settings['twp']['showts'], '-1' ); ?>><?php _e( 'Never', 'twitter-widget-pro' );?></option>
584
  </select>
585
  </td>
586
  </tr>
587
  <tr valign="top">
588
  <th scope="row">
589
+ <label for="twp_dateFormat"><?php echo sprintf( __( 'Format to display the date in, uses <a href="%s">PHP date()</a> format:', 'twitter-widget-pro' ), 'http://php.net/date' ); ?></label>
590
  </th>
591
  <td>
592
  <input id="twp_dateFormat" name="twp[dateFormat]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['dateFormat'] ); ?>" size="40" />
594
  </tr>
595
  <tr valign="top">
596
  <th scope="row">
597
+ <?php _e( "Other Setting:", 'twitter-widget-pro' );?>
598
  </th>
599
  <td>
600
  <input type="hidden" value="false" name="twp[showretweets]" />
601
  <input class="checkbox" type="checkbox" value="true" id="twp_showretweets" name="twp[showretweets]"<?php checked( $this->_settings['twp']['showretweets'], 'true' ); ?> />
602
+ <label for="twp_showretweets"><?php _e( 'Include retweets', 'twitter-widget-pro' ); ?></label>
603
  <br />
604
  <input type="hidden" value="false" name="twp[hidereplies]" />
605
  <input class="checkbox" type="checkbox" value="true" id="twp_hidereplies" name="twp[hidereplies]"<?php checked( $this->_settings['twp']['hidereplies'], 'true' ); ?> />
606
+ <label for="twp_hidereplies"><?php _e( 'Hide @replies', 'twitter-widget-pro' ); ?></label>
607
  <br />
608
  <input type="hidden" value="false" name="twp[hidefrom]" />
609
  <input class="checkbox" type="checkbox" value="true" id="twp_hidefrom" name="twp[hidefrom]"<?php checked( $this->_settings['twp']['hidefrom'], 'true' ); ?> />
610
+ <label for="twp_hidefrom"><?php _e( 'Hide sending applications', 'twitter-widget-pro' ); ?></label>
611
  <br />
612
  <input type="hidden" value="false" name="twp[showintents]" />
613
  <input class="checkbox" type="checkbox" value="true" id="twp_showintents" name="twp[showintents]"<?php checked( $this->_settings['twp']['showintents'], 'true' ); ?> />
614
+ <label for="twp_showintents"><?php _e( 'Show Tweet Intents (reply, retweet, favorite)', 'twitter-widget-pro' ); ?></label>
615
  <br />
616
  <input type="hidden" value="false" name="twp[showfollow]" />
617
  <input class="checkbox" type="checkbox" value="true" id="twp_showfollow" name="twp[showfollow]"<?php checked( $this->_settings['twp']['showfollow'], 'true' ); ?> />
618
+ <label for="twp_showfollow"><?php _e( 'Show Follow Link', 'twitter-widget-pro' ); ?></label>
619
  <br />
620
  <input type="hidden" value="false" name="twp[targetBlank]" />
621
  <input class="checkbox" type="checkbox" value="true" id="twp_targetBlank" name="twp[targetBlank]"<?php checked( $this->_settings['twp']['targetBlank'], 'true' ); ?> />
622
+ <label for="twp_targetBlank"><?php _e( 'Open links in a new window', 'twitter-widget-pro' ); ?></label>
623
  </td>
624
  </tr>
625
  </table>
796
  $widgetContent = $args['before_widget'] . '<div>';
797
 
798
  if ( empty( $args['title'] ) )
799
+ $args['title'] = sprintf( __( 'Twitter: %s', 'twitter-widget-pro' ), $args['username'] );
800
 
801
  $args['title'] = apply_filters( 'twitter-widget-title', $args['title'], $args );
802
  $args['title'] = "<span class='twitterwidget twitterwidget-title'>{$args['title']}</span>";
808
  }
809
  $widgetContent .= '<ul>';
810
  if ( ! is_array( $tweets ) || count( $tweets ) == 0 ) {
811
+ $widgetContent .= '<li class="wpTwitterWidgetEmpty">' . __( 'No Tweets Available', 'twitter-widget-pro' ) . '</li>';
812
  } else {
813
  $count = 0;
814
  foreach ( $tweets as $tweet ) {
826
  $widgetContent .= '</span>';
827
 
828
  if ( 'true' != $args['hidefrom'] ) {
829
+ $from = sprintf( __( 'from %s', 'twitter-widget-pro' ), str_replace( '&', '&amp;', $tweet->source ) );
830
  $widgetContent .= " <span class='from-meta'>{$from}</span>";
831
  }
832
  if ( !empty( $tweet->in_reply_to_screen_name ) ) {
833
+ $rtLinkText = sprintf( __( 'in reply to %s', 'twitter-widget-pro' ), $tweet->in_reply_to_screen_name );
834
  $widgetContent .= ' <span class="in-reply-to-meta">';
835
  $linkAttrs = array(
836
  'href' => "http://twitter.com/{$tweet->in_reply_to_screen_name}/statuses/{$tweet->in_reply_to_status_id_str}",
847
  if ( !empty( $lang ) )
848
  $linkAttrs['data-lang'] = $lang;
849
 
850
+ $linkText = __( 'Reply', 'twitter-widget-pro' );
851
  $linkAttrs['href'] = "http://twitter.com/intent/tweet?in_reply_to={$tweet->id_str}";
852
  $linkAttrs['class'] = 'in-reply-to';
853
  $linkAttrs['title'] = $linkText;
854
  $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
855
 
856
+ $linkText = __( 'Retweet', 'twitter-widget-pro' );
857
  $linkAttrs['href'] = "http://twitter.com/intent/retweet?tweet_id={$tweet->id_str}";
858
  $linkAttrs['class'] = 'retweet';
859
  $linkAttrs['title'] = $linkText;
860
  $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
861
 
862
+ $linkText = __( 'Favorite', 'twitter-widget-pro' );
863
  $linkAttrs['href'] = "http://twitter.com/intent/favorite?tweet_id={$tweet->id_str}";
864
  $linkAttrs['class'] = 'favorite';
865
  $linkAttrs['title'] = $linkText;
880
  $linkAttrs = array(
881
  'href' => "http://twitter.com/{$args['username']}",
882
  'class' => 'twitter-follow-button',
883
+ 'title' => sprintf( __( 'Follow %s', 'twitter-widget-pro' ), "@{$args['username']}" ),
884
  );
885
  $lang = $this->_getTwitterLang();
886
  if ( !empty( $lang ) )
955
  if ( ! empty( $parameters['screen_name'] ) ) {
956
  if ( empty( $this->_settings['twp-authed-users'][strtolower( $parameters['screen_name'] )] ) ) {
957
  if ( empty( $widgetOptions['errmsg'] ) )
958
+ $widgetOptions['errmsg'] = __( 'Account needs to be authorized', 'twitter-widget-pro' );
959
  } else {
960
  $this->_wp_twitter_oauth->set_token( $this->_settings['twp-authed-users'][strtolower( $parameters['screen_name'] )] );
961
  $response = $this->_wp_twitter_oauth->send_authed_request( 'statuses/user_timeline', 'GET', $parameters );
973
  }
974
 
975
  if ( empty( $widgetOptions['errmsg'] ) )
976
+ $widgetOptions['errmsg'] = __( 'Invalid Twitter Response.', 'twitter-widget-pro' );
977
  do_action( 'widget_twitter_parsefeed_error', $response, $parameters, $widgetOptions );
978
  throw new Exception( $widgetOptions['errmsg'] );
979
  }
1055
  }
1056
 
1057
  $messages = array(
1058
+ 'year' => _n( 'about %s year ago', 'about %s years ago', $count, 'twitter-widget-pro' ),
1059
+ 'month' => _n( 'about %s month ago', 'about %s months ago', $count, 'twitter-widget-pro' ),
1060
+ 'week' => _n( 'about %s week ago', 'about %s weeks ago', $count, 'twitter-widget-pro' ),
1061
+ 'day' => _n( 'about %s day ago', 'about %s days ago', $count, 'twitter-widget-pro' ),
1062
+ 'hour' => _n( 'about %s hour ago', 'about %s hours ago', $count, 'twitter-widget-pro' ),
1063
+ 'minute' => _n( 'about %s minute ago', 'about %s minutes ago', $count, 'twitter-widget-pro' ),
1064
+ 'second' => _n( 'about %s second ago', 'about %s seconds ago', $count, 'twitter-widget-pro' ),
1065
  );
1066
 
1067
  return sprintf( $messages[$key], $count );
1111
  'targetBlank' => 'false',
1112
  'items' => 10,
1113
  'showts' => 60 * 60 * 24,
1114
+ 'dateFormat' => __( 'h:i:s A F d, Y', 'twitter-widget-pro' ),
1115
  );
1116
 
1117
  /**
1181
  'targetBlank' => 'false',
1182
  'items' => 10,
1183
  'showts' => 60 * 60 * 24,
1184
+ 'dateFormat' => __( 'h:i:s A F d, Y', 'twitter-widget-pro' ),
1185
  );
1186
 
1187
  return $this->fixAvatar( wp_parse_args( $settings, $defaultArgs ) );
1244
  }
1245
  }
1246
 
1247
+ public function init_locale() {
1248
+ load_plugin_textdomain( 'twitter-widget-pro' );
1249
+ }
1250
+
1251
+ protected function _get_settings() {
1252
+ foreach ( $this->_optionNames as $opt ) {
1253
+ $this->_settings[$opt] = apply_filters( 'twitter-widget-pro-opt-'.$opt, get_option($opt));
1254
+ }
1255
+ }
1256
+
1257
+ public function register_options() {
1258
+ foreach ( $this->_optionNames as $opt ) {
1259
+ if ( !empty($this->_optionCallbacks[$opt]) && is_callable( $this->_optionCallbacks[$opt] ) ) {
1260
+ $callback = $this->_optionCallbacks[$opt];
1261
+ } else {
1262
+ $callback = '';
1263
+ }
1264
+ register_setting( $this->_optionGroup, $opt, $callback );
1265
+ }
1266
+ }
1267
+
1268
+ public function changelog ($pluginData, $newPluginData) {
1269
+ require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
1270
+
1271
+ $plugin = plugins_api( 'plugin_information', array( 'slug' => $newPluginData->slug ) );
1272
+
1273
+ if ( !$plugin || is_wp_error( $plugin ) || empty( $plugin->sections['changelog'] ) ) {
1274
+ return;
1275
+ }
1276
+
1277
+ $changes = $plugin->sections['changelog'];
1278
+ $pos = strpos( $changes, '<h4>' . preg_replace('/[^\d\.]/', '', $pluginData['Version'] ) );
1279
+ if ( $pos !== false ) {
1280
+ $changes = trim( substr( $changes, 0, $pos ) );
1281
+ }
1282
+
1283
+ $replace = array(
1284
+ '<ul>' => '<ul style="list-style: disc inside; padding-left: 15px; font-weight: normal;">',
1285
+ '<h4>' => '<h4 style="margin-bottom:0;">',
1286
+ );
1287
+ echo str_replace( array_keys($replace), $replace, $changes );
1288
+ }
1289
+
1290
+ public function register_options_page() {
1291
+ add_options_page( $this->_pageTitle, $this->_menuTitle, $this->_accessLevel, $this->_hook, array( $this, 'options_page' ) );
1292
+ }
1293
+
1294
+ protected function _filter_boxes_main($boxName) {
1295
+ if ( 'main' == strtolower($boxName) )
1296
+ return false;
1297
+
1298
+ return $this->_filter_boxes_helper($boxName, 'main');
1299
+ }
1300
+
1301
+ protected function _filter_boxes_sidebar($boxName) {
1302
+ return $this->_filter_boxes_helper($boxName, 'sidebar');
1303
+ }
1304
+
1305
+ protected function _filter_boxes_helper($boxName, $test) {
1306
+ return ( strpos( strtolower($boxName), strtolower($test) ) !== false );
1307
+ }
1308
+
1309
+ public function options_page() {
1310
+ global $wp_meta_boxes;
1311
+ $allBoxes = array_keys( $wp_meta_boxes['aaron-twitter-widget-pro'] );
1312
+ $mainBoxes = array_filter( $allBoxes, array( $this, '_filter_boxes_main' ) );
1313
+ unset($mainBoxes['main']);
1314
+ sort($mainBoxes);
1315
+ $sidebarBoxes = array_filter( $allBoxes, array( $this, '_filter_boxes_sidebar' ) );
1316
+ unset($sidebarBoxes['sidebar']);
1317
+ sort($sidebarBoxes);
1318
+
1319
+ $main_width = empty( $sidebarBoxes )? '100%' : '75%';
1320
+ ?>
1321
+ <div class="wrap">
1322
+ <?php $this->screen_icon_link(); ?>
1323
+ <h2><?php echo esc_html($this->_pageTitle); ?></h2>
1324
+ <div class="metabox-holder">
1325
+ <div class="postbox-container" style="width:<?php echo $main_width; ?>;">
1326
+ <?php
1327
+ do_action( 'rpf-pre-main-metabox', $main_width );
1328
+ if ( in_array( 'main', $allBoxes ) ) {
1329
+ ?>
1330
+ <form action="<?php esc_attr_e( $this->_optionsPageAction ); ?>" method="post"<?php do_action( 'rpf-options-page-form-tag' ) ?>>
1331
+ <?php
1332
+ settings_fields( $this->_optionGroup );
1333
+ do_meta_boxes( 'aaron-twitter-widget-pro', 'main', '' );
1334
+ ?>
1335
+ <p class="submit">
1336
+ <input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options &raquo;', 'twitter-widget-pro' ); ?>" />
1337
+ </p>
1338
+ </form>
1339
+ <?php
1340
+ }
1341
+ foreach( $mainBoxes as $context ) {
1342
+ do_meta_boxes( 'aaron-twitter-widget-pro', $context, '' );
1343
+ }
1344
+ ?>
1345
+ </div>
1346
+ <?php
1347
+ if ( !empty( $sidebarBoxes ) ) {
1348
+ ?>
1349
+ <div class="alignright" style="width:24%;">
1350
+ <?php
1351
+ foreach( $sidebarBoxes as $context ) {
1352
+ do_meta_boxes( 'aaron-twitter-widget-pro', $context, '' );
1353
+ }
1354
+ ?>
1355
+ </div>
1356
+ <?php
1357
+ }
1358
+ ?>
1359
+ </div>
1360
+ </div>
1361
+ <?php
1362
+ }
1363
+
1364
+ public function add_plugin_page_links( $links, $file ){
1365
+ if ( $file == $this->_file ) {
1366
+ // Add Widget Page link to our plugin
1367
+ $link = $this->get_options_link();
1368
+ array_unshift( $links, $link );
1369
+
1370
+ // Add Support Forum link to our plugin
1371
+ $link = $this->get_support_forum_link();
1372
+ array_unshift( $links, $link );
1373
+ }
1374
+ return $links;
1375
+ }
1376
+
1377
+ public function add_plugin_meta_links( $meta, $file ){
1378
+ if ( $file == $this->_file )
1379
+ $meta[] = $this->get_plugin_link(__('Rate Plugin'));
1380
+ return $meta;
1381
+ }
1382
+
1383
+ public function get_support_forum_link( $linkText = '' ) {
1384
+ if ( empty($linkText) ) {
1385
+ $linkText = __( 'Support', 'twitter-widget-pro' );
1386
+ }
1387
+ return '<a href="' . $this->get_support_forum_url() . '">' . $linkText . '</a>';
1388
+ }
1389
+
1390
+ public function get_support_forum_url() {
1391
+ return 'http://wordpress.org/support/plugin/twitter-widget-pro';
1392
+ }
1393
+
1394
+ public function get_plugin_link( $linkText = '' ) {
1395
+ if ( empty($linkText) )
1396
+ $linkText = __( 'Give it a good rating on WordPress.org.', 'twitter-widget-pro' );
1397
+ return "<a href='" . $this->get_plugin_url() . "'>{$linkText}</a>";
1398
+ }
1399
+
1400
+ public function get_plugin_url() {
1401
+ return 'http://wordpress.org/extend/plugins/twitter-widget-pro';
1402
+ }
1403
+
1404
+ public function get_options_link( $linkText = '' ) {
1405
+ if ( empty($linkText) ) {
1406
+ $linkText = __( 'Settings', 'twitter-widget-pro' );
1407
+ }
1408
+ return '<a href="' . $this->get_options_url() . '">' . $linkText . '</a>';
1409
+ }
1410
+
1411
+ public function get_options_url() {
1412
+ return admin_url( 'options-general.php?page=' . $this->_hook );
1413
+ }
1414
+
1415
+ public function admin_enqueue_scripts() {
1416
+ if (isset($_GET['page']) && $_GET['page'] == $this->_hook) {
1417
+ wp_enqueue_style('dashboard');
1418
+ }
1419
+ }
1420
+
1421
+ public function add_default_options_meta_boxes() {
1422
+ if ( apply_filters( 'show-aaron-like-this', true ) )
1423
+ add_meta_box( 'twitter-widget-pro-like-this', __('Like this Plugin?', 'twitter-widget-pro'), array($this, 'like_this_meta_box'), 'aaron-twitter-widget-pro', 'sidebar');
1424
+
1425
+ if ( apply_filters( 'show-aaron-support', true ) )
1426
+ add_meta_box( 'twitter-widget-pro-support', __('Need Support?', 'twitter-widget-pro'), array($this, 'support_meta_box'), 'aaron-twitter-widget-pro', 'sidebar');
1427
+
1428
+ if ( apply_filters( 'show-aaron-feed', true ) )
1429
+ add_meta_box( 'twitter-widget-pro-aaron-feed', __('Latest news from Aaron', 'twitter-widget-pro'), array($this, 'aaron_feed_meta_box'), 'aaron-twitter-widget-pro', 'sidebar');
1430
+ }
1431
+
1432
+ public function like_this_meta_box() {
1433
+ echo '<p>';
1434
+ _e('Then please do any or all of the following:', 'twitter-widget-pro');
1435
+ echo '</p><ul>';
1436
+
1437
+ echo "<li><a href='https://aarondcampbell.com/wordpress-plugin/twitter-widget-pro'>";
1438
+ _e('Link to it so others can find out about it.', 'twitter-widget-pro');
1439
+ echo "</a></li>";
1440
+
1441
+ echo '<li>' . $this->get_plugin_link() . '</li>';
1442
+
1443
+ echo '</ul>';
1444
+ }
1445
+
1446
+ public function support_meta_box() {
1447
+ echo '<p>';
1448
+ echo sprintf(__('If you have any problems with this plugin or ideas for improvements or enhancements, please use the <a href="%s">Support Forums</a>.', 'twitter-widget-pro'), $this->get_support_forum_url() );
1449
+ echo '</p>';
1450
+ }
1451
+
1452
+ public function aaron_feed_meta_box() {
1453
+ $args = array(
1454
+ 'url' => $this->_feed_url,
1455
+ 'items' => '5',
1456
+ );
1457
+ echo '<div class="rss-widget">';
1458
+ wp_widget_rss_output( $args );
1459
+ echo "</div>";
1460
+ }
1461
+
1462
+ public function screen_icon_link($name = 'aaron') {
1463
+ $link = '<a href="http://aarondcampbell.com">';
1464
+ if ( function_exists( 'get_screen_icon' ) ) {
1465
+ $link .= get_screen_icon( $name );
1466
+ } else {
1467
+ ob_start();
1468
+ screen_icon($name);
1469
+ $link .= ob_get_clean();
1470
+ }
1471
+ $link .= '</a>';
1472
+ echo apply_filters('rpf-screen_icon_link', $link, $name );
1473
+ }
1474
+
1475
+ public function admin_print_scripts() {
1476
+ if (isset($_GET['page']) && $_GET['page'] == $this->_hook) {
1477
+ wp_enqueue_script('postbox');
1478
+ wp_enqueue_script('dashboard');
1479
+ }
1480
+ }
1481
+
1482
  }
1483
  // Instantiate our class
1484
  $wpTwitterWidget = wpTwitterWidget::getInstance();