'; exit();}
else
{
if ($newurl<>$url)
{
if (preg_match($pattern,$newurl))
{
//$newurl is the real url with the own protocol http or https
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $newurl);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FILETIME, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 2);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
$store = curl_exec ($ch);
//Get response code
$response_code=curl_getinfo($ch,CURLINFO_HTTP_CODE);
//Not found?
if ($response_code=='404' or $response_code=='0') $newurl=false;
else $newurl= str_replace("HTTP","http",str_replace("HTTPS","https",(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL))));
if($ch!= null) curl_close($ch);
}
else $newurl=false;
}
if($newurl==false) {echo '
'._t('_ibdw_evowall_erroreurl').'
'; exit();}
else
{
$newstringa=$newurl;
/*We extract the Title from the head tags:*/
preg_match("/(.*)<\/head>/smUi",$store, $headers);
if(count($headers) > 0)
{
/*Fetch the charset of the page*/
$trovato=strpos($headers[1],"charset=");
if (preg_match('/charset\s*=\s*([a-zA-Z0-9- _]+)/', $headers[1], $results)) $charset= $results[1];
elseif(!$trovato===false)
{
$charset=str_replace("charset=","",substr($headers[1],$trovato,$trovato+10));
$charset=str_replace('"','',$charset);
$charset=str_replace("'","",$charset);
$fine=strpos($charset,">");
$charset=substr($charset,0,$fine);
$charset=str_replace("<","",$charset);
$charset=str_replace(">","",$charset);
}
else $charset='None';
if(preg_match("/(.*)<\/title>/smUi",$headers[1], $titles))
{
if(count($titles) > 0)
{
/*If the charset information has been extracted, we convert it to UTF-8 - Otherwise we assume it's already UTF-8*/
if($charset == 'None') $title=trim(strip_tags($titles[1]));
else $title=trim(strip_tags(iconv($charset, "UTF-8", $titles[1])));
}
}
else
{
/*If there is no title given we take the url as a title*/
if(strlen($url) > 30) $title=trim(substr($url,30)).'...';
else $title= trim($url);
}
}
else
{
/*If there is no title given we take the url as a title*/
if(strlen($url) > 30) $title=trim(substr($url,30)).'...';
else $title= trim($url);
}
/*Let's fetch the META description or give a description is there is not description available*/
preg_match("|]*description[^>]*content=\"([^>]+)\"[^>]*>|smUi",$headers[1], $matches);
if(count($matches) > 0)
{
if($charset != 'None') $description= trim(strip_tags(iconv($charset, "UTF-8",$matches[1])));
else $description= trim(strip_tags($matches[1]));
}
else
{
//if the description is not retrieved using this method, try to use the php get_meta_tags function
$metatags=get_meta_tags($newurl);
$descr=$metatags['description'];
if ($descr<>"")
{
if($charset != 'None') $description= trim(strip_tags(iconv($charset, "UTF-8",$descr)));
else $description= trim(strip_tags($descr));
}
else
{
preg_match("/(.*)<\/body>/smUi",$store, $matches);
if(count($matches) > 0)
{
//$description = preg_replace('/<(script|style)(?:(?!<\/?\1).)*?<\/\1>/s',"",$matches[1]);
if($charset != 'None') $description= trim(substr(trim(strip_tags(preg_replace('/<(script|style)(?:(?!<\/?\1).)*?<\/\1>/s',"",iconv($charset, "UTF-8",$matches[1])))),0,250));
else $description= trim(substr(trim(strip_tags(preg_replace('/<(script|style)(?:(?!<\/?\1).)*?<\/\1>/s',"",$matches[1]))),0,250));
}
else
{
if($charset != 'None') $description= trim(substr(trim(strip_tags(iconv($charset, "UTF-8",$store))),0,250));
else $description= trim(substr(trim(strip_tags($store)),0,250));
}
}
}
$titolosito=$title;
$descrizione=$description;
}
}
if(strpos($newurl, "http://") !== false) $finalurl="http://".$url;
else $finalurl="https://".$url;
?>
';
echo '
';
echo '
';
if ($messagesent<>'' and str_replace('&','%26',$newstringa)<>str_replace('youtu.be/','www.youtube.com/watch?v=',$messagesent)) echo "
".str_replace("codapos1","'",$messagesent)."
";
echo '
'.$titolosito.'
';
echo '
'.$finalurl.'
';
echo '
'.$descrizione.'
';
echo '';
echo '';
echo '';
echo '
';
if ($messagesent<>'' and str_replace('&','%26',$newstringa)<>$messagesent)
{
echo '
'. _t('_ibdw_evowall_messageandpreview').'
';
echo '
'._t('_ibdw_evowall_justmessage').'
';
}
else
{
$messagesent="";
echo '
'. _t('_ibdw_evowall_bott_condividi_3').'
';
}
echo '
';//Chiusura del contenitore dei pulsanti
echo '
';//Chiusura del lato destro
echo '';//Chiusura del box contenitore
?>