v1.2.4
This commit is contained in:
parent
5cd5900111
commit
44e2366e16
7 changed files with 97 additions and 24 deletions
|
|
@ -1,5 +1,39 @@
|
|||
== Changelog ==
|
||||
|
||||
= 1.2.4 =
|
||||
|
||||
_Release date: 2026-11-04_
|
||||
|
||||
**Highlights**
|
||||
|
||||
* WordPress 7.2 compatibility, including the refactored native AI client. PHP support documented up to 8.6.
|
||||
|
||||
**Fixed**
|
||||
|
||||
* "Request timeout" setting was ignored whenever the WordPress AI client passes an explicit request timeout to the HTTP API (observed on WordPress 7.2, whose AI client was refactored onto a shared builder base class): explicit arguments bypass the `http_request_timeout` filter the plugin relied on. The configured timeout is now also applied through the `wp_ai_client_default_request_timeout` filter (available since WordPress 7.0), so the setting works identically on WordPress 7.0 through 7.2+.
|
||||
* Settings `request_timeout` values stored as non-numeric garbage now fall back to the schema default (60 s) instead of being cast to `0`.
|
||||
|
||||
**Changed**
|
||||
|
||||
* Tested up to WordPress 7.2. The plugin was verified against the WordPress 7.2 development tree (7.2-beta4): the AI client's public API used by the plugin (`wp_ai_client_prompt()`, `using_system_instruction()`, `generate_text()`, `is_supported_for_text_generation()`, `wp_supports_ai()`) is unchanged — the builder methods are now proxied through a shared `WP_AI_Client_Builder` base class.
|
||||
* Minimum PHP version raised from 5.6 to 8.3 (ROBOTSTXT ecosystem support floor). For the record, the code still passes a full-range PHPCompatibility 5.6-8.6 scan — 8.3 is a support-policy decision, not a code limitation.
|
||||
* PHP support documented up to 8.6. Verified with PHPCompatibility and the full test suite on PHP 8.6.
|
||||
* Static analysis raised to the maximum strictness: PHPStan now runs at `level: max` (10 as of PHPStan 2.3) with zero errors and no baseline. Tooling updated (PHPStan 2.3.5, WordPress stubs 7.1, PHPUnit 9.6.38); no runtime dependencies were added.
|
||||
|
||||
**Compatibility**
|
||||
|
||||
* WordPress: 7.0 - 7.2
|
||||
* PHP: 8.3 - 8.6
|
||||
* WP-CLI: 2.12 or newer
|
||||
|
||||
**Tests**
|
||||
|
||||
* PHP Coding Standards: WordPress-Core, WordPress-Docs, WordPress-Extra (0 errors, 0 warnings)
|
||||
* PHPCompatibility: 8.3 - 8.6 (declared range) and 5.6 - 8.6 (informational full range) — 0 errors
|
||||
* PHPStan: level max/10, no baseline (incl. wp-compat @ Requires at least 7.0)
|
||||
* PHPUnit: 64/64 tests passing (single-site) on WordPress 7.2-beta4 / PHP 8.6, including new tests for both request-timeout filters
|
||||
* composer audit: no known CVEs
|
||||
|
||||
= 1.2.3 =
|
||||
|
||||
_Release date: 2026-08-24_
|
||||
|
|
|
|||
|
|
@ -654,7 +654,9 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array<string,mixed> $raw Raw input from the form.
|
||||
* @param array<mixed> $raw Raw input from the form. Keys are never trusted:
|
||||
* only the known schema keys are read, so integer
|
||||
* keys and unexpected values are ignored.
|
||||
*
|
||||
* @return array<string,bool|int>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -208,7 +208,10 @@ if ( ! class_exists( 'AI_Translator_Settings' ) ) {
|
|||
foreach ( self::DEFAULTS as $key => $default ) {
|
||||
if ( array_key_exists( $key, $settings ) ) {
|
||||
if ( is_int( $default ) ) {
|
||||
$normalized[ $key ] = (int) $settings[ $key ];
|
||||
$value = $settings[ $key ];
|
||||
// Reject non-numeric input instead of casting it: garbage
|
||||
// falls back to the schema default.
|
||||
$normalized[ $key ] = is_numeric( $value ) ? (int) $value : $default;
|
||||
} else {
|
||||
$normalized[ $key ] = (bool) $settings[ $key ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,31 @@ if ( ! class_exists( 'AI_Translator_Translator' ) ) {
|
|||
return is_numeric( $timeout ) ? (int) $timeout : 30;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the wp_ai_client_default_request_timeout value while an AI
|
||||
* translation call is in progress. Registered and de-registered by
|
||||
* translate() around each call.
|
||||
*
|
||||
* Since WordPress 7.2 the AI client builders pass an explicit request
|
||||
* timeout to the WordPress HTTP API (default 30 s). Explicit arguments
|
||||
* bypass the http_request_timeout filter, so the configured plugin
|
||||
* timeout must be injected through this filter to stay effective on
|
||||
* WordPress 7.0 through 7.2+ (the filter exists since 7.0).
|
||||
*
|
||||
* @since 1.2.4
|
||||
*
|
||||
* @param int|float|string|null $default_timeout Default timeout in seconds.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function filter_ai_default_timeout( $default_timeout ) {
|
||||
if ( null !== $this->active_timeout ) {
|
||||
return $this->active_timeout;
|
||||
}
|
||||
|
||||
return is_numeric( $default_timeout ) ? (int) $default_timeout : 30;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether AI features are enabled for this WordPress installation.
|
||||
*
|
||||
|
|
@ -113,7 +138,10 @@ if ( ! class_exists( 'AI_Translator_Translator' ) ) {
|
|||
* Translates a single piece of text to the target locale.
|
||||
*
|
||||
* Applies the configured request_timeout via the http_request_timeout filter
|
||||
* for the duration of the AI call, then restores the previous timeout.
|
||||
* and, since 1.2.4, via the wp_ai_client_default_request_timeout filter
|
||||
* (required on WP 7.2+, where the AI client passes an explicit timeout that
|
||||
* bypasses http_request_timeout) for the duration of the AI call, then
|
||||
* restores the previous timeout.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
|
|
@ -158,10 +186,13 @@ if ( ! class_exists( 'AI_Translator_Translator' ) ) {
|
|||
$language_name
|
||||
);
|
||||
|
||||
// Apply the configured request timeout around the AI call.
|
||||
// Apply the configured request timeout around the AI call. Both filters
|
||||
// are needed: WP 7.2+ AI client requests carry an explicit timeout that
|
||||
// bypasses http_request_timeout (see filter_ai_default_timeout()).
|
||||
$site_settings = $this->settings->get_settings();
|
||||
$this->active_timeout = max( 30, (int) $site_settings['request_timeout'] );
|
||||
add_filter( 'http_request_timeout', array( $this, 'filter_timeout' ), PHP_INT_MAX );
|
||||
add_filter( 'wp_ai_client_default_request_timeout', array( $this, 'filter_ai_default_timeout' ), PHP_INT_MAX );
|
||||
|
||||
try {
|
||||
$result = wp_ai_client_prompt( $text )
|
||||
|
|
@ -174,6 +205,7 @@ if ( ! class_exists( 'AI_Translator_Translator' ) ) {
|
|||
}
|
||||
|
||||
remove_filter( 'http_request_timeout', array( $this, 'filter_timeout' ), PHP_INT_MAX );
|
||||
remove_filter( 'wp_ai_client_default_request_timeout', array( $this, 'filter_ai_default_timeout' ), PHP_INT_MAX );
|
||||
$this->active_timeout = null;
|
||||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
# This file is distributed under the GPL-3.0-or-later.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: AI Translator (by ROBOTSTXT) 1.2.3\n"
|
||||
"Project-Id-Version: AI Translator (by ROBOTSTXT) 1.2.4\n"
|
||||
"Report-Msgid-Bugs-To: https://www.robotstxt.software/plugins/robotstxt-ai-translator/\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2026-08-24T11:03:38+00:00\n"
|
||||
"POT-Creation-Date: 2026-11-04T15:09:57+00:00\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"X-Generator: WP-CLI 2.12.0\n"
|
||||
"X-Domain: robotstxt-ai-translator\n"
|
||||
|
|
@ -319,12 +319,12 @@ msgstr ""
|
|||
#: includes/class-ai-translator-cli.php:145
|
||||
#: includes/class-ai-translator-editor-ui.php:427
|
||||
#: includes/class-ai-translator-editor-ui.php:563
|
||||
#: includes/class-ai-translator-translator.php:135
|
||||
#: includes/class-ai-translator-translator.php:163
|
||||
msgid "AI features are disabled for this WordPress installation."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class-ai-translator-cli.php:149
|
||||
#: includes/class-ai-translator-translator.php:142
|
||||
#: includes/class-ai-translator-translator.php:170
|
||||
msgid "No AI provider is configured for text generation. Open Settings → AI to set one up."
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -419,17 +419,17 @@ msgstr ""
|
|||
msgid "Dismiss this notice"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class-ai-translator-translator.php:151
|
||||
#: includes/class-ai-translator-translator.php:179
|
||||
msgid "The target language is not installed on this site."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: target language name.
|
||||
#: includes/class-ai-translator-translator.php:157
|
||||
#: includes/class-ai-translator-translator.php:185
|
||||
#, php-format
|
||||
msgid "You are a professional translator. Translate the user message into %s. Preserve any HTML, shortcodes, line breaks, and Markdown exactly as they appear. Return only the translated text, without explanations, prefaces, or quotation marks."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class-ai-translator-translator.php:186
|
||||
#: includes/class-ai-translator-translator.php:218
|
||||
msgid "The AI service returned an unexpected response."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
22
readme.txt
22
readme.txt
|
|
@ -2,9 +2,9 @@
|
|||
Contributors: robotstxt, javiercasares
|
||||
Tags: ai, translation, multilingual, multisite, editor
|
||||
Requires at least: 7.0
|
||||
Tested up to: 7.1
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 1.2.3
|
||||
Tested up to: 7.2
|
||||
Requires PHP: 8.3
|
||||
Stable tag: 1.2.4
|
||||
License: GPL-3.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ The endpoint reads the **saved** title and content from the database, not from t
|
|||
= Requirements =
|
||||
|
||||
* WordPress 7.0 or higher (the `wp_ai_client_prompt()` function is part of WordPress core since 7.0).
|
||||
* PHP 5.6 or higher.
|
||||
* PHP 8.3 or higher.
|
||||
* At least one AI provider configured in Settings → AI. The plugin works with any provider registered through the WordPress AI client — no specific AI plugin is required.
|
||||
|
||||
= Manual download =
|
||||
|
|
@ -134,14 +134,20 @@ The plugin reads the post title and content from the database, not from the edit
|
|||
|
||||
== Compatibility ==
|
||||
|
||||
* WordPress: 7.0 - 7.1
|
||||
* PHP: 5.6 - 8.5
|
||||
* WordPress: 7.0 - 7.2
|
||||
* PHP: 8.3 - 8.6
|
||||
* WP-CLI: 2.12 or newer
|
||||
|
||||
== Changelog ==
|
||||
|
||||
Only the 3 last versions. The full changelog will be at changelog.txt
|
||||
|
||||
= 1.2.4 =
|
||||
|
||||
* Confirmed compatibility with WordPress 7.2 (including the refactored AI client, which now proxies the builder methods through a shared base class) and with PHP 8.6.
|
||||
* Fixed the "Request timeout" setting being ignored whenever the WordPress AI client passes an explicit request timeout that bypasses the `http_request_timeout` filter (observed on WordPress 7.2). The plugin now also applies the timeout through the `wp_ai_client_default_request_timeout` filter (available since WordPress 7.0).
|
||||
* Raised the minimum PHP version from 5.6 to 8.3. The code itself still passes a full PHPCompatibility 5.6-8.6 scan; 8.3 is the supported ecosystem floor. Maximum documented PHP version: 8.6.
|
||||
|
||||
= 1.2.3 =
|
||||
|
||||
* Manager (by ROBOTSTXT) detection now uses the ecosystem presence constant `ROBOTSTXT_MANAGER_NOTICED` (Manager 1.6.2+) instead of scanning the plugin list, falling back to the plugin-list scan for older Manager versions.
|
||||
|
|
@ -153,10 +159,6 @@ Only the 3 last versions. The full changelog will be at changelog.txt
|
|||
* Changed the Plugin URI and Update URI to `https://www.robotstxt.software/plugins/robotstxt-ai-translator/`.
|
||||
* Lowered the minimum PHP version from 7.4 to 5.6 (verified with PHPCompatibility 5.6-8.5). WordPress 7.0+ remains the minimum WordPress version because the plugin uses the native WordPress AI client.
|
||||
|
||||
= 1.2.1 =
|
||||
|
||||
* Confirmed compatibility with WordPress 7.1. No functional changes.
|
||||
|
||||
= Previous versions =
|
||||
|
||||
If you want to see the full changelog, visit the [changelog](https://www.robotstxt.software/plugins/robotstxt-ai-translator/) page.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-ai-translator/
|
||||
* Update URI: https://www.robotstxt.software/plugins/robotstxt-ai-translator/
|
||||
* Description: Translate post titles and content from the editor using the native WordPress AI client (available in WP 7.0+). Multisite-ready with global or per-site configuration.
|
||||
* Version: 1.2.3
|
||||
* Version: 1.2.4
|
||||
* Author: ROBOTSTXT
|
||||
* Author URI: https://www.robotstxt.software/
|
||||
* License: GPL-3.0-or-later
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
* Text Domain: robotstxt-ai-translator
|
||||
* Domain Path: /languages
|
||||
* Requires at least: 7.0
|
||||
* Requires PHP: 5.6
|
||||
* Requires PHP: 8.3
|
||||
* Network: true
|
||||
*
|
||||
* @package ROBOTSTXT\AI_Translator
|
||||
|
|
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
/**
|
||||
* Plugin version.
|
||||
*/
|
||||
define( 'AI_TRANSLATOR_VERSION', '1.2.3' );
|
||||
define( 'AI_TRANSLATOR_VERSION', '1.2.4' );
|
||||
|
||||
/**
|
||||
* Main plugin file path.
|
||||
|
|
|
|||
Loading…
Reference in a new issue