'twitter', 'description' => _a("Your latest Twitter updates")); $this->WP_Widget('atom-twitter', _a('Twitter'), $widget_ops); atom_add('ajax_requests', array(&$this, 'ajax')); // include in jQuery(document).ready() atom_add('jquery_init', array(&$this, 'js')); } function ajax(){ if(atom_ajax_request('get_twitter_data')): atom_ajax_header('get_twitter_data'); $this->display_tweets(esc_attr($_GET['widget_id']), esc_attr(($_GET['twituser'])), intval($_GET['twitcount']), false, $_GET['showinfo']); exit(); endif; } function js(){ // we need to process all instances because this function gets to run only once $widget_settings = atom_get_options($this->option_name); foreach((array)$widget_settings as $instance => $options): // identify instance $id = "{$this->id_base}-{$instance}"; $block_id = "instance-{$id}"; if (false === ($data = get_transient($block_id)) && is_active_widget(false, $id, $this->id_base)): ?> $.ajax({ type: "GET", url: "", data: { widget_id: '', twituser: '', twitcount: , showinfo: , _ajax_nonce: "", atom: 'get_twitter_data' }, beforeSend: function() { }, complete: function() { }, success: function(response){ var block = $('#'); $('.latest-tweets', block).html(response); // animate list $('.latest-tweets li', block).hide().each(function(i){ $(this).delay(333*i).animate( { "opacity": "show", "height": "show", "marginTop": "show", "marginBottom": "show", "paddingTop": "show", "paddingBottom": "show" }, { duration: 333, step: function(now, fx){ $('.latest-tweets', block).parents('li.block .sections').height((block.height()) + 5); } }); }); } });
<?php echo $data['user']['name']; ?>
'; if(is_string($error)) printf(_a("Twitter returned error: %s"), $error); else _ae("Could not retrieve tweets."); echo ''; if(!is_string($error)): echo '

'._a("Possible reasons:").'

'; echo '