} echo "<p><hr>"; } else { echo "<h3>Top movies this week</h3>"; for ($i = 1; $i <= 9; $i += 1) { //$movies[$i] = preg_replace( "/\s\s+/", "", $movies[$i]); echo "What are people saying about <b>{$movies[$i]}</b>?<br><br>"; //echo "<br>".$movies[$i]; //echo urlencode($movies[$i]); //$temp_twitter_rss = "http://search.twitter.com/search.atom?q=".$search_url; $search_string = urlencode($movies[$i] . " saw"); $search_url = "http://search.twitter.com/search.atom?q=" . $search_string; //echo $search_url; $temp_twitter_rss = $search_url; //echo $temp_twitter_rss."<br>"; $twitter_raw_rss = curl_rss($temp_twitter_rss); //echo $twitter_raw_rss; $temp_title = get_title($twitter_raw_rss); //echo $temp_title; $temp_split = split("<title>", $twitter_raw_rss); for ($k = 1; $k <= 7; $k += 1) { $final_string_array = split("\\<", $temp_split[$k]); $tweets[$i][] = $final_string_array[0]; } for ($h = 1; $h <= 6; $h += 1) { echo "<li>" . $tweets[$i][$h] . "<br>"; //split_words($tweets[$h]); //$array_search_words = split_words($tweets[$h]); //foreach ($array_search_words as $value) { //$stripped_tweet = ereg_replace($value, "", $stripped_tweet); //}
function print_movie_block($movie_title) { $search_string = gen_search_string($movie_title); $search_url = "http://search.twitter.com/search.atom?q=" . $search_string . "&rpp=26"; //echo $search_url; $temp_twitter_rss = $search_url; //echo $temp_twitter_rss."<br>"; $twitter_raw_rss = curl_rss($temp_twitter_rss); //echo $twitter_raw_rss; //$temp_title = get_title($twitter_raw_rss); //$temp_author = get_author($twitter_raw_rss); //echo $temp_title; $temp_split = split("<title>", $twitter_raw_rss); $temp_split_author = split("<uri>", $twitter_raw_rss); $search_string_yt = urlencode($movie_title . " trailer"); $search_url_yt = "http://gdata.youtube.com/feeds/base/videos?q=" . $search_string_yt; $temp_yt_rss = $search_url_yt; //echo $temp_yt_rss."<br>"; $yt_raw_rss = curl_rss($temp_yt_rss); //echo $yt_raw_rss; $temp_split_yt = split("i.ytimg.com\\/vi\\/", $yt_raw_rss); $yt_id = substr($temp_split_yt[1], 0, 11); echo "<table cellpadding='2' align='center' border='0'>"; echo "<tr>"; echo "<td valign='top'><div class='movieHeader'>Tweets about <b>{$movie_title}</b></div>"; //echo "<div class='scroll' id='friendDiv' style='display:none'><div class='reviewBlock' style='background-color:#CCC;' id='reviewDiv'><div class='tweetText'> <a href='http://www.twitter.com/Daughterpick'>@Daughterpick</a> Saw the trailer when we took Grace to see Hotel for Dogs. Chow Yun Fat is in it... and he's the Man!</div> <div class='authorText'><a href='http://twitter.com/patman23'>patman23</a></div></div></div>"; echo "<div class='scroll' id='tweetsDiv' style='display:block'>"; for ($k = 1; $k <= 26; $k += 1) { $final_string_array = split("\\<", $temp_split[$k]); $final_string_array_author = split("\\<", $temp_split_author[$k]); $tweets[$i][] = $final_string_array[0]; $authors[$i][] = $final_string_array_author[0]; } for ($h = 1; $h <= 6; $h += 1) { if ($tweets[$i][$h] == "") { echo ""; } else { $pos_at = strpos($tweets[$i][$h], "@"); if ($pos_at > -1) { $name_string = split(" ", $tweets[$i][$h]); $tweets[$i][$h] = ""; foreach ($name_string as $value) { $pos_at_2 = strpos($value, "@"); if ($pos_at_2 > -1) { $value_no_a = $movie_string = ereg_replace("@", '', $value); $value = "<a href='http://www.twitter.com/" . $value_no_a . "'>" . $value . "</a>"; } $tweets[$i][$h] = $tweets[$i][$h] . " " . $value; } } } echo "<div class='reviewBlock'><div class='tweetText'>" . $tweets[$i][$h] . "</div> <div class='authorText'><a href='" . $authors[$i][$h - 1] . "'>" . substr($authors[$i][$h - 1], 19) . "</a></div></div>"; } $next_block = ""; for ($h = 7; $h <= 25; $h += 1) { if ($tweets[$i][$h] == "") { echo ""; } else { $pos_at = strpos($tweets[$i][$h], "@"); if ($pos_at > -1) { $name_string = split(" ", $tweets[$i][$h]); $tweets[$i][$h] = ""; foreach ($name_string as $value) { $pos_at_2 = strpos($value, "@"); if ($pos_at_2 > -1) { $value_no_a = $movie_string = ereg_replace("@", '', $value); $value = "<a href='http://www.twitter.com/" . $value_no_a . "'>" . $value . "</a>"; } $tweets[$i][$h] = $tweets[$i][$h] . " " . $value; } } } $next_block = $next_block . "<div class='reviewBlock'><div class='tweetText' >" . $tweets[$i][$h] . "</div> <div class='authorText'><a href='" . $authors[$i][$h - 1] . "'>" . substr($authors[$i][$h - 1], 19) . "</a></div></div>"; } echo "<div><input id='btn1' name='btnl' style='width:100%;' type='button' value='Show 20 more' onclick='document.getElementById(\"btn1\").style.display=\"none\";p=document.getElementById(\"tweets20\");pclone=p.cloneNode(true);document.getElementById(\"tweetsDiv\").appendChild(pclone);p=document.getElementById(\"moreButton\");pclone=p.cloneNode(true);document.getElementByID(\"tweetsDiv\").appendChild(pclone);document.getElementById(\"btn1\").style.display=\"hide\";' /></div>"; echo "</div>"; //echo "<div id='loginDiv' style='display:block' class='questionBlock movieHeader'>Sign in to see what your friends are saying <br>Username <input type='text' value='' name='username'><br>Password <input type='text' value='' name='password'> <input type='button' onClick='document.getElementById(\"loginDiv\").style.display=\"none\";document.getElementById(\"questionDiv\").style.display=\"block\";document.getElementById(\"tweetsDiv\").style.display=\"none\";document.getElementById(\"friendDiv\").style.display=\"block\";document.loginForm.userInput.focus()' name='login' value='Sign In'></div>"; //echo "<div id='questionDiv' class='questionBlock' style='display:none;'><form name='loginForm'><textarea name='userInput' cols='42' rows='2' wrap='soft' value='".$movie_title."'></textarea><br><input type='submit' name='testpost' value='Post to Twitter'></form></div></td>"; echo "<td valign='top'><div class='playerDiv'><object height='344' width='425'><param name='movie' value='http://www.youtube.com/v/" . $yt_id . "&hl=en&fs=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/" . $yt_id . "&hl=en&fs=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' height='344' width='425'></embed></object></div>"; //echo "<div class='questionBlock movieHeader'><b>$movie_title movie trailer</b><span class='tweetText'></span></div>"; echo "</td>"; echo "</tr></table>"; $next_block = $next_block . "<div id='btn12'><input id='button2' name='btnl2' style='width:100%;' type='button' value='Show 20 more' onclick='p=document.getElementById(\"tweets20\");pclone=p.cloneNode(true);document.getElementById(\"tweetsDiv\").appendChild(pclone);p=document.getElementById(\"moreButton\");pclone=p.cloneNode(true);document.getElementById(\"tweetsDiv\").appendChild(pclone);' />"; echo "<div style='display:none'><div id='tweets20'>" . $next_block . "</div></div>"; }