File manager - Edit - /home/lapakabqaryb6f7f/public_html/wp-content.zip
Back
PK G]J� index.phpnu �[��� <?php // Silence is golden. PK G]\tl| plugins/akismet/.htaccessnu �[��� # Only allow direct access to specific Web-available files. # Apache 2.2 <IfModule !mod_authz_core.c> Order Deny,Allow Deny from all </IfModule> # Apache 2.4 <IfModule mod_authz_core.c> Require all denied </IfModule> # Akismet CSS and JS <FilesMatch "^(form\.js|akismet(-frontend|-admin)?\.js|akismet(-admin)?(-rtl)?\.css|inter\.css)$"> <IfModule !mod_authz_core.c> Allow from all </IfModule> <IfModule mod_authz_core.c> Require all granted </IfModule> </FilesMatch> # Akismet images <FilesMatch "^(logo-a-2x\.png|akismet-refresh-logo\.svg|akismet-refresh-logo@2x\.png|arrow-left\.svg|akismet-activation-banner-elements\.png|copy\.svg)$"> <IfModule !mod_authz_core.c> Allow from all </IfModule> <IfModule mod_authz_core.c> Require all granted </IfModule> </FilesMatch> PK G]���u� � A plugins/akismet/abilities/class-akismet-ability-comment-check.phpnu �[��� <?php /** * Comment Check ability for Akismet. * * @package Akismet * @since 5.7 */ declare( strict_types = 1 ); /** * Class Akismet_Ability_Comment_Check * * Registers and handles the ability to check comments for spam. */ class Akismet_Ability_Comment_Check extends Akismet_Ability implements Akismet_Ability_Interface { /** * Get the ability name. * * @return string The ability name. */ protected function get_ability_name(): string { return 'akismet/comment-check'; } /** * Get the human-readable label. * * @return string The label. */ protected function get_label(): string { return __( 'Check comment for spam', 'akismet' ); } /** * Get the ability description. * * @return string The description. */ protected function get_description(): string { return __( 'Checks a comment against the Akismet spam filter to determine if it is spam or legitimate content.', 'akismet' ); } /** * Get the input schema. * * @return array The input schema. */ protected function get_input_schema(): array { return array( 'type' => 'object', 'properties' => array( 'comment_author' => array( 'type' => 'string', 'description' => __( 'Name of the comment author.', 'akismet' ), ), 'comment_author_email' => array( 'type' => 'string', 'description' => __( 'Email address of the comment author.', 'akismet' ), 'format' => 'email', ), 'comment_author_url' => array( 'type' => 'string', 'description' => __( 'URL/website of the comment author.', 'akismet' ), 'format' => 'uri', ), 'comment_content' => array( 'type' => 'string', 'description' => __( 'The comment content/text.', 'akismet' ), ), 'comment_type' => array( 'type' => 'string', 'description' => __( 'The comment type (e.g., "comment", "trackback", "pingback").', 'akismet' ), 'default' => 'comment', ), 'comment_post_ID' => array( 'type' => 'integer', 'description' => __( 'The ID of the post the comment is being submitted to.', 'akismet' ), ), 'permalink' => array( 'type' => 'string', 'description' => __( 'The permanent link to the post or page.', 'akismet' ), 'format' => 'uri', ), 'user_ip' => array( 'type' => 'string', 'description' => __( 'IP address of the commenter.', 'akismet' ), ), 'user_agent' => array( 'type' => 'string', 'description' => __( 'User agent string of the web browser submitting the comment.', 'akismet' ), ), 'referrer' => array( 'type' => 'string', 'description' => __( 'The HTTP_REFERER header.', 'akismet' ), ), 'user_role' => array( 'type' => 'string', 'description' => __( 'The user role of the comment author if logged in.', 'akismet' ), ), ), 'additionalProperties' => false, ); } /** * Get the output schema. * * @return array The output schema. */ protected function get_output_schema(): array { return array( 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean', 'description' => __( 'Whether the check was successfully performed.', 'akismet' ), ), 'is_spam' => array( 'type' => 'boolean', 'description' => __( 'Whether the comment is identified as spam.', 'akismet' ), ), 'pro_tip' => array( 'type' => 'string', 'description' => __( 'Optional recommendation from Akismet (e.g., "discard" for obvious spam).', 'akismet' ), ), 'guid' => array( 'type' => 'string', 'description' => __( 'Unique identifier for this check, used for webhooks and updates.', 'akismet' ), ), 'error' => array( 'type' => 'string', 'description' => __( 'Error message if the check could not be completed.', 'akismet' ), ), 'debug_help' => array( 'type' => 'string', 'description' => __( 'Debug information to help troubleshoot issues.', 'akismet' ), ), ), 'additionalProperties' => false, ); } /** * Get the ability configuration. * * @return array The ability configuration. */ public function get_config(): array { return array( 'label' => $this->get_label(), 'description' => $this->get_description(), 'category' => Akismet_Abilities::CATEGORY_SLUG, 'input_schema' => $this->get_input_schema(), 'output_schema' => $this->get_output_schema(), 'execute_callback' => array( $this, 'execute' ), 'permission_callback' => array( $this, 'current_user_has_permission' ), 'meta' => array( 'annotations' => array( 'readonly' => true, 'destructive' => false, 'idempotent' => false, ), 'mcp' => array( 'public' => ( get_option( 'akismet_enable_mcp_access' ) === '1' ), 'type' => 'tool', ), 'show_in_rest' => true, ), ); } /** * Execute callback for the comment-check ability. * * @param array|null $input The comment data to check. * @return array|WP_Error The spam check result or error. */ public function execute( ?array $input = null ) { // Check for required API key. if ( ! Akismet::get_api_key() ) { return new WP_Error( 'akismet_not_configured', __( 'Akismet is not configured. Please enter an API key.', 'akismet' ) ); } // Perform the comment check. $result = Akismet::comment_check( $input ); if ( ! $result ) { return new WP_Error( 'comment_check_failed', __( 'Failed to check comment with Akismet API.', 'akismet' ) ); } // Build response array. $response = array( 'success' => true, 'is_spam' => $result->is_spam, ); // Include optional fields if present. if ( isset( $result->pro_tip ) ) { $response['pro_tip'] = $result->pro_tip; } if ( isset( $result->guid ) ) { $response['guid'] = $result->guid; } if ( isset( $result->error ) ) { $response['error'] = $result->error; } if ( isset( $result->debug_help ) ) { $response['debug_help'] = $result->debug_help; } return $response; } } PK G]�]� � = plugins/akismet/abilities/class-akismet-ability-get-stats.phpnu �[��� <?php /** * Get Stats ability for Akismet. * * @package Akismet * @since 5.7 */ declare( strict_types = 1 ); /** * Class Akismet_Ability_Get_Stats * * Registers and handles the ability to retrieve Akismet statistics. */ class Akismet_Ability_Get_Stats extends Akismet_Ability implements Akismet_Ability_Interface { /** * Get the ability name. * * @return string The ability name. */ protected function get_ability_name(): string { return 'akismet/get-stats'; } /** * Get the human-readable label. * * @return string The label. */ protected function get_label(): string { return __( 'Get Akismet statistics', 'akismet' ); } /** * Get the ability description. * * @return string The description. */ protected function get_description(): string { return __( 'Retrieves Akismet spam protection statistics including spam blocked count, accuracy percentage, and other key metrics.', 'akismet' ); } /** * Get the input schema. * * @return array The input schema. */ protected function get_input_schema(): array { return array( 'type' => array( 'object', 'null' ), 'properties' => array( 'interval' => array( 'type' => 'string', 'description' => __( 'The time interval for stats. Options: "6-months", "all", or "60-days".', 'akismet' ), 'enum' => array( '6-months', 'all', '60-days' ), 'default' => '6-months', ), ), 'additionalProperties' => false, ); } /** * Get the output schema. * * @return array The output schema. */ protected function get_output_schema(): array { return array( 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean', 'description' => __( 'Whether the stats were successfully retrieved.', 'akismet' ), ), 'spam' => array( 'type' => 'integer', 'description' => __( 'Total number of spam comments blocked.', 'akismet' ), ), 'ham' => array( 'type' => 'integer', 'description' => __( 'Total number of legitimate comments approved.', 'akismet' ), ), 'missed_spam' => array( 'type' => 'integer', 'description' => __( 'Number of spam comments that were missed.', 'akismet' ), ), 'false_positives' => array( 'type' => 'integer', 'description' => __( 'Number of legitimate comments incorrectly marked as spam.', 'akismet' ), ), 'accuracy' => array( 'type' => 'number', 'description' => __( 'Accuracy percentage of spam detection.', 'akismet' ), ), 'time_saved' => array( 'type' => 'integer', 'description' => __( 'Estimated time saved by Akismet blocking spam, in seconds.', 'akismet' ), ), 'breakdown' => array( 'type' => 'object', 'description' => __( 'Monthly breakdown of statistics.', 'akismet' ), 'additionalProperties' => array( 'type' => 'object', 'properties' => array( 'spam' => array( 'type' => 'integer', 'description' => __( 'Total number of spam comments blocked in this period.', 'akismet' ), ), 'ham' => array( 'type' => 'integer', 'description' => __( 'Total number of legitimate comments approved in this period.', 'akismet' ), ), 'missed_spam' => array( 'type' => 'integer', 'description' => __( 'Number of spam comments that were missed in this period.', 'akismet' ), ), 'false_positives' => array( 'type' => 'integer', 'description' => __( 'Number of legitimate comments incorrectly marked as spam in this period.', 'akismet' ), ), 'da' => array( 'type' => 'string', 'description' => __( 'Date for this period.', 'akismet' ), ), ), ), ), 'interval' => array( 'type' => 'string', 'description' => __( 'The time interval for these stats.', 'akismet' ), ), 'error' => array( 'type' => 'string', 'description' => __( 'Error message if the operation could not be completed.', 'akismet' ), ), ), 'additionalProperties' => false, ); } /** * Get the ability configuration. * * @return array The ability configuration. */ public function get_config(): array { return array( 'label' => $this->get_label(), 'description' => $this->get_description(), 'category' => Akismet_Abilities::CATEGORY_SLUG, 'input_schema' => $this->get_input_schema(), 'output_schema' => $this->get_output_schema(), 'execute_callback' => array( $this, 'execute' ), 'permission_callback' => array( $this, 'current_user_has_permission' ), 'meta' => array( 'annotations' => array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ), 'mcp' => array( 'public' => ( get_option( 'akismet_enable_mcp_access' ) === '1' ), 'type' => 'tool', ), 'show_in_rest' => true, ), ); } /** * Execute callback for the get-stats ability. * * @param array|null $input The input parameters with optional interval. * @return array|WP_Error The stats data or error. */ public function execute( ?array $input = null ) { // Get interval from input or use default. $interval = isset( $input['interval'] ) ? $input['interval'] : '6-months'; // Fetch stats from Akismet API. $data = Akismet::get_stats( $interval ); if ( ! $data ) { return new WP_Error( 'stats_fetch_failed', __( 'Failed to retrieve stats from Akismet API.', 'akismet' ) ); } // Build response with data from API (already properly typed by get_stats). return array_merge( array( 'success' => true, 'interval' => $interval, ), (array) $data ); } } PK G]�� 3 plugins/akismet/abilities/class-akismet-ability.phpnu �[��� <?php /** * Represents a Base Ability. * * This class holds a default constructor to register the ability and a default permission. * * @package Akismet * @since 5.7 */ declare( strict_types = 1 ); /** * Base class for Akismet abilities. * * @package Akismet * @since 5.7 */ abstract class Akismet_Ability implements Akismet_Ability_Interface { /** * Get the ability name. * * Classes extending this must implement this method to provide the ability name into the registration. * * @return string The ability name. */ abstract protected function get_ability_name(): string; /** * Get the config. * * Classes extending this must implement this method to provide the ability configuration into the registration. * * @return array The ability configuration array. */ abstract public function get_config(): array; /** * Constructor - registers the ability. */ public function __construct() { wp_register_ability( $this->get_ability_name(), $this->get_config() ); } // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Base class default, subclasses use $input. /** * Permission callback for any ability that uses this trait. * * @param array|null $input The input parameters (unused). * @return bool Whether the current user can use this ability. */ public function current_user_has_permission( ?array $input = null ): bool { // phpcs:enable Generic.CodeAnalysis.UnusedFunctionParameter.Found return current_user_can( 'moderate_comments' ); } } PK G]�y�>x x 7 plugins/akismet/abilities/interface-akismet-ability.phpnu �[��� <?php /** * Interface for Akismet abilities. * * @package Akismet * @since 5.7 */ declare( strict_types = 1 ); /** * Interface Akismet_Ability_Interface */ interface Akismet_Ability_Interface { /** * Get the ability configuration array. * * Returns the configuration array used to register the ability with wp_register_ability(). * * @return array { * The ability configuration array. * * @type string $label A human-readable name for the ability. Used for display purposes. Should be translatable. * @type string $description A detailed description of what the ability does, its purpose, and its parameters or return values. * This is crucial for AI agents to understand how and when to use the ability. * @type string $category The slug of the category this ability belongs to. The category must be registered before * registering the ability. * @type array $output_schema A JSON Schema definition describing the expected format of the data returned by the ability. * Used for validation and documentation. * @type callable $execute_callback The PHP function or method to execute when this ability is called. Receives optional input * argument matching the input schema type. * @type callable $permission_callback A callback function to check if the current user has permission to execute this ability. * Returns boolean or WP_Error. * @type array $input_schema Optional. JSON Schema defining expected input parameters. Required when the ability accepts inputs. * @type array $meta Optional. An associative array for storing arbitrary additional metadata about the ability, * including 'annotations' (readonly, destructive, idempotent flags) and 'show_in_rest'. * @type string $ability_class Optional. Custom class name extending WP_Ability for behavior customization. * } */ public function get_config(): array; /** * Execute callback for the ability. * * Runs the main functionality of the ability. * * @param array|null $input The input parameters for the ability. Null when no input provided. * @return array|WP_Error The result of the execution or a WP_Error on failure. */ public function execute( ?array $input = null ); /** * Permission callback for the ability. * * Checks if the current user has permission to execute the ability. * * @param array|null $input The input parameters for the ability. Null when no input provided. * @return bool Whether the current user has permission. */ public function current_user_has_permission( ?array $input = null ): bool; } PK G]�Yx: : plugins/akismet/akismet.phpnu �[��� <?php /** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection 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>. Akismet Anti-spam 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: 5.7 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly if ( ! function_exists( 'add_action' ) ) { echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; exit; } define( 'AKISMET_VERSION', '5.7' ); define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' ); define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'AKISMET_DELETE_LIMIT', 10000 ); register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) ); 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'; require_once AKISMET__PLUGIN_DIR . 'class-akismet-compatible-plugins.php'; add_action( 'init', array( 'Akismet', 'init' ) ); add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) ); add_action( 'init', array( 'Akismet_Compatible_Plugins', 'init' ) ); if ( function_exists( 'wp_get_connectors' ) ) { require_once AKISMET__PLUGIN_DIR . 'class-akismet-connector.php'; add_action( 'init', array( 'Akismet_Connector', 'init' ) ); } /** * Conditionally loads for a WordPress 6.9+ installation, which has * access to the core Abilities API. Only register abilities if Akismet * is set up with an API key (either predefined or configured). */ if ( function_exists( 'wp_register_ability' ) ) { require_once AKISMET__PLUGIN_DIR . 'class-akismet-abilities.php'; add_action( 'init', function () { if ( Akismet::get_api_key() ) { Akismet_Abilities::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' ) ); } // add wrapper class around deprecated akismet functions that are referenced elsewhere require_once AKISMET__PLUGIN_DIR . 'wrapper.php'; if ( defined( 'WP_CLI' ) && WP_CLI ) { require_once AKISMET__PLUGIN_DIR . 'class.akismet-cli.php'; } PK G] ���S[ S[ plugins/akismet/changelog.txtnu �[��� === Akismet Anti-spam === == Archived Changelog Entries == This file contains older changelog entries, so we can keep the size of the standard WordPress readme.txt file reasonable. For the latest changes, please see the "Changelog" section of the [readme.txt file](https://plugins.svn.wordpress.org/akismet/trunk/readme.txt). = 4.2.5 = *Release Date - 11 July 2022* * Fixed a bug that added unnecessary comment history entries after comment rechecks. * Added a notice that displays when WP-Cron is disabled and might be affecting comment rechecks. = 4.2.4 = *Release Date - 20 May 2022* * Improved translator instructions for comment history. * Bumped the "Tested up to" tag to WP 6.0. = 4.2.3 = *Release Date - 25 April 2022* * Improved compatibility with Fluent Forms * Fixed missing translation domains * Updated stats URL. * Improved accessibility of elements on the config page. = 4.2.2 = *Release Date - 24 January 2022* * Improved compatibility with Formidable Forms * Fixed a bug that could cause issues when multiple contact forms appear on one page. * Updated delete_comment and deleted_comment actions to pass two arguments to match WordPress core since 4.9.0. * Added a filter that allows comment types to be excluded when counting users' approved comments. = 4.2.1 = *Release Date - 1 October 2021* * Fixed a bug causing AMP validation to fail on certain pages with forms. = 4.2 = *Release Date - 30 September 2021* * Added links to additional information on API usage notifications. * Reduced the number of network requests required for a comment page when running Akismet. * Improved compatibility with the most popular contact form plugins. * Improved API usage buttons for clarity on what upgrade is needed. = 4.1.12 = *Release Date - 3 September 2021* * Fixed "Use of undefined constant" notice. * Improved styling of alert notices. = 4.1.11 = *Release Date - 23 August 2021* * Added support for Akismet API usage notifications on Akismet settings and edit-comments admin pages. * Added support for the deleted_comment action when bulk-deleting comments from Spam. = 4.1.10 = *Release Date - 6 July 2021* * Simplified the code around checking comments in REST API and XML-RPC requests. * Updated Plus plan terminology in notices to match current subscription names. * Added `rel="noopener"` to the widget link to avoid warnings in Google Lighthouse. * Set the Akismet JavaScript as deferred instead of async to improve responsiveness. * Improved the preloading of screenshot popups on the edit comments admin page. = 4.1.9 = *Release Date - 2 March 2021* * Improved handling of pingbacks in XML-RPC multicalls = 4.1.8 = *Release Date - 6 January 2021* * Fixed missing fields in submit-spam and submit-ham calls that could lead to reduced accuracy. * Fixed usage of deprecated jQuery function. = 4.1.7 = *Release Date - 22 October 2020* * Show the "Set up your Akismet account" banner on the comments admin screen, where it's relevant to mention if Akismet hasn't been configured. * Don't use wp_blacklist_check when the new wp_check_comment_disallowed_list function is available. = 4.1.6 = *Release Date - 4 June 2020* * Disable "Check for Spam" button until the page is loaded to avoid errors with clicking through to queue recheck endpoint directly. * Added filter "akismet_enable_mshots" to allow disabling screenshot popups on the edit comments admin page. = 4.1.5 = *Release Date - 29 April 2020* * Based on user feedback, we have dropped the in-admin notice explaining the availability of the "privacy notice" option in the AKismet settings screen. The option itself is available, but after displaying the notice for the last 2 years, it is now considered a known fact. * Updated the "Requires at least" to WP 4.6, based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet * Moved older changelog entries to a separate file to keep the size of this readme reasonable, also based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet = 4.1.4 = *Release Date - 17 March 2020* * Only redirect to the Akismet setup screen upon plugin activation if the plugin was activated manually from within the plugin-related screens, to help users with non-standard install workflows, like WP-CLI. * Update the layout of the initial setup screen to be more readable on small screens. * If no API key has been entered, don't run code that expects an API key. * Improve the readability of the comment history entries. * Don't modify the comment form HTML if no API key has been set. = 4.1.3 = *Release Date - 31 October 2019* * Prevented an attacker from being able to cause a user to unknowingly recheck their Pending comments for spam. * Improved compatibility with Jetpack 7.7+. * Updated the plugin activation page to use consistent language and markup. * Redirecting users to the Akismet connnection/settings screen upon plugin activation, in an effort to make it easier for people to get setup. = 4.1.2 = *Release Date - 14 May 2019* * Fixed a conflict between the Akismet setup banner and other plugin notices. * Reduced the number of API requests made by the plugin when attempting to verify the API key. * Include additional data in the pingback pre-check API request to help make the stats more accurate. * Fixed a bug that was enabling the "Check for Spam" button when no comments were eligible to be checked. * Improved Akismet's AMP compatibility. = 4.1.1 = *Release Date - 31 January 2019* * Fixed the "Setup Akismet" notice so it resizes responsively. * Only highlight the "Save Changes" button in the Akismet config when changes have been made. * The count of comments in your spam queue shown on the dashboard show now always be up-to-date. = 4.1 = *Release Date - 12 November 2018* * Added a WP-CLI method for retrieving stats. * Hooked into the new "Personal Data Eraser" functionality from WordPress 4.9.6. * Added functionality to clear outdated alerts from Akismet.com. = 4.0.8 = *Release Date - 19 June 2018* * Improved the grammar and consistency of the in-admin privacy related notes (notice and config). * Revised in-admin explanation of the comment form privacy notice to make its usage clearer. * Added `rel="nofollow noopener"` to the comment form privacy notice to improve SEO and security. = 4.0.7 = *Release Date - 28 May 2018* * Based on user feedback, the link on "Learn how your comment data is processed." in the optional privacy notice now has a `target` of `_blank` and opens in a new tab/window. * Updated the in-admin privacy notice to use the term "comment" instead of "contact" in "Akismet can display a notice to your users under your comment forms." * Only show in-admin privacy notice if Akismet has an API Key configured = 4.0.6 = *Release Date - 26 May 2018* * Moved away from using `empty( get_option() )` to instantiating a variable to be compatible with older versions of PHP (5.3, 5.4, etc). = 4.0.5 = *Release Date - 26 May 2018* * Corrected version number after tagging. Sorry... = 4.0.4 = *Release Date - 26 May 2018* * Added a hook to provide Akismet-specific privacy information for a site's privacy policy. * Added tools to control the display of a privacy related notice under comment forms. * Fixed HTML in activation failure message to close META and HEAD tag properly. * Fixed a bug that would sometimes prevent Akismet from being correctly auto-configured. = 4.0.3 = *Release Date - 19 February 2018* * Added a scheduled task to remove entries in wp_commentmeta that no longer have corresponding comments in wp_comments. * Added a new `akismet_batch_delete_count` action to the batch delete methods for people who'd like to keep track of the numbers of records being processed by those methods. = 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* * Added a WP-CLI module. You can now check comments and recheck the moderation queue from the command line. * Stopped using the deprecated jQuery function `.live()`. * Fixed a bug in `remove_comment_author_url()` and `add_comment_author_url()` that could generate PHP notices. * Fixed a bug that could cause an infinite loop for sites with very very very large comment IDs. * Fixed a bug that could cause the Akismet widget title to be blank. = 3.1.11 = *Release Date - 12 May 2016* * Fixed a bug that could cause the "Check for Spam" button to skip some comments. * Fixed a bug that could prevent some spam submissions from being sent to Akismet. * Updated all links to use https:// when possible. * Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled. = 3.1.10 = *Release Date - 1 April 2016* * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. * Fixed a bug that could have resulted in comments that were caught by the core WordPress comment blacklist not to have a corresponding History entry. * Fixed a bug that could have caused avoidable PHP warnings in the error log. = 3.1.9 = *Release Date - 28 March 2016* * Add compatibility with Jetpack so that Jetpack can automatically configure Akismet settings when appropriate. * Fixed a bug preventing some comment data from being sent to Akismet. = 3.1.8 = *Release Date - 4 March 2016* * Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs. * Reduced the amount of bandwidth used on Akismet API calls * Reduced the amount of space Akismet uses in the database * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. = 3.1.7 = *Release Date - 4 January 2016* * Added documentation for the 'akismet_comment_nonce' filter. * The post-install activation button is now accessible to screen readers and keyboard-only users. * Fixed a bug that was preventing the "Remove author URL" feature from working in WordPress 4.4 = 3.1.6 = *Release Date - 14 December 2015* * Improve the notices shown after activating Akismet. * Update some strings to allow for the proper plural forms in all languages. = 3.1.5 = *Release Date - 13 October 2015* * Closes a potential XSS vulnerability. = 3.1.4 = *Release Date - 24 September 2015* * Fixed a bug that was preventing some users from automatically connecting using Jetpack if they didn't have a current Akismet subscription. * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. * Error messages and instructions have been simplified to be more understandable. * Link previews are enabled for all links inside comments, not just the author's website link. = 3.1.3 = *Release Date - 6 July 2015* * Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens. = 3.1.2 = *Release Date - 7 June 2015* * Reduced the amount of space Akismet uses in the commentmeta table. * Fixed a bug where some comments with quotes in the author name weren't getting history entries * Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation. * Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted. * When deactivating the plugin, notify the Akismet API so the site can be marked as inactive. * Clearer error messages. = 3.1.1 = *Release Date - 17th March, 2015* * Improvements to the "Remove comment author URL" JavaScript * Include the pingback pre-check from the 2.6 branch. = 3.1 = *Release Date - 11th March, 2015* * Use HTTPS by default for all requests to Akismet. * Fix for a situation where Akismet might strip HTML from a comment. = 3.0.4 = *Release Date - 11th December, 2014* * Fix to make .htaccess compatible with Apache 2.4. * Fix to allow removal of https author URLs. * Fix to avoid stripping part of the author URL when removing and re-adding. * Removed the "Check for Spam" button from the "Trash" and "Approved" queues, where it would have no effect. * Allow automatic API key configuration when Jetpack is installed and connected to a WordPress.com account = 3.0.3 = *Release Date - 3rd November, 2014* * Fix for sending the wrong data to delete_comment action that could have prevented old spam comments from being deleted. * Added a filter to disable logging of Akismet debugging information. * Added a filter for the maximum comment age when deleting old spam comments. * Added a filter for the number per batch when deleting old spam comments. * Removed the "Check for Spam" button from the Spam folder. = 3.0.2 = *Release Date - 18th August, 2014* * Performance improvements. * Fixed a bug that could truncate the comment data being sent to Akismet for checking. = 3.0.1 = *Release Date - 9th July, 2014* * Removed dependency on PHP's fsockopen function * Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app * Remove jQuery dependency for comment form JavaScript * Remove unnecessary data from some Akismet comment meta * Suspended keys will now result in all comments being put in moderation, not spam. = 3.0.0 = *Release Date - 15th April, 2014* * Move Akismet to Settings menu * Drop Akismet Stats menu * Add stats snapshot to Akismet settings * Add Akismet subscription details and status to Akismet settings * Add contextual help for each page * Improve Akismet setup to use Jetpack to automate plugin setup * Fix "Check for Spam" to use AJAX to avoid page timing out * Fix Akismet settings page to be responsive * Drop legacy code * Tidy up CSS and Javascript * Replace the old discard setting with a new "discard pervasive spam" feature. = 2.6.0 = *Release Date - 18th March, 2014* * Add ajax paging to the check for spam button to handle large volumes of comments * Optimize javascript and add localization support * Fix bug in link to spam comments from right now dashboard widget * Fix bug with deleting old comments to avoid timeouts dealing with large volumes of comments * Include X-Pingback-Forwarded-For header in outbound WordPress pingback verifications * Add pre-check for pingbacks, to stop spam before an outbound verification request is made = 2.5.9 = *Release Date - 1st August, 2013* * Update 'Already have a key' link to redirect page rather than depend on javascript * Fix some non-translatable strings to be translatable * Update Activation banner in plugins page to redirect user to Akismet config page = 2.5.8 = *Release Date - 20th January, 2013* * Simplify the activation process for new users * Remove the reporter_ip parameter * Minor preventative security improvements = 2.5.7 = *Release Date - 13th December, 2012* * FireFox Stats iframe preview bug * Fix mshots preview when using https * Add .htaccess to block direct access to files * Prevent some PHP notices * Fix Check For Spam return location when referrer is empty * Fix Settings links for network admins * Fix prepare() warnings in WP 3.5 = 2.5.6 = *Release Date - 26th April, 2012* * Prevent retry scheduling problems on sites where wp_cron is misbehaving * Preload mshot previews * Modernize the widget code * Fix a bug where comments were not held for moderation during an error condition * Improve the UX and display when comments are temporarily held due to an error * Make the Check For Spam button force a retry when comments are held due to an error * Handle errors caused by an invalid key * Don't retry comments that are too old * Improve error messages when verifying an API key = 2.5.5 = *Release Date - 11th January, 2012* * Add nonce check for comment author URL remove action * Fix the settings link = 2.5.4 = *Release Date - 5th January, 2012* * Limit Akismet CSS and Javascript loading in wp-admin to just the pages that need it * Added author URL quick removal functionality * Added mShot preview on Author URL hover * Added empty index.php to prevent directory listing * Move wp-admin menu items under Jetpack, if it is installed * Purge old Akismet comment meta data, default of 15 days = 2.5.3 = *Release Date - 8th Febuary, 2011* * Specify the license is GPL v2 or later * Fix a bug that could result in orphaned commentmeta entries * Include hotfix for WordPress 3.0.5 filter issue = 2.5.2 = *Release Date - 14th January, 2011* * Properly format the comment count for author counts * Look for super admins on multisite installs when looking up user roles * Increase the HTTP request timeout * Removed padding for author approved count * Fix typo in function name * Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side. = 2.5.1 = *Release Date - 17th December, 2010* * Fix a bug that caused the "Auto delete" option to fail to discard comments correctly * Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce * Fixed padding bug in "author" column of posts screen * Added margin-top to "cleared by ..." badges on dashboard * Fix possible error when calling akismet_cron_recheck() * Fix more PHP warnings * Clean up XHTML warnings for comment nonce * Fix for possible condition where scheduled comment re-checks could get stuck * Clean up the comment meta details after deleting a comment * Only show the status badge if the comment status has been changed by someone/something other than Akismet * Show a 'History' link in the row-actions * Translation fixes * Reduced font-size on author name * Moved "flagged by..." notification to top right corner of comment container and removed heavy styling * Hid "flagged by..." notification while on dashboard = 2.5.0 = *Release Date - 7th December, 2010* * Track comment actions under 'Akismet Status' on the edit comment screen * Fix a few remaining deprecated function calls ( props Mike Glendinning ) * Use HTTPS for the stats IFRAME when wp-admin is using HTTPS * Use the WordPress HTTP class if available * Move the admin UI code to a separate file, only loaded when needed * Add cron retry feature, to replace the old connectivity check * Display Akismet status badge beside each comment * Record history for each comment, and display it on the edit page * Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham * Highlight links in comment content * New option, "Show the number of comments you've approved beside each comment author." * New option, "Use a nonce on the comment form." = 2.4.0 = *Release Date - 23rd August, 2010* * Spell out that the license is GPLv2 * Fix PHP warnings * Fix WordPress deprecated function calls * Fire the delete_comment action when deleting comments * Move code specific for older WP versions to legacy.php * General code clean up = 2.3.0 = *Release Date - 5th June, 2010* * Fix "Are you sure" nonce message on config screen in WPMU * Fix XHTML compliance issue in sidebar widget * Change author link; remove some old references to WordPress.com accounts * Localize the widget title (core ticket #13879) = 2.2.9 = *Release Date - 2nd June, 2010* * Eliminate a potential conflict with some plugins that may cause spurious reports = 2.2.8 = *Release Date - 27th May, 2010* * Fix bug in initial comment check for ipv6 addresses * Report comments as ham when they are moved from spam to moderation * Report comments as ham when clicking undo after spam * Use transition_comment_status action when available instead of older actions for spam/ham submissions * Better diagnostic messages when PHP network functions are unavailable * Better handling of comments by logged-in users = 2.2.7 = *Release Date - 17th December, 2009* * Add a new AKISMET_VERSION constant * Reduce the possibility of over-counting spam when another spam filter plugin is in use * Disable the connectivity check when the API key is hard-coded for WPMU = 2.2.6 = *Release Date - 20th July, 2009* * Fix a global warning introduced in 2.2.5 * Add changelog and additional readme.txt tags * Fix an array conversion warning in some versions of PHP * Support a new WPCOM_API_KEY constant for easier use with WordPress MU = 2.2.5 = *Release Date - 13th July, 2009* * Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls = 2.2.4 = *Release Date - 3rd June, 2009* * Fixed a key problem affecting the stats feature in WordPress MU * Provide additional blog information in Akismet API calls PK G]w�]S1 1 + plugins/akismet/class-akismet-abilities.phpnu �[��� <?php /** * Registers Akismet abilities with the WordPress Abilities API. * * @package Akismet * @since 5.7 */ declare( strict_types = 1 ); // Load ability interface and classes. require_once __DIR__ . '/abilities/interface-akismet-ability.php'; require_once __DIR__ . '/abilities/class-akismet-ability.php'; require_once __DIR__ . '/abilities/class-akismet-ability-get-stats.php'; require_once __DIR__ . '/abilities/class-akismet-ability-comment-check.php'; /** * Class Akismet_Abilities * * Registers Akismet abilities with the WordPress Abilities API. * Provides abilities for spam detection and comment moderation. */ class Akismet_Abilities { /** * The category slug for Akismet abilities. * * @var string */ const CATEGORY_SLUG = 'akismet'; /** * Initialize the ability registration. * * @return void */ public static function init() { // Register category. if ( did_action( 'wp_abilities_api_categories_init' ) ) { self::register_category(); } else { add_action( 'wp_abilities_api_categories_init', array( __CLASS__, 'register_category' ) ); } // Register abilities. if ( did_action( 'wp_abilities_api_init' ) ) { self::register_abilities(); } else { add_action( 'wp_abilities_api_init', array( __CLASS__, 'register_abilities' ) ); } } /** * Register the Akismet ability category. * * @return void */ public static function register_category() { if ( ! function_exists( 'wp_register_ability_category' ) ) { return; } wp_register_ability_category( self::CATEGORY_SLUG, array( 'label' => 'Akismet', 'description' => __( 'Abilities for spam protection and comment moderation with Akismet.', 'akismet' ), ) ); } /** * Register all Akismet abilities. * * @return void */ public static function register_abilities() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } $abilities = array( Akismet_Ability_Get_Stats::class, Akismet_Ability_Comment_Check::class, ); foreach ( $abilities as $ability_class ) { new $ability_class(); } } } PK G]�֨�V V 4 plugins/akismet/class-akismet-compatible-plugins.phpnu �[��� <?php /** * Handles compatibility checks for Akismet with other plugins. * * @package Akismet * @since 5.4.0 */ declare( strict_types = 1 ); // Following existing Akismet convention for file naming. // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase /** * Class for managing compatibility checks for Akismet with other plugins. * * This class includes methods for determining whether specific plugins are * installed and active relative to the ability to work with Akismet. */ class Akismet_Compatible_Plugins { /** * The endpoint for the compatible plugins API. * * @var string */ protected const COMPATIBLE_PLUGIN_ENDPOINT = 'https://rest.akismet.com/1.2/compatible-plugins'; /** * The error key for the compatible plugins API error. * * @var string */ protected const COMPATIBLE_PLUGIN_API_ERROR = 'akismet_compatible_plugins_api_error'; /** * The valid fields for a compatible plugin object. * * @var array */ protected const COMPATIBLE_PLUGIN_FIELDS = array( 'slug', 'name', 'logo', 'help_url', 'path', ); /** * The cache key for the compatible plugins. * * @var string */ protected const CACHE_KEY = 'akismet_compatible_plugin_list'; /** * How many plugins should be visible by default? * * @var int */ public const DEFAULT_VISIBLE_PLUGIN_COUNT = 2; /** * Get the list of active, installed compatible plugins. * * @param bool $bypass_cache Whether to bypass the cache and fetch fresh data. * @return WP_Error|array { * Array of active, installed compatible plugins with their metadata. * @type string $name The display name of the plugin * @type string $help_url URL to the plugin's help documentation * @type string $logo URL or path to the plugin's logo * } */ public static function get_installed_compatible_plugins( bool $bypass_cache = false ) { // Retrieve and validate the full compatible plugins list. $compatible_plugins = static::get_compatible_plugins( $bypass_cache ); if ( empty( $compatible_plugins ) ) { return new WP_Error( self::COMPATIBLE_PLUGIN_API_ERROR, __( 'Error getting compatible plugins.', 'akismet' ) ); } // Retrieve all installed plugins once. $all_plugins = get_plugins(); // Build list of compatible plugins that are both installed and active. $active_compatible_plugins = array(); foreach ( $compatible_plugins as $slug => $data ) { $path = $data['path']; // Skip if not installed. if ( ! isset( $all_plugins[ $path ] ) ) { continue; } // Check activation: per-site or network-wide (multisite). $site_active = is_plugin_active( $path ); $network_active = is_multisite() && is_plugin_active_for_network( $path ); if ( $site_active || $network_active ) { $active_compatible_plugins[ $slug ] = $data; } } return $active_compatible_plugins; } /** * Initializes action hooks for the class. * * @return void */ public static function init(): void { add_action( 'activated_plugin', array( static::class, 'handle_plugin_change' ), true ); add_action( 'deactivated_plugin', array( static::class, 'handle_plugin_change' ), true ); } /** * Handles plugin activation and deactivation events. * * @param string $plugin The path to the main plugin file from plugins directory. * @return void */ public static function handle_plugin_change( string $plugin ): void { $cached_plugins = static::get_cached_plugins(); /** * Terminate if nothing's cached. */ if ( false === $cached_plugins ) { return; } $plugin_change_should_invalidate_cache = in_array( $plugin, array_column( $cached_plugins, 'path' ) ); /** * Purge the cache if the plugin is activated or deactivated. */ if ( $plugin_change_should_invalidate_cache ) { static::purge_cache(); } } /** * Gets plugins that are compatible with Akismet from the Akismet API. * * @param bool $bypass_cache Whether to bypass the cache and fetch fresh data. * @return array */ private static function get_compatible_plugins( bool $bypass_cache = false ): array { // Return cached result if present (false => cache miss; empty array is valid). $cached_plugins = static::get_cached_plugins(); if ( false !== $cached_plugins && ! $bypass_cache ) { return $cached_plugins; } $response = wp_remote_get( self::COMPATIBLE_PLUGIN_ENDPOINT ); $sanitized = static::validate_compatible_plugin_response( $response ); if ( false === $sanitized ) { return array(); } /** * Sets local static associative array of plugin data keyed by plugin slug. */ $compatible_plugins = array(); foreach ( $sanitized as $plugin ) { $compatible_plugins[ $plugin['slug'] ] = $plugin; } static::set_cached_plugins( $compatible_plugins ); return $compatible_plugins; } /** * Validates a response object from the Compatible Plugins API. * * @param array|WP_Error $response * @return array|false */ private static function validate_compatible_plugin_response( $response ) { /** * Terminates the function if the response is a WP_Error object. */ if ( is_wp_error( $response ) ) { return false; } /** * The response returned is an array of header + body string data. * This pops off the body string for processing. */ $response_body = wp_remote_retrieve_body( $response ); if ( empty( $response_body ) ) { return false; } $plugins = json_decode( $response_body, true ); if ( false === is_array( $plugins ) ) { return false; } foreach ( $plugins as $plugin ) { if ( ! is_array( $plugin ) ) { /** * Skips to the next iteration if for some reason the plugin is not an array. */ continue; } // Ensure that the plugin config read in from the API has all the required fields. $plugin_key_count = count( array_intersect_key( $plugin, array_flip( static::COMPATIBLE_PLUGIN_FIELDS ) ) ); $does_not_have_all_required_fields = ! ( $plugin_key_count === count( static::COMPATIBLE_PLUGIN_FIELDS ) ); if ( $does_not_have_all_required_fields ) { return false; } if ( false === static::has_valid_plugin_path( $plugin['path'] ) ) { return false; } } return static::sanitize_compatible_plugin_response( $plugins ); } /** * Validates a plugin path format. * * The path should be in the format of 'plugin-name/plugin-name.php'. * Allows alphanumeric characters, dashes, underscores, and optional dots in folder names. * * @param string $path * @return bool */ private static function has_valid_plugin_path( string $path ): bool { return preg_match( '/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9_-]+\.php$/', $path ) === 1; } /** * Sanitizes a response object from the Compatible Plugins API. * * @param array $plugins * @return array */ private static function sanitize_compatible_plugin_response( array $plugins = array() ): array { foreach ( $plugins as $key => $plugin ) { $plugins[ $key ] = array_map( 'sanitize_text_field', $plugin ); $plugins[ $key ]['help_url'] = sanitize_url( $plugins[ $key ]['help_url'] ); $plugins[ $key ]['logo'] = sanitize_url( $plugins[ $key ]['logo'] ); } return $plugins; } /** * @param array $plugins * @return bool */ private static function set_cached_plugins( array $plugins ): bool { $_blog_id = (int) get_current_blog_id(); return set_transient( static::CACHE_KEY . "_$_blog_id", $plugins, DAY_IN_SECONDS ); } /** * Attempts to get cached compatible plugins. * * @return mixed|false */ private static function get_cached_plugins() { $_blog_id = (int) get_current_blog_id(); return get_transient( static::CACHE_KEY . "_$_blog_id" ); } /** * Purges the cache for the compatible plugins. * * @return bool */ private static function purge_cache(): bool { $_blog_id = (int) get_current_blog_id(); return delete_transient( static::CACHE_KEY . "_$_blog_id" ); } } PK G]Ǯ߆� � + plugins/akismet/class-akismet-connector.phpnu �[��� <?php /** * Akismet Connector integration. * * @package Akismet */ declare( strict_types = 1 ); /** * Integrates Akismet with the WordPress Connectors framework, * handling API key validation and connection status reporting. */ class Akismet_Connector { /** * Register hooks for the WordPress Connectors integration. */ public static function init() { add_action( 'wp_connectors_init', array( 'Akismet_Connector', 'register_connector' ) ); // Priority 9 so we validate the real key before core's connector masking filter at priority 10. add_filter( 'rest_post_dispatch', array( 'Akismet_Connector', 'validate_api_key' ), 9, 3 ); add_filter( 'script_module_data_options-connectors-wp-admin', array( 'Akismet_Connector', 'set_connected_status' ), 11 ); // Invalidate the connector key status cache on any key change. foreach ( array( 'add', 'update', 'delete' ) as $action ) { add_action( "{$action}_option_wordpress_api_key", array( 'Akismet_Connector', 'invalidate_key_status_cache' ) ); } } /** * Validate the Akismet API key when saved via the connectors REST settings endpoint. * If the key is invalid, revert it to an empty string. * * @param WP_REST_Response $response The response object. * @param WP_REST_Server $server The server instance. * @param WP_REST_Request $request The request object. * @return WP_REST_Response */ public static function validate_api_key( $response, $server, $request ) { if ( '/wp/v2/settings' !== $request->get_route() ) { return $response; } if ( 'POST' !== $request->get_method() && 'PUT' !== $request->get_method() ) { return $response; } $data = $response->get_data(); if ( ! is_array( $data ) || ! array_key_exists( 'wordpress_api_key', $data ) ) { return $response; } $key = $data['wordpress_api_key']; if ( ! is_string( $key ) || '' === $key ) { return $response; } if ( Akismet::KEY_STATUS_INVALID === Akismet::verify_key( $key ) ) { update_option( 'wordpress_api_key', '' ); $data['wordpress_api_key'] = ''; $response->set_data( $data ); } return $response; } /** * Set the isConnected status for the Akismet connector based on actual key validity. * * @param array $data Script module data. * @return array */ public static function set_connected_status( $data ) { if ( ! isset( $data['connectors']['akismet']['authentication'] ) ) { return $data; } $key = Akismet::get_api_key(); if ( empty( $key ) ) { $data['connectors']['akismet']['authentication']['isConnected'] = false; return $data; } $is_connected = get_transient( 'akismet_connector_key_status' ); if ( false === $is_connected ) { $is_connected = Akismet::verify_key( $key ); // Don't cache failures (e.g. network timeouts) so we retry on the next page load. if ( Akismet::KEY_STATUS_FAILED !== $is_connected ) { set_transient( 'akismet_connector_key_status', $is_connected, DAY_IN_SECONDS ); } } $data['connectors']['akismet']['authentication']['isConnected'] = ( Akismet::KEY_STATUS_VALID === $is_connected ); return $data; } /** * Clear the connector key status cache so it doesn't serve stale data. */ public static function invalidate_key_status_cache() { delete_transient( 'akismet_connector_key_status' ); } /** * Register the Akismet connector with an is_active callback so the * connectors page can detect Akismet as active when installed as a mu-plugin. * * We re-register the full connector rather than patching the core one * so that Akismet still has a connector even if core removes its own. * * @see https://github.com/WordPress/gutenberg/pull/76994 * * @param WP_Connector_Registry $registry Connector registry instance. */ public static function register_connector( $registry ) { if ( method_exists( $registry, 'is_registered' ) && $registry->is_registered( 'akismet' ) ) { $registry->unregister( 'akismet' ); } $registry->register( 'akismet', array( 'name' => __( 'Akismet Anti-spam', 'akismet' ), 'description' => __( 'Protect your site from spam.', 'akismet' ), 'type' => 'spam_filtering', 'plugin' => array( 'file' => 'akismet/akismet.php', 'is_active' => function () { return defined( 'AKISMET_VERSION' ); }, ), 'authentication' => array( 'method' => 'api_key', 'credentials_url' => 'https://akismet.com/get/', 'setting_name' => 'wordpress_api_key', 'constant_name' => 'WPCOM_API_KEY', ), ) ); } } PK G]��a� � '