Example #1
0
function tweetable_write_trackmenu()
{
    tweetable_admin_page_header();
    $user_name = get_option('tweetable_twitter_user');
    $user_key = get_option('tweetable_access_token');
    $user_key_secret = get_option('tweetable_access_token_secret');
    $twitter = new Twitter_API(get_option('tweetable_app_key'), get_option('tweetable_app_key_secret'));
    echo '<h2>Twitter: Track</h2>';
    ?>
	
	<div id="twitter-submit">
	<form action="" name="post-twitter">
	<p id="tweet-tools">
	<span id="twitter-tools"><a href="#" id="shorten-url" title="Shorten Link"><img src="<?php 
    echo tweetable_get_plugin_dir('url');
    ?>
/images/page_link.png" alt="Shorten Link" /></a></span> &nbsp;
	<span id="chars-left"><strong>140</strong> characters left</span>
	</p>
	<textarea name="tweet" id="tweet" rows="2" cols="75"></textarea>
	<input type="hidden" name="in_reply_to_user" id="in_reply_to_user" value="" />
	<input type="hidden" name="in_reply_to_status" id="in_reply_to_status" value="" />
	<input type="hidden" name="do" id="do_action" value="update-status" />
	<input type="hidden" name="token" id="js_token" value="<?php 
    echo md5($user_key);
    ?>
" />
	<input type="hidden" name="post_to" id="post_to" value="<?php 
    echo tweetable_get_plugin_dir('url');
    ?>
/form_post.php" />
	<div id="my-latest-status">
	<?php 
    $latest = tweetable_fetch_latest_tweet();
    $date = date('F j, Y g:i', strtotime($latest['tweet']['created_at']));
    echo '<strong>Latest: </strong>' . $latest['tweet']['text'] . ' <em>' . $date . '</em>';
    ?>
	</div>
	<p style="text-align:right;"><span id="loading-send-tweet" style="display:none;"><img src="<?php 
    echo tweetable_get_plugin_dir('url');
    ?>
/images/loading.gif" alt="Loading..." style="vertical-align:middle" /></span> <input type="submit" class="button-primary" id="update-status" value="Update Status" name="submit" /></p>
	</form>
	<br style="clear:both" />
	</div>
	
	<p class="search-box" style="float:none; margin: 0 0 25px 5px;">
		<label class="hidden" for="twitter-search-input">New Twitter Search:</label>
		<input type="text" class="search-input" id="twitter-search-input" name="s" value="" />
		<input type="submit" value="New Search" id="add-search" class="button" />
		<span id="loading-add-search" style="display:none;"><img src="<?php 
    echo tweetable_get_plugin_dir('url');
    ?>
/images/loading.gif" alt="Loading..." style="vertical-align:middle" /></span>
	</p>	

	<?php 
    $searches = get_option('tweetable_saved_searches');
    if ($searches) {
        foreach ($searches as $search) {
            echo '<div class="search-div" id="search-' . array_search($search, $searches) . '">';
            echo '<h3>' . $search . ' <a href="#" class="delete-search" title="Remove"><img src="' . tweetable_get_plugin_dir('url') . '/images/delete.png" alt="Delete" style="vertical-align:middle" /></a></h3>';
            echo '<div class="twitter_timeline">';
            echo '<ol id="tweetable-timeline">';
            $results = $twitter->search($search, 'en', '10');
            foreach ($results->entry as $tweet) {
                $tweet->content = preg_replace('/<a\\shref=\\"([^\\"]*)\\"><b>\\#(.*)<\\/b><\\/a>/siU', '<a href="' . tweetable_get_plugin_dir('url') . '/dialog.php?show=hashtag&hashtag=\\2&KeepThis=true&amp;TB_iframe=true&amp;height=450&amp;width=680" class="thickbox hashtag" title="Hashtag Search">#\\2</a>', $tweet->content);
                $status_id = explode(':', $tweet->id);
                $status_id = $status_id[2];
                $status_user = explode(' (', $tweet->author->name);
                $status_user = $status_user[0];
                echo '<li class="status" id="' . $status_id . '">';
                echo '<span class="twitter_thumb"><img src="' . $tweet->link[1]['href'] . '" width="48" height="48" alt="" /></span>';
                echo '<span class="twitter_status">';
                echo '<strong><a class="user" href="' . $tweet->link[0]['href'] . '">' . $status_user . '</a></strong> ';
                echo '<span class="status-text">' . make_clickable($tweet->content) . '</span>';
                $date = date('F j, Y g:i', strtotime($tweet->published));
                echo '<span class="twitter_meta">' . $date . '</span>';
                echo '</span>';
                echo '<span class="twitter_functions">';
                echo '<a class="reply" href="#"><img src="' . tweetable_get_plugin_dir('url') . '/images/reply.png" alt="Reply" title="Reply" /></a>&nbsp;';
                echo '<a class="retweet" href="#"><img src="' . tweetable_get_plugin_dir('url') . '/images/retweet.png" alt="Retweet" title="Retweet" /></a>';
                echo '</span>';
                echo '<br style="clear:both" />';
                echo '</li>';
            }
            echo '</ol>';
            echo '</div>';
            echo '</div>';
        }
    } else {
        echo 'No searches are currently running. Maybe you should add a few?';
    }
    tweetable_admin_page_footer();
}
Example #2
0
function hashtag($title, $hashtag)
{
    if (!defined('WP_CONTENT_URL')) {
        define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php 
    echo $title;
    ?>
</title>
<link rel='stylesheet' href='http://wp.ntugo.com/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load=global' type='text/css' media='all' />
<link rel='stylesheet' id='colors-css'  href='http://wp.ntugo.com/wp-admin/css/colors-fresh.css?ver=20090610' type='text/css' media='all' />
<link rel="stylesheet" href="<?php 
    echo tweetable_get_plugin_dir('url');
    ?>
/admin_css.css" type="text/css" />
<style>
.search-div {
	margin-left: 15px;
}
</style>
</head>
<body>
	<?php 
    $twitter = new Twitter_API();
    echo '<div class="search-div">';
    echo '<h3>#' . $hashtag . '</h3>';
    echo '<div class="twitter_timeline">';
    echo '<ol id="tweetable-timeline">';
    $results = $twitter->search($hashtag, 'en', '30');
    foreach ($results->entry as $tweet) {
        $tweet->content = preg_replace('/<a\\shref=\\"([^\\"]*)\\">\\#<b>(.*)<\\/b><\\/a>/siU', '<a href="' . tweetable_get_plugin_dir('url') . '/dialog.php?show=hashtag&hashtag=\\2&KeepThis=true&amp;TB_iframe=true&amp;height=450&amp;width=680" class="thickbox hashtag" title="Hashtag Search">#\\2</a>', $tweet->content);
        $status_id = explode(':', $tweet->id);
        $status_id = $status_id[2];
        $status_user = explode(' (', $tweet->author->name);
        $status_user = $status_user[0];
        echo '<li class="status" id="' . $status_id . '">';
        echo '<span class="twitter_thumb"><img src="' . $tweet->link[1]['href'] . '" width="48" height="48" alt="" /></span>';
        echo '<span class="twitter_status">';
        echo '<strong><a class="user" href="' . $tweet->link[0]['href'] . '">' . $status_user . '</a></strong> ';
        echo '<span class="status-text">' . make_clickable($tweet->content) . '</span>';
        $date = date('F j, Y g:i', strtotime($tweet->published));
        echo '<span class="twitter_meta">' . $date . '</span>';
        echo '</span>';
        echo '</span>';
        echo '<br style="clear:both" />';
        echo '</li>';
    }
    echo '</ol>';
    echo '</div>';
    echo '</div>';
    echo '</body></html>';
}