示例#1
0
function analysis($word)
{
    $users = search($word);
    // ユーザーIDの配列
    $tweets = array();
    // ユーザーのツイート
    $lists = array();
    // ユーザーが登録されているリスト
    $follow_rates = array();
    // 相互フォロー率の配列
    // ユーザーごとのツイートとリストの集約
    foreach ($users as $user) {
        $user_id = $user['user_id'];
        $tweets = array_merge($tweets, get_tweets($user_id));
        $lists = array_merge($lists, get_lists($user_id));
        // 相互フォロー率の統計
        $rate = get_follow_rate($user_id);
        if (isset($follow_rates[$rate])) {
            $follow_rates[$rate]++;
        } else {
            $follow_rates[$rate] = 1;
        }
    }
    ksort($follow_rates, SORT_NUMERIC);
    // ツイート位置情報の統計
    $geos = get_geos($tweets);
    // ツイート日の統計
    $tweet_dates = get_date_for_tweets($tweets);
    // ツイート時間の統計
    $tweet_times = get_time_for_tweets($tweets);
    // ツイート長の統計
    $tweet_length = get_length_for_tweets($tweets);
    // ハッシュタグの統計
    $hash_tags = get_hash_tags($tweets);
    // ソート
    asort($lists);
    asort($hash_tags);
    $res = array("user" => $users, "tweet" => $tweets, "geo" => $geos, "list" => $lists, "tweet_date" => $tweet_dates, "tweet_time" => $tweet_times, "tweet_length" => $tweet_length, "hash_tag" => $hash_tags, "follow_rate" => $follow_rates);
    //    var_dump($res);
    return $res;
}
示例#2
0
					</h2>
					
					<?php 
echo get_dagens_digt();
?>
					
				</section>
										
				<section class="col-sm-4 col-xs-6">
				
					<h2>
						Tweets
					</h2>
					
					<?php 
echo get_tweets();
?>
					
				</section>

				<!-- top_row -->
			</div>
		
			<div class="row">
				<!-- bottom_row -->
			
				<section class="col-sm-4 col-xs-6">
					
					<h2>
						Populære digte
					</h2>
示例#3
0
文件: ajax.php 项目: jnpdx/combotweet
} elseif ($func == 'get_tweets') {
    $panel_id = $_REQUEST['panel'];
    $page = $_REQUEST['page'];
    $location = $_REQUEST['location'];
    $location_dist = $_REQUEST['location_search_dist'];
    $since = $_REQUEST['since'];
    $tweet_type = $_REQUEST['tweet_type'];
    $tw_user = $_SESSION['panels'][$panel_id]->user;
    $tw_pass = $_SESSION['panels'][$panel_id]->pass;
    $panel_type = $_SESSION['panels'][$panel_id]->panel_type;
    header("Content-type: text/javascript");
    if ($panel_type == "search") {
        $tweets = get_search_tweets($tw_user, $location, $location_dist, $page, $since);
    } elseif ($panel_type == 'regular') {
        //if ($tweet_type != 'replies') {
        $tweets = get_tweets($tw_user, $tw_pass, $tweet_type, $page, $since);
        //} else {
        //$tweets = get_search_tweets($tw_user,$location,$location_dist,$page,$since);
        //}
    } elseif ($panel_type == 'shizzow_panel') {
        $tweets = get_shizzow_shouts($tw_user, $tw_pass);
    }
    echo $tweets;
} elseif ($func == 'send_tweet') {
    $panel_id = $_REQUEST['panel'];
    $tw_user = $_SESSION['panels'][$panel_id]->user;
    $tw_pass = $_SESSION['panels'][$panel_id]->pass;
    $reply_to = $_REQUEST['reply_to'];
    $reply_to_name = $_REQUEST['reply_to_name'];
    $dm = $_REQUEST['direct_message'];
    $tweet = stripslashes($_REQUEST['tweet_data']);
示例#4
0
文件: tag.php 项目: WaitButWhy/www
        ?>
"><i class="icon-facebook" style="margin-left:4px;"></i> <?php 
        //echo get_shares($url);
        ?>
</a>-->
                        
                        
                        
                        <a href="https://twitter.com/intent/tweet?text=<?php 
        urlencode(the_title());
        ?>
&url=<?php 
        echo $url;
        ?>
"><i class="icon-twitter"></i> <?php 
        echo get_tweets($url);
        ?>
</a>
                        
                        <a href="https://plus.google.com/share?url=<?php 
        echo $url;
        ?>
"><i class="icon-google-plus"></i> <?php 
        echo $gPlusCount;
        ?>
</a>
                        <div class="homeFBL2"><fb:like href="<?php 
        echo $url;
        ?>
" layout="button_count" action="like" show_faces="false" share="false"></fb:like></div>
                        
    }
    //end if-else user == user
}
//end while transaction
mysql_query("DELETE FROM server_unit_transaction WHERE eta < {$time}") or die(mysql_error());
$transactions = mysql_query("SELECT city_id,building_id FROM server_building_transaction WHERE eta < {$time}") or die(mysql_error());
while ($transaction = mysql_fetch_assoc($transactions)) {
    $city = new city($transaction['city_id']);
    $city->finish_build($transaction['building_id']);
}
//end while transaction
mysql_query("DELETE FROM server_building_transaction WHERE eta < {$time}") or die(mysql_error());
mysql_query("DELETE FROM messages WHERE time < " . ceil($time - 60 * 3)) or die(mysql_error());
//delete all messages more than 3 minutes old
/* TWITTER */
$xml = get_tweets();
$first = true;
foreach ($xml->xpath('//direct_message') as $message) {
    //		if($first) file_put_contents('last_twitter', $message->id.'');
    $first = false;
    $user = mysql_query("SELECT user_id, last_server FROM users WHERE twitter='{$message->sender_screen_name}' LIMIT 1", $db) or die(mysql_error());
    $user = mysql_fetch_assoc($user);
    if (!$user || !$user['user_id']) {
        continue;
    }
    preg_match('/([\\s]+on[\\s+])?server[\\s]+(.*)$/i', $message->text, $server);
    $message->text = preg_replace('/([\\s]+on[\\s+])?server[\\s]+.*$/i', '', $message->text);
    if ($server[2]) {
        $server = new server($server[2]);
        mysql_query("UPDATE users SET last_server={$server->getID()} WHERE user_id={$user['user_id']} LIMIT 1", $db) or die(mysql_error());
    } else {
示例#6
0
    if (!$tweet_id || !$count) {
        status_header(400);
        wp_die();
    }
    get_tweets(function ($cb, $user) use($tweet_id) {
        return (array) $cb->statuses_retweets_ID('id=' . $tweet_id . '$count=' . $count);
    });
});
add_action('wp_ajax_status.get_mentions', function () {
    $count = get_param('count');
    if (!$count) {
        status_header(400);
        wp_die();
    }
    get_tweets(function ($cb, $user) {
        return (array) $cb->statuses_mentionsTimeline(array('trim_user' => false, 'count' => intval($count)));
    });
});
add_action('wp_ajax_status.get_timeline', function () {
    global $current_user;
    global $wpdb;
    header('Content-Type: application/json');
    $events = $wpdb->get_results($wpdb->prepare('SELECT ID as db_id, event, data, created_at FROM ' . $wpdb->prefix . 'twitter_data WHERE user_id = %d', $current_user->ID));
    foreach ($events as $event) {
        $event->data = json_decode($event->data);
        $event->analytics = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'twitter_analytics WHERE status_id = %d', $event->db_id));
    }
    $links = $wpdb->get_results($wpdb->prepare('SELECT ID as id, from_id, to_id FROM ' . $wpdb->prefix . 'twitter_data_links WHERE user_id = %d', $current_user->ID));
    echo json_encode(array('events' => $events, 'links' => $links));
    wp_die();
});
        }
        ?>

            <?php 
        if ($twitter_share != 'yes') {
            ?>
                <div class="pull-left single-soc-share-link-twitter">
                    <a target="_blank" href="https://twitter.com/share?url=<?php 
            echo $thepermalink;
            ?>
&text=<?php 
            the_title();
            ?>
" class="twitter-share-button">
                        <span><?php 
            echo get_tweets(get_permalink());
            ?>
</span>
                        <p><?php 
            _e('Twitter', 'tkingdom');
            ?>
</p>
                    </a>
                </div><!--/single-soc-share-link-twitter-->
            <?php 
        }
        ?>

            <?php 
        if ($google_share != 'yes') {
            ?>
示例#8
0
//debug
//アクセストークンを作成する
//最初に一度呼び出せば良い
TOATool::create_oauth("49650585-Jkfaz7X4v0SbEAkupLnczFOgLo3hL5asN7wGhy9Z4", "7gSHlpRoIiVSWlZYesyC7OZHLJunt7Vi8qWIYqKoo");
if (0) {
    //呼び出し
    $word = "一般意志";
    $results = search($word);
    //結果表示
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <title>Message</title> </head>";
    var_dump($results);
}
if (0) {
    //呼び出し
    $user_id = "49650585";
    $results = get_tweets($user_id);
    //結果表示
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <title>Message</title> </head>";
    var_dump($results);
}
if (0) {
    //呼び出し
    $user_id = "49650585";
    $results = get_lists($user_id);
    //結果表示
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <title>Message</title> </head>";
    var_dump($results);
}
if (0) {
    //呼び出し
    $user_id = "49650585";
示例#9
0
    function dw_ajax_tweets_setup()
    {
        global $social_wall_settings;
        if (!isset($_REQUEST['page_id'])) {
            exit(0);
        }
        $social_wall_settings = get_post_meta($_REQUEST['page_id'], 'dw-social-wall-settings', true);
        $social_wall_settings = wp_parse_args($social_wall_settings, array('heading-1' => '', 'heading-2' => '', 'short-intro' => '', 'welcome-box-bg-color' => '#fc615d', 'welcome-box-text-color' => '#fff', 'facebook-name' => '', 'twitter-query' => '', 'twitter-consumer-key' => '', 'twitter-consumer-secret' => '', 'google-plus-name' => '', 'google-plus-url' => '', 'flickr-id' => '', 'instagram-search' => ''));
        if (!$social_wall_settings['twitter-query']) {
            exit(0);
        }
        $tweets = get_tweets(array('query' => $social_wall_settings['twitter-query'], 'page_id' => $_REQUEST['page_id'], 'consumer_key' => $social_wall_settings['twitter-consumer-key'], 'consumer_secret' => $social_wall_settings['twitter-consumer-secret']));
        ?>
        <?php 
        if (!empty($tweets)) {
            ?>
        <?php 
            foreach ($tweets as $tweet) {
                ?>
                <p class="twitter-content"><?php 
                echo update_tweet_urls($tweet->text);
                ?>
</p>
                <p class="twitter-link"><a href="https://twitter.com/<?php 
                echo $tweet->user->screen_name;
                ?>
"><i class="icon-twitter"></i> @<?php 
                echo $tweet->user->screen_name;
                ?>
</a></p>
        <?php 
            }
            ?>
        <?php 
        }
        ?>
        <?php 
        exit(0);
    }
示例#10
0
$programs_id = get_page_by_path('residency-programs')->ID;
$programs_permalink = get_the_permalink($programs_id);
echo '<a href="' . $programs_permalink . '">Residency Programs</a>';
?>
			</h3>
			<div class="text">
				<?php 
echo strip_tags($programs_text);
echo '<a href="' . $programs_permalink . '">Learn more.</a>';
?>
			</div>
		</div>

		<div class="module social">
			<?php 
get_tweets(3);
$facebook_url = 'http://facebook.com/' . get_field('facebook', $about_id);
$instagram_handle = str_replace('@', '', get_field('instagram', $about_id));
$instagram_url = 'http://instagram.com/' . $instagram_handle;
?>
		</div>
		<div class="module links">
			<div class="link medium facebook half-border-right">
				<a href="<?php 
echo $facebook_url;
?>
" target="_blank">
					<h3>
						<div class="swap">
							<div class="icon default"></div>
							<div class="icon hover"></div>
示例#11
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $tweetid = '';
        $this_tweet = '';
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $consumer_key = isset($instance['consumer_key']) ? esc_attr($instance['consumer_key']) : '';
        $consumer_secret = isset($instance['consumer_secret']) ? esc_attr($instance['consumer_secret']) : '';
        $user_token = isset($instance['user_token']) ? esc_attr($instance['user_token']) : '';
        $user_secret = isset($instance['user_secret']) ? esc_attr($instance['user_secret']) : '';
        $username_widget = isset($instance['username_widget']) ? esc_attr($instance['username_widget']) : '';
        $num_of_tweets = isset($instance['num_of_tweets']) ? esc_attr($instance['num_of_tweets']) : '';
        echo $before_widget;
        // WIDGET display CODE Start
        if (!empty($title)) {
            echo $before_title;
        }
        echo $title;
        echo $after_title;
        $tweets = get_tweets($username_widget, $num_of_tweets, $consumer_key, $consumer_secret, $user_token, $user_secret);
        //echo '<ul id="tweets_crunchpress" class="tweetss">';
        $profile_image = 'profile_image';
        $follow_link = 'follow_link';
        $counter_twi = 2;
        echo '<script type="text/javascript">jQuery(document).ready(function ($) { $(".twitter-' . $counter_twi . '").bxSlider({mode:"fade"});});</script>';
        ?>
		<ul class="twitter-<?php 
        echo $counter_twi;
        ?>
" id="footer-tweet">
		<?php 
        $screen_name = '';
        if ($tweets != '') {
            $counter_twitter = 0;
            while ($this_tweet = array_shift($tweets)) {
                $counter_twitter++;
                $screen_name = $this_tweet->user->screen_name;
                ?>
					<li>
						<div class="tweets"> 
							<a href="http://twitter.com/<?php 
                echo $screen_name;
                ?>
/status/<?php 
                echo $this_tweet->id_str;
                ?>
"> <?php 
                echo $this_tweet->user->screen_name;
                ?>
</a>
							<p><?php 
                echo $this_tweet->text;
                ?>
</p>
							<strong class="name"><?php 
                echo $this_tweet->user->name;
                ?>
</strong>
						</div>
					</li>
			<?php 
            }
        }
        echo '</ul>';
        echo $after_widget;
    }