function thinktank_chron_archive_handler($atts) { extract(shortcode_atts(array('twitter_username' => get_option('thinktank_twitter_username'), 'title' => '<h3><a href="http://twitter.com/#twitter_username#/">@#twitter_username#</a>\'s Tweets in Chronological Order (sans replies)</h3>', 'before' => '<br /><ul>', 'after' => '</ul>', 'before_tweet' => '<li>', 'after_tweet' => '</li>', 'before_date' => '', 'after_date' => '', 'before_tweet_html' => '', 'after_tweet_html' => '', 'date_format' => 'Y.m.d, g:ia', 'gmt_offset' => 8), $atts)); $options_array = thinktank_get_options_array(); if ($options_array['thinktank_server']['value'] != '') { $wpdb2 = new wpdb($options_array['thinktank_dbusername']['value'], $options_array['thinktank_dbpw']['value'], $options_array['thinktank_db']['value'], $options_array['thinktank_server']['value']); } else { global $wpdb; $wpdb2 = $wpdb; } $sql = $wpdb2->prepare("select pub_date, tweet_html, status_id from " . $options_array['thinktank_table_prefix']['value'] . "tweets where author_username='******' and in_reply_to_user_id is null order by pub_date asc", $twitter_username); $tweets = $wpdb2->get_results($sql); if ($tweets) { echo str_replace('#twitter_username#', $twitter_username, $title); echo "{$before}"; foreach ($tweets as $t) { $tweet_content = linkUrls($t->tweet_html); $tweet_content = linkTwitterUsers($tweet_content); echo "{$before_tweet}{$before_tweet_html}{$tweet_content}{$after_tweet_html} {$before_date}<a href=\"http://twitter.com/{$twitter_username}/statuses/{$t->status_id}/\">" . actual_time($date_format, $gmt_offset, strtotime($t->pub_date)) . "</a>{$after_date}{$after_tweet}"; } echo "{$after}"; } else { echo "No tweets found in ThinkTank for {$twitter_username}."; } }
function scrobbleTrack($userID, $trackID) { $now = date("Y-m-d H:i:s"); $gmt = actual_time("Y-m-d H:i:s", 0, time()); $insert = array('user_id' => $userID, 'track_id' => $trackID, 'scrobble_time' => $gmt); if ($this->db->insert('scrobbled_songs', $insert)) { $id = $this->db->insert_id(); return $id; } else { return FALSE; } }
function twitalytic_chron_archive_handler($atts) { extract(shortcode_atts(array('twitter_username' => 'twitalytic', 'title' => '<h3><a href="http://twitter.com/#twitter_username#/">@#twitter_username#</a>\'s Tweets in Chronological Order (sans replies)</h3>', 'before' => '<br /><ul>', 'after' => '</ul>', 'before_tweet' => '<li>', 'after_tweet' => '</li>', 'before_date' => '', 'after_date' => '', 'before_tweet_html' => '', 'after_tweet_html' => '', 'date_format' => 'Y.m.d, g:ia', 'gmt_offset' => 8), $atts)); global $wpdb; $sql = $wpdb->prepare("select \r\n\t\tpub_date, tweet_html, status_id \r\n\t\tfrom ta_tweets \r\n\t\twhere author_username='******' and in_reply_to_user_id is null \r\n\t\torder by pub_date asc", $twitter_username); $tweets = $wpdb->get_results($sql); $output = ''; if ($tweets) { $output .= str_replace('#twitter_username#', $twitter_username, $title); $output .= "{$before}"; foreach ($tweets as $t) { $tweet_content = linkUrls($t->tweet_html); $tweet_content = linkTwitterUsers($tweet_content); $output .= "{$before_tweet}{$before_tweet_html}{$tweet_content}{$after_tweet_html} {$before_date}<a href=\"http://twitter.com/{$twitter_username}/statuses/{$t->status_id}/\">" . actual_time($date_format, $gmt_offset, strtotime($t->pub_date)) . "</a>{$after_date}{$after_tweet}"; } $output .= "{$after}"; } else { $output .= "No tweets found in Twitalytic for {$twitter_username}."; } return $output; }