Re: BBcode/html/smilies
| From: | Rodrigo Magri | Date: | Thu, 12 Feb 2004 12:44:40 +0000 |
| Subject: | Re: BBcode/html/smilies | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-45431@lists.php.net to get a copy of this message | ||
<?php
function bbcode_replace($data) {
//pad so we can match /somethings/ at the end and vice versa at start
$data = " ".$data." ";
//$data = str_replace("<", "<", $data);
//$data = str_replace(">", ">", $data);
$data = htmlentities($data,ENT_QUOTES);
$matches = array ( "/[b](.*?)[/b]/is",
"/[heading](.*?)[/heading]/is",
"/[link]((ht|f)tp://.*?)[/link]/is",
"/[link](.*?)[/link]/is",
"/[link=((ht|f)tp://.*?)](.*?)[/link]/is",
"/[link=(.*?)](.*?)[/link]/is",
"/[email](.*?)[/email]/is",
"/[email=(.*?)](.*?)[/email]/is",
"/\s([a-zA-Z0-9.-_]+@[a-zA-Z0-9.-_]+)\s/",
"/\s((ht|f)tp://\S+)\s/",
"/[i](.*?)[/i]/is",
"/[quote](rn|n|)(.*?)[/quote]/is",
"/[uline](.*?)[/uline]/is",
);
$replace = array ( "<span class='bold'>\1</span>",
"<span class='heading'>\1</span>",
"<a href='\1'
target='_blank'>\1</a>",
"<a href='http://\1'
target='_blank'>\1</a>",
"<a href='\1'
target='_blank'>\3</a>",
"<a href='http://\1'
target='_blank'>\2</a>",
"<a href='mailto:\1'>\1</a>",
"<a href='mailto:\1'>\2</a>",
" <a href='mailto:\1'>\1</a> ",
" <a href='\1' target='_blank'>\1</a>
",
"<span class='italic'>\1</span>",
"<div class='quote'>\2</div>",
"<span class='uline'>\1</span>",
);
$data = preg_replace($matches,$replace,$data);
$data = nl2br($data);
return $data;
}
?>
----------------------------------------------------------------------------
----
Rodrigo Magri - Webmaster
Msn: rodri@chore.com.ar
Icq: 86960958
Web: www.chore.com.ar
----- Original Message -----
From: "cinefilo" <lpalcaide@yahoo.es>
To: <lista@phpes.com>
Sent: Thursday, February 12, 2004 9:06 AM
Subject: [PHP-ES] BBcode/html/smilies
> He terminado de hacer un foro en php para mi web,pero me gustaria tener la
opcion q tiene el phpbb , de los bbcode/html/smilies , necesito un manual o
algun script q pueda implementar este tipo de cosas, xq no lo encuentro ,
en google, no sale nada q merezca la pena ya q todo hace referencia al phpbb
de las paginas.
>
> Salu2
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Socio Hispalinux #5362 ( \---/ ) http://www.cinefiloweb.tk
> Usuario Linux #334721 ) . . ( http://cinefiloweb.cjb.net
> ____________________,--,_(___Y___)_,--,______________________
> ~~~~~~~~~~~~~~~~~~~~'--'~~~~~~~~~~~'--'~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
> ---------------------------------
>
> Antivirus #8226; Filtros antispam #8226; 6 MB gratis
> ¿Todavía no tienes un correo inteligente?