<?php
$val= "beti kb tak aaogi yr :( <3";
echo "beti kb tak aaogi yr <img src=emotions/frown.gif title=frown />  <img src=emotions/heart.gif title=heart />";
function DisplayContent($val){
	$url =explode('/',$val);
	if($url[2]=='vimeo.com' || $url[2]=='www.vimeo.com'){
		$count_url = count($url);
		$vimeo_link =  'http://vimeo.com/'.$url[$count_url-1];
		$vimeo_link = str_replace('http://vimeo.com/', 'http://vimeo.com/api/v2/video/', $vimeo_link) . '.php';
		$html_returned = unserialize(file_get_contents($vimeo_link));
		$title_vimo = $html_returned[0]['title'];
		$thumb_url = $html_returned[0]['thumbnail_medium'];
		return '<label>'.$title_vimo.'</label><br><a href="videos.php?vimeo='.$url[$count_url-1].'"  class="a" onClick="$(this).modal({width:800, height:530}).open(); return false;"><img src="'.$thumb_url.'" style="width: 120px;height: 90px;"></a>';
	}else if($url[2]=='youtube.com' || $url[2]=='www.youtube.com'){
		$youtube_count = count($url);
		$youtubecode = explode('=',$url[$youtube_count-1]);
		$video_code = $youtubecode[1];
		$content = file_get_contents("http://www.youtube.com/get_video_info?video_id=".$video_code);
		parse_str($content, $ytarr);
		return '<label>'.$ytarr['title'].'</label><br><a href="videos.php?youtube='.$video_code.'"  class="a" onClick="$(this).modal({width:800, height:530}).open(); return false;"><img src="http://img.youtube.com/vi/'.$video_code.'/1.jpg"></a>';
	}else{
		$img =explode('-',$val);
		if($img[0]=='images'){
			$rand = rand();
			$_SESSION["'".$rand."'"] = $img[1];
			return '<a href="videos.php?images='.$rand.'"  class="a"  onClick="$(this).modal({width:800, height:530}).open(); return false;"><img src="uploads/statusimg/'.$img[1].'" style="max-width: 300px;"></a>';
		}else{
			$val = str_replace('o:)','<img src="emotions/angel.gif" title="angel" /> ',$val);
			$val = str_replace(':3','<img src="emotions/colonthree.gif" title="colonthree" /> ',$val);
			$val = str_replace('o.O','<img src="emotions/confused.gif" title="confused" /> ',$val);
			$val = str_replace(":'(",'<img src="emotions/cry.gif" title="cry" /> ',$val);
			$val = str_replace('3:)','<img src="emotions/devil.gif" title="devil" /> ',$val);
			$val = str_replace(':(','<img src="emotions/frown.gif" title="frown" /> ',$val);
			$val = str_replace(':O','<img src="emotions/gasp.gif" title="gasp" /> ',$val);
			$val = str_replace('8)','<img src="emotions/glasses.gif" title="glasses" /> ',$val);
			$val = str_replace(':D','<img src="emotions/grin.gif" title="grin" /> ',$val);
			$val = str_replace('>:(','<img src="emotions/grumpy.gif" title="grumpy" /> ',$val);
			$val = str_replace('<3','<img src="emotions/heart.gif" title="heart" /> ',$val);
			$val = str_replace('^_^','<img src="emotions/kiki.gif" title="kiki" /> ',$val);
			$val = str_replace(':*','<img src="emotions/kiss.gif" title="kiss" /> ',$val);
			$val = str_replace(':v','<img src="emotions/pacman.gif" title="pacman" /> ',$val);
			$val = str_replace(':)','<img src="emotions/smile.gif" title="smile" /> ',$val);
			$val = str_replace('-_-','<img src="emotions/squint.gif" title="squint" /> ',$val);
			$val = str_replace('8|','<img src="emotions/sunglasses.gif" title="sunglasses" /> ',$val);
			$val = str_replace(':/','<img src="emotions/unsure.gif" title="unsure" /> ',$val);
			$val = str_replace(':p','<img src="emotions/tongue.gif" title="tongue" /> ',$val);
			$val = str_replace('>:O','<img src="emotions/upset.gif" title="upset" /> ',$val);
			$val = str_replace(';)','<img src="emotions/wink.gif" title="wink" /> ',$val);
			return $val;
		}
	}
}
			
echo DisplayContent($val);
?>