webForumDet fria alternativet

Inte visa bild i citat-funktion (bbkod)

PHP

1 svar · 360 visningar · startad av Guldstrand

Medlem sedan juli 20041 271 inlägg
Frågan#1

Jag använder följande kod till en citat-funktion (bbkod).

function format_quotes($s)
{
  while ($old_s != $s)
  {
  	$old_s = $s;

	  //find first occurrence of [/quote]
	  $close = strpos($s, "[/quote]");
	  if ($close === false)
	  	return $s;

	  //find last [quote] before first [/quote]
	  //note that there is no check for correct syntax
	  $open = _strlastpos(substr($s,0,$close), "[quote");
	  if ($open === false)
	    return $s;

	  $quote = substr($s,$open,$close - $open + 8);

	  //[quote]Text[/quote]
	  $quote = preg_replace(
	    "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
	    "<b>Citat:</b><blockquote>\\1</blockquote>", $quote);

	  //[quote=Author]Text[/quote]
	  $quote = preg_replace(
	    "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
	    "<b>\\1 skrev:</b><blockquote>\\2</blockquote>", $quote);

	  $s = substr($s,0,$open) . $quote . substr($s,$close + 8);
  }

	return $s;
}

Nu skulle jag vilja fixa så att inga bilder syns i citatet, utan endast länken till bilden. Hur löser jag det?

Alltså.. om någon citerar ett inlägg som innehåller en bild, då vill jag automatiskt ta bort [ img ][ /img ] -taggarna, och endast visa länken till bilden i citatet.

Medlem sedan juli 20041 271 inlägg
#2

*bump*

264 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
118 ms — deklarationer (db)
0 ms — hämta statistik (cache)
139 ms — hämta tråd, inlägg och bilagor (db)
122 ms — ändringar (db)