'lifestream', 'description' => _a("Your activity around social networks")); $control_ops = array('width' => 500); $this->WP_Widget('atom-lifestream', _a('Lifestream'), $widget_ops, $control_ops); // atom_add('ajax_requests', array(&$this, 'ajax')); // atom_add('jquery_init', array(&$this, 'js')); // include in jQuery(document).ready() // add_action('atom_jquery_init', array(&$this, 'js')); } function ajax(){ if(isset($_GET['atom_get_lastfm_data'])): atom_ajax_header('atom_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_lastfm_data: 1 }, beforeSend: function() { }, complete: function() { }, success: function(response){ $("# .latest-tweets").hide().html(response).slideDown(333); } });
';
$url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22".urlencode("http://twitter.com/statuses/user_timeline/35092196.rss")."%22&format=json";
$response = wp_remote_retrieve_body(wp_remote_request($url));
if(!is_array($data_twitter = json_decode($response, true))) $error = true;
print_r($data_twitter['query']['results']['rss']['channel']['item']);
$url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22".urlencode("http://ws.audioscrobbler.com/1.0/user/xs/recenttracks.rss")."%22&format=json";
$response = wp_remote_retrieve_body(wp_remote_request($url));
if(!is_array($data_lastfm = json_decode($response, true))) $error = true;
print_r($data_lastfm['query']['results']['rss']['channel']['item']);
echo '';
return;
if (!function_exists('simplexml_load_file')) echo 'need php 5!';
$url = "http://ws.audioscrobbler.com/2.0/user/{$user}/{$type}.xml?limit={$count}";
$feed = @simplexml_load_file($url);
// if (array_key_exists('track', get_object_vars($feed)));
$last = count($feed->track);
for ($i=0; $i<$last; $i++):
echo '