Changeset 596258
- Timestamp:
- 09/08/2012 11:26:34 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
widget-embed-lastest-tweets/trunk/widget-embed-latest-tweets.php
r594946 r596258 4 4 * Plugin URI: http://www.arnaudbanvillet.com/blog/portfolio/widget-embed-latest-tweets/ 5 5 * Description: A Widget to show your latest tweets. Use the oEmbed methode and some cache. It is simple, elegant and it works. Just type your user name and the numbers of tweets you want to show. 6 * Version: 0. 3.26 * Version: 0.4 7 7 * Author: Arnaud Banvillet 8 8 * Author URI: http://www.arnaudbanvillet.com … … 129 129 130 130 $maxwidth = strip_tags($new_instance['maxwidth']); 131 if( is_numeric( $maxwidth ) )131 if( is_numeric( $maxwidth ) || empty( $maxwidth )) 132 132 $instance['maxwidth'] = $maxwidth; 133 133 … … 174 174 175 175 <p> 176 <label for="<?php echo $this->get_field_id('maxwidth'); ?>"><?php _e('Maximum Width :', 'ab-welt-locales') ?></label> 177 <input id="<?php echo $this->get_field_id('maxwidth'); ?>" name="<?php echo $this->get_field_name('maxwidth'); ?>" type="number" step="1" min="20" max="1000" value="<?php echo $maxwidth; ?>" /> 176 <label for="<?php echo $this->get_field_id('maxwidth'); ?>"><?php _e('Width :', 'ab-welt-locales') ?></label> 177 <input id="<?php echo $this->get_field_id('maxwidth'); ?>" name="<?php echo $this->get_field_name('maxwidth'); ?>" type="number" step="1" min="250" max="550" value="<?php echo $maxwidth; ?>" /> 178 <br /> 179 <span class="description"><?php _e('Twitter says :This value is constrained to be between 250 and 550 pixels') ?></span> 180 178 181 </p> 179 182 … … 231 234 if( $oauth_methode ){ 232 235 $connection = new TwitterOAuth($twitter_oauth_var[consumer_key], $twitter_oauth_var[consumer_secret], $twitter_oauth_var[token_key],$twitter_oauth_var[token_secret]); 233 234 236 $last_tweet = $connection->get('http://api.twitter.com/1/statuses/user_timeline.json', $options ); 235 237 … … 259 261 260 262 $options['id'] = $id; 263 264 if( empty( $maxwidth) ){ 265 unset( $options['maxwidth']); 266 } 267 261 268 $last_tweet_html = $connection->get('https://api.twitter.com/1/statuses/oembed.json', $options); 262 269 … … 269 276 // We use the GET statuses/oembed API to get the html to display 270 277 // https://dev.twitter.com/docs/api/1/get/statuses/oembed 271 $last_tweet_html = @file_get_contents('https://api.twitter.com/1/statuses/oembed.json?id=' . $id . '&align=' . $align . '&hide_thread='. $hide_thread .'&lang=' . $lang . '&maxwidth=' .$maxwidth); 278 $option_string = 'id=' . $id . '&align=' . $align . '&hide_thread='. $hide_thread .'&lang=' . $lang; 279 280 if( is_numeric( $maxwidth) ){ 281 $option_string .= '&maxwidth=' . $maxwidth; 282 } 283 284 $last_tweet_html = @file_get_contents('https://api.twitter.com/1/statuses/oembed.json?' . $option_string); 272 285 $last_tweet_html = json_decode($last_tweet_html); 273 286
Note: See TracChangeset
for help on using the changeset viewer.