Changeset 3798980
- Timestamp:
- 11/12/2026 05:52:52 PM (less than one hour ago)
- Location:
- axial-audio-post-narration/trunk
- Files:
-
- 5 edited
-
assets/front.css (modified) (1 diff)
-
axial-audio-post-narration.php (modified) (3 diffs)
-
includes/class-nasc-admin.php (modified) (2 diffs)
-
includes/class-nasc-frontend.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
axial-audio-post-narration/trunk/assets/front.css
r3775419 r3798980 97 97 /* 1.3.4: mode choice remains visible in the shared single-frame toolbar. */ 98 98 .axial-components-media-bar .nasc-modern-modes,.axial-components-media-bar .nasc-modern-single-mode{display:inline-flex!important;visibility:visible!important;flex-shrink:0!important} 99 100 /* Card-only audio summary controls (opt-in). */ 101 .nasc-card-audio{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:9px;max-width:100%;margin:12px 0 4px;padding:8px 10px;border-radius:8px;background:#f3f6f9;color:#24313b;min-height:44px;box-sizing:border-box;z-index:2;} 102 .nasc-card-audio .nasc-audio-button{position:relative;flex:none;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;min-width:34px;min-height:34px;border:0;border-radius:50%;background:var(--nasc-button-color,#10bce8);color:#fff;cursor:pointer;padding:0;} 103 .nasc-card-audio .nasc-card-audio-label{font-size:12px;font-weight:600;line-height:1.35;} 104 .nasc-card-audio .nasc-card-audio-duration{font-size:11px;opacity:.72;margin-left:auto;} 105 .nasc-card-audio .nasc-audio-element{display:none;} 106 .nasc-card-audio button:focus-visible{outline:2px solid #1976d2;outline-offset:3px;} 107 108 109 /* 1.3.9 - Compact and restrained audio controls exclusively in news cards. 110 Overrides the generic narration bar (which intentionally has !important rules). */ 111 .nasc-audio-summary.nasc-card-audio { 112 display: inline-flex !important; 113 vertical-align: middle !important; 114 align-items: center !important; 115 justify-content: center !important; 116 gap: 7px !important; 117 width: auto !important; 118 max-width: calc(100% - 16px) !important; 119 min-height: 34px !important; 120 margin: 8px auto 4px !important; 121 padding: 3px 10px 3px 4px !important; 122 border: 1px solid #e0e4e9 !important; 123 border-radius: 999px !important; 124 background: #fff !important; 125 color: #596471 !important; 126 box-shadow: none !important; 127 font: 500 11px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif !important; 128 text-decoration: none !important; 129 isolation: isolate; 130 } 131 .nasc-card-audio .nasc-audio-button { 132 display: inline-flex !important; 133 align-items: center !important; 134 justify-content: center !important; 135 width: 26px !important; 136 height: 26px !important; 137 min-width: 26px !important; 138 min-height: 26px !important; 139 flex: 0 0 26px !important; 140 margin: 0 !important; 141 padding: 0 !important; 142 background: transparent !important; 143 color: var(--nasc-button-color, #687781) !important; 144 border: 1px solid currentColor !important; 145 border-radius: 50% !important; 146 box-shadow: none !important; 147 transition: background .15s ease,color .15s ease !important; 148 } 149 .nasc-card-audio .nasc-audio-button:hover { 150 background: var(--nasc-button-color, #687781) !important; 151 color: #fff !important; 152 } 153 .nasc-card-audio .nasc-audio-button:focus-visible { 154 outline: 2px solid var(--nasc-button-color, #687781) !important; 155 outline-offset: 2px !important; 156 } 157 .nasc-card-audio .nasc-audio-play-icon { 158 display: block !important; 159 font-size: 10px !important; 160 line-height: 1 !important; 161 transform: translateX(1px); 162 } 163 .nasc-card-audio .nasc-audio-button[aria-pressed="true"] .nasc-audio-play-icon { 164 font-size: 0 !important; 165 transform: none !important; 166 } 167 .nasc-card-audio .nasc-audio-button[aria-pressed="true"] .nasc-audio-play-icon::before { 168 content: "Ⅱ"; 169 font-size: 11px !important; 170 font-weight: 800; 171 } 172 .nasc-card-audio .nasc-card-audio-label { 173 font-size: 11px !important; 174 font-weight: 500 !important; 175 line-height: 1.3 !important; 176 white-space: nowrap; 177 color: inherit !important; 178 } 179 .nasc-card-audio .nasc-card-audio-duration { 180 margin-left: 0 !important; 181 padding-left: 7px !important; 182 border-left: 1px solid #e0e4e9; 183 font-size: 10px !important; 184 font-variant-numeric: tabular-nums; 185 color: #7d8994 !important; 186 opacity: 1 !important; 187 } 188 .nasc-card-audio .nasc-audio-element { display: none !important; } 189 @media (max-width: 420px) { 190 .nasc-audio-summary.nasc-card-audio { margin-top: 7px !important; } 191 } 192 193 /* 1.3.10: place the compact summary player in its own centered row before the card title. */ 194 .nasc-card-audio-slot { 195 display: flex !important; 196 justify-content: center !important; 197 align-items: center !important; 198 width: 100% !important; 199 margin: 10px 0 8px !important; 200 box-sizing: border-box; 201 position: relative; 202 z-index: 3; 203 } 204 .nasc-card-audio-slot .nasc-audio-summary.nasc-card-audio { 205 margin: 0 !important; 206 } -
axial-audio-post-narration/trunk/axial-audio-post-narration.php
r3775419 r3798980 3 3 * Plugin Name: AXIAL Audio Post Narration 4 4 * Description: Adds AI-generated audio summaries or full-read narration to published WordPress posts using the Nebula Audio service. 5 * Version: 1.3. 55 * Version: 1.3.10 6 6 * Requires at least: 6.0 7 7 * Requires PHP: 7.4 … … 146 146 147 147 148 define('NASC_VERSION', '1.3. 5');148 define('NASC_VERSION', '1.3.10'); 149 149 define('NASC_FILE', __FILE__); 150 150 define('NASC_DIR', plugin_dir_path(__FILE__)); … … 191 191 'dual_full_placement' => 'before', 192 192 'show_in_excerpts' => 0, 193 'show_in_cards' => 0, 193 194 'auto_generate' => 0, 194 195 'post_types' => ['post'], -
axial-audio-post-narration/trunk/includes/class-nasc-admin.php
r3774178 r3798980 131 131 } 132 132 $out['show_in_excerpts'] = !empty($input['show_in_excerpts']) ? 1 : 0; 133 $out['show_in_cards'] = !empty($input['show_in_cards']) ? 1 : 0; 133 134 $out['auto_generate'] = !empty($input['auto_generate']) ? 1 : 0; 134 135 $out['download_local'] = !empty($input['download_local']) ? 1 : 0; … … 256 257 </td></tr> 257 258 <tr><th>Listados / extractos</th><td><label><input type="checkbox" name="<?php echo esc_attr(NASC_OPTION); ?>[show_in_excerpts]" value="1" <?php checked(!empty($s['show_in_excerpts'])); ?>> Agregar el botón también después del extracto cuando el tema usa <code>the_excerpt()</code></label></td></tr> 259 <tr><th>Tarjetas de noticias</th><td> 260 <label><input type="checkbox" name="<?php echo esc_attr(NASC_OPTION); ?>[show_in_cards]" value="1" <?php checked(!empty($s['show_in_cards'])); ?>> Mostrar Play de audio resumen en tarjetas de noticias</label> 261 <p class="description">Sólo aparece si el post publicado tiene un audio resumen disponible. Compatible con tarjetas estándar y Elementor Posts / Loop Grid. No reproduce audios de lectura completa. Desactivado por defecto.</p> 262 </td></tr> 258 263 <tr><th>Consulta de jobs</th><td>Cada <input class="small-text" type="number" min="10" max="120" name="<?php echo esc_attr(NASC_OPTION); ?>[poll_delay]" value="<?php echo esc_attr($s['poll_delay']); ?>"> segundos, hasta <input class="small-text" type="number" min="5" max="120" name="<?php echo esc_attr(NASC_OPTION); ?>[max_polls]" value="<?php echo esc_attr($s['max_polls']); ?>"> intentos.</td></tr> 259 264 </table> -
axial-audio-post-narration/trunk/includes/class-nasc-frontend.php
r3775419 r3798980 12 12 add_action('wp_enqueue_scripts', [__CLASS__, 'enqueue_assets'], 5); 13 13 add_action('wp_footer', [__CLASS__, 'render_floating_player'], 99); 14 add_action('wp_ajax_nasc_card_audio', [__CLASS__, 'ajax_card_audio']); 15 add_action('wp_ajax_nopriv_nasc_card_audio', [__CLASS__, 'ajax_card_audio']); 14 16 } 15 17 … … 23 25 if (!self::is_amp_request()) { 24 26 wp_enqueue_script('nasc-front', NASC_URL . 'assets/front.js', [], NASC_VERSION, true); 25 } 27 $settings = nasc_get_settings(); 28 // News grids also appear inside regular WordPress pages (is_singular() is true there). 29 // Exclude only individual blog posts; include pages containing Elementor grids. 30 if (!empty($settings['show_in_cards']) && !is_singular('post')) { 31 wp_enqueue_script('nasc-cards', NASC_URL . 'assets/cards.js', ['nasc-front'], NASC_VERSION, true); 32 wp_add_inline_script('nasc-cards', 'window.nascCardAudio=' . wp_json_encode([ 33 'endpoint' => admin_url('admin-ajax.php'), 34 'nonce' => wp_create_nonce('nasc_card_audio'), 35 'label' => 'Escuchar resumen', 36 'color' => sanitize_hex_color($settings['button_color'] ?? '') ?: '#10bce8', 37 ]) . ';', 'before'); 38 } 39 40 } 41 } 42 43 /** Public, read-only: exposes audio URLs only for published posts with a summary. */ 44 public static function ajax_card_audio() { 45 if (!check_ajax_referer('nasc_card_audio', 'nonce', false)) { 46 wp_send_json_error(['message' => 'Invalid request'], 403); 47 } 48 $settings = nasc_get_settings(); 49 if (empty($settings['show_in_cards'])) { 50 wp_send_json_success(['items' => []]); 51 } 52 $raw_ids = isset($_POST['ids']) ? (array) wp_unslash($_POST['ids']) : []; 53 $ids = array_slice(array_unique(array_filter(array_map('absint', $raw_ids))), 0, 40); 54 $raw_urls = isset($_POST['urls']) ? (array) wp_unslash($_POST['urls']) : []; 55 $urls = array_slice(array_unique(array_filter(array_map('esc_url_raw', $raw_urls))), 0, 40); 56 $site_host = strtolower((string) wp_parse_url(home_url('/'), PHP_URL_HOST)); 57 $url_ids = []; 58 foreach ($urls as $permalink) { 59 $host = strtolower((string) wp_parse_url($permalink, PHP_URL_HOST)); 60 $scheme = strtolower((string) wp_parse_url($permalink, PHP_URL_SCHEME)); 61 if (!$host || $host !== $site_host || !in_array($scheme, ['http', 'https'], true)) { continue; } 62 $id = absint(url_to_postid($permalink)); 63 if ($id) { 64 $url_ids[$permalink] = $id; 65 $ids[] = $id; 66 } 67 } 68 $ids = array_slice(array_unique($ids), 0, 80); 69 $items = []; 70 foreach ($ids as $id) { 71 $post = get_post($id); 72 if (!$post || $post->post_status !== 'publish' || !nasc_post_is_supported($post)) { continue; } 73 $url = ''; 74 $duration = 0; 75 if (NASC_Dual::enabled()) { 76 $url = NASC_Dual::url($id, 'summary'); 77 $duration = NASC_Dual::duration($id, 'summary'); 78 } 79 if (!$url && NASC_Worker::stored_mode($id) === 'summary') { 80 $url = NASC_Worker::audio_url($id); 81 $duration = absint(get_post_meta($id, NASC_Worker::META_DURATION, true)); 82 } 83 if (!$url) { continue; } 84 $items[(string) $id] = [ 85 'url' => esc_url_raw($url), 86 'duration' => $duration, 87 ]; 88 } 89 $url_items = []; 90 foreach ($url_ids as $permalink => $id) { 91 if (isset($items[(string) $id])) { $url_items[$permalink] = $items[(string) $id]; } 92 } 93 wp_send_json_success(['items' => $items, 'urls' => $url_items]); 26 94 } 27 95 -
axial-audio-post-narration/trunk/readme.txt
r3775419 r3798980 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.3. 57 Stable tag: 1.3.10 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 35 35 36 36 Features include: 37 38 * Optional compact audio-summary Play control positioned before the title in news cards and compatible Elementor listings; displayed only when an audio summary is available. 37 39 38 40 * Optional dual playback: separate summary and full-article MP3s for the same post. … … 180 182 == Changelog == 181 183 184 = 1.3.10 = 185 * Add an optional compact audio-summary Play control in news cards, positioned before the card title. 186 * Support Elementor Posts, Loop Grid, WordPress query listings, and compatible custom news cards. 187 * Resolve custom card posts through their permalink when the post ID is not present in the markup. 188 * Load card playback on WordPress pages that contain post listings. 189 * Show the control only for published posts with an available audio summary; do not substitute full-article narration. 190 * Keep card playback independent of navigation links and synchronize play/pause with other audio. 191 * Preserve existing single-post audio players, narration generation, API settings, and audio metadata. 192 182 193 = 1.3.5 = 183 * Restore the independent floating player when the summary and full-audio modes use different placements. 184 * Keep floating audio outside the shared inline translation toolbar. 185 186 187 = 1.3.5 = 188 * Isolate playback controls from translation navigation in the shared AXIAL toolbar. 189 194 * Restore the independent floating player when summary and full-audio modes use different placements. 195 * Keep floating narration controls separate from the shared inline translation toolbar. 190 196 191 197 = 1.3.2 = 192 * Keep playback mode visible and narration controls separated from language navigation. 193 198 * Keep playback modes visible and narration controls separate from language navigation. 194 199 195 200 = 1.3.1 = 196 * Redesigned compact audio bar with playback progress, time display and speed control. 197 * When both audio variants appear together, a single player offers Summary and Full controls. 198 * Preserved individual players and existing audio processing. 199 201 * Redesign the audio bar with progress, time display, and speed selection. 202 * Support a unified player with Summary and Full controls when both narrations are present. 200 203 201 204 = 1.2.9 = 202 * Align WordPress.org release metadata with the plugin version. 203 * Include Axial Components shared administration, configurable AXIAL endpoint, API connection tests, and documentation links from the 1.2.8 candidate. 204 * Retain multiple audio APIs, dual narration modes, and existing post-level settings. 205 205 * Align release metadata with the plugin version and include AXIAL Components administration. 206 * Preserve multiple audio API connections and independent narration modes. 207 208 = 1.2.6 = 209 * Move administration to Axial Components > Post Narration. 210 * Add setup guides, FAQ links, and configurable trusted HTTPS service endpoint. 206 211 207 212 = 1.2.3 = 208 * Add optional dual-player mode with separate summary and full-text APIs, generation jobs, and MP3 records per post. 209 * Add independent player placement settings: before content, after content, floating bottom bar, or shortcode. 213 * Add optional dual playback with independent summary and full-text APIs. 210 214 * Add `[nebula_audio_resumen]` and `[nebula_audio_completo]` shortcodes. 211 * Support playback speeds 1x, 1.2x (default), and 1.5x in inline and floating players. 212 * Preserve previously generated audio when enabling dual mode. 213 * Hide legacy Audio · Nebula editor panel in dual mode; retain the original interface when dual mode is disabled. 214 215 * Add independently configurable player placement and playback speed controls. 215 216 216 217 = 1.1.2 = 217 * Added on-demand per-post credit estimation for the selected Audio API using the AXIAL estimate command. 218 * Playback defaults to 1.2x for visitors without a saved preference; 1x and 1.5x remain available. 218 * Add per-post credit estimation. 219 219 220 220 = 1.1.1 = 221 * Added the ability to upload or select an existing MP3 and associate it with a post. 222 * Added a direct Download MP3 button in the post editor. 223 * Manually associated audio is tracked separately from Nebula-generated audio and prevents stale polling from overwriting it. 221 * Allow editors to upload/select an existing MP3 and download associated audio. 224 222 225 223 = 1.1.0 = 226 * Added support for multiple Nebula Audio APIs on the same WordPress site. 227 * Added an identifiable name for each API connection. 228 * Added per-post API selection before generating or regenerating audio. 229 * The selected API is stored with the post/job so status polling uses the same credentials. 230 * Added a default API for automatic generation, bulk actions, and batch generation. 231 * Existing single-API settings are migrated automatically to an "API principal" connection. 224 * Add multiple audio APIs, default API selection, and per-post API assignment. 232 225 233 226 = 1.0.1 = 234 * Added AMP-compatible audio playback using `amp-audio` and native AMP Play/Pause actions. 235 * Custom frontend JavaScript is no longer enqueued on AMP requests. 236 * Standard pages keep the existing player and 1x / 1.2x / 1.5x speed controls. 227 * Add AMP-compatible audio playback using native amp-audio actions. 237 228 238 229 = 1.0.0 = 239 * Initial WordPress.org submission candidate under the AXIAL Audio Post Narration name. 240 * Audio summary and Full reading support. 241 * Accessible floating player with configurable colors and playback speed. 242 * Manual generation sends the initial request to Nebula immediately. 243 * Background polling and batch generation support. 244 * Existing Nebula Audio Client settings and post metadata remain compatible. 245 * Added external-service and privacy disclosures. 246 247 == Changelog == 248 249 = 1.3.5 = 250 * Restore the independent floating player when the summary and full-audio modes use different placements. 251 * Keep floating audio outside the shared inline translation toolbar. 252 253 254 = 1.3.5 = 255 * Isolate playback controls from translation navigation in the shared AXIAL toolbar. 256 257 258 = 1.3.2 = 259 * Keep playback mode visible and narration controls separated from language navigation. 260 261 262 = 1.3.1 = 263 * Redesigned compact audio bar with playback progress, time display and speed control. 264 * When both audio variants appear together, a single player offers Summary and Full controls. 265 * Preserved individual players and existing audio processing. 266 267 268 = 1.2.9 = 269 * Align WordPress.org release metadata with the plugin version. 270 * Include Axial Components shared administration, configurable AXIAL endpoint, API connection tests, and documentation links from the 1.2.8 candidate. 271 * Retain multiple audio APIs, dual narration modes, and existing post-level settings. 272 273 274 = 1.2.6 = 275 * Move administration under Axial Components > Post Narration. 276 * Add AXIAL setup guide and platform FAQ links. 277 * Make the preconfigured HTTPS audio endpoint editable. 278 * Preserve dual audio mode and existing API configurations. 230 * Initial release of AXIAL Audio Post Narration.
Note:
See TracChangeset
for help on using the changeset viewer.