Changeset 3483107
- Timestamp:
- 03/15/2026 01:18:49 PM (3 weeks ago)
- Location:
- natural-text-to-speech/trunk
- Files:
-
- 19 added
- 15 deleted
- 4 edited
-
components/block.php (added)
-
components/cache-compat.php (added)
-
components/implement-plugin.php (modified) (3 diffs)
-
constants.php (modified) (1 diff)
-
natural-text-to-speech.php (modified) (3 diffs)
-
public/js/ntts-admin-v2.6.8-main.js (deleted)
-
public/js/ntts-admin-v2.6.8-vendor.js (deleted)
-
public/js/ntts-admin-v2.6.9-main.js (added)
-
public/js/ntts-admin-v2.6.9-vendor.js (added)
-
public/js/ntts-block-editor-v2.6.9.js (added)
-
public/js/ntts-public-v2.6.8-main.js (deleted)
-
public/js/ntts-public-v2.6.8-vendor.js (deleted)
-
public/js/ntts-public-v2.6.9-main.js (added)
-
public/js/ntts-public-v2.6.9-vendor.js (added)
-
public/js/ntts-shortcode-editor-v2.6.9.js (added)
-
public/js/nttsa-00506a12.js (added)
-
public/js/nttsa-0ee09f0d.js (added)
-
public/js/nttsa-18bf2853.js (deleted)
-
public/js/nttsa-2bc4a826.js (added)
-
public/js/nttsa-31217516.js (added)
-
public/js/nttsa-38258eb4.js (added)
-
public/js/nttsa-3af4abef.js (added)
-
public/js/nttsa-3ff61d58.js (added)
-
public/js/nttsa-4540ed88.js (deleted)
-
public/js/nttsa-4d279764.js (deleted)
-
public/js/nttsa-56c7638d.js (deleted)
-
public/js/nttsa-657a9e19.js (deleted)
-
public/js/nttsa-6cb45e8a.js (added)
-
public/js/nttsa-82158227.js (added)
-
public/js/nttsa-9a2d1975.js (added)
-
public/js/nttsa-bfb339ea.js (deleted)
-
public/js/nttsa-d05ebe13.js (deleted)
-
public/js/nttsa-d124b2c3.js (deleted)
-
public/js/nttsa-d27828d8.js (deleted)
-
public/js/nttsa-d6d8c914.js (deleted)
-
public/js/nttsa-e764f45a.js (added)
-
public/js/nttsa-ed997e61.js (deleted)
-
readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
natural-text-to-speech/trunk/components/implement-plugin.php
r3481905 r3483107 34 34 35 35 add_filter( 'the_content', 'natuteto_append_shortcode_to_content' ); 36 37 /** 38 * Return the default shortcode attributes for the TTS player. 39 * 40 * @return array 41 */ 42 function natuteto_get_shortcode_default_attributes() { 43 return array( 44 'description' => null, 45 'lang' => null, 46 'auto-embed' => null, 47 'target-tts-direction' => null, 48 'target-tts-selector' => null, 49 'src' => null, 50 'only-show' => null, 51 'trigger-play' => null, 52 ); 53 } 54 55 /** 56 * Shared renderer for shortcode and Gutenberg block output. 57 * 58 * @param array $atts Shortcode-compatible attributes. 59 * @param string|null $content Optional JSON config payload. 60 * @return string 61 */ 62 function natuteto_render_tts_embed_markup( $atts, $content = null ) { 63 global $post; 64 65 $default_attribute = natuteto_get_shortcode_default_attributes(); 66 $atts = shortcode_atts( $default_attribute, $atts ); 67 68 $post_categories = array(); 69 70 if ( $post instanceof WP_Post ) { 71 $post_categories = wp_get_post_terms( 72 $post->ID, 73 'category', 74 array( 'fields' => 'slugs' ) 75 ); 76 } 77 78 $attributes = ''; 79 foreach ( $default_attribute as $key => $default ) { 80 if ( ! empty( $atts[ $key ] ) ) { 81 $data_key = esc_attr( "data-$key" ); 82 $data_val = esc_attr( $atts[ $key ] ); 83 $attributes .= " {$data_key}=\"{$data_val}\""; 84 } 85 } 86 87 if ( $content ) { 88 $config = json_decode( natuteto_normalize_json_string_for_decode( $content ), true ); 89 90 if ( json_last_error() !== JSON_ERROR_NONE ) { 91 return "<div class='natural-tts-error'>Invalid JSON in shortcode</div>"; 92 } 93 } else { 94 $config = natuteto_get_plugin_config(); 95 } 96 97 if ( $config && isset( $config['exclude_from_post_categories'] ) ) { 98 $excluded = (array) $config['exclude_from_post_categories']; 99 100 if ( array_intersect( $excluded, $post_categories ) ) { 101 return ''; 102 } 103 } 104 105 if ( ! $content ) { 106 return sprintf( 107 '<div class="' . NATUTETO_SHORTCODE_CLASS . '"%s>🔊</div>', 108 $attributes 109 ); 110 } 111 112 $encoded = esc_attr( wp_json_encode( $config ) ); 113 114 return sprintf( 115 '<div class="' . NATUTETO_SHORTCODE_CLASS . '" %s data-config="%s">🔊</div>', 116 $attributes, 117 $encoded 118 ); 119 } 36 120 37 121 /** … … 78 162 } 79 163 80 // Read more about shortcode attributes: https://wordpress.org/plugins/natural-text-to-speech. 81 $default_attribute = array( 82 'description' => null, 83 'lang' => null, 84 'auto-embed' => null, 85 'target-tts-direction' => null, 86 'target-tts-selector' => null, 87 'src' => null, 88 'only-show' => null, 89 'trigger-play' => null, 90 ); 91 92 $atts = shortcode_atts( $default_attribute, $atts ); 93 94 // Category exclusion logic. 95 $post_categories = array(); 96 97 if ( $post instanceof WP_Post ) { 98 $post_categories = wp_get_post_terms( 99 $post->ID, 100 'category', 101 array( 'fields' => 'slugs' ) 102 ); 103 } 104 105 // Build HTML attributes. 106 $attributes = ''; 107 foreach ( $default_attribute as $key => $default ) { 108 if ( ! empty( $atts[ $key ] ) ) { 109 $data_key = esc_attr( "data-$key" ); 110 $data_val = esc_attr( $atts[ $key ] ); 111 $attributes .= " {$data_key}=\"{$data_val}\""; 112 } 113 } 114 115 if ( $content ) { 116 $config = json_decode( natuteto_normalize_json_string_for_decode( $content ), true ); 117 118 if ( json_last_error() !== JSON_ERROR_NONE ) { 119 return "<div class='natural-tts-error'>Invalid JSON in shortcode</div>"; 120 } 121 } else { 122 $config = natuteto_get_plugin_config(); 123 } 124 125 if ( $config ) { 126 if ( isset( $config['exclude_from_post_categories'] ) ) { 127 $excluded = (array) $config['exclude_from_post_categories']; 128 129 // If any category matches, don't render the shortcode. 130 if ( array_intersect( $excluded, $post_categories ) ) { 131 return ''; // skip rendering. 132 } 133 } 134 } 135 136 if ( ! $content ) { 137 return sprintf( 138 '<div class="' . NATUTETO_SHORTCODE_CLASS . '"%s>🔊</div>', 139 $attributes 140 ); 141 } 142 143 $encoded = esc_attr( wp_json_encode( $config ) ); 144 145 return sprintf( 146 '<div class="' . NATUTETO_SHORTCODE_CLASS . '" %s data-config="%s">🔊</div>', 147 $attributes, 148 $encoded 149 ); 164 return natuteto_render_tts_embed_markup( $atts, $content ); 150 165 } 151 166 … … 192 207 $auto_embed_types = isset( $config['auto_add_for_post_types'] ) ? (array) $config['auto_add_for_post_types'] : array(); 193 208 if ( in_array( $post->post_type, $auto_embed_types, true ) ) { 209 return true; 210 } 211 212 if ( function_exists( 'has_block' ) && has_block( NATUTETO_BLOCK_NAME, $post ) ) { 194 213 return true; 195 214 } -
natural-text-to-speech/trunk/constants.php
r3481905 r3483107 69 69 70 70 const NATUTETO_SHORTCODE_CLASS = 'natural-tts'; 71 72 const NATUTETO_BLOCK_NAME = NATUTETO_PLUGIN_PREFIX . '/player'; 71 73 72 74 /** -
natural-text-to-speech/trunk/natural-text-to-speech.php
r3481905 r3483107 4 4 * Plugin URI: https://wordpress.org/plugins/natural-text-to-speech 5 5 * Description: Read aloud your posts using natural, human-like voices and highlights sentences and words as they are spoken. Available in Free and Pro versions! Start now with 20,000 free characters / month. 6 * Version: 2.6. 86 * Version: 2.6.9 7 7 * Author: Reinvent WP 8 8 * Author URI: https://reinventwp.com … … 20 20 * serious issues with the options, so no if ( ! defined() ).}} 21 21 */ 22 define( 'NATUTETO_VERSION', '2.6. 8' );22 define( 'NATUTETO_VERSION', '2.6.9' ); 23 23 24 24 if ( ! defined( 'NATUTETO_PLUGIN_DIR' ) ) { … … 109 109 require_once plugin_dir_path( __FILE__ ) . 'components/utils.php'; 110 110 111 // Cache and optimizer compatibility hooks. 112 require_once plugin_dir_path( __FILE__ ) . 'components/cache-compat.php'; 113 114 // Gutenberg block integration. 115 require_once plugin_dir_path( __FILE__ ) . 'components/block.php'; 116 111 117 // Implementation of the plugin to the post. 112 118 require_once plugin_dir_path( __FILE__ ) . 'components/implement-plugin.php'; -
natural-text-to-speech/trunk/readme.txt
r3481905 r3483107 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 2.6. 87 Version: 2.6. 86 Stable tag: 2.6.9 7 Version: 2.6.9 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 18 18 Designed as a flexible multi-provider TTS bridge, Reinvent WP Text to Speech (formerly Natural Text To Speech) allows you to switch voice engines without changing plugins. Generate audio automatically, export posts to MP3, and enable sentence-by-sentence playback with intelligent caching. 19 19 20 Ideal for news sites, educational platforms, accessibility-focused websites, a nd agencies managing multiple client installations.20 Ideal for news sites, educational platforms, accessibility-focused websites, agencies managing multiple client installations, and content-heavy WooCommerce stores. 21 21 22 22 **Simple, Powerful Audio: Install now and see the play button on your posts in seconds!** … … 69 69 * **Marketing** - Create compelling voice ads and audio clips from your written marketing copy. 70 70 * **SEO Optimization** - Increase time-on-site by giving users the option to listen to audio. 71 * **WooCommerce Content** - Add listenable audio to product descriptions and other WooCommerce product content. 71 72 72 73 === Supported Languages === … … 313 314 314 315 Yes. The plugin inserts its player with a shortcode, so it will show on top of your posts. No template editing is required. 316 317 = Does it work with WooCommerce? = 318 319 Yes. You can use Reinvent WP Text To Speech with WooCommerce product content because the plugin supports custom post types, including products, alongside posts and pages. 315 320 316 321 = Can I customise the player’s colors, size, or position? = … … 420 425 * Advanced Analytics: Completion Rate Metrics 421 426 * Audio Schema Markup (SEO) 427 * Add the player with the Gutenberg block editor 422 428 * Any suggestion? [fill this form](https://reinventwp.com/feedback) 423 429 … … 485 491 == Changelog == 486 492 493 = 2.6.9 = 494 * Add the player with the Gutenberg block editor 495 487 496 = 2.6.8 = 488 497 * Audio Schema Markup (SEO)
Note: See TracChangeset
for help on using the changeset viewer.