diff --git a/my-definitive-spam-fucker.php b/my-definitive-spam-fucker.php index 282465d..c7bf416 100644 --- a/my-definitive-spam-fucker.php +++ b/my-definitive-spam-fucker.php @@ -1,34 +1,78 @@ 400, 'back_link' => true, ] ); } } return $approved; } - add_filter( 'pre_comment_approved', 'my_definitive_spam_fucker_handler', '99', 2 ); + +/** + * Unuseful callback fired when the plugin is activated + */ +function my_definitive_spam_fucker_activation() { + add_option( 'my_definitive_spam_fucker_init', date('U'), '', false ); + add_option( 'my_definitive_spam_fucker_count', 0 , '', false ); +} +register_uninstall_hook( __FILE__, 'my_definitive_spam_fucker_activation' ); + +/** + * Unuseful callback fired when the plugin is uninstalled + */ +function my_definitive_spam_fucker_uninstall() { + delete_option( 'my_definitive_spam_fucker_init' ); + delete_option( 'my_definitive_spam_fucker_count' ); +} +register_uninstall_hook( __FILE__, 'my_definitive_spam_fucker_uninstall' ); + +/** + * Register the unuseful Dashboard widget + */ +function my_definitive_spam_fucker_dashboard_widget() { + wp_add_dashboard_widget( 'my_definitive_spam_fucker_dashboard_widget', __( "My Definitive SPAM Fucker", 'my-definitive-spam-fucker' ), 'my_definitive_spam_fucker_dashboard_widget_content' ); +} + +/** + * Register the unuseful Dashboard widget content + */ +function my_definitive_spam_fucker_dashboard_widget_content() { + echo '
'; + printf( + __( "Spammers fucked since activation: %s and counting!", 'my-definitive-spam-fucker' ), + '' . get_option( 'my_definitive_spam_fucker_count', 0 ) . '' + ); + echo '
'; +} +add_action( 'wp_dashboard_setup', 'my_definitive_spam_fucker_dashboard_widget' );