Changeset 3442731
- Timestamp:
- 01/19/2026 06:30:15 PM (2 months ago)
- Location:
- accessimate
- Files:
-
- 2 added
- 6 edited
- 1 copied
-
tags/1.0.4 (copied) (copied from accessimate/trunk)
-
tags/1.0.4/accessimate.php (modified) (82 diffs)
-
tags/1.0.4/assets/js/accessimate-frontend.js (modified) (6 diffs)
-
tags/1.0.4/readme.txt (modified) (1 diff)
-
tags/1.0.4/vendor/freemius/assets/img/accessimate.png (added)
-
trunk/accessimate.php (modified) (82 diffs)
-
trunk/assets/js/accessimate-frontend.js (modified) (6 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/vendor/freemius/assets/img/accessimate.png (added)
Legend:
- Unmodified
- Added
- Removed
-
accessimate/tags/1.0.4/accessimate.php
r3420458 r3442731 2 2 3 3 /** 4 * Plugin Name: AccessiMate 4 * Plugin Name: AccessiMate Pro 5 5 * Description: A comprehensive WordPress accessibility plugin that provides tools to make your website more accessible to users with disabilities. 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: BDPlugins 8 * Author URI: https://bdplugins.com/ 8 9 * License: GPL v2 or later 9 10 * Text Domain: accessimate 10 11 */ 11 12 // Prevent direct access 12 if ( !defined( 'ABSPATH' )) {13 if (!defined('ABSPATH')) { 13 14 exit; 14 15 } 15 16 // Define plugin constants 16 define( 'ACCESSIMATE_VERSION', '1.0.3');17 define( 'ACCESSIMATE_PLUGIN_DIR', plugin_dir_path( __FILE__ ));18 define( 'ACCESSIMATE_PLUGIN_URL', plugin_dir_url( __FILE__ ));19 define( 'ACCESSIMATE_AI_ENABLED', true);20 if ( function_exists( 'bdpacc_fs' )) {21 bdpacc_fs()->set_basename( false, __FILE__);17 define('ACCESSIMATE_VERSION', '1.0.4'); 18 define('ACCESSIMATE_PLUGIN_DIR', plugin_dir_path(__FILE__)); 19 define('ACCESSIMATE_PLUGIN_URL', plugin_dir_url(__FILE__)); 20 define('ACCESSIMATE_AI_ENABLED', true); 21 if (function_exists('bdpacc_fs')) { 22 bdpacc_fs()->set_basename(false, __FILE__); 22 23 } else { 23 24 /** … … 25 26 * `function_exists` CALL ABOVE TO PROPERLY WORK. 26 27 */ 27 if ( !function_exists( 'bdpacc_fs' )) {28 if (!function_exists('bdpacc_fs')) { 28 29 // Create a helper function for easy SDK access. 29 function bdpacc_fs() { 30 function bdpacc_fs() 31 { 30 32 global $bdpacc_fs; 31 if ( !isset( $bdpacc_fs )) {33 if (!isset($bdpacc_fs)) { 32 34 // Include Freemius SDK. 33 require_once dirname( __FILE__) . '/vendor/freemius/start.php';34 $bdpacc_fs = fs_dynamic_init( [35 require_once dirname(__FILE__) . '/vendor/freemius/start.php'; 36 $bdpacc_fs = fs_dynamic_init([ 35 37 'id' => '20125', 36 38 'slug' => 'accessimate', … … 55 57 ], 56 58 'is_live' => true, 57 ] );59 ]); 58 60 } 59 61 return $bdpacc_fs; … … 63 65 bdpacc_fs(); 64 66 // Signal that SDK was initiated. 65 do_action( 'bdpacc_fs_loaded');67 do_action('bdpacc_fs_loaded'); 66 68 // Initialize the plugin 67 69 new AccessiMate(); … … 69 71 // ... Your plugin's main file logic ... 70 72 } 71 class AccessiMate { 73 class AccessiMate 74 { 72 75 /** 73 76 * Constructor 74 77 */ 75 public function __construct() { 76 add_action( 'init', [$this, 'init'] ); 77 register_activation_hook( __FILE__, [$this, 'activate'] ); 78 register_deactivation_hook( __FILE__, [$this, 'deactivate'] ); 78 public function __construct() 79 { 80 add_action('init', [$this, 'init']); 81 register_activation_hook(__FILE__, [$this, 'activate']); 82 register_deactivation_hook(__FILE__, [$this, 'deactivate']); 79 83 } 80 84 … … 82 86 * Initialize the plugin 83 87 */ 84 public function init() { 88 public function init() 89 { 85 90 // Admin hooks 86 if ( is_admin()) {87 add_action( 'admin_menu', [$this, 'add_admin_menu']);88 add_action( 'admin_init', [$this, 'admin_init']);89 add_action( 'admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']);91 if (is_admin()) { 92 add_action('admin_menu', [$this, 'add_admin_menu']); 93 add_action('admin_init', [$this, 'admin_init']); 94 add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']); 90 95 } 91 96 // Frontend hooks 92 add_action( 'wp_enqueue_scripts', [$this, 'enqueue_frontend_scripts']);93 add_action( 'wp_footer', [$this, 'render_accessibility_toolbar']);97 add_action('wp_enqueue_scripts', [$this, 'enqueue_frontend_scripts']); 98 add_action('wp_footer', [$this, 'render_accessibility_toolbar']); 94 99 // AJAX hooks 95 add_action( 'wp_ajax_accessimate_save_settings', [$this, 'save_user_preferences']);96 add_action( 'wp_ajax_nopriv_accessimate_save_settings', [$this, 'save_user_preferences']);97 add_action( 'wp_ajax_accessimate_generate_alt_text', [$this, 'generate_alt_text']);98 add_action( 'wp_ajax_accessimate_scan_content', [$this, 'scan_content_accessibility']);99 add_action( 'wp_ajax_accessimate_simplify_text', [$this, 'simplify_text']);100 add_action('wp_ajax_accessimate_save_settings', [$this, 'save_user_preferences']); 101 add_action('wp_ajax_nopriv_accessimate_save_settings', [$this, 'save_user_preferences']); 102 add_action('wp_ajax_accessimate_generate_alt_text', [$this, 'generate_alt_text']); 103 add_action('wp_ajax_accessimate_scan_content', [$this, 'scan_content_accessibility']); 104 add_action('wp_ajax_accessimate_simplify_text', [$this, 'simplify_text']); 100 105 // AI Features 101 106 // if (ACCESSIMATE_AI_ENABLED) { … … 108 113 * Plugin activation 109 114 */ 110 public function activate() { 115 public function activate() 116 { 111 117 // Set default options 112 118 $default_options = [ … … 139 145 'cursor' => 1, 140 146 ]; 141 add_option( 'accessimate_options', $default_options);147 add_option('accessimate_options', $default_options); 142 148 // Create custom table for user preferences if needed 143 149 $this->create_user_preferences_table(); … … 147 153 * Plugin deactivation 148 154 */ 149 public function deactivate() { 155 public function deactivate() 156 { 150 157 // Clean up if needed (keeping options for now) 151 158 } … … 154 161 * Create user preferences table 155 162 */ 156 private function create_user_preferences_table() { 163 private function create_user_preferences_table() 164 { 157 165 global $wpdb; 158 166 $table_name = "{$wpdb->prefix}accessimate_user_prefs"; 159 167 $charset_collate = $wpdb->get_charset_collate(); 160 $sql = "CREATE TABLE {$table_name} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n user_session varchar(100) NOT NULL,\n preferences text NOT NULL,\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\nUNIQUE KEY user_session (user_session)\n ) {$charset_collate};";168 $sql = "CREATE TABLE {$table_name} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n user_session varchar(100) NOT NULL,\n preferences text NOT NULL,\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\n UNIQUE KEY user_session (user_session)\n ) {$charset_collate};"; 161 169 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 162 dbDelta( $sql);170 dbDelta($sql); 163 171 // Create AI suggestions table 164 172 $ai_table = "{$wpdb->prefix}accessimate_ai_suggestions"; 165 $sql_ai = "CREATE TABLE {$ai_table} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n post_id mediumint(9) NOT NULL,\n suggestion_type varchar(50) NOT NULL,\n original_content text NOT NULL,\n suggested_content text NOT NULL,\n status varchar(20) DEFAULT 'pending',\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\nKEY post_id (post_id)\n ) {$charset_collate};";166 dbDelta( $sql_ai);173 $sql_ai = "CREATE TABLE {$ai_table} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n post_id mediumint(9) NOT NULL,\n suggestion_type varchar(50) NOT NULL,\n original_content text NOT NULL,\n suggested_content text NOT NULL,\n status varchar(20) DEFAULT 'pending',\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\n KEY post_id (post_id)\n ) {$charset_collate};"; 174 dbDelta($sql_ai); 167 175 } 168 176 … … 170 178 * Add admin menu 171 179 */ 172 public function add_admin_menu() { 180 public function add_admin_menu() 181 { 173 182 add_options_page( 174 __( 'AccessiMate Settings', 'accessimate'),175 __( 'AccessiMate', 'accessimate'),183 __('AccessiMate Settings', 'accessimate'), 184 __('AccessiMate', 'accessimate'), 176 185 'manage_options', 177 186 'accessimate', … … 183 192 * Initialize admin settings 184 193 */ 185 public function admin_init() { 186 register_setting( 'accessimate_options', 'accessimate_options', [$this, 'validate_options'] ); 194 public function admin_init() 195 { 196 register_setting('accessimate_options', 'accessimate_options', [$this, 'validate_options']); 187 197 add_settings_section( 188 198 'accessimate_main', 189 __( 'Main Settings', 'accessimate'),199 __('Main Settings', 'accessimate'), 190 200 [$this, 'main_section_callback'], 191 201 'accessimate' … … 195 205 [ 196 206 'id' => 'enable_toolbar', 197 'label' => __( 'Accessibility Toolbar', 'accessimate'),207 'label' => __('Accessibility Toolbar', 'accessimate'), 198 208 'callback' => [$this, 'checkbox_field'], 199 209 'description' => 'Display the accessibility toolbar on the frontend.', … … 201 211 [ 202 212 'id' => 'toolbar_position', 203 'label' => __( 'Toolbar Position', 'accessimate'),213 'label' => __('Toolbar Position', 'accessimate'), 204 214 'callback' => [$this, 'select_field'], 205 215 'options' => [ 206 'top-left' => __( 'Top Left', 'accessimate'),207 'top-right' => __( 'Top Right', 'accessimate'),208 'bottom-left' => __( 'Bottom Left', 'accessimate'),209 'bottom-right' => __( 'Bottom Right', 'accessimate'),216 'top-left' => __('Top Left', 'accessimate'), 217 'top-right' => __('Top Right', 'accessimate'), 218 'bottom-left' => __('Bottom Left', 'accessimate'), 219 'bottom-right' => __('Bottom Right', 'accessimate'), 210 220 ], 211 221 ], 212 222 [ 213 223 'id' => 'toolbar_animation', 214 'label' => __( 'Toolbar Animation', 'accessimate'),224 'label' => __('Toolbar Animation', 'accessimate'), 215 225 'callback' => [$this, 'select_field'], 216 226 'options' => [ 217 'none' => __( 'None', 'accessimate'),218 'fade' => __( 'Fade', 'accessimate'),219 'slide-left' => __( 'Slide Left', 'accessimate'),220 'slide-right' => __( 'Slide Right', 'accessimate'),221 'slide-top' => __( 'Slide Top', 'accessimate'),222 'slide-bottom' => __( 'Slide Bottom', 'accessimate'),227 'none' => __('None', 'accessimate'), 228 'fade' => __('Fade', 'accessimate'), 229 'slide-left' => __('Slide Left', 'accessimate'), 230 'slide-right' => __('Slide Right', 'accessimate'), 231 'slide-top' => __('Slide Top', 'accessimate'), 232 'slide-bottom' => __('Slide Bottom', 'accessimate'), 223 233 ], 224 234 ], 225 235 [ 226 236 'id' => 'toolbar_theme', 227 'label' => __( 'Toolbar Theme', 'accessimate'),237 'label' => __('Toolbar Theme', 'accessimate'), 228 238 'callback' => [$this, 'select_field'], 229 239 'options' => [ 230 'auto' => __( 'Auto (System Preference)', 'accessimate'),231 'light' => __( 'Light', 'accessimate'),232 'dark' => __( 'Dark', 'accessimate'),240 'auto' => __('Auto (System Preference)', 'accessimate'), 241 'light' => __('Light', 'accessimate'), 242 'dark' => __('Dark', 'accessimate'), 233 243 ], 234 244 ], … … 236 246 [ 237 247 'id' => 'bigger-text', 238 'label' => __( 'Bigger Text', 'accessimate'),248 'label' => __('Bigger Text', 'accessimate'), 239 249 'callback' => [$this, 'checkbox_field'], 240 250 'description' => 'Increase text size for better readability.', … … 242 252 [ 243 253 'id' => 'cursor', 244 'label' => __( 'Cursor', 'accessimate'),254 'label' => __('Cursor', 'accessimate'), 245 255 'callback' => [$this, 'checkbox_field'], 246 256 'description' => 'Improve cursor visibility for users with visual challenges.', … … 248 258 [ 249 259 'id' => 'line-height', 250 'label' => __( 'Line Height', 'accessimate'),260 'label' => __('Line Height', 'accessimate'), 251 261 'callback' => [$this, 'checkbox_field'], 252 262 'description' => 'Adjust line spacing to reduce text clutter.', … … 254 264 [ 255 265 'id' => 'letter-spacing', 256 'label' => __( 'Letter Spacing', 'accessimate'),266 'label' => __('Letter Spacing', 'accessimate'), 257 267 'callback' => [$this, 'checkbox_field'], 258 268 'description' => 'Increase spacing between letters for clarity.', … … 260 270 [ 261 271 'id' => 'readable-font', 262 'label' => __( 'Readable Font', 'accessimate'),272 'label' => __('Readable Font', 'accessimate'), 263 273 'callback' => [$this, 'checkbox_field'], 264 274 'description' => 'Use a clean, legible font for easier reading.', … … 266 276 [ 267 277 'id' => 'dyslexic-font', 268 'label' => __( 'Dyslexic Font', 'accessimate'),278 'label' => __('Dyslexic Font', 'accessimate'), 269 279 'callback' => [$this, 'checkbox_field'], 270 280 'description' => 'Enable a font designed to aid dyslexic users.', … … 273 283 [ 274 284 'id' => 'text-align', 275 'label' => __( 'Text Align', 'accessimate'),285 'label' => __('Text Align', 'accessimate'), 276 286 'callback' => [$this, 'checkbox_field'], 277 287 'description' => 'Adjust text alignment for better legibility.', … … 279 289 [ 280 290 'id' => 'text-magnifier', 281 'label' => __( 'Text Magnifier', 'accessimate'),291 'label' => __('Text Magnifier', 'accessimate'), 282 292 'callback' => [$this, 'checkbox_field'], 283 293 'description' => 'Magnify text on hover or focus for better visibility.', … … 286 296 [ 287 297 'id' => 'highlight-links', 288 'label' => __( 'Highlight Links', 'accessimate'),298 'label' => __('Highlight Links', 'accessimate'), 289 299 'callback' => [$this, 'checkbox_field'], 290 300 'description' => 'Highlight all links on the page for visibility.', … … 292 302 [ 293 303 'id' => 'invert-colors', 294 'label' => __( 'Invert Colors', 'accessimate'),304 'label' => __('Invert Colors', 'accessimate'), 295 305 'callback' => [$this, 'checkbox_field'], 296 306 'description' => 'Invert website colors to reduce eye strain.', … … 298 308 [ 299 309 'id' => 'brightness', 300 'label' => __( 'Brightness', 'accessimate'),310 'label' => __('Brightness', 'accessimate'), 301 311 'callback' => [$this, 'checkbox_field'], 302 312 'description' => 'Adjust screen brightness for comfort.', … … 304 314 [ 305 315 'id' => 'contrast', 306 'label' => __( 'Contrast', 'accessimate'),316 'label' => __('Contrast', 'accessimate'), 307 317 'callback' => [$this, 'checkbox_field'], 308 318 'description' => 'Improve content visibility with contrast adjustment.', … … 310 320 ], 311 321 [ 312 'id' => 'gray -scale',313 'label' => __( 'Gray Scale', 'accessimate'),322 'id' => 'grayscale', 323 'label' => __('Grayscale', 'accessimate'), 314 324 'callback' => [$this, 'checkbox_field'], 315 325 'description' => 'Convert content to grayscale for focus.', … … 317 327 [ 318 328 'id' => 'saturation', 319 'label' => __( 'Saturation', 'accessimate'),329 'label' => __('Saturation', 'accessimate'), 320 330 'callback' => [$this, 'checkbox_field'], 321 331 'description' => 'Adjust saturation to reduce visual overload.', … … 324 334 [ 325 335 'id' => 'reading-line', 326 'label' => __( 'Reading Line', 'accessimate'),336 'label' => __('Reading Line', 'accessimate'), 327 337 'callback' => [$this, 'checkbox_field'], 328 338 'description' => 'Display a horizontal line to follow text.', … … 330 340 [ 331 341 'id' => 'reading-mask', 332 'label' => __( 'Reading Mask', 'accessimate'),342 'label' => __('Reading Mask', 'accessimate'), 333 343 'callback' => [$this, 'checkbox_field'], 334 344 'description' => 'Dim parts of the screen to focus on text.', … … 336 346 [ 337 347 'id' => 'highlight-all', 338 'label' => __( 'Highlight All', 'accessimate'),348 'label' => __('Highlight All', 'accessimate'), 339 349 'callback' => [$this, 'checkbox_field'], 340 350 'description' => 'Highlight all content to assist with visual tracking.', … … 342 352 [ 343 353 'id' => 'highlight-titles', 344 'label' => __( 'Highlight Titles', 'accessimate'),354 'label' => __('Highlight Titles', 'accessimate'), 345 355 'callback' => [$this, 'checkbox_field'], 346 356 'description' => 'Emphasize headings and titles for better navigation.', … … 349 359 [ 350 360 'id' => 'hide-images', 351 'label' => __( 'Hide Images', 'accessimate'),361 'label' => __('Hide Images', 'accessimate'), 352 362 'callback' => [$this, 'checkbox_field'], 353 363 'description' => 'Hide images to reduce distractions.', … … 355 365 [ 356 366 'id' => 'text-to-speech', 357 'label' => __( 'Text to Speech', 'accessimate'),367 'label' => __('Text to Speech', 'accessimate'), 358 368 'callback' => [$this, 'checkbox_field'], 359 369 'description' => 'Read out text for users with visual impairments.', … … 362 372 [ 363 373 'id' => 'mute-sounds', 364 'label' => __( 'Mute Sounds', 'accessimate'),374 'label' => __('Mute Sounds', 'accessimate'), 365 375 'callback' => [$this, 'checkbox_field'], 366 376 'description' => 'Silence all site audio for a quieter experience.', … … 369 379 [ 370 380 'id' => 'stop-animations', 371 'label' => __( 'Stop Animations', 'accessimate'),381 'label' => __('Stop Animations', 'accessimate'), 372 382 'callback' => [$this, 'checkbox_field'], 373 383 'description' => 'Stop moving elements to prevent distractions.', … … 375 385 [ 376 386 'id' => 'keyboard', 377 'label' => __( 'Keyboard Navigation', 'accessimate'),387 'label' => __('Keyboard Navigation', 'accessimate'), 378 388 'callback' => [$this, 'checkbox_field'], 379 389 'description' => 'Highlight elements during keyboard navigation.', 380 390 'is_beta' => true, 381 391 ], 392 [ 393 'id' => 'language', 394 'label' => __('Toolbar Language', 'accessimate'), 395 'callback' => [$this, 'select_field'], 396 'options' => [ 397 'en' => __('English', 'accessimate'), 398 'fr' => __('French', 'accessimate'), 399 'es' => __('Spanish', 'accessimate'), 400 'de' => __('German', 'accessimate'), 401 'it' => __('Italian', 'accessimate'), 402 'pt' => __('Portuguese', 'accessimate'), 403 'ar' => __('Arabic', 'accessimate'), 404 ], 405 'description' => __('Select the language for the accessibility toolbar.', 'accessimate'), 406 ], 382 407 ]; 383 408 // Register all fields 384 foreach ( $settings as $setting) {409 foreach ($settings as $setting) { 385 410 $args = [ 386 411 'field' => $setting['id'], 387 412 ]; 388 if ( isset( $setting['description'] )) {413 if (isset($setting['description'])) { 389 414 $args['description'] = $setting['description']; 390 415 } 391 if ( isset( $setting['options'] )) {416 if (isset($setting['options'])) { 392 417 $args['options'] = $setting['options']; 393 418 } 394 if ( isset( $setting['is_beta'] )) {419 if (isset($setting['is_beta'])) { 395 420 $args['is_beta'] = $setting['is_beta']; 396 421 } … … 409 434 * Main settings section callback 410 435 */ 411 public function main_section_callback() { 412 echo '<p>' . esc_html__( 'Configure AccessiMate settings to improve your website accessibility.', 'accessimate' ) . '</p>'; 436 public function main_section_callback() 437 { 438 echo '<p>' . esc_html__('Configure AccessiMate settings to improve your website accessibility.', 'accessimate') . '</p>'; 413 439 } 414 440 … … 418 444 * @param array $args Field arguments. 419 445 */ 420 public function checkbox_field( $args ) { 421 $options = get_option( 'accessimate_options' ); 446 public function checkbox_field($args) 447 { 448 $options = get_option('accessimate_options'); 422 449 $field = $args['field']; 423 $checked = ( isset( $options[$field] ) ? checked( $options[$field], 1, false ) : '');424 $description = ( isset( $args['description'] ) ? $args['description'] : '');425 $is_beta = ( isset( $args['is_beta'] ) ? $args['is_beta'] : false);450 $checked = (isset($options[$field]) ? checked($options[$field], 1, false) : ''); 451 $description = (isset($args['description']) ? $args['description'] : ''); 452 $is_beta = (isset($args['is_beta']) ? $args['is_beta'] : false); 426 453 echo '<label>'; 427 echo '<input type="checkbox" name="accessimate_options[' . esc_attr( $field ) . ']" value="1" ' . wp_kses_post( $checked) . ' /> ';428 echo esc_html( $description);429 if ( $is_beta) {430 echo '<span class="accessimate-beta-feature">' . esc_html__( 'Beta', 'accessimate') . '</span>';454 echo '<input type="checkbox" name="accessimate_options[' . esc_attr($field) . ']" value="1" ' . wp_kses_post($checked) . ' /> '; 455 echo esc_html($description); 456 if ($is_beta) { 457 echo '<span class="accessimate-beta-feature">' . esc_html__('Beta', 'accessimate') . '</span>'; 431 458 } 432 459 echo '</label>'; … … 438 465 * @param array $args Field arguments. 439 466 */ 440 public function select_field( $args ) { 441 $options = get_option( 'accessimate_options' ); 467 public function select_field($args) 468 { 469 $options = get_option('accessimate_options'); 442 470 $field = $args['field']; 443 471 $current = $options[$field] ?? ''; 444 echo '<select name="accessimate_options[' . esc_attr( $field) . ']">';445 foreach ( $args['options'] as $value => $label) {446 $selected = selected( $current, $value, false);447 echo '<option value="' . esc_attr( $value ) . '" ' . wp_kses_post( $selected ) . '>' . esc_html( $label) . '</option>';472 echo '<select name="accessimate_options[' . esc_attr($field) . ']">'; 473 foreach ($args['options'] as $value => $label) { 474 $selected = selected($current, $value, false); 475 echo '<option value="' . esc_attr($value) . '" ' . wp_kses_post($selected) . '>' . esc_html($label) . '</option>'; 448 476 } 449 477 echo '</select>'; … … 455 483 * @param array $args Field arguments. 456 484 */ 457 public function text_field( $args ) { 458 $options = get_option( 'accessimate_options' ); 485 public function text_field($args) 486 { 487 $options = get_option('accessimate_options'); 459 488 $field = $args['field']; 460 $value = ( isset( $options[$field] ) ? esc_attr( $options[$field] ) : '' ); 461 $type = ( isset( $args['type'] ) ? $args['type'] : 'text' ); 462 $description = ( isset( $args['description'] ) ? $args['description'] : '' ); 463 echo '<input type="' . esc_attr( $type ) . '" name="accessimate_options[' . esc_attr( $field ) . ']" value="' . esc_attr( $value ) . '" class="regular-text" />'; 464 if ( $description ) { 465 echo '<p class="description">' . esc_html( $description ) . '</p>'; 466 } 467 } 468 469 public function validate_options( $input ) { 489 $value = (isset($options[$field]) ? esc_attr($options[$field]) : ''); 490 $type = (isset($args['type']) ? $args['type'] : 'text'); 491 $description = (isset($args['description']) ? $args['description'] : ''); 492 echo '<input type="' . esc_attr($type) . '" name="accessimate_options[' . esc_attr($field) . ']" value="' . esc_attr($value) . '" class="regular-text" />'; 493 if ($description) { 494 echo '<p class="description">' . esc_html($description) . '</p>'; 495 } 496 } 497 498 public function validate_options($input) 499 { 470 500 $valid = []; 471 501 // Main settings validation 472 $valid['enable_toolbar'] = ( isset( $input['enable_toolbar'] ) ? 1 : 0);473 $valid['enable_skip_links'] = ( isset( $input['enable_skip_links'] ) ? 1 : 0);474 $valid['bigger-text'] = ( isset( $input['bigger-text'] ) ? 1 : 0);475 $valid['cursor'] = ( isset( $input['cursor'] ) ? 1 : 0);476 $valid['line-height'] = ( isset( $input['line-height'] ) ? 1 : 0);477 $valid['letter-spacing'] = ( isset( $input['letter-spacing'] ) ? 1 : 0);478 $valid['readable-font'] = ( isset( $input['readable-font'] ) ? 1 : 0);479 $valid['dyslexic-font'] = ( isset( $input['dyslexic-font'] ) ? 1 : 0);480 $valid['text-align'] = ( isset( $input['text-align'] ) ? 1 : 0);481 $valid['text-magnifier'] = ( isset( $input['text-magnifier'] ) ? 1 : 0);482 $valid['highlight-links'] = ( isset( $input['highlight-links'] ) ? 1 : 0);483 $valid['invert-colors'] = ( isset( $input['invert-colors'] ) ? 1 : 0);484 $valid['brightness'] = ( isset( $input['brightness'] ) ? 1 : 0);485 $valid['contrast'] = ( isset( $input['contrast'] ) ? 1 : 0);486 $valid['gray -scale'] = ( isset( $input['gray-scale'] ) ? 1 : 0);487 $valid['saturation'] = ( isset( $input['saturation'] ) ? 1 : 0);488 $valid['reading-line'] = ( isset( $input['reading-line'] ) ? 1 : 0);489 $valid['reading-mask'] = ( isset( $input['reading-mask'] ) ? 1 : 0);490 $valid['highlight-all'] = ( isset( $input['highlight-all'] ) ? 1 : 0);491 $valid['highlight-titles'] = ( isset( $input['highlight-titles'] ) ? 1 : 0);492 $valid['hide-images'] = ( isset( $input['hide-images'] ) ? 1 : 0);493 $valid['text-to-speech'] = ( isset( $input['text-to-speech'] ) ? 1 : 0);494 $valid['mute-sounds'] = ( isset( $input['mute-sounds'] ) ? 1 : 0);495 $valid['stop-animations'] = ( isset( $input['stop-animations'] ) ? 1 : 0);496 $valid['keyboard'] = ( isset( $input['keyboard'] ) ? 1 : 0);502 $valid['enable_toolbar'] = (isset($input['enable_toolbar']) ? 1 : 0); 503 $valid['enable_skip_links'] = (isset($input['enable_skip_links']) ? 1 : 0); 504 $valid['bigger-text'] = (isset($input['bigger-text']) ? 1 : 0); 505 $valid['cursor'] = (isset($input['cursor']) ? 1 : 0); 506 $valid['line-height'] = (isset($input['line-height']) ? 1 : 0); 507 $valid['letter-spacing'] = (isset($input['letter-spacing']) ? 1 : 0); 508 $valid['readable-font'] = (isset($input['readable-font']) ? 1 : 0); 509 $valid['dyslexic-font'] = (isset($input['dyslexic-font']) ? 1 : 0); 510 $valid['text-align'] = (isset($input['text-align']) ? 1 : 0); 511 $valid['text-magnifier'] = (isset($input['text-magnifier']) ? 1 : 0); 512 $valid['highlight-links'] = (isset($input['highlight-links']) ? 1 : 0); 513 $valid['invert-colors'] = (isset($input['invert-colors']) ? 1 : 0); 514 $valid['brightness'] = (isset($input['brightness']) ? 1 : 0); 515 $valid['contrast'] = (isset($input['contrast']) ? 1 : 0); 516 $valid['grayscale'] = (isset($input['grayscale']) ? 1 : 0); 517 $valid['saturation'] = (isset($input['saturation']) ? 1 : 0); 518 $valid['reading-line'] = (isset($input['reading-line']) ? 1 : 0); 519 $valid['reading-mask'] = (isset($input['reading-mask']) ? 1 : 0); 520 $valid['highlight-all'] = (isset($input['highlight-all']) ? 1 : 0); 521 $valid['highlight-titles'] = (isset($input['highlight-titles']) ? 1 : 0); 522 $valid['hide-images'] = (isset($input['hide-images']) ? 1 : 0); 523 $valid['text-to-speech'] = (isset($input['text-to-speech']) ? 1 : 0); 524 $valid['mute-sounds'] = (isset($input['mute-sounds']) ? 1 : 0); 525 $valid['stop-animations'] = (isset($input['stop-animations']) ? 1 : 0); 526 $valid['keyboard'] = (isset($input['keyboard']) ? 1 : 0); 497 527 // Validate toolbar position 498 528 $valid_positions = [ … … 502 532 'bottom-right' 503 533 ]; 504 $valid['toolbar_position'] = ( in_array( $input['toolbar_position'], $valid_positions, true ) ? sanitize_text_field( $input['toolbar_position'] ) : 'top-right');534 $valid['toolbar_position'] = (in_array($input['toolbar_position'], $valid_positions, true) ? sanitize_text_field($input['toolbar_position']) : 'top-right'); 505 535 // Validate toolbar theme 506 536 $valid_themes = ['auto', 'light', 'dark']; 507 $valid['toolbar_theme'] = ( in_array( $input['toolbar_theme'], $valid_themes, true ) ? sanitize_text_field( $input['toolbar_theme'] ) : 'auto');537 $valid['toolbar_theme'] = (in_array($input['toolbar_theme'], $valid_themes, true) ? sanitize_text_field($input['toolbar_theme']) : 'auto'); 508 538 // Validate toolbar animation 509 539 $valid_animations = [ … … 515 545 'slide-bottom' 516 546 ]; 517 $valid['toolbar_animation'] = ( in_array( $input['toolbar_animation'], $valid_animations, true ) ? sanitize_text_field( $input['toolbar_animation'] ) : 'slide-top' ); 547 $valid['toolbar_animation'] = (in_array($input['toolbar_animation'], $valid_animations, true) ? sanitize_text_field($input['toolbar_animation']) : 'slide-top'); 548 // Validate language 549 $valid_languages = [ 550 'en', 551 'fr', 552 'es', 553 'de', 554 'it', 555 'pt', 556 'ar' 557 ]; 558 $valid['language'] = (in_array($input['language'], $valid_languages, true) ? sanitize_text_field($input['language']) : 'en'); 518 559 return $valid; 519 560 } … … 522 563 * Display admin page 523 564 */ 524 public function admin_page() { 565 public function admin_page() 566 { 525 567 // Check user capabilities 526 if ( !current_user_can( 'manage_options' )) {568 if (!current_user_can('manage_options')) { 527 569 return; 528 570 } 529 571 ?> 530 572 <div class="wrap"> 531 <h1><?php 532 esc_html_e( 'AccessiMate Settings', 'accessimate');573 <h1><?php 574 esc_html_e('AccessiMate Settings', 'accessimate'); 533 575 ?></h1> 534 576 535 577 <div class="accessimate-admin-header"> 536 <p><?php 537 esc_html_e( 'Make your WordPress website more accessible with AccessiMate. Configure the settings below to enable various accessibility features.', 'accessimate');578 <p><?php 579 esc_html_e('Make your WordPress website more accessible with AccessiMate. Configure the settings below to enable various accessibility features.', 'accessimate'); 538 580 ?></p> 539 581 </div> 540 582 541 583 <form method="post" action="options.php"> 542 <?php 543 settings_fields( 'accessimate_options');544 do_settings_sections( 'accessimate');584 <?php 585 settings_fields('accessimate_options'); 586 do_settings_sections('accessimate'); 545 587 submit_button(); 546 588 ?> … … 548 590 549 591 <div class="accessimate-admin-info"> 550 <h3><?php 551 esc_html_e( 'Accessibility Guidelines', 'accessimate');592 <h3><?php 593 esc_html_e('Accessibility Guidelines', 'accessimate'); 552 594 ?></h3> 553 <p class="desc"><?php 554 esc_html_e( 'Follow these best practices to improve the accessibility of your website for all users, including those with disabilities.', 'accessimate');595 <p class="desc"><?php 596 esc_html_e('Follow these best practices to improve the accessibility of your website for all users, including those with disabilities.', 'accessimate'); 555 597 ?></p> 556 598 557 599 <ul> 558 600 <li> 559 <strong><?php 560 esc_html_e( 'Use Descriptive Alt Text:', 'accessimate');601 <strong><?php 602 esc_html_e('Use Descriptive Alt Text:', 'accessimate'); 561 603 ?></strong> 562 <?php 563 esc_html_e( 'All images should have meaningful alternative (alt) text to convey the purpose of the image to screen readers.', 'accessimate');604 <?php 605 esc_html_e('All images should have meaningful alternative (alt) text to convey the purpose of the image to screen readers.', 'accessimate'); 564 606 ?> 565 607 </li> 566 608 <li> 567 <strong><?php 568 esc_html_e( 'Follow Heading Hierarchy:', 'accessimate');609 <strong><?php 610 esc_html_e('Follow Heading Hierarchy:', 'accessimate'); 569 611 ?></strong> 570 <?php 571 esc_html_e( 'Use proper HTML heading structure (e.g., H1 for main titles, H2 for sections, H3 for sub-sections) to organize content clearly.', 'accessimate');612 <?php 613 esc_html_e('Use proper HTML heading structure (e.g., H1 for main titles, H2 for sections, H3 for sub-sections) to organize content clearly.', 'accessimate'); 572 614 ?> 573 615 </li> 574 616 <li> 575 <strong><?php 576 esc_html_e( 'Ensure Sufficient Color Contrast:', 'accessimate');617 <strong><?php 618 esc_html_e('Ensure Sufficient Color Contrast:', 'accessimate'); 577 619 ?></strong> 578 <?php 579 esc_html_e( 'Text and interactive elements should have a high contrast ratio against their backgrounds for readability.', 'accessimate');620 <?php 621 esc_html_e('Text and interactive elements should have a high contrast ratio against their backgrounds for readability.', 'accessimate'); 580 622 ?> 581 623 </li> 582 624 <li> 583 <strong><?php 584 esc_html_e( 'Enable Keyboard Navigation:', 'accessimate');625 <strong><?php 626 esc_html_e('Enable Keyboard Navigation:', 'accessimate'); 585 627 ?></strong> 586 <?php 587 esc_html_e( 'All functionality should be usable with a keyboard alone, without requiring a mouse.', 'accessimate');628 <?php 629 esc_html_e('All functionality should be usable with a keyboard alone, without requiring a mouse.', 'accessimate'); 588 630 ?> 589 631 </li> 590 632 <li> 591 <strong><?php 592 esc_html_e( 'Use Descriptive Link Text:', 'accessimate');633 <strong><?php 634 esc_html_e('Use Descriptive Link Text:', 'accessimate'); 593 635 ?></strong> 594 <?php 595 esc_html_e( 'Avoid generic phrases like "click here" — use link text that describes the target (e.g., "Download Accessibility Guide").', 'accessimate');636 <?php 637 esc_html_e('Avoid generic phrases like "click here" — use link text that describes the target (e.g., "Download Accessibility Guide").', 'accessimate'); 596 638 ?> 597 639 </li> 598 640 <li> 599 <strong><?php 600 esc_html_e( 'Provide Captions & Transcripts:', 'accessimate');641 <strong><?php 642 esc_html_e('Provide Captions & Transcripts:', 'accessimate'); 601 643 ?></strong> 602 <?php 603 esc_html_e( 'Videos should have captions, and audio content should include transcripts to support users with hearing impairments.', 'accessimate');644 <?php 645 esc_html_e('Videos should have captions, and audio content should include transcripts to support users with hearing impairments.', 'accessimate'); 604 646 ?> 605 647 </li> 606 648 <li> 607 <strong><?php 608 esc_html_e( 'Don’t Rely on Color Alone:', 'accessimate');649 <strong><?php 650 esc_html_e('Don’t Rely on Color Alone:', 'accessimate'); 609 651 ?></strong> 610 <?php 611 esc_html_e( 'Use patterns, labels, or icons in addition to color to convey information (e.g., for charts or status indicators).', 'accessimate');652 <?php 653 esc_html_e('Use patterns, labels, or icons in addition to color to convey information (e.g., for charts or status indicators).', 'accessimate'); 612 654 ?> 613 655 </li> 614 656 <li> 615 <strong><?php 616 esc_html_e( 'Label All Form Inputs:', 'accessimate');657 <strong><?php 658 esc_html_e('Label All Form Inputs:', 'accessimate'); 617 659 ?></strong> 618 <?php 619 esc_html_e( 'Forms must have clear, programmatically associated labels for all input fields.', 'accessimate');660 <?php 661 esc_html_e('Forms must have clear, programmatically associated labels for all input fields.', 'accessimate'); 620 662 ?> 621 663 </li> 622 664 <li> 623 <strong><?php 624 esc_html_e( 'Make Focus States Visible:', 'accessimate');665 <strong><?php 666 esc_html_e('Make Focus States Visible:', 'accessimate'); 625 667 ?></strong> 626 <?php 627 esc_html_e( 'Users navigating with a keyboard should see clear focus outlines on buttons, links, and form elements.', 'accessimate');668 <?php 669 esc_html_e('Users navigating with a keyboard should see clear focus outlines on buttons, links, and form elements.', 'accessimate'); 628 670 ?> 629 671 </li> 630 672 <li> 631 <strong><?php 632 esc_html_e( 'Avoid Unexpected Content Changes:', 'accessimate');673 <strong><?php 674 esc_html_e('Avoid Unexpected Content Changes:', 'accessimate'); 633 675 ?></strong> 634 <?php 635 esc_html_e( 'Content that changes automatically (like sliders or popups) should be controllable and not disrupt user interaction.', 'accessimate');676 <?php 677 esc_html_e('Content that changes automatically (like sliders or popups) should be controllable and not disrupt user interaction.', 'accessimate'); 636 678 ?> 637 679 </li> … … 640 682 641 683 </div> 642 <?php 684 <?php 643 685 } 644 686 … … 648 690 * @param string $hook The current admin page. 649 691 */ 650 public function enqueue_admin_scripts( $hook ) { 692 public function enqueue_admin_scripts($hook) 693 { 651 694 // Only load on AccessiMate settings page 652 if ( 'settings_page_accessimate' !== $hook) {695 if ('settings_page_accessimate' !== $hook) { 653 696 return; 654 697 } … … 670 713 * Enqueue frontend scripts and styles 671 714 */ 672 public function enqueue_frontend_scripts() { 673 $options = get_option( 'accessimate_options' ); 674 if ( !isset( $options['enable_toolbar'] ) || !$options['enable_toolbar'] ) { 715 public function enqueue_frontend_scripts() 716 { 717 $options = get_option('accessimate_options'); 718 if (!isset($options['enable_toolbar']) || !$options['enable_toolbar']) { 675 719 return; 676 720 } … … 696 740 ); 697 741 // Localize script for AJAX 698 wp_localize_script( 'accessimate-frontend', 'accessimate_ajax', [699 'ajax_url' => admin_url( 'admin-ajax.php'),700 'nonce' => wp_create_nonce( 'accessimate_nonce'),742 wp_localize_script('accessimate-frontend', 'accessimate_ajax', [ 743 'ajax_url' => admin_url('admin-ajax.php'), 744 'nonce' => wp_create_nonce('accessimate_nonce'), 701 745 'ai_features' => [ 702 746 'text_to_speech' => $options['ai_text_to_speech'] ?? 0, … … 705 749 'reading_assistance' => $options['reading_assistance'] ?? 0, 706 750 ], 707 ] );751 ]); 708 752 } 709 753 … … 715 759 * @return array|null Button data or null if key is not found 716 760 */ 717 private function getFeatures( $key = null ) { 761 private function getFeatures($key = null) 762 { 718 763 $features = [ 719 764 [ 720 765 'id' => 'bigger-text', 721 766 'icon' => 'format_size', 722 'label' => 'Bigger Text', 767 'label' => [ 768 'en' => 'Bigger Text', 769 'fr' => 'Texte Plus Grand', 770 ], 723 771 'default' => true, 724 772 'has_step' => true, … … 727 775 'id' => 'cursor', 728 776 'icon' => 'arrow_selector_tool', 729 'label' => 'Cursor', 777 'label' => [ 778 'en' => 'Cursor', 779 'fr' => 'Curseur', 780 ], 730 781 'default' => true, 731 782 'has_step' => true, … … 734 785 'id' => 'line-height', 735 786 'icon' => 'format_line_spacing', 736 'label' => 'Line Height', 787 'label' => [ 788 'en' => 'Line Height', 789 'fr' => 'Hauteur de Ligne', 790 ], 737 791 'default' => true, 738 792 'has_step' => true, … … 741 795 'id' => 'letter-spacing', 742 796 'icon' => 'format_letter_spacing', 743 'label' => 'Letter Spacing', 797 'label' => [ 798 'en' => 'Letter Spacing', 799 'fr' => 'Espacement des Lettres', 800 ], 744 801 'default' => true, 745 802 'has_step' => true, … … 748 805 'id' => 'readable-font', 749 806 'icon' => 'hdr_auto', 750 'label' => 'Readable Font', 807 'label' => [ 808 'en' => 'Readable Font', 809 'fr' => 'Police Lisible', 810 ], 751 811 'default' => true, 752 812 ], … … 754 814 'id' => 'dyslexic-font', 755 815 'icon' => 'brand_family', 756 'label' => 'Dyslexic Font', 816 'label' => [ 817 'en' => 'Dyslexic Font', 818 'fr' => 'Police Dyslexique', 819 ], 757 820 'default' => true, 758 821 ], … … 760 823 'id' => 'text-align', 761 824 'icon' => 'format_align_left', 762 'label' => 'Text Align', 825 'label' => [ 826 'en' => 'Text Align', 827 'fr' => 'Alignement du Texte', 828 ], 763 829 'default' => true, 764 830 'has_step' => true, … … 767 833 'id' => 'text-magnifier', 768 834 'icon' => 'loupe', 769 'label' => 'Text Magnifier', 835 'label' => [ 836 'en' => 'Text Magnifier', 837 'fr' => 'Loupe de Texte', 838 ], 770 839 'default' => true, 771 840 ], … … 773 842 'id' => 'highlight-links', 774 843 'icon' => 'link', 775 'label' => 'Highlight Links', 844 'label' => [ 845 'en' => 'Highlight Links', 846 'fr' => 'Mettre en Évidence les Liens', 847 ], 776 848 'default' => true, 777 849 ], … … 779 851 'id' => 'invert-colors', 780 852 'icon' => 'invert_colors', 781 'label' => 'Invert Colors', 853 'label' => [ 854 'en' => 'Invert Colors', 855 'fr' => 'Inverser les Couleurs', 856 ], 782 857 'default' => true, 783 858 'has_step' => true, … … 786 861 'id' => 'brightness', 787 862 'icon' => 'brightness_6', 788 'label' => 'Brightness', 863 'label' => [ 864 'en' => 'Brightness', 865 'fr' => 'Luminosité', 866 ], 789 867 'default' => true, 790 868 'has_step' => true, … … 793 871 'id' => 'contrast', 794 872 'icon' => 'contrast', 795 'label' => 'Contrast', 873 'label' => [ 874 'en' => 'Contrast', 875 'fr' => 'Contraste', 876 ], 796 877 'has_step' => true, 797 878 'default' => true, 798 879 ], 799 880 [ 800 'id' => 'gray -scale',881 'id' => 'grayscale', 801 882 'icon' => 'filter_b_and_w', 802 'label' => 'Grayscale', 883 'label' => [ 884 'en' => 'Grayscale', 885 'fr' => 'Niveaux de Gris', 886 ], 803 887 'default' => true, 804 888 'has_step' => true, … … 807 891 'id' => 'saturation', 808 892 'icon' => 'palette', 809 'label' => 'Saturation', 893 'label' => [ 894 'en' => 'Saturation', 895 'fr' => 'Saturation', 896 ], 810 897 'default' => true, 811 898 'has_step' => true, … … 814 901 'id' => 'reading-line', 815 902 'icon' => 'insert_page_break', 816 'label' => 'Reading Line', 903 'label' => [ 904 'en' => 'Reading Line', 905 'fr' => 'Ligne de Lecture', 906 ], 817 907 'default' => true, 818 908 ], … … 820 910 'id' => 'reading-mask', 821 911 'icon' => 'credit_card', 822 'label' => 'Reading Mask', 912 'label' => [ 913 'en' => 'Reading Mask', 914 'fr' => 'Masque de Lecture', 915 ], 823 916 'default' => true, 824 917 ], … … 826 919 'id' => 'highlight-all', 827 920 'icon' => 'highlight', 828 'label' => 'Highlight All', 921 'label' => [ 922 'en' => 'Highlight All', 923 'fr' => 'Tout Mettre en Évidence', 924 ], 829 925 'default' => true, 830 926 ], … … 832 928 'id' => 'highlight-titles', 833 929 'icon' => 'title', 834 'label' => 'Highlight Titles', 930 'label' => [ 931 'en' => 'Highlight Titles', 932 'fr' => 'Mettre en Évidence les Titres', 933 ], 835 934 'default' => true, 836 935 ], … … 838 937 'id' => 'keyboard', 839 938 'icon' => 'keyboard', 840 'label' => 'Keyboard', 939 'label' => [ 940 'en' => 'Keyboard Navigation', 941 'fr' => 'Navigation au Clavier', 942 ], 841 943 'default' => true, 842 944 ], … … 844 946 'id' => 'hide-images', 845 947 'icon' => 'hide_image', 846 'label' => 'Hide Images', 948 'label' => [ 949 'en' => 'Hide Images', 950 'fr' => 'Cacher les Images', 951 ], 847 952 'default' => true, 848 953 ], … … 850 955 'id' => 'text-to-speech', 851 956 'icon' => 'text_to_speech', 852 'label' => 'Text to Speech', 957 'label' => [ 958 'en' => 'Text to Speech', 959 'fr' => 'Texte en Parole', 960 ], 853 961 'default' => true, 854 962 ], … … 856 964 'id' => 'mute-sounds', 857 965 'icon' => 'volume_off', 858 'label' => 'Mute Sounds', 966 'label' => [ 967 'en' => 'Mute Sounds', 968 'fr' => 'Couper les Sons', 969 ], 859 970 'default' => true, 860 971 ], … … 862 973 'id' => 'stop-animations', 863 974 'icon' => 'animation', 864 'label' => 'Stop Animations', 975 'label' => [ 976 'en' => 'Stop Animations', 977 'fr' => 'Arrêter les Animations', 978 ], 865 979 'default' => true, 866 980 ], … … 868 982 'id' => 'simplify-text', 869 983 'icon' => 'description', 870 'label' => 'Simplify Text', 984 'label' => [ 985 'en' => 'Simplify Text', 986 'fr' => 'Simplifier le Texte', 987 ], 871 988 'default' => false, 872 989 ], … … 874 991 'id' => 'scan-page', 875 992 'icon' => 'scan', 876 'label' => 'Scan Page', 993 'label' => [ 994 'en' => 'Scan Page', 995 'fr' => 'Analyser la Page', 996 ], 877 997 'default' => false, 878 998 ] 879 999 ]; 880 return ( $key === null ? $features : array_filter( $features, fn( $feature ) => $feature['id'] === $key ));1000 return ($key === null ? $features : array_filter($features, fn ($feature) => $feature['id'] === $key)); 881 1001 } 882 1002 … … 884 1004 * Render accessibility toolbar 885 1005 */ 886 public function render_accessibility_toolbar() { 887 $options = get_option( 'accessimate_options' ); 888 if ( !isset( $options['enable_toolbar'] ) || !$options['enable_toolbar'] ) { 1006 public function render_accessibility_toolbar() 1007 { 1008 $options = get_option('accessimate_options'); 1009 if (!isset($options['enable_toolbar']) || !$options['enable_toolbar']) { 889 1010 return; 890 1011 } 891 1012 $position = $options['toolbar_position'] ?? 'bottom-right'; 892 ?> 893 894 <div data-accessimate-theme="<?php 895 echo esc_attr( $options['toolbar_theme'] ?? 'auto' ); 896 ?>" id="accessimate-toolbar" class="accessimate-toolbar accessimate-<?php 897 echo esc_attr( $position ); 1013 $language = $options['language'] ?? 'en'; 1014 $title = [ 1015 'en' => 'Accessibility', 1016 'fr' => 'Accessibilité', 1017 'es' => 'Accesibilidad', 1018 'de' => 'Barrierefreiheit', 1019 'it' => 'Accessibilità', 1020 'pt' => 'Acessibilidade', 1021 'ar' => 'إمكانية الوصول', 1022 ]; 1023 ?> 1024 1025 <div data-accessimate-language="<?php 1026 echo esc_attr($language); 1027 ?>" data-accessimate-theme="<?php 1028 echo esc_attr($options['toolbar_theme'] ?? 'auto'); 1029 ?>" id="accessimate-toolbar" class="accessimate-toolbar accessimate-<?php 1030 echo esc_attr($position); 898 1031 ?>"> 899 1032 <div class="accessimate-toolbar-toggle"> 900 <button id="accessimate-toggle" aria-label="<?php 901 esc_attr_e( 'Toggle Accessibility Options', 'accessimate');1033 <button id="accessimate-toggle" aria-label="<?php 1034 esc_attr_e('Toggle Accessibility Options', 'accessimate'); 902 1035 ?>"> 903 1036 <span class="accessimate-icon">accessibility</span> … … 905 1038 </div> 906 1039 907 <div id="accessimate-panel" class="accessimate-panel" style="display: none;" data-animation="<?php 908 echo esc_attr( $options['toolbar_animation'] ?? 'slide-top');1040 <div id="accessimate-panel" class="accessimate-panel" style="display: none;" data-animation="<?php 1041 echo esc_attr($options['toolbar_animation'] ?? 'slide-top'); 909 1042 ?>"> 910 1043 <div class="accessimate-panel-header"> 911 <h3><?php 912 e sc_html_e( 'Accessibility', 'accessimate');1044 <h3><?php 1045 echo esc_html($title[$language] ?? $title['en']); 913 1046 ?></h3> 914 1047 <div class="accessimate-header-actions"> … … 916 1049 <span class="accessimate-icon">brightness_4</span> 917 1050 </button> 918 <button id="accessimate-close" aria-label="<?php 919 esc_attr_e( 'Close Accessibility Panel', 'accessimate');1051 <button id="accessimate-close" aria-label="<?php 1052 esc_attr_e('Close Accessibility Panel', 'accessimate'); 920 1053 ?>"> 921 1054 <span class="accessimate-icon">close</span> … … 925 1058 926 1059 <div class="accessimate-panel-content"> 927 <?php 928 foreach ( $this->getFeatures() as $feature) {1060 <?php 1061 foreach ($this->getFeatures() as $feature) { 929 1062 $id = $feature['id']; 930 1063 $icon = $feature['icon']; 931 $label = $feature['label'] ;1064 $label = $feature['label'][$language] ?? $feature['label']['en']; 932 1065 $label_id = "accessimate-option-label-{$id}"; 933 $has_step = isset( $feature['has_step']) && $feature['has_step'];934 $is_active = filter_var( $options[$id] ?? $feature['default'] ?? false, FILTER_VALIDATE_BOOLEAN);1066 $has_step = isset($feature['has_step']) && $feature['has_step']; 1067 $is_active = filter_var($options[$id] ?? $feature['default'] ?? false, FILTER_VALIDATE_BOOLEAN); 935 1068 ?> 936 1069 937 <?php 938 if ( $is_active) {1070 <?php 1071 if ($is_active) { 939 1072 ?> 940 <button id="accessimate-<?php 941 echo esc_attr( $id);1073 <button id="accessimate-<?php 1074 echo esc_attr($id); 942 1075 ?>" class="accessimate-btn"> 943 <span class="accessimate-icon"><?php 944 echo esc_html( $icon);1076 <span class="accessimate-icon"><?php 1077 echo esc_html($icon); 945 1078 ?></span> 946 <span class="accessimate-option-label" id="<?php 947 echo esc_attr( $label_id);1079 <span class="accessimate-option-label" id="<?php 1080 echo esc_attr($label_id); 948 1081 ?>"> 949 <?php 950 esc_html_e( $label, 'accessimate');1082 <?php 1083 esc_html_e($label, 'accessimate'); 951 1084 ?> 952 1085 </span> 953 <?php 954 if ( $has_step) {1086 <?php 1087 if ($has_step) { 955 1088 ?> 956 1089 <div class="accessimate-option-step"></div> 957 <?php 1090 <?php 958 1091 } 959 1092 ?> 960 1093 </button> 961 <?php 1094 <?php 962 1095 } 963 1096 ?> 964 <?php 1097 <?php 965 1098 } 966 1099 ?> … … 969 1102 <button id="accessimate-reset" class="accessimate-btn accessimate-btn-full accessimate-btn-reset"> 970 1103 <span class="accessimate-icon">reset_settings</span> 971 <?php 972 esc_html_e( 'Reset All', 'accessimate' ); 1104 <?php 1105 $reset_label = [ 1106 'en' => 'Reset All', 1107 'fr' => 'Tout Réinitialiser', 1108 'es' => 'Restablecer Todo', 1109 'de' => 'Alles Zurücksetzen', 1110 'it' => 'Reimpostare Tutto', 1111 'pt' => 'Redefinir Tudo', 1112 'ar' => 'إعادة تعيين الكل', 1113 ]; 1114 ?> 1115 <?php 1116 echo esc_html($reset_label[$language] ?? $reset_label['en']); 973 1117 ?> 974 1118 </button> … … 977 1121 </div> 978 1122 979 <?php 980 if ( isset( $options['enable_skip_links'] ) && $options['enable_skip_links']) {1123 <?php 1124 if (isset($options['enable_skip_links']) && $options['enable_skip_links']) { 981 1125 ?> 982 <a href="#main" class="accessimate-skip-link"><?php 983 esc_html_e( 'Skip to main content', 'accessimate');1126 <a href="#main" class="accessimate-skip-link"><?php 1127 esc_html_e('Skip to main content', 'accessimate'); 984 1128 ?></a> 985 <?php 986 } 987 ?> 988 <?php 1129 <?php 1130 } 1131 ?> 1132 <?php 989 1133 } 990 1134 … … 992 1136 * Save user preferences via AJAX 993 1137 */ 994 public function save_user_preferences() { 1138 public function save_user_preferences() 1139 { 995 1140 // Verify nonce for security 996 if ( !check_ajax_referer( 'accessimate_nonce', 'nonce', false )) {997 wp_send_json_error( [998 'message' => __( 'Security check failed', 'accessimate'),999 ] );1141 if (!check_ajax_referer('accessimate_nonce', 'nonce', false)) { 1142 wp_send_json_error([ 1143 'message' => __('Security check failed', 'accessimate'), 1144 ]); 1000 1145 } 1001 1146 // Validate input 1002 if ( !isset( $_POST['preferences'] )) {1003 wp_send_json_error( [1004 'message' => __( 'Missing preferences data', 'accessimate'),1005 ] );1006 } 1007 $preferences = sanitize_text_field( wp_unslash( $_POST['preferences'] ));1147 if (!isset($_POST['preferences'])) { 1148 wp_send_json_error([ 1149 'message' => __('Missing preferences data', 'accessimate'), 1150 ]); 1151 } 1152 $preferences = sanitize_text_field(wp_unslash($_POST['preferences'])); 1008 1153 $session_id = session_id(); 1009 if ( empty( $session_id )) {1154 if (empty($session_id)) { 1010 1155 session_start(); 1011 1156 $session_id = session_id(); … … 1016 1161 // a built-in API for custom user preference storage with session handling 1017 1162 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 1018 $result = $wpdb->replace( $table_name, [1163 $result = $wpdb->replace($table_name, [ 1019 1164 'user_session' => $session_id, 1020 1165 'preferences' => $preferences, 1021 ], ['%s', '%s'] );1022 if ( false === $result) {1023 wp_send_json_error( [1024 'message' => __( 'Failed to save preferences', 'accessimate'),1025 ] );1026 } 1027 wp_send_json_success( [1028 'message' => __( 'Preferences saved successfully', 'accessimate'),1029 ] );1166 ], ['%s', '%s']); 1167 if (false === $result) { 1168 wp_send_json_error([ 1169 'message' => __('Failed to save preferences', 'accessimate'), 1170 ]); 1171 } 1172 wp_send_json_success([ 1173 'message' => __('Preferences saved successfully', 'accessimate'), 1174 ]); 1030 1175 } 1031 1176 -
accessimate/tags/1.0.4/assets/js/accessimate-frontend.js
r3384547 r3442731 16 16 this.fontSize = 100; 17 17 this.isOpen = false; 18 this.language = this.toolbar.data('accessimate-language') || 'en'; 18 19 this.excludedElements = ".accessimate-notification, .accessimate-notification *, .accessimate-toolbar, .accessimate-toolbar *, #wpadminbar, #wpadminbar *, rs-fullwidth-wrap, rs-fullwidth-wrap *, rs-module-wrap, rs-module-wrap *, sr7-module, sr7-module *"; 19 20 … … 693 694 694 695 grayscale(level, $notification = true) { 696 695 697 const filter = level === 'grayscale-v1' ? "grayscale(33%) !important;" : level === 'grayscale-v2' ? "grayscale(66%) !important;" : level === 'grayscale-v3' ? "grayscale(100%) !important;" : null; 698 696 699 $("html").not(this.excludedElements).each(function () { 697 700 let style = $(this).attr("style") || ""; … … 706 709 707 710 if ($notification) { 708 const label = level === 1 ? 'Grayscale V1' : level === 2 ? 'Grayscale V2' : level === 3? 'Grayscale V3' : 'Default';711 const label = level === 'grayscale-v1' ? 'Grayscale V1' : level === 'grayscale-v2' ? 'Grayscale V2' : level === 'grayscale-v3' ? 'Grayscale V3' : 'Default'; 709 712 this.showNotification(`Grayscale: ${label}`); 710 713 } … … 1320 1323 button = this.getTrigger($key), 1321 1324 buttonText = button.find('.accessimate-option-label'), 1322 name= this.options[$key].name || $key.charAt(0).toUpperCase() + $key.slice(1),1325 label = this.options[$key].name || $key.charAt(0).toUpperCase() + $key.slice(1), 1323 1326 currentType = this.getPreferences($key) || 'default', 1324 1327 prefix = `accessimate-${this.#camelToHyphen($key)}`; 1328 1329 let labels = { 1330 default: { 1331 en: 'Default', 1332 fr: 'Par défaut', 1333 es: 'Predeterminado', 1334 de: 'Standard', 1335 it: 'Predefinito', 1336 pt: 'Padrão', 1337 ar: 'افتراضي', 1338 }, 1339 disabled: { 1340 en: 'Disabled', 1341 fr: 'Désactivé', 1342 es: 'Desactivado', 1343 de: 'Deaktiviert', 1344 it: 'Disattivato', 1345 pt: 'Desativado', 1346 ar: 'معطل', 1347 }, 1348 enabled: { 1349 en: 'Enabled', 1350 fr: 'Activé', 1351 es: 'Activado', 1352 de: 'Aktiviert', 1353 it: 'Attivato', 1354 pt: 'Ativado', 1355 ar: 'مفعل', 1356 }, 1357 'bigger-text': { 1358 en: 'Bigger Text', 1359 fr: 'Texte plus grand', 1360 es: 'Texto más grande', 1361 de: 'Größerer Text', 1362 it: 'Testo più grande', 1363 pt: 'Texto maior', 1364 ar: 'نص أكبر', 1365 }, 1366 small: { 1367 en: 'Small', 1368 fr: 'Petit', 1369 es: 'Pequeño', 1370 de: 'Klein', 1371 it: 'Piccolo', 1372 pt: 'Pequeno', 1373 ar: 'صغير', 1374 }, 1375 medium: { 1376 en: 'Medium', 1377 fr: 'Moyen', 1378 es: 'Medio', 1379 de: 'Mittel', 1380 it: 'Medio', 1381 pt: 'Médio', 1382 ar: 'متوسط', 1383 }, 1384 large: { 1385 en: 'Large', 1386 fr: 'Grand', 1387 es: 'Grande', 1388 de: 'Groß', 1389 it: 'Grande', 1390 pt: 'Grande', 1391 ar: 'كبير', 1392 }, 1393 biggest: { 1394 en: 'Biggest', 1395 fr: 'Très grand', 1396 es: 'Muy grande', 1397 de: 'Sehr groß', 1398 it: 'Molto grande', 1399 pt: 'Muito grande', 1400 ar: 'كبير جدًا', 1401 }, 1402 cursor: { 1403 en: 'Cursor', 1404 fr: 'Curseur', 1405 es: 'Cursor', 1406 de: 'Cursor', 1407 it: 'Cursore', 1408 pt: 'Cursor', 1409 ar: 'المؤشر', 1410 }, 1411 'cursor-v1': { 1412 en: 'Cursor V1', 1413 fr: 'Curseur V1', 1414 es: 'Cursor V1', 1415 de: 'Cursor V1', 1416 it: 'Cursore V1', 1417 pt: 'Cursor V1', 1418 ar: 'المؤشر V1', 1419 }, 1420 'cursor-v2': { 1421 en: 'Cursor V2', 1422 fr: 'Curseur V2', 1423 es: 'Cursor V2', 1424 de: 'Cursor V2', 1425 it: 'Cursore V2', 1426 pt: 'Cursor V2', 1427 ar: 'المؤشر V2', 1428 }, 1429 'cursor-v3': { 1430 en: 'Cursor V3', 1431 fr: 'Curseur V3', 1432 es: 'Cursor V3', 1433 de: 'Cursor V3', 1434 it: 'Cursore V3', 1435 pt: 'Cursor V3', 1436 ar: 'المؤشر V3', 1437 }, 1438 'line-height': { 1439 en: 'Line Height', 1440 fr: 'Hauteur de ligne', 1441 es: 'Altura de línea', 1442 de: 'Zeilenhöhe', 1443 it: 'Altezza linea', 1444 pt: 'Altura da linha', 1445 ar: 'ارتفاع السطر', 1446 }, 1447 'letter-spacing': { 1448 en: 'Letter Spacing', 1449 fr: 'Espacement des lettres', 1450 es: 'Espaciado de letras', 1451 de: 'Zeichenabstand', 1452 it: 'Spaziatura lettere', 1453 pt: 'Espaçamento de letras', 1454 ar: 'تباعد الحروف', 1455 }, 1456 'readable-font': { 1457 en: 'Readable Font', 1458 fr: 'Police lisible', 1459 es: 'Fuente legible', 1460 de: 'Lesbare Schrift', 1461 it: 'Font leggibile', 1462 pt: 'Fonte legível', 1463 ar: 'خط واضح', 1464 }, 1465 'dyslexic-font': { 1466 en: 'Dyslexic Font', 1467 fr: 'Police pour dyslexie', 1468 es: 'Fuente para dislexia', 1469 de: 'Dyslexie-Schrift', 1470 it: 'Font per dislessia', 1471 pt: 'Fonte para dislexia', 1472 ar: 'خط لعسر القراءة', 1473 }, 1474 'text-align': { 1475 en: 'Text Align', 1476 fr: 'Alignement du texte', 1477 es: 'Alineación del texto', 1478 de: 'Textausrichtung', 1479 it: 'Allineamento testo', 1480 pt: 'Alinhamento do texto', 1481 ar: 'محاذاة النص', 1482 }, 1483 left: { 1484 en: 'Left', 1485 fr: 'Gauche', 1486 es: 'Izquierda', 1487 de: 'Links', 1488 it: 'Sinistra', 1489 pt: 'Esquerda', 1490 ar: 'يسار', 1491 }, 1492 center: { 1493 en: 'Center', 1494 fr: 'Centre', 1495 es: 'Centro', 1496 de: 'Zentriert', 1497 it: 'Centro', 1498 pt: 'Centro', 1499 ar: 'وسط', 1500 }, 1501 right: { 1502 en: 'Right', 1503 fr: 'Droite', 1504 es: 'Derecha', 1505 de: 'Rechts', 1506 it: 'Destra', 1507 pt: 'Direita', 1508 ar: 'يمين', 1509 }, 1510 justify: { 1511 en: 'Justify', 1512 fr: 'Justifié', 1513 es: 'Justificado', 1514 de: 'Blocksatz', 1515 it: 'Giustificato', 1516 pt: 'Justificado', 1517 ar: 'محاذاة كاملة', 1518 }, 1519 'text-magnifier': { 1520 en: 'Text Magnifier', 1521 fr: 'Loupe de texte', 1522 es: 'Lupa de texto', 1523 de: 'Textlupe', 1524 it: 'Lente di testo', 1525 pt: 'Lupa de texto', 1526 ar: 'مكبر النص', 1527 }, 1528 'highlight-links': { 1529 en: 'Highlight Links', 1530 fr: 'Mettre en évidence les liens', 1531 es: 'Resaltar enlaces', 1532 de: 'Links hervorheben', 1533 it: 'Evidenzia link', 1534 pt: 'Destacar links', 1535 ar: 'تمييز الروابط', 1536 }, 1537 underline: { 1538 en: 'Underline', 1539 fr: 'Souligner', 1540 es: 'Subrayar', 1541 de: 'Unterstreichen', 1542 it: 'Sottolinea', 1543 pt: 'Sublinhar', 1544 ar: 'تسطير', 1545 }, 1546 box: { 1547 en: 'Box', 1548 fr: 'Boîte', 1549 es: 'Caja', 1550 de: 'Box', 1551 it: 'Riquadro', 1552 pt: 'Caixa', 1553 ar: 'مربع', 1554 }, 1555 background: { 1556 en: 'Background', 1557 fr: 'Arrière-plan', 1558 es: 'Fondo', 1559 de: 'Hintergrund', 1560 it: 'Sfondo', 1561 pt: 'Fundo', 1562 ar: 'الخلفية', 1563 }, 1564 'invert-colors': { 1565 en: 'Invert Colors', 1566 fr: 'Inverser les couleurs', 1567 es: 'Invertir colores', 1568 de: 'Farben invertieren', 1569 it: 'Inverti colori', 1570 pt: 'Inverter cores', 1571 ar: 'عكس الألوان', 1572 }, 1573 brightness: { 1574 en: 'Brightness', 1575 fr: 'Luminosité', 1576 es: 'Brillo', 1577 de: 'Helligkeit', 1578 it: 'Luminosità', 1579 pt: 'Brilho', 1580 ar: 'السطوع', 1581 }, 1582 contrast: { 1583 en: 'Contrast', 1584 fr: 'Contraste', 1585 es: 'Contraste', 1586 de: 'Kontrast', 1587 it: 'Contrasto', 1588 pt: 'Contraste', 1589 ar: 'التباين', 1590 }, 1591 dark: { 1592 en: 'Dark', 1593 fr: 'Sombre', 1594 es: 'Oscuro', 1595 de: 'Dunkel', 1596 it: 'Scuro', 1597 pt: 'Escuro', 1598 ar: 'داكن', 1599 }, 1600 light: { 1601 en: 'Light', 1602 fr: 'Clair', 1603 es: 'Claro', 1604 de: 'Hell', 1605 it: 'Chiaro', 1606 pt: 'Claro', 1607 ar: 'فاتح', 1608 }, 1609 grayscale: { 1610 en: 'Grayscale', 1611 fr: 'Niveaux de gris', 1612 es: 'Escala de grises', 1613 de: 'Graustufen', 1614 it: 'Scala di grigi', 1615 pt: 'Escala de cinza', 1616 ar: 'تدرج الرمادي', 1617 }, 1618 'grayscale-v1': { 1619 en: 'Grayscale V1', 1620 fr: 'Niveaux de gris V1', 1621 es: 'Escala de grises V1', 1622 de: 'Graustufen V1', 1623 it: 'Scala di grigi V1', 1624 pt: 'Escala de cinza V1', 1625 ar: 'تدرج الرمادي V1', 1626 }, 1627 'grayscale-v2': { 1628 en: 'Grayscale V2', 1629 fr: 'Niveaux de gris V2', 1630 es: 'Escala de grises V2', 1631 de: 'Graustufen V2', 1632 it: 'Scala di grigi V2', 1633 pt: 'Escala de cinza V2', 1634 ar: 'تدرج الرمادي V2', 1635 }, 1636 'grayscale-v3': { 1637 en: 'Grayscale V3', 1638 fr: 'Niveaux de gris V3', 1639 es: 'Escala de grises V3', 1640 de: 'Graustufen V3', 1641 it: 'Scala di grigi V3', 1642 pt: 'Escala de cinza V3', 1643 ar: 'تدرج الرمادي V3', 1644 }, 1645 saturation: { 1646 en: 'Saturation', 1647 fr: 'Saturation', 1648 es: 'Saturación', 1649 de: 'Sättigung', 1650 it: 'Saturazione', 1651 pt: 'Saturação', 1652 ar: 'التشبع', 1653 }, 1654 'high-contrast': { 1655 en: 'High Contrast', 1656 fr: 'Haut contraste', 1657 es: 'Alto contraste', 1658 de: 'Hoher Kontrast', 1659 it: 'Alto contrasto', 1660 pt: 'Alto contraste', 1661 ar: 'تباين عالٍ', 1662 }, 1663 'reading-line': { 1664 en: 'Reading Line', 1665 fr: 'Ligne de lecture', 1666 es: 'Línea de lectura', 1667 de: 'Leselinie', 1668 it: 'Linea di lettura', 1669 pt: 'Linha de leitura', 1670 ar: 'سطر القراءة', 1671 }, 1672 'reading-mask': { 1673 en: 'Reading Mask', 1674 fr: 'Masque de lecture', 1675 es: 'Máscara de lectura', 1676 de: 'Lesemaske', 1677 it: 'Maschera di lettura', 1678 pt: 'Máscara de leitura', 1679 ar: 'قناع القراءة', 1680 }, 1681 rectangle: { 1682 en: 'Rectangle', 1683 fr: 'Rectangle', 1684 es: 'Rectángulo', 1685 de: 'Rechteck', 1686 it: 'Rettangolo', 1687 pt: 'Retângulo', 1688 ar: 'مستطيل', 1689 }, 1690 circle: { 1691 en: 'Circle', 1692 fr: 'Cercle', 1693 es: 'Círculo', 1694 de: 'Kreis', 1695 it: 'Cerchio', 1696 pt: 'Círculo', 1697 ar: 'دائرة', 1698 }, 1699 'mute-sounds': { 1700 en: 'Mute Sounds', 1701 fr: 'Couper les sons', 1702 es: 'Silenciar sonidos', 1703 de: 'Sounds stummschalten', 1704 it: 'Disattiva suoni', 1705 pt: 'Silenciar sons', 1706 ar: 'كتم الأصوات', 1707 }, 1708 'stop-animations': { 1709 en: 'Stop Animations', 1710 fr: 'Arrêter les animations', 1711 es: 'Detener animaciones', 1712 de: 'Animationen stoppen', 1713 it: 'Ferma animazioni', 1714 pt: 'Parar animações', 1715 ar: 'إيقاف الرسوم المتحركة', 1716 }, 1717 'text-to-speech': { 1718 en: 'Text to Speech', 1719 fr: 'Synthèse vocale', 1720 es: 'Texto a voz', 1721 de: 'Text-zu-Sprache', 1722 it: 'Sintesi vocale', 1723 pt: 'Texto para fala', 1724 ar: 'تحويل النص إلى كلام', 1725 }, 1726 'highlight-all': { 1727 en: 'Highlight All', 1728 fr: 'Tout mettre en évidence', 1729 es: 'Resaltar todo', 1730 de: 'Alles hervorheben', 1731 it: 'Evidenzia tutto', 1732 pt: 'Destacar tudo', 1733 ar: 'تسليط الضوء على الكل', 1734 }, 1735 'highlight-titles': { 1736 en: 'Highlight Titles', 1737 fr: 'Mettre en évidence les titres', 1738 es: 'Resaltar títulos', 1739 de: 'Titel hervorheben', 1740 it: 'Evidenzia titoli', 1741 pt: 'Destacar títulos', 1742 ar: 'تمييز العناوين', 1743 }, 1744 keyboard: { 1745 en: 'Keyboard', 1746 fr: 'Clavier', 1747 es: 'Teclado', 1748 de: 'Tastatur', 1749 it: 'Tastiera', 1750 pt: 'Teclado', 1751 ar: 'لوحة المفاتيح', 1752 }, 1753 'hide-images': { 1754 en: 'Hide Images', 1755 fr: 'Masquer les images', 1756 es: 'Ocultar imágenes', 1757 de: 'Bilder ausblenden', 1758 it: 'Nascondi immagini', 1759 pt: 'Ocultar imagens', 1760 ar: 'إخفاء الصور', 1761 } 1762 }; 1763 1764 const labelLang = labels[label.toLowerCase().replace(/ /g, '-')] || { en: label, fr: label }; 1765 const name = labelLang[this.language] || labelLang['en']; 1325 1766 1326 1767 if (currentType === 'default' || currentType === 'disabled') { … … 1329 1770 }); 1330 1771 button.removeClass('active'); 1772 1331 1773 buttonText.text(name); 1332 1774 } else if (currentType === 'enabled') { … … 1343 1785 button.addClass('active'); 1344 1786 buttonText.text( 1345 `${currentType.charAt(0).toUpperCase() + currentType.slice(1).replace(/-/g, ' ')}`1787 labels[currentType][this.language] || labels[currentType]['en'] 1346 1788 ); 1347 1789 -
accessimate/tags/1.0.4/readme.txt
r3420458 r3442731 100 100 101 101 == Changelog == 102 = 1.0.4 = 103 * Added multi-language support to the Toolbox. 104 102 105 = 1.0.3 = 103 106 * Tested and confirmed compatibility with current WordPress versions. -
accessimate/trunk/accessimate.php
r3420458 r3442731 2 2 3 3 /** 4 * Plugin Name: AccessiMate 4 * Plugin Name: AccessiMate Pro 5 5 * Description: A comprehensive WordPress accessibility plugin that provides tools to make your website more accessible to users with disabilities. 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: BDPlugins 8 * Author URI: https://bdplugins.com/ 8 9 * License: GPL v2 or later 9 10 * Text Domain: accessimate 10 11 */ 11 12 // Prevent direct access 12 if ( !defined( 'ABSPATH' )) {13 if (!defined('ABSPATH')) { 13 14 exit; 14 15 } 15 16 // Define plugin constants 16 define( 'ACCESSIMATE_VERSION', '1.0.3');17 define( 'ACCESSIMATE_PLUGIN_DIR', plugin_dir_path( __FILE__ ));18 define( 'ACCESSIMATE_PLUGIN_URL', plugin_dir_url( __FILE__ ));19 define( 'ACCESSIMATE_AI_ENABLED', true);20 if ( function_exists( 'bdpacc_fs' )) {21 bdpacc_fs()->set_basename( false, __FILE__);17 define('ACCESSIMATE_VERSION', '1.0.4'); 18 define('ACCESSIMATE_PLUGIN_DIR', plugin_dir_path(__FILE__)); 19 define('ACCESSIMATE_PLUGIN_URL', plugin_dir_url(__FILE__)); 20 define('ACCESSIMATE_AI_ENABLED', true); 21 if (function_exists('bdpacc_fs')) { 22 bdpacc_fs()->set_basename(false, __FILE__); 22 23 } else { 23 24 /** … … 25 26 * `function_exists` CALL ABOVE TO PROPERLY WORK. 26 27 */ 27 if ( !function_exists( 'bdpacc_fs' )) {28 if (!function_exists('bdpacc_fs')) { 28 29 // Create a helper function for easy SDK access. 29 function bdpacc_fs() { 30 function bdpacc_fs() 31 { 30 32 global $bdpacc_fs; 31 if ( !isset( $bdpacc_fs )) {33 if (!isset($bdpacc_fs)) { 32 34 // Include Freemius SDK. 33 require_once dirname( __FILE__) . '/vendor/freemius/start.php';34 $bdpacc_fs = fs_dynamic_init( [35 require_once dirname(__FILE__) . '/vendor/freemius/start.php'; 36 $bdpacc_fs = fs_dynamic_init([ 35 37 'id' => '20125', 36 38 'slug' => 'accessimate', … … 55 57 ], 56 58 'is_live' => true, 57 ] );59 ]); 58 60 } 59 61 return $bdpacc_fs; … … 63 65 bdpacc_fs(); 64 66 // Signal that SDK was initiated. 65 do_action( 'bdpacc_fs_loaded');67 do_action('bdpacc_fs_loaded'); 66 68 // Initialize the plugin 67 69 new AccessiMate(); … … 69 71 // ... Your plugin's main file logic ... 70 72 } 71 class AccessiMate { 73 class AccessiMate 74 { 72 75 /** 73 76 * Constructor 74 77 */ 75 public function __construct() { 76 add_action( 'init', [$this, 'init'] ); 77 register_activation_hook( __FILE__, [$this, 'activate'] ); 78 register_deactivation_hook( __FILE__, [$this, 'deactivate'] ); 78 public function __construct() 79 { 80 add_action('init', [$this, 'init']); 81 register_activation_hook(__FILE__, [$this, 'activate']); 82 register_deactivation_hook(__FILE__, [$this, 'deactivate']); 79 83 } 80 84 … … 82 86 * Initialize the plugin 83 87 */ 84 public function init() { 88 public function init() 89 { 85 90 // Admin hooks 86 if ( is_admin()) {87 add_action( 'admin_menu', [$this, 'add_admin_menu']);88 add_action( 'admin_init', [$this, 'admin_init']);89 add_action( 'admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']);91 if (is_admin()) { 92 add_action('admin_menu', [$this, 'add_admin_menu']); 93 add_action('admin_init', [$this, 'admin_init']); 94 add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']); 90 95 } 91 96 // Frontend hooks 92 add_action( 'wp_enqueue_scripts', [$this, 'enqueue_frontend_scripts']);93 add_action( 'wp_footer', [$this, 'render_accessibility_toolbar']);97 add_action('wp_enqueue_scripts', [$this, 'enqueue_frontend_scripts']); 98 add_action('wp_footer', [$this, 'render_accessibility_toolbar']); 94 99 // AJAX hooks 95 add_action( 'wp_ajax_accessimate_save_settings', [$this, 'save_user_preferences']);96 add_action( 'wp_ajax_nopriv_accessimate_save_settings', [$this, 'save_user_preferences']);97 add_action( 'wp_ajax_accessimate_generate_alt_text', [$this, 'generate_alt_text']);98 add_action( 'wp_ajax_accessimate_scan_content', [$this, 'scan_content_accessibility']);99 add_action( 'wp_ajax_accessimate_simplify_text', [$this, 'simplify_text']);100 add_action('wp_ajax_accessimate_save_settings', [$this, 'save_user_preferences']); 101 add_action('wp_ajax_nopriv_accessimate_save_settings', [$this, 'save_user_preferences']); 102 add_action('wp_ajax_accessimate_generate_alt_text', [$this, 'generate_alt_text']); 103 add_action('wp_ajax_accessimate_scan_content', [$this, 'scan_content_accessibility']); 104 add_action('wp_ajax_accessimate_simplify_text', [$this, 'simplify_text']); 100 105 // AI Features 101 106 // if (ACCESSIMATE_AI_ENABLED) { … … 108 113 * Plugin activation 109 114 */ 110 public function activate() { 115 public function activate() 116 { 111 117 // Set default options 112 118 $default_options = [ … … 139 145 'cursor' => 1, 140 146 ]; 141 add_option( 'accessimate_options', $default_options);147 add_option('accessimate_options', $default_options); 142 148 // Create custom table for user preferences if needed 143 149 $this->create_user_preferences_table(); … … 147 153 * Plugin deactivation 148 154 */ 149 public function deactivate() { 155 public function deactivate() 156 { 150 157 // Clean up if needed (keeping options for now) 151 158 } … … 154 161 * Create user preferences table 155 162 */ 156 private function create_user_preferences_table() { 163 private function create_user_preferences_table() 164 { 157 165 global $wpdb; 158 166 $table_name = "{$wpdb->prefix}accessimate_user_prefs"; 159 167 $charset_collate = $wpdb->get_charset_collate(); 160 $sql = "CREATE TABLE {$table_name} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n user_session varchar(100) NOT NULL,\n preferences text NOT NULL,\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\nUNIQUE KEY user_session (user_session)\n ) {$charset_collate};";168 $sql = "CREATE TABLE {$table_name} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n user_session varchar(100) NOT NULL,\n preferences text NOT NULL,\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\n UNIQUE KEY user_session (user_session)\n ) {$charset_collate};"; 161 169 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 162 dbDelta( $sql);170 dbDelta($sql); 163 171 // Create AI suggestions table 164 172 $ai_table = "{$wpdb->prefix}accessimate_ai_suggestions"; 165 $sql_ai = "CREATE TABLE {$ai_table} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n post_id mediumint(9) NOT NULL,\n suggestion_type varchar(50) NOT NULL,\n original_content text NOT NULL,\n suggested_content text NOT NULL,\n status varchar(20) DEFAULT 'pending',\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\nKEY post_id (post_id)\n ) {$charset_collate};";166 dbDelta( $sql_ai);173 $sql_ai = "CREATE TABLE {$ai_table} (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n post_id mediumint(9) NOT NULL,\n suggestion_type varchar(50) NOT NULL,\n original_content text NOT NULL,\n suggested_content text NOT NULL,\n status varchar(20) DEFAULT 'pending',\n created_at datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (id),\n KEY post_id (post_id)\n ) {$charset_collate};"; 174 dbDelta($sql_ai); 167 175 } 168 176 … … 170 178 * Add admin menu 171 179 */ 172 public function add_admin_menu() { 180 public function add_admin_menu() 181 { 173 182 add_options_page( 174 __( 'AccessiMate Settings', 'accessimate'),175 __( 'AccessiMate', 'accessimate'),183 __('AccessiMate Settings', 'accessimate'), 184 __('AccessiMate', 'accessimate'), 176 185 'manage_options', 177 186 'accessimate', … … 183 192 * Initialize admin settings 184 193 */ 185 public function admin_init() { 186 register_setting( 'accessimate_options', 'accessimate_options', [$this, 'validate_options'] ); 194 public function admin_init() 195 { 196 register_setting('accessimate_options', 'accessimate_options', [$this, 'validate_options']); 187 197 add_settings_section( 188 198 'accessimate_main', 189 __( 'Main Settings', 'accessimate'),199 __('Main Settings', 'accessimate'), 190 200 [$this, 'main_section_callback'], 191 201 'accessimate' … … 195 205 [ 196 206 'id' => 'enable_toolbar', 197 'label' => __( 'Accessibility Toolbar', 'accessimate'),207 'label' => __('Accessibility Toolbar', 'accessimate'), 198 208 'callback' => [$this, 'checkbox_field'], 199 209 'description' => 'Display the accessibility toolbar on the frontend.', … … 201 211 [ 202 212 'id' => 'toolbar_position', 203 'label' => __( 'Toolbar Position', 'accessimate'),213 'label' => __('Toolbar Position', 'accessimate'), 204 214 'callback' => [$this, 'select_field'], 205 215 'options' => [ 206 'top-left' => __( 'Top Left', 'accessimate'),207 'top-right' => __( 'Top Right', 'accessimate'),208 'bottom-left' => __( 'Bottom Left', 'accessimate'),209 'bottom-right' => __( 'Bottom Right', 'accessimate'),216 'top-left' => __('Top Left', 'accessimate'), 217 'top-right' => __('Top Right', 'accessimate'), 218 'bottom-left' => __('Bottom Left', 'accessimate'), 219 'bottom-right' => __('Bottom Right', 'accessimate'), 210 220 ], 211 221 ], 212 222 [ 213 223 'id' => 'toolbar_animation', 214 'label' => __( 'Toolbar Animation', 'accessimate'),224 'label' => __('Toolbar Animation', 'accessimate'), 215 225 'callback' => [$this, 'select_field'], 216 226 'options' => [ 217 'none' => __( 'None', 'accessimate'),218 'fade' => __( 'Fade', 'accessimate'),219 'slide-left' => __( 'Slide Left', 'accessimate'),220 'slide-right' => __( 'Slide Right', 'accessimate'),221 'slide-top' => __( 'Slide Top', 'accessimate'),222 'slide-bottom' => __( 'Slide Bottom', 'accessimate'),227 'none' => __('None', 'accessimate'), 228 'fade' => __('Fade', 'accessimate'), 229 'slide-left' => __('Slide Left', 'accessimate'), 230 'slide-right' => __('Slide Right', 'accessimate'), 231 'slide-top' => __('Slide Top', 'accessimate'), 232 'slide-bottom' => __('Slide Bottom', 'accessimate'), 223 233 ], 224 234 ], 225 235 [ 226 236 'id' => 'toolbar_theme', 227 'label' => __( 'Toolbar Theme', 'accessimate'),237 'label' => __('Toolbar Theme', 'accessimate'), 228 238 'callback' => [$this, 'select_field'], 229 239 'options' => [ 230 'auto' => __( 'Auto (System Preference)', 'accessimate'),231 'light' => __( 'Light', 'accessimate'),232 'dark' => __( 'Dark', 'accessimate'),240 'auto' => __('Auto (System Preference)', 'accessimate'), 241 'light' => __('Light', 'accessimate'), 242 'dark' => __('Dark', 'accessimate'), 233 243 ], 234 244 ], … … 236 246 [ 237 247 'id' => 'bigger-text', 238 'label' => __( 'Bigger Text', 'accessimate'),248 'label' => __('Bigger Text', 'accessimate'), 239 249 'callback' => [$this, 'checkbox_field'], 240 250 'description' => 'Increase text size for better readability.', … … 242 252 [ 243 253 'id' => 'cursor', 244 'label' => __( 'Cursor', 'accessimate'),254 'label' => __('Cursor', 'accessimate'), 245 255 'callback' => [$this, 'checkbox_field'], 246 256 'description' => 'Improve cursor visibility for users with visual challenges.', … … 248 258 [ 249 259 'id' => 'line-height', 250 'label' => __( 'Line Height', 'accessimate'),260 'label' => __('Line Height', 'accessimate'), 251 261 'callback' => [$this, 'checkbox_field'], 252 262 'description' => 'Adjust line spacing to reduce text clutter.', … … 254 264 [ 255 265 'id' => 'letter-spacing', 256 'label' => __( 'Letter Spacing', 'accessimate'),266 'label' => __('Letter Spacing', 'accessimate'), 257 267 'callback' => [$this, 'checkbox_field'], 258 268 'description' => 'Increase spacing between letters for clarity.', … … 260 270 [ 261 271 'id' => 'readable-font', 262 'label' => __( 'Readable Font', 'accessimate'),272 'label' => __('Readable Font', 'accessimate'), 263 273 'callback' => [$this, 'checkbox_field'], 264 274 'description' => 'Use a clean, legible font for easier reading.', … … 266 276 [ 267 277 'id' => 'dyslexic-font', 268 'label' => __( 'Dyslexic Font', 'accessimate'),278 'label' => __('Dyslexic Font', 'accessimate'), 269 279 'callback' => [$this, 'checkbox_field'], 270 280 'description' => 'Enable a font designed to aid dyslexic users.', … … 273 283 [ 274 284 'id' => 'text-align', 275 'label' => __( 'Text Align', 'accessimate'),285 'label' => __('Text Align', 'accessimate'), 276 286 'callback' => [$this, 'checkbox_field'], 277 287 'description' => 'Adjust text alignment for better legibility.', … … 279 289 [ 280 290 'id' => 'text-magnifier', 281 'label' => __( 'Text Magnifier', 'accessimate'),291 'label' => __('Text Magnifier', 'accessimate'), 282 292 'callback' => [$this, 'checkbox_field'], 283 293 'description' => 'Magnify text on hover or focus for better visibility.', … … 286 296 [ 287 297 'id' => 'highlight-links', 288 'label' => __( 'Highlight Links', 'accessimate'),298 'label' => __('Highlight Links', 'accessimate'), 289 299 'callback' => [$this, 'checkbox_field'], 290 300 'description' => 'Highlight all links on the page for visibility.', … … 292 302 [ 293 303 'id' => 'invert-colors', 294 'label' => __( 'Invert Colors', 'accessimate'),304 'label' => __('Invert Colors', 'accessimate'), 295 305 'callback' => [$this, 'checkbox_field'], 296 306 'description' => 'Invert website colors to reduce eye strain.', … … 298 308 [ 299 309 'id' => 'brightness', 300 'label' => __( 'Brightness', 'accessimate'),310 'label' => __('Brightness', 'accessimate'), 301 311 'callback' => [$this, 'checkbox_field'], 302 312 'description' => 'Adjust screen brightness for comfort.', … … 304 314 [ 305 315 'id' => 'contrast', 306 'label' => __( 'Contrast', 'accessimate'),316 'label' => __('Contrast', 'accessimate'), 307 317 'callback' => [$this, 'checkbox_field'], 308 318 'description' => 'Improve content visibility with contrast adjustment.', … … 310 320 ], 311 321 [ 312 'id' => 'gray -scale',313 'label' => __( 'Gray Scale', 'accessimate'),322 'id' => 'grayscale', 323 'label' => __('Grayscale', 'accessimate'), 314 324 'callback' => [$this, 'checkbox_field'], 315 325 'description' => 'Convert content to grayscale for focus.', … … 317 327 [ 318 328 'id' => 'saturation', 319 'label' => __( 'Saturation', 'accessimate'),329 'label' => __('Saturation', 'accessimate'), 320 330 'callback' => [$this, 'checkbox_field'], 321 331 'description' => 'Adjust saturation to reduce visual overload.', … … 324 334 [ 325 335 'id' => 'reading-line', 326 'label' => __( 'Reading Line', 'accessimate'),336 'label' => __('Reading Line', 'accessimate'), 327 337 'callback' => [$this, 'checkbox_field'], 328 338 'description' => 'Display a horizontal line to follow text.', … … 330 340 [ 331 341 'id' => 'reading-mask', 332 'label' => __( 'Reading Mask', 'accessimate'),342 'label' => __('Reading Mask', 'accessimate'), 333 343 'callback' => [$this, 'checkbox_field'], 334 344 'description' => 'Dim parts of the screen to focus on text.', … … 336 346 [ 337 347 'id' => 'highlight-all', 338 'label' => __( 'Highlight All', 'accessimate'),348 'label' => __('Highlight All', 'accessimate'), 339 349 'callback' => [$this, 'checkbox_field'], 340 350 'description' => 'Highlight all content to assist with visual tracking.', … … 342 352 [ 343 353 'id' => 'highlight-titles', 344 'label' => __( 'Highlight Titles', 'accessimate'),354 'label' => __('Highlight Titles', 'accessimate'), 345 355 'callback' => [$this, 'checkbox_field'], 346 356 'description' => 'Emphasize headings and titles for better navigation.', … … 349 359 [ 350 360 'id' => 'hide-images', 351 'label' => __( 'Hide Images', 'accessimate'),361 'label' => __('Hide Images', 'accessimate'), 352 362 'callback' => [$this, 'checkbox_field'], 353 363 'description' => 'Hide images to reduce distractions.', … … 355 365 [ 356 366 'id' => 'text-to-speech', 357 'label' => __( 'Text to Speech', 'accessimate'),367 'label' => __('Text to Speech', 'accessimate'), 358 368 'callback' => [$this, 'checkbox_field'], 359 369 'description' => 'Read out text for users with visual impairments.', … … 362 372 [ 363 373 'id' => 'mute-sounds', 364 'label' => __( 'Mute Sounds', 'accessimate'),374 'label' => __('Mute Sounds', 'accessimate'), 365 375 'callback' => [$this, 'checkbox_field'], 366 376 'description' => 'Silence all site audio for a quieter experience.', … … 369 379 [ 370 380 'id' => 'stop-animations', 371 'label' => __( 'Stop Animations', 'accessimate'),381 'label' => __('Stop Animations', 'accessimate'), 372 382 'callback' => [$this, 'checkbox_field'], 373 383 'description' => 'Stop moving elements to prevent distractions.', … … 375 385 [ 376 386 'id' => 'keyboard', 377 'label' => __( 'Keyboard Navigation', 'accessimate'),387 'label' => __('Keyboard Navigation', 'accessimate'), 378 388 'callback' => [$this, 'checkbox_field'], 379 389 'description' => 'Highlight elements during keyboard navigation.', 380 390 'is_beta' => true, 381 391 ], 392 [ 393 'id' => 'language', 394 'label' => __('Toolbar Language', 'accessimate'), 395 'callback' => [$this, 'select_field'], 396 'options' => [ 397 'en' => __('English', 'accessimate'), 398 'fr' => __('French', 'accessimate'), 399 'es' => __('Spanish', 'accessimate'), 400 'de' => __('German', 'accessimate'), 401 'it' => __('Italian', 'accessimate'), 402 'pt' => __('Portuguese', 'accessimate'), 403 'ar' => __('Arabic', 'accessimate'), 404 ], 405 'description' => __('Select the language for the accessibility toolbar.', 'accessimate'), 406 ], 382 407 ]; 383 408 // Register all fields 384 foreach ( $settings as $setting) {409 foreach ($settings as $setting) { 385 410 $args = [ 386 411 'field' => $setting['id'], 387 412 ]; 388 if ( isset( $setting['description'] )) {413 if (isset($setting['description'])) { 389 414 $args['description'] = $setting['description']; 390 415 } 391 if ( isset( $setting['options'] )) {416 if (isset($setting['options'])) { 392 417 $args['options'] = $setting['options']; 393 418 } 394 if ( isset( $setting['is_beta'] )) {419 if (isset($setting['is_beta'])) { 395 420 $args['is_beta'] = $setting['is_beta']; 396 421 } … … 409 434 * Main settings section callback 410 435 */ 411 public function main_section_callback() { 412 echo '<p>' . esc_html__( 'Configure AccessiMate settings to improve your website accessibility.', 'accessimate' ) . '</p>'; 436 public function main_section_callback() 437 { 438 echo '<p>' . esc_html__('Configure AccessiMate settings to improve your website accessibility.', 'accessimate') . '</p>'; 413 439 } 414 440 … … 418 444 * @param array $args Field arguments. 419 445 */ 420 public function checkbox_field( $args ) { 421 $options = get_option( 'accessimate_options' ); 446 public function checkbox_field($args) 447 { 448 $options = get_option('accessimate_options'); 422 449 $field = $args['field']; 423 $checked = ( isset( $options[$field] ) ? checked( $options[$field], 1, false ) : '');424 $description = ( isset( $args['description'] ) ? $args['description'] : '');425 $is_beta = ( isset( $args['is_beta'] ) ? $args['is_beta'] : false);450 $checked = (isset($options[$field]) ? checked($options[$field], 1, false) : ''); 451 $description = (isset($args['description']) ? $args['description'] : ''); 452 $is_beta = (isset($args['is_beta']) ? $args['is_beta'] : false); 426 453 echo '<label>'; 427 echo '<input type="checkbox" name="accessimate_options[' . esc_attr( $field ) . ']" value="1" ' . wp_kses_post( $checked) . ' /> ';428 echo esc_html( $description);429 if ( $is_beta) {430 echo '<span class="accessimate-beta-feature">' . esc_html__( 'Beta', 'accessimate') . '</span>';454 echo '<input type="checkbox" name="accessimate_options[' . esc_attr($field) . ']" value="1" ' . wp_kses_post($checked) . ' /> '; 455 echo esc_html($description); 456 if ($is_beta) { 457 echo '<span class="accessimate-beta-feature">' . esc_html__('Beta', 'accessimate') . '</span>'; 431 458 } 432 459 echo '</label>'; … … 438 465 * @param array $args Field arguments. 439 466 */ 440 public function select_field( $args ) { 441 $options = get_option( 'accessimate_options' ); 467 public function select_field($args) 468 { 469 $options = get_option('accessimate_options'); 442 470 $field = $args['field']; 443 471 $current = $options[$field] ?? ''; 444 echo '<select name="accessimate_options[' . esc_attr( $field) . ']">';445 foreach ( $args['options'] as $value => $label) {446 $selected = selected( $current, $value, false);447 echo '<option value="' . esc_attr( $value ) . '" ' . wp_kses_post( $selected ) . '>' . esc_html( $label) . '</option>';472 echo '<select name="accessimate_options[' . esc_attr($field) . ']">'; 473 foreach ($args['options'] as $value => $label) { 474 $selected = selected($current, $value, false); 475 echo '<option value="' . esc_attr($value) . '" ' . wp_kses_post($selected) . '>' . esc_html($label) . '</option>'; 448 476 } 449 477 echo '</select>'; … … 455 483 * @param array $args Field arguments. 456 484 */ 457 public function text_field( $args ) { 458 $options = get_option( 'accessimate_options' ); 485 public function text_field($args) 486 { 487 $options = get_option('accessimate_options'); 459 488 $field = $args['field']; 460 $value = ( isset( $options[$field] ) ? esc_attr( $options[$field] ) : '' ); 461 $type = ( isset( $args['type'] ) ? $args['type'] : 'text' ); 462 $description = ( isset( $args['description'] ) ? $args['description'] : '' ); 463 echo '<input type="' . esc_attr( $type ) . '" name="accessimate_options[' . esc_attr( $field ) . ']" value="' . esc_attr( $value ) . '" class="regular-text" />'; 464 if ( $description ) { 465 echo '<p class="description">' . esc_html( $description ) . '</p>'; 466 } 467 } 468 469 public function validate_options( $input ) { 489 $value = (isset($options[$field]) ? esc_attr($options[$field]) : ''); 490 $type = (isset($args['type']) ? $args['type'] : 'text'); 491 $description = (isset($args['description']) ? $args['description'] : ''); 492 echo '<input type="' . esc_attr($type) . '" name="accessimate_options[' . esc_attr($field) . ']" value="' . esc_attr($value) . '" class="regular-text" />'; 493 if ($description) { 494 echo '<p class="description">' . esc_html($description) . '</p>'; 495 } 496 } 497 498 public function validate_options($input) 499 { 470 500 $valid = []; 471 501 // Main settings validation 472 $valid['enable_toolbar'] = ( isset( $input['enable_toolbar'] ) ? 1 : 0);473 $valid['enable_skip_links'] = ( isset( $input['enable_skip_links'] ) ? 1 : 0);474 $valid['bigger-text'] = ( isset( $input['bigger-text'] ) ? 1 : 0);475 $valid['cursor'] = ( isset( $input['cursor'] ) ? 1 : 0);476 $valid['line-height'] = ( isset( $input['line-height'] ) ? 1 : 0);477 $valid['letter-spacing'] = ( isset( $input['letter-spacing'] ) ? 1 : 0);478 $valid['readable-font'] = ( isset( $input['readable-font'] ) ? 1 : 0);479 $valid['dyslexic-font'] = ( isset( $input['dyslexic-font'] ) ? 1 : 0);480 $valid['text-align'] = ( isset( $input['text-align'] ) ? 1 : 0);481 $valid['text-magnifier'] = ( isset( $input['text-magnifier'] ) ? 1 : 0);482 $valid['highlight-links'] = ( isset( $input['highlight-links'] ) ? 1 : 0);483 $valid['invert-colors'] = ( isset( $input['invert-colors'] ) ? 1 : 0);484 $valid['brightness'] = ( isset( $input['brightness'] ) ? 1 : 0);485 $valid['contrast'] = ( isset( $input['contrast'] ) ? 1 : 0);486 $valid['gray -scale'] = ( isset( $input['gray-scale'] ) ? 1 : 0);487 $valid['saturation'] = ( isset( $input['saturation'] ) ? 1 : 0);488 $valid['reading-line'] = ( isset( $input['reading-line'] ) ? 1 : 0);489 $valid['reading-mask'] = ( isset( $input['reading-mask'] ) ? 1 : 0);490 $valid['highlight-all'] = ( isset( $input['highlight-all'] ) ? 1 : 0);491 $valid['highlight-titles'] = ( isset( $input['highlight-titles'] ) ? 1 : 0);492 $valid['hide-images'] = ( isset( $input['hide-images'] ) ? 1 : 0);493 $valid['text-to-speech'] = ( isset( $input['text-to-speech'] ) ? 1 : 0);494 $valid['mute-sounds'] = ( isset( $input['mute-sounds'] ) ? 1 : 0);495 $valid['stop-animations'] = ( isset( $input['stop-animations'] ) ? 1 : 0);496 $valid['keyboard'] = ( isset( $input['keyboard'] ) ? 1 : 0);502 $valid['enable_toolbar'] = (isset($input['enable_toolbar']) ? 1 : 0); 503 $valid['enable_skip_links'] = (isset($input['enable_skip_links']) ? 1 : 0); 504 $valid['bigger-text'] = (isset($input['bigger-text']) ? 1 : 0); 505 $valid['cursor'] = (isset($input['cursor']) ? 1 : 0); 506 $valid['line-height'] = (isset($input['line-height']) ? 1 : 0); 507 $valid['letter-spacing'] = (isset($input['letter-spacing']) ? 1 : 0); 508 $valid['readable-font'] = (isset($input['readable-font']) ? 1 : 0); 509 $valid['dyslexic-font'] = (isset($input['dyslexic-font']) ? 1 : 0); 510 $valid['text-align'] = (isset($input['text-align']) ? 1 : 0); 511 $valid['text-magnifier'] = (isset($input['text-magnifier']) ? 1 : 0); 512 $valid['highlight-links'] = (isset($input['highlight-links']) ? 1 : 0); 513 $valid['invert-colors'] = (isset($input['invert-colors']) ? 1 : 0); 514 $valid['brightness'] = (isset($input['brightness']) ? 1 : 0); 515 $valid['contrast'] = (isset($input['contrast']) ? 1 : 0); 516 $valid['grayscale'] = (isset($input['grayscale']) ? 1 : 0); 517 $valid['saturation'] = (isset($input['saturation']) ? 1 : 0); 518 $valid['reading-line'] = (isset($input['reading-line']) ? 1 : 0); 519 $valid['reading-mask'] = (isset($input['reading-mask']) ? 1 : 0); 520 $valid['highlight-all'] = (isset($input['highlight-all']) ? 1 : 0); 521 $valid['highlight-titles'] = (isset($input['highlight-titles']) ? 1 : 0); 522 $valid['hide-images'] = (isset($input['hide-images']) ? 1 : 0); 523 $valid['text-to-speech'] = (isset($input['text-to-speech']) ? 1 : 0); 524 $valid['mute-sounds'] = (isset($input['mute-sounds']) ? 1 : 0); 525 $valid['stop-animations'] = (isset($input['stop-animations']) ? 1 : 0); 526 $valid['keyboard'] = (isset($input['keyboard']) ? 1 : 0); 497 527 // Validate toolbar position 498 528 $valid_positions = [ … … 502 532 'bottom-right' 503 533 ]; 504 $valid['toolbar_position'] = ( in_array( $input['toolbar_position'], $valid_positions, true ) ? sanitize_text_field( $input['toolbar_position'] ) : 'top-right');534 $valid['toolbar_position'] = (in_array($input['toolbar_position'], $valid_positions, true) ? sanitize_text_field($input['toolbar_position']) : 'top-right'); 505 535 // Validate toolbar theme 506 536 $valid_themes = ['auto', 'light', 'dark']; 507 $valid['toolbar_theme'] = ( in_array( $input['toolbar_theme'], $valid_themes, true ) ? sanitize_text_field( $input['toolbar_theme'] ) : 'auto');537 $valid['toolbar_theme'] = (in_array($input['toolbar_theme'], $valid_themes, true) ? sanitize_text_field($input['toolbar_theme']) : 'auto'); 508 538 // Validate toolbar animation 509 539 $valid_animations = [ … … 515 545 'slide-bottom' 516 546 ]; 517 $valid['toolbar_animation'] = ( in_array( $input['toolbar_animation'], $valid_animations, true ) ? sanitize_text_field( $input['toolbar_animation'] ) : 'slide-top' ); 547 $valid['toolbar_animation'] = (in_array($input['toolbar_animation'], $valid_animations, true) ? sanitize_text_field($input['toolbar_animation']) : 'slide-top'); 548 // Validate language 549 $valid_languages = [ 550 'en', 551 'fr', 552 'es', 553 'de', 554 'it', 555 'pt', 556 'ar' 557 ]; 558 $valid['language'] = (in_array($input['language'], $valid_languages, true) ? sanitize_text_field($input['language']) : 'en'); 518 559 return $valid; 519 560 } … … 522 563 * Display admin page 523 564 */ 524 public function admin_page() { 565 public function admin_page() 566 { 525 567 // Check user capabilities 526 if ( !current_user_can( 'manage_options' )) {568 if (!current_user_can('manage_options')) { 527 569 return; 528 570 } 529 571 ?> 530 572 <div class="wrap"> 531 <h1><?php 532 esc_html_e( 'AccessiMate Settings', 'accessimate');573 <h1><?php 574 esc_html_e('AccessiMate Settings', 'accessimate'); 533 575 ?></h1> 534 576 535 577 <div class="accessimate-admin-header"> 536 <p><?php 537 esc_html_e( 'Make your WordPress website more accessible with AccessiMate. Configure the settings below to enable various accessibility features.', 'accessimate');578 <p><?php 579 esc_html_e('Make your WordPress website more accessible with AccessiMate. Configure the settings below to enable various accessibility features.', 'accessimate'); 538 580 ?></p> 539 581 </div> 540 582 541 583 <form method="post" action="options.php"> 542 <?php 543 settings_fields( 'accessimate_options');544 do_settings_sections( 'accessimate');584 <?php 585 settings_fields('accessimate_options'); 586 do_settings_sections('accessimate'); 545 587 submit_button(); 546 588 ?> … … 548 590 549 591 <div class="accessimate-admin-info"> 550 <h3><?php 551 esc_html_e( 'Accessibility Guidelines', 'accessimate');592 <h3><?php 593 esc_html_e('Accessibility Guidelines', 'accessimate'); 552 594 ?></h3> 553 <p class="desc"><?php 554 esc_html_e( 'Follow these best practices to improve the accessibility of your website for all users, including those with disabilities.', 'accessimate');595 <p class="desc"><?php 596 esc_html_e('Follow these best practices to improve the accessibility of your website for all users, including those with disabilities.', 'accessimate'); 555 597 ?></p> 556 598 557 599 <ul> 558 600 <li> 559 <strong><?php 560 esc_html_e( 'Use Descriptive Alt Text:', 'accessimate');601 <strong><?php 602 esc_html_e('Use Descriptive Alt Text:', 'accessimate'); 561 603 ?></strong> 562 <?php 563 esc_html_e( 'All images should have meaningful alternative (alt) text to convey the purpose of the image to screen readers.', 'accessimate');604 <?php 605 esc_html_e('All images should have meaningful alternative (alt) text to convey the purpose of the image to screen readers.', 'accessimate'); 564 606 ?> 565 607 </li> 566 608 <li> 567 <strong><?php 568 esc_html_e( 'Follow Heading Hierarchy:', 'accessimate');609 <strong><?php 610 esc_html_e('Follow Heading Hierarchy:', 'accessimate'); 569 611 ?></strong> 570 <?php 571 esc_html_e( 'Use proper HTML heading structure (e.g., H1 for main titles, H2 for sections, H3 for sub-sections) to organize content clearly.', 'accessimate');612 <?php 613 esc_html_e('Use proper HTML heading structure (e.g., H1 for main titles, H2 for sections, H3 for sub-sections) to organize content clearly.', 'accessimate'); 572 614 ?> 573 615 </li> 574 616 <li> 575 <strong><?php 576 esc_html_e( 'Ensure Sufficient Color Contrast:', 'accessimate');617 <strong><?php 618 esc_html_e('Ensure Sufficient Color Contrast:', 'accessimate'); 577 619 ?></strong> 578 <?php 579 esc_html_e( 'Text and interactive elements should have a high contrast ratio against their backgrounds for readability.', 'accessimate');620 <?php 621 esc_html_e('Text and interactive elements should have a high contrast ratio against their backgrounds for readability.', 'accessimate'); 580 622 ?> 581 623 </li> 582 624 <li> 583 <strong><?php 584 esc_html_e( 'Enable Keyboard Navigation:', 'accessimate');625 <strong><?php 626 esc_html_e('Enable Keyboard Navigation:', 'accessimate'); 585 627 ?></strong> 586 <?php 587 esc_html_e( 'All functionality should be usable with a keyboard alone, without requiring a mouse.', 'accessimate');628 <?php 629 esc_html_e('All functionality should be usable with a keyboard alone, without requiring a mouse.', 'accessimate'); 588 630 ?> 589 631 </li> 590 632 <li> 591 <strong><?php 592 esc_html_e( 'Use Descriptive Link Text:', 'accessimate');633 <strong><?php 634 esc_html_e('Use Descriptive Link Text:', 'accessimate'); 593 635 ?></strong> 594 <?php 595 esc_html_e( 'Avoid generic phrases like "click here" — use link text that describes the target (e.g., "Download Accessibility Guide").', 'accessimate');636 <?php 637 esc_html_e('Avoid generic phrases like "click here" — use link text that describes the target (e.g., "Download Accessibility Guide").', 'accessimate'); 596 638 ?> 597 639 </li> 598 640 <li> 599 <strong><?php 600 esc_html_e( 'Provide Captions & Transcripts:', 'accessimate');641 <strong><?php 642 esc_html_e('Provide Captions & Transcripts:', 'accessimate'); 601 643 ?></strong> 602 <?php 603 esc_html_e( 'Videos should have captions, and audio content should include transcripts to support users with hearing impairments.', 'accessimate');644 <?php 645 esc_html_e('Videos should have captions, and audio content should include transcripts to support users with hearing impairments.', 'accessimate'); 604 646 ?> 605 647 </li> 606 648 <li> 607 <strong><?php 608 esc_html_e( 'Don’t Rely on Color Alone:', 'accessimate');649 <strong><?php 650 esc_html_e('Don’t Rely on Color Alone:', 'accessimate'); 609 651 ?></strong> 610 <?php 611 esc_html_e( 'Use patterns, labels, or icons in addition to color to convey information (e.g., for charts or status indicators).', 'accessimate');652 <?php 653 esc_html_e('Use patterns, labels, or icons in addition to color to convey information (e.g., for charts or status indicators).', 'accessimate'); 612 654 ?> 613 655 </li> 614 656 <li> 615 <strong><?php 616 esc_html_e( 'Label All Form Inputs:', 'accessimate');657 <strong><?php 658 esc_html_e('Label All Form Inputs:', 'accessimate'); 617 659 ?></strong> 618 <?php 619 esc_html_e( 'Forms must have clear, programmatically associated labels for all input fields.', 'accessimate');660 <?php 661 esc_html_e('Forms must have clear, programmatically associated labels for all input fields.', 'accessimate'); 620 662 ?> 621 663 </li> 622 664 <li> 623 <strong><?php 624 esc_html_e( 'Make Focus States Visible:', 'accessimate');665 <strong><?php 666 esc_html_e('Make Focus States Visible:', 'accessimate'); 625 667 ?></strong> 626 <?php 627 esc_html_e( 'Users navigating with a keyboard should see clear focus outlines on buttons, links, and form elements.', 'accessimate');668 <?php 669 esc_html_e('Users navigating with a keyboard should see clear focus outlines on buttons, links, and form elements.', 'accessimate'); 628 670 ?> 629 671 </li> 630 672 <li> 631 <strong><?php 632 esc_html_e( 'Avoid Unexpected Content Changes:', 'accessimate');673 <strong><?php 674 esc_html_e('Avoid Unexpected Content Changes:', 'accessimate'); 633 675 ?></strong> 634 <?php 635 esc_html_e( 'Content that changes automatically (like sliders or popups) should be controllable and not disrupt user interaction.', 'accessimate');676 <?php 677 esc_html_e('Content that changes automatically (like sliders or popups) should be controllable and not disrupt user interaction.', 'accessimate'); 636 678 ?> 637 679 </li> … … 640 682 641 683 </div> 642 <?php 684 <?php 643 685 } 644 686 … … 648 690 * @param string $hook The current admin page. 649 691 */ 650 public function enqueue_admin_scripts( $hook ) { 692 public function enqueue_admin_scripts($hook) 693 { 651 694 // Only load on AccessiMate settings page 652 if ( 'settings_page_accessimate' !== $hook) {695 if ('settings_page_accessimate' !== $hook) { 653 696 return; 654 697 } … … 670 713 * Enqueue frontend scripts and styles 671 714 */ 672 public function enqueue_frontend_scripts() { 673 $options = get_option( 'accessimate_options' ); 674 if ( !isset( $options['enable_toolbar'] ) || !$options['enable_toolbar'] ) { 715 public function enqueue_frontend_scripts() 716 { 717 $options = get_option('accessimate_options'); 718 if (!isset($options['enable_toolbar']) || !$options['enable_toolbar']) { 675 719 return; 676 720 } … … 696 740 ); 697 741 // Localize script for AJAX 698 wp_localize_script( 'accessimate-frontend', 'accessimate_ajax', [699 'ajax_url' => admin_url( 'admin-ajax.php'),700 'nonce' => wp_create_nonce( 'accessimate_nonce'),742 wp_localize_script('accessimate-frontend', 'accessimate_ajax', [ 743 'ajax_url' => admin_url('admin-ajax.php'), 744 'nonce' => wp_create_nonce('accessimate_nonce'), 701 745 'ai_features' => [ 702 746 'text_to_speech' => $options['ai_text_to_speech'] ?? 0, … … 705 749 'reading_assistance' => $options['reading_assistance'] ?? 0, 706 750 ], 707 ] );751 ]); 708 752 } 709 753 … … 715 759 * @return array|null Button data or null if key is not found 716 760 */ 717 private function getFeatures( $key = null ) { 761 private function getFeatures($key = null) 762 { 718 763 $features = [ 719 764 [ 720 765 'id' => 'bigger-text', 721 766 'icon' => 'format_size', 722 'label' => 'Bigger Text', 767 'label' => [ 768 'en' => 'Bigger Text', 769 'fr' => 'Texte Plus Grand', 770 ], 723 771 'default' => true, 724 772 'has_step' => true, … … 727 775 'id' => 'cursor', 728 776 'icon' => 'arrow_selector_tool', 729 'label' => 'Cursor', 777 'label' => [ 778 'en' => 'Cursor', 779 'fr' => 'Curseur', 780 ], 730 781 'default' => true, 731 782 'has_step' => true, … … 734 785 'id' => 'line-height', 735 786 'icon' => 'format_line_spacing', 736 'label' => 'Line Height', 787 'label' => [ 788 'en' => 'Line Height', 789 'fr' => 'Hauteur de Ligne', 790 ], 737 791 'default' => true, 738 792 'has_step' => true, … … 741 795 'id' => 'letter-spacing', 742 796 'icon' => 'format_letter_spacing', 743 'label' => 'Letter Spacing', 797 'label' => [ 798 'en' => 'Letter Spacing', 799 'fr' => 'Espacement des Lettres', 800 ], 744 801 'default' => true, 745 802 'has_step' => true, … … 748 805 'id' => 'readable-font', 749 806 'icon' => 'hdr_auto', 750 'label' => 'Readable Font', 807 'label' => [ 808 'en' => 'Readable Font', 809 'fr' => 'Police Lisible', 810 ], 751 811 'default' => true, 752 812 ], … … 754 814 'id' => 'dyslexic-font', 755 815 'icon' => 'brand_family', 756 'label' => 'Dyslexic Font', 816 'label' => [ 817 'en' => 'Dyslexic Font', 818 'fr' => 'Police Dyslexique', 819 ], 757 820 'default' => true, 758 821 ], … … 760 823 'id' => 'text-align', 761 824 'icon' => 'format_align_left', 762 'label' => 'Text Align', 825 'label' => [ 826 'en' => 'Text Align', 827 'fr' => 'Alignement du Texte', 828 ], 763 829 'default' => true, 764 830 'has_step' => true, … … 767 833 'id' => 'text-magnifier', 768 834 'icon' => 'loupe', 769 'label' => 'Text Magnifier', 835 'label' => [ 836 'en' => 'Text Magnifier', 837 'fr' => 'Loupe de Texte', 838 ], 770 839 'default' => true, 771 840 ], … … 773 842 'id' => 'highlight-links', 774 843 'icon' => 'link', 775 'label' => 'Highlight Links', 844 'label' => [ 845 'en' => 'Highlight Links', 846 'fr' => 'Mettre en Évidence les Liens', 847 ], 776 848 'default' => true, 777 849 ], … … 779 851 'id' => 'invert-colors', 780 852 'icon' => 'invert_colors', 781 'label' => 'Invert Colors', 853 'label' => [ 854 'en' => 'Invert Colors', 855 'fr' => 'Inverser les Couleurs', 856 ], 782 857 'default' => true, 783 858 'has_step' => true, … … 786 861 'id' => 'brightness', 787 862 'icon' => 'brightness_6', 788 'label' => 'Brightness', 863 'label' => [ 864 'en' => 'Brightness', 865 'fr' => 'Luminosité', 866 ], 789 867 'default' => true, 790 868 'has_step' => true, … … 793 871 'id' => 'contrast', 794 872 'icon' => 'contrast', 795 'label' => 'Contrast', 873 'label' => [ 874 'en' => 'Contrast', 875 'fr' => 'Contraste', 876 ], 796 877 'has_step' => true, 797 878 'default' => true, 798 879 ], 799 880 [ 800 'id' => 'gray -scale',881 'id' => 'grayscale', 801 882 'icon' => 'filter_b_and_w', 802 'label' => 'Grayscale', 883 'label' => [ 884 'en' => 'Grayscale', 885 'fr' => 'Niveaux de Gris', 886 ], 803 887 'default' => true, 804 888 'has_step' => true, … … 807 891 'id' => 'saturation', 808 892 'icon' => 'palette', 809 'label' => 'Saturation', 893 'label' => [ 894 'en' => 'Saturation', 895 'fr' => 'Saturation', 896 ], 810 897 'default' => true, 811 898 'has_step' => true, … … 814 901 'id' => 'reading-line', 815 902 'icon' => 'insert_page_break', 816 'label' => 'Reading Line', 903 'label' => [ 904 'en' => 'Reading Line', 905 'fr' => 'Ligne de Lecture', 906 ], 817 907 'default' => true, 818 908 ], … … 820 910 'id' => 'reading-mask', 821 911 'icon' => 'credit_card', 822 'label' => 'Reading Mask', 912 'label' => [ 913 'en' => 'Reading Mask', 914 'fr' => 'Masque de Lecture', 915 ], 823 916 'default' => true, 824 917 ], … … 826 919 'id' => 'highlight-all', 827 920 'icon' => 'highlight', 828 'label' => 'Highlight All', 921 'label' => [ 922 'en' => 'Highlight All', 923 'fr' => 'Tout Mettre en Évidence', 924 ], 829 925 'default' => true, 830 926 ], … … 832 928 'id' => 'highlight-titles', 833 929 'icon' => 'title', 834 'label' => 'Highlight Titles', 930 'label' => [ 931 'en' => 'Highlight Titles', 932 'fr' => 'Mettre en Évidence les Titres', 933 ], 835 934 'default' => true, 836 935 ], … … 838 937 'id' => 'keyboard', 839 938 'icon' => 'keyboard', 840 'label' => 'Keyboard', 939 'label' => [ 940 'en' => 'Keyboard Navigation', 941 'fr' => 'Navigation au Clavier', 942 ], 841 943 'default' => true, 842 944 ], … … 844 946 'id' => 'hide-images', 845 947 'icon' => 'hide_image', 846 'label' => 'Hide Images', 948 'label' => [ 949 'en' => 'Hide Images', 950 'fr' => 'Cacher les Images', 951 ], 847 952 'default' => true, 848 953 ], … … 850 955 'id' => 'text-to-speech', 851 956 'icon' => 'text_to_speech', 852 'label' => 'Text to Speech', 957 'label' => [ 958 'en' => 'Text to Speech', 959 'fr' => 'Texte en Parole', 960 ], 853 961 'default' => true, 854 962 ], … … 856 964 'id' => 'mute-sounds', 857 965 'icon' => 'volume_off', 858 'label' => 'Mute Sounds', 966 'label' => [ 967 'en' => 'Mute Sounds', 968 'fr' => 'Couper les Sons', 969 ], 859 970 'default' => true, 860 971 ], … … 862 973 'id' => 'stop-animations', 863 974 'icon' => 'animation', 864 'label' => 'Stop Animations', 975 'label' => [ 976 'en' => 'Stop Animations', 977 'fr' => 'Arrêter les Animations', 978 ], 865 979 'default' => true, 866 980 ], … … 868 982 'id' => 'simplify-text', 869 983 'icon' => 'description', 870 'label' => 'Simplify Text', 984 'label' => [ 985 'en' => 'Simplify Text', 986 'fr' => 'Simplifier le Texte', 987 ], 871 988 'default' => false, 872 989 ], … … 874 991 'id' => 'scan-page', 875 992 'icon' => 'scan', 876 'label' => 'Scan Page', 993 'label' => [ 994 'en' => 'Scan Page', 995 'fr' => 'Analyser la Page', 996 ], 877 997 'default' => false, 878 998 ] 879 999 ]; 880 return ( $key === null ? $features : array_filter( $features, fn( $feature ) => $feature['id'] === $key ));1000 return ($key === null ? $features : array_filter($features, fn ($feature) => $feature['id'] === $key)); 881 1001 } 882 1002 … … 884 1004 * Render accessibility toolbar 885 1005 */ 886 public function render_accessibility_toolbar() { 887 $options = get_option( 'accessimate_options' ); 888 if ( !isset( $options['enable_toolbar'] ) || !$options['enable_toolbar'] ) { 1006 public function render_accessibility_toolbar() 1007 { 1008 $options = get_option('accessimate_options'); 1009 if (!isset($options['enable_toolbar']) || !$options['enable_toolbar']) { 889 1010 return; 890 1011 } 891 1012 $position = $options['toolbar_position'] ?? 'bottom-right'; 892 ?> 893 894 <div data-accessimate-theme="<?php 895 echo esc_attr( $options['toolbar_theme'] ?? 'auto' ); 896 ?>" id="accessimate-toolbar" class="accessimate-toolbar accessimate-<?php 897 echo esc_attr( $position ); 1013 $language = $options['language'] ?? 'en'; 1014 $title = [ 1015 'en' => 'Accessibility', 1016 'fr' => 'Accessibilité', 1017 'es' => 'Accesibilidad', 1018 'de' => 'Barrierefreiheit', 1019 'it' => 'Accessibilità', 1020 'pt' => 'Acessibilidade', 1021 'ar' => 'إمكانية الوصول', 1022 ]; 1023 ?> 1024 1025 <div data-accessimate-language="<?php 1026 echo esc_attr($language); 1027 ?>" data-accessimate-theme="<?php 1028 echo esc_attr($options['toolbar_theme'] ?? 'auto'); 1029 ?>" id="accessimate-toolbar" class="accessimate-toolbar accessimate-<?php 1030 echo esc_attr($position); 898 1031 ?>"> 899 1032 <div class="accessimate-toolbar-toggle"> 900 <button id="accessimate-toggle" aria-label="<?php 901 esc_attr_e( 'Toggle Accessibility Options', 'accessimate');1033 <button id="accessimate-toggle" aria-label="<?php 1034 esc_attr_e('Toggle Accessibility Options', 'accessimate'); 902 1035 ?>"> 903 1036 <span class="accessimate-icon">accessibility</span> … … 905 1038 </div> 906 1039 907 <div id="accessimate-panel" class="accessimate-panel" style="display: none;" data-animation="<?php 908 echo esc_attr( $options['toolbar_animation'] ?? 'slide-top');1040 <div id="accessimate-panel" class="accessimate-panel" style="display: none;" data-animation="<?php 1041 echo esc_attr($options['toolbar_animation'] ?? 'slide-top'); 909 1042 ?>"> 910 1043 <div class="accessimate-panel-header"> 911 <h3><?php 912 e sc_html_e( 'Accessibility', 'accessimate');1044 <h3><?php 1045 echo esc_html($title[$language] ?? $title['en']); 913 1046 ?></h3> 914 1047 <div class="accessimate-header-actions"> … … 916 1049 <span class="accessimate-icon">brightness_4</span> 917 1050 </button> 918 <button id="accessimate-close" aria-label="<?php 919 esc_attr_e( 'Close Accessibility Panel', 'accessimate');1051 <button id="accessimate-close" aria-label="<?php 1052 esc_attr_e('Close Accessibility Panel', 'accessimate'); 920 1053 ?>"> 921 1054 <span class="accessimate-icon">close</span> … … 925 1058 926 1059 <div class="accessimate-panel-content"> 927 <?php 928 foreach ( $this->getFeatures() as $feature) {1060 <?php 1061 foreach ($this->getFeatures() as $feature) { 929 1062 $id = $feature['id']; 930 1063 $icon = $feature['icon']; 931 $label = $feature['label'] ;1064 $label = $feature['label'][$language] ?? $feature['label']['en']; 932 1065 $label_id = "accessimate-option-label-{$id}"; 933 $has_step = isset( $feature['has_step']) && $feature['has_step'];934 $is_active = filter_var( $options[$id] ?? $feature['default'] ?? false, FILTER_VALIDATE_BOOLEAN);1066 $has_step = isset($feature['has_step']) && $feature['has_step']; 1067 $is_active = filter_var($options[$id] ?? $feature['default'] ?? false, FILTER_VALIDATE_BOOLEAN); 935 1068 ?> 936 1069 937 <?php 938 if ( $is_active) {1070 <?php 1071 if ($is_active) { 939 1072 ?> 940 <button id="accessimate-<?php 941 echo esc_attr( $id);1073 <button id="accessimate-<?php 1074 echo esc_attr($id); 942 1075 ?>" class="accessimate-btn"> 943 <span class="accessimate-icon"><?php 944 echo esc_html( $icon);1076 <span class="accessimate-icon"><?php 1077 echo esc_html($icon); 945 1078 ?></span> 946 <span class="accessimate-option-label" id="<?php 947 echo esc_attr( $label_id);1079 <span class="accessimate-option-label" id="<?php 1080 echo esc_attr($label_id); 948 1081 ?>"> 949 <?php 950 esc_html_e( $label, 'accessimate');1082 <?php 1083 esc_html_e($label, 'accessimate'); 951 1084 ?> 952 1085 </span> 953 <?php 954 if ( $has_step) {1086 <?php 1087 if ($has_step) { 955 1088 ?> 956 1089 <div class="accessimate-option-step"></div> 957 <?php 1090 <?php 958 1091 } 959 1092 ?> 960 1093 </button> 961 <?php 1094 <?php 962 1095 } 963 1096 ?> 964 <?php 1097 <?php 965 1098 } 966 1099 ?> … … 969 1102 <button id="accessimate-reset" class="accessimate-btn accessimate-btn-full accessimate-btn-reset"> 970 1103 <span class="accessimate-icon">reset_settings</span> 971 <?php 972 esc_html_e( 'Reset All', 'accessimate' ); 1104 <?php 1105 $reset_label = [ 1106 'en' => 'Reset All', 1107 'fr' => 'Tout Réinitialiser', 1108 'es' => 'Restablecer Todo', 1109 'de' => 'Alles Zurücksetzen', 1110 'it' => 'Reimpostare Tutto', 1111 'pt' => 'Redefinir Tudo', 1112 'ar' => 'إعادة تعيين الكل', 1113 ]; 1114 ?> 1115 <?php 1116 echo esc_html($reset_label[$language] ?? $reset_label['en']); 973 1117 ?> 974 1118 </button> … … 977 1121 </div> 978 1122 979 <?php 980 if ( isset( $options['enable_skip_links'] ) && $options['enable_skip_links']) {1123 <?php 1124 if (isset($options['enable_skip_links']) && $options['enable_skip_links']) { 981 1125 ?> 982 <a href="#main" class="accessimate-skip-link"><?php 983 esc_html_e( 'Skip to main content', 'accessimate');1126 <a href="#main" class="accessimate-skip-link"><?php 1127 esc_html_e('Skip to main content', 'accessimate'); 984 1128 ?></a> 985 <?php 986 } 987 ?> 988 <?php 1129 <?php 1130 } 1131 ?> 1132 <?php 989 1133 } 990 1134 … … 992 1136 * Save user preferences via AJAX 993 1137 */ 994 public function save_user_preferences() { 1138 public function save_user_preferences() 1139 { 995 1140 // Verify nonce for security 996 if ( !check_ajax_referer( 'accessimate_nonce', 'nonce', false )) {997 wp_send_json_error( [998 'message' => __( 'Security check failed', 'accessimate'),999 ] );1141 if (!check_ajax_referer('accessimate_nonce', 'nonce', false)) { 1142 wp_send_json_error([ 1143 'message' => __('Security check failed', 'accessimate'), 1144 ]); 1000 1145 } 1001 1146 // Validate input 1002 if ( !isset( $_POST['preferences'] )) {1003 wp_send_json_error( [1004 'message' => __( 'Missing preferences data', 'accessimate'),1005 ] );1006 } 1007 $preferences = sanitize_text_field( wp_unslash( $_POST['preferences'] ));1147 if (!isset($_POST['preferences'])) { 1148 wp_send_json_error([ 1149 'message' => __('Missing preferences data', 'accessimate'), 1150 ]); 1151 } 1152 $preferences = sanitize_text_field(wp_unslash($_POST['preferences'])); 1008 1153 $session_id = session_id(); 1009 if ( empty( $session_id )) {1154 if (empty($session_id)) { 1010 1155 session_start(); 1011 1156 $session_id = session_id(); … … 1016 1161 // a built-in API for custom user preference storage with session handling 1017 1162 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 1018 $result = $wpdb->replace( $table_name, [1163 $result = $wpdb->replace($table_name, [ 1019 1164 'user_session' => $session_id, 1020 1165 'preferences' => $preferences, 1021 ], ['%s', '%s'] );1022 if ( false === $result) {1023 wp_send_json_error( [1024 'message' => __( 'Failed to save preferences', 'accessimate'),1025 ] );1026 } 1027 wp_send_json_success( [1028 'message' => __( 'Preferences saved successfully', 'accessimate'),1029 ] );1166 ], ['%s', '%s']); 1167 if (false === $result) { 1168 wp_send_json_error([ 1169 'message' => __('Failed to save preferences', 'accessimate'), 1170 ]); 1171 } 1172 wp_send_json_success([ 1173 'message' => __('Preferences saved successfully', 'accessimate'), 1174 ]); 1030 1175 } 1031 1176 -
accessimate/trunk/assets/js/accessimate-frontend.js
r3384547 r3442731 16 16 this.fontSize = 100; 17 17 this.isOpen = false; 18 this.language = this.toolbar.data('accessimate-language') || 'en'; 18 19 this.excludedElements = ".accessimate-notification, .accessimate-notification *, .accessimate-toolbar, .accessimate-toolbar *, #wpadminbar, #wpadminbar *, rs-fullwidth-wrap, rs-fullwidth-wrap *, rs-module-wrap, rs-module-wrap *, sr7-module, sr7-module *"; 19 20 … … 693 694 694 695 grayscale(level, $notification = true) { 696 695 697 const filter = level === 'grayscale-v1' ? "grayscale(33%) !important;" : level === 'grayscale-v2' ? "grayscale(66%) !important;" : level === 'grayscale-v3' ? "grayscale(100%) !important;" : null; 698 696 699 $("html").not(this.excludedElements).each(function () { 697 700 let style = $(this).attr("style") || ""; … … 706 709 707 710 if ($notification) { 708 const label = level === 1 ? 'Grayscale V1' : level === 2 ? 'Grayscale V2' : level === 3? 'Grayscale V3' : 'Default';711 const label = level === 'grayscale-v1' ? 'Grayscale V1' : level === 'grayscale-v2' ? 'Grayscale V2' : level === 'grayscale-v3' ? 'Grayscale V3' : 'Default'; 709 712 this.showNotification(`Grayscale: ${label}`); 710 713 } … … 1320 1323 button = this.getTrigger($key), 1321 1324 buttonText = button.find('.accessimate-option-label'), 1322 name= this.options[$key].name || $key.charAt(0).toUpperCase() + $key.slice(1),1325 label = this.options[$key].name || $key.charAt(0).toUpperCase() + $key.slice(1), 1323 1326 currentType = this.getPreferences($key) || 'default', 1324 1327 prefix = `accessimate-${this.#camelToHyphen($key)}`; 1328 1329 let labels = { 1330 default: { 1331 en: 'Default', 1332 fr: 'Par défaut', 1333 es: 'Predeterminado', 1334 de: 'Standard', 1335 it: 'Predefinito', 1336 pt: 'Padrão', 1337 ar: 'افتراضي', 1338 }, 1339 disabled: { 1340 en: 'Disabled', 1341 fr: 'Désactivé', 1342 es: 'Desactivado', 1343 de: 'Deaktiviert', 1344 it: 'Disattivato', 1345 pt: 'Desativado', 1346 ar: 'معطل', 1347 }, 1348 enabled: { 1349 en: 'Enabled', 1350 fr: 'Activé', 1351 es: 'Activado', 1352 de: 'Aktiviert', 1353 it: 'Attivato', 1354 pt: 'Ativado', 1355 ar: 'مفعل', 1356 }, 1357 'bigger-text': { 1358 en: 'Bigger Text', 1359 fr: 'Texte plus grand', 1360 es: 'Texto más grande', 1361 de: 'Größerer Text', 1362 it: 'Testo più grande', 1363 pt: 'Texto maior', 1364 ar: 'نص أكبر', 1365 }, 1366 small: { 1367 en: 'Small', 1368 fr: 'Petit', 1369 es: 'Pequeño', 1370 de: 'Klein', 1371 it: 'Piccolo', 1372 pt: 'Pequeno', 1373 ar: 'صغير', 1374 }, 1375 medium: { 1376 en: 'Medium', 1377 fr: 'Moyen', 1378 es: 'Medio', 1379 de: 'Mittel', 1380 it: 'Medio', 1381 pt: 'Médio', 1382 ar: 'متوسط', 1383 }, 1384 large: { 1385 en: 'Large', 1386 fr: 'Grand', 1387 es: 'Grande', 1388 de: 'Groß', 1389 it: 'Grande', 1390 pt: 'Grande', 1391 ar: 'كبير', 1392 }, 1393 biggest: { 1394 en: 'Biggest', 1395 fr: 'Très grand', 1396 es: 'Muy grande', 1397 de: 'Sehr groß', 1398 it: 'Molto grande', 1399 pt: 'Muito grande', 1400 ar: 'كبير جدًا', 1401 }, 1402 cursor: { 1403 en: 'Cursor', 1404 fr: 'Curseur', 1405 es: 'Cursor', 1406 de: 'Cursor', 1407 it: 'Cursore', 1408 pt: 'Cursor', 1409 ar: 'المؤشر', 1410 }, 1411 'cursor-v1': { 1412 en: 'Cursor V1', 1413 fr: 'Curseur V1', 1414 es: 'Cursor V1', 1415 de: 'Cursor V1', 1416 it: 'Cursore V1', 1417 pt: 'Cursor V1', 1418 ar: 'المؤشر V1', 1419 }, 1420 'cursor-v2': { 1421 en: 'Cursor V2', 1422 fr: 'Curseur V2', 1423 es: 'Cursor V2', 1424 de: 'Cursor V2', 1425 it: 'Cursore V2', 1426 pt: 'Cursor V2', 1427 ar: 'المؤشر V2', 1428 }, 1429 'cursor-v3': { 1430 en: 'Cursor V3', 1431 fr: 'Curseur V3', 1432 es: 'Cursor V3', 1433 de: 'Cursor V3', 1434 it: 'Cursore V3', 1435 pt: 'Cursor V3', 1436 ar: 'المؤشر V3', 1437 }, 1438 'line-height': { 1439 en: 'Line Height', 1440 fr: 'Hauteur de ligne', 1441 es: 'Altura de línea', 1442 de: 'Zeilenhöhe', 1443 it: 'Altezza linea', 1444 pt: 'Altura da linha', 1445 ar: 'ارتفاع السطر', 1446 }, 1447 'letter-spacing': { 1448 en: 'Letter Spacing', 1449 fr: 'Espacement des lettres', 1450 es: 'Espaciado de letras', 1451 de: 'Zeichenabstand', 1452 it: 'Spaziatura lettere', 1453 pt: 'Espaçamento de letras', 1454 ar: 'تباعد الحروف', 1455 }, 1456 'readable-font': { 1457 en: 'Readable Font', 1458 fr: 'Police lisible', 1459 es: 'Fuente legible', 1460 de: 'Lesbare Schrift', 1461 it: 'Font leggibile', 1462 pt: 'Fonte legível', 1463 ar: 'خط واضح', 1464 }, 1465 'dyslexic-font': { 1466 en: 'Dyslexic Font', 1467 fr: 'Police pour dyslexie', 1468 es: 'Fuente para dislexia', 1469 de: 'Dyslexie-Schrift', 1470 it: 'Font per dislessia', 1471 pt: 'Fonte para dislexia', 1472 ar: 'خط لعسر القراءة', 1473 }, 1474 'text-align': { 1475 en: 'Text Align', 1476 fr: 'Alignement du texte', 1477 es: 'Alineación del texto', 1478 de: 'Textausrichtung', 1479 it: 'Allineamento testo', 1480 pt: 'Alinhamento do texto', 1481 ar: 'محاذاة النص', 1482 }, 1483 left: { 1484 en: 'Left', 1485 fr: 'Gauche', 1486 es: 'Izquierda', 1487 de: 'Links', 1488 it: 'Sinistra', 1489 pt: 'Esquerda', 1490 ar: 'يسار', 1491 }, 1492 center: { 1493 en: 'Center', 1494 fr: 'Centre', 1495 es: 'Centro', 1496 de: 'Zentriert', 1497 it: 'Centro', 1498 pt: 'Centro', 1499 ar: 'وسط', 1500 }, 1501 right: { 1502 en: 'Right', 1503 fr: 'Droite', 1504 es: 'Derecha', 1505 de: 'Rechts', 1506 it: 'Destra', 1507 pt: 'Direita', 1508 ar: 'يمين', 1509 }, 1510 justify: { 1511 en: 'Justify', 1512 fr: 'Justifié', 1513 es: 'Justificado', 1514 de: 'Blocksatz', 1515 it: 'Giustificato', 1516 pt: 'Justificado', 1517 ar: 'محاذاة كاملة', 1518 }, 1519 'text-magnifier': { 1520 en: 'Text Magnifier', 1521 fr: 'Loupe de texte', 1522 es: 'Lupa de texto', 1523 de: 'Textlupe', 1524 it: 'Lente di testo', 1525 pt: 'Lupa de texto', 1526 ar: 'مكبر النص', 1527 }, 1528 'highlight-links': { 1529 en: 'Highlight Links', 1530 fr: 'Mettre en évidence les liens', 1531 es: 'Resaltar enlaces', 1532 de: 'Links hervorheben', 1533 it: 'Evidenzia link', 1534 pt: 'Destacar links', 1535 ar: 'تمييز الروابط', 1536 }, 1537 underline: { 1538 en: 'Underline', 1539 fr: 'Souligner', 1540 es: 'Subrayar', 1541 de: 'Unterstreichen', 1542 it: 'Sottolinea', 1543 pt: 'Sublinhar', 1544 ar: 'تسطير', 1545 }, 1546 box: { 1547 en: 'Box', 1548 fr: 'Boîte', 1549 es: 'Caja', 1550 de: 'Box', 1551 it: 'Riquadro', 1552 pt: 'Caixa', 1553 ar: 'مربع', 1554 }, 1555 background: { 1556 en: 'Background', 1557 fr: 'Arrière-plan', 1558 es: 'Fondo', 1559 de: 'Hintergrund', 1560 it: 'Sfondo', 1561 pt: 'Fundo', 1562 ar: 'الخلفية', 1563 }, 1564 'invert-colors': { 1565 en: 'Invert Colors', 1566 fr: 'Inverser les couleurs', 1567 es: 'Invertir colores', 1568 de: 'Farben invertieren', 1569 it: 'Inverti colori', 1570 pt: 'Inverter cores', 1571 ar: 'عكس الألوان', 1572 }, 1573 brightness: { 1574 en: 'Brightness', 1575 fr: 'Luminosité', 1576 es: 'Brillo', 1577 de: 'Helligkeit', 1578 it: 'Luminosità', 1579 pt: 'Brilho', 1580 ar: 'السطوع', 1581 }, 1582 contrast: { 1583 en: 'Contrast', 1584 fr: 'Contraste', 1585 es: 'Contraste', 1586 de: 'Kontrast', 1587 it: 'Contrasto', 1588 pt: 'Contraste', 1589 ar: 'التباين', 1590 }, 1591 dark: { 1592 en: 'Dark', 1593 fr: 'Sombre', 1594 es: 'Oscuro', 1595 de: 'Dunkel', 1596 it: 'Scuro', 1597 pt: 'Escuro', 1598 ar: 'داكن', 1599 }, 1600 light: { 1601 en: 'Light', 1602 fr: 'Clair', 1603 es: 'Claro', 1604 de: 'Hell', 1605 it: 'Chiaro', 1606 pt: 'Claro', 1607 ar: 'فاتح', 1608 }, 1609 grayscale: { 1610 en: 'Grayscale', 1611 fr: 'Niveaux de gris', 1612 es: 'Escala de grises', 1613 de: 'Graustufen', 1614 it: 'Scala di grigi', 1615 pt: 'Escala de cinza', 1616 ar: 'تدرج الرمادي', 1617 }, 1618 'grayscale-v1': { 1619 en: 'Grayscale V1', 1620 fr: 'Niveaux de gris V1', 1621 es: 'Escala de grises V1', 1622 de: 'Graustufen V1', 1623 it: 'Scala di grigi V1', 1624 pt: 'Escala de cinza V1', 1625 ar: 'تدرج الرمادي V1', 1626 }, 1627 'grayscale-v2': { 1628 en: 'Grayscale V2', 1629 fr: 'Niveaux de gris V2', 1630 es: 'Escala de grises V2', 1631 de: 'Graustufen V2', 1632 it: 'Scala di grigi V2', 1633 pt: 'Escala de cinza V2', 1634 ar: 'تدرج الرمادي V2', 1635 }, 1636 'grayscale-v3': { 1637 en: 'Grayscale V3', 1638 fr: 'Niveaux de gris V3', 1639 es: 'Escala de grises V3', 1640 de: 'Graustufen V3', 1641 it: 'Scala di grigi V3', 1642 pt: 'Escala de cinza V3', 1643 ar: 'تدرج الرمادي V3', 1644 }, 1645 saturation: { 1646 en: 'Saturation', 1647 fr: 'Saturation', 1648 es: 'Saturación', 1649 de: 'Sättigung', 1650 it: 'Saturazione', 1651 pt: 'Saturação', 1652 ar: 'التشبع', 1653 }, 1654 'high-contrast': { 1655 en: 'High Contrast', 1656 fr: 'Haut contraste', 1657 es: 'Alto contraste', 1658 de: 'Hoher Kontrast', 1659 it: 'Alto contrasto', 1660 pt: 'Alto contraste', 1661 ar: 'تباين عالٍ', 1662 }, 1663 'reading-line': { 1664 en: 'Reading Line', 1665 fr: 'Ligne de lecture', 1666 es: 'Línea de lectura', 1667 de: 'Leselinie', 1668 it: 'Linea di lettura', 1669 pt: 'Linha de leitura', 1670 ar: 'سطر القراءة', 1671 }, 1672 'reading-mask': { 1673 en: 'Reading Mask', 1674 fr: 'Masque de lecture', 1675 es: 'Máscara de lectura', 1676 de: 'Lesemaske', 1677 it: 'Maschera di lettura', 1678 pt: 'Máscara de leitura', 1679 ar: 'قناع القراءة', 1680 }, 1681 rectangle: { 1682 en: 'Rectangle', 1683 fr: 'Rectangle', 1684 es: 'Rectángulo', 1685 de: 'Rechteck', 1686 it: 'Rettangolo', 1687 pt: 'Retângulo', 1688 ar: 'مستطيل', 1689 }, 1690 circle: { 1691 en: 'Circle', 1692 fr: 'Cercle', 1693 es: 'Círculo', 1694 de: 'Kreis', 1695 it: 'Cerchio', 1696 pt: 'Círculo', 1697 ar: 'دائرة', 1698 }, 1699 'mute-sounds': { 1700 en: 'Mute Sounds', 1701 fr: 'Couper les sons', 1702 es: 'Silenciar sonidos', 1703 de: 'Sounds stummschalten', 1704 it: 'Disattiva suoni', 1705 pt: 'Silenciar sons', 1706 ar: 'كتم الأصوات', 1707 }, 1708 'stop-animations': { 1709 en: 'Stop Animations', 1710 fr: 'Arrêter les animations', 1711 es: 'Detener animaciones', 1712 de: 'Animationen stoppen', 1713 it: 'Ferma animazioni', 1714 pt: 'Parar animações', 1715 ar: 'إيقاف الرسوم المتحركة', 1716 }, 1717 'text-to-speech': { 1718 en: 'Text to Speech', 1719 fr: 'Synthèse vocale', 1720 es: 'Texto a voz', 1721 de: 'Text-zu-Sprache', 1722 it: 'Sintesi vocale', 1723 pt: 'Texto para fala', 1724 ar: 'تحويل النص إلى كلام', 1725 }, 1726 'highlight-all': { 1727 en: 'Highlight All', 1728 fr: 'Tout mettre en évidence', 1729 es: 'Resaltar todo', 1730 de: 'Alles hervorheben', 1731 it: 'Evidenzia tutto', 1732 pt: 'Destacar tudo', 1733 ar: 'تسليط الضوء على الكل', 1734 }, 1735 'highlight-titles': { 1736 en: 'Highlight Titles', 1737 fr: 'Mettre en évidence les titres', 1738 es: 'Resaltar títulos', 1739 de: 'Titel hervorheben', 1740 it: 'Evidenzia titoli', 1741 pt: 'Destacar títulos', 1742 ar: 'تمييز العناوين', 1743 }, 1744 keyboard: { 1745 en: 'Keyboard', 1746 fr: 'Clavier', 1747 es: 'Teclado', 1748 de: 'Tastatur', 1749 it: 'Tastiera', 1750 pt: 'Teclado', 1751 ar: 'لوحة المفاتيح', 1752 }, 1753 'hide-images': { 1754 en: 'Hide Images', 1755 fr: 'Masquer les images', 1756 es: 'Ocultar imágenes', 1757 de: 'Bilder ausblenden', 1758 it: 'Nascondi immagini', 1759 pt: 'Ocultar imagens', 1760 ar: 'إخفاء الصور', 1761 } 1762 }; 1763 1764 const labelLang = labels[label.toLowerCase().replace(/ /g, '-')] || { en: label, fr: label }; 1765 const name = labelLang[this.language] || labelLang['en']; 1325 1766 1326 1767 if (currentType === 'default' || currentType === 'disabled') { … … 1329 1770 }); 1330 1771 button.removeClass('active'); 1772 1331 1773 buttonText.text(name); 1332 1774 } else if (currentType === 'enabled') { … … 1343 1785 button.addClass('active'); 1344 1786 buttonText.text( 1345 `${currentType.charAt(0).toUpperCase() + currentType.slice(1).replace(/-/g, ' ')}`1787 labels[currentType][this.language] || labels[currentType]['en'] 1346 1788 ); 1347 1789 -
accessimate/trunk/readme.txt
r3420458 r3442731 100 100 101 101 == Changelog == 102 = 1.0.4 = 103 * Added multi-language support to the Toolbox. 104 102 105 = 1.0.3 = 103 106 * Tested and confirmed compatibility with current WordPress versions.
Note: See TracChangeset
for help on using the changeset viewer.