Easy Twitter Feed Widget Plugin - Version 0.5

Version Description

  • December 18, 2015 =

  • Enhancement: WP_Widget is deprecated and replaced with __construct().

Download this release

Release Info

Developer designorbital
Plugin Icon 128x128 Easy Twitter Feed Widget Plugin
Version 0.5
Comparing to
See all releases

Code changes from version 0.4 to 0.5

easy-twitter-feed-widget.php CHANGED
@@ -7,7 +7,7 @@ Author: DesignOrbital.com
7
  Author URI: http://designorbital.com
8
  Text Domain: kamn-easy-twitter-feed-widget
9
  Domain Path: /languages/
10
- Version: 0.4
11
  License: GPL v3
12
 
13
  Easy Twitter Feed Widget Plugin
7
  Author URI: http://designorbital.com
8
  Text Domain: kamn-easy-twitter-feed-widget
9
  Domain Path: /languages/
10
+ Version: 0.5
11
  License: GPL v3
12
 
13
  Easy Twitter Feed Widget Plugin
lib/widget-easy-twitter-feed-widget.php CHANGED
@@ -1,310 +1,303 @@
1
- <?php
2
- /**********************************************
3
- * Twitterwidget Widget
4
- * https://dev.twitter.com/web/embedded-timelines
5
- **********************************************/
6
-
7
- class Kamn_Widget_Easytwitterfeedwidget extends WP_Widget {
8
-
9
- /**
10
- * Set up the widget's unique name, ID, class, description, and other options.
11
- */
12
- function __construct() {
13
-
14
- /* Set up the widget options. */
15
- $widget_options = array(
16
- 'classname' => 'widget-easy-twitter-feed-widget-kamn',
17
- 'description' => esc_html__( 'A widget to display Twitter feed.', 'kamn-easy-twitter-feed-widget' )
18
- );
19
-
20
- /* Set up the widget control options. */
21
- $control_options = array(
22
- 'width' => 300,
23
- 'height' => 250
24
- );
25
-
26
- /* Create the widget. */
27
- $this->WP_Widget( 'widget-easy-twitter-feed-widget-kamn', __( 'Easy Twitter Feed Widget', 'kamn-easy-twitter-feed-widget'), $widget_options, $control_options );
28
-
29
- }
30
-
31
- /**
32
- * Outputs the widget based on the arguments input through the widget controls.
33
- *
34
- * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
35
- * @param array $instance The settings for the particular instance of the widget
36
- */
37
-
38
- function widget( $args, $instance ) {
39
-
40
- /** Global Data */
41
- global $post;
42
-
43
- /** Extract Args */
44
- extract( $args );
45
-
46
- /** Set up the default form values. */
47
- $defaults = $this->kamn_defaults();
48
-
49
- /** Merge the user-selected arguments with the defaults. */
50
- $instance = wp_parse_args( (array) $instance, $defaults );
51
-
52
- /** Data Chrome */
53
- $data_chrome = array();
54
- $data_chrome[] = ( $instance['twitter_widget_chrome_header'] == 0 )? 'noheader': '';
55
- $data_chrome[] = ( $instance['twitter_widget_chrome_footer'] == 0 )? 'nofooter': '';
56
- $data_chrome[] = ( $instance['twitter_widget_chrome_border'] == 0 )? 'noborders': '';
57
- $data_chrome[] = ( $instance['twitter_widget_chrome_scrollbar'] == 0 )? 'noscrollbar': '';
58
- $data_chrome[] = ( $instance['twitter_widget_chrome_background'] == 0 )? 'transparent': '';
59
-
60
- /** Data Attributes */
61
- $data_twitter_widget = array(
62
- 'data-widget-id' => $instance['twitter_widget_id'],
63
- 'data-screen-name' => $instance['twitter_widget_screen_name'],
64
- 'data-show-replies' => $instance['twitter_widget_show_replies'],
65
- 'data-theme' => $instance['twitter_widget_theme'],
66
- 'data-link-color' => $instance['twitter_widget_link_color'],
67
- 'data-border-color' => $instance['twitter_widget_border_color'],
68
- 'data-chrome' => trim( join( ' ', $data_chrome ) )
69
- );
70
-
71
- /** Twitter only manages scrollbar / height at default value. So this is for it :) */
72
- if( $instance['twitter_widget_tweet_limit'] != 0 ) {
73
- $data_twitter_widget['data-tweet-limit'] = $instance['twitter_widget_tweet_limit'];
74
- }
75
-
76
- /** Data Attributes as name=value */
77
- $data_twitter_widget_nv = '';
78
- foreach ( $data_twitter_widget as $key => $val ) {
79
- $data_twitter_widget_nv .= $key . '=' . '"' . esc_attr( $val ) . '"' . ' ';
80
- }
81
-
82
- /** Open the output of the widget. */
83
- echo $before_widget;
84
-
85
- ?>
86
- <div class="widget-easy-twitter-feed-widget-global-wrapper">
87
- <div class="widget-easy-twitter-feed-widget-container">
88
-
89
- <?php if ( ! empty( $instance['title'] ) ) : ?>
90
- <div class="row">
91
- <div class="col-lg-12">
92
- <?php echo $before_title . '<span>' . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . '</span>' . $after_title; ?>
93
- </div>
94
- </div>
95
- <?php endif; ?>
96
-
97
- <div class="widget-easy-twitter-feed-widget-row">
98
- <div class="widget-easy-twitter-feed-widget-col">
99
- <div class="twitterwidget <?php echo $widget_id; ?>">
100
- <a class="twitter-timeline" width="<?php echo $instance['twitter_widget_width']; ?>" height="<?php echo $instance['twitter_widget_height']; ?>" href="https://twitter.com/twitterdev" <?php echo trim( $data_twitter_widget_nv ); ?>><?php _e( 'Tweets by @', 'kamn-easy-twitter-feed-widget' ); ?><?php echo $instance['twitter_widget_screen_name']; ?></a>
101
- </div>
102
- </div>
103
- </div>
104
-
105
- </div> <!-- End .widget-global-wrapper -->
106
- </div>
107
-
108
- <?php
109
-
110
- /** Close the output of the widget. */
111
- echo $after_widget;
112
-
113
- }
114
-
115
- /** Updates the widget control options for the particular instance of the widget.
116
- *
117
- * This function should check that $new_instance is set correctly.
118
- * The newly calculated value of $instance should be returned.
119
- * If "false" is returned, the instance won't be saved/updated.
120
- *
121
- * @param array $new_instance New settings for this instance as input by the user via form()
122
- * @param array $old_instance Old settings for this instance
123
- * @return array Settings to save or bool false to cancel saving
124
- */
125
- function update( $new_instance, $old_instance ) {
126
-
127
- /** Default Args */
128
- $defaults = $this->kamn_defaults();
129
-
130
- /** Update Logic */
131
- $instance = $old_instance;
132
- foreach( $defaults as $key => $val ) {
133
- $instance[$key] = strip_tags( $new_instance[$key] );
134
- }
135
- return $instance;
136
-
137
- }
138
-
139
- /**
140
- *
141
- * Displays the widget control options in the Widgets admin screen.
142
- *
143
- * @param array $instance Current settings
144
- */
145
- function form( $instance ) {
146
-
147
- /** Set up the default form values. */
148
- $defaults = $this->kamn_defaults();
149
-
150
- /** Merge the user-selected arguments with the defaults. */
151
- $instance = wp_parse_args( (array) $instance, $defaults );
152
-
153
- $title = strip_tags( $instance['title'] );
154
- $twitter_widget_tweet_limit = array_merge( array( 0 => 'default' ), array_combine( range( 1, 20 ), range( 1, 20 ) ) );
155
- $twitter_widget_show_replies = array( 'true' => 'Yes', 'false' => 'No' );
156
- $twitter_widget_width = range( 180, 520, 20 );
157
- $twitter_widget_height = range( 200, 600, 50 );
158
- $twitter_widget_theme = array( 'light' => 'Light', 'dark' => 'Dark' );
159
- $boolean = array( 1 => 'Yes', 0 => 'No' );
160
- ?>
161
-
162
- <p>
163
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'kamn-easy-twitter-feed-widget' ); ?></label>
164
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
165
- </p>
166
-
167
- <p><strong><?php _e( 'Easy Twitter Feed Widget Settings', 'kamn-easy-twitter-feed-widget' ); ?></strong></p>
168
- <hr />
169
-
170
- <p>
171
- <label for="<?php echo $this->get_field_id( 'twitter_widget_id' ); ?>"><?php _e( 'Twitter Widget ID:', 'kamn-easy-twitter-feed-widget' ); ?></label>
172
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_id' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_id' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_id'] ); ?>" />
173
- </p>
174
-
175
- <p>
176
- <label for="<?php echo $this->get_field_id( 'twitter_widget_screen_name' ); ?>"><?php _e( 'Twitter Screen Name:', 'kamn-easy-twitter-feed-widget' ); ?></label>
177
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_screen_name' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_screen_name' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_screen_name'] ); ?>" />
178
- </p>
179
-
180
- <p>
181
- <label for="<?php echo $this->get_field_id( 'twitter_widget_tweet_limit' ); ?>"><?php _e( 'Tweet Limit:', 'kamn-easy-twitter-feed-widget' ); ?></label>
182
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_tweet_limit' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_tweet_limit' ); ?>">
183
- <?php foreach ( $twitter_widget_tweet_limit as $key => $val ): ?>
184
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_tweet_limit'], $key ); ?>><?php echo esc_html( $val ); ?></option>
185
- <?php endforeach; ?>
186
- </select>
187
- </p>
188
-
189
- <p>
190
- <label for="<?php echo $this->get_field_id( 'twitter_widget_show_replies' ); ?>"><?php _e( 'Show Replies:', 'kamn-easy-twitter-feed-widget' ); ?></label>
191
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_show_replies' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_show_replies' ); ?>">
192
- <?php foreach ( $twitter_widget_show_replies as $key => $val ): ?>
193
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_show_replies'], $key ); ?>><?php echo esc_html( $val ); ?></option>
194
- <?php endforeach; ?>
195
- </select>
196
- </p>
197
-
198
- <p>
199
- <label for="<?php echo $this->get_field_id( 'twitter_widget_width' ); ?>"><?php _e( 'Twitter Widget Width:', 'kamn-easy-twitter-feed-widget' ); ?></label>
200
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_width' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_width' ); ?>">
201
- <?php foreach ( $twitter_widget_width as $val ): ?>
202
- <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $instance['twitter_widget_width'], $val ); ?>><?php echo esc_html( $val ); ?></option>
203
- <?php endforeach; ?>
204
- </select>
205
- </p>
206
-
207
- <p>
208
- <label for="<?php echo $this->get_field_id( 'twitter_widget_height' ); ?>"><?php _e( 'Twitter Widget Height:', 'kamn-easy-twitter-feed-widget' ); ?></label>
209
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_height' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_height' ); ?>">
210
- <?php foreach ( $twitter_widget_height as $val ): ?>
211
- <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $instance['twitter_widget_height'], $val ); ?>><?php echo esc_html( $val ); ?></option>
212
- <?php endforeach; ?>
213
- </select>
214
- <small><?php _e( 'Height setting will work only @ Tweet Limit "default".', 'kamn-easy-twitter-feed-widget' ); ?></small>
215
- </p>
216
-
217
- <p>
218
- <label for="<?php echo $this->get_field_id( 'twitter_widget_theme' ); ?>"><?php _e( 'Twitter Widget Theme:', 'kamn-easy-twitter-feed-widget' ); ?></label>
219
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_theme' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_theme' ); ?>">
220
- <?php foreach ( $twitter_widget_theme as $key => $val ): ?>
221
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_theme'], $key ); ?>><?php echo esc_html( $val ); ?></option>
222
- <?php endforeach; ?>
223
- </select>
224
- </p>
225
-
226
- <p>
227
- <label for="<?php echo $this->get_field_id( 'twitter_widget_link_color' ); ?>"><?php _e( 'Twitter Widget Link Color:', 'kamn-easy-twitter-feed-widget' ); ?> <small><?php _e( 'e.g #333333', 'kamn-easy-twitter-feed-widget' ); ?></small></label><br />
228
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_link_color' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_link_color' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_link_color'] ); ?>" />
229
- </p>
230
-
231
- <p>
232
- <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_header' ); ?>"><?php _e( 'Show Twitter Widget Header:', 'kamn-easy-twitter-feed-widget' ); ?></label>
233
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_header' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_header' ); ?>">
234
- <?php foreach ( $boolean as $key => $val ): ?>
235
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_header'], $key ); ?>><?php echo esc_html( $val ); ?></option>
236
- <?php endforeach; ?>
237
- </select>
238
- </p>
239
-
240
- <p>
241
- <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_footer' ); ?>"><?php _e( 'Show Twitter Widget Footer:', 'kamn-easy-twitter-feed-widget' ); ?></label>
242
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_footer' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_footer' ); ?>">
243
- <?php foreach ( $boolean as $key => $val ): ?>
244
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_footer'], $key ); ?>><?php echo esc_html( $val ); ?></option>
245
- <?php endforeach; ?>
246
- </select>
247
- </p>
248
-
249
- <p>
250
- <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_border' ); ?>"><?php _e( 'Show Twitter Widget Border:', 'kamn-easy-twitter-feed-widget' ); ?></label>
251
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_border' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_border' ); ?>">
252
- <?php foreach ( $boolean as $key => $val ): ?>
253
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_border'], $key ); ?>><?php echo esc_html( $val ); ?></option>
254
- <?php endforeach; ?>
255
- </select>
256
- </p>
257
-
258
- <p>
259
- <label for="<?php echo $this->get_field_id( 'twitter_widget_border_color' ); ?>"><?php _e( 'Twitter Widget Border Color:', 'kamn-easy-twitter-feed-widget' ); ?> <small><?php _e( 'e.g #333333', 'kamn-easy-twitter-feed-widget' ); ?></small></label><br />
260
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_border_color' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_border_color' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_border_color'] ); ?>" />
261
- </p>
262
-
263
- <p>
264
- <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_scrollbar' ); ?>"><?php _e( 'Show Twitter Widget Scrollbar:', 'kamn-easy-twitter-feed-widget' ); ?></label>
265
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_scrollbar' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_scrollbar' ); ?>">
266
- <?php foreach ( $boolean as $key => $val ): ?>
267
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_scrollbar'], $key ); ?>><?php echo esc_html( $val ); ?></option>
268
- <?php endforeach; ?>
269
- </select>
270
- <small><?php _e( 'Scrollbar setting will work only @ Tweet Limit "default".', 'kamn-easy-twitter-feed-widget' ); ?></small>
271
- </p>
272
-
273
- <p>
274
- <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_background' ); ?>"><?php _e( 'Use Twitter Widget Background Color:', 'kamn-easy-twitter-feed-widget' ); ?></label>
275
- <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_background' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_background' ); ?>">
276
- <?php foreach ( $boolean as $key => $val ): ?>
277
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_background'], $key ); ?>><?php echo esc_html( $val ); ?></option>
278
- <?php endforeach; ?>
279
- </select>
280
- </p>
281
-
282
- <?php
283
- }
284
-
285
- /** Set up the default form values. */
286
- function kamn_defaults() {
287
-
288
- $defaults = array(
289
- 'title' => esc_attr__( 'Twitter Widget', 'kamn-easy-twitter-feed-widget'),
290
- 'twitter_widget_id' => '344713329262084096',
291
- 'twitter_widget_screen_name' => 'designorbital',
292
- 'twitter_widget_tweet_limit' => 0,
293
- 'twitter_widget_show_replies' => 'false',
294
- 'twitter_widget_width' => 300,
295
- 'twitter_widget_height' => 250,
296
- 'twitter_widget_theme' => 'light',
297
- 'twitter_widget_link_color' => '',
298
- 'twitter_widget_border_color' => '',
299
- 'twitter_widget_chrome_header' => 1,
300
- 'twitter_widget_chrome_footer' => 1,
301
- 'twitter_widget_chrome_border' => 1,
302
- 'twitter_widget_chrome_scrollbar' => 1,
303
- 'twitter_widget_chrome_background' => 1
304
- );
305
-
306
- return $defaults;
307
-
308
- }
309
-
310
  }
1
+ <?php
2
+ /**********************************************
3
+ * Twitterwidget Widget
4
+ * https://dev.twitter.com/web/embedded-timelines
5
+ **********************************************/
6
+
7
+ class Kamn_Widget_Easytwitterfeedwidget extends WP_Widget {
8
+
9
+ /**
10
+ * Set up the widget's unique name, ID, class, description, and other options.
11
+ */
12
+ function __construct() {
13
+
14
+ parent::__construct(
15
+ 'widget-easy-twitter-feed-widget-kamn',
16
+ apply_filters( 'kamn_easy_twitter_feed_widget_name', __( 'Easy Twitter Feed Widget', 'kamn-easy-twitter-feed-widget') ),
17
+ array(
18
+ 'classname' => 'widget-easy-twitter-feed-widget-kamn',
19
+ 'description' => __( 'A widget to display Twitter feed.', 'kamn-easy-twitter-feed-widget' )
20
+ )
21
+ );
22
+ }
23
+
24
+ /**
25
+ * Outputs the widget based on the arguments input through the widget controls.
26
+ *
27
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
28
+ * @param array $instance The settings for the particular instance of the widget
29
+ */
30
+
31
+ function widget( $args, $instance ) {
32
+
33
+ /** Global Data */
34
+ global $post;
35
+
36
+ /** Extract Args */
37
+ extract( $args );
38
+
39
+ /** Set up the default form values. */
40
+ $defaults = $this->kamn_defaults();
41
+
42
+ /** Merge the user-selected arguments with the defaults. */
43
+ $instance = wp_parse_args( (array) $instance, $defaults );
44
+
45
+ /** Data Chrome */
46
+ $data_chrome = array();
47
+ $data_chrome[] = ( $instance['twitter_widget_chrome_header'] == 0 )? 'noheader': '';
48
+ $data_chrome[] = ( $instance['twitter_widget_chrome_footer'] == 0 )? 'nofooter': '';
49
+ $data_chrome[] = ( $instance['twitter_widget_chrome_border'] == 0 )? 'noborders': '';
50
+ $data_chrome[] = ( $instance['twitter_widget_chrome_scrollbar'] == 0 )? 'noscrollbar': '';
51
+ $data_chrome[] = ( $instance['twitter_widget_chrome_background'] == 0 )? 'transparent': '';
52
+
53
+ /** Data Attributes */
54
+ $data_twitter_widget = array(
55
+ 'data-widget-id' => $instance['twitter_widget_id'],
56
+ 'data-screen-name' => $instance['twitter_widget_screen_name'],
57
+ 'data-show-replies' => $instance['twitter_widget_show_replies'],
58
+ 'data-theme' => $instance['twitter_widget_theme'],
59
+ 'data-link-color' => $instance['twitter_widget_link_color'],
60
+ 'data-border-color' => $instance['twitter_widget_border_color'],
61
+ 'data-chrome' => trim( join( ' ', $data_chrome ) )
62
+ );
63
+
64
+ /** Twitter only manages scrollbar / height at default value. So this is for it :) */
65
+ if( $instance['twitter_widget_tweet_limit'] != 0 ) {
66
+ $data_twitter_widget['data-tweet-limit'] = $instance['twitter_widget_tweet_limit'];
67
+ }
68
+
69
+ /** Data Attributes as name=value */
70
+ $data_twitter_widget_nv = '';
71
+ foreach ( $data_twitter_widget as $key => $val ) {
72
+ $data_twitter_widget_nv .= $key . '=' . '"' . esc_attr( $val ) . '"' . ' ';
73
+ }
74
+
75
+ /** Open the output of the widget. */
76
+ echo $before_widget;
77
+
78
+ ?>
79
+ <div class="widget-easy-twitter-feed-widget-global-wrapper">
80
+ <div class="widget-easy-twitter-feed-widget-container">
81
+
82
+ <?php if ( ! empty( $instance['title'] ) ) : ?>
83
+ <div class="row">
84
+ <div class="col-lg-12">
85
+ <?php echo $before_title . '<span>' . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . '</span>' . $after_title; ?>
86
+ </div>
87
+ </div>
88
+ <?php endif; ?>
89
+
90
+ <div class="widget-easy-twitter-feed-widget-row">
91
+ <div class="widget-easy-twitter-feed-widget-col">
92
+ <div class="twitterwidget <?php echo $widget_id; ?>">
93
+ <a class="twitter-timeline" width="<?php echo $instance['twitter_widget_width']; ?>" height="<?php echo $instance['twitter_widget_height']; ?>" href="https://twitter.com/twitterdev" <?php echo trim( $data_twitter_widget_nv ); ?>><?php _e( 'Tweets by @', 'kamn-easy-twitter-feed-widget' ); ?><?php echo $instance['twitter_widget_screen_name']; ?></a>
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+ </div> <!-- End .widget-global-wrapper -->
99
+ </div>
100
+
101
+ <?php
102
+
103
+ /** Close the output of the widget. */
104
+ echo $after_widget;
105
+
106
+ }
107
+
108
+ /** Updates the widget control options for the particular instance of the widget.
109
+ *
110
+ * This function should check that $new_instance is set correctly.
111
+ * The newly calculated value of $instance should be returned.
112
+ * If "false" is returned, the instance won't be saved/updated.
113
+ *
114
+ * @param array $new_instance New settings for this instance as input by the user via form()
115
+ * @param array $old_instance Old settings for this instance
116
+ * @return array Settings to save or bool false to cancel saving
117
+ */
118
+ function update( $new_instance, $old_instance ) {
119
+
120
+ /** Default Args */
121
+ $defaults = $this->kamn_defaults();
122
+
123
+ /** Update Logic */
124
+ $instance = $old_instance;
125
+ foreach( $defaults as $key => $val ) {
126
+ $instance[$key] = strip_tags( $new_instance[$key] );
127
+ }
128
+ return $instance;
129
+
130
+ }
131
+
132
+ /**
133
+ *
134
+ * Displays the widget control options in the Widgets admin screen.
135
+ *
136
+ * @param array $instance Current settings
137
+ */
138
+ function form( $instance ) {
139
+
140
+ /** Set up the default form values. */
141
+ $defaults = $this->kamn_defaults();
142
+
143
+ /** Merge the user-selected arguments with the defaults. */
144
+ $instance = wp_parse_args( (array) $instance, $defaults );
145
+
146
+ $title = strip_tags( $instance['title'] );
147
+ $twitter_widget_tweet_limit = array_merge( array( 0 => 'default' ), array_combine( range( 1, 20 ), range( 1, 20 ) ) );
148
+ $twitter_widget_show_replies = array( 'true' => 'Yes', 'false' => 'No' );
149
+ $twitter_widget_width = range( 180, 520, 20 );
150
+ $twitter_widget_height = range( 200, 600, 50 );
151
+ $twitter_widget_theme = array( 'light' => 'Light', 'dark' => 'Dark' );
152
+ $boolean = array( 1 => 'Yes', 0 => 'No' );
153
+ ?>
154
+
155
+ <p>
156
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'kamn-easy-twitter-feed-widget' ); ?></label>
157
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
158
+ </p>
159
+
160
+ <p><strong><?php _e( 'Easy Twitter Feed Widget Settings', 'kamn-easy-twitter-feed-widget' ); ?></strong></p>
161
+ <hr />
162
+
163
+ <p>
164
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_id' ); ?>"><?php _e( 'Twitter Widget ID:', 'kamn-easy-twitter-feed-widget' ); ?></label>
165
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_id' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_id' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_id'] ); ?>" />
166
+ </p>
167
+
168
+ <p>
169
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_screen_name' ); ?>"><?php _e( 'Twitter Screen Name:', 'kamn-easy-twitter-feed-widget' ); ?></label>
170
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_screen_name' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_screen_name' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_screen_name'] ); ?>" />
171
+ </p>
172
+
173
+ <p>
174
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_tweet_limit' ); ?>"><?php _e( 'Tweet Limit:', 'kamn-easy-twitter-feed-widget' ); ?></label>
175
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_tweet_limit' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_tweet_limit' ); ?>">
176
+ <?php foreach ( $twitter_widget_tweet_limit as $key => $val ): ?>
177
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_tweet_limit'], $key ); ?>><?php echo esc_html( $val ); ?></option>
178
+ <?php endforeach; ?>
179
+ </select>
180
+ </p>
181
+
182
+ <p>
183
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_show_replies' ); ?>"><?php _e( 'Show Replies:', 'kamn-easy-twitter-feed-widget' ); ?></label>
184
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_show_replies' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_show_replies' ); ?>">
185
+ <?php foreach ( $twitter_widget_show_replies as $key => $val ): ?>
186
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_show_replies'], $key ); ?>><?php echo esc_html( $val ); ?></option>
187
+ <?php endforeach; ?>
188
+ </select>
189
+ </p>
190
+
191
+ <p>
192
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_width' ); ?>"><?php _e( 'Twitter Widget Width:', 'kamn-easy-twitter-feed-widget' ); ?></label>
193
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_width' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_width' ); ?>">
194
+ <?php foreach ( $twitter_widget_width as $val ): ?>
195
+ <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $instance['twitter_widget_width'], $val ); ?>><?php echo esc_html( $val ); ?></option>
196
+ <?php endforeach; ?>
197
+ </select>
198
+ </p>
199
+
200
+ <p>
201
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_height' ); ?>"><?php _e( 'Twitter Widget Height:', 'kamn-easy-twitter-feed-widget' ); ?></label>
202
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_height' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_height' ); ?>">
203
+ <?php foreach ( $twitter_widget_height as $val ): ?>
204
+ <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $instance['twitter_widget_height'], $val ); ?>><?php echo esc_html( $val ); ?></option>
205
+ <?php endforeach; ?>
206
+ </select>
207
+ <small><?php _e( 'Height setting will work only @ Tweet Limit "default".', 'kamn-easy-twitter-feed-widget' ); ?></small>
208
+ </p>
209
+
210
+ <p>
211
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_theme' ); ?>"><?php _e( 'Twitter Widget Theme:', 'kamn-easy-twitter-feed-widget' ); ?></label>
212
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_theme' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_theme' ); ?>">
213
+ <?php foreach ( $twitter_widget_theme as $key => $val ): ?>
214
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_theme'], $key ); ?>><?php echo esc_html( $val ); ?></option>
215
+ <?php endforeach; ?>
216
+ </select>
217
+ </p>
218
+
219
+ <p>
220
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_link_color' ); ?>"><?php _e( 'Twitter Widget Link Color:', 'kamn-easy-twitter-feed-widget' ); ?> <small><?php _e( 'e.g #333333', 'kamn-easy-twitter-feed-widget' ); ?></small></label><br />
221
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_link_color' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_link_color' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_link_color'] ); ?>" />
222
+ </p>
223
+
224
+ <p>
225
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_header' ); ?>"><?php _e( 'Show Twitter Widget Header:', 'kamn-easy-twitter-feed-widget' ); ?></label>
226
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_header' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_header' ); ?>">
227
+ <?php foreach ( $boolean as $key => $val ): ?>
228
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_header'], $key ); ?>><?php echo esc_html( $val ); ?></option>
229
+ <?php endforeach; ?>
230
+ </select>
231
+ </p>
232
+
233
+ <p>
234
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_footer' ); ?>"><?php _e( 'Show Twitter Widget Footer:', 'kamn-easy-twitter-feed-widget' ); ?></label>
235
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_footer' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_footer' ); ?>">
236
+ <?php foreach ( $boolean as $key => $val ): ?>
237
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_footer'], $key ); ?>><?php echo esc_html( $val ); ?></option>
238
+ <?php endforeach; ?>
239
+ </select>
240
+ </p>
241
+
242
+ <p>
243
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_border' ); ?>"><?php _e( 'Show Twitter Widget Border:', 'kamn-easy-twitter-feed-widget' ); ?></label>
244
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_border' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_border' ); ?>">
245
+ <?php foreach ( $boolean as $key => $val ): ?>
246
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_border'], $key ); ?>><?php echo esc_html( $val ); ?></option>
247
+ <?php endforeach; ?>
248
+ </select>
249
+ </p>
250
+
251
+ <p>
252
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_border_color' ); ?>"><?php _e( 'Twitter Widget Border Color:', 'kamn-easy-twitter-feed-widget' ); ?> <small><?php _e( 'e.g #333333', 'kamn-easy-twitter-feed-widget' ); ?></small></label><br />
253
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_border_color' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_border_color' ); ?>" value="<?php echo esc_attr( $instance['twitter_widget_border_color'] ); ?>" />
254
+ </p>
255
+
256
+ <p>
257
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_scrollbar' ); ?>"><?php _e( 'Show Twitter Widget Scrollbar:', 'kamn-easy-twitter-feed-widget' ); ?></label>
258
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_scrollbar' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_scrollbar' ); ?>">
259
+ <?php foreach ( $boolean as $key => $val ): ?>
260
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_scrollbar'], $key ); ?>><?php echo esc_html( $val ); ?></option>
261
+ <?php endforeach; ?>
262
+ </select>
263
+ <small><?php _e( 'Scrollbar setting will work only @ Tweet Limit "default".', 'kamn-easy-twitter-feed-widget' ); ?></small>
264
+ </p>
265
+
266
+ <p>
267
+ <label for="<?php echo $this->get_field_id( 'twitter_widget_chrome_background' ); ?>"><?php _e( 'Use Twitter Widget Background Color:', 'kamn-easy-twitter-feed-widget' ); ?></label>
268
+ <select class="widefat" id="<?php echo $this->get_field_id( 'twitter_widget_chrome_background' ); ?>" name="<?php echo $this->get_field_name( 'twitter_widget_chrome_background' ); ?>">
269
+ <?php foreach ( $boolean as $key => $val ): ?>
270
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $instance['twitter_widget_chrome_background'], $key ); ?>><?php echo esc_html( $val ); ?></option>
271
+ <?php endforeach; ?>
272
+ </select>
273
+ </p>
274
+
275
+ <?php
276
+ }
277
+
278
+ /** Set up the default form values. */
279
+ function kamn_defaults() {
280
+
281
+ $defaults = array(
282
+ 'title' => esc_attr__( 'Twitter Widget', 'kamn-easy-twitter-feed-widget'),
283
+ 'twitter_widget_id' => '344713329262084096',
284
+ 'twitter_widget_screen_name' => 'designorbital',
285
+ 'twitter_widget_tweet_limit' => 0,
286
+ 'twitter_widget_show_replies' => 'false',
287
+ 'twitter_widget_width' => 300,
288
+ 'twitter_widget_height' => 250,
289
+ 'twitter_widget_theme' => 'light',
290
+ 'twitter_widget_link_color' => '',
291
+ 'twitter_widget_border_color' => '',
292
+ 'twitter_widget_chrome_header' => 1,
293
+ 'twitter_widget_chrome_footer' => 1,
294
+ 'twitter_widget_chrome_border' => 1,
295
+ 'twitter_widget_chrome_scrollbar' => 1,
296
+ 'twitter_widget_chrome_background' => 1
297
+ );
298
+
299
+ return $defaults;
300
+
301
+ }
302
+
 
 
 
 
 
 
 
303
  }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: designorbital
3
  License: GPLv3
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
  Tags: twitter, twitter feed, tweet, twitter widget, feed, widget, twitter sidebar, social, social media, sidebar, plugin
6
- Requires at least: 4.0
7
- Tested up to: 4.2.3
8
- Stable tag: 0.4
9
 
10
  Add twitter feeds on your WordPress site by using the Easy Twitter Feed Widget plugin.
11
 
@@ -21,7 +21,7 @@ If you are planning to display tweets on your blog's sidebar without bells and w
21
  * Make it your own by customizing the link color, border color, background choice and other useful options.
22
 
23
  = Further Useful Stuff =
24
- Easy Twitter Feed Widget plugin is developed by DesignOrbital. You may be interesed to use our [Premium WordPress Themes](http://designorbital.com/) or [Free WordPress Themes](http://designorbital.com/free-wordpress-themes/) to run your website under the clean and SEO optimized code.
25
 
26
  == Installation ==
27
 
@@ -47,6 +47,10 @@ Easy Twitter Feed Widget plugin is developed by DesignOrbital. You may be intere
47
 
48
  == Changelog ==
49
 
 
 
 
 
50
  = 0.4 - July 27, 2015 =
51
 
52
  * Enhancement: No widget title HTML markup will print when the widget title is empty.
3
  License: GPLv3
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
  Tags: twitter, twitter feed, tweet, twitter widget, feed, widget, twitter sidebar, social, social media, sidebar, plugin
6
+ Requires at least: 4.5
7
+ Tested up to: 4.7
8
+ Stable tag: 0.5
9
 
10
  Add twitter feeds on your WordPress site by using the Easy Twitter Feed Widget plugin.
11
 
21
  * Make it your own by customizing the link color, border color, background choice and other useful options.
22
 
23
  = Further Useful Stuff =
24
+ Easy Twitter Feed Widget plugin is developed by DesignOrbital. You may be interesed to use our [Premium WordPress Themes](https://designorbital.com/) or [Free WordPress Themes](https://designorbital.com/free-wordpress-themes/) to run your website under the clean and SEO optimized code.
25
 
26
  == Installation ==
27
 
47
 
48
  == Changelog ==
49
 
50
+ = 0.5 - December 18, 2015 =
51
+
52
+ * Enhancement: WP_Widget is deprecated and replaced with __construct().
53
+
54
  = 0.4 - July 27, 2015 =
55
 
56
  * Enhancement: No widget title HTML markup will print when the widget title is empty.