Not Solved [plugin] "noparse" tag
#1
Not Solved
Hi,

I've just made a plugin for MyBB and want to share it with you all Smile

It's the noparse tag. It adds a tag that allows to post MyCode tags without they being parsed (recognized) so you can teach other how to use MyCode, for example.

Read the readme.txt inside the zip for more details.

choli Wink


Attached Files
.zip   noparse.zip (Size: 1.84 KB / Downloads: 282)
[Image: choli_av.php]
Reply
#2
Not Solved
Will this work for smiley's as well?

for example [noparse]:wink:[/noparse]
Reply
#3
Not Solved
[Image: choli_av.php]
Reply
#4
Not Solved
Thank you =) I'm using it now.
Reply
#5
Not Solved
There seems to be a problem while using this plugin on MyBB 1.01. When you don't edit functions_post.php, the first four characters of signatures get lost. You should add something in your plugin_activate function so that functions_post gets edited automatically on activation and on deactivation.
I tried this and it works:
function noparse_activate () {
	//EDIT FILES
	$fh = fopen('./inc/functions_post.php', "r") or cperror("Could not open file!"); //OPEN FILE
	$data = fread($fh, filesize('./inc/functions_post.php')) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
	fclose($fh); //CLOSE FILE AGAIN
	$newdata = preg_replace('#if\(\$allowsmilies != "no"\)#','$message = $plugins->run_hooks("pre_parse_message", $message);
if($allowsmilies != "no")',$data); //REPLACE IN STRING
	$fw = fopen('./inc/functions_post.php', "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
	$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
	fclose($fw); //CLOSE FILE AGAIN
}

function noparse_deactivate () {
	//EDIT FILES
	$fh = fopen('./inc/functions_post.php', "r") or cperror("Could not open file!"); //OPEN FILE
	$data = fread($fh, filesize('./inc/functions_post.php')) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
	fclose($fh); //CLOSE FILE AGAIN
	$newdata = preg_replace('#\$message = \$plugins->run_hooks\("pre_parse_message", \$message\);
if\(\$allowsmilies != "no"\)#s','if($allowsmilies != "no")',$data); //REPLACE IN STRING
	$fw = fopen('./inc/functions_post.php', "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
	$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
	fclose($fw); //CLOSE FILE AGAIN
}
If you use this, don't forget to write in the readme file that users have to chmod their inc/functions_post.php to 755 or 777.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)