Who is online?
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest None
Most users ever online was 37 on Fri Sep 17, 2021 8:43 pm
Statistics
We have 15 registered usersThe newest registered user is bilde
Our users have posted a total of 271 messages in 27 subjects
deleted after updated
thanks testing thread
2 posters
Page 1 of 1
thanks testing thread
\sazdgfxhdgfjnyg
Last edited by Admin on Fri Jul 27, 2012 12:16 am; edited 1 time in total
Re: thanks testing thread
- Code:
//consider your string as the variable $string
//only do it if there is a code block in the text.
if(preg_match('/\[code\](.|\r|\n)*\[code\]', $string))
{
//split the string up at each starting [code] tag.
//so you got 'stuff inside code [/code] more stuff'
$codes = explode('[code]',$string);
for($i=0; $i<count($codes); $i++)
{
//now split that string at the closing code block. So you have the stuff inside the code block.
$code_content = explode('[/code]',$codes[$i]);
//fix the stuff in the code block.
$code_fixed = htmlspecialchars( $code_content[0] );
//Now replace the entry in the codes array with the new fixed content, plus everything after the closing code block.
$codes[$i] = $code_fixed .'</code></div>'. $code_content[1];
}
//join it all together again with the html for the opening code block instead.
$string = implode( '<div class="codediv"><code>', $codes);
}
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum