function linkHash($x)
{
    $reg = "/\\#[a-zA-Z]+/";
    $new = array();
    $gg = explode(" ", $x);
    foreach ($gg as $word) {
        if (preg_match($reg, $word)) {
            $stripslash = explode("#", $word);
            $word = '<a href="https://twitter.com/hashtag/' . $stripslash[1] . '/?src=hash" target="_blank">' . $word . '</a>';
        }
        $word = urlFind($word);
        $word = hashTag($word);
        array_push($new, $word);
    }
    $tweetcontent = implode(" ", $new);
    return $tweetcontent;
}
function full_twitter_stream($att, $content = null){
  global $apiKey, $apiSec, $apiTok, $apiTokSec,  $username , $userID, $hash , $json, $looping;
  require_once "twitter/index.php";
  try{
  	checkStream($json);
		$tweetcontent = "";
		$hlink = "";
		$striphash = array();
		$findLink = array();
		$content = '<div id="twitterStream">';
  	$content .= '<a href="http://twitter.com/'.$username.'" target="_blank"><h1>@'.$username.'</h1></a>';
		
		//foreach($json as $data){
  	for($i = 0 ; $i < $looping; $i++){

    	$datesplit = explode(" ", $json[$i]->created_at);
			$date = $datesplit[1]."<br>".$datesplit[2];
    	$url = "http://twitter.com/".$username."/status/".$json[$i]->id_str;
    	
    	if($json[$i]->entities->hashtags){
    			$tweetcontent= linkHash($json[$i]->text);
    	}
    	else{
    		$arr = array();
    		$arr = explode(" ", $json[$i]->text);
    		$jh = urlFind($arr);
        $tweetcontent = hashTag($jh);
    	}

    	$content .= 
    		'<div class="tweet">
    			<div class="col one">
    				<div class="date">'
    				.	$date.
    				'</div>
    			</div>
    			<div class="col two">
    				<div class="content">'
        				.$tweetcontent.
      				'</div>
      				<div class="url">
      					<div class="line"></div>
      					<a href="'.$url.'" target="_blank">
      						See Tweet
      					</a>
      				</div>
    			</div>
    		</div>'
    	;
  	}  
  
  	$content .= '</div>';
    
  	$output = "";
  	$output .= $content;
  	return $output;
  }
  catch(Exception $e){
		return "Opps Looks like Twitter is having issues.<br> " .$e->getMessage();
	}

}