<?php
private function urls()
{
#$this->code = preg_replace('/(.*?)/','<a href="${1}">${1}</a>',$this->code); #$this->code = preg_replace('/(.*?)/','<a href="${1}">${2}</a>',$this->code);
$this->code = preg_replace('/http://(.*?)/','<a href="http://${1}">http://${1}</a>',$this->code); $this->code = preg_replace('/www.(.*?)/','<a href="http://www.${1}">www.${1}</a>',$this->code);
return true;
}
?>
Co zrobić, aby parsowało
, ,
http://cos, www.cos, i
http://www.cos, ale nie może się "nadpisywać", tak jak w tej chwili, czyli najpierw parsuje funkcja wyłapująca linki bez [url(=)][/url], a potem jeszcze ta z [url(=)][/url] i wychodzi np. takie coś:
Kod
<a href="<a href="http://">http://</a>google.pl/"><a href="http://">http://</a>google.pl/</a>
z tego
Kod
[url]http://google.pl/[/url]