public static function init_hooks()
 {
     // The standalone stats page was removed in 3.0 for an all-in-one config and stats page.
     // Redirect any links that might have been bookmarked or in browser history.
     if (isset($_GET['page']) && 'akismet-stats-display' == $_GET['page']) {
         wp_safe_redirect(esc_url_raw(self::get_page_url('stats')), 301);
         die;
     }
     self::$initiated = true;
     add_action('admin_init', array('Akismet_Admin', 'admin_init'));
     add_action('admin_menu', array('Akismet_Admin', 'admin_menu'), 5);
     # Priority 5, so it's called before Jetpack's admin_menu.
     add_action('admin_notices', array('Akismet_Admin', 'display_notice'));
     add_action('admin_enqueue_scripts', array('Akismet_Admin', 'load_resources'));
     add_action('activity_box_end', array('Akismet_Admin', 'dashboard_stats'));
     add_action('rightnow_end', array('Akismet_Admin', 'rightnow_stats'));
     add_action('manage_comments_nav', array('Akismet_Admin', 'check_for_spam_button'));
     add_action('transition_comment_status', array('Akismet_Admin', 'transition_comment_status'), 10, 3);
     add_action('admin_action_akismet_recheck_queue', array('Akismet_Admin', 'recheck_queue'));
     add_action('wp_ajax_akismet_recheck_queue', array('Akismet_Admin', 'recheck_queue'));
     add_action('wp_ajax_comment_author_deurl', array('Akismet_Admin', 'remove_comment_author_url'));
     add_action('wp_ajax_comment_author_reurl', array('Akismet_Admin', 'add_comment_author_url'));
     add_filter('plugin_action_links', array('Akismet_Admin', 'plugin_action_links'), 10, 2);
     add_filter('comment_row_actions', array('Akismet_Admin', 'comment_row_action'), 10, 2);
     add_filter('comment_text', array('Akismet_Admin', 'text_add_link_class'));
     add_filter('plugin_action_links_' . plugin_basename(plugin_dir_path(__FILE__) . 'akismet.php'), array('Akismet_Admin', 'admin_plugin_settings_link'));
 }
 /**
  * Recheck all comments in the Pending queue.
  *
  * ## EXAMPLES
  *
  *     wp akismet recheck_queue
  *
  * @alias recheck-queue
  */
 public function recheck_queue()
 {
     $batch_size = 100;
     $start = 0;
     $total_counts = array();
     do {
         $result_counts = Akismet_Admin::recheck_queue_portion($start, $batch_size);
         if ($result_counts['processed'] > 0) {
             foreach ($result_counts as $key => $count) {
                 if (!isset($total_counts[$key])) {
                     $total_counts[$key] = $count;
                 } else {
                     $total_counts[$key] += $count;
                 }
             }
             $start += $batch_size;
             $start -= $result_counts['spam'];
             // These comments will have been removed from the queue.
         }
     } while ($result_counts['processed'] > 0);
     WP_CLI::line(sprintf(_n("Processed %d comment.", "Processed %d comments.", $total_counts['processed'], 'akismet'), number_format($total_counts['processed'])));
     WP_CLI::line(sprintf(_n("%d comment moved to Spam.", "%d comments moved to Spam.", $total_counts['spam'], 'akismet'), number_format($total_counts['spam'])));
     if ($total_counts['error']) {
         WP_CLI::line(sprintf(_n("%d comment could not be checked.", "%d comments could not be checked.", $total_counts['error'], 'akismet'), number_format($total_counts['error'])));
     }
 }
Example #3
0
    Akismet::view('get', array('text' => __('Get your API key', 'akismet'), 'classes' => array('right', 'button', 'button-primary')));
    ?>
</div>
<div class="activate-highlight secondary activate-option">
	<div class="option-description">
		<strong><?php 
    esc_html_e('Manually enter an API key', 'akismet');
    ?>
</strong>
		<p><?php 
    esc_html_e('If you already know your API key.', 'akismet');
    ?>
</p>
	</div>
	<form action="<?php 
    echo esc_url(Akismet_Admin::get_page_url());
    ?>
" method="post" id="akismet-enter-api-key" class="right">
		<input id="key" name="key" type="text" size="15" value="" class="regular-text code">
		<input type="hidden" name="action" value="enter-key">
		<?php 
    wp_nonce_field(Akismet_Admin::NONCE);
    ?>
		<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php 
    esc_attr_e('Use this key', 'akismet');
    ?>
">
	</form>
</div><?php 
}
?>
Example #4
0
	<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
		<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
		<input type="hidden" name="action" value="enter-key">
		<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
		<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
	</form>
</div>
<?php else :?>
<p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
	<div class="option-description">
		<strong><?php esc_html_e( 'Activate Akismet' , 'akismet');?></strong>
		<p><?php esc_html_e('Log in or create an account to get your API key.', 'akismet'); ?></p>
	</div>
	<?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet'), 'classes' => array( 'right', 'button', 'button-primary' ) ) ); ?>
</div>
<div class="activate-highlight secondary activate-option">
	<div class="option-description">
		<strong><?php esc_html_e('Manually enter an API key', 'akismet'); ?></strong>
		<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
	</div>
	<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
		<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
		<input type="hidden" name="action" value="enter-key">
		<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
		<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
	</form>
</div><?php
	endif;?>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
</div>
Example #5
0
															'akismet'
														),
														admin_url( 'edit-comments.php?comment_status=spam' ),
														$delete_interval
													);
													
													?>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
								<div id="major-publishing-actions">
									<?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
									<div id="delete-action">
										<a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
									</div>
									<?php endif; ?>
									<?php wp_nonce_field(Akismet_Admin::NONCE) ?>
									<div id="publishing-action">
											<input type="hidden" name="action" value="enter-key">
											<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'akismet');?>">

									</div>
									<div class="clear"></div>
								</div>
							</form>
						</div>
					</div>
				</div>
				<div class="postbox-container" style="width:44%;">
Example #6
0
													<?php 
    $delete_interval = max(1, intval(apply_filters('akismet_delete_comment_interval', 15)));
    printf(_n('Spam in the <a href="%1$s">spam folder</a> older than 1 day is deleted automatically.', 'Spam in the <a href="%1$s">spam folder</a> older than %2$d days is deleted automatically.', $delete_interval, 'akismet'), admin_url('edit-comments.php?comment_status=spam'), $delete_interval);
    ?>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
								<div id="major-publishing-actions">
									<?php 
    if (!defined('WPCOM_API_KEY')) {
        ?>
									<div id="delete-action">
										<a class="submitdelete deletion" href="<?php 
        echo esc_url(Akismet_Admin::get_page_url('delete_key'));
        ?>
"><?php 
        esc_html_e('Disconnect this account', 'akismet');
        ?>
</a>
									</div>
									<?php 
    }
    ?>
									<?php 
    wp_nonce_field(Akismet_Admin::NONCE);
    ?>
									<div id="publishing-action">
											<input type="hidden" name="action" value="enter-key">
											<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php 
Example #7
0
			</div>
			<div class="aa_description"><?php 
    _e('<strong>Almost done</strong> - activate your account and say goodbye to comment spam', 'akismet');
    ?>
</div>
		</div>
	</form>
</div>
<?php 
} elseif ($type == 'spam-check') {
    ?>
<div id="akismet-warning" class="updated fade"><p><strong><?php 
    esc_html_e('Akismet has detected a problem.', 'akismet');
    ?>
</strong> <?php 
    printf(__('Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation. Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url(Akismet_Admin::get_page_url()));
    ?>
</p></div>
<?php 
} elseif ($type == 'version') {
    ?>
<div id="akismet-warning" class="updated fade"><p><strong><?php 
    printf(esc_html__('Akismet %s requires WordPress 3.0 or higher.', 'akismet'), AKISMET_VERSION);
    ?>
</strong> <?php 
    printf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');
    ?>
</p></div>
<?php 
} elseif ($type == 'alert') {
    ?>
Example #8
0
function akismet_load_menu()
{
    return Akismet_Admin::load_menu();
}
Example #9
0
function akismet_load_menu()
{
    _deprecated_function(__FUNCTION__, '3.0', 'Akismet_Admin::load_menu()');
    return Akismet_Admin::load_menu();
}
Example #10
0
<<<<<<< HEAD
<<<<<<< HEAD
<div class="wrap">
	<h2><?php esc_html_e( 'Akismet Stats' , 'akismet');?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php esc_html_e( 'Settings' , 'akismet');?></a><?php endif;?></h2> 
	<iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
=======
<div class="wrap">
	<h2><?php esc_html_e( 'Akismet Stats' , 'akismet');?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php esc_html_e( 'Settings' , 'akismet');?></a><?php endif;?></h2> 
	<iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
<div class="wrap">
	<h2><?php esc_html_e( 'Akismet Stats' , 'akismet');?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php esc_html_e( 'Settings' , 'akismet');?></a><?php endif;?></h2> 
	<iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
</div>
 /**
  * Get number of spam messages blocked by Akismet.
  *
  * @since 4.3.0
  *
  * @return int|string Number of spam blocked by Akismet. Otherwise, an error message.
  */
 public function get_akismet_data()
 {
     if (!is_wp_error($status = $this->akismet_is_active_and_registered())) {
         return rest_ensure_response(Akismet_Admin::get_stats(Akismet::get_api_key()));
     } else {
         return $status->get_error_code();
     }
 }
 /**
  * Get number of spam messages blocked by Akismet.
  *
  * @since 4.1.0
  *
  * @param WP_REST_Request $data {
  *     Array of parameters received by request.
  *
  *     @type string $date Date range to restrict results to.
  * }
  *
  * @return int|string Number of spam blocked by Akismet. Otherwise, an error message.
  */
 public static function akismet_get_stats_data(WP_REST_Request $data)
 {
     if (!is_wp_error($status = self::akismet_is_active_and_registered())) {
         return rest_ensure_response(Akismet_Admin::get_stats(Akismet::get_api_key()));
     } else {
         return $status->get_error_code();
     }
 }
Example #13
0
	<h3 class="key-status failed"><?php esc_html_e("You're using your Akismet key on more sites than your Pro subscription allows.", 'akismet'); ?></h3>
	<p class="description"><?php printf( __('If you would like to use Akismet on more than 10 sites, you will need to <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>. If you have any questions, please <a href="%s" target="_blank">get in touch with our support team</a>', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
	<?php elseif ( $level == 'red' ): ?>
	<h3 class="key-status failed"><?php esc_html_e("You're using Akismet on far too many sites for your Pro subscription.", 'akismet'); ?></h3>
	<p class="description"><?php printf( __('To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
	<?php endif; ?>
</div>
<?php endif;?>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
<?php if ( $type == 'plugin' ) :?>
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
	<style type="text/css">
.akismet_activate{min-width:825px;border:1px solid #4F800D;padding:5px;margin:15px 0;background:#83AF24;background-image:-webkit-gradient(linear,0% 0,80% 100%,from(#83AF24),to(#4F800D));background-image:-moz-linear-gradient(80% 100% 120deg,#4F800D,#83AF24);-moz-border-radius:3px;border-radius:3px;-webkit-border-radius:3px;position:relative;overflow:hidden}.akismet_activate .aa_a{position:absolute;top:-5px;right:10px;font-size:140px;color:#769F33;font-family:Georgia, "Times New Roman", Times, serif;z-index:1}.akismet_activate .aa_button{font-weight:bold;border:1px solid #029DD6;border-top:1px solid #06B9FD;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#FFF;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button:hover{text-decoration:none !important;border:1px solid #029DD6;border-bottom:1px solid #00A8EF;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#F0F8FB;background:#0079B1;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#0079B1),to(#0092BF));background-image:-moz-linear-gradient(0% 100% 90deg,#0092BF,#0079B1);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button_border{border:1px solid #006699;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6)}.akismet_activate .aa_button_container{cursor:pointer;display:inline-block;background:#DEF1B8;padding:5px;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;width:266px}.akismet_activate .aa_description{position:absolute;top:22px;left:285px;margin-left:25px;color:#E5F2B1;font-size:15px;z-index:1000}.akismet_activate .aa_description strong{color:#FFF;font-weight:normal}
	</style>
	<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
		<div class="akismet_activate">
			<div class="aa_a">A</div>
			<div class="aa_button_container" onclick="document.akismet_activate.submit();">
				<div class="aa_button_border">
					<div class="aa_button"><?php esc_html_e('Activate your Akismet account', 'akismet');?></div>
				</div>
			</div>
			<div class="aa_description"><?php _e('<strong>Almost done</strong> - activate your account and say goodbye to comment spam', 'akismet');?></div>
		</div>
	</form>
</div>
<?php elseif ( $type == 'spam-check' ) :?>
<div id="akismet-warning" class="updated fade">
	<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
	<p><?php printf( __( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ) ); ?></p>
Example #14
0
<<<<<<< HEAD
<<<<<<< HEAD
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
	<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
	<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
	<input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
=======
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
	<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
	<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
	<input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
	<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
	<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
	<input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
</form>