v1.1.0
This commit is contained in:
parent
a157afe625
commit
02cd01e862
20 changed files with 1365 additions and 646 deletions
|
|
@ -221,16 +221,22 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
<label for="ai-translator-translate-content">
|
||||
<input type="checkbox" id="ai-translator-translate-content" name="ai_translator_settings[translate_content]" value="1" <?php checked( $current['translate_content'] ); ?> />
|
||||
<?php echo esc_html__( 'Translate content', 'robotstxt-ai-translator' ); ?>
|
||||
</label><br />
|
||||
|
||||
<label for="ai-translator-translate-excerpt">
|
||||
<input type="checkbox" id="ai-translator-translate-excerpt" name="ai_translator_settings[translate_excerpt]" value="1" <?php checked( $current['translate_excerpt'] ); ?> />
|
||||
<?php echo esc_html__( 'Translate excerpt', 'robotstxt-ai-translator' ); ?>
|
||||
</label>
|
||||
|
||||
<?php if ( is_multisite() ) : ?>
|
||||
<p class="description">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: title default, 2: content default. */
|
||||
esc_html__( 'Network defaults: title %1$s, content %2$s.', 'robotstxt-ai-translator' ),
|
||||
/* translators: 1: title default, 2: content default, 3: excerpt default. */
|
||||
esc_html__( 'Network defaults: title %1$s, content %2$s, excerpt %3$s.', 'robotstxt-ai-translator' ),
|
||||
isset( $defaults['translate_title'] ) && $defaults['translate_title'] ? esc_html__( 'enabled', 'robotstxt-ai-translator' ) : esc_html__( 'disabled', 'robotstxt-ai-translator' ),
|
||||
isset( $defaults['translate_content'] ) && $defaults['translate_content'] ? esc_html__( 'enabled', 'robotstxt-ai-translator' ) : esc_html__( 'disabled', 'robotstxt-ai-translator' )
|
||||
isset( $defaults['translate_content'] ) && $defaults['translate_content'] ? esc_html__( 'enabled', 'robotstxt-ai-translator' ) : esc_html__( 'disabled', 'robotstxt-ai-translator' ),
|
||||
isset( $defaults['translate_excerpt'] ) && $defaults['translate_excerpt'] ? esc_html__( 'enabled', 'robotstxt-ai-translator' ) : esc_html__( 'disabled', 'robotstxt-ai-translator' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
|
@ -238,6 +244,26 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( class_exists( '\Inpsyde\MultilingualPress\TranslationUi\Post\MetaboxAction' ) ) : ?>
|
||||
<tr>
|
||||
<th scope="row"><?php echo esc_html__( 'MultilingualPress', 'robotstxt-ai-translator' ); ?></th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php echo esc_html__( 'MultilingualPress', 'robotstxt-ai-translator' ); ?></legend>
|
||||
|
||||
<label for="ai-translator-auto-translate-mlp">
|
||||
<input type="checkbox" id="ai-translator-auto-translate-mlp" name="ai_translator_settings[auto_translate_on_mlp_create]" value="1" <?php checked( $current['auto_translate_on_mlp_create'] ); ?> />
|
||||
<?php echo esc_html__( 'Auto-translate new connected posts', 'robotstxt-ai-translator' ); ?>
|
||||
</label>
|
||||
|
||||
<p class="description">
|
||||
<?php echo esc_html__( 'When MultilingualPress creates a new connected post, automatically translate its enabled fields into the target site\'s language. The translation runs synchronously during save.', 'robotstxt-ai-translator' ); ?>
|
||||
</p>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
@ -315,6 +341,11 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
<label for="ai-translator-net-translate-content">
|
||||
<input type="checkbox" id="ai-translator-net-translate-content" name="ai_translator_settings[translate_content]" value="1" <?php checked( $network['translate_content'] ); ?> />
|
||||
<?php echo esc_html__( 'Translate content', 'robotstxt-ai-translator' ); ?>
|
||||
</label><br />
|
||||
|
||||
<label for="ai-translator-net-translate-excerpt">
|
||||
<input type="checkbox" id="ai-translator-net-translate-excerpt" name="ai_translator_settings[translate_excerpt]" value="1" <?php checked( $network['translate_excerpt'] ); ?> />
|
||||
<?php echo esc_html__( 'Translate excerpt', 'robotstxt-ai-translator' ); ?>
|
||||
</label>
|
||||
|
||||
<p class="description">
|
||||
|
|
@ -323,6 +354,26 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( class_exists( '\Inpsyde\MultilingualPress\TranslationUi\Post\MetaboxAction' ) ) : ?>
|
||||
<tr>
|
||||
<th scope="row"><?php echo esc_html__( 'MultilingualPress', 'robotstxt-ai-translator' ); ?></th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php echo esc_html__( 'MultilingualPress', 'robotstxt-ai-translator' ); ?></legend>
|
||||
|
||||
<label for="ai-translator-net-auto-translate-mlp">
|
||||
<input type="checkbox" id="ai-translator-net-auto-translate-mlp" name="ai_translator_settings[auto_translate_on_mlp_create]" value="1" <?php checked( $network['auto_translate_on_mlp_create'] ); ?> />
|
||||
<?php echo esc_html__( 'Auto-translate new connected posts', 'robotstxt-ai-translator' ); ?>
|
||||
</label>
|
||||
|
||||
<p class="description">
|
||||
<?php echo esc_html__( 'When MultilingualPress creates a new connected post, automatically translate its enabled fields into the target site\'s language. The translation runs synchronously during save.', 'robotstxt-ai-translator' ); ?>
|
||||
</p>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
@ -514,6 +565,11 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
/**
|
||||
* Sanitises a raw settings array into a strict boolean schema.
|
||||
*
|
||||
* This is the single sanitisation boundary for all form input from both the
|
||||
* site and network settings pages. Raw POST values arrive via wp_unslash()
|
||||
* and are converted here to strict booleans. Any new field added to this
|
||||
* schema MUST be sanitised in this method before being stored.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array<string,mixed> $raw Raw input from the form.
|
||||
|
|
@ -522,8 +578,10 @@ if ( ! class_exists( 'AI_Translator_Admin' ) ) {
|
|||
*/
|
||||
private function sanitize_settings( array $raw ) {
|
||||
return array(
|
||||
'translate_title' => ! empty( $raw['translate_title'] ),
|
||||
'translate_content' => ! empty( $raw['translate_content'] ),
|
||||
'translate_title' => ! empty( $raw['translate_title'] ),
|
||||
'translate_content' => ! empty( $raw['translate_content'] ),
|
||||
'translate_excerpt' => ! empty( $raw['translate_excerpt'] ),
|
||||
'auto_translate_on_mlp_create' => ! empty( $raw['auto_translate_on_mlp_create'] ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue