All pastes #1024299 Raw Edit

FlatPress plugin by i_pk_pjers_i

public php v1 · immutable
#1024299 ·published 2008-05-20 22:38 UTC
rendered paste body
<?php/*Plugin Name: BadWordsPlugin URI: http://www.flatpress.org/Description: Adds a badword filter to FlatPressAuthor: i_pk_pjers_iVersion: 1.0Author URI: none, yet..*/ /*Sample FlatPress plugin coded by i_pk_pjers_i*Date: May 20, 2008*Reason:  Plugins4noobs*Installation: Save this file as plugin.badwords.php, make a folder called badwords in  fp-plugins, *and copy the file over to it, go into AdminCP, plugins, and enable the plugin.*FlatPress Plugins are simply functions, and using add_filter to call them, then enabling them in AdminCP*/function badwords($str) {  $str = str_replace('fuck', 'bad word detected', $str);$str = str_replace('shit', 'bad word detected', $str);$str = str_replace('bitch', 'bad word detected', $str);$str = str_replace('cock', 'bad word detected', $str);//Return is required so the function doesn't mess up FlatPressreturn $str;}/**Here add_filter is using the_content(a new blog post) and comment_text(a new blog comment) to call the badwords function,*And the badwords function responds by doing its "function", which is replacing badwords with "bad word detected".*/add_filter('the_content', 'badwords');add_filter('comment_text', 'badwords');//To code  your own plugin for FlatPress this is what the code would be: (Copy everything from /* Plugin name to the closing  author uri /*, //then copy from the < ? php to the ? >/*Plugin Name: pluginnamePlugin URI: http://www.flatpress.org/Description: does somethingAuthor: your nameVersion: 1.0Author URI: your website url*/ /*<?phpfunction yourpluginname($str) {//php code goes herereturn $str;}add_filter('whatwillcallitgoeshere', 'yourpluginname');?>*After adding that code in, (and adding php code, and filling in the "stuff" with actual values(ex: badwords as the function name), *you go into AdminCP, plugins, and enable the plugin you have created*/?>