Code pour vos pages en Php
function bbcode($text) {
$text =
preg_replace("#\[img\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img\]#sie",
"'<img src=\\1' . str_replace(' ', '%20', '\\3') . '>'",
$text);
$text =
preg_replace("#\[url\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/url\]#sie",
"'<a href=\"\\1' . str_replace(' ', '%20', '\\3') . '\" target=blank>\\1\\3</a>'",
$text);
$text =
preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/",
"<a href=$1 target=_blank>$2</a>",
$text);
$text =
preg_replace("/\[b\](.+?)\[\/b\]/",
"<b>$1</b>",
$text);
$text =
preg_replace("/\[i\](.+?)\[\/i\]/",
"<i>$1</i>",
$text);
$text =
preg_replace("/\[u\](.+?)\[\/u\]/",
"<u>$1</u>",
$text);
$text =
preg_replace("/\[code\](.+?)\[\/code\]/",
"<table width=100%><tr><th align=left>Code :</th></tr><tr><td align=left><code>$1</code></td></tr></table>",
$text);
$text =
preg_replace("/\[quote=(.+?)\]/",
"<center><table width=80%><tr><th align=left>Message de $1 :</th></tr><tr><td align=left class=milieu_messages>",
$text);
$text =
preg_replace("/\[\/quote\]/",
"</td></tr></table></center>",
$text);
$text =
preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/",
"<font color=$1>$2</font>",
$text);
return $text;
}
EXEMPLE:
<tr>
<td width=394 height=3>
<p><font color=#FFFFFF>".bbcode(nl2br($mess))."</font></p>
</td>
</tr>
Original web not working, here's the code
<?php
/*
Plugin Name: Limit Posts
Plugin URI: http://labitacora.net/comunBlog/limit-post.phps
Description: Limits the displayed text length on the index page entries and generates a link to a page to read the full content if its bigger than the selected maximum length.
Usage: the_content_limit($max_charaters, $more_link)
Version: 1.1
Author: Alfonso Sánchez-Paus Díaz y Julián Simón de Castro
Author URI: http://labitacora.net/
License: GPL
Download URL: http://labitacora.net/comunBlog/limit-post.phps
Make:
In file index.php
replace the_content()
with the_content_limit(1000, "more")
*/
function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
}
else if ((strlen($content)>
$max_char) &&
($espacio =
strpos($content,
" ",
$max_char ))) {
$content =
substr($content,
0,
$espacio);
$content = $content;
}
else {
}
}
?>
Ça parait simple comme ça mais ça m'a pris du temps de trouver, donc pas la peine de le perdre :)
this is my firt code in my life... that is good!!!...