$link_replacement = "
";
$shoutmessage = $data['shout_message'];
$shoutmessage = parsesmileys($shoutmessage);
//replace links with link image
$shoutmessage = preg_replace("#(^|[\r\n ]|^\])((http|https|ftp|ftps)://[\w\#$%&~/.\-;:=,?@\[\]+]*)(|[\r\n ]|^\[)#si", "\\1".$link_replacement." ", $shoutmessage);
$shoutmessage = preg_replace("#(^|[\r\n ]|^\])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)(|[\r\n ]|^\[)#si", "\\1".$link_replacement." ", $shoutmessage);
//parsing urls only with domain without www\ftp, http(s): or ftp(s): at the beggining
$shoutmessage = preg_replace("#(^|[\r\n ]|^\])([\w\#$%&~/.\-;:=,?@\[\]+]*\.(html|php3|htm|php|com|net|org|info|biz|aero|coop|museum|name|pro|gov|edu|mil|int|ac|ad|ae|ag|am|as|au|bb|be|bg|bi|bm|br|bt|bv|ca|cc|cd|ch|ck|cl|cm|cn|cr|cu|cx|cz|de|dk|do|ec|ee|es|fj|fm|fo|fr|gb|ge|gi|gl|gm|gr|gs|gt|gu|hk|hm|hr|hu|id|ir|ie|il|in|io|is|it|jo|jp|kr|ky|kz|lb|li|lk|lt|lu|ly|mc|mn|ms|mw|mx|na|nc|nl|no|nu|nz|pe|ph|pk|pl|pm|py|re|ro|ru|sa|se|sg|sh|si|sk|sm|su|tc|tf|th|tj|to|tr|tv|tw|ua|ue|ug|uk|us|uy|uz|va|vc|vg|vi|vn|vu|wf|ws|za|ai|al|an|ao|ar|az|ba|bf|bn|bo|bs|by|bz|cg|ci|co|cy|dz|eg|fi|fk|ga|gg|gh|im|je|ke|kg|kh|lc|lv|mc|mh|mo|mp|mr|mt|my|ni|np|om|pn|pt|ga|rw|sb|sc|sj|sn|sv|tp|af|aw|bd|bh|bj|bw|cf|cv|dj|dm|eh|er|et|gd|gf|gn|gq|gw|gy|ht|iq|jm|ki|km|kn|kp|kw|la|lr|ls|ma|mg|mk|ml|mm|mq|mu|mv|mz|ne|nf|ng|nr|pa|pf|pg|pr|pw|sd|sl|so|sr|st|sy|sz|td|tg|tk|tm|tt|tz|um|ye|zm|zw|agent|arts|auction|chat|church|club|family|free|game|golf|inc|kids|law|llc|llp|love|ltd|med|mp3|school|scifi|shop|soc|sport|tech|travel|video|xxx|america|com2|etc|earth|not|online|usa|z))(|[\r\n ]|^\[)#si", "\\1".$link_replacement." ", $shoutmessage);
//replace links with link image
echo "
\n".$shoutmessage."\n\n";