6 function widget_akismet_register() {
7 if ( function_exists('register_sidebar_widget') ) :
8 function widget_akismet($args) {
10 $options = get_option('widget_akismet');
11 $count = get_option('akismet_spam_count');
13 <?php echo $before_widget; ?>
14 <?php echo $before_title . $options['title'] . $after_title; ?>
15 <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><?php printf( _n( '%1$s%2$s%3$s %4$sspam comment%5$s %6$sblocked by%7$s<br />%8$sAkismet%9$s', '%1$s%2$s%3$s %4$sspam comments%5$s %6$sblocked by%7$s<br />%8$sAkismet%9$s', $count ), '<span id="akismet1"><span id="akismetcount">', number_format_i18n( $count ), '</span>', '<span id="akismetsc">', '</span></span>', '<span id="akismet2"><span id="akismetbb">', '</span>', '<span id="akismeta">', '</span></span>' ); ?></a></div></div>
16 <?php echo $after_widget; ?>
20 function widget_akismet_style() {
21 $plugin_dir = '/wp-content/plugins';
22 if ( defined( 'PLUGINDIR' ) )
23 $plugin_dir = '/' . PLUGINDIR;
26 <style type="text/css">
27 #aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none}
28 #aka:hover{border:none;text-decoration:none}
29 #aka:hover #akismet1{display:none}
30 #aka:hover #akismet2,#akismet1{display:block}
31 #akismet2{display:none;padding-top:2px}
32 #akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none}
33 #akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none}
34 #akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'), $plugin_dir; ?>/akismet/akismet.gif) no-repeat top left;border:none;color:#fff;font:11px 'Trebuchet MS','Myriad Pro',sans-serif;height:40px;line-height:100%;overflow:hidden;padding:8px 0 0;text-align:center;width:120px}
39 function widget_akismet_control() {
40 $options = $newoptions = get_option('widget_akismet');
41 if ( isset( $_POST['akismet-submit'] ) && $_POST["akismet-submit"] ) {
42 $newoptions['title'] = strip_tags(stripslashes($_POST["akismet-title"]));
43 if ( empty($newoptions['title']) ) $newoptions['title'] = __('Spam Blocked');
45 if ( $options != $newoptions ) {
46 $options = $newoptions;
47 update_option('widget_akismet', $options);
49 $title = htmlspecialchars($options['title'], ENT_QUOTES);
51 <p><label for="akismet-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="akismet-title" name="akismet-title" type="text" value="<?php echo $title; ?>" /></label></p>
52 <input type="hidden" id="akismet-submit" name="akismet-submit" value="1" />
56 if ( function_exists( 'wp_register_sidebar_widget' ) ) {
57 wp_register_sidebar_widget( 'akismet', 'Akismet', 'widget_akismet', null, 'akismet');
58 wp_register_widget_control( 'akismet', 'Akismet', 'widget_akismet_control', null, 75, 'akismet');
60 register_sidebar_widget('Akismet', 'widget_akismet', null, 'akismet');
61 register_widget_control('Akismet', 'widget_akismet_control', null, 75, 'akismet');
63 if ( is_active_widget('widget_akismet') )
64 add_action('wp_head', 'widget_akismet_style');
68 add_action('init', 'widget_akismet_register');
70 // Counter for non-widget users
71 function akismet_counter() {
72 $plugin_dir = '/wp-content/plugins';
73 if ( defined( 'PLUGINDIR' ) )
74 $plugin_dir = '/' . PLUGINDIR;
77 <style type="text/css">
78 #akismetwrap #aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none}
79 #aka:hover{border:none;text-decoration:none}
80 #aka:hover #akismet1{display:none}
81 #aka:hover #akismet2,#akismet1{display:block}
82 #akismet2{display:none;padding-top:2px}
83 #akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none}
84 #akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none}
85 #akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'), $plugin_dir; ?>/akismet/akismet.gif) no-repeat top left;border:none;color:#fff;font:11px 'Trebuchet MS','Myriad Pro',sans-serif;height:40px;line-height:100%;overflow:hidden;padding:8px 0 0;text-align:center;width:120px}
88 $count = get_option('akismet_spam_count');
89 printf( _n( '<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount">%1$s</span> <span id="akismetsc">spam comment</span></div> <div id="akismet2"><span id="akismetbb">blocked by</span><br /><span id="akismeta">Akismet</span></div></a></div></div>', '<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount">%1$s</span> <span id="akismetsc">spam comments</span></div> <div id="akismet2"><span id="akismetbb">blocked by</span><br /><span id="akismeta">Akismet</span></div></a></div></div>', $count ), number_format_i18n( $count ) );