Changeset 3464861
- Timestamp:
- 02/19/2026 08:51:49 AM (2 days ago)
- Location:
- a11ybridge/trunk
- Files:
-
- 6 edited
-
a11ybridge-plugin.php (modified) (3 diffs)
-
admin/settings-basics.php (modified) (7 diffs)
-
admin/settings-pro.php (modified) (1 diff)
-
frontend/assets/js/text-simplification.js (modified) (5 diffs)
-
includes/settings-fields.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
a11ybridge/trunk/a11ybridge-plugin.php
r3462162 r3464861 4 4 * Plugin URI: https://a11ybridge.de 5 5 * Description: Accessibility toolbar for WordPress: font size, contrast, focus mode, color-blind filters, keyboard navigation, text-to-speech, and optional AI text simplification. 6 * Version: 1.0.5 06 * Version: 1.0.52 7 7 * Requires at least: 6.0 8 8 * Tested up to: 6.9 … … 52 52 // 1) Plugin release version (already defined by you from plugin header) 53 53 if (!defined('A11YBRIDGE_VERSION')) { 54 define('A11YBRIDGE_VERSION', '1.0.5 0'); // fallback, should never be used54 define('A11YBRIDGE_VERSION', '1.0.52'); // fallback, should never be used 55 55 } 56 56 … … 962 962 if (!$available || !$client_visible) { continue; } 963 963 964 // Only show features explicitly enabled in admin basics settings 965 if (empty($general_settings[$key])) { continue; } 964 // Decide enabled state: 965 // - If the admin saved an explicit value, respect it (0/1) 966 // - Otherwise, use the feature's default from settings-fields.php 967 if (array_key_exists($key, $general_settings)) { 968 $is_enabled = ((int) $general_settings[$key] === 1); 969 } else { 970 $is_enabled = !empty($data['enabled']); 971 } 972 973 if (!$is_enabled) { continue; } 966 974 967 975 $rendered_any = true; -
a11ybridge/trunk/admin/settings-basics.php
r3461470 r3464861 28 28 $settings_basic = require plugin_dir_path(__FILE__) . '../includes/settings-fields.php'; 29 29 30 // Nur die Grundfunktionen anzeigen30 // Basics tab: include only features that are available in this build. 31 31 $basic_features = array_filter($settings_basic, function($feature) { 32 return !in_array($feature['title'], [ 33 'KI-Bildbeschreibung', 34 'Text-Vereinfachung', 35 'Sprachbefehle', 36 'Barrierefreiheits-Scanner', 37 'Barrierefreiheits-Badge' 38 ]); 32 if (!is_array($feature)) { 33 return false; 34 } 35 $available = !empty($feature['available']); 36 $client_visible = array_key_exists('client_visible', $feature) ? (bool) $feature['client_visible'] : true; 37 return $available && $client_visible; 39 38 }); 40 ?>39 ?> 41 40 42 41 <form method="post" action="options.php"> … … 59 58 60 59 <div class="a11y-field-group <?php echo esc_attr($lock['class']); ?>"> 60 <?php 61 // Default: use the feature's declared default unless the admin explicitly saved 0/1. 62 $feature_enabled_val = array_key_exists($key, $general_settings) 63 ? (int) $general_settings[$key] 64 : ( !empty($data['enabled']) ? 1 : 0 ); 65 ?> 66 <input type="hidden" 67 name="a11ybridge_plugin_general_settings[<?php echo esc_attr($key); ?>]" 68 value="0" /> 61 69 <input type="checkbox" 62 70 id="<?php echo esc_attr($key); ?>" 63 71 name="a11ybridge_plugin_general_settings[<?php echo esc_attr($key); ?>]" 64 72 value="1" 65 <?php checked( isset($general_settings[$key]) ? (bool)$general_settings[$key] : false, true); ?>73 <?php checked($feature_enabled_val, 1); ?> 66 74 <?php echo wp_kses_data($lock['attrs']); ?> /> 67 75 … … 194 202 <div class="a11y-field-group <?php echo esc_attr($lock['class']); ?>"> 195 203 204 <?php 205 $toolbar_auto_hide_val = array_key_exists('toolbar_auto_hide', $general_settings) 206 ? (int) $general_settings['toolbar_auto_hide'] 207 : 0; 208 ?> 209 210 <input type="hidden" 211 name="a11ybridge_plugin_general_settings[toolbar_auto_hide]" 212 value="0" /> 213 196 214 <input type="checkbox" 197 215 id="toolbar_auto_hide" 198 216 name="a11ybridge_plugin_general_settings[toolbar_auto_hide]" 199 217 value="1" 200 <?php checked( isset($general_settings['toolbar_auto_hide']) ? (bool)$general_settings['toolbar_auto_hide'] : false, true); ?> />218 <?php checked($toolbar_auto_hide_val, 1); ?> /> 201 219 202 220 <label for="toolbar_auto_hide"> … … 223 241 <?php $lock = a11ybridge_ui_lock_attrs('basics_mobile_friendly'); ?> 224 242 <div class="a11y-field-group <?php echo esc_attr($lock['class']); ?>"> 243 <?php 244 $mobile_optimized_val = array_key_exists('mobile_optimized', $general_settings) 245 ? (int) $general_settings['mobile_optimized'] 246 : 0; 247 ?> 248 249 <input type="hidden" 250 name="a11ybridge_plugin_general_settings[mobile_optimized]" 251 value="0" /> 225 252 226 253 <input type="checkbox" … … 228 255 name="a11ybridge_plugin_general_settings[mobile_optimized]" 229 256 value="1" 230 <?php checked( isset($general_settings['mobile_optimized']) ? (bool)$general_settings['mobile_optimized'] : false, true); ?> />257 <?php checked($mobile_optimized_val, 1); ?> /> 231 258 232 259 <label for="mobile_optimized"> … … 247 274 <?php $lock = a11ybridge_ui_lock_attrs('basics_touch_friendly'); ?> 248 275 <div class="a11y-field-group <?php echo esc_attr($lock['class']); ?>"> 276 277 <?php 278 $touch_friendly_val = array_key_exists('touch_friendly', $general_settings) 279 ? (int) $general_settings['touch_friendly'] 280 : 0; 281 ?> 282 283 <input type="hidden" 284 name="a11ybridge_plugin_general_settings[touch_friendly]" 285 value="0" /> 249 286 250 287 <input type="checkbox" … … 252 289 name="a11ybridge_plugin_general_settings[touch_friendly]" 253 290 value="1" 254 <?php checked( isset($general_settings['touch_friendly']) ? (bool)$general_settings['touch_friendly'] : false, true); ?> />291 <?php checked($touch_friendly_val, 1); ?> /> 255 292 256 293 <label for="touch_friendly"> -
a11ybridge/trunk/admin/settings-pro.php
r3462162 r3464861 153 153 <h2><?php esc_html_e('Cloud connection (optional)', 'a11ybridge'); ?></h2> 154 154 <p class="description"> 155 <?php esc_html_e('A11yBridge can optionally connect to A11yBridge cloud services for AI features and quota/licensing. For WP.org compliance, no external requests are made until you enable cloud services (or activate a license).', 'a11ybridge'); ?>155 <?php esc_html_e('A11yBridge can optionally connect to A11yBridge cloud services for AI features and quota/licensing. For WP.org compliance, no external requests are made until you enable cloud services and opt-in.', 'a11ybridge'); ?> 156 156 </p> 157 157 -
a11ybridge/trunk/frontend/assets/js/text-simplification.js
r3462162 r3464861 22 22 23 23 async init() { 24 // Hard gate: do not expose UI or make requests unless admin enabled cloud + feature. 24 // Gate: the admin must enable the feature. 25 // Cloud opt-in may be disabled; in that case we keep the UI available, but we show 26 // a helpful notice (instead of a generic error) when a visitor tries to use it. 25 27 const cfg = window.a11ybridgePlugin || {}; 26 if (!cfg. cloudEnabled || !cfg.adminTextSimplificationEnabled) {27 globalThis.A11yBridgeLogger.debug('🛑 Text Simplification disabled ( cloud oradmin feature toggle off).');28 if (!cfg.adminTextSimplificationEnabled) { 29 globalThis.A11yBridgeLogger.debug('🛑 Text Simplification disabled (admin feature toggle off).'); 28 30 return; 31 } 32 if (!cfg.cloudEnabled) { 33 globalThis.A11yBridgeLogger.debug('⚠️ Text Simplification: Cloud opt-in is disabled. Requests will be blocked.'); 29 34 } 30 35 … … 599 604 async getAiProxyToken() { 600 605 const tokenUrl = window.a11ybridgePlugin?.aiTokenUrl || null; 601 if (!tokenUrl) return ''; 606 if (!tokenUrl) { 607 return { token: '', ok: false, status: 0, error: 'missing_token_url', message: '' }; 608 } 602 609 603 610 try { … … 610 617 cache: 'no-store', 611 618 }); 612 if (!r.ok) return '';613 619 const data = await r.json().catch(() => null); 614 return (data && data.token) ? String(data.token) : ''; 620 621 if (r.ok && data && data.token) { 622 return { token: String(data.token), ok: true, status: r.status, error: '', message: '' }; 623 } 624 625 const error = (data && (data.error || data.code)) ? String(data.error || data.code) : `http_${r.status}`; 626 const message = (data && data.message) ? String(data.message) : ''; 627 return { token: '', ok: false, status: r.status, error, message }; 615 628 } catch (e) { 616 return '';629 return { token: '', ok: false, status: 0, error: 'network_error', message: '' }; 617 630 } 618 631 } … … 660 673 ''; 661 674 662 const cfg = window.A11YBRIDGE_CONFIG || {}; 663 664 const aiToken = await this.getAiProxyToken(); 665 if (!aiToken) { 666 throw new Error('AI token unavailable'); 667 } 675 const pluginCfg = window.a11ybridgePlugin || {}; 676 677 if (!pluginCfg.cloudEnabled) { 678 this.updateNotification( 679 notif, 680 '⚠️ Cloud opt-in is disabled. Text simplification requires the admin to enable Cloud services in A11yBridge settings.', 681 'warning', 682 6500 683 ); 684 return; 685 } 686 687 if (!pluginCfg.adminTextSimplificationEnabled) { 688 this.updateNotification( 689 notif, 690 '⚠️ Text simplification is disabled by the site administrator.', 691 'warning', 692 5500 693 ); 694 return; 695 } 696 697 const tok = await this.getAiProxyToken(); 698 if (!tok || !tok.token) { 699 let msg = '❌ Could not start text simplification.'; 700 const err = (tok && tok.error) ? String(tok.error) : ''; 701 702 if (err === 'cloud_or_feature_disabled' || err === 'a11ybridge_cloud_disabled') { 703 msg = '⚠️ Cloud opt-in is disabled. Text simplification requires the admin to enable Cloud services in A11yBridge settings.'; 704 } else if (err === 'rate_limited') { 705 msg = '⚠️ Too many requests. Please try again in a moment.'; 706 } else if (err) { 707 msg = `❌ Could not fetch AI token (${err}).`; 708 } else { 709 msg = '❌ AI token unavailable.'; 710 } 711 712 this.updateNotification(notif, msg, 'error', 6500); 713 return; 714 } 715 716 const aiToken = tok.token; 668 717 669 718 const response = await fetch(this.apiUrl, { … … 690 739 const bodyText = await response.text().catch(() => ''); 691 740 globalThis.A11yBridgeLogger.error('❌ Simplify error response:', response.status, bodyText); 692 throw new Error(`HTTP ${response.status}: ${bodyText}`); 741 let parsed = null; 742 try { parsed = bodyText ? JSON.parse(bodyText) : null; } catch {} 743 744 const code = parsed && (parsed.code || parsed.error) ? String(parsed.code || parsed.error) : ''; 745 const message = parsed && parsed.message ? String(parsed.message) : ''; 746 747 // Friendly, explicit messages for the common admin-gating cases 748 if (response.status === 403 && (code === 'a11ybridge_cloud_disabled' || code === 'cloud_or_feature_disabled')) { 749 this.updateNotification( 750 notif, 751 '⚠️ Cloud opt-in is disabled. Text simplification requires the admin to enable Cloud services in A11yBridge settings.', 752 'warning', 753 6500 754 ); 755 return; 756 } 757 if (response.status === 403 && code === 'a11ybridge_feature_disabled') { 758 this.updateNotification( 759 notif, 760 '⚠️ Text simplification is disabled by the site administrator.', 761 'warning', 762 5500 763 ); 764 return; 765 } 766 if (response.status === 429 || code === 'rate_limited') { 767 this.updateNotification( 768 notif, 769 '⚠️ Too many requests. Please try again in a moment.', 770 'warning', 771 4500 772 ); 773 return; 774 } 775 776 const userMsg = message ? `❌ ${message}` : '❌ Error during simplification'; 777 this.updateNotification(notif, userMsg, 'error', 6500); 778 return; 693 779 } 694 780 -
a11ybridge/trunk/includes/settings-fields.php
r3461470 r3464861 115 115 'script' => '', 116 116 'icon' => '⌨️', 117 'enabled' => false,117 'enabled' => true, 118 118 'available' => true, 119 119 'client_visible' => true, … … 160 160 'script' => '', 161 161 'icon' => '🎯', 162 'enabled' => false,162 'enabled' => true, 163 163 'available' => true, 164 164 'client_visible' => true, … … 173 173 'script' => '', 174 174 'icon' => '👁️', 175 'enabled' => false,175 'enabled' => true, 176 176 'available' => true, 177 177 'client_visible' => true, … … 186 186 'script' => '', 187 187 'icon' => '🔈', 188 'enabled' => false,188 'enabled' => true, 189 189 'available' => true, 190 190 'client_visible' => true, -
a11ybridge/trunk/readme.txt
r3462162 r3464861 2 2 Contributors: berlinlion 3 3 Donate link: https://a11ybridge.de/ 4 Tags: accessibility, wcag, contrast, text-to-speech, keyboard, a11y, screen reader, web-accessibility4 Tags: accessibility, a11y, wcag, keyboard, text-to-speech 5 5 Requires at least: 6.0 6 6 Tested up to: 6.9.1 7 7 Requires PHP: 7.4 8 Stable tag: 1.0.5 08 Stable tag: 1.0.52 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 144 144 == Changelog == 145 145 146 = 1.0.5 0=146 = 1.0.52 = 147 147 * WP.org compliance fixes: removed trialware indicators, removed legacy frontend templates with direct script/style tags. 148 148 * Fixed undefined function error in a11ybridge-plugin.php (legacy footer hook removed). … … 155 155 == Upgrade Notice == 156 156 157 = 1.0.5 0=157 = 1.0.52 = 158 158 Recommended update for WP.org submission compliance and stability fixes. 159 159
Note: See TracChangeset
for help on using the changeset viewer.