]*href\s*=\s*[\"\']?([^\'\" >]+)[\'\" >]/i"; preg_match_all ("/a[\s]+[^>]*?href[\s]?=[\s\"\']+". "(.*?)[\"\']+.*?>"."([^<]+|.*?)?<\/a>/", $content, &$matches); $total = count($matches[0]); $links = array(); for($i=0;$i<$total;$i++){ $links[$i]['html'] = $matches[0][$i]; $links[$i]['href'] = $matches[1][$i]; $links[$i]['link'] = $matches[2][$i]; } return $links; } function replace_urls($content) { $links = extract_urls($content); $_link_count = count($links); $_links = $links; $footerHTML=""; $counter=1; if ($_link_count>0){ $footerHTML = "
Links";
for($i=0;$i<$_link_count;$i++){
if (!preg_match('#\.(jpg|png|gif)$#', $_links[$i]['href'])){
$_new_links = $_links[$i]['html']."[".$counter."]";
$content = str_replace($_links[$i]['html'],$_new_links,$content);
if (strlen($_links[$i]['href'])>64){
$ahref = TinyURL($_links[$i]['href']);
} else {
$ahref = $_links[$i]['href'];
}
$footerHTML = $footerHTML."
[".$counter."] ".$ahref."";
$counter = $counter + 1;
}
}
$footerHTML = $footerHTML."
QR Code
You can read this post online by scanning this barcode (or visiting ".$perm_link.")
".addQRCode($perm_link)."