update plugins and theme

master
RedWolf 6 years ago
parent 9a3748aa8e
commit 4828353fc7

@ -1,20 +0,0 @@
jQuery(document).ready(function($) {
jQuery( '#select404page' ).change(function() {
jQuery( '#edit_404_page, #test_404_page' ).prop( 'disabled', !( jQuery( '#select404page' ).val() == jQuery( '#404page_current_value').text() != 0 ) );
});
jQuery( '#select404page' ).trigger( 'change' );
jQuery( '#edit_404_page' ).click(function() {
window.location.href = jQuery( '#404page_edit_link' ).text();
});
jQuery( '#test_404_page' ).click(function() {
window.location.href = jQuery( '#404page_test_link' ).text();
});
jQuery( '#404page_admin_notice .notice-dismiss' ).click( function() {
jQuery.ajax({
url: ajaxurl,
data: {
action: '404page_dismiss_admin_notice'
}
});
});
});

@ -1,641 +1,74 @@
<?php
/*
Plugin Name: 404page - your smart custom 404 error page
Plugin URI: http://petersplugins.com/free-wordpress-plugins/404page/
Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
Version: 2.3
Author: Peter's Plugins, smartware.cc
Author URI: http://petersplugins.com
Text Domain: 404page
License: GPL2+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
/**
* The 404page Plugin
*
* 404page allows creation of 404 error pages in WordPress admin
*
* @wordpress-plugin
* Plugin Name: 404page - your smart custom 404 error page
* Plugin URI: https://petersplugins.com/free-wordpress-plugins/404page/
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
* Version: 3.3
* Author: Peter Raschendorfer
* Author URI: https://petersplugins.com
* Text Domain: 404page
* License: GPL2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// If this file is called directly, abort
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'PP_404', true );
class Smart404Page {
public $plugin_name;
public $plugin_slug;
public $version;
private $wp_url;
private $my_url;
private $dc_url;
public $settings;
private $template;
private $postid;
public function __construct() {
$this->plugin_name = '404page';
$this->plugin_slug = '404page';
$this->version = '2.3';
$this->get_settings();
$this->init();
}
// get all settings
private function get_settings() {
$this->settings = array();
$this->settings['404page_page_id'] = $this->get_404page_id();
$this->settings['404page_hide'] = $this->get_404page_hide();
$this->settings['404page_fire_error'] = $this->get_404page_fire_error();
// $this->settings['404page_method'] = $this->get_404page_method(); --> moved to set_mode in v 2.2 because this may be too early here
$this->settings['404page_native'] = false;
}
// do plugin init
private function init() {
// as of v 2.2 always call set_mode
add_action( 'init', array( $this, 'set_mode' ) );
if ( !is_admin() ) {
add_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
add_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
} else {
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'admin_head', array( $this, 'admin_css' ) );
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
if ( $this->settings['404page_hide'] and $this->settings['404page_page_id'] > 0 ) {
add_action( 'pre_get_posts' ,array ( $this, 'exclude_404page' ) );
}
}
}
// init filters
function set_mode() {
$this->settings['404page_method'] = $this->get_404page_method();
if ( !is_admin() ) {
if ( defined( 'CUSTOMIZR_VER' ) ) {
// Customizr Compatibility Mode
add_filter( 'tc_404_header_content', array( $this, 'show404title_customizr_mode' ), 999 );
add_filter( 'tc_404_content', array( $this, 'show404_customizr_mode' ), 999 );
add_filter( 'tc_404_selectors', array( $this, 'show404articleselectors_customizr_mode' ), 999 );
} elseif ( $this->settings['404page_method'] != 'STD' ) {
// Compatibility Mode
add_filter( 'posts_results', array( $this, 'show404_compatiblity_mode' ), 999 );
} else {
// Standard Mode
add_filter( '404_template', array( $this, 'show404_standard_mode' ), 999 );
if ( $this->settings['404page_fire_error'] ) {
add_action( 'template_redirect', array( $this, 'do_404_header_standard_mode' ) );
}
}
}
}
// show 404 page - Standard Mode
function show404_standard_mode( $template ) {
global $wp_query;
$pageid = $this->settings['404page_page_id'];
if ( $pageid > 0 ) {
if ( ! $this->settings['404page_native'] ) {
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query( 'page_id=' . $pageid );
$wp_query->the_post();
$template = get_page_template();
rewind_posts();
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
}
$this->do_404page_action();
}
return $template;
}
// show 404 page - Compatibility Mode
function show404_compatiblity_mode( $posts ) {
// remove the filter so we handle only the first query - no custom queries
remove_filter( 'posts_results', array( $this, 'show404_compatiblity_mode' ), 999 );
$pageid = $this->settings['404page_page_id'];
if ( $pageid > 0 && ! $this->settings['404page_native'] ) {
if ( empty( $posts ) && is_main_query() && !is_robots() && !is_home() && !is_feed() && !is_search() && !is_archive() && ( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
// we need to get the 404 page
$pageid = $this->get_page_id( $pageid );
// as of v2.1 we do not alter the posts argument here because this does not work with SiteOrigin's Page Builder Plugin, template_include filter introduced
$this->postid = $pageid;
$this->template = get_page_template_slug( $pageid );
if ( $this->template == '' ) {
$this->template = get_page_template();
}
add_action( 'wp', array( $this, 'do_404_header' ) );
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
$posts[] = get_post( $pageid );
$this->do_404page_action();
} elseif ( 1 == count( $posts ) && 'page' == $posts[0]->post_type ) {
// Do a 404 if the 404 page is opened directly
if ( $this->settings['404page_fire_error'] ) {
$curpageid = $posts[0]->ID;
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
// WPML is active - get the post ID of the default language
global $sitepress;
$curpageid = apply_filters( 'wpml_object_id', $curpageid, 'page', $sitepress->get_default_language() );
$pageid = apply_filters( 'wpml_object_id', $pageid, 'page', $sitepress->get_default_language() );
} elseif ( defined( 'POLYLANG_VERSION' ) ) {
// Polylang is active - get the post ID of the default language
$curpageid = pll_get_post( $curpageid, pll_default_language() );
$pageid = pll_get_post( $pageid, pll_default_language() );
}
if ( $pageid == $curpageid ) {
add_action( 'wp', array( $this, 'do_404_header' ) );
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
$this->do_404page_action();
}
}
}
} elseif ( $pageid > 0 && $this->settings['404page_native'] ) {
$this->do_404page_action();
}
return $posts;
}
// this function overrides the page template in compatibilty mode
function change_404_template( $template ) {
// we have to check if the template file is there because if the theme was changed maybe a wrong template is stored in the database
$new_template = locate_template( array( $this->template ) );
if ( '' != $new_template ) {
return $new_template ;
}
return $template;
}
// send a 404 HTTP header - Standard Mode
function do_404_header_standard_mode() {
if ( is_page() && get_the_ID() == $this->settings['404page_page_id'] && !is_404() ) {
status_header( 404 );
nocache_headers();
$this->do_404page_action();
}
}
// send a 404 HTTP header - Compatibility Mode
function do_404_header() {
// remove the action so we handle only the first query - no custom queries
remove_action( 'wp', array( $this, 'do_404_header' ) );
status_header( 404 );
nocache_headers();
}
// adds the error404 class to the body classes
function add_404_body_class( $classes ) {
$classes[] = 'error404';
return $classes;
}
// show title - Customizr Compatibility Mode
function show404title_customizr_mode( $title ) {
if ( ! $this->settings['404page_native'] ) {
return '<h1 class="entry-title">' . get_the_title( $this->settings['404page_page_id'] ) . '</h1>';
} else {
return $title;
}
}
// show content - Customizr Compatibility Mode
function show404_customizr_mode( $content ) {
if ( ! $this->settings['404page_native'] ) {
return '<div class="entry-content">' . apply_filters( 'the_content', get_post_field( 'post_content', $this->settings['404page_page_id'] ) ) . '</div>';
} else {
return $content;
}
$this->do_404page_action();
}
// change article selectors - Customizr Compatibility Mode
function show404articleselectors_customizr_mode( $selectors ) {
if ( ! $this->settings['404page_native'] ) {
return 'id="post-' . $this->settings['404page_page_id'] . '" ' . 'class="' . join( ' ', get_post_class( 'row-fluid', $this->settings['404page_page_id'] ) ) . '"';
} else {
return $selectors;
}
}
// init the admin section
function admin_init() {
$this->wp_url = 'https://wordpress.org/plugins/' . $this->plugin_slug;
$this->my_url = 'http://petersplugins.com/free-wordpress-plugins/' . $this->plugin_slug;
$this->dc_url = 'http://petersplugins.com/docs/' . $this->plugin_slug;
load_plugin_textdomain( '404page' );
add_settings_section( '404page-settings', null, null, '404page_settings_section' );
register_setting( '404page_settings', '404page_page_id' );
register_setting( '404page_settings', '404page_hide' );
register_setting( '404page_settings', '404page_method' );
register_setting( '404page_settings', '404page_fire_error' );
add_settings_field( '404page_settings_404page', __( 'Page to be displayed as 404 page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_select_page"></a>' , array( $this, 'admin_404page' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_page_id' ) );
add_settings_field( '404page_settings_hide', __( 'Hide 404 page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_hide_page"></a>' , array( $this, 'admin_hide' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_hide' ) );
add_settings_field( '404page_settings_fire', __( 'Fire 404 error', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_fire_404"></a>' , array( $this, 'admin_fire404' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_fire_error' ) );
add_settings_field( '404page_settings_method', __( 'Operating Method', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_operating_method"></a>' , array( $this, 'admin_method' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_method' ) );
}
// add css
function admin_css() {
echo '<style type="text/css">#select404page {width: 100%; }';
if ( $this->settings['404page_page_id'] > 0 ) {
echo ' #the-list #post-' . $this->settings['404page_page_id'] . ' .column-title {min-height: 32px; background-position: left top; background-repeat: no-repeat; background-image: url(' . plugins_url( 'pluginicon.png', __FILE__ ) . '); padding-left: 40px;}';
}
echo '</style>';
}
// handle the settings field page id
function admin_404page() {
if ( $this->settings['404page_page_id'] < 0 ) {
echo '<div class="error form-invalid" style="line-height: 3em">' . __( 'The page you have selected as 404 page does not exist anymore. Please choose another page.', '404page' ) . '</div>';
}
wp_dropdown_pages( array( 'name' => '404page_page_id', 'id' => 'select404page', 'echo' => 1, 'show_option_none' => __( '&mdash; NONE (WP default 404 page) &mdash;', '404page'), 'option_none_value' => '0', 'selected' => $this->settings['404page_page_id'] ) );
echo '<div id="404page_edit_link" style="display: none">' . get_edit_post_link( $this->get_404page_id() ) . '</div>';
echo '<div id="404page_test_link" style="display: none">' . get_site_url() . '/' . md5( rand() ) . '/' . md5( rand() ) . '/' . md5( rand() ) . '</div>';
echo '<div id="404page_current_value" style="display: none">' . $this->get_404page_id() . '</div>';
echo '<p class="submit"><input type="button" name="edit_404_page" id="edit_404_page" class="button secondary" value="' . __( 'Edit Page', '404page' ) . '" />&nbsp;<input type="button" name="test_404_page" id="test_404_page" class="button secondary" value="' . __( 'Test 404 error', '404page' ) . '" /></p>';
}
// handle the settings field hide
function admin_hide() {
echo '<p><input type="checkbox" id="404page_hide" name="404page_hide" value="1"' . checked( true, $this->settings['404page_hide'], false ) . '/>';
echo '<label for="404page_hide">' . __( 'Hide the selected page from the Pages list', '404page' ) . '</label></p>';
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'For Administrators the page is always visible.', '404page' ) . '</p>';
}
// handle the settings field fire 404 error
function admin_fire404() {
echo '<p><input type="checkbox" id="404page_fire_error" name="404page_fire_error" value="1"' . checked( true, $this->settings['404page_fire_error'], false ) . '/>';
echo '<label for="404page_fire_error">' . __( 'Send an 404 error if the page is accessed directly by its URL', '404page' ) . '</label></p>';
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Uncheck this if you want the selected page to be accessible.', '404page' ) . '</p>';
if ( function_exists( 'wpsupercache_activate' ) ) {
echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;<strong>' . __( 'WP Super Cache Plugin detected', '404page' ) . '</strong>. ' . __ ( 'If the page you selected as 404 error page is in cache, always a HTTP code 200 is sent. To avoid this and send a HTTP code 404 you have to exlcude this page from caching', '404page' ) . ' (<a href="' . admin_url( 'options-general.php?page=wpsupercache&tab=settings#rejecturi' ) . '">' . __( 'Click here', '404page' ) . '</a>).<br />(<a href="' . $this->dc_url . '/#wp_super_cache">' . __( 'Read more', '404page' ) . '</a>)</p>';
}
}
// handle the settings field method
function admin_method() {
if ( $this->settings['404page_native'] ) {
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'This setting is not available because the Theme you are using natively supports the 404page plugin.', '404page' ) . ' (<a href="' . $this->dc_url . '/#native_mode">' . __( 'Read more', '404page' ) . '</a>)</p>';
} elseif ( defined( 'CUSTOMIZR_VER' ) ) {
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'This setting is not availbe because the 404page Plugin works in Customizr Compatibility Mode.', '404page' ) . ' (<a href="' . $this->dc_url . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)</p>';
} elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'This setting is not availbe because the 404page Plugin works in WPML Mode.', '404page' ) . ' (<a href="' . $this->dc_url . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)</p>';
} elseif ( defined( 'POLYLANG_VERSION' ) ) {
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'This setting is not availbe because the 404page Plugin works in Polylang Mode.', '404page' ) . ' (<a href="' . $this->dc_url . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)</p>';
} else {
echo '<p><input type="radio" id="404page_settings_method_standard" name="404page_method" value="STD"' . checked( 'STD', $this->settings['404page_method'], false ) . ' />';
echo '<label for="404page_settings_method_standard">' . __( 'Standard Mode', '404page' ) . '</label></p>';
echo '<p><input type="radio" id="404page_settings_method_compatibility" name="404page_method" value="CMP"' . checked( 'CMP', $this->settings['404page_method'], false ) . '/>';
echo '<label for="404page_settings_method_compatibility">' . __( 'Compatibility Mode', '404page' ) . '</label></p>';
echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Standard Mode uses the WordPress Template System and should work in most cases. If the 404page plugin does not work properly, probably you are using a theme or plugin that modifies the WordPress Template System. In this case the Compatibility Mode maybe can fix the problem, although it cannot be guaranteed that every possible configuration can be handled by Compatibility Mode. Standard Mode is the recommended method, only switch to Compatibility Mode if you have any problems.', '404page' ) . '</p>';
}
}
// this function hides the selected page from the list of pages
function exclude_404page( $query ) {
if ( $this->settings['404page_page_id'] > 0 ) {
global $pagenow;
$post_type = $query->get( 'post_type' );
/**
* Load core plugin class and run the plugin
*/
require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page.php' );
$pp_404page = new PP_404Page( __FILE__ );
// as of v 2.3 we check the post_type on front end
if( ( is_admin() && ( 'edit.php' == $pagenow && !current_user_can( 'create_users' ) ) ) || ( ! is_admin() && ( !empty( $post_type) && ( ('page' === $post_type || 'any' === $post_type) || ( is_array( $post_type ) && in_array( 'page', $post_type ) ) ) )) ) {
$pageid = $this->settings['404page_page_id'];
if ( ! is_admin() ) {
$pageid = $this->get_page_id( $pageid );
}
// as of v 2.3 we add the ID of the 404 page to post__not_in
// using just $query->set() overrides existing settings but not adds a new setting
$query->set( 'post__not_in', array_merge( (array)$query->get( 'post__not_in', array() ), array( $pageid ) ) );
}
}
}
// this function removes the 404 page from get_pages result array
function remove_404page_from_array( $pages, $r ) {
if ( $this->settings['404page_page_id'] > 0 ) {
$pageid = $this->get_page_id( $this->settings['404page_page_id'] );
for ( $i = 0; $i < sizeof( $pages ); $i++ ) {
if ( $pages[$i]->ID == $pageid ) {
unset( $pages[$i] );
break;
}
}
}
return array_values( $pages );
}
// adds the options page to admin menu
function admin_menu() {
$page_handle = add_theme_page ( __( '404 Error Page', "404page" ), __( '404 Error Page', '404page' ), 'manage_options', '404pagesettings', array( $this, 'admin_page' ) );
add_action( 'admin_print_scripts', array( $this, 'admin_js' ) );
}
// adds javascript to the 404page settings page
function admin_js() {
wp_enqueue_script( '404pagejs', plugins_url( '/404page.js', __FILE__ ), 'jquery', $this->version, true );
}
// creates the options page
function admin_page() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
?>
<div class="wrap">
<?php screen_icon(); ?>
<h2 style="min-height: 32px; line-height: 32px; padding-left: 40px; background-image: url(<?php echo plugins_url( 'pluginicon.png', __FILE__ ); ?>); background-repeat: no-repeat; background-position: left center"><a href="<?php echo $this->my_url; ?>">404page</a> <?php echo __( 'Settings', '404page' ); ?></h2>
<?php settings_errors(); ?>
<hr />
<p>Plugin Version: <?php echo $this->version; ?> <a class="dashicons dashicons-editor-help" href="<?php echo $this->wp_url; ?>/changelog/"></a></p>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<div class="meta-box-sortables ui-sortable">
<form method="post" action="options.php">
<div class="postbox">
<div class="inside">
<?php
settings_fields( '404page_settings' );
do_settings_sections( '404page_settings_section' );
submit_button();
?>
</div>
</div>
</form>
</div>
</div>
<?php { $this->show_meta_boxes(); } ?>
</div>
<br class="clear">
</div>
</div>
<?php
}
// returns the id of the 404 page if one is defined, returns 0 if none is defined, returns -1 if the defined page id does not exist
private function get_404page_id() {
$pageid = get_option( '404page_page_id', 0 );
if ( $pageid != 0 ) {
$page = get_post( $pageid );
if ( !$page || $page->post_status != 'publish' ) {
$pageid = -1;
}
}
return $pageid;
}
// returns the selected method
private function get_404page_method() {
if ( defined( 'ICL_SITEPRESS_VERSION' ) || defined( 'POLYLANG_VERSION' ) ) {
// WPML or Polylang is active
return 'CMP';
} else {
return get_option( '404page_method', 'STD' );
}
}
// should we hide the selected 404 page from the page list?
private function get_404page_hide() {
return (bool)get_option( '404page_hide', false );
}
// should we fire an 404 error if the selected page is accessed directly?
private function get_404page_fire_error() {
return (bool)get_option( '404page_fire_error', true );
}
// this function gets the id of the translated page if WPML or Polylang is active - otherwise the original pageid is returned
private function get_page_id( $pageid ) {
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
// WPML is active
$pageid = apply_filters( 'wpml_object_id', $pageid, 'page', true );
} elseif ( defined( 'POLYLANG_VERSION' ) ) {
// Polylang is active
$translatedpageid = pll_get_post( $pageid );
if ( !empty( $translatedpageid ) && 'publish' == get_post_status( $translatedpageid ) ) {
$pageid = $translatedpageid;
}
}
return $pageid;
}
// make plugin expandable
function do_404page_action() {
do_action( '404page_after_404' );
}
// show meta boxes
function show_meta_boxes() {
?>
<div id="postbox-container-1" class="postbox-container">
<div class="meta-box-sortables">
<div class="postbox">
<h3><span><?php _e( 'Like this Plugin?', '404page' ); ?></span></h3>
<div class="inside">
<ul>
<li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="<?php echo $this->wp_url; ?>/"><?php _e( 'Please rate the plugin', '404page' ); ?></a></li>
<li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="<?php echo $this->my_url; ?>/"><?php _e( 'Plugin homepage', '404page'); ?></a></li>
<li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="http://petersplugins.com/"><?php _e( 'Author homepage', '404page' );?></a></li>
<li><div class="dashicons dashicons-googleplus"></div>&nbsp;&nbsp;<a href="http://g.petersplugins.com/"><?php _e( 'Authors Google+ Page', '404page' ); ?></a></li>
<li><div class="dashicons dashicons-facebook-alt"></div>&nbsp;&nbsp;<a href="http://f.petersplugins.com/"><?php _e( 'Authors facebook Page', '404page' ); ?></a></li>
</ul>
</div>
</div>
<div class="postbox">
<h3><span><?php _e( 'Need help?', '404page' ); ?></span></h3>
<div class="inside">
<ul>
<li><div class="dashicons dashicons-book-alt"></div>&nbsp;&nbsp;<a href="<?php echo $this->dc_url; ?>"><?php _e( 'Take a look at the Plugin Doc', '404page' ); ?></a></li>
<li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="<?php echo $this->wp_url; ?>/faq/"><?php _e( 'Take a look at the FAQ section', '404page' ); ?></a></li>
<li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="http://wordpress.org/support/plugin/<?php echo $this->plugin_slug; ?>/"><?php _e( 'Take a look at the Support section', '404page'); ?></a></li>
<li><div class="dashicons dashicons-admin-comments"></div>&nbsp;&nbsp;<a href="http://petersplugins.com/contact/"><?php _e( 'Feel free to contact the Author', '404page' ); ?></a></li>
</ul>
</div>
</div>
<div class="postbox">
<h3><span><?php _e( 'Translate this Plugin', '404page' ); ?></span></h3>
<div class="inside">
<p><?php _e( 'It would be great if you\'d support the 404page Plugin by adding a new translation or keeping an existing one up to date!', '404page' ); ?></p>
<p><a href="https://translate.wordpress.org/projects/wp-plugins/<?php echo $this->plugin_slug; ?>"><?php _e( 'Translate online', '404page' ); ?></a></p>
</div>
</div>
</div>
</div>
<?php
}
// add a link to settings page in plugin list
function add_settings_link( $links ) {
return array_merge( $links, array( '<a href="' . admin_url( 'themes.php?page=404pagesettings' ) . '">' . __( 'Settings', '404page' ) . '</a>') );
}
// uninstall plugin
function uninstall() {
if( is_multisite() ) {
$this->uninstall_network();
} else {
$this->uninstall_single();
}
}
// uninstall network wide
function uninstall_network() {
global $wpdb;
$activeblog = $wpdb->blogid;
$blogids = $wpdb->get_col( esc_sql( 'SELECT blog_id FROM ' . $wpdb->blogs ) );
foreach ($blogids as $blogid) {
switch_to_blog( $blogid );
$this->uninstall_single();
}
switch_to_blog( $activeblog );
}
// uninstall single blog
function uninstall_single() {
foreach ( $this->settings as $key => $value) {
delete_option( $key );
}
}
// *
// * functions for theme usage
// *
// check if there's a custom 404 page set
function pp_404_is_active() {
return ( $this->settings['404page_page_id'] > 0 );
}
// activate the native theme support
function pp_404_set_native_support() {
$this->settings['404page_native'] = true;
}
// get the title - native theme support
function pp_404_get_the_title() {
$title = '';
if ( $this->settings['404page_page_id'] > 0 && $this->settings['404page_native'] ) {
$title = get_the_title( $this->settings['404page_page_id'] );
}
return $title;
}
// print title - native theme support
function pp_404_the_title() {
echo $this->pp_404_get_the_title();
}
// get the content - native theme support
function pp_404_get_the_content() {
$content = '';
if ( $this->settings['404page_page_id'] > 0 && $this->settings['404page_native'] ) {
$content = apply_filters( 'the_content', get_post_field( 'post_content', $this->settings['404page_page_id'] ) );
}
return $content;
}
// print content - native theme support
function pp_404_the_content() {
echo $this->pp_404_get_the_content();
}
}
$smart404page = new Smart404Page();
/**
* Theme functions
*/
// this function can be used by a theme to check if there's an active custom 404 page
function pp_404_is_active() {
global $smart404page;
return $smart404page->pp_404_is_active();
global $pp_404page;
return $pp_404page->pp_404_is_active();
}
// this function can be used by a theme to activate native support
function pp_404_set_native_support() {
global $smart404page;
$smart404page->pp_404_set_native_support();
global $pp_404page;
$pp_404page->pp_404_set_native_support();
}
// this function can be used by a theme to get the title of the custom 404 page in native support
function pp_404_get_the_title() {
global $smart404page;
return $smart404page->pp_404_get_the_title();
global $pp_404page;
return $pp_404page->pp_404_get_the_title();
}
// this function can be used by a theme to print out the title of the custom 404 page in native support
function pp_404_the_title() {
global $smart404page;
$smart404page->pp_404_the_title();
global $pp_404page;
$pp_404page->pp_404_the_title();
}
// this function can be used by a theme to get the content of the custom 404 page in native support
function pp_404_get_the_content() {
global $smart404page;
return $smart404page->pp_404_get_the_content();
global $pp_404page;
return $pp_404page->pp_404_get_the_content();
}
// this function can be used by a theme to print out the content of the custom 404 page in native support
function pp_404_the_content() {
global $smart404page;
return $smart404page->pp_404_the_content();
global $pp_404page;
return $pp_404page->pp_404_the_content();
}
?>

@ -0,0 +1,126 @@
#pp-404page-settings h1 {
margin-bottom: 40px;
}
#pp-plugin-info-404page {
min-height: 48px;
line-height: 48px;
vertical-align: middle;
padding-left: 60px;
background-repeat: no-repeat;
background-position: left center;
}
.rtl #pp-plugin-info-404page {
padding-left: 0;
padding-right: 60px;
background-position: right center;
}
#pp-plugin-info-404page span {
float: right;
padding-left: 50px;
}
.rtl #pp-plugin-info-404page span {
float: left;
padding-left: 0;
padding-right: 50px;
}
#pp-plugin-info-404page .dashicons {
vertical-align: middle;
}
#select404page {
width: 100%;
}
#pp-404page-settings .form-table th, .form-table td {
display: block;
width: auto;
}
#pp-404page-settings .form-table th {
padding: 0;
font-weight: normal;
}
#pp-404page-settings .form-table td {
padding: 0;
margin-bottom: 20px;
}
#pp-404page-settings .form-table td p {
padding: 0;
line-height: 1.2;
margin-bottom: 20px;
}
#pp-seetings-advanced .form-table th {
display: none;
}
#pp-404page-settings input[type="checkbox"] {
display: none;
}
#pp-404page-settings input[type="checkbox"] + label.check {
cursor: pointer;
text-indent: -9999px;
width: 80px;
height: 40px;
background: grey;
display: block;
border-radius: 40px;
position: relative;
float: left;
margin-right: 40px;
}
.rtl #pp-404page-settings input[type="checkbox"] + label.check {
float: right;
margin-left: 40px;
margin-right: 0;
}
#pp-404page-settings input[type="checkbox"]:disabled + label.check {
background-color: #DDD;
}
#pp-404page-settings input[type="checkbox"] + label.check:after {
content: '';
position: absolute;
top: 5px;
width: 30px;
height: 30px;
background: #fff;
border-radius: 30px;
transition: 0.3s;
}
body:not(.rtl) #pp-404page-settings input[type="checkbox"] + label.check:after, .rtl #pp-404page-settings input[type="checkbox"]:enabled:checked + label.check:after {
left: 5px;
transform: none;
}
#pp-404page-settings input[type="checkbox"]:enabled:checked + label.check {
background: #104060;
}
body:not(.rtl) #pp-404page-settings input[type="checkbox"]:enabled:checked + label.check:after, .rtl #pp-404page-settings input[type="checkbox"] + label.check:after {
left: calc(100% - 5px);
transform: translateX(-100%);
}
#pp-404page-settings select {
border: 1px solid #104060;
border-radius:5px;
height: 40px;
line-height: 40px;
margin: 5px 0;
}
#pp-404page-settings .dashicons-warning, #pp-404page-settings input[type="checkbox"] + label.check.warning:before {
color: #d54e21;
}

@ -0,0 +1 @@
<?php // Silence is golden

@ -0,0 +1,12 @@
jQuery(document).ready(function($) {
$( '#select404page' ).change(function() {
$( '#edit_404_page, #test_404_page' ).prop( 'disabled', !( $( '#select404page' ).val() == $( '#404page_current_value').text() != 0 ) );
});
$( '#select404page' ).trigger( 'change' );
$( '#edit_404_page' ).click(function() {
window.location.href = $( '#404page_edit_link' ).text();
});
$( '#test_404_page' ).click(function() {
window.location.href = $( '#404page_test_link' ).text();
});
});

@ -0,0 +1,13 @@
jQuery(document).ready(function($) {
$( '.pp-404page-admin-notice' ).on( 'click', '.notice-dismiss', function ( event ) {
event.preventDefault();
data = {
action: 'pp_404page_dismiss_admin_notice',
pp_404page_dismiss_admin_notice: $( this ).parent().attr( 'id' )
};
$.post( ajaxurl, data );
return false;
});
});

@ -0,0 +1 @@
<?php // Silence is golden

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
<?php // Silence is golden

@ -0,0 +1 @@
<?php // Silence is golden

Binary file not shown.

Before

Width:  |  Height:  |  Size: 934 B

@ -1,10 +1,11 @@
=== 404page - your smart custom 404 error page ===
Contributors: petersplugins, smartware.cc
Donate link:http://petersplugins.com/make-a-donation/
Contributors: petersplugins
Donate link: https://petersplugins.com/make-a-donation/
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page
Requires at least: 3.0
Tested up to: 4.6
Stable tag: 2.3
Tested up to: 4.9
Stable tag: 3.3
Requires PHP: 5.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -12,28 +13,78 @@ Custom 404 the easy way! Set any page as custom 404 error page. No coding needed
== Description ==
> Create your custom 404 Error Page using the full Power of WordPress
<strong>The 404page plugin is the most used plugin to create a customized 404 error page in WordPress.</strong>
**See also [Plugin Homepage](http://petersplugins.com/free-wordpress-plugins/404page/) and [Plugin Doc](http://petersplugins.com/docs/404page/)**
It allows you to easily create your own 404 error page without any effort and it works with almost every theme.
https://www.youtube.com/watch?v=VTL07Lf0IsY
<blockquote>
If you like this plugin please do me favor and leave a review here on wordpress.org so that other people know it is helpful for you. Thanks!
</blockquote>
Create your custom 404 Page as a normal WordPress Page using the full power of WordPress. You can use a Custom Page Template or Custom Fields, you can set a Featured Image - everything like on every other Page. Then go to 'Appearance' -> '404 Error Page' from your WordPress Dashbord and select the created Page as your 404 error page. That's it!
[youtube https://youtu.be/HygoFMwdIuY]
= Why you should choose this plugin =
= Usage =
Create your custom 404 error page just like any other page using the WordPress Page Editor. Then go to 'Appearance' -> '404 Error Page' and select the created page as your custom 404 error page. That's it!
* Different from other similar plugins the 404page plugin **does not create redirects**. Thats **quite important** because a correct code 404 is delivered which tells search engines that the page does not exist and has to be removed from the index. A redirect would result in a HTTP code 301 or 302 and the URL would remain in the search index.
* Different from other similar plugins the 404page plugin **does not create additional server requests**.
= Translations =
= Docs & Support =
The 404page Plugin uses GlotPress - the wordpress.org Translation System - for translations. Translations can be submitted at [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/404page).
More detailed information about the 404page plugin can be found in the [Plugin Manual](http://petersplugins.com/docs/404page/). For support check the [Support Forum](https://wordpress.org/support/plugin/404page).
**Translation are highly appreciated**. It would be great if you'd support the 404page Plugin by adding a new translation or keeping an existing one up to date. If you're new to GlotPress take a look at the [Translator Handbook](https://make.wordpress.org/polyglots/handbook/tools/glotpress-translate-wordpress-org/).
== Compatibility ==
= Do you like the 404page Plugin? =
= The 404page plugin was sucessfully tested by the author with the following themes =
* [Athena](https://wordpress.org/themes/athena/)
* [Customizr](https://wordpress.org/themes/customizr/) (Read more about [Customizr Compatibility Mode](http://petersplugins.com/docs/404page/#settings_operating_method))
* [Enfold](https://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=petersplugins)
* [evolve](https://wordpress.org/themes/evolve/)
* [GeneratePress](https://wordpress.org/themes/generatepress/)
* [Graphene](https://wordpress.org/themes/graphene/)
* [Hemingway](https://wordpress.org/themes/hemingway/)
* [Hueman](https://wordpress.org/themes/hueman/)
* [Responsive](https://wordpress.org/themes/responsive/)
* [Spacious](https://wordpress.org/themes/spacious/)
* [Sparkling](https://wordpress.org/themes/sparkling/)
* [Sydney](https://wordpress.org/themes/sydney/)
* [Twenty Ten](https://wordpress.org/themes/twentyten/)
* [Twenty Eleven](https://wordpress.org/themes/twentyeleven/)
* [Twenty Twelve](https://wordpress.org/themes/twentytwelve/)
* [Twenty Thirteen](https://wordpress.org/themes/twentythirteen/)
* [Twenty Fourteen](https://wordpress.org/themes/twentyfourteen/)
* [Twenty Fifteen](https://wordpress.org/themes/twentyfifteen/)
* [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
* [Twenty Seventeen](https://wordpress.org/themes/twentyseventeen/)
* [Vantage](https://wordpress.org/themes/vantage/)
* [Virtue](https://wordpress.org/themes/virtue/)
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
Thanks, I appreciate that. You dont need to make a donation. No money, no beer, no coffee. Please, just [tell the world that you like what Im doing](http://petersplugins.com/make-a-donation/)! And thats all.
= The 404page plugin was sucessfully tested by the author with the following starter themes =
* [Bones](http://themble.com/bones/)
* [JointsWP](http://jointswp.com/)
* [undersores](http://underscores.me/)
= The 404page plugin was sucessfully tested by the author with the following plugins =
* [bbPress](https://wordpress.org/plugins/bbpress/)
* [BuddyPress](https://wordpress.org/plugins/buddypress/)
* [DW Question & Answer](https://www.designwall.com/wordpress/plugins/dw-question-answer/)
* [hashtagger](https://wordpress.org/plugins/hashtagger/)
* [Page Builder by SiteOrigin](https://wordpress.org/plugins/siteorigin-panels/)
* [Polylang](https://wordpress.org/plugins/polylang/)
* [User Submitted Posts](https://wordpress.org/plugins/user-submitted-posts/)
* [WooCommerce](https://wordpress.org/plugins/woocommerce/)
* [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)(Read more about [WP Super Cache Compatibility](http://petersplugins.com/docs/404page/#wp_super_cache)
* [WPML WordPress Multilingual Plugin](https://wpml.org/)([officially approved by WPML team](https://wpml.org/plugin/404page/))
== For developers ==
= Action Hook =
The plugin adds an action hook 404page_after_404 which you can use to add extra functionality. The exact position the action occurs after an 404 error is detected depends on the Operating Method. Your function must not generate any output. There are no parameters.
= Native Support =
If you are a theme developer you can add native support for the 404page plugin to your theme for full control. [Read more](http://petersplugins.com/docs/404page/#theme_native_support).
= More plugins from Peter =
@ -42,19 +93,12 @@ Thanks, I appreciate that. You dont need to make a donation. No money, no bee
* **[smart User Slug Hider](https://wordpress.org/plugins/smart-user-slug-hider/)** - Hide usernames in author pages URLs to enhance security
* [See all](https://profiles.wordpress.org/petersplugins/#content-plugins)
== Installation ==
= From your WordPress dashboard =
1. Visit 'Plugins' -> 'Add New'
1. Search for '404page'
1. Activate the plugin through the 'Plugins' menu in WordPress
= Manually from wordpress.org =
== Screenshots ==
1. Download 404page from wordpress.org and unzip the archive
1. Upload the `404page` folder to your `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Create your costom 404 Error Page as a normal WordPress Page
2. Set the created Page as 404 Error Page
3. Advanced Settings
4. Advanced Settings with WPML plugin installed (Compatibility Mode is not available, because the 404page plugin automatically switches to WMPL mode)
== Frequently Asked Questions ==
@ -66,20 +110,45 @@ To enable the WordPress 404 error handling you have to set the Permalink Structu
No, there is no redirection! The chosen page is delivered as a 'real' 404 error page. This results in a HTTP 404 code and not in 301 or 302, which is important for Search Engines to tell them, that the page does not exist and should be deleted from the index.
= What about PHP Version 7? =
The plugin works smoothly with PHP 7.
= Is it possible to add custom CSS to the 404 page? =
The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be used for extra styling.
== Screenshots ==
1. Create your 404 Page as a normal WordPress Page
2. Define the created Page as 404 Error Page
3. Your custom 404 Error Page is shown in case of a 404 error
The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be used for extra styling.
== Changelog ==
= 3.3 (2017-11-16) =
* support for right-to-left-languages added
* faulty display in WP 4.9 fixed
= 3.2 (2017-10-05) =
* new feature to send an HTTP 410 error for deleted objects
= 3.1 (2017-07-24) =
* bugfix for Polylang ([See Topic](https://wordpress.org/support/topic/3-0-breaks-polylang-support/))
* bugfix for CLI ([See Topic](https://wordpress.org/support/topic/uninstall-php-from-cli-failed/))
* add debug class to body tag
* also add body classes for Customizr theme
* do not add error404 class if already exists
* further redesign admin interface
= 3.0 (2017-07-05) =
* new feature to force 404 error after loading page
* new feature to disable URL autocorrection guessing
* finally removed Polylang stuff disabled in 2.4
* redesigned admin interface
* code improvement
= 2.5 (2017-05-19) =
* hide 404 page from search results on front end (if WPML is active, all languages are hidden)
* do not fire a 404 in Compatibility Mode if the [DW Question & Answer plugin by DesignWall](https://www.designwall.com/wordpress/plugins/dw-question-answer/) is active and a question has no answers
= 2.4 (2017-03-08) =
* ensure that all core files are loaded properly ([See Topic](https://wordpress.org/support/topic/had-to-deactivate-404page-to-make-wordpress-correctly))
* Polylang plugin does no longer require Compatibility Mode ([See Topic](https://wordpress.org/support/topic/still-displaying-the-themes-404-page-with-polylang/))
* hide all translations if WPML is installed and "Hide 404 page" is active (thanks to the [WPML](https://wpml.org/) guys for pointing me at this)
* post status fix ([See topic](https://wordpress.org/support/topic/doesnt-work-with-custom-post-status/))
* [Enfold theme](https://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=petersplugins) issue fix (thanks to the guys at [Kriesi.at](http://www.kriesi.at/) for supporting me)
= 2.3 (2016-11-21) =
* a few minor bug fixes solve some problems with page templates in certain combinations
@ -135,63 +204,35 @@ The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be
== Upgrade Notice ==
= 2.2 =
Enhanced compatibility. Automated Operating Method select removed. Several fixes.
= 3.3 =
support for right-to-left-languages
= 2.1 =
Introduced Compatibility Mode, improved compatibility with several plugins.
= 3.2 =
new feature to send an HTTP 410 error for deleted objects
= 2.0 =
Version 2.0 is more or less a completely new development and a big step forward. [Read more](http://petersplugins.com/blog/2016/02/23/the-404page-plugin-now-works-with-wpml-and-other-enhancements/)
= 3.1 =
fixed two bugs, plus further enhancements
= 1.4 =
Editing of the 404 page is now possible directly from settings page. Portuguese translation added.
= 3.0 =
new features added to force 404 error after loading page and to disable URL autocorrection guessing, plus further enhancements
== Compatibility ==
= 2.5 =
Hide 404 page from search results, compatibility with DW Question & Answer plugin
= The 404page plugin was sucessfully tested by the author with the following themes =
* [Athena](https://wordpress.org/themes/athena/)
* [Customizr](https://wordpress.org/themes/customizr/) (Read more about [Customizr Compatibility Mode](http://petersplugins.com/docs/404page/#settings_operating_method))
* [evolve](https://wordpress.org/themes/evolve/)
* [GeneratePress](https://wordpress.org/themes/generatepress/)
* [Graphene](https://wordpress.org/themes/graphene/)
* [Hemingway](https://wordpress.org/themes/hemingway/)
* [Hueman](https://wordpress.org/themes/hueman/)
* [Responsive](https://wordpress.org/themes/responsive/)
* [Spacious](https://wordpress.org/themes/spacious/)
* [Sparkling](https://wordpress.org/themes/sparkling/)
* [Sydney](https://wordpress.org/themes/sydney/)
* [Twenty Ten](https://wordpress.org/themes/twentyten/)
* [Twenty Eleven](https://wordpress.org/themes/twentyeleven/)
* [Twenty Twelve](https://wordpress.org/themes/twentytwelve/)
* [Twenty Thirteen](https://wordpress.org/themes/twentythirteen/)
* [Twenty Fourteen](https://wordpress.org/themes/twentyfourteen/)
* [Twenty Fifteen](https://wordpress.org/themes/twentyfifteen/)
* [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
* [Vantage](https://wordpress.org/themes/vantage/)
* [Virtue](https://wordpress.org/themes/virtue/)
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
= 2.4 =
Version 2.4 fixes several issues. See [changelog](https://wordpress.org/plugins/404page/changelog/) for details.
= The 404page plugin was sucessfully tested by the author with the following starter themes =
* [Bones}(http://themble.com/bones/)
* [JointsWP](http://jointswp.com/)
* [undersores](http://underscores.me/)
= 2.3 =
A few minor bug fixes solve some problems with page templates in certain combinations.
= The 404page plugin was sucessfully tested by the author with the following plugins =
* [bbPress](https://wordpress.org/plugins/bbpress/)
* [BuddyPress](https://wordpress.org/plugins/buddypress/)
* [hashtagger](https://wordpress.org/plugins/hashtagger/)
* [Page Builder by SiteOrigin](https://wordpress.org/plugins/siteorigin-panels/)
* [Polylang](https://wordpress.org/plugins/polylang/)
* [User Submitted Posts](https://wordpress.org/plugins/user-submitted-posts/)
* [WooCommerce](https://wordpress.org/plugins/woocommerce/)
* [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)(Read more about [WP Super Cache Compatibility](http://petersplugins.com/docs/404page/#wp_super_cache)
* [WPML WordPress Multilingual Plugin](https://wpml.org/)([officially approved by WPML team](https://wpml.org/plugin/404page/))
= 2.2 =
Enhanced compatibility. Automated Operating Method select removed. Several fixes.
== For developers ==
= 2.1 =
Introduced Compatibility Mode, improved compatibility with several plugins.
= Action Hook =
The plugin adds an action hook 404page_after_404 which you can use to add extra functionality. The exact position the action occurs after an 404 error is detected depends on the Operating Method. Your function must not generate any output. There are no parameters.
= 2.0 =
Version 2.0 is more or less a completely new development and a big step forward. [Read more](http://petersplugins.com/blog/2016/02/23/the-404page-plugin-now-works-with-wpml-and-other-enhancements/)
= Native Support =
If you are a theme developer you can add native support for the 404page plugin to your theme for full control. [Read more](http://petersplugins.com/docs/404page/#theme_native_support).
= 1.4 =
Editing of the 404 page is now possible directly from settings page. Portuguese translation added.

@ -1,12 +1,27 @@
<?php
// 404page uninstall
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || ! WP_UNINSTALL_PLUGIN || dirname( WP_UNINSTALL_PLUGIN ) != dirname( plugin_basename( __FILE__ ) ) ) {
status_header( 404 );
exit;
}
include_once plugin_dir_path( __FILE__ ) . '404page.php';
/**
* The 404page Plugin Uninstall
*/
$smart404page->uninstall();
// If this file is called directly, abort
if ( ! defined( 'WPINC' ) ) {
die;
}
// If this is somehow accessed withou plugin uninstall is requested, abort
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || ! WP_UNINSTALL_PLUGIN || dirname( WP_UNINSTALL_PLUGIN ) != dirname( plugin_basename( __FILE__ ) ) ) {
die;
}
/**
* Load core plugin class and run uninstall
*/
require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page.php' );
$pp_404page = new PP_404Page( __FILE__ );
$pp_404page->uninstall();
?>

@ -1,3 +1,6 @@
.wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config {
background-color:#f3f6f8;
}
#submitted-on {
position: relative;
@ -13,12 +16,12 @@
text-decoration: inherit;
color: inherit;
}
#the-comment-list .remove_url {
#the-comment-list .akismet_remove_url {
margin-left: 3px;
color: #999;
padding: 2px 3px 2px 0;
}
#the-comment-list .remove_url:hover {
#the-comment-list .akismet_remove_url:hover {
color: #A7301F;
font-weight: bold;
padding: 2px 2px 2px 0;
@ -73,136 +76,37 @@ table.comments td.comment p a:after {
height: 338px;
width: 450px;
}
h2.ak-header {
padding: 30px;
background: #649316 url('img/logo-full-2x.png') no-repeat 20px center;
background-size: 185px 33px;
height: 33px;
text-indent: -9999em;
margin-right: 10px;
}
.checkforspam {
display: inline-block !important;
}
.checkforspam-spinner {
display: inline-block;
margin-top: 7px;
}
.config-wrap {
margin-top: 2em;
max-width: 700px;
}
.activate-option {
background: #e3e3e3;
border-radius: 3px;
margin-bottom: 30px;
overflow: hidden;
padding: 20px;
}
.activate-option.clicked {
background: #649316;
color: #fff;
}
.activate-option.clicked:hover {
background: #68802E;
color: #fff;
}
.activate-option .button.button-secondary {
margin: 15px 0;
}
.activate-option p {
margin: 10px 0 10px;
}
.activate-highlight {
background: #fff;
padding: 30px;
margin-right: 10px;
.checkforspam-progress {
padding-left: 1ex;
display: none;
}
.activate-highlight.secondary {
background: #ddd;
padding: 20px 30px;
.checkforspam.button-disabled .checkforspam-progress {
display: inline;
}
.activate-highlight h3 {
margin: 0 0 0.3em;
}
.activate-highlight p {
color: #777;
}
.activate-highlight .button-primary {
margin-top: 15px;
.checkforspam-spinner {
display: inline-block;
margin-top: 7px;
}
#akismet-enter-api-key .regular-text {
width: 18em;
margin-top: 15px;
.akismet-right {
float: right;
}
.right {
float: right;
.akismet-card .akismet-right {
margin: 1em 0;
}
.alert-text {
.akismet-alert-text {
color: #dd3d36;
font-weight: bold;
font-size: 120%;
margin-top: .5rem;
}
.success {
color: #649316;
}
.option-description {
float: left;
font-size: 16px;
}
.option-description span {
color: #666;
display: block;
font-size: 14px;
margin-top: 5px;
}
.option-action {
float: right;
}
.key-config-link {
font-size: 14px;
margin-left: 20px;
}
.jetpack-account {
float: left;
font-size: 18px;
margin-right: 40px;
}
.small-heading {
color: #777;
display: block;
font-size: 12px;
font-weight: bold;
margin-bottom: 5px;
text-transform: uppercase;
}
.inline-label {
background: #ddd;
border-radius: 3px;
font-size: 11px;
padding: 3px 8px;
text-transform: uppercase;
}
.inline-label.alert {
background: #e54747;
color: #fff;
}
.jetpack-account .inline-label {
margin-left: 5px;
}
.option-action .manual-key {
margin-top: 7px;
}
.alert {
.akismet-alert {
border: 1px solid #e5e5e5;
padding: 0.4em 1em 1.4em 1em;
border-radius: 3px;
@ -211,49 +115,45 @@ h2.ak-header {
border-style: solid;
}
.alert h3.key-status {
.akismet-alert h3.akismet-key-status {
color: #fff;
margin: 1em 0 0.5em 0;
}
.alert.critical {
.akismet-alert.akismet-critical {
background-color: #993300;
}
.alert.active {
.akismet-alert.akismet-active {
background-color: #649316;
}
.alert p.key-status {
.akismet-alert p.akismet-key-status {
font-size: 24px;
}
.alert p.description {
.akismet-alert p.akismet-description {
color:#fff;
font-size: 14px;
margin: 0 0;
font-style: normal;
}
.alert p.description a,
.alert p.description a,
.alert p.description a,
.alert p.description a {
.akismet-alert p.akismet-description a,
.akismet-alert p.akismet-description a,
.akismet-alert p.akismet-description a,
.akismet-alert p.akismet-description a {
color: #fff;
}
.new-snapshot {
.akismet-new-snapshot {
margin-top: 1em;
padding: 1em;
text-align: center;
}
.new-snapshot.stats {
background: #fff;
border: 1px solid #e5e5e5;
}
.new-snapshot h3 {
.akismet-new-snapshot h3 {
background: #f5f5f5;
color: #888;
font-size: 11px;
@ -266,7 +166,7 @@ h2.ak-header {
width: 100%;
}
.new-snapshot ul li {
.akismet-new-snapshot ul li {
color: #999;
float: left;
font-size: 11px;
@ -279,16 +179,12 @@ h2.ak-header {
-ms-box-sizing: border-box;
}
.new-snapshot.stats ul li:first-child,
.new-snapshot.stats ul li:nth-child(2) {
.akismet-new-snapshot ul li:first-child,
.akismet-new-snapshot ul li:nth-child(2) {
border-right:1px dotted #ccc;
}
.new-snapshot.account ul li:nth-child(2) {
border-right: none;
}
.new-snapshot ul li span {
.akismet-new-snapshot ul li span {
color: #52accc;
display: block;
font-size: 32px;
@ -296,60 +192,6 @@ h2.ak-header {
line-height: 1.5em;
}
.new-snapshot.stats {
}
.new-snapshot.account,
.new-snapshot.settings {
float: left;
padding: 0;
text-align: left;
width: 50%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
}
.account-container {
background: #fff;
border: 1px solid #e5e5e5;
margin-right: 0.5em;
}
.settings-container {
background: #fff;
border: 1px solid #e5e5e5;
margin-left: 0.5em;
}
.new-snapshot.account ul li {
width:100%
}
.new-snapshot.account ul li span {
font-size: 14px;
font-weight: normal;
}
.new-snapshot.settings ul li {
border: none;
display: block;
width:100%
}
.new-snapshot.settings ul li span {
display: block;
font-size: 14px;
font-weight: normal;
}
.new-snapshot.settings p.submit {
margin: 0;
text-align: center;
}
.akismet-settings th:first-child {
vertical-align: top;
padding-top: 15px;
@ -364,17 +206,13 @@ h2.ak-header {
width: 75%;
}
.akismet-settings span.note{
.akismet-settings span.akismet-note{
float: left;
padding-left: 23px;
font-size: 75%;
margin-top: -10px;
}
.clearfix {
clear:both;
}
/**
* For the activation notice on the plugins page.
*/
@ -471,4 +309,278 @@ h2.ak-header {
.akismet_activate .aa_description strong {
color: #FFF;
font-weight: normal;
}
.jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent {
padding-left: 0;
}
.akismet-masthead {
background-color:#fff;
text-align:center;
box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3
}
@media (max-width: 45rem) {
.akismet-masthead {
padding:0 1.25rem
}
}
.akismet-masthead__inside-container {
padding:.375rem 0;
margin:0 auto;
width:100%;
max-width:45rem;
text-align: left;
}
.akismet-masthead__logo-container {
padding:.3125rem 0 0
}
.akismet-masthead__logo {
width:10.375rem;
height:1.8125rem;
}
.akismet-masthead__logo-link {
display:inline-block;
outline:none;
vertical-align:middle
}
.akismet-masthead__logo-link:focus {
line-height:0;
box-shadow:0 0 0 2px #78dcfa
}
.akismet-masthead__logo-link+code {
margin:0 10px;
padding:5px 9px;
border-radius:2px;
background:#e6ecf1;
color:#647a88
}
.akismet-masthead__links {
display:-ms-flexbox;
display:flex;
-ms-flex-flow:row wrap;
flex-flow:row wrap;
-ms-flex:2 50%;
flex:2 50%;
-ms-flex-pack:end;
justify-content:flex-end;
margin:0
}
@media (max-width: 480px) {
.akismet-masthead__links {
padding-right:.625rem
}
}
.akismet-masthead__link-li {
margin:0;
padding:0
}
.akismet-masthead__link {
font-style:normal;
color:#0087be;
padding:.625rem;
display:inline-block
}
.akismet-masthead__link:visited {
color:#0087be
}
.akismet-masthead__link:active,.akismet-masthead__link:hover {
color:#00aadc
}
.akismet-masthead__link:hover {
text-decoration:underline
}
.akismet-masthead__link .dashicons {
display:none
}
@media (max-width: 480px) {
.akismet-masthead__link:hover,.akismet-masthead__link:active {
text-decoration:none
}
.akismet-masthead__link .dashicons {
display:block;
font-size:1.75rem
}
.akismet-masthead__link span+span {
display:none
}
}
.akismet-masthead__link-li:last-of-type .akismet-masthead__link {
padding-right:0
}
.akismet-lower {
margin: 0 auto;
text-align: left;
max-width: 45rem;
padding: 1.5rem;
}
.akismet-card {
margin-top: 1rem;
margin-bottom: 0;
position: relative;
margin: 0 auto 0.625rem auto;
box-sizing: border-box;
background: white;
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
}
.akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.akismet-card .inside {
padding: 1.5rem;
padding-top: 1rem;
}
.akismet-card .akismet-card-actions {
margin-top: 1rem;
}
.jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag {
display: none;
}
.akismet-masthead .akismet-right {
line-height: 2.125rem;
font-size: 0.9rem;
}
.akismet-box {
box-sizing: border-box;
background: white;
border: 1px solid rgba(200, 215, 225, 0.5);
}
.akismet-box h2, .akismet-box h3 {
padding: 1.5rem 1.5rem .5rem 1.5rem;
margin: 0;
}
.akismet-box p {
padding: 0 1.5rem 1.5rem 1.5rem;
margin: 0;
}
.akismet-jetpack-email {
font-style: oblique;
}
.akismet-jetpack-gravatar {
padding: 0 0 0 1.5rem;
float: left;
margin-right: 1rem;
width: 54px;
height: 54px;
}
.akismet-box p:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.akismet-box .akismet-right {
padding-right: 1.5rem;
}
.akismet-boxes .akismet-box {
margin-bottom: 0;
padding: 0;
margin-top: -1px;
}
.akismet-boxes .akismet-box:last-child {
margin-bottom: 1.5rem;
}
.akismet-boxes .akismet-box:first-child {
margin-top: 1.5rem;
}
.akismet-button, .akismet-button:hover, .akismet-button:visited {
background: white;
border-color: #c8d7e1;
border-style: solid;
border-width: 1px 1px 2px;
color: #2e4453;
cursor: pointer;
display: inline-block;
margin: 0;
outline: 0;
overflow: hidden;
font-size: 14px;
font-weight: 500;
text-overflow: ellipsis;
text-decoration: none;
vertical-align: top;
box-sizing: border-box;
font-size: 14px;
line-height: 21px;
border-radius: 4px;
padding: 7px 14px 9px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.akismet-button:hover {
border-color: #a8bece;
}
.akismet-button:active {
border-width: 2px 1px 1px;
}
.akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited {
background: #00aadc;
border-color: #0087be;
color: white;
}
.akismet-is-primary:hover, .akismet-is-primary:focus {
border-color: #005082;
}
.akismet-is-primary:hover {
border-color: #005082;
}
.akismet-section-header {
position: relative;
margin: 0 auto 0.625rem auto;
padding: 1rem;
box-sizing: border-box;
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
background: #ffffff;
width: 100%;
padding-top: 0.6875rem;
padding-bottom: 0.6875rem;
display: flex;
}
.akismet-section-header__label {
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
-ms-flex-positive: 1;
flex-grow: 1;
line-height: 1.75rem;
position: relative;
font-size: 0.875rem;
color: #4f748e;
}
.akismet-section-header__actions {
line-height: 1.75rem;
}

@ -3,17 +3,8 @@ jQuery( function ( $ ) {
var mshotSecondTryTimer = null
var mshotThirdTryTimer = null
$( 'a.activate-option' ).click( function(){
var link = $( this );
if ( link.hasClass( 'clicked' ) ) {
link.removeClass( 'clicked' );
}
else {
link.addClass( 'clicked' );
}
$( '.toggle-have-key' ).slideToggle( 'slow', function() {});
return false;
});
var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a';
$('.akismet-status').each(function () {
var thisId = $(this).attr('commentid');
$(this).prependTo('#comment-' + thisId + ' .column-comment');
@ -22,31 +13,10 @@ jQuery( function ( $ ) {
var thisId = $(this).attr('commentid');
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
});
$('#the-comment-list')
.find('tr.comment, tr[id ^= "comment-"]')
.find('.column-author a[href^="http"]:first') // Ignore mailto: links, which would be the comment author's email.
.each(function () {
var linkHref = $(this).attr( 'href' );
// Ignore any links to the current domain, which are diagnostic tools, like the IP address link
// or any other links another plugin might add.
var currentHostParts = document.location.href.split( '/' );
var currentHost = currentHostParts[0] + '//' + currentHostParts[2] + '/';
if ( linkHref.indexOf( currentHost ) != 0 ) {
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
$(this)
.attr("id", "author_comment_url_"+ thisCommentId[1])
.after(
$( '<a href="#" class="remove_url">x</a>' )
.attr( 'commentid', thisCommentId[1] )
.attr( 'title', WPAkismet.strings['Remove this URL'] )
);
}
});
akismet_enable_comment_author_url_removal();
$( '#the-comment-list' ).on( 'click', '.remove_url', function () {
$( '#the-comment-list' ).on( 'click', '.akismet_remove_url', function () {
var thisId = $(this).attr('commentid');
var data = {
action: 'comment_author_deurl',
@ -114,7 +84,7 @@ jQuery( function ( $ ) {
});
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments.
$( 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, table.comments td.comment p a' ).mouseover( function () {
$( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () {
clearTimeout( mshotRemovalTimer );
if ( $( '.akismet-mshot' ).length > 0 ) {
@ -131,9 +101,9 @@ jQuery( function ( $ ) {
clearTimeout( mshotSecondTryTimer );
clearTimeout( mshotThirdTryTimer );
var thisHref = $.URLEncode( $( this ).attr( 'href' ) );
var thisHref = $( this ).attr( 'href' );
var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/' + thisHref + '?w=450" width="450" height="338" class="mshot-image" /></div>' );
var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="' + akismet_mshot_url( thisHref ) + '" width="450" height="338" class="mshot-image" /></div>' );
mShot.data( 'link', this );
var offset = $( this ).offset();
@ -143,32 +113,64 @@ jQuery( function ( $ ) {
top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
} );
// These retries appear to be superfluous if .mshot-image has already loaded, but it's because mShots
// can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need
// to retry to see if we can get the newly generated thumbnail.
mshotSecondTryTimer = setTimeout( function () {
mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2' );
mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 2 ) );
}, 6000 );
mshotThirdTryTimer = setTimeout( function () {
mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3' );
mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 3 ) );
}, 12000 );
$( 'body' ).append( mShot );
} ).mouseout( function () {
} ).on( 'mouseout', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () {
mshotRemovalTimer = setTimeout( function () {
clearTimeout( mshotSecondTryTimer );
clearTimeout( mshotThirdTryTimer );
$( '.akismet-mshot' ).remove();
}, 200 );
} ).on( 'mouseover', 'tr', function () {
// When the mouse hovers over a comment row, begin preloading mshots for any links in the comment or the comment author.
var linksToPreloadMshotsFor = $( this ).find( mshotEnabledLinkSelector );
linksToPreloadMshotsFor.each( function () {
// Don't attempt to preload an mshot for a single link twice. Browser caching should cover this, but in case of
// race conditions, save a flag locally when we've begun trying to preload one.
if ( ! $( this ).data( 'akismet-mshot-preloaded' ) ) {
akismet_preload_mshot( $( this ).attr( 'href' ) );
$( this ).data( 'akismet-mshot-preloaded', true );
}
} );
} );
$('.checkforspam:not(.button-disabled)').click( function(e) {
e.preventDefault();
$('.checkforspam:not(.button-disabled)').addClass('button-disabled');
$('.checkforspam-spinner').addClass( 'spinner' );
$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
// Update the label on the "Check for Spam" button to use the active "Checking for Spam" language.
$( '.checkforspam .akismet-label' ).text( $( '.checkforspam' ).data( 'active-label' ) );
akismet_check_for_spam(0, 100);
e.preventDefault();
});
var spam_count = 0;
var recheck_count = 0;
function akismet_check_for_spam(offset, limit) {
var check_for_spam_buttons = $( '.checkforspam' );
// We show the percentage complete down to one decimal point so even queues with 100k
// pending comments will show some progress pretty quickly.
var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10;
// Update the progress counter on the "Check for Spam" button.
$( '.checkforspam-progress' ).text( check_for_spam_buttons.data( 'progress-label-format' ).replace( '%1$s', percentage_complete ) );
$.post(
ajaxurl,
{
@ -177,8 +179,11 @@ jQuery( function ( $ ) {
'limit': limit
},
function(result) {
recheck_count += result.counts.processed;
spam_count += result.counts.spam;
if (result.counts.processed < limit) {
window.location.reload();
window.location.href = check_for_spam_buttons.data( 'success-url' ).replace( '__recheck_count__', recheck_count ).replace( '__spam_count__', spam_count );
}
else {
// Account for comments that were caught as spam and moved out of the queue.
@ -187,11 +192,85 @@ jQuery( function ( $ ) {
}
);
}
});
// URL encode plugin
jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
while(x<c.length){var m=r.exec(c.substr(x));
if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
}else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}
});
if ( "start_recheck" in WPAkismet && WPAkismet.start_recheck ) {
$( '.checkforspam' ).click();
}
if ( typeof MutationObserver !== 'undefined' ) {
// Dynamically add the "X" next the the author URL links when a comment is quick-edited.
var comment_list_container = document.getElementById( 'the-comment-list' );
if ( comment_list_container ) {
var observer = new MutationObserver( function ( mutations ) {
for ( var i = 0, _len = mutations.length; i < _len; i++ ) {
if ( mutations[i].addedNodes.length > 0 ) {
akismet_enable_comment_author_url_removal();
// Once we know that we'll have to check for new author links, skip the rest of the mutations.
break;
}
}
} );
observer.observe( comment_list_container, { attributes: true, childList: true, characterData: true } );
}
}
function akismet_enable_comment_author_url_removal() {
$( '#the-comment-list' )
.find( 'tr.comment, tr[id ^= "comment-"]' )
.find( '.column-author a[href^="http"]:first' ) // Ignore mailto: links, which would be the comment author's email.
.each(function () {
if ( $( this ).parent().find( '.akismet_remove_url' ).length > 0 ) {
return;
}
var linkHref = $(this).attr( 'href' );
// Ignore any links to the current domain, which are diagnostic tools, like the IP address link
// or any other links another plugin might add.
var currentHostParts = document.location.href.split( '/' );
var currentHost = currentHostParts[0] + '//' + currentHostParts[2] + '/';
if ( linkHref.indexOf( currentHost ) != 0 ) {
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
$(this)
.attr("id", "author_comment_url_"+ thisCommentId[1])
.after(
$( '<a href="#" class="akismet_remove_url">x</a>' )
.attr( 'commentid', thisCommentId[1] )
.attr( 'title', WPAkismet.strings['Remove this URL'] )
);
}
});
}
/**
* Generate an mShot URL if given a link URL.
*
* @param string linkUrl
* @param int retry If retrying a request, the number of the retry.
* @return string The mShot URL;
*/
function akismet_mshot_url( linkUrl, retry ) {
var mshotUrl = '//s0.wordpress.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900';
if ( retry ) {
mshotUrl += '&r=' + encodeURIComponent( retry );
}
return mshotUrl;
}
/**
* Begin loading an mShot preview of a link.
*
* @param string linkUrl
*/
function akismet_preload_mshot( linkUrl ) {
var img = new Image();
img.src = akismet_mshot_url( linkUrl );
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -3,10 +3,10 @@
* @package Akismet
*/
/*
Plugin Name: Akismet
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="https://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
Version: 3.2
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
Version: 4.0.2
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
@ -37,8 +37,8 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
define( 'AKISMET_VERSION', '3.2' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' );
define( 'AKISMET_VERSION', '4.0.2' );
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
@ -47,9 +47,12 @@ register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' )
require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-rest-api.php' );
add_action( 'init', array( 'Akismet', 'init' ) );
add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) );
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' );
add_action( 'init', array( 'Akismet_Admin', 'init' ) );

@ -63,6 +63,8 @@ class Akismet_Admin {
add_filter( 'plugin_action_links_'.plugin_basename( plugin_dir_path( __FILE__ ) . 'akismet.php'), array( 'Akismet_Admin', 'admin_plugin_settings_link' ) );
add_filter( 'wxr_export_skip_commentmeta', array( 'Akismet_Admin', 'exclude_commentmeta_from_export' ), 10, 3 );
add_filter( 'all_plugins', array( 'Akismet_Admin', 'modify_plugin_description' ) );
}
public static function admin_init() {
@ -89,12 +91,14 @@ class Akismet_Admin {
}
public static function load_menu() {
if ( class_exists( 'Jetpack' ) )
$hook = add_submenu_page( 'jetpack', __( 'Akismet' , 'akismet'), __( 'Akismet' , 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
else
$hook = add_options_page( __('Akismet', 'akismet'), __('Akismet', 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
if ( version_compare( $GLOBALS['wp_version'], '3.3', '>=' ) ) {
if ( class_exists( 'Jetpack' ) ) {
$hook = add_submenu_page( 'jetpack', __( 'Akismet Anti-Spam' , 'akismet'), __( 'Akismet Anti-Spam' , 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
}
else {
$hook = add_options_page( __('Akismet Anti-Spam', 'akismet'), __('Akismet Anti-Spam', 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
}
if ( $hook ) {
add_action( "load-$hook", array( 'Akismet_Admin', 'admin_help' ) );
}
}
@ -102,7 +106,7 @@ class Akismet_Admin {
public static function load_resources() {
global $hook_suffix;
if ( in_array( $hook_suffix, array(
if ( in_array( $hook_suffix, apply_filters( 'akismet_admin_page_hook_suffixes', array(
'index.php', # dashboard
'edit-comments.php',
'comment.php',
@ -110,13 +114,14 @@ class Akismet_Admin {
'settings_page_akismet-key-config',
'jetpack_page_akismet-key-config',
'plugins.php',
) ) ) {
) ) ) ) {
wp_register_style( 'akismet.css', plugin_dir_url( __FILE__ ) . '_inc/akismet.css', array(), AKISMET_VERSION );
wp_enqueue_style( 'akismet.css');
wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array('jquery','postbox'), AKISMET_VERSION );
wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array('jquery'), AKISMET_VERSION );
wp_enqueue_script( 'akismet.js' );
wp_localize_script( 'akismet.js', 'WPAkismet', array(
$inline_js = array(
'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ),
'strings' => array(
'Remove this URL' => __( 'Remove this URL' , 'akismet'),
@ -125,7 +130,13 @@ class Akismet_Admin {
'(undo)' => __( '(undo)' , 'akismet'),
'Re-adding...' => __( 'Re-adding...' , 'akismet'),
)
) );
);
if ( isset( $_GET['akismet_recheck'] ) && wp_verify_nonce( $_GET['akismet_recheck'], 'akismet_recheck' ) ) {
$inline_js['start_recheck'] = true;
}
wp_localize_script( 'akismet.js', 'WPAkismet', $inline_js );
}
}
@ -199,7 +210,7 @@ class Akismet_Admin {
'content' =>
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
'<p>' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '</p>' .
'<p>' . esc_html__( 'On this page, you are able to enter/remove an API key, view account information and view spam stats.' , 'akismet') . '</p>',
'<p>' . esc_html__( 'On this page, you are able to update your Akismet settings and view spam stats.' , 'akismet') . '</p>',
)
);
@ -209,22 +220,24 @@ class Akismet_Admin {
'title' => __( 'Settings' , 'akismet'),
'content' =>
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
'<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' .
( Akismet::predefined_api_key() ? '' : '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' ) .
'<p><strong>' . esc_html__( 'Comments' , 'akismet') . '</strong> - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '</p>' .
'<p><strong>' . esc_html__( 'Strictness' , 'akismet') . '</strong> - ' . esc_html__( 'Choose to either discard the worst spam automatically or to always put all spam in spam folder.' , 'akismet') . '</p>',
)
);
$current_screen->add_help_tab(
array(
'id' => 'account',
'title' => __( 'Account' , 'akismet'),
'content' =>
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
'<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' .
'<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>',
)
);
if ( ! Akismet::predefined_api_key() ) {
$current_screen->add_help_tab(
array(
'id' => 'account',
'title' => __( 'Account' , 'akismet'),
'content' =>
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
'<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' .
'<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>',
)
);
}
}
}
@ -237,8 +250,9 @@ class Akismet_Admin {
}
public static function enter_api_key() {
if ( function_exists('current_user_can') && !current_user_can('manage_options') )
die(__('Cheatin&#8217; uh?', 'akismet'));
if ( ! current_user_can( 'manage_options' ) ) {
die( __( 'Cheatin&#8217; uh?', 'akismet' ) );
}
if ( !wp_verify_nonce( $_POST['_wpnonce'], self::NONCE ) )
return false;
@ -246,10 +260,11 @@ class Akismet_Admin {
foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) {
update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' );
}
if ( defined( 'WPCOM_API_KEY' ) )
if ( Akismet::predefined_api_key() ) {
return false; //shouldn't have option to save key if already defined
}
$new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] );
$old_key = Akismet::get_api_key();
@ -291,8 +306,9 @@ class Akismet_Admin {
}
public static function dashboard_stats() {
if ( !function_exists('did_action') || did_action( 'rightnow_end' ) )
if ( did_action( 'rightnow_end' ) ) {
return; // We already displayed this info in the "Right Now" section
}
if ( !$count = get_option('akismet_spam_count') )
return;
@ -344,12 +360,25 @@ class Akismet_Admin {
return;
}
if ( function_exists('plugins_url') )
$link = add_query_arg( array( 'action' => 'akismet_recheck_queue' ), admin_url( 'admin.php' ) );
else
$link = add_query_arg( array( 'page' => 'akismet-admin', 'recheckqueue' => 'true', 'noheader' => 'true' ), admin_url( 'edit-comments.php' ) );
$link = add_query_arg( array( 'action' => 'akismet_recheck_queue' ), admin_url( 'admin.php' ) );
$comments_count = wp_count_comments();
echo '</div>';
echo '<div class="alignleft">';
echo '<a
class="button-secondary checkforspam"
href="' . esc_url( $link ) . '"
data-active-label="' . esc_attr( __( 'Checking for Spam', 'akismet' ) ) . '"
data-progress-label-format="' . esc_attr( __( '(%1$s%)', 'akismet' ) ) . '"
data-success-url="' . esc_attr( remove_query_arg( 'akismet_recheck', add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '"
data-pending-comment-count="' . esc_attr( $comments_count->moderated ) . '"
>';
echo '<span class="akismet-label">' . esc_html__('Check for Spam', 'akismet') . '</span>';
echo '<span class="checkforspam-progress"></span>';
echo '</a>';
echo '<span class="checkforspam-spinner"></span>';
echo '</div><div class="alignleft"><a class="button-secondary checkforspam" href="' . esc_url( $link ) . '">' . esc_html__('Check for Spam', 'akismet') . '</a><span class="checkforspam-spinner"></span>';
}
public static function recheck_queue() {
@ -442,11 +471,6 @@ class Akismet_Admin {
}
public static function comment_row_action( $a, $comment ) {
// failsafe for old WP versions
if ( !function_exists('add_comment_meta') )
return $a;
$akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true );
$akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true );
$user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true);
@ -475,7 +499,7 @@ class Akismet_Admin {
$b[ $k ] = $item;
if (
$k == 'edit'
|| ( $k == 'unspam' && $GLOBALS['wp_version'] >= 3.4 )
|| $k == 'unspam'
) {
$b['history'] = '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="'. esc_attr__( 'View comment history' , 'akismet') . '"> '. esc_html__('History', 'akismet') . '</a>';
}
@ -487,7 +511,14 @@ class Akismet_Admin {
if ( $desc )
echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' , 'akismet') . '">'.esc_html( $desc ).'</a></span>';
$show_user_comments = apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') );
$show_user_comments_option = get_option( 'akismet_show_user_comments_approved' );
if ( $show_user_comments_option === false ) {
// Default to active if the user hasn't made a decision.
$show_user_comments_option = '1';
}
$show_user_comments = apply_filters( 'akismet_show_user_comments_approved', $show_user_comments_option );
$show_user_comments = $show_user_comments === 'false' ? false : $show_user_comments; //option used to be saved as 'false' / 'true'
if ( $show_user_comments ) {
@ -613,12 +644,8 @@ class Akismet_Admin {
if ( !$type ) { // total
$count = wp_cache_get( 'akismet_spam_count', 'widget' );
if ( false === $count ) {
if ( function_exists('wp_count_comments') ) {
$count = wp_count_comments();
$count = $count->spam;
} else {
$count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_approved = 'spam'");
}
$count = wp_count_comments();
$count = $count->spam;
wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 );
}
return $count;
@ -674,7 +701,7 @@ class Akismet_Admin {
update_option('akismet_connectivity_time', time());
}
if ( function_exists( 'wp_http_supports' ) && ( wp_http_supports( array( 'ssl' ) ) ) ) {
if ( wp_http_supports( array( 'ssl' ) ) ) {
$response = wp_remote_get( 'https://rest.akismet.com/1.1/test' );
}
else {
@ -698,9 +725,23 @@ class Akismet_Admin {
return self::check_server_connectivity( $cache_timeout );
}
public static function get_number_spam_waiting() {
global $wpdb;
return (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" );
/**
* Find out whether any comments in the Pending queue have not yet been checked by Akismet.
*
* @return bool
*/
public static function are_any_comments_waiting_to_be_checked() {
return !! get_comments( array(
// Exclude comments that are not pending. This would happen if someone manually approved or spammed a comment
// that was waiting to be checked. The akismet_error meta entry will eventually be removed by the cron recheck job.
'status' => 'hold',
// This is the commentmeta that is saved when a comment couldn't be checked.
'meta_key' => 'akismet_error',
// We only need to know whether at least one comment is waiting for a check.
'number' => 1,
) );
}
public static function get_page_url( $page = 'config' ) {
@ -787,16 +828,12 @@ class Akismet_Admin {
public static function display_spam_check_warning() {
Akismet::fix_scheduled_recheck();
if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::get_number_spam_waiting() > 0 ) {
if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::are_any_comments_waiting_to_be_checked() ) {
$link_text = apply_filters( 'akismet_spam_check_warning_link_text', sprintf( __( 'Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url( self::get_page_url() ) ) );
Akismet::view( 'notice', array( 'type' => 'spam-check', 'link_text' => $link_text ) );
}
}
public static function display_invalid_version() {
Akismet::view( 'notice', array( 'type' => 'version' ) );
}
public static function display_api_key_warning() {
Akismet::view( 'notice', array( 'type' => 'plugin' ) );
}
@ -838,18 +875,26 @@ class Akismet_Admin {
if ( $_GET['action'] == 'save-key' ) {
if ( is_object( $akismet_user ) ) {
self::save_key( $akismet_user->api_key );
self::display_notice();
self::display_configuration_page();
return;
return;
}
}
}
echo '<h2 class="ak-header">'.esc_html__('Akismet', 'akismet').'</h2>';
self::display_status();
Akismet::view( 'start', compact( 'akismet_user' ) );
/*
// To see all variants when testing.
$akismet_user->status = 'no-sub';
Akismet::view( 'start', compact( 'akismet_user' ) );
$akismet_user->status = 'cancelled';
Akismet::view( 'start', compact( 'akismet_user' ) );
$akismet_user->status = 'suspended';
Akismet::view( 'start', compact( 'akismet_user' ) );
$akismet_user->status = 'other';
Akismet::view( 'start', compact( 'akismet_user' ) );
$akismet_user = false;
*/
}
public static function display_stats_page() {
@ -869,12 +914,20 @@ class Akismet_Admin {
$stat_totals = self::get_stats( $api_key );
// If unset, create the new strictness option using the old discard option to determine its default
if ( get_option( 'akismet_strictness' ) === false )
add_option( 'akismet_strictness', (get_option('akismet_discard_month') === 'true' ? '1' : '0') );
// If unset, create the new strictness option using the old discard option to determine its default.
// If the old option wasn't set, default to discarding the blatant spam.
if ( get_option( 'akismet_strictness' ) === false ) {
add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) );
}
// Sync the local "Total spam blocked" count with the authoritative count from the server.
if ( isset( $stat_totals['all'], $stat_totals['all']->spam ) ) {
update_option( 'akismet_spam_count', $stat_totals['all']->spam );
}
$notices = array();
if ( empty( self::$notices ) ) {
//show status
if ( ! empty( $stat_totals['all'] ) && isset( $stat_totals['all']->time_saved ) && $akismet_user->status == 'active' && $akismet_user->account_type == 'free-api-key' ) {
$time_saved = false;
@ -892,26 +945,53 @@ class Akismet_Admin {
elseif ( $total_in_minutes >= 30 )
$time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %d minute!', 'Akismet has saved you %d minutes!', $total_in_minutes, 'akismet' ), $total_in_minutes );
}
Akismet::view( 'notice', array( 'type' => 'active-notice', 'time_saved' => $time_saved ) );
$notices[] = array( 'type' => 'active-notice', 'time_saved' => $time_saved );
}
if ( !empty( $akismet_user->limit_reached ) && in_array( $akismet_user->limit_reached, array( 'yellow', 'red' ) ) ) {
Akismet::view( 'notice', array( 'type' => 'limit-reached', 'level' => $akismet_user->limit_reached ) );
$notices[] = array( 'type' => 'limit-reached', 'level' => $akismet_user->limit_reached );
}
}
if ( !isset( self::$notices['status'] ) && in_array( $akismet_user->status, array( 'cancelled', 'suspended', 'missing', 'no-sub' ) ) )
Akismet::view( 'notice', array( 'type' => $akismet_user->status ) );
if ( !isset( self::$notices['status'] ) && in_array( $akismet_user->status, array( 'cancelled', 'suspended', 'missing', 'no-sub' ) ) ) {
$notices[] = array( 'type' => $akismet_user->status );
}
/*
// To see all variants when testing.
$notices[] = array( 'type' => 'active-notice', 'time_saved' => 'Cleaning up spam takes time. Akismet has saved you 1 minute!' );
$notices[] = array( 'type' => 'plugin' );
$notices[] = array( 'type' => 'spam-check', 'link_text' => 'Link text.' );
$notices[] = array( 'type' => 'notice', 'notice_header' => 'This is the notice header.', 'notice_text' => 'This is the notice text.' );
$notices[] = array( 'type' => 'missing-functions' );
$notices[] = array( 'type' => 'servers-be-down' );
$notices[] = array( 'type' => 'active-dunning' );
$notices[] = array( 'type' => 'cancelled' );
$notices[] = array( 'type' => 'suspended' );
$notices[] = array( 'type' => 'missing' );
$notices[] = array( 'type' => 'no-sub' );
$notices[] = array( 'type' => 'new-key-valid' );
$notices[] = array( 'type' => 'new-key-invalid' );
$notices[] = array( 'type' => 'existing-key-invalid' );
$notices[] = array( 'type' => 'new-key-failed' );
$notices[] = array( 'type' => 'limit-reached', 'level' => 'yellow' );
$notices[] = array( 'type' => 'limit-reached', 'level' => 'red' );
*/
Akismet::log( compact( 'stat_totals', 'akismet_user' ) );
Akismet::view( 'config', compact( 'api_key', 'akismet_user', 'stat_totals' ) );
Akismet::view( 'config', compact( 'api_key', 'akismet_user', 'stat_totals', 'notices' ) );
}
public static function display_notice() {
global $hook_suffix;
if ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config', 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) {
if ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config' ) ) ) {
// This page manages the notices and puts them inline where they make sense.
return;
}
if ( in_array( $hook_suffix, array( 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) {
Akismet::verify_key( Akismet::get_api_key() ); //verify that the key is still in alert state
if ( get_option( 'akismet_alert_code' ) > 0 )
@ -923,38 +1003,59 @@ class Akismet_Admin {
elseif ( $hook_suffix == 'edit-comments.php' && wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) {
self::display_spam_check_warning();
}
elseif ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config' ) ) && Akismet::get_api_key() ) {
self::display_status();
else if ( isset( $_GET['akismet_recheck_complete'] ) ) {
$recheck_count = (int) $_GET['recheck_count'];
$spam_count = (int) $_GET['spam_count'];
if ( $recheck_count === 0 ) {
$message = __( 'There were no comments to check. Akismet will only check comments in the Pending queue.', 'akismet' );
}
else {
$message = sprintf( _n( 'Akismet checked %s comment.', 'Akismet checked %s comments.', $recheck_count, 'akismet' ), number_format( $recheck_count ) );
$message .= ' ';
if ( $spam_count === 0 ) {
$message .= __( 'No comments were caught as spam.' );
}
else {
$message .= sprintf( _n( '%s comment was caught as spam.', '%s comments were caught as spam.', $spam_count, 'akismet' ), number_format( $spam_count ) );
}
}
echo '<div class="notice notice-success"><p>' . esc_html( $message ) . '</p></div>';
}
}
public static function display_status() {
$type = '';
if ( !self::get_server_connectivity() )
$type = 'servers-be-down';
if ( !empty( $type ) )
Akismet::view( 'notice', compact( 'type' ) );
elseif ( !empty( self::$notices ) ) {
foreach ( self::$notices as $type ) {
if ( ! self::get_server_connectivity() ) {
Akismet::view( 'notice', array( 'type' => 'servers-be-down' ) );
}
else if ( ! empty( self::$notices ) ) {
foreach ( self::$notices as $index => $type ) {
if ( is_object( $type ) ) {
$notice_header = $notice_text = '';
if ( property_exists( $type, 'notice_header' ) )
if ( property_exists( $type, 'notice_header' ) ) {
$notice_header = wp_kses( $type->notice_header, self::$allowed );
}
if ( property_exists( $type, 'notice_text' ) )
if ( property_exists( $type, 'notice_text' ) ) {
$notice_text = wp_kses( $type->notice_text, self::$allowed );
}
if ( property_exists( $type, 'status' ) ) {
$type = wp_kses( $type->status, self::$allowed );
Akismet::view( 'notice', compact( 'type', 'notice_header', 'notice_text' ) );
unset( self::$notices[ $index ] );
}
}
else
else {
Akismet::view( 'notice', compact( 'type' ) );
}
unset( self::$notices[ $index ] );
}
}
}
}
@ -974,8 +1075,22 @@ class Akismet_Admin {
if ( !$xml->isError() ) {
$responses = $xml->getResponse();
if ( count( $responses ) > 1 ) {
$api_key = array_shift( $responses[0] );
$user_id = (int) array_shift( $responses[1] );
// Due to a quirk in how Jetpack does multi-calls, the response order
// can't be trusted to match the call order. It's a good thing our
// return values can be mostly differentiated from each other.
$first_response_value = array_shift( $responses[0] );
$second_response_value = array_shift( $responses[1] );
// If WPCOM ever reaches 100 billion users, this will fail. :-)
if ( preg_match( '/^[a-f0-9]{12}$/i', $first_response_value ) ) {
$api_key = $first_response_value;
$user_id = (int) $second_response_value;
}
else {
$api_key = $second_response_value;
$user_id = (int) $first_response_value;
}
return compact( 'api_key', 'user_id' );
}
}
@ -997,4 +1112,20 @@ class Akismet_Admin {
return $exclude;
}
}
/**
* When Akismet is active, remove the "Activate Akismet" step from the plugin description.
*/
public static function modify_plugin_description( $all_plugins ) {
if ( isset( $all_plugins['akismet/akismet.php'] ) ) {
if ( Akismet::get_api_key() ) {
$all_plugins['akismet/akismet.php']['Description'] = __( 'Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. Your site is fully configured and being protected, even while you sleep.', 'akismet' );
}
else {
$all_plugins['akismet/akismet.php']['Description'] = __( 'Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started, just go to <a href="admin.php?page=akismet-key-config">your Akismet Settings page</a> to set up your API key.', 'akismet' );
}
}
return $all_plugins;
}
}

@ -0,0 +1,271 @@
<?php
class Akismet_REST_API {
/**
* Register the REST API routes.
*/
public static function init() {
if ( ! function_exists( 'register_rest_route' ) ) {
// The REST API wasn't integrated into core until 4.4, and we support 4.0+ (for now).
return false;
}
register_rest_route( 'akismet/v1', '/key', array(
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_key' ),
), array(
'methods' => WP_REST_Server::EDITABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'set_key' ),
'args' => array(
'key' => array(
'required' => true,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ),
),
),
), array(
'methods' => WP_REST_Server::DELETABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'delete_key' ),
)
) );
register_rest_route( 'akismet/v1', '/settings/', array(
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_settings' ),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'set_boolean_settings' ),
'args' => array(
'akismet_strictness' => array(
'required' => false,
'type' => 'boolean',
'description' => __( 'If true, Akismet will automatically discard the worst spam automatically rather than putting it in the spam folder.', 'akismet' ),
),
'akismet_show_user_comments_approved' => array(
'required' => false,
'type' => 'boolean',
'description' => __( 'If true, show the number of approved comments beside each comment author in the comments list page.', 'akismet' ),
),
),
)
) );
register_rest_route( 'akismet/v1', '/stats', array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
'args' => array(
'interval' => array(
'required' => false,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_interval' ),
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
'default' => 'all',
),
),
) );
register_rest_route( 'akismet/v1', '/stats/(?P<interval>[\w+])', array(
'args' => array(
'interval' => array(
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
'type' => 'string',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
)
) );
}
/**
* Get the current Akismet API key.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_key( $request = null ) {
return rest_ensure_response( Akismet::get_api_key() );
}
/**
* Set the API key, if possible.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function set_key( $request ) {
if ( defined( 'WPCOM_API_KEY' ) ) {
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be changed via the API.', 'akismet' ), array( 'status'=> 409 ) ) );
}
$new_api_key = $request->get_param( 'key' );
if ( ! self::key_is_valid( $new_api_key ) ) {
return rest_ensure_response( new WP_Error( 'invalid_key', __( 'The value provided is not a valid and registered API key.', 'akismet' ), array( 'status' => 400 ) ) );
}
update_option( 'wordpress_api_key', $new_api_key );
return self::get_key();
}
/**
* Unset the API key, if possible.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function delete_key( $request ) {
if ( defined( 'WPCOM_API_KEY' ) ) {
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be deleted.', 'akismet' ), array( 'status'=> 409 ) ) );
}
delete_option( 'wordpress_api_key' );
return rest_ensure_response( true );
}
/**
* Get the Akismet settings.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_settings( $request = null ) {
return rest_ensure_response( array(
'akismet_strictness' => ( get_option( 'akismet_strictness', '1' ) === '1' ),
'akismet_show_user_comments_approved' => ( get_option( 'akismet_show_user_comments_approved', '1' ) === '1' ),
) );
}
/**
* Update the Akismet settings.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function set_boolean_settings( $request ) {
foreach ( array(
'akismet_strictness',
'akismet_show_user_comments_approved',
) as $setting_key ) {
$setting_value = $request->get_param( $setting_key );
if ( is_null( $setting_value ) ) {
// This setting was not specified.
continue;
}
// From 4.7+, WP core will ensure that these are always boolean
// values because they are registered with 'type' => 'boolean',
// but we need to do this ourselves for prior versions.
$setting_value = Akismet_REST_API::parse_boolean( $setting_value );
update_option( $setting_key, $setting_value ? '1' : '0' );
}
return self::get_settings();
}
/**
* Parse a numeric or string boolean value into a boolean.
*
* @param mixed $value The value to convert into a boolean.
* @return bool The converted value.
*/
public static function parse_boolean( $value ) {
switch ( $value ) {
case true:
case 'true':
case '1':
case 1:
return true;
case false:
case 'false':
case '0':
case 0:
return false;
default:
return (bool) $value;
}
}
/**
* Get the Akismet stats for a given time period.
*
* Possible `interval` values:
* - all
* - 60-days
* - 6-months
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_stats( $request ) {
$api_key = Akismet::get_api_key();
$interval = $request->get_param( 'interval' );
$stat_totals = array();
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
if ( ! empty( $response[1] ) ) {
$stat_totals[$interval] = json_decode( $response[1] );
}
return rest_ensure_response( $stat_totals );
}
private static function key_is_valid( $key ) {
$response = Akismet::http_post(
Akismet::build_query(
array(
'key' => $key,
'blog' => get_option( 'home' )
)
),
'verify-key'
);
if ( $response[1] == 'valid' ) {
return true;
}
return false;
}
public static function privileged_permission_callback() {
return current_user_can( 'manage_options' );
}
public static function sanitize_interval( $interval, $request, $param ) {
$interval = trim( $interval );
$valid_intervals = array( '60-days', '6-months', 'all', );
if ( ! in_array( $interval, $valid_intervals ) ) {
$interval = 'all';
}
return $interval;
}
public static function sanitize_key( $key, $request, $param ) {
return trim( $key );
}
}

@ -62,7 +62,7 @@ class Akismet_Widget extends WP_Widget {
}
function form( $instance ) {
if ( $instance ) {
if ( $instance && isset( $instance['title'] ) ) {
$title = $instance['title'];
}
else {

@ -10,7 +10,8 @@ class Akismet {
private static $prevent_moderation_email_for_these_comments = array();
private static $last_comment_result = null;
private static $comment_as_submitted_allowed_keys = array( 'blog' => '', 'blog_charset' => '', 'blog_lang' => '', 'blog_ua' => '', 'comment_agent' => '', 'comment_author' => '', 'comment_author_IP' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => '', 'comment_date_gmt' => '', 'comment_tags' => '', 'comment_type' => '', 'guid' => '', 'is_test' => '', 'permalink' => '', 'reporter' => '', 'site_domain' => '', 'submit_referer' => '', 'submit_uri' => '', 'user_ID' => '', 'user_agent' => '', 'user_id' => '', 'user_ip' => '' );
private static $is_rest_api_call = false;
public static function init() {
if ( ! self::$initiated ) {
self::init_hooks();
@ -25,26 +26,18 @@ class Akismet {
add_action( 'wp_insert_comment', array( 'Akismet', 'auto_check_update_meta' ), 10, 2 );
add_filter( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 );
add_filter( 'rest_pre_insert_comment', array( 'Akismet', 'rest_auto_check_comment' ), 1 );
add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments' ) );
add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments_meta' ) );
add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) );
/**
* To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag
* and return any string value that is not 'true' or '' (empty string).
*
* Don't return boolean false, because that implies that the 'akismet_comment_nonce' option
* has not been set and that Akismet should just choose the default behavior for that
* situation.
*/
$akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' )
add_action( 'comment_form', array( 'Akismet', 'add_comment_nonce' ), 1 );
add_action( 'comment_form', array( 'Akismet', 'add_comment_nonce' ), 1 );
add_action( 'admin_head-edit-comments.php', array( 'Akismet', 'load_form_js' ) );
add_action( 'comment_form', array( 'Akismet', 'load_form_js' ) );
add_action( 'comment_form', array( 'Akismet', 'inject_ak_js' ) );
add_filter( 'script_loader_tag', array( 'Akismet', 'set_form_js_async' ), 10, 3 );
add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 );
add_filter( 'pre_comment_approved', array( 'Akismet', 'last_comment_status' ), 10, 2 );
@ -115,6 +108,12 @@ class Akismet {
self::verify_key( $value );
}
}
public static function rest_auto_check_comment( $commentdata ) {
self::$is_rest_api_call = true;
return self::auto_check_comment( $commentdata );
}
public static function auto_check_comment( $commentdata ) {
self::$last_comment_result = null;
@ -129,8 +128,9 @@ class Akismet {
$comment['blog_charset'] = get_option('blog_charset');
$comment['permalink'] = get_permalink( $comment['comment_post_ID'] );
if ( !empty( $comment['user_ID'] ) )
if ( ! empty( $comment['user_ID'] ) ) {
$comment['user_role'] = Akismet::get_user_roles( $comment['user_ID'] );
}
/** See filter documentation in init_hooks(). */
$akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
@ -170,7 +170,11 @@ class Akismet {
}
$post = get_post( $comment['comment_post_ID'] );
$comment[ 'comment_post_modified_gmt' ] = $post->post_modified_gmt;
if ( ! is_null( $post ) ) {
// $post can technically be null, although in the past, it's always been an indicator of another plugin interfering.
$comment[ 'comment_post_modified_gmt' ] = $post->post_modified_gmt;
}
$response = self::http_post( Akismet::build_query( $comment ), 'comment-check' );
@ -196,12 +200,25 @@ class Akismet {
do_action( 'akismet_spam_caught', $discard );
if ( $discard ) {
// The spam is obvious, so we're bailing out early.
// akismet_result_spam() won't be called so bump the counter here
if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
$redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : get_permalink( $post );
wp_safe_redirect( esc_url_raw( $redirect_to ) );
die();
if ( $incr = apply_filters( 'akismet_spam_count_incr', 1 ) ) {
update_option( 'akismet_spam_count', get_option( 'akismet_spam_count' ) + $incr );
}
if ( self::$is_rest_api_call ) {
return new WP_Error( 'akismet_rest_comment_discarded', __( 'Comment discarded.', 'akismet' ) );
}
else {
// Redirect back to the previous page, or failing that, the post permalink, or failing that, the homepage of the blog.
$redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ( $post ? get_permalink( $post ) : home_url() );
wp_safe_redirect( esc_url_raw( $redirect_to ) );
die();
}
}
else if ( self::$is_rest_api_call ) {
// The way the REST API structures its calls, we can set the comment_approved value right away.
$commentdata['comment_approved'] = 'spam';
}
}
@ -211,26 +228,20 @@ class Akismet {
// Comment status should be moderated
self::$last_comment_result = '0';
}
if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) {
if ( !wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) {
wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] );
}
if ( ! wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) {
wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] );
}
self::$prevent_moderation_email_for_these_comments[] = $commentdata;
}
if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_event') ) {
// WP 2.1+: delete old comments daily
if ( !wp_next_scheduled( 'akismet_scheduled_delete' ) )
wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' );
// Delete old comments daily
if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) {
wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' );
}
elseif ( (mt_rand(1, 10) == 3) ) {
// WP 2.0: run this one time in ten
self::delete_old_comments();
}
self::set_last_comment( $commentdata );
self::fix_scheduled_recheck();
@ -260,14 +271,6 @@ class Akismet {
// this fires on wp_insert_comment. we can't update comment_meta when auto_check_comment() runs
// because we don't know the comment ID at that point.
public static function auto_check_update_meta( $id, $comment ) {
// failsafe for old WP versions
if ( !function_exists('add_comment_meta') )
return false;
if ( !isset( self::$last_comment['comment_author_email'] ) )
self::$last_comment['comment_author_email'] = '';
// wp_insert_comment() might be called in other contexts, so make sure this is the same comment
// as was checked by auto_check_comment
if ( is_object( $comment ) && !empty( self::$last_comment ) && is_array( self::$last_comment ) ) {
@ -354,6 +357,7 @@ class Akismet {
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) );
clean_comment_cache( $comment_ids );
do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
}
if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->comments ) ) // lucky number
@ -381,6 +385,8 @@ class Akismet {
foreach ( $comment_ids as $comment_id ) {
delete_comment_meta( $comment_id, 'akismet_as_submitted' );
}
do_action( 'akismet_delete_commentmeta_batch', count( $comment_ids ) );
}
if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->commentmeta ) ) // lucky number
@ -402,11 +408,6 @@ class Akismet {
// get the full comment history for a given comment, as an array in reverse chronological order
public static function get_comment_history( $comment_id ) {
// failsafe for old WP versions
if ( !function_exists('add_comment_meta') )
return false;
$history = get_comment_meta( $comment_id, 'akismet_history', false );
usort( $history, array( 'Akismet', '_cmp_time' ) );
return $history;
@ -423,10 +424,6 @@ class Akismet {
public static function update_comment_history( $comment_id, $message, $event=null, $meta=null ) {
global $current_user;
// failsafe for old WP versions
if ( !function_exists('add_comment_meta') )
return false;
$user = '';
$event = array(
@ -465,8 +462,9 @@ class Akismet {
$c['recheck_reason'] = $recheck_reason;
$c['user_role'] = '';
if ( isset( $c['user_ID'] ) )
$c['user_role'] = Akismet::get_user_roles($c['user_ID']);
if ( ! empty( $c['user_ID'] ) ) {
$c['user_role'] = Akismet::get_user_roles( $c['user_ID'] );
}
if ( self::is_test_mode() )
$c['is_test'] = 'true';
@ -536,24 +534,36 @@ class Akismet {
if ( get_comment_meta( $comment->comment_ID, 'akismet_rechecking' ) )
return;
global $current_user;
$reporter = '';
if ( is_object( $current_user ) )
$reporter = $current_user->user_login;
// Assumption alert:
// We want to submit comments to Akismet only when a moderator explicitly spams or approves it - not if the status
// is changed automatically by another plugin. Unfortunately WordPress doesn't provide an unambiguous way to
// determine why the transition_comment_status action was triggered. And there are several different ways by which
// to spam and unspam comments: bulk actions, ajax, links in moderation emails, the dashboard, and perhaps others.
// We'll assume that this is an explicit user action if certain POST/GET variables exist.
if ( ( isset( $_POST['status'] ) && in_array( $_POST['status'], array( 'spam', 'unspam' ) ) ) ||
( isset( $_POST['spam'] ) && (int) $_POST['spam'] == 1 ) ||
( isset( $_POST['unspam'] ) && (int) $_POST['unspam'] == 1 ) ||
( isset( $_POST['comment_status'] ) && in_array( $_POST['comment_status'], array( 'spam', 'unspam' ) ) ) ||
( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'spam', 'unspam', 'spamcomment', 'unspamcomment', ) ) ) ||
( isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'editedcomment' ) ) ) ||
( isset( $_GET['for'] ) && ( 'jetpack' == $_GET['for'] ) ) // Moderation via WP.com notifications/WP app/etc.
if (
// status=spam: Marking as spam via the REST API or...
// status=unspam: I'm not sure. Maybe this used to be used instead of status=approved? Or the UI for removing from spam but not approving has been since removed?...
// status=approved: Unspamming via the REST API (Calypso) or...
( isset( $_POST['status'] ) && in_array( $_POST['status'], array( 'spam', 'unspam', 'approved', ) ) )
// spam=1: Clicking "Spam" underneath a comment in wp-admin and allowing the AJAX request to happen.
|| ( isset( $_POST['spam'] ) && (int) $_POST['spam'] == 1 )
// unspam=1: Clicking "Not Spam" underneath a comment in wp-admin and allowing the AJAX request to happen. Or, clicking "Undo" after marking something as spam.
|| ( isset( $_POST['unspam'] ) && (int) $_POST['unspam'] == 1 )
// comment_status=spam/unspam: It's unclear where this is happening.
|| ( isset( $_POST['comment_status'] ) && in_array( $_POST['comment_status'], array( 'spam', 'unspam' ) ) )
// action=spam: Choosing "Mark as Spam" from the Bulk Actions dropdown in wp-admin (or the "Spam it" link in notification emails).
// action=unspam: Choosing "Not Spam" from the Bulk Actions dropdown in wp-admin.
// action=spamcomment: Following the "Spam" link below a comment in wp-admin (not allowing AJAX request to happen).
// action=unspamcomment: Following the "Not Spam" link below a comment in wp-admin (not allowing AJAX request to happen).
|| ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'spam', 'unspam', 'spamcomment', 'unspamcomment', ) ) )
// action=editedcomment: Editing a comment via wp-admin (and possibly changing its status).
|| ( isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'editedcomment' ) ) )
// for=jetpack: Moderation via the WordPress app, Calypso, anything powered by the Jetpack connection.
|| ( isset( $_GET['for'] ) && ( 'jetpack' == $_GET['for'] ) && ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) )
// Certain WordPress.com API requests
|| ( defined( 'REST_API_REQUEST' ) && REST_API_REQUEST )
// WordPress.org REST API requests
|| ( defined( 'REST_REQUEST' ) && REST_REQUEST )
) {
if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) {
return self::submit_spam_comment( $comment->comment_ID );
@ -596,14 +606,18 @@ class Akismet {
$comment->site_domain = $current_site->domain;
$comment->user_role = '';
if ( isset( $comment->user_ID ) )
if ( ! empty( $comment->user_ID ) ) {
$comment->user_role = Akismet::get_user_roles( $comment->user_ID );
}
if ( self::is_test_mode() )
$comment->is_test = 'true';
$post = get_post( $comment->comment_post_ID );
$comment->comment_post_modified_gmt = $post->post_modified_gmt;
if ( ! is_null( $post ) ) {
$comment->comment_post_modified_gmt = $post->post_modified_gmt;
}
$response = Akismet::http_post( Akismet::build_query( $comment ), 'submit-spam' );
if ( $comment->reporter ) {
@ -642,14 +656,18 @@ class Akismet {
if ( is_object($current_site) )
$comment->site_domain = $current_site->domain;
if ( isset( $comment->user_ID ) )
$comment->user_role = Akismet::get_user_roles($comment->user_ID);
if ( ! empty( $comment->user_ID ) ) {
$comment->user_role = Akismet::get_user_roles( $comment->user_ID );
}
if ( Akismet::is_test_mode() )
$comment->is_test = 'true';
$post = get_post( $comment->comment_post_ID );
$comment->comment_post_modified_gmt = $post->post_modified_gmt;
if ( ! is_null( $post ) ) {
$comment->comment_post_modified_gmt = $post->post_modified_gmt;
}
$response = self::http_post( Akismet::build_query( $comment ), 'submit-ham' );
if ( $comment->reporter ) {
@ -683,7 +701,13 @@ class Akismet {
foreach ( (array) $comment_errors as $comment_id ) {
// if the comment no longer exists, or is too old, remove the meta entry from the queue to avoid getting stuck
$comment = get_comment( $comment_id );
if ( !$comment || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) ) {
if (
! $comment // Comment has been deleted
|| strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) // Comment is too old.
|| $comment->comment_approved !== "0" // Comment is no longer in the Pending queue
) {
echo "Deleting";
delete_comment_meta( $comment_id, 'akismet_error' );
delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' );
continue;
@ -764,9 +788,21 @@ class Akismet {
}
public static function add_comment_nonce( $post_id ) {
echo '<p style="display: none;">';
wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE );
echo '</p>';
/**
* To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag
* and return any string value that is not 'true' or '' (empty string).
*
* Don't return boolean false, because that implies that the 'akismet_comment_nonce' option
* has not been set and that Akismet should just choose the default behavior for that
* situation.
*/
$akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) {
echo '<p style="display: none;">';
wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE );
echo '</p>';
}
}
public static function is_test_mode() {
@ -796,7 +832,25 @@ class Akismet {
private static function comments_match( $comment1, $comment2 ) {
$comment1 = (array) $comment1;
$comment2 = (array) $comment2;
// Set default values for these strings that we check in order to simplify
// the checks and avoid PHP warnings.
if ( ! isset( $comment1['comment_author'] ) ) {
$comment1['comment_author'] = '';
}
if ( ! isset( $comment2['comment_author'] ) ) {
$comment2['comment_author'] = '';
}
if ( ! isset( $comment1['comment_author_email'] ) ) {
$comment1['comment_author_email'] = '';
}
if ( ! isset( $comment2['comment_author_email'] ) ) {
$comment2['comment_author_email'] = '';
}
$comments_match = (
isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] )
&& intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] )
@ -830,9 +884,6 @@ class Akismet {
// Does the supplied comment match the details of the one most recently stored in self::$last_comment?
public static function matches_last_comment( $comment ) {
if ( is_object( $comment ) )
$comment = (array) $comment;
return self::comments_match( self::$last_comment, $comment );
}
@ -882,6 +933,15 @@ class Akismet {
return $approved;
}
if ( 'trash' === $approved ) {
// If the last comment we checked has had its approval set to 'trash',
// then it failed the comment blacklist check. Let that blacklist override
// the spam check, since users have the (valid) expectation that when
// they fill out their blacklists, comments that match it will always
// end up in the trash.
return $approved;
}
// bump the counter here instead of when the filter is added to reduce the possibility of overcounting
if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
@ -983,7 +1043,7 @@ class Akismet {
do_action( 'akismet_ssl_disabled' );
}
if ( ! $ssl_disabled && function_exists( 'wp_http_supports') && ( $ssl = wp_http_supports( array( 'ssl' ) ) ) ) {
if ( ! $ssl_disabled && ( $ssl = wp_http_supports( array( 'ssl' ) ) ) ) {
$akismet_url = set_url_scheme( $akismet_url, 'https' );
do_action( 'akismet_https_request_pre' );
@ -1038,7 +1098,7 @@ class Akismet {
}
// given a response from an API call like check_key_status(), update the alert code options if an alert is present.
private static function update_alert( $response ) {
public static function update_alert( $response ) {
$code = $msg = null;
if ( isset( $response[0]['x-akismet-alert-code'] ) ) {
$code = $response[0]['x-akismet-alert-code'];
@ -1059,17 +1119,23 @@ class Akismet {
}
public static function load_form_js() {
// WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer.
// Once we drop support for everything pre-3.3, this can change back to a single enqueue call.
wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true );
add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) );
add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) );
wp_enqueue_script( 'akismet-form' );
}
public static function print_form_js() {
wp_print_scripts( 'akismet-form' );
/**
* Mark form.js as async. Because nothing depends on it, it can run at any time
* after it's loaded, and the browser won't have to wait for it to load to continue
* parsing the rest of the page.
*/
public static function set_form_js_async( $tag, $handle, $src ) {
if ( 'akismet-form' !== $handle ) {
return $tag;
}
return preg_replace( '/^<script /i', '<script async="async" ', $tag );
}
public static function inject_ak_js( $fields ) {
echo '<p style="display: none;">';
echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>';
@ -1150,7 +1216,21 @@ p {
* @static
*/
public static function plugin_deactivation( ) {
return self::deactivate_key( self::get_api_key() );
self::deactivate_key( self::get_api_key() );
// Remove any scheduled cron jobs.
$akismet_cron_events = array(
'akismet_schedule_cron_recheck',
'akismet_scheduled_delete',
);
foreach ( $akismet_cron_events as $akismet_cron_event ) {
$timestamp = wp_next_scheduled( $akismet_cron_event );
if ( $timestamp ) {
wp_unschedule_event( $timestamp, $akismet_cron_event );
}
}
}
/**
@ -1173,7 +1253,7 @@ p {
* @param mixed $akismet_debug The data to log.
*/
public static function log( $akismet_debug ) {
if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) {
if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG && defined( 'AKISMET_DEBUG' ) && AKISMET_DEBUG ) ) {
error_log( print_r( compact( 'akismet_debug' ), true ) );
}
}
@ -1260,4 +1340,12 @@ p {
return $meta_value;
}
public static function predefined_api_key() {
if ( defined( 'WPCOM_API_KEY' ) ) {
return true;
}
return apply_filters( 'akismet_predefined_api_key', false );
}
}

@ -1,16 +1,16 @@
=== Akismet ===
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
=== Akismet Anti-Spam ===
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 3.7
Tested up to: 4.6.1
Stable tag: 3.2
Requires at least: 4.0
Tested up to: 4.9.1
Stable tag: 4.0.2
License: GPLv2 or later
Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
== Description ==
Akismet checks your comments against the Akismet Web service to see if they look like spam or not and lets you review the spam it catches under your blog's "Comments" admin screen.
Akismet checks your comments and contact form submissions against our global database of spam to prevent your site from publishing malicious content. You can review the comment spam it catches on your blog's "Comments" admin screen.
Major features in Akismet include:
@ -30,6 +30,66 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
= 4.0.2 =
*Release Date - 18 December 2017*
* Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam.
* Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked.
= 4.0.1 =
*Release Date - 6 November 2017*
* Fixed a bug that could prevent some users from connecting Akismet via their Jetpack connection.
* Ensured that any pending Akismet-related events are unscheduled if the plugin is deactivated.
* Allow some JavaScript to be run asynchronously to avoid affecting page render speeds.
= 4.0 =
*Release Date - 19 September 2017*
* Added REST API endpoints for configuring Akismet and retrieving stats.
* Increased the minimum supported WordPress version to 4.0.
* Added compatibility with comments submitted via the REST API.
* Improved the progress indicator on the "Check for Spam" button.
= 3.3.4 =
*Release Date - 3 August 2017*
* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined.
* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin.
* When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well.
* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers.
= 3.3.3 =
*Release Date - 13 July 2017*
* Reduced amount of bandwidth used by the URL Preview feature.
* Improved the admin UI when the API key is manually pre-defined for the site.
* Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
* The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
* Fixed a bug in the Akismet widget that could cause PHP warnings.
= 3.3.2 =
*Release Date - 10 May 2017*
* Fixed a bug causing JavaScript errors in some browsers.
= 3.3.1 =
*Release Date - 2 May 2017*
* Improve performance by only requesting the akismet_comment_nonce option when absolutely necessary.
* Fixed two bugs that could cause PHP warnings.
* Fixed a bug that was preventing the "Remove author URL" feature from working after a comment was edited using "Quick Edit."
* Fixed a bug that was preventing the URL preview feature from working after a comment was edited using "Quick Edit."
= 3.3 =
*Release Date - 23 February 2017*
* Updated the Akismet admin pages with a new clean design.
* Fixed bugs preventing the `akismet_add_comment_nonce` and `akismet_update_alert` wrapper functions from working properly.
* Fixed bug preventing the loading indicator from appearing when re-checking all comments for spam.
* Added a progress indicator to the "Check for Spam" button.
* Added a success message after manually rechecking the Pending queue for spam.
= 3.2 =
*Release Date - 6 September 2016*

@ -1,216 +1,231 @@
<div class="wrap">
<h2><?php esc_html_e( 'Akismet' , 'akismet');?></h2>
<div class="have-key">
<div id="akismet-plugin-container">
<div class="akismet-masthead">
<div class="akismet-masthead__inside-container">
<div class="akismet-masthead__logo-container">
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
</div>
</div>
<div class="akismet-lower">
<?php if ( Akismet::get_api_key() ) { ?>
<?php Akismet_Admin::display_status(); ?>
<?php } ?>
<?php if ( ! empty( $notices ) ) { ?>
<?php foreach ( $notices as $notice ) { ?>
<?php Akismet::view( 'notice', $notice ); ?>
<?php } ?>
<?php } ?>
<?php if ( $stat_totals && isset( $stat_totals['all'] ) && (int) $stat_totals['all']->spam > 0 ) : ?>
<div class="new-snapshot stats">
<span style="float:right;margin:10px 15px -5px 0px">
<a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>" class=""><?php esc_html_e( 'Summaries' , 'akismet');?></a>
</span>
<iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 215px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=180&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() );?>"></iframe>
<ul>
<li>
<h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3>
<span><?php echo number_format( $stat_totals['6-months']->spam );?></span>
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?>
</li>
<li>
<h3><?php esc_html_e( 'All time' , 'akismet');?></h3>
<span><?php echo number_format( $stat_totals['all']->spam );?></span>
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?>
</li>
<li>
<h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3>
<span><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
<?php printf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ); ?>
|
<?php printf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ); ?>
</li>
</ul>
<div class="clearfix"></div>
<div class="akismet-card">
<div class="akismet-section-header">
<div class="akismet-section-header__label">
<span><?php esc_html_e( 'Statistics' , 'akismet'); ?></span>
</div>
<div class="akismet-section-header__actions">
<a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
<?php esc_html_e( 'Detailed Stats' , 'akismet');?>
</a>
</div>
</div>
<div class="akismet-new-snapshot">
<iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=200&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() );?>"></iframe>
<ul>
<li>
<h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3>
<span><?php echo number_format( $stat_totals['6-months']->spam );?></span>
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?>
</li>
<li>
<h3><?php esc_html_e( 'All time' , 'akismet');?></h3>
<span><?php echo number_format( $stat_totals['all']->spam );?></span>
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?>
</li>
<li>
<h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3>
<span><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
<?php printf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ); ?>
|
<?php printf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ); ?>
</li>
</ul>
</div>
</div>
<?php endif;?>
<?php if ( $akismet_user ):?>
<div class="akismet-card">
<div class="akismet-section-header">
<div class="akismet-section-header__label">
<span><?php esc_html_e( 'Settings' , 'akismet'); ?></span>
</div>
</div>
<div id="wpcom-stats-meta-box-container" class="metabox-holder"><?php
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
if(typeof postboxes !== 'undefined')
postboxes.add_postbox_toggles( 'plugins_page_akismet-key-config' );
});
</script>
<div class="postbox-container" style="width: 55%;margin-right: 10px;">
<div id="normal-sortables" class="meta-box-sortables ui-sortable">
<div id="referrers" class="postbox ">
<div class="handlediv" title="Click to toggle"><br></div>
<h3 class="hndle"><span><?php esc_html_e( 'Settings' , 'akismet');?></span></h3>
<form name="akismet_conf" id="akismet-conf" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
<div class="inside">
<table cellspacing="0" class="akismet-settings">
<tbody>
<?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
<tr>
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
</td>
</tr>
<?php endif; ?>
<?php if ( isset( $_GET['ssl_status'] ) ) { ?>
<tr>
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
<td></td>
<td align="left">
<p>
<?php
<div class="inside">
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
<table cellspacing="0" class="akismet-settings">
<tbody>
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<tr>
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
</td>
</tr>
<?php } ?>
<?php if ( isset( $_GET['ssl_status'] ) ) { ?>
<tr>
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
<td></td>
<td align="left">
<p>
<?php
if ( ! function_exists( 'wp_http_supports' ) ) {
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php printf( esc_html( 'Your WordPress installation does not include the function %s; upgrade to the latest version of WordPress.', 'akismet' ), '<code>wp_http_supports</code>' ); ?><?php
}
else if ( ! wp_http_supports( array( 'ssl' ) ) ) {
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?><?php
}
else {
$ssl_disabled = get_option( 'akismet_ssl_disabled' );
if ( ! wp_http_supports( array( 'ssl' ) ) ) {
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?><?php
}
else {
$ssl_disabled = get_option( 'akismet_ssl_disabled' );
if ( $ssl_disabled ) {
?><b><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?><?php
}
else {
?><b><?php esc_html_e( 'Enabled.', 'akismet' ); ?></b> <?php esc_html_e( 'All systems functional.', 'akismet' ); ?><?php
}
}
if ( $ssl_disabled ) {
?><b><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?><?php
}
else {
?><b><?php esc_html_e( 'Enabled.', 'akismet' ); ?></b> <?php esc_html_e( 'All systems functional.', 'akismet' ); ?><?php
}
}
?>
</p>
</td>
</tr>
<?php } ?>
<tr>
<th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th>
<td></td>
<td align="left">
<p>
<label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="1" type="checkbox" <?php checked('1', get_option('akismet_show_user_comments_approved')); ?>> <?php esc_html_e('Show the number of approved comments beside each comment author', 'akismet'); ?></label>
</p>
</td>
</tr>
<tr>
<th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th>
<td></td>
<td align="left">
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
<p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p>
<p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
</fieldset>
<span class="note"><strong><?php esc_html_e('Note:', 'akismet');?></strong>
?>
</p>
</td>
</tr>
<?php } ?>
<tr>
<th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th>
<td></td>
<td align="left">
<p>
<label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>">
<input
name="akismet_show_user_comments_approved"
id="akismet_show_user_comments_approved"
value="1"
type="checkbox"
<?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
);
// If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
?>
</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>
/>
<?php esc_html_e( 'Show the number of approved comments beside each comment author', 'akismet' ); ?>
</label>
</p>
</td>
</tr>
<tr>
<th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th>
<td></td>
<td align="left">
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
<p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p>
<p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
</fieldset>
<span class="akismet-note"><strong><?php esc_html_e('Note:', 'akismet');?></strong>
<?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 class="akismet-card-actions">
<?php if ( ! Akismet::predefined_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="akismet-button akismet-is-primary" value="<?php esc_attr_e('Save Changes', 'akismet');?>">
</div>
<div class="clear"></div>
</div>
</div>
</form>
</div>
<div class="postbox-container" style="width:44%;">
<div id="normal-sortables" class="meta-box-sortables ui-sortable">
<div id="referrers" class="postbox ">
<div class="handlediv" title="Click to toggle"><br></div>
<h3 class="hndle"><span><?php esc_html_e( 'Account' , 'akismet');?></span></h3>
<div class="inside">
<table cellspacing="0">
<tbody>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span><?php echo esc_html( $akismet_user->account_name ); ?></span>
</td>
</tr>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span><?php
if ( 'cancelled' == $akismet_user->status ) :
esc_html_e( 'Cancelled', 'akismet' );
elseif ( 'suspended' == $akismet_user->status ) :
esc_html_e( 'Suspended', 'akismet' );
elseif ( 'missing' == $akismet_user->status ) :
esc_html_e( 'Missing', 'akismet' );
elseif ( 'no-sub' == $akismet_user->status ) :
esc_html_e( 'No Subscription Found', 'akismet' );
else :
esc_html_e( 'Active', 'akismet' );
endif; ?></span>
</td>
</tr>
<?php if ( $akismet_user->next_billing_date ) : ?>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></span>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div id="major-publishing-actions">
<div id="publishing-action">
<?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
</div>
<div class="clear"></div>
</div>
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<div class="akismet-card">
<div class="akismet-section-header">
<div class="akismet-section-header__label">
<span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
</div>
</div>
<div class="inside">
<table cellspacing="0" border="0" class="akismet-settings">
<tbody>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<p><?php echo esc_html( $akismet_user->account_name ); ?></p>
</td>
</tr>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<p><?php
if ( 'cancelled' == $akismet_user->status ) :
esc_html_e( 'Cancelled', 'akismet' );
elseif ( 'suspended' == $akismet_user->status ) :
esc_html_e( 'Suspended', 'akismet' );
elseif ( 'missing' == $akismet_user->status ) :
esc_html_e( 'Missing', 'akismet' );
elseif ( 'no-sub' == $akismet_user->status ) :
esc_html_e( 'No Subscription Found', 'akismet' );
else :
esc_html_e( 'Active', 'akismet' );
endif; ?></p>
</td>
</tr>
<?php if ( $akismet_user->next_billing_date ) : ?>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div class="akismet-card-actions">
<div id="publishing-action">
<?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?php } ?>
<?php endif;?>
</div>
</div>

@ -2,5 +2,5 @@
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<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 ); ?>"/>
<input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'akismet-button akismet-is-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
</form>

@ -5,23 +5,21 @@
<div class="aa_a">A</div>
<div class="aa_button_container">
<div class="aa_button_border">
<input type="submit" class="aa_button" value="<?php esc_attr_e( 'Activate your Akismet account', 'akismet' ); ?>" />
<input type="submit" class="aa_button" value="<?php esc_attr_e( 'Set up your Akismet account', 'akismet' ); ?>" />
</div>
</div>
<div class="aa_description"><?php _e('<strong>Almost done</strong> - activate Akismet and say goodbye to spam', 'akismet');?></div>
<div class="aa_description"><?php _e('<strong>Almost done</strong> - configure Akismet and say goodbye to spam', 'akismet');?></div>
</div>
</form>
</div>
<?php elseif ( $type == 'spam-check' ) :?>
<div id="akismet-warning" class="updated fade">
<div class="notice notice-warning">
<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>
<?php if ( $link_text ) { ?>
<p><?php echo $link_text; ?></p>
<?php } ?>
</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' ) :?>
<div class='error'>
<p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
@ -35,88 +33,102 @@
</p>
</div>
<?php elseif ( $type == 'notice' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php echo $notice_header; ?></h3>
<p class="description">
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php echo $notice_header; ?></h3>
<p class="akismet-description">
<?php echo $notice_text; ?>
</p>
</div>
<?php elseif ( $type == 'missing-functions' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
<p class="description"><?php printf( __('Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'servers-be-down' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e("Akismet can&#8217;t connect to your site.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Your firewall may be blocking Akismet. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e("Your site can&#8217;t connect to the Akismet servers.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'active-dunning' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e("Please update your payment information.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e("Please update your payment information.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
</div>
<?php elseif ( $type == 'cancelled' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e("Your Akismet plan has been cancelled.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e("Your Akismet plan has been cancelled.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
</div>
<?php elseif ( $type == 'suspended' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e("Your Akismet subscription is suspended.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e("Your Akismet subscription is suspended.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
</div>
<?php elseif ( $type == 'active-notice' && $time_saved ) :?>
<div class="wrap alert active">
<h3 class="key-status"><?php echo esc_html( $time_saved ); ?></h3>
<p class="description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
<div class="akismet-alert akismet-active">
<h3 class="akismet-key-status"><?php echo esc_html( $time_saved ); ?></h3>
<p class="akismet-description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
</div>
<?php elseif ( $type == 'missing' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e( 'There is a problem with your API key.', 'akismet'); ?></h3>
<p class="description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e( 'There is a problem with your API key.', 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
</div>
<?php elseif ( $type == 'no-sub' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e( 'You don&#8217;t have an Akismet plan.', 'akismet'); ?></h3>
<p class="description">
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You don&#8217;t have an Akismet plan.', 'akismet'); ?></h3>
<p class="akismet-description">
<?php printf( __( 'In 2012, Akismet began using subscription plans for all accounts (even free ones). A plan has not been assigned to your account, and we&#8217;d appreciate it if you&#8217;d <a href="%s" target="_blank">sign into your account</a> and choose one.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/' ); ?>
</p>
</div>
<?php elseif ( $type == 'new-key-valid' ) :?>
<div class="wrap alert active">
<h3 class="key-status"><?php esc_html_e('Akismet is now activated. Happy blogging!', 'akismet'); ?></h3>
<?php elseif ( $type == 'new-key-valid' ) :
global $wpdb;
$check_pending_link = false;
$at_least_one_comment_in_moderation = !! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
if ( $at_least_one_comment_in_moderation) {
$check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
}
?>
<div class="akismet-alert akismet-active">
<h3 class="akismet-key-status"><?php esc_html_e( 'Akismet is now protecting your site from spam. Happy blogging!', 'akismet' ); ?></h3>
<?php if ( $check_pending_link ) { ?>
<p class="akismet-description"><?php printf( __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ), esc_url( $check_pending_link ) ); ?></p>
<?php } ?>
</div>
<?php elseif ( $type == 'new-key-invalid' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'existing-key-invalid' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'Your API key is no longer valid. Please enter a new key or contact support@akismet.com.' , 'akismet'); ?></h3>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e( 'Your API key is no longer valid. Please enter a new key or contact support@akismet.com.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'new-key-failed' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
<p class="description"><?php printf( __('The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
<div class="wrap alert critical">
<div class="akismet-alert akismet-critical">
<?php if ( $level == 'yellow' ): ?>
<h3 class="key-status failed"><?php esc_html_e( 'You&#8217;re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
<p class="description">
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You&#8217;re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
<p class="akismet-description">
<?php printf( __( 'Your Pro subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'https://docs.akismet.com/billing/add-more-sites/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
</p>
<?php elseif ( $level == 'red' ): ?>
<h3 class="key-status failed"><?php esc_html_e( 'You&#8217;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.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?></p>
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You&#8217;re using Akismet on far too many sites for your Pro subscription.', 'akismet' ); ?></h3>
<p class="akismet-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.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?></p>
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
</p>
<?php endif; ?>
</div>

@ -1,97 +1,102 @@
<div class="no-key config-wrap"><?php
if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) :
if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) :?>
<p><?php esc_html_e('Akismet eliminates spam from your site. Register below to get started.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description">
<strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong>
<?php echo esc_html( $akismet_user->user_email ); ?>
<div id="akismet-plugin-container">
<div class="akismet-masthead">
<div class="akismet-masthead__inside-container">
<div class="akismet-masthead__logo-container">
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
</div>
</div>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
<input type="hidden" name="redirect" value="plugin-signup"/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Register for Akismet' , 'akismet'); ?>"/>
</form>
</div>
<?php elseif ( $akismet_user->status == 'cancelled' ) :?>
<p><?php esc_html_e('Akismet eliminates spam from your site.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description" style="width:75%;">
<strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong>
<?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled' , 'akismet'), $akismet_user->user_email ) ); ?>
<div class="akismet-lower">
<?php Akismet_Admin::display_status(); ?>
<div class="akismet-box">
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
<p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p>
</div>
<div class="akismet-boxes">
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?>
<?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?>
<div class="akismet-box">
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
<p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
<input type="hidden" name="redirect" value="plugin-signup"/>
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
</form>
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
<p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
</div>
<?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
<div class="akismet-box">
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
<input type="hidden" name="redirect" value="upgrade"/>
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
</form>
<p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
</div>
<?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
<div class="centered akismet-box">
<h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
<p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
<p><?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?></p>
<p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
</div>
<?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
<div class="akismet-box">
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
<p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
</form>
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
<p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
</div>
<?php } ?>
<div class="akismet-box">
<h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
<div class="akismet-right">
<?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
</div>
<p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
</div>
<?php } else { ?>
<div class="akismet-box">
<h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
<div class="akismet-right">
<?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
</div>
<p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
</div>
<?php } ?>
<div class="akismet-box">
<h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
<p><?php esc_html_e( 'Already have your key? Enter it here.', 'akismet' ); ?> <a href="https://docs.akismet.com/getting-started/api-key/" target="_blank"><?php esc_html_e( '(What is an API key?)', 'akismet' ); ?></a></p>
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="hidden" name="action" value="enter-key">
<p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
<input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
<input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
</p>
</form>
</div>
<?php } else { ?>
<div class="akismet-box">
<h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
<p><?php echo sprintf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' ); ?></p>
</div>
<?php } ?>
</div>
</div>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
<input type="hidden" name="redirect" value="upgrade"/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet'); ?>"/>
</form>
</div>
<?php elseif ( $akismet_user->status == 'suspended' ) : ?>
<p><?php esc_html_e('Akismet eliminates spam from your site.', 'akismet'); ?></p>
<div class="activate-highlight centered activate-option">
<strong class="small-heading"><?php esc_html_e( 'Connected via Jetpack' , 'akismet'); ?></strong>
<h3 class="alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended' , 'akismet'), $akismet_user->user_email ) ); ?></h3>
<p><?php esc_html_e('No worries! Get in touch and we&#8217;ll sort this out.', 'akismet'); ?></p>
<a href="https://akismet.com/contact" class="button button-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet'); ?></a>
</div>
<?php else : // ask do they want to use akismet account found using jetpack wpcom connection ?>
<p style="margin-right:10px"><?php esc_html_e('Akismet eliminates spam from your site. To set up Akismet, select one of the options below.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description">
<strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong>
<?php echo esc_html( $akismet_user->user_email ); ?>
</div>
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="right">
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Use this account' , 'akismet'); ?>"/>
</form>
</div>
<?php endif;?>
<div class="activate-highlight secondary activate-option">
<div class="option-description">
<strong><?php esc_html_e('Sign up for a plan with a different email address', 'akismet'); ?></strong>
<p><?php esc_html_e('Use this option to use Akismet independently of your Jetpack connection.', 'akismet'); ?></p>
</div>
<?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet'), 'classes' => array( 'right', 'button', 'button-secondary' ) ) ); ?>
</div>
<div class="activate-highlight secondary activate-option">
<div class="option-description">
<strong><?php esc_html_e('Enter an API key', 'akismet'); ?></strong>
<p><?php esc_html_e('Already have your key? Enter it here.', '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 else :?>
<p><?php esc_html_e('Akismet eliminates spam from your site. To set up 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 sign up now.', '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" value="<?php echo esc_attr( Akismet::get_api_key() ); ?>" 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;?>
</div>

@ -1,4 +1,11 @@
<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_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
<div id="akismet-plugin-container">
<div class="akismet-masthead">
<div class="akismet-masthead__inside-container">
<a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="akismet-right"><?php esc_html_e( 'Akismet Settings' , 'akismet' ); ?></a>
<div class="akismet-masthead__logo-container">
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
</div>
</div>
<iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0"></iframe>
</div>

@ -1,17 +0,0 @@
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e( 'Akismet anti-spam strictness', 'akismet' ); ?></span>
</legend>
<p>
<label for="akismet_strictness_1">
<input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked( '1', get_option( 'akismet_strictness' ) ); ?> />
<?php esc_html_e( 'Strict: silently discard the worst and most pervasive spam.', 'akismet' ); ?>
</label>
</p>
<p>
<label for="akismet_strictness_0">
<input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked( '0', get_option( 'akismet_strictness' ) ); ?> />
<?php esc_html_e( 'Safe: always put spam in the Spam folder for review.', 'akismet' ); ?>
</label>
</p>
</fieldset>

@ -175,7 +175,7 @@ function akismet_get_ip_address() {
function akismet_cron_recheck() {
return Akismet::cron_recheck();
}
function akismet_add_comment_nonce() {
function akismet_add_comment_nonce( $post_id ) {
return Akismet::add_comment_nonce( $post_id );
}
function akismet_fix_scheduled_recheck() {

@ -1,6 +1,7 @@
<?php
/**
* @package All-in-One-SEO-Pack
* @version 2.3.12.2
*/
if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
@ -502,11 +503,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$regex = '';
$cont = 0;
foreach ( $list as $l ) {
if ( $cont ) {
$regex .= '|';
$trim_l = trim ( $l );
if ( ! empty( $trim_l ) ) {
if ( $cont ) {
$regex .= '|';
}
$cont = 1;
$regex .= preg_quote( trim( $l ), $quote );
}
$cont = 1;
$regex .= preg_quote( trim( $l ), $quote );
}
return $regex;
@ -925,16 +929,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
/**
* Handles exporting settings data for a module.
*
* @since 2.4.13 Fixed bug on empty options.
*
* @param $buf
*
* @return string
*/
function settings_export( $buf ) {
global $aiosp;
$post_types = null;
$post_types = apply_filters( 'aioseop_export_settings_exporter_post_types', null );
$has_data = null;
$general_settings = null;
$exporter_choices = '';
$exporter_choices = apply_filters( 'aioseop_export_settings_exporter_choices', '' );
if ( ! empty( $_REQUEST['aiosp_importer_exporter_export_choices'] ) ) {
$exporter_choices = $_REQUEST['aiosp_importer_exporter_export_choices'];
}
@ -953,6 +959,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$buf .= $this->post_data_export( '_aioseop', array(
'posts_per_page' => - 1,
'post_type' => $post_types,
'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit' ),
) );
}
@ -1331,8 +1338,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
}
/**
* @param null $options
* @param null $p
* Returns available social seo images.
*
* @since 2.4 #1079 Fixes array_flip warning on opengraph module.
*
* @param array $options Plugin/module options.
* @param object $p Post.
*
* @return array
*/
@ -1379,10 +1390,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
}
if ( ! empty( $meta_key ) && ! empty( $post ) ) {
$meta_key = explode( ',', $meta_key );
$image = $this->get_the_image_by_meta_key( array(
'post_id' => $post->ID,
'meta_key' => $meta_key,
'meta_key' => explode( ',', $meta_key ),
) );
if ( ! empty( $image ) ) {
$img[] = array( 'type' => 'meta_key', 'id' => $meta_key, 'link' => $image );
@ -1539,6 +1549,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
}
/**
* @since 2.4.13 Fixes when content is taxonomy.
*
* @param null $p
*
* @return bool
@ -1551,6 +1563,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$post = $p;
}
if ( is_category() || is_tag() || is_tax() )
return false;
$post_thumbnail_id = null;
if ( function_exists( 'get_post_thumbnail_id' ) ) {
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
@ -1697,9 +1712,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
/**
* Load scripts and styles for metaboxes.
*
* edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
* Also, that check and others should be pulled out into their own functions
* Also, that check and others should be pulled out into their own functions.
*
* @since 2.4.14 Added term as screen base.
*/
function enqueue_metabox_scripts() {
$screen = '';
@ -1731,17 +1747,26 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
foreach ( $this->locations as $k => $v ) {
if ( $v['type'] === 'metabox' && isset( $v['display'] ) && ! empty( $v['display'] ) ) {
$enqueue_scripts = false;
$enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) ) || in_array( $screen->post_type, $v['display'] );
$enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) )
|| in_array( $screen->post_type, $v['display'] )
|| $screen->base == 'edit-category'
|| $screen->base == 'edit-post_tag'
|| $screen->base == 'term';
$enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
if ( $enqueue_scripts ) {
add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ), 20 );
add_action( 'admin_print_scripts', array( $this, 'enqueue_styles' ), 20 );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 20 );
}
}
}
}
function admin_enqueue_scripts(){
wp_enqueue_media(); // WP 3.5+ Media upload.
}
/**
* Load styles for module.
*/
@ -1750,14 +1775,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
if ( ! empty( $this->pointers ) ) {
wp_enqueue_style( 'wp-pointer' );
}
wp_enqueue_style( 'aioseop-module-style', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module.css' );
wp_enqueue_style( 'aioseop-module-style', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module.css', array(), AIOSEOP_VERSION );
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
wp_enqueue_style( 'aioseop-module-style-rtl', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module-rtl.css', array( 'aioseop-module-style' ) );
wp_enqueue_style( 'aioseop-module-style-rtl', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module-rtl.css', array( 'aioseop-module-style' ), AIOSEOP_VERSION );
}
}
/**
* Load scripts for module, can pass data to module script.
* @since 2.3.12.3 Add missing wp_enqueue_media.
*/
function enqueue_scripts() {
wp_enqueue_script( 'sack' );
@ -1770,6 +1796,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
if ( ! empty( $this->pointers ) ) {
wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
}
global $post;
if( !empty( $post->ID) ) {
wp_enqueue_media( array( 'post' => $post->ID ) );
}else{
wp_enqueue_media();
}
wp_enqueue_script( 'aioseop-module-script', AIOSEOP_PLUGIN_URL . 'js/modules/aioseop_module.js', array(), AIOSEOP_VERSION );
if ( ! empty( $this->script_data ) ) {
aioseop_localize_script_data();
@ -1987,12 +2019,26 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
foreach ( $v['display'] as $posttype ) {
$v['location'] = $k;
$v['posttype'] = $posttype;
if ( post_type_exists( $posttype ) ) {
// Metabox priority/context on edit post screen.
$v['context'] = apply_filters( 'aioseop_post_metabox_context', 'normal' );
$v['priority'] = apply_filters( 'aioseop_post_metabox_priority', 'high' );
}
if ( false !== strpos( $posttype, 'edit-' ) ) {
// Metabox priority/context on edit taxonomy screen.
$v['context'] = 'advanced';
$v['priority'] = 'default';
}
// Metabox priority for everything else.
if ( ! isset( $v['context'] ) ) {
$v['context'] = 'advanced';
}
if ( ! isset( $v['priority'] ) ) {
$v['priority'] = 'default';
}
if ( $this->tabbed_metaboxes ) {
$this->post_metaboxes[] = array(
'id' => $v['prefix'] . $k,
@ -2088,6 +2134,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$setsel = $strings['selected'];
if ( isset( $options['initial_options'] ) && is_array( $options['initial_options'] ) ) {
foreach ( $options['initial_options'] as $l => $option ) {
$option_check = strip_tags( is_array( $option ) ? implode( ' ', $option ) : $option );
if ( empty( $l ) && empty( $option_check ) )
continue;
$is_group = is_array( $option );
if ( ! $is_group ) {
$option = array( $l => $option );
@ -2188,7 +2237,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$buf .= "<textarea name='$name' $attr>$value</textarea>";
break;
case 'image':
$buf .= "<input class='aioseop_upload_image_button button-primary' type='button' value='Upload Image' style='float:left;' />" .
$buf .= '<input class="aioseop_upload_image_checker" type="hidden" name="' . $name . '_checker" value="0">' .
"<input class='aioseop_upload_image_button button-primary' type='button' value='";
$buf .= __( 'Upload Image', 'all-in-one-seo-pack' );
$buf .= "' style='float:left;' />" .
"<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
break;
case 'html':
@ -2206,6 +2258,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$size = $options['size'];
} elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) {
$size = $options['rows'] * $options['cols'];
}
if ( 'Description' === $options['name'] && isset( $options['name'] ) ) {
$size = ( $size - 90 ) . '-' . $size;
}
if ( isset( $options['count_desc'] ) ) {
$count_desc = $options['count_desc'];
@ -2518,8 +2573,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$this->settings_page_init();
?>
<div class="wrap <?php echo get_class( $this ); ?>">
<?php
ob_start();
do_action( $this->prefix . 'settings_header_errors', $location );
$errors = ob_get_clean();
echo $errors;
?>
<div id="aioseop_settings_header">
<?php if ( ! empty( $message ) ) {
<?php if ( ! empty( $message ) && empty( $errors ) ) {
echo "<div id=\"message\" class=\"updated fade\"><p>$message</p></div>";
} ?>
<div id="icon-aioseop" class="icon32"><br></div>
@ -2552,7 +2613,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
'Submit_Default' => array(
'type' => 'submit',
'class' => 'button-secondary',
'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack' ) . ' &raquo;',
'value' => sprintf( __( 'Reset %s Settings to Defaults', 'all-in-one-seo-pack' ), $name ) . ' &raquo;',
),
);
$submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location );
@ -2749,7 +2810,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
return $opts;
}
/** Generates just the default option names and values
/**
* Generates just the default option names and values
*
* @since 2.4.13 Applies filter before final return.
*
* @param null $location
* @param null $defaults
@ -2757,6 +2821,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
* @return array
*/
function default_options( $location = null, $defaults = null ) {
$prefix = $this->get_prefix( $location );
$options = $this->setting_options( $location, $defaults );
$opts = array();
foreach ( $options as $k => $v ) {
@ -2764,11 +2829,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
$opts[ $k ] = $v['default'];
}
}
return $opts;
return apply_filters( $prefix . 'default_options', $opts, $location );
}
/** Gets the current options stored for a given location.
/**
* Gets the current options stored for a given location.
*
* @since 2.4.14 Added taxonomy options.
*
* @param array $opts
* @param null $location
@ -2793,17 +2860,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
}
if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
$term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
$term_id = $term_id ? $term_id : get_queried_object()->term_id;
if ( AIOSEOPPRO ) {
$get_opts = AIO_ProGeneral::getprotax( $get_opts );
$get_opts = get_term_meta( $term_id, '_' . $prefix . $location, true );
}
} elseif ( isset( $post ) ) {
$get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
}
}
if ( is_home() && ! is_front_page() ) {
// If we're on the non-front page blog page, WP doesn't really know its post meta data so we need to get that manually for social meta.
$get_opts = get_post_meta( get_option( 'page_for_posts' ), '_' . $prefix . $location, true );
}
$defs = $this->default_options( $location, $defaults );
if ( $get_opts == '' ) {
if ( empty( $get_opts ) ) {
$get_opts = $defs;
} else {
$get_opts = wp_parse_args( $get_opts, $defs );

@ -5,18 +5,18 @@
<h3 class="wp-people-group"><?php _e( 'Project Leaders', 'all-in-one-seo-pack' ); ?></h3>
<ul class="wp-people-group " id="wp-people-group-project-leaders">
<li class="wp-person" id="wp-person-michaeltorbert">
<a class="web" href="https://profiles.wordpress.org/hallsofmontezuma" target="_blank"><img alt="" class="gravatar" src="https://s.gravatar.com/avatar/f41419cf5cfdbb071a8d591ac9976bf3?s=60">
<a class="web" href="https://twitter.com/michaeltorbert" target="_blank"><img alt="" class="gravatar" src="https://s.gravatar.com/avatar/f41419cf5cfdbb071a8d591ac9976bf3?s=60">
Michael Torbert</a>
<span class="title"><?php _e( 'Project Lead', 'all-in-one-seo-pack' ); ?></span>
</li>
<li class="wp-person" id="wp-person-stevemortiboy">
<a class="web" target="_blank" href="https://profiles.wordpress.org/wpsmort"><img alt="" class="gravatar" src="https://www.gravatar.com/avatar/40e33d813c16a63500675d851b0cbf3a?s=60">
<a class="web" target="_blank" href="https://twitter.com/wpsmort"><img alt="" class="gravatar" src="https://www.gravatar.com/avatar/40e33d813c16a63500675d851b0cbf3a?s=60">
Steve Mortiboy</a>
<span class="title"><?php _e( 'Project Manager', 'all-in-one-seo-pack' ); ?></span>
</li>
</ul>
<h3 class="wp-people-group"><?php printf( _e( 'Core Team', 'all-in-one-seo-pack' ) ); ?></h3>
<h3 class="wp-people-group"><?php printf( __( 'Core Team', 'all-in-one-seo-pack' ) ); ?></h3>
<ul class="wp-people-group " id="wp-people-group-contributors">
<li class="wp-person" id="wp-person-arnaudbroes">
<a class="web" target="_blank" href="https://profiles.wordpress.org/arnaudbroes"><img alt="" class="gravatar" src="https://www.gravatar.com/avatar/0ce0d554c2b0bd61d326e15c8dcde756?s=60">
@ -37,8 +37,9 @@
<h3 class="wp-people-group">&#x1f31f;<?php _e( 'Recent Rockstar Contributors', 'all-in-one-seo-pack' ); ?>&#x1f31f;</h3>
<ul class="wp-people-group " id="wp-people-group-rockstars">
<li><?php printf( __('Want to see your name and picture here as a community developer? Open a new issue on Github to report a bug or request a feature or find an issue and submit code!')); ?>
<a href="https://github.com/semperfiwebdesign/all-in-one-seo-pack" target="_blank">Click here to go to Github</a>
<li><?php /* translators: '%1$s' and '%2$s' are used as placeholders and turn the text in between into a clickable link */
printf( __('Want to see your name and picture here as a community developer? %1$sClick here%2$s to open an issue on GitHub to report a bug, request a feature or find an issue and submit code!', 'all-in-one-seo-pack'),
'<a href="https://github.com/semperfiwebdesign/all-in-one-seo-pack" target="_blank">', '</a>'); ?>
</li>
<li class="wp-person" id="wp-person-dougalcampbell">
<a class="web" target="_blank" href="https://profiles.wordpress.org/dougal/"><img alt="" class="gravatar" src="https://www.gravatar.com/avatar/81717a172b6918071fbea1a52483294b?s=60">
@ -48,14 +49,14 @@
<a class="web" target="_blank" href="https://github.com/amostajo"><img alt="" class="gravatar" src="https://avatars1.githubusercontent.com/u/1645908?s=60">
Alejandro Mostajo</a>
</li>
<li class="wp-person" id="joelrd">
<a class="web" target="_blank" href="https://github.com/joelrd"><img alt="" class="gravatar" src="https://avatars0.githubusercontent.com/u/16063717?s=60">
Joelrd</a>
</li>
<li class="wp-person" id="carlalexander">
<a class="web" target="_blank" href="https://profiles.wordpress.org/carlalexander/"><img alt="" class="gravatar" src="https://secure.gravatar.com/avatar/5a4758faa5ba6c1322bdfb0f6ebcf56c?s=60">
Carl Alexander</a>
<li class="wp-person" id="rozroz">
<a class="web" target="_blank" href="https://profiles.wordpress.org/rozroz/"><img alt="" class="gravatar" src="https://secure.gravatar.com/avatar/5a4758faa5ba6fc1322bdfb0f6ebcf56c?s=60">
Ashish Ravi</a>
</li>
<li class="wp-person" id="rozroz">
<a class="web" target="_blank" href="https://profiles.wordpress.org/yummy-wp/"><img alt="" class="gravatar" src="https://avatars0.githubusercontent.com/u/22232968?v=3&s=460">
Stanislav Samoilenko</a>
</li>
</ul>
<h3 class="wp-people-group dashicons-before dashicons-translation"><?php printf( _e( 'Translation contributors and translation editors', 'all-in-one-seo-pack' ), '1.2' ); ?></h3>
@ -72,6 +73,7 @@
<a href="https://profiles.wordpress.org/webaware/" target="_blank">webaware</a>,
<a href="https://profiles.wordpress.org/escribirelmundo/" target="_blank">escribirelmundo</a>,
<a href="https://profiles.wordpress.org/casiepa/" target="_blank">Pascal Casier</a>,
<a href="https://profiles.wordpress.org/shoheitanaka/" target="_blank">Shohei Tanaka</a>,
<a href="https://profiles.wordpress.org/nurron/" target="_blank">Nurron Shodiqin</a>,
<a href="https://profiles.wordpress.org/aprmndr/" target="_blank">Alyssa Primandaru</a>,
<a href="https://profiles.wordpress.org/facestoro/" target="_blank">facestoro</a>,

@ -39,7 +39,10 @@ class aiosp_metaboxes {
if ( ! AIOSEOPPRO ) {
?>
<p>
<strong><?php echo aiosp_common::get_upgrade_hyperlink( 'side', __( 'Pro Version', 'all-in-one-seo-pack' ), __( 'CLICK HERE', 'all-in-one-seo-pack' ), '_blank' ); ?> to upgrade to Pro Version and get:</strong>
<strong>
<?php
echo aiosp_common::get_upgrade_hyperlink( 'side', __( 'Pro Version', 'all-in-one-seo-pack' ), __( 'CLICK HERE', 'all-in-one-seo-pack' ), '_blank' );
echo __( ' to upgrade to Pro Version and get:', 'all-in-one-seo-pack' ); ?></strong>
</p>
<?php } ?>
</div>
@ -70,17 +73,22 @@ class aiosp_metaboxes {
// Eventually if nothing is returned we should just remove this section.
if ( get_locale() != 'en_US' ) { ?>
<div><strong>
<div class="aioseop_translations"><strong>
<?php
if ( $aiosp_trans->percent_translated < 100 ) {
if ( ! empty ( $aiosp_trans->native_name ) ) {
$maybe_native_name = $aiosp_trans->native_name;
} else {
$maybe_native_name = $aiosp_trans->name;
}
/* translators: %1$s expands to the number of languages All in One SEO Pack has been translated into. $2%s to the percentage translated of the current language, $3%s to the language name, %4$s and %5$s to anchor tags with link to translation page at translate.wordpress.org */
printf( __(
'All in One SEO Pack has been translated into %1$s languages, but currently the %3$s translation is only %2$s percent complete. %4$s Click here %5$s to help get it to 100 percent.', 'all-in-one-seo-pack' ),
$aiosp_trans->translated_count,
$aiosp_trans->percent_translated,
$aiosp_trans->name,
$maybe_native_name,
"<a href=\"$aiosp_trans->translation_url\" target=\"_BLANK\">",
'</a>' );
}
@ -103,8 +111,8 @@ class aiosp_metaboxes {
<i><?php _e( 'Sign up today and receive a free copy of the e-book 5 SEO Tips for WordPress ($39 value).', 'all-in-one-seo-pack' ); ?></i>
</p>
<p><input type="text" value="" name="EMAIL" class="required email" id="mce-EMAIL"
placeholder="Email Address">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"
placeholder="<?php _e( 'Email Address', 'all-in-one-seo-pack' ); ?>">
<input type="submit" value="<?php _e( 'Subscribe', 'all-in-one-seo-pack' ); ?>" name="subscribe" id="mc-embedded-subscribe"
class="btn"></p>
</form>
</div>
@ -150,19 +158,21 @@ class aiosp_metaboxes {
echo '<ul>';
if ( class_exists( 'WooCommerce' ) ) {
echo '<li>Advanced support for WooCommerce</li>';
echo '<li>' . __( 'Advanced support for WooCommerce', 'all-in-one-seo-pack' ) . '</li>';
}else{
echo '<li>Advanced support for e-commerce</li>';
echo '<li>' . __( 'Advanced support for e-commerce', 'all-in-one-seo-pack' ) . '</li>';
}
echo '<li>Video SEO Module</li>';
echo '<li>SEO for Categories, Tags and Custom Taxonomies</li>';
echo '<li>Access to Video Screencasts</li>';
echo '<li>Access to Premium Support Forums</li>';
echo '<li>Access to Knowledge Center</li>';
echo '<li>' . __( 'Video SEO Module', 'all-in-one-seo-pack' ) . '</li>';
echo '<li>' . __( 'SEO for Categories, Tags and Custom Taxonomies', 'all-in-one-seo-pack' ) . '</li>';
echo '<li>' . __( 'Access to Video Screencasts', 'all-in-one-seo-pack' ) . '</li>';
echo '<li>' . __( 'Access to Premium Support Forums', 'all-in-one-seo-pack' ) . '</li>';
echo '<li>' . __( 'Access to Knowledge Center', 'all-in-one-seo-pack' ) . '</li>';
echo '</ul>';
echo '<a href="https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/new" />Click here</a> to file a feature request/bug report.';
}
}

@ -0,0 +1,38 @@
<?php
/**
* Class AIOSEOPAdminMenus
*
* @since 2.3.11.5
*/
class AIOSEOPAdminMenus {
/**
* Constructor to add the actions.
*/
function __construct() {
if( current_user_can( 'manage_options' ) || current_user_can( 'aiosp_manage_seo') ){
add_action( 'admin_menu', array( $this, 'add_pro_submenu' ), 11 );
}else{
return;
}
}
/**
* Adds Upgrade link to our menu.
*
* @since 2.3.11.5
*/
function add_pro_submenu() {
global $submenu;
$url = 'https://semperplugins.com/all-in-one-seo-pack-pro-version/?loc=aio_menu';
$upgrade_text = __('Upgrade to Pro', 'all-in-one-seo-pack');
$submenu['all-in-one-seo-pack/aioseop_class.php'][] = array(
"<span class='upgrade_menu_link'>$upgrade_text</span>",
'manage_options',
$url,
);
}
}
new AIOSEOPAdminMenus();

@ -52,10 +52,10 @@
target="_blank"><?php echo __( 'We have complete documentation on every setting and feature', 'all-in-one-seo-pack' ); ?></a>
</li>
<li><a href="https://semperplugins.com/videos/"
target="_blank"><?php echo __( 'You can get access to video tutorials about SEO with the Pro version', 'all-in-one-seo-pack' ); ?></a>
target="_blank"><?php echo __( 'Access to video tutorials about SEO with the Pro version', 'all-in-one-seo-pack' ); ?></a>
</li>
<li><a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/?loc=aio_welcome"
target="_blank"><?php echo __( 'You can control SEO on categories, tags and custom taxonomies with the Pro version', 'all-in-one-seo-pack' ); ?></a>
target="_blank"><?php echo __( 'Control SEO on categories, tags and custom taxonomies with the Pro version', 'all-in-one-seo-pack' ); ?></a>
</li>
</ul>
</div>

@ -16,7 +16,7 @@ if ( ! class_exists( 'aioseop_welcome' ) ) {
}
add_action( 'admin_menu', array( $this, 'add_menus' ) );
add_action( 'admin_head', array( $this, 'remove_pages' ) );
add_action( 'admin_menu', array( $this, 'remove_pages' ), 999 );
add_action( 'admin_enqueue_scripts', array( $this, 'welcome_screen_assets' ) );
}
@ -30,13 +30,15 @@ if ( ! class_exists( 'aioseop_welcome' ) ) {
if ( 'dashboard_page_aioseop-about' === $hook ) {
wp_enqueue_style( 'aioseop_welcome_css', AIOSEOP_PLUGIN_URL . '/css/welcome.css' );
wp_enqueue_style( 'aioseop_welcome_css', AIOSEOP_PLUGIN_URL . '/css/welcome.css', array(), AIOSEOP_VERSION );
wp_enqueue_script( 'aioseop_welcome_js', AIOSEOP_PLUGIN_URL . '/js/welcome.js', array( 'jquery' ), AIOSEOP_VERSION, true );
}
}
/**
* Removes unneeded pages.
*
* @since 2.3.12 Called via admin_menu action instead of admin_head.
*/
function remove_pages() {
remove_submenu_page( 'index.php', 'aioseop-about' );
@ -64,10 +66,6 @@ if ( ! class_exists( 'aioseop_welcome' ) ) {
*/
function init( $activate = false ) {
if ( AIOSEOPPRO ) {
return;
}
if ( ! is_admin() ) {
return;
}
@ -80,15 +78,24 @@ if ( ! class_exists( 'aioseop_welcome' ) ) {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
wp_cache_flush();
aiosp_common::clear_wpe_cache();
delete_transient( '_aioseop_activation_redirect' );
$seen = 0;
$seen = get_user_meta( get_current_user_id(), 'aioseop_seen_about_page', true );
if ( AIOSEOP_VERSION === get_user_meta( get_current_user_id(), 'aioseop_seen_about_page', true ) && true !== $activate ) {
return;
}
update_user_meta( get_current_user_id(), 'aioseop_seen_about_page', AIOSEOP_VERSION );
aiosp_common::clear_wpe_cache();
if ( AIOSEOPPRO ) {
return;
}
if ( ( AIOSEOP_VERSION === $seen ) || ( true !== $activate ) ) {
return;
}
wp_safe_redirect( add_query_arg( array( 'page' => 'aioseop-about' ), admin_url( 'index.php' ) ) );
exit;

@ -69,7 +69,8 @@ add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
/**
* Intercept POST data from the form submission.
*
* Use the intercepted data to convert values in the postmeta table from one platform to another.
* Use the intercepted data to convert values in the postmeta table from one platform to another and display feedback to the user about compatible conversion
* elements and the conversion process.
*/
function aiosp_seometa_action() {
@ -130,11 +131,6 @@ function aiosp_seometa_action() {
}
/**
* This function displays feedback to the user about compatible conversion
* elements and the conversion process via the admin_alert hook.
*/
/**
* The admin page output
*/
@ -486,6 +482,7 @@ function aiosp_seometa_import() {
'Custom Doctitle' => '_aioseop_title',
'META Description' => '_aioseop_description',
'META Keywords' => '_aioseop_keywords',
'Canonical URI' => '_aioseop_custom_link',
),
'Greg\'s High Performance SEO' => array(
'Custom Doctitle' => '_ghpseo_secondary_title',
@ -507,6 +504,9 @@ function aiosp_seometa_import() {
'Canonical URI' => '_wds_canonical',
'Redirect URI' => '_wds_redirect',
),
'Jetpack' => array(
'META Description' => 'advanced_seo_description',
),
'Meta SEO Pack' => array(
'META Description' => '_msp_description',
'META Keywords' => '_msp_keywords',
@ -516,6 +516,10 @@ function aiosp_seometa_import() {
'META Description' => 'description',
'META Keywords' => 'keywords',
),
'SEOpressor' => array(
'Custom Doctitle' => '_seopressor_meta_title',
'META Description' => '_seopressor_meta_description',
),
'SEO Title Tag' => array(
'Custom Doctitle' => 'title_tag',
'META Description' => 'meta_description',

File diff suppressed because it is too large Load Diff

@ -1,17 +1,17 @@
<?php
/*
Plugin Name: All In One SEO Pack
Plugin URI: https://semperfiwebdesign.com
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
Version: 2.3.11
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
Version: 2.4.4.1
Author: Michael Torbert
Author URI: https://michaeltorbert.com
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Text Domain: all-in-one-seo-pack
Domain Path: /i18n/
*/
/*
Copyright (C) 2007-2016 Michael Torbert, https://semperfiwebdesign.com
Copyright (C) 2007-2017 Michael Torbert, https://semperfiwebdesign.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -31,14 +31,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* The original WordPress SEO plugin.
*
* @package All-in-One-SEO-Pack
* @version 2.3.11
* @version 2.4.4.1
*/
if ( ! defined( 'AIOSEOPPRO' ) ) {
define( 'AIOSEOPPRO', false );
}
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
define( 'AIOSEOP_VERSION', '2.3.11' );
define( 'AIOSEOP_VERSION', '2.4.4.1' );
}
global $aioseop_plugin_name;
$aioseop_plugin_name = 'All in One SEO Pack';
@ -233,7 +233,7 @@ if ( AIOSEOPPRO ) {
$aioseop_update_checker->license_key = '';
}
$aioseop_update_checker->options_page = AIOSEOP_PLUGIN_DIRNAME . "/aioseop_class.php";
$aioseop_update_checker->renewal_page = 'https://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/';
$aioseop_update_checker->renewal_page = 'https://semperplugins.com/all-in-one-seo-pack-pro-version/';
$aioseop_update_checker->addQueryArgFilter( array( $aioseop_update_checker, 'add_secret_key' ) );
}
@ -277,15 +277,16 @@ if ( ! function_exists( 'aiosp_plugin_row_meta' ) ) {
*/
function aiosp_plugin_row_meta( $actions, $plugin_file ) {
if ( ! AIOSEOPPRO ) {
$action_links = array(
'settings' => array(
'label' => __( 'Feature Request/Bug Report', 'all-in-one-seo-pack' ),
'url' => 'https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/new' )
);
} else {
$action_links = '';
}
return aiosp_action_links( $actions, $plugin_file, $action_links, 'after' );
}
@ -303,6 +304,9 @@ if ( ! function_exists( 'aiosp_add_action_links' ) ) {
* @return array
*/
function aiosp_add_action_links( $actions, $plugin_file ) {
if ( ! is_array( $actions ) ) {
return $actions;
}
$aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME;
$action_links = array();
@ -369,6 +373,12 @@ if ( ! function_exists( 'aiosp_action_links' ) ) {
}
if ( ! function_exists( 'aioseop_init_class' ) ) {
/**
* Inits All-in-One-Seo plugin class.
*
* @since ?? // When was this added?
* @since 2.3.12.3 Loads third party compatibility class.
*/
function aioseop_init_class() {
global $aiosp;
load_plugin_textdomain( 'all-in-one-seo-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/' );
@ -382,11 +392,13 @@ if ( ! function_exists( 'aioseop_init_class' ) ) {
require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/abstract/aiosep_compatible.php');
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-init.php');
require_once( AIOSEOP_PLUGIN_DIR . 'public/front.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'public/google-analytics.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/welcome.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/dashboard_widget.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/menu.php' );
$aioseop_welcome = new aioseop_welcome(); // TODO move this to updates file.
@ -442,7 +454,7 @@ if ( ! function_exists( 'aioseop_welcome' ) ){
add_action( 'init', 'aioseop_load_modules', 1 );
//add_action( 'after_setup_theme', 'aioseop_load_modules' );
if ( is_admin() ) {
if ( is_admin() || defined( 'AIOSEOP_UNIT_TESTING' ) ) {
add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' );
add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' );
add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' );
@ -455,6 +467,7 @@ if ( is_admin() ) {
add_action( 'wp_ajax_aioseo_dismiss_yst_notice', 'aioseop_update_yst_detected_notice' );
add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' );
add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' );
add_action( 'wp_ajax_aioseo_dismiss_sitemap_max_url_notice', 'aioseop_sitemap_max_url_notice_dismissed' );
if ( AIOSEOPPRO ) {
add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' );
}

@ -127,3 +127,8 @@ li#wp-admin-bar-aioseop-pro-upgrade a.ab-item {
background-color:#00aced;
border-radius:2px;
}
.upgrade_menu_link {
font-weight: 900;
color: #d54e21;
font-size: 105%;
}

@ -32,23 +32,18 @@
padding-top: 2px;
outline: none;
color: #888;
border: 2px solid #888;
border-radius: 33px;
width: 22px;
height: 20px;
font-family: sans-serif;
}
.aioseop_help_text_link span {
position: absolute;
left: 21px;
font-size: 14px;
}
.aioseop_help_text_link:before {
content: '\a0?';
color: #888;
font-size: 19px;
content: "\f223";
font-size: 27px;
font-family: dashicons;
vertical-align: middle;
}
#aioseop-support .aioseop_metabox_text,
@ -92,10 +87,6 @@
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==);
}
.aioseop_help_text_link.aioseop_meta_box_help:before {
font-size: 14px;
}
.aioseop_meta_box_help > label {
position: absolute;
margin-left: 8px;
@ -136,11 +127,16 @@ div.aioseop_tip_icon:before {
position: relative;
}
.aioseop_tabs .aioseop_meta_box_help,
.aioseop_tabs .aioseop_meta_box_help:active {
margin-top: 4px;
margin-right: 45px;
}
.aioseop_label {
color: #5F5F5F;
font-weight: bold;
line-height: 19px;
padding-left: 10px; /*changed from 20px to 10px for certain language support*/
display: inline-block;
text-align: left;
position: absolute;
@ -152,7 +148,7 @@ div.aioseop_tip_icon:before {
.aioseop_option_div {
max-height: 360px;
min-height: 43px;
min-height: 37px;
width: 95%;
overflow-y: auto;
}
@ -163,7 +159,7 @@ div.aioseop_tip_icon:before {
.aioseop input[type="text"] {
color: #515151;
height: 35px;
height: 35px;
padding: 10px 0 10px 10px;
font-size: 14px;
width: 95%;
@ -183,7 +179,7 @@ div.aioseop_tip_icon:before {
.aioseop_help_text_div {
text-align: left;
width: 100%;
margin: 10px 0 10px 0;
margin: 0;
}
.aioseop_help_text {
@ -291,9 +287,6 @@ div.aioseop_tip_icon:before {
clear: left;
}
.aioseop_options_wrapper {
}
.aioseop_options_wrapper .hndle {
font-size: 15px;
font-family: Georgia,
@ -361,6 +354,10 @@ div.aioseop_tip_icon:before {
margin-top: 20px;
}
.aioseop_translations {
margin-top: 15px;
}
.aioseop_option_label {
float: left;
margin: 0;
@ -813,51 +810,6 @@ div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
/* max-width: 900px; */
}
#aiosp div.preview_snippet {
border: 1px solid #ebebeb;
padding: 15px 15px 20px 7px;
background-color: #fff;
}
div#aioseop_snippet {
font-family: arial, sans-serif;
font-size: 13px;
}
div#aioseop_snippet > h3 {
font-size: 16px;
padding: 8px 0;
border: 0;
background: inherit;
}
div#aioseop_snippet > h3 > a {
color: #12c;
text-decoration: none;
cursor: pointer;
}
div#aioseop_snippet > div {
color: #222;
max-width: 42em;
}
div#aioseop_snippet > div > div {
display: block;
margin-bottom: 1px;
}
div#aioseop_snippet > div > div > cite {
color: #093;
font-style: normal;
}
div#aioseop_snippet > div > span {
margin: 0;
padding: 0;
border: 0;
}
#aiosp_sitemap_addl_pages,
#aiosp_video_sitemap_addl_pages {
clear: left;
@ -1026,6 +978,11 @@ table.aioseop_table td, table.aioseop_table th {
height: 0;
}
#aiosp_title_metabox #aiosp_force_rewrites_wrapper {
display: none;
height: 0;
}
.aioseop_module.error.below-h2 {
padding: 5px 0;
margin: 0 477px 15px 0 !important;
@ -1033,7 +990,6 @@ table.aioseop_table td, table.aioseop_table th {
#aioseop_opengraph_settings .inside {
margin: 0;
padding: 0;
}
#aioseop_opengraph_settings_image_wrapper img {
@ -1058,7 +1014,7 @@ table.aioseop_table td, table.aioseop_table th {
}
#aiosp {
width: 100%;
width: auto;
}
.aioseop_input.aioseop_top_label .aioseop_option_input {
@ -1196,37 +1152,21 @@ div.aioseop_notice a.aioseop_dismiss_link {
}
.aioseop_header_tabs li a.aioseop_header_tab {
height: 18px;
font: 13px/18px Arial,
Helvetica,
sans-serif normal;
font-size: 14px;
line-height: 37px;
text-decoration: none;
margin: 5px 5px 0 0;
padding: 4px 5px 2px;
padding: 10px;
cursor: pointer;
-webkit-border-top-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
background-color: rgb(255, 255, 255);
background-color: rgba(255, 255, 255, 0.5);
background-color: #e5e5e5;
border: 1px solid #ccc;
color: #5F5F5F;
}
/* Fix for Chrome */
@media screen and (-webkit-min-device-pixel-ratio:0) {
.aioseop_header_tabs li a.aioseop_header_tab {
padding-bottom: 0;
}
}
/* Fix for Safari */
_:-webkit-full-screen:not(:root:root), .aioseop_header_tabs li a.aioseop_header_tab {
padding-bottom: 2px;
}
.aioseop_header_tabs li:first-child a.aioseop_header_tab {
border-left: solid 1px #CCC;
margin-left: 5px;
@ -1236,7 +1176,7 @@ _:-webkit-full-screen:not(:root:root), .aioseop_header_tabs li a.aioseop_header_
border: solid 1px #CCC;
background-color: rgb(255, 255, 255);
background-color: rgba(255, 255, 255, 0.5);
padding-left: 5px;
padding: 10px;
}
.aioseop_loading {
@ -1332,3 +1272,134 @@ div.sfwd_debug_error {
margin-left: 20px !important;
margin-bottom: 10px !important;
}
/**
* Edit Post screen specific styling
*
*/
.postbox-container .aioseop_option_div {
width: 100%;
}
.postbox-container .aioseop_option_div input[type="text"],
.postbox-container .aioseop_option_div textarea {
width: 99%;
max-width: 900px;
}
.postbox-container .aioseop_option_label {
max-width: none;
height: auto !important;
}
.postbox-container .aioseop_wrapper {
padding: 0;
}
.postbox-container .aioseop_input {
display: block;
margin-bottom: 10px;
padding: 0;
}
.postbox-container .aioseop_option_input {
width: 63%;
padding: 0;
}
.postbox-container div#aiosp_upgrade_wrapper {
float: none;
width: auto;
margin: 0;
padding: 0;
}
.postbox-container div#aiosp_upgrade_wrapper .aioseop_input {
display: block;
padding: 0;
}
.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input {
float: none;
width: auto;
padding: 0;
}
.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input .aioseop_option_div {
width: auto;
min-height: 0;
padding: 10px 0;
}
.aioseop_tabs .aioseop_options {
margin: 0;
}
#aioseop_opengraph_settings .aioseop_options {
clear: both;
margin-top: 35px;
}
#aioseop_opengraph_settings .aioseop_option_input {
width: 70%;
}
/**
* Preview Snippet styling
*
*/
div#aiosp_snippet_wrapper {
border: 1px solid #888;
clear: both;
padding: 10px 10px 0;
max-width: 97%;
margin-bottom: 15px;
}
div#aiosp_snippet_wrapper .aioseop_option_label {
height: auto !important;
}
div#aiosp_snippet_wrapper .aioseop_input.aioseop_top_label .aioseop_option_input {
margin: 0;
}
div#aioseop_snippet {
font-family: arial, sans-serif;
font-size: 13px;
}
div#aioseop_snippet > h3 {
margin: 10px 0 5px;
font-size: 18px;
border: 0;
background: inherit;
font-weight: normal;
}
div#aioseop_snippet > h3 > a {
color: #12c;
text-decoration: none;
cursor: pointer;
}
div#aioseop_snippet > div {
color: #545454;
max-width: 48em;
}
div#aioseop_snippet > div > div {
display: block;
margin-bottom: 1px;
}
div#aioseop_snippet > div > div > cite {
color: #093;
font-style: normal;
}
div#aioseop_snippet > div > span {
margin: 0;
padding: 0;
border: 0;
}

@ -120,6 +120,14 @@ section:first-child {
list-style-type: square;
}
#wp-people-group-rockstars li {
margin-bottom: 1.33em;
}
#wp-people-group-rockstars li.wp-person {
margin-bottom: 0;
}
@media screen and (max-width: 850px) {
.welcome-panel-column {
width: 100%;

@ -3495,7 +3495,7 @@ msgstr ""
msgid ""
"Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO "
"for custom post types, SEO for blogs or business sites, SEO for ecommerce "
"sites, and much more. Almost 30 million downloads since 2007."
"sites, and much more. More than 30 million downloads since 2007.""
msgstr ""
#. Author of the plugin/theme

@ -5,6 +5,7 @@
* We'll eventually move these to a better place, and figure out ones not being used anymore.
*
* @package All-in-One-SEO-Pack
* @version 2.3.13
*/
if ( ! function_exists( 'aioseop_load_modules' ) ) {
@ -183,7 +184,7 @@ if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
if ( ! function_exists( 'aioseop_admin_head' ) ) {
function aioseop_admin_head() {
echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
wp_enqueue_script( 'aioseop_welcome_js', AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js', array( 'jquery' ), AIOSEOP_VERSION);
?>
<style>
.aioseop_edit_button {
@ -295,7 +296,7 @@ if ( ! function_exists( 'aioseop_output_notice' ) ) {
$class .= ' id="' . esc_attr( $id ) . '"';
}
$dismiss = ' ';
echo "<div{$class}>" . wp_kses_post( $message ) . '<br class=clear /></div>';
echo "<div{$class}>" . wp_kses_post( $message ) . '</div>';
return true;
}
@ -956,3 +957,45 @@ function aioseop_woo_upgrade_notice_dismissed() {
update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
}
function aioseop_sitemap_max_url_notice_dismissed() {
update_user_meta( get_current_user_id(), 'aioseop_sitemap_max_url_notice_dismissed', true );
}
/**
* Returns home_url() value compatible for any use.
* Thought for compatibility purposes.
*
* @since 2.3.12.3
*
* @param string $path Relative path to home_url().
*
* @return string url.
*/
function aioseop_home_url( $path = '/' ) {
$url = apply_filters( 'aioseop_home_url', $path );
return $path === $url ? home_url( $path ) : $url;
}
if ( ! function_exists('aiosp_include_images') ) {
function aiosp_include_images() {
if ( false === apply_filters( 'aioseo_include_images_in_sitemap', true ) ) {
return false;
}
global $aioseop_options;
if( isset( $aioseop_options['modules'] ) &&
isset( $aioseop_options['modules']['aiosp_sitemap_options'] ) &&
isset( $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_images'] ) &&
'on' === $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_images']
){
return false;
}
return true;
}
}

@ -57,10 +57,11 @@ class AIOSEOP_Updates {
}
if( ! is_network_admin() || !isset( $_GET['activate-multi'] ) ) {
// Replace this to reactivate update welcome screen.
//set_transient( '_aioseop_activation_redirect', true, 30 ); // Sets 30 second transient for welcome screen redirect on activation.
}
delete_transient( 'aioseop_feed' );
// add_action( 'admin_init', array( $this, 'aioseop_welcome' ) );
add_action( 'admin_init', array( $this, 'aioseop_welcome' ) );
}
@ -74,8 +75,8 @@ class AIOSEOP_Updates {
function aioseop_welcome(){
if ( get_transient( '_aioseop_activation_redirect' ) ) {
delete_transient( '_aioseop_activation_redirect' );
$aioseop_welcome = new aioseop_welcome();
$aioseop_welcome->init( TRUE );
//$aioseop_welcome = new aioseop_welcome();
//$aioseop_welcome->init( TRUE );
}
}
@ -135,27 +136,6 @@ class AIOSEOP_Updates {
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
update_option( 'aioseop_options', $aioseop_options );
$aiosp->update_class_option( $aioseop_options );
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
&& 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules']
) {
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
require_once(
AIOSEOP_PLUGIN_DIR .
'admin/aioseop_module_class.php'
);
require_once(
AIOSEOP_PLUGIN_DIR .
'modules/aioseop_bad_robots.php'
);
}
$aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
$aiosp_reset_htaccess->generate_htaccess_blocklist();
}
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
&& extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' )
) {
insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
}
}
}
@ -182,21 +162,6 @@ class AIOSEOP_Updates {
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
update_option( 'aioseop_options', $aioseop_options );
$aiosp->update_class_option( $aioseop_options );
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) {
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php' );
}
$aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
$aiosp_reset_htaccess->generate_htaccess_blocklist();
}
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ) {
insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
}
}
}
@ -219,21 +184,6 @@ class AIOSEOP_Updates {
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
update_option( 'aioseop_options', $aioseop_options );
$aiosp->update_class_option( $aioseop_options );
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) {
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php' );
}
$aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
$aiosp_reset_htaccess->generate_htaccess_blocklist();
}
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ) {
insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
}
}
}

@ -105,4 +105,19 @@ class aiosp_common {
static function get_upgrade_url() {
//put build URL stuff in here
}
/**
* Check whether a url is relative and if it is, make it absolute.
*
* @param string $url URL to check.
*
* @return string
*/
static function absolutize_url( $url ) {
if ( strpos( $url, 'http' ) !== 0 && strpos( $url, '//' ) !== 0 && $url != '/' ) {
$url = home_url( $url );
}
return $url;
}
}

@ -34,6 +34,7 @@ class AIOSP_Common_Strings {
// Update checker strings (incomplete... need to separate out html).
__( 'Purchase one now', 'all-in-one-seo-pack' );
__( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
/* translators: Please mind the space at the beginning of the string. */
__( ' Need a license key?', 'all-in-one-seo-pack' );
__( 'Notice: ', 'all-in-one-seo-pack' );
__( 'Manage Licenses', 'all-in-one-seo-pack' );
@ -45,5 +46,30 @@ class AIOSP_Common_Strings {
__( 'This displays an SEO News widget on the dashboard.', 'all-in-one-seo-pack' );
__( 'Check this to add All in One SEO Pack to the Admin Bar for easy access to your SEO settings.', 'all-in-one-seo-pack' );
__( 'Check this to move the All in One SEO Pack menu item to the top of your WordPress Dashboard menu.', 'all-in-one-seo-pack' );
__('%s is almost ready.', 'all-in-one-seo-pack' );
__('You must <a href="%s">enter a valid License Key</a> for it to work.', 'all-in-one-seo-pack' );
__( "There is a new version of %s available. Go to <a href='%s'>the plugins page</a> for details.", 'all-in-one-seo-pack' );
sprintf( __( 'Your license has expired. Please %1$s click here %2$s to purchase a new one.', 'all-in-one-seo-pack' ), '<a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/" target="_blank">', '</a>' );
__( 'Track Outbound Forms:', 'all-in-one-seo-pack' );
__( 'Track Events:', 'all-in-one-seo-pack' );
__( 'Track URL Changes:', 'all-in-one-seo-pack' );
__( 'Track Page Visibility:', 'all-in-one-seo-pack' );
__( 'Track Media Query:', 'all-in-one-seo-pack' );
__( 'Track Elements Visibility:', 'all-in-one-seo-pack' );
__( 'Track Page Scrolling:', 'all-in-one-seo-pack' );
__( 'Track Facebook and Twitter:', 'all-in-one-seo-pack' );
__( 'Ensure URL Consistency:', 'all-in-one-seo-pack' );
__( 'Check this if you want to track outbound forms with Google Analytics.', 'all-in-one-seo-pack' );
__( 'Check this if you want to track events with Google Analytics.', 'all-in-one-seo-pack' );
__( 'Check this if you want to track URL changes for single pages with Google Analytics.', 'all-in-one-seo-pack' );
__( 'Check this if you want to track how long pages are in visible state with Google Analytics.', 'all-in-one-seo-pack' );
/* translators: 'This option allows users to track media queries, allowing them to find out if users are viewing a responsive layout or not and which layout changes
have been applied if the browser window has been resized by the user, see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/media-query-tracker.md. */
__( 'Check this if you want to track media query matching and queries with Google Analytics.', 'all-in-one-seo-pack' );
/* translators: The term 'viewport' refers to the area of the page that is visible to the user, see https://www.w3schools.com/css/css_rwd_viewport.asp. */
__( 'Check this if you want to track when elements are visible within the viewport with Google Analytics.', 'all-in-one-seo-pack' );
__( 'Check this if you want to ensure consistency in URL paths reported to Google Analytics.', 'all-in-one-seo-pack' );
__( 'Check this if you want to track how far down a user scrolls a page with Google Analytics.', 'all-in-one-seo-pack' );
__( 'Check this if you want to track interactions with the official Facebook and Twitter widgets with Google Analytics.', 'all-in-one-seo-pack' );
}
}

@ -0,0 +1,32 @@
<?php
if ( ! class_exists( 'All_in_One_SEO_Pack_Compatible' ) ) {
/**
* Abstract class to be used to create compatibility with 3rd party wordpress plugins.
*
* @package All-in-One-SEO-Pack
* @author Alejandro Mostajo
* @copyright Semperfi Web Design <https://semperplugins.com/>
* @version 2.3.13
* @since 2.3.12.3
*/
abstract class All_in_One_SEO_Pack_Compatible {
/**
* Returns flag indicating if compatible plugin exists in current instalation or not.
* This function should be overwritten on child class.
* @since 2.3.12.3
*
* @return bool
*/
public function exists() {
return false;
}
/**
* Method executed by compatibility handler to declare hooks and/or any other compatibility code needed.
* @since 2.3.12.3
*/
public function hooks() {
// TODO per compatible plugin.
}
}
}

@ -5,7 +5,7 @@
* Eventually we'll have subclasses for each.
*
* @package All-in-One-SEO-Pack
* @since 2.3.6
* @since 2.3.13
*/
if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
@ -15,8 +15,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
*
* @since 2.3.6
*/
class All_in_One_SEO_Pack_Compatibility {
/**
* List of compatibility classes to execute and run.
*
* @since 2.3.12.3
*
* @var array
*/
protected $classes = array();
/**
* All_in_One_SEO_Pack_Compatibility constructor.
*
@ -32,6 +42,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
* Load Compatibility Hooks.
*
* @since 2.3.6
* @since 2.3.12.3 Runs hooks located in compatibility classes.
*/
public function load_compatibility_hooks() {
// We'll use this until we set up our classes.
@ -42,6 +53,29 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
'filter_jetpack_site_verification_output',
), 10, 1 );
}
// Remove Twitter plugin's meta if our Social Module is on.
global $aioseop_options;
if ( isset( $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_opengraph'] ) && $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_opengraph'] === 'on' ) {
add_filter( 'twitter_card', array( $this, 'aioseop_disable_twitter' ) );
}
// Run compatibility classes
for ( $i = count( $this->classes ) - 1; $i >= 0; --$i ) {
$this->classes[ $i ]->hooks();
}
}
/**
*
* @return bool
*/
function aioseop_disable_twitter( $card_properties ) {
if ( apply_filters( 'aioseop_disable_twitter_plugin_card', true ) ) {
return false;
}
return $card_properties;
}
/**
@ -101,8 +135,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
* Load Compatibility classes.
*
* @since 2.3.6
* @since 2.3.12.3 WPML compatibility loaded.
*/
public function load_compatibility_classes() {
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-wpml.php' ); // Load classes.
// Evaluate classes and push them into array
$target = new All_in_One_SEO_Pack_Wpml;
if ( $target->exists() )
$this->classes[] = $target;
// Eventually we'll load our other classes from here.
$this->load_compatibility_hooks();
}

@ -0,0 +1,72 @@
<?php
if ( ! class_exists( 'All_in_One_SEO_Pack_Wpml' ) ) {
/**
* Compatibility with WPML - Wordpress Multilingual Plugin
*
* @link https://wpml.org/
* @package All-in-One-SEO-Pack
* @author Alejandro Mostajo
* @copyright Semperfi Web Design <https://semperplugins.com/>
* @version 2.3.13
*/
class All_in_One_SEO_Pack_Wpml extends All_in_One_SEO_Pack_Compatible {
/**
* Returns flag indicating if WPML is present.
*
* @since 2.3.12.3
*
* @return bool
*/
public function exists() {
return function_exists( 'icl_object_id' );
}
/**
* Declares compatibility hooks.
*
* @since 2.3.12.3
*/
public function hooks() {
add_filter( 'aioseop_home_url', array( &$this, 'aioseop_home_url' ) );
add_filter( 'aioseop_sitemap_xsl_url', array( &$this, 'aioseop_sitemap_xsl_url' ) );
}
/**
* Returns specified url filtered by wpml.
* This is needed to obtain the correct domain in which wordpress is running on.
* AIOSEOP would have ran first expecting the return of home_url().
*
* @since 2.3.12.3
*
* @param string $path Relative path or url.
*
* @param string filtered url.
*/
public function aioseop_home_url( $path ) {
$url = apply_filters( 'wpml_home_url', home_url( '/' ) );
// Remove query string
preg_match_all( '/\?[\s\S]+/', $url, $matches );
// Get base
$url = preg_replace( '/\?[\s\S]+/', '', $url);
$url = trailingslashit( $url );
$url .= preg_replace( '/\//', '', $path, 1);
// Add query string
if ( count( $matches ) > 0 && count( $matches[0] ) > 0 )
$url .= $matches[0][0];
return $url;
}
/**
* Returns XSL url without query string.
*
* @since 2.3.12.3
*
* @param string $url XSL url.
*
* @param string filtered url.
*/
public function aioseop_sitemap_xsl_url( $url )
{
return preg_replace( '/\?[\s\S]+/', '', $url);
}
}
}

@ -7,11 +7,13 @@
* @package All-in-One-SEO-Pack
*
* @since 2.3.6
* @since 2.3.12.3 Refactoring indentation and added xmlns fix for Chrome rendering.
*/
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
@ -26,76 +28,82 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
</xsl:choose>
</xsl:variable>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
<xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when>
<xsl:otherwise>Sitemap Index</xsl:otherwise>
</xsl:choose>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
margin: 0;
font-family: Helvetica, Arial, sans-serif;
font-size: 68.5%;
}
#content-head {
background-color: #4275f4;
padding: 20px 40px;
}
#content-head h1,
#content-head p,
#content-head a {
color: #fff;
font-size: 1.2em;
}
#content-head h1 {
font-size: 2em;
}
table {
margin: 20px 40px;
border: none;
border-collapse: collapse;
}
table {
font-size: 1em;
width: 75%;
}
th {
border-bottom: 1px solid #ccc;
text-align: left;
padding: 15px 5px;
font-size: 14px;
}
td {
padding: 10px 5px;
border-left: 3px solid #fff;
}
tr.stripe {
background-color: #f7f7f7;
}
</style>
</head>
<body>
<div id="content">
<div id="content-head">
<h1>XML Sitemap</h1>
<p>Generated by <a href="https://semperplugins.com">All in One </a> <a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/">SEO</a>, this is an XML Sitemap, meant to be consumed by search engines like Google or Bing.<br/>
You can find more information about XML sitemaps at <a href="http://sitemaps.org">sitemaps.org</a>.</p>
<p><xsl:choose>
<head>
<title>
<xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when>
<xsl:otherwise>Sitemap Index</xsl:otherwise>
</xsl:choose>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
margin: 0;
font-family: Helvetica, Arial, sans-serif;
font-size: 68.5%;
}
#content-head {
background-color: #4275f4;
padding: 20px 40px;
}
#content-head h1,
#content-head p,
#content-head a {
color: #fff;
font-size: 1.2em;
}
#content-head h1 {
font-size: 2em;
}
table {
margin: 20px 40px;
border: none;
border-collapse: collapse;
}
table {
font-size: 1em;
width: 75%;
}
th {
border-bottom: 1px solid #ccc;
text-align: left;
padding: 15px 5px;
font-size: 14px;
}
td {
padding: 10px 5px;
border-left: 3px solid #fff;
}
tr.stripe {
background-color: #f7f7f7;
}
table td a {
display: block;
}
table td a img {
max-height: 30px;
margin: 6px 3px;
}
</style>
</head>
<body>
<div id="content">
<div id="content-head">
<h1>XML Sitemap</h1>
<p>Generated by <a href="https://semperplugins.com">All in One </a> <a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/">SEO</a>, this is an XML Sitemap, meant to be consumed by search engines like Google or Bing.<br/>
You can find more information about XML sitemaps at <a href="http://sitemaps.org">sitemaps.org</a>.</p>
<p><xsl:choose>
<xsl:when test="$fileType='Sitemap'">
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of> URLs</xsl:when>
<xsl:otherwise>This sitemap index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of> sitemaps</xsl:otherwise>
</xsl:choose></p>
</div>
<xsl:choose>
<xsl:when test="$fileType='Sitemap'">
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of> URLs</xsl:when>
<xsl:otherwise>This sitemap index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of> sitemaps</xsl:otherwise>
</xsl:choose></p>
</div>
<xsl:choose>
<xsl:when test="$fileType='Sitemap'">
<xsl:call-template name="sitemapTable"/></xsl:when>
<xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
</xsl:choose>
</div>
</body>
<xsl:call-template name="sitemapTable"/></xsl:when>
<xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
</xsl:choose>
</div>
</body>
</html>
</xsl:template>
<xsl:template name="siteindexTable">
@ -135,9 +143,16 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
<thead>
<tr>
<th width="50%">URL</th>
<?php
if ( aiosp_include_images() ) {
?>
<th>Images</th>
<?php
}
?>
<th>Priority</th>
<th>Change Frequency</th>
<th>LastChange</th>
<th>Last Change</th>
</tr>
</thead>
<tbody>
@ -155,16 +170,27 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
<a href="{$itemURL}">
<xsl:value-of select="sitemap:loc"/>
</a>
<xsl:variable name="thumbURL">
<xsl:value-of select="video:video/video:thumbnail_loc"/>
</xsl:variable>
<xsl:variable name="playURL">
<xsl:value-of select="video:video/video:player_loc"/>
</xsl:variable>
<xsl:if test="$thumbURL != ''">
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
</xsl:if>
<xsl:for-each select="video:video">
<xsl:variable name="thumbURL">
<xsl:value-of select="video:thumbnail_loc"/>
</xsl:variable>
<xsl:variable name="playURL">
<xsl:value-of select="video:player_loc"/>
</xsl:variable>
<xsl:if test="$thumbURL != ''">
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
</xsl:if>
</xsl:for-each>
</td>
<?php
if ( aiosp_include_images() ) {
?>
<td>
<xsl:value-of select="count(image:image)"/>
</td>
<?php
}
?>
<td>
<xsl:if test="string(number(sitemap:priority))!='NaN'">
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
@ -177,9 +203,6 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
</td>
<td>
</td>
</tr>
</xsl:for-each>

@ -32,6 +32,8 @@ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
public $percent_translated = '';
public $native_name = '';
/**
* AIOSEOP_Translations constructor.
*
@ -148,10 +150,28 @@ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
}
/**
* Gets and sets the native language.
*
* @since 2.3.12.1
*/
function set_native_language() {
if ( file_exists( ABSPATH . 'wp-admin/includes/translation-install.php' ) ) {
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
} else {
return;
}
if ( function_exists( 'wp_get_available_translations' ) ) {
$translations = wp_get_available_translations();
$this->native_name = $translations[ $this->current_locale ]['native_name'];
}
}
/**
*
* @since 2.3.5
* @since 2.3.6 Return FALSE on WP_Error object in get_locale_data().
* @since 2.3.12.1 set_native_language()
*
*/
private function init() {
@ -171,6 +191,8 @@ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
$this->translated_count = $this->count_translated_languages( $locales );
$this->set_translation_url();
$this->set_native_language();
}
}

@ -72,7 +72,7 @@ function countChars( field, cntfield ) {
cntfield.style.color = "#fff";
cntfield.style.backgroundColor = "#f00";
} else {
if ( cntfield.value > ( field_size - 6 ) ) {
if ( cntfield.value > ( field_size - 91 ) ) {
cntfield.style.color = "#515151";
cntfield.style.backgroundColor = "#ff0";
} else {
@ -242,29 +242,98 @@ jQuery( document ).ready(function() {
aioseop_do_condshow( aiosp_data.condshow );
}
}
/**
* Turns on image checker on custom url change.
* @since 2.3.16
*/
jQuery( '.aioseop_upload_image_label' ).on( 'change', function() {
this.checker = jQuery( this ).parent().find( '.aioseop_upload_image_checker' );
if ( this.checker.length > 0 ) {
this.checker.val( 1 );
}
} );
});
/**
* @since 1.0.0
* @return boolean.
* @summary Custom jQuery plugin that enables image uploader in wordpress.
*
* @since 2.3.13
* @since 2.4.14 Added success callback and options.
* @see http://www.webmaster-source.com/2013/02/06/using-the-wordpress-3-5-media-uploader-in-your-plugin-or-theme/
*
* @param object options Plugin options.
*/
jQuery( document ).ready(function() {
var image_field;
jQuery( '.aioseop_upload_image_button' ).click(function() {
window.send_to_editor = aioseopNewSendToEditor;
image_field = jQuery( this ).next();
formfield = image_field.attr( 'name' );
tb_show( '', 'media-upload.php?type=image&amp;TB_iframe=true' );
return false;
});
aioseopStoreSendToEditor = window.send_to_editor;
aioseopNewSendToEditor = function(html) {
imgurl = jQuery( 'img',html ).attr( 'src' );
if ( typeof( imgurl ) !== undefined )
image_field.val( imgurl );
tb_remove();
window.send_to_editor = aioseopStoreSendToEditor;
};
jQuery.fn.aioseopImageUploader = function( options ) {
// Keep reference to this.
var self = this;
// Options
self.options = jQuery.extend({
success: undefined,
}, options);
// Set input target when to update image url value
self.target = jQuery( self ).next();
// Uploader per image button
// * Having only one uploader was causing problems when multiple image buttons where in place
self.uploader = wp.media({
title: 'Choose Image',
button: {
text: 'Choose Image'
},
multiple: false
});
/**
* Event handler that will be called when an image is selected from media uploader.
*/
self.onSelect = function() {
var url = self.uploader.state().get( 'selection' ).first().toJSON().url;
if ( self.target.length >= 0 )
jQuery( self.target ).val( url );
if ( self.options.success !== undefined )
self.options.success( url, self );
}
/**
* Click event handler.
* @param object e Click event.
*/
self.onClick = function( e ) {
e.preventDefault();
self.uploader.open();
}
//Set uploader select handler
self.uploader.on( 'select', self.onSelect );
// Set click handler
jQuery( self ).click( self.onClick );
};
/**
* @summary Javascript for using WP media uploader. Indentifies which DOM should use custom uploader plugin.
*
* @see http://www.webmaster-source.com/2013/02/06/using-the-wordpress-3-5-media-uploader-in-your-plugin-or-theme/
* @since ?
* @since 2.3.11.2 Use WP 3.5 new media uploader
* @since 2.3.13 Fixed issue #[740](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/740)
*
*/
jQuery(document).ready(function($){
jQuery( '.aioseop_upload_image_button' ).each(function() {
jQuery( this ).aioseopImageUploader({
success: function( url, el ) {
// Update checker
if ( jQuery( el ).prev().length > 0 )
jQuery( el ).prev().val( 1 );
},
});
});
});
/**

@ -31,6 +31,17 @@ jQuery(document).on( 'click', '.woo-upgrade-notice', function() {
})
jQuery(document).on( 'click', '.sitemap_max_urls_notice', function() {
jQuery.ajax({
url: ajaxurl,
data: {
action: 'aioseo_dismiss_sitemap_max_url_notice'
}
})
})
function aioseop_ajax_edit_meta_form( post_id, meta, nonce ) {
var uform = jQuery('#aioseop_'+meta+'_' + post_id);
@ -63,7 +74,7 @@ function handle_post_meta( p, t, m, n ) {
loading += '</label><div style="float:left">Please wait…</div>';
jQuery("div#aioseop_"+m+"_"+p).fadeIn('fast', function() {
var aioseop_sack = new sack(aioseopadmin.requestUrl);
aioseop_sack.execute = 1;
aioseop_sack.execute = 1;
aioseop_sack.method = 'POST';
aioseop_sack.setVar( "action", "aioseop_ajax_save_meta");
aioseop_sack.setVar( "post_id", p );
@ -76,6 +87,6 @@ function handle_post_meta( p, t, m, n ) {
})
jQuery("div#aioseop_"+m+"_"+p).html(loading);
jQuery("div#aioseop_"+m+"_"+p).attr( "class", "aioseop_mpc_admin_meta_options" );
})
}
}

@ -23,7 +23,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
'htaccess_rules' => __( 'Block bad robots via Apache .htaccess rules. Warning: this will change your web server configuration, make sure you are able to edit this file manually as well.', 'all-in-one-seo-pack' ),
'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ),
'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ),
'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ),
@ -34,7 +33,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
'block_bots' => array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ),
'block_refer' => array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ),
'track_blocks' => array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ),
'htaccess_rules' => array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ),
'edit_blocks' => array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ),
'blocklist' => array(
'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ),
@ -68,14 +66,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
'condshow' => array( "{$this->prefix}track_blocks" => 'on' ),
),
);
$is_apache = false;
if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) {
$is_apache = true;
add_action( $this->prefix . 'settings_update', array( $this, 'generate_htaccess_blocklist' ), 10 );
} else {
unset( $this->default_options['htaccess_rules'] );
unset( $help_text['htaccess_rules'] );
}
if ( ! empty( $help_text ) ) {
foreach ( $help_text as $k => $v ) {
@ -137,52 +127,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
}
function generate_htaccess_blocklist() {
if ( ! $this->option_isset( 'htaccess_rules' ) ) {
if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) {
aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
} else {
aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
}
return;
}
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
foreach ( array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
if ( ! in_array( $m, $modules ) ) {
aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' );
}
}
}
$botlist = $this->default_bad_bots();
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
if ( ! empty( $botlist ) ) {
$regex = $this->quote_list_for_regex( $botlist, '"' );
$htaccess = array();
$htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
$referlist = $this->default_bad_referers();
$referlist = apply_filters( $this->prefix . 'badreferlist', $botlist );
if ( ! empty( $referlist ) ) {
$regex = $this->quote_list_for_regex( $referlist, '"' );
$htaccess[] = 'SetEnvIfNoCase Referer "' . $regex . '" bad_bot';
}
}
$htaccess[] = 'Deny from env=bad_bot';
if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, $htaccess ) ) {
aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
} else {
aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
}
} else {
aioseop_output_notice( __( 'No rules to update!', 'all-in-one-seo-pack' ), '', 'error' );
}
}
/**
* @param $referlist
*
@ -190,7 +134,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
*/
function filter_bad_referlist( $referlist ) {
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
$referlist = explode( "\n", $this->options["{$this->prefix}referlist"] );
$referlist = preg_split('/\r\n|[\r\n]/', $this->options["{$this->prefix}referlist"] );
}
return $referlist;
@ -203,7 +147,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
*/
function filter_bad_botlist( $botlist ) {
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'blocklist' ) ) {
$botlist = explode( "\n", $this->options["{$this->prefix}blocklist"] );
$botlist = preg_split('/\r\n|[\r\n]/', $this->options["{$this->prefix}blocklist"] );
}
return $botlist;
@ -216,6 +160,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
* @param string $msg
*/
function blocked_message( $msg ) {
if ( ! $this->option_isset( 'track_blocks' ) ) {
return; // Only log if track blocks is checked.
}
if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) {
$this->options["{$this->prefix}blocked_log"] = '';
}

@ -31,7 +31,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
),
'opengraph' => array(
'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all-in-one-seo-pack' ),
'description' => __( 'Add Social Meta data to your site to deliver closer integration between your website/blog and social media.', 'all-in-one-seo-pack' ),
),
'robots' => array(
'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),

@ -43,8 +43,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
'name' => __( 'Export Settings', 'all-in-one-seo-pack' ),
'type' => 'multicheckbox',
'initial_options' => Array(
1 => 'General Settings',
2 => 'Post Data',
1 => __( 'General Settings', 'all-in-one-seo-pack' ),
+ 2 => __( 'Post Data', 'all-in-one-seo-pack' ),
),
),
'export_post_types' => Array(
@ -121,9 +121,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
function debug_post_types() {
$post_types = $this->get_post_type_titles();
$rempost = array(
'attachment' => 1,
'revision' => 1,
'nav_menu_item' => 1,
'customize_changeset' => 1,
'custom_css' => 1,
'revision' => 1,
'nav_menu_item' => 1,
);
$this->default_options['export_post_types']['initial_options'] = array_diff_key(
$post_types,
@ -199,7 +200,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
if ( is_array( $this->warnings ) ) {
foreach ( $this->warnings as $warning ) {
echo "<p>" . esc_html( $warning ) . "</p>";
echo "<p>" . wp_kses( wp_unslash( $warning ), 'b, strong, i, em' ) . "</p>";
}
}
echo '</div>';
@ -491,7 +492,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
}
}
} catch ( Exception $e ) {
// Shows only one warning when compromised file is imported
$this->warnings = array();
$this->warnings[] = $e->getMessage();
add_action(
$this->prefix . 'settings_header_errors',
array( $this, 'show_import_warnings' )
);
break;
}
// Shows all errors found

File diff suppressed because it is too large Load Diff

@ -80,6 +80,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
$system_status = array(
'status' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
'send_email' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
);
$this->layout['system_status'] = array(
@ -151,6 +152,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
function settings_page_init() {
$this->default_options['status']['default'] = $this->get_serverinfo();
$this->default_options['send_email']['default'] = $this->get_email_input();
}
function menu_order() {
@ -228,9 +230,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
$ms = __( 'N/A', 'all-in-one-seo-pack' );
}
$siteurl = get_option( 'siteurl' );
$homeurl = get_option( 'home' );
$db_version = get_option( 'db_version' );
$siteurl = get_option( 'siteurl' );
$homeurl = get_option( 'home' );
$db_version = get_option( 'db_version' );
$site_title = get_bloginfo( 'name' );
$language = get_bloginfo( 'language' );
$front_displays = get_option( 'show_on_front' );
$page_on_front = get_option( 'page_on_front' );
$blog_public = get_option( 'blog_public' );
$perm_struct = get_option( 'permalink_structure' );
$debug_info = array(
__( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
@ -253,6 +261,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
__( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
__( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
__( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'],
__( 'Site Title', 'all-in-one-seo-pack' ) => $site_title,
__( 'Site Language', 'all-in-one-seo-pack' ) => $language,
__( 'Front Page Displays', 'all-in-one-seo-pack' ) => $front_displays === 'page' ? $front_displays . ' [ID = ' . $page_on_front . ']' : $front_displays,
__( 'Search Engine Visibility', 'all-in-one-seo-pack' ) => $blog_public,
__( 'Permalink Setting', 'all-in-one-seo-pack' ) => $perm_struct,
);
$debug_info['Active Plugins'] = null;
$active_plugins = $inactive_plugins = array();
@ -282,24 +295,43 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
}
do {
if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) {
if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) ) {
$nonce = $_REQUEST['sfwd_debug_nonce'];
if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
echo "<div class='sfwd_debug_error'>" . __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' ) . '</div>';
break;
}
if ( $_REQUEST['sfwd_update_check'] ) {
global $aioseop_update_checker;
$aioseop_update_checker->checkForUpdates();
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( '%s has checked for updates.', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . '</div>';
break;
}
$email = '';
if ( ! empty( $_REQUEST['sfwd_debug_send_email'] ) ) {
$email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
}
if ( $email ) {
if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text ) ) {
$attachments = array();
$upload_dir = wp_upload_dir();
$dir = $upload_dir['basedir'] . '/aiosp-log/';
if ( wp_mkdir_p( $dir ) ) {
$file_path = $dir . 'settings_aioseop-' . date( 'Y-m-d' ) . '-' . time() . '.ini';
if ( ! file_exists( $file_path ) ) {
if ( $file_handle = @fopen( $file_path, 'w' ) ) {
global $aiosp;
$buf = '; ' . __(
'Settings export file for All in One SEO Pack', 'all-in-one-seo-pack'
) . "\n";
// Adds all settings and posts data to settings file
add_filter( 'aioseop_export_settings_exporter_post_types', array( $this, 'get_exporter_post_types' ) );
add_filter( 'aioseop_export_settings_exporter_choices', array( $this, 'get_exporter_choices' ) );
$buf = $aiosp->settings_export( $buf );
$buf = apply_filters( 'aioseop_export_settings', $buf );
fwrite( $file_handle, $buf );
fclose( $file_handle );
$attachments[] = $file_path;
}
}
}
if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text, '', $attachments ) ) {
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
} else {
echo "<div class='sfwd_debug_error'>" . sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
@ -309,16 +341,36 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
}
}
} while ( 0 ); // Control structure for use with break.
$buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n";
return $buf;
}
function get_email_input() {
$nonce = wp_create_nonce( 'sfwd-debug-nonce' );
$buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
'<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '"><input name="sfwd_debug_nonce" type="hidden" value="' .
$buf = '<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '"><input name="sfwd_debug_nonce" type="hidden" value="' .
$nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
return $buf;
}
if ( AIOSEOPPRO ) {
$buf .= '<p><input name="sfwd_update_check" type="submit" value="' . __( 'Check For Updates', 'all-in-one-seo-pack' ) . '" class="button-primary">';
}
function get_exporter_choices() {
return array( 1, 2 );
}
return $buf;
function get_exporter_post_types() {
$post_types = $this->get_post_type_titles();
$rempost = array(
'customize_changeset' => 1,
'custom_css' => 1,
'revision' => 1,
'nav_menu_item' => 1,
);
$post_types = array_diff_key(
$post_types,
$rempost
);
return array_keys( $post_types );
}
}
}

@ -246,7 +246,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
$access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block';
if ( $access ) {
global $aioseop_options;
$sitemap_url = '';
$sitemapurl = '';
$sitemap_filename = $this->get_sitemap_filename();
if ( $sitemap_filename ) {
$sitemapurl = trailingslashit( get_home_url() ) . $sitemap_filename . '.xml';

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save