Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/02/2011, 15:53
miguelpes
 
Fecha de Ingreso: enero-2011
Mensajes: 48
Antigüedad: 13 años, 4 meses
Puntos: 1
Problema con BBCODE.

Buenas gente, queria preguntaros una cosa...


Tengo una funcion para manejar los bbcode y hasta ahora me habia funcionado bien... pero, cuando pongo una direccion "larga" con barras / entre medias y tal, deja de funcionar,

alguien sabe por que es?

dejo aqui mi script:

Código PHP:
$a = array( 
      "/\[i\](.*?)\[\/i\]/is", 
      "/\[b\](.*?)\[\/b\]/is", 
      "/\[u\](.*?)\[\/u\]/is", 
      "/\[img\](.*?)\[\/img\]/is", 
      "/\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\](.*?)\[/url\]/is",
      "/<?php (.*?) ?>/is",
      "/<script>(.*?)<\/script>/is",
      "/\[youtube\](.*?)v=(.*?)&(.*?)\[\/youtube\]/is",
      "/\[youtube\](.*?)v=(.*?)\[\/youtube\]/is"
   ); 
   $b = array( 
      "<i>$1</i>", 
      "<b>$1</b>", 
      "<u>$1</u>", 
      "<img src=\"$1\" /><br/>", 
      "<a href=\"$1\">$2</a>",
      "$1",
      "$1",
      "<iframe title=\"YouTube video player\" style=\"margin-right:10%;margin-left:10%\" width=\"80%\" height=\"390\" src=\"http://www.youtube.com/embed/$2?wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe>",
      "<iframe title=\"YouTube video player\" style=\"margin-right:10%;margin-left:10%\" width=\"80%\" height=\"390\" src=\"http://www.youtube.com/embed/$2?wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe>"
   ); 
   $texto = preg_replace($a, $b, $texto); 
      $texto = nl2br($texto);
Me urge bastante muchas gracias un saludo.