⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 akismet.php

📁 WordPress是一个Blog程序,用它你可以架设完全属于你自己的Blog. 而WordPress现在的应用又不仅仅只是在Blog方面,因为其强大的扩展性,部分网站甚至已经开始使用WordPress
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	$comment_date = mysql2date(get_option("date_format") . " @ " . get_option("time_format"), $comment->comment_date);	$post = get_post($comment->comment_post_ID);	$post_title = $post->post_title;	if ($i % 2) $class = 'class="alternate"';	else $class = '';	echo "\n\t<li id='comment-$comment->comment_ID' $class>";	?><p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p><?php comment_text() ?><p><label for="spam-<?php echo $comment->comment_ID; ?>"><input type="checkbox" id="spam-<?php echo $comment->comment_ID; ?>" name="not_spam[]" value="<?php echo $comment->comment_ID; ?>" /><?php _e('Not Spam') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [<?php$post = get_post($comment->comment_post_ID);$post_title = wp_specialchars( $post->post_title, 'double' );$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;?> <a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ] </p><?php}?></ul><?php if ( $total > 50 ) {$total_pages = ceil( $total / 50 );$r = '';if ( 1 < $page ) {	$args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1;	$r .=  '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">'. __('&laquo; Previous Page') .'</a>' . "\n";}if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) {	for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :		if ( $page == $page_num ) :			$r .=  "<strong>$page_num</strong>\n";		else :			$p = false;			if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :				$args['apage'] = ( 1 == $page_num ) ? '' : $page_num;				$r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n";				$in = true;			elseif ( $in == true ) :				$r .= "...\n";				$in = false;			endif;		endif;	endfor;}if ( ( $page ) * 50 < $total || -1 == $total ) {	$args['apage'] = $page + 1;	$r .=  '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page &raquo;') .'</a>' . "\n";}echo "<p>$r</p>";}?><p class="submit"><input type="submit" name="submit" value="<?php echo attribute_escape(__('De-spam marked comments &raquo;')); ?>" /></p><p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.'); ?></p></form><?php} else {?><p><?php _e('No results found.'); ?></p><?php } ?><?php if ( !isset( $_POST['s'] ) ) { ?><form method="post" action="<?php echo attribute_escape( add_query_arg( 'noheader', 'true' ) ); ?>"><?php akismet_nonce_field($akismet_nonce) ?><p><input type="hidden" name="action" value="delete" /><?php printf(__('There are currently %1$s comments identified as spam.'), $spam_count); ?>&nbsp; &nbsp; <input type="submit" name="Submit" class="button" value="<?php echo attribute_escape(__('Delete all')); ?>" /><input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /></p></form><?php } ?></div><?php	}}add_action('admin_menu', 'akismet_manage_page');// WP < 2.5function akismet_stats() {	if ( !function_exists('did_action') || did_action( 'rightnow_end' ) ) // We already displayed this info in the "Right Now" section		return;	if ( !$count = get_option('akismet_spam_count') )		return;	$path = plugin_basename(__FILE__);	echo '<h3>'.__('Spam').'</h3>';	global $submenu;	if ( isset( $submenu['edit-comments.php'] ) )		$link = 'edit-comments.php';	else		$link = 'edit.php';	echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.'), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'</p>';}add_action('activity_box_end', 'akismet_stats');// WP 2.5+function akismet_rightnow() {	global $submenu, $wp_db_version;	if ( 8645 < $wp_db_version  ) // 2.7		$link = 'edit-comments.php?comment_status=spam';	elseif ( isset( $submenu['edit-comments.php'] ) )		$link = 'edit-comments.php?page=akismet-admin';	else		$link = 'edit.php?page=akismet-admin';	if ( $count = get_option('akismet_spam_count') ) {		$intro = sprintf( __ngettext(			'<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already,',			'<a href="%1$s">Akismet</a> has protected your site from %2$s spam comments already,',			$count		), 'http://akismet.com/', number_format_i18n( $count ) );	} else {		$intro = sprintf( __('<a href="%1$s">Akismet</a> blocks spam from getting to your blog,'), 'http://akismet.com/' );	}	if ( $queue_count = akismet_spam_count() ) {		$queue_text = sprintf( __ngettext(			'and there\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.',			'and there are <a href="%2$s">%1$s comments</a> in your spam queue right now.',			$queue_count		), number_format_i18n( $queue_count ), clean_url($link) );	} else {		$queue_text = sprintf( __( "but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), clean_url($link) );	}	$text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text );	echo "<p class='akismet-right-now'>$text</p>\n";}	add_action('rightnow_end', 'akismet_rightnow');// For WP <= 2.3.xif ( 'moderation.php' == $pagenow ) {	function akismet_recheck_button( $page ) {		global $submenu;		if ( isset( $submenu['edit-comments.php'] ) )			$link = 'edit-comments.php';		else			$link = 'edit.php';		$button = "<a href='$link?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true' style='display: block; width: 100px; position: absolute; right: 7%; padding: 5px; font-size: 14px; text-decoration: underline; background: #fff; border: 1px solid #ccc;'>" . __('Recheck Queue for Spam') . "</a>";		$page = str_replace( '<div class="wrap">', '<div class="wrap">' . $button, $page );		return $page;	}	if ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" ) )		ob_start( 'akismet_recheck_button' );}// For WP >= 2.5function akismet_check_for_spam_button($comment_status) {	if ( 'approved' == $comment_status )		return;	if ( function_exists('plugins_url') )		$link = 'admin.php?action=akismet_recheck_queue';	else		$link = 'edit-comments.php?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true';	echo "</div><div class='alignleft'><a class='button-secondary checkforspam' href='$link'>" . __('Check for Spam') . "</a>";}add_action('manage_comments_nav', 'akismet_check_for_spam_button');function akismet_recheck_queue() {	global $wpdb, $akismet_api_host, $akismet_api_port;	if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) )		return;	$moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A );	foreach ( (array) $moderation as $c ) {		$c['user_ip']    = $c['comment_author_IP'];		$c['user_agent'] = $c['comment_agent'];		$c['referrer']   = '';		$c['blog']       = get_option('home');		$id = (int) $c['comment_ID'];		$query_string = '';		foreach ( $c as $key => $data )		$query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';		$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);		if ( 'true' == $response[1] ) {			$wpdb->query( "UPDATE $wpdb->comments SET comment_approved = 'spam' WHERE comment_ID = $id" );		}	}	wp_redirect( $_SERVER['HTTP_REFERER'] );	exit;}add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue');function akismet_check_db_comment( $id ) {	global $wpdb, $akismet_api_host, $akismet_api_port;	$id = (int) $id;	$c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A );	if ( !$c )		return;	$c['user_ip']    = $c['comment_author_IP'];	$c['user_agent'] = $c['comment_agent'];	$c['referrer']   = '';	$c['blog']       = get_option('home');	$id = $c['comment_ID'];	$query_string = '';	foreach ( $c as $key => $data )	$query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';	$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);	return $response[1];}// This option causes tons of FPs, was removed in 2.1function akismet_kill_proxy_check( $option ) { return 0; }add_filter('option_open_proxy_check', 'akismet_kill_proxy_check');// Widget stufffunction widget_akismet_register() {	if ( function_exists('register_sidebar_widget') ) :	function widget_akismet($args) {		extract($args);		$options = get_option('widget_akismet');		$count = number_format_i18n(get_option('akismet_spam_count'));		?>			<?php echo $before_widget; ?>				<?php echo $before_title . $options['title'] . $after_title; ?>				<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><?php printf( __( '%1$s %2$sspam comments%3$s %4$sblocked by%5$s<br />%6$sAkismet%7$s' ), '<div id="akismet1"><span id="akismetcount">' . $count . '</span>', '<span id="akismetsc">', '</span></div>', '<div id="akismet2"><span id="akismetbb">', '</span>', '<span id="akismeta">', '</span></div>' ); ?></a></div></div>			<?php echo $after_widget; ?>	<?php	}	function widget_akismet_style() {		?><style type="text/css">#aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none}#aka:hover{border:none;text-decoration:none}#aka:hover #akismet1{display:none}#aka:hover #akismet2,#akismet1{display:block}#akismet2{display:none;padding-top:2px}#akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none}#akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none}#akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'); ?>/wp-content/plugins/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}</style>		<?php	}	function widget_akismet_control() {		$options = $newoptions = get_option('widget_akismet');		if ( $_POST["akismet-submit"] ) {			$newoptions['title'] = strip_tags(stripslashes($_POST["akismet-title"]));			if ( empty($newoptions['title']) ) $newoptions['title'] = 'Spam Blocked';		}		if ( $options != $newoptions ) {			$options = $newoptions;			update_option('widget_akismet', $options);		}		$title = htmlspecialchars($options['title'], ENT_QUOTES);	?>				<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>				<input type="hidden" id="akismet-submit" name="akismet-submit" value="1" />	<?php	}	register_sidebar_widget('Akismet', 'widget_akismet', null, 'akismet');	register_widget_control('Akismet', 'widget_akismet_control', null, 75, 'akismet');	if ( is_active_widget('widget_akismet') )		add_action('wp_head', 'widget_akismet_style');	endif;}add_action('init', 'widget_akismet_register');// Counter for non-widget usersfunction akismet_counter() {?><style type="text/css">#akismetwrap #aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none}#aka:hover{border:none;text-decoration:none}#aka:hover #akismet1{display:none}#aka:hover #akismet2,#akismet1{display:block}#akismet2{display:none;padding-top:2px}#akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none}#akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none}#akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'); ?>/wp-content/plugins/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}</style><?php$count = number_format_i18n(get_option('akismet_spam_count'));?><div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments') ?></span></div> <div id="akismet2"><span id="akismetbb"><?php _e('blocked by') ?></span><br /><span id="akismeta">Akismet</span></div></a></div></div><?php}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -