Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Podobne do BBcode B | i | u | Quote | List | URL .....
boya
post
Post #1





Grupa: Zarejestrowani
Postów: 287
Pomógł: 0
Dołączył: 26.02.2003
Skąd: Ow/Pn

Ostrzeżenie: (0%)
-----


Mam pytanko a raczej problem
Jak zrobic takie cos taka weryfikacje bo to chyba to ze jak jakis uzytkownik pisze posta na mojej www i pisze link lub jakis text to mogl go pogrubic wstawiajac [ b]...[/b] lub ... i jak to dalej jest weryfikowane sadze ze gotowy zapis trafia do bazy a pozniej jest czytany i przechodzi przez CSS
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
hwao
post
Post #2


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




[php:1:5aef850481]<?php
function bbcode( $text) {

$text = nl2br( $text);

$text = str_replace("", "<span style="font-weight: bold">", $text);
$text = str_replace("", "</span>", $text);
$text = str_replace("", "<span style="text-decoration: underline">", $text);
$text = str_replace("", "</span>", $text);
$text = str_replace("", "<span style="font-style: italic">", $text);
$text = str_replace("", "</span>", $text);
$text = str_replace("", "<ul>", $text);
$text = str_replace("", "<li>", $text);
$text = str_replace("", "</ul>", $text);
$text = str_replace("[list]", "</ol>", $text);
$text = preg_replace("/[list]/si", "<ol type="1">", $text);
$text = preg_replace("/{6}|[a-z]+)]/si", "<span
style="color: 1">", $text);
$text = str_replace("
", "</span>", $text);
$text = preg_replace("/?[0-9])]/si", "<span style="font-size:
1px; line-height: normal">", $text);
$text = str_replace("
", "</span>", $text);

$patterns = array();
$replacements = array();
$patterns[] = "#[img](.*?)[/img]#si";
$replacements[] = "<img src="1" border="0" />";
$patterns[] =
"#[email=([a-z0-9&-_.]+?@[w-]+.([w-.]+.)?[w]+)]([a-z0-9&-_.]+?@[w-]+.([w-.]+.)?[w]+)[/email]#si";
$replacements[] = "<a href="mailto:1">1</a>";
$patterns[] = "#([^ "nrt<]*?)#is";
$replacements[] = "<a href="1" target="_blank" class="mb_link">1</a>";
$patterns[] = "#*?)](.*?)#is";
$replacements[] = "<a href="1" target="_blank" class="mb_link">2</a>";
$patterns[] =
"#[email=([a-z0-9&-_.]+?@[w-]+.([w-.]+.)?[w]+)](.*?)[/email]#si";
$replacements[] = "<a href="mailto:1">3</a>";

$text = preg_replace($patterns, $replacements, $text);
return $text;
}
?>[/php:1:5aef850481]
Ktoś już dał ten kod ale nie pamietam kto
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.12.2025 - 07:44