Plugin Directory

Changeset 3442731


Ignore:
Timestamp:
01/19/2026 06:30:15 PM (2 months ago)
Author:
bdplugins
Message:

add v1.0.4 support 6 languages

Location:
accessimate
Files:
2 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • accessimate/tags/1.0.4/accessimate.php

    r3420458 r3442731  
    22
    33/**
    4  * Plugin Name: AccessiMate
     4 * Plugin Name: AccessiMate Pro
    55 * Description: A comprehensive WordPress accessibility plugin that provides tools to make your website more accessible to users with disabilities.
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77 * Author: BDPlugins
     8 * Author URI: https://bdplugins.com/
    89 * License: GPL v2 or later
    910 * Text Domain: accessimate
    1011 */
    1112// Prevent direct access
    12 if ( !defined( 'ABSPATH' ) ) {
     13if (!defined('ABSPATH')) {
    1314    exit;
    1415}
    1516// 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__ );
     17define('ACCESSIMATE_VERSION', '1.0.4');
     18define('ACCESSIMATE_PLUGIN_DIR', plugin_dir_path(__FILE__));
     19define('ACCESSIMATE_PLUGIN_URL', plugin_dir_url(__FILE__));
     20define('ACCESSIMATE_AI_ENABLED', true);
     21if (function_exists('bdpacc_fs')) {
     22    bdpacc_fs()->set_basename(false, __FILE__);
    2223} else {
    2324    /**
     
    2526     * `function_exists` CALL ABOVE TO PROPERLY WORK.
    2627     */
    27     if ( !function_exists( 'bdpacc_fs' ) ) {
     28    if (!function_exists('bdpacc_fs')) {
    2829        // Create a helper function for easy SDK access.
    29         function bdpacc_fs() {
     30        function bdpacc_fs()
     31        {
    3032            global $bdpacc_fs;
    31             if ( !isset( $bdpacc_fs ) ) {
     33            if (!isset($bdpacc_fs)) {
    3234                // 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([
    3537                    'id'               => '20125',
    3638                    'slug'             => 'accessimate',
     
    5557                    ],
    5658                    'is_live'          => true,
    57                 ] );
     59                ]);
    5860            }
    5961            return $bdpacc_fs;
     
    6365        bdpacc_fs();
    6466        // Signal that SDK was initiated.
    65         do_action( 'bdpacc_fs_loaded' );
     67        do_action('bdpacc_fs_loaded');
    6668        // Initialize the plugin
    6769        new AccessiMate();
     
    6971    // ... Your plugin's main file logic ...
    7072}
    71 class AccessiMate {
     73class AccessiMate
     74{
    7275    /**
    7376     * Constructor
    7477     */
    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']);
    7983    }
    8084
     
    8286     * Initialize the plugin
    8387     */
    84     public function init() {
     88    public function init()
     89    {
    8590        // 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']);
    9095        }
    9196        // 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']);
    9499        // 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']);
    100105        // AI Features
    101106        // if (ACCESSIMATE_AI_ENABLED) {
     
    108113     * Plugin activation
    109114     */
    110     public function activate() {
     115    public function activate()
     116    {
    111117        // Set default options
    112118        $default_options = [
     
    139145            'cursor'            => 1,
    140146        ];
    141         add_option( 'accessimate_options', $default_options );
     147        add_option('accessimate_options', $default_options);
    142148        // Create custom table for user preferences if needed
    143149        $this->create_user_preferences_table();
     
    147153     * Plugin deactivation
    148154     */
    149     public function deactivate() {
     155    public function deactivate()
     156    {
    150157        // Clean up if needed (keeping options for now)
    151158    }
     
    154161     * Create user preferences table
    155162     */
    156     private function create_user_preferences_table() {
     163    private function create_user_preferences_table()
     164    {
    157165        global $wpdb;
    158166        $table_name = "{$wpdb->prefix}accessimate_user_prefs";
    159167        $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),\n            UNIQUE 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};";
    161169        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    162         dbDelta( $sql );
     170        dbDelta($sql);
    163171        // Create AI suggestions table
    164172        $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),\n            KEY 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);
    167175    }
    168176
     
    170178     * Add admin menu
    171179     */
    172     public function add_admin_menu() {
     180    public function add_admin_menu()
     181    {
    173182        add_options_page(
    174             __( 'AccessiMate Settings', 'accessimate' ),
    175             __( 'AccessiMate', 'accessimate' ),
     183            __('AccessiMate Settings', 'accessimate'),
     184            __('AccessiMate', 'accessimate'),
    176185            'manage_options',
    177186            'accessimate',
     
    183192     * Initialize admin settings
    184193     */
    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']);
    187197        add_settings_section(
    188198            'accessimate_main',
    189             __( 'Main Settings', 'accessimate' ),
     199            __('Main Settings', 'accessimate'),
    190200            [$this, 'main_section_callback'],
    191201            'accessimate'
     
    195205            [
    196206                'id'          => 'enable_toolbar',
    197                 'label'       => __( 'Accessibility Toolbar', 'accessimate' ),
     207                'label'       => __('Accessibility Toolbar', 'accessimate'),
    198208                'callback'    => [$this, 'checkbox_field'],
    199209                'description' => 'Display the accessibility toolbar on the frontend.',
     
    201211            [
    202212                'id'       => 'toolbar_position',
    203                 'label'    => __( 'Toolbar Position', 'accessimate' ),
     213                'label'    => __('Toolbar Position', 'accessimate'),
    204214                'callback' => [$this, 'select_field'],
    205215                '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'),
    210220                ],
    211221            ],
    212222            [
    213223                'id'       => 'toolbar_animation',
    214                 'label'    => __( 'Toolbar Animation', 'accessimate' ),
     224                'label'    => __('Toolbar Animation', 'accessimate'),
    215225                'callback' => [$this, 'select_field'],
    216226                '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'),
    223233                ],
    224234            ],
    225235            [
    226236                'id'       => 'toolbar_theme',
    227                 'label'    => __( 'Toolbar Theme', 'accessimate' ),
     237                'label'    => __('Toolbar Theme', 'accessimate'),
    228238                'callback' => [$this, 'select_field'],
    229239                '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'),
    233243                ],
    234244            ],
     
    236246            [
    237247                'id'          => 'bigger-text',
    238                 'label'       => __( 'Bigger Text', 'accessimate' ),
     248                'label'       => __('Bigger Text', 'accessimate'),
    239249                'callback'    => [$this, 'checkbox_field'],
    240250                'description' => 'Increase text size for better readability.',
     
    242252            [
    243253                'id'          => 'cursor',
    244                 'label'       => __( 'Cursor', 'accessimate' ),
     254                'label'       => __('Cursor', 'accessimate'),
    245255                'callback'    => [$this, 'checkbox_field'],
    246256                'description' => 'Improve cursor visibility for users with visual challenges.',
     
    248258            [
    249259                'id'          => 'line-height',
    250                 'label'       => __( 'Line Height', 'accessimate' ),
     260                'label'       => __('Line Height', 'accessimate'),
    251261                'callback'    => [$this, 'checkbox_field'],
    252262                'description' => 'Adjust line spacing to reduce text clutter.',
     
    254264            [
    255265                'id'          => 'letter-spacing',
    256                 'label'       => __( 'Letter Spacing', 'accessimate' ),
     266                'label'       => __('Letter Spacing', 'accessimate'),
    257267                'callback'    => [$this, 'checkbox_field'],
    258268                'description' => 'Increase spacing between letters for clarity.',
     
    260270            [
    261271                'id'          => 'readable-font',
    262                 'label'       => __( 'Readable Font', 'accessimate' ),
     272                'label'       => __('Readable Font', 'accessimate'),
    263273                'callback'    => [$this, 'checkbox_field'],
    264274                'description' => 'Use a clean, legible font for easier reading.',
     
    266276            [
    267277                'id'          => 'dyslexic-font',
    268                 'label'       => __( 'Dyslexic Font', 'accessimate' ),
     278                'label'       => __('Dyslexic Font', 'accessimate'),
    269279                'callback'    => [$this, 'checkbox_field'],
    270280                'description' => 'Enable a font designed to aid dyslexic users.',
     
    273283            [
    274284                'id'          => 'text-align',
    275                 'label'       => __( 'Text Align', 'accessimate' ),
     285                'label'       => __('Text Align', 'accessimate'),
    276286                'callback'    => [$this, 'checkbox_field'],
    277287                'description' => 'Adjust text alignment for better legibility.',
     
    279289            [
    280290                'id'          => 'text-magnifier',
    281                 'label'       => __( 'Text Magnifier', 'accessimate' ),
     291                'label'       => __('Text Magnifier', 'accessimate'),
    282292                'callback'    => [$this, 'checkbox_field'],
    283293                'description' => 'Magnify text on hover or focus for better visibility.',
     
    286296            [
    287297                'id'          => 'highlight-links',
    288                 'label'       => __( 'Highlight Links', 'accessimate' ),
     298                'label'       => __('Highlight Links', 'accessimate'),
    289299                'callback'    => [$this, 'checkbox_field'],
    290300                'description' => 'Highlight all links on the page for visibility.',
     
    292302            [
    293303                'id'          => 'invert-colors',
    294                 'label'       => __( 'Invert Colors', 'accessimate' ),
     304                'label'       => __('Invert Colors', 'accessimate'),
    295305                'callback'    => [$this, 'checkbox_field'],
    296306                'description' => 'Invert website colors to reduce eye strain.',
     
    298308            [
    299309                'id'          => 'brightness',
    300                 'label'       => __( 'Brightness', 'accessimate' ),
     310                'label'       => __('Brightness', 'accessimate'),
    301311                'callback'    => [$this, 'checkbox_field'],
    302312                'description' => 'Adjust screen brightness for comfort.',
     
    304314            [
    305315                'id'          => 'contrast',
    306                 'label'       => __( 'Contrast', 'accessimate' ),
     316                'label'       => __('Contrast', 'accessimate'),
    307317                'callback'    => [$this, 'checkbox_field'],
    308318                'description' => 'Improve content visibility with contrast adjustment.',
     
    310320            ],
    311321            [
    312                 'id'          => 'gray-scale',
    313                 'label'       => __( 'Gray Scale', 'accessimate' ),
     322                'id'          => 'grayscale',
     323                'label'       => __('Grayscale', 'accessimate'),
    314324                'callback'    => [$this, 'checkbox_field'],
    315325                'description' => 'Convert content to grayscale for focus.',
     
    317327            [
    318328                'id'          => 'saturation',
    319                 'label'       => __( 'Saturation', 'accessimate' ),
     329                'label'       => __('Saturation', 'accessimate'),
    320330                'callback'    => [$this, 'checkbox_field'],
    321331                'description' => 'Adjust saturation to reduce visual overload.',
     
    324334            [
    325335                'id'          => 'reading-line',
    326                 'label'       => __( 'Reading Line', 'accessimate' ),
     336                'label'       => __('Reading Line', 'accessimate'),
    327337                'callback'    => [$this, 'checkbox_field'],
    328338                'description' => 'Display a horizontal line to follow text.',
     
    330340            [
    331341                'id'          => 'reading-mask',
    332                 'label'       => __( 'Reading Mask', 'accessimate' ),
     342                'label'       => __('Reading Mask', 'accessimate'),
    333343                'callback'    => [$this, 'checkbox_field'],
    334344                'description' => 'Dim parts of the screen to focus on text.',
     
    336346            [
    337347                'id'          => 'highlight-all',
    338                 'label'       => __( 'Highlight All', 'accessimate' ),
     348                'label'       => __('Highlight All', 'accessimate'),
    339349                'callback'    => [$this, 'checkbox_field'],
    340350                'description' => 'Highlight all content to assist with visual tracking.',
     
    342352            [
    343353                'id'          => 'highlight-titles',
    344                 'label'       => __( 'Highlight Titles', 'accessimate' ),
     354                'label'       => __('Highlight Titles', 'accessimate'),
    345355                'callback'    => [$this, 'checkbox_field'],
    346356                'description' => 'Emphasize headings and titles for better navigation.',
     
    349359            [
    350360                'id'          => 'hide-images',
    351                 'label'       => __( 'Hide Images', 'accessimate' ),
     361                'label'       => __('Hide Images', 'accessimate'),
    352362                'callback'    => [$this, 'checkbox_field'],
    353363                'description' => 'Hide images to reduce distractions.',
     
    355365            [
    356366                'id'          => 'text-to-speech',
    357                 'label'       => __( 'Text to Speech', 'accessimate' ),
     367                'label'       => __('Text to Speech', 'accessimate'),
    358368                'callback'    => [$this, 'checkbox_field'],
    359369                'description' => 'Read out text for users with visual impairments.',
     
    362372            [
    363373                'id'          => 'mute-sounds',
    364                 'label'       => __( 'Mute Sounds', 'accessimate' ),
     374                'label'       => __('Mute Sounds', 'accessimate'),
    365375                'callback'    => [$this, 'checkbox_field'],
    366376                'description' => 'Silence all site audio for a quieter experience.',
     
    369379            [
    370380                'id'          => 'stop-animations',
    371                 'label'       => __( 'Stop Animations', 'accessimate' ),
     381                'label'       => __('Stop Animations', 'accessimate'),
    372382                'callback'    => [$this, 'checkbox_field'],
    373383                'description' => 'Stop moving elements to prevent distractions.',
     
    375385            [
    376386                'id'          => 'keyboard',
    377                 'label'       => __( 'Keyboard Navigation', 'accessimate' ),
     387                'label'       => __('Keyboard Navigation', 'accessimate'),
    378388                'callback'    => [$this, 'checkbox_field'],
    379389                'description' => 'Highlight elements during keyboard navigation.',
    380390                'is_beta'     => true,
    381391            ],
     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            ],
    382407        ];
    383408        // Register all fields
    384         foreach ( $settings as $setting ) {
     409        foreach ($settings as $setting) {
    385410            $args = [
    386411                'field' => $setting['id'],
    387412            ];
    388             if ( isset( $setting['description'] ) ) {
     413            if (isset($setting['description'])) {
    389414                $args['description'] = $setting['description'];
    390415            }
    391             if ( isset( $setting['options'] ) ) {
     416            if (isset($setting['options'])) {
    392417                $args['options'] = $setting['options'];
    393418            }
    394             if ( isset( $setting['is_beta'] ) ) {
     419            if (isset($setting['is_beta'])) {
    395420                $args['is_beta'] = $setting['is_beta'];
    396421            }
     
    409434     * Main settings section callback
    410435     */
    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>';
    413439    }
    414440
     
    418444     * @param array $args Field arguments.
    419445     */
    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');
    422449        $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);
    426453        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>';
    431458        }
    432459        echo '</label>';
     
    438465     * @param array $args Field arguments.
    439466     */
    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');
    442470        $field = $args['field'];
    443471        $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>';
    448476        }
    449477        echo '</select>';
     
    455483     * @param array $args Field arguments.
    456484     */
    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');
    459488        $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    {
    470500        $valid = [];
    471501        // 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);
    497527        // Validate toolbar position
    498528        $valid_positions = [
     
    502532            'bottom-right'
    503533        ];
    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');
    505535        // Validate toolbar theme
    506536        $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');
    508538        // Validate toolbar animation
    509539        $valid_animations = [
     
    515545            'slide-bottom'
    516546        ];
    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');
    518559        return $valid;
    519560    }
     
    522563     * Display admin page
    523564     */
    524     public function admin_page() {
     565    public function admin_page()
     566    {
    525567        // Check user capabilities
    526         if ( !current_user_can( 'manage_options' ) ) {
     568        if (!current_user_can('manage_options')) {
    527569            return;
    528570        }
    529571        ?>
    530572        <div class="wrap">
    531             <h1><?php 
    532         esc_html_e( 'AccessiMate Settings', 'accessimate' );
     573            <h1><?php
     574        esc_html_e('AccessiMate Settings', 'accessimate');
    533575        ?></h1>
    534576           
    535577            <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');
    538580        ?></p>
    539581            </div>
    540582           
    541583            <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');
    545587        submit_button();
    546588        ?>
     
    548590
    549591            <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');
    552594        ?></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');
    555597        ?></p>
    556598               
    557599                <ul>
    558600                    <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');
    561603        ?></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');
    564606        ?>
    565607                    </li>
    566608                    <li>
    567                         <strong><?php 
    568         esc_html_e( 'Follow Heading Hierarchy:', 'accessimate' );
     609                        <strong><?php
     610        esc_html_e('Follow Heading Hierarchy:', 'accessimate');
    569611        ?></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');
    572614        ?>
    573615                    </li>
    574616                    <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');
    577619        ?></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');
    580622        ?>
    581623                    </li>
    582624                    <li>
    583                         <strong><?php 
    584         esc_html_e( 'Enable Keyboard Navigation:', 'accessimate' );
     625                        <strong><?php
     626        esc_html_e('Enable Keyboard Navigation:', 'accessimate');
    585627        ?></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');
    588630        ?>
    589631                    </li>
    590632                    <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');
    593635        ?></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');
    596638        ?>
    597639                    </li>
    598640                    <li>
    599                         <strong><?php 
    600         esc_html_e( 'Provide Captions & Transcripts:', 'accessimate' );
     641                        <strong><?php
     642        esc_html_e('Provide Captions & Transcripts:', 'accessimate');
    601643        ?></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');
    604646        ?>
    605647                    </li>
    606648                    <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');
    609651        ?></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');
    612654        ?>
    613655                    </li>
    614656                    <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');
    617659        ?></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');
    620662        ?>
    621663                    </li>
    622664                    <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');
    625667        ?></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');
    628670        ?>
    629671                    </li>
    630672                    <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');
    633675        ?></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');
    636678        ?>
    637679                    </li>
     
    640682
    641683        </div>
    642         <?php 
     684        <?php
    643685    }
    644686
     
    648690     * @param string $hook The current admin page.
    649691     */
    650     public function enqueue_admin_scripts( $hook ) {
     692    public function enqueue_admin_scripts($hook)
     693    {
    651694        // Only load on AccessiMate settings page
    652         if ( 'settings_page_accessimate' !== $hook ) {
     695        if ('settings_page_accessimate' !== $hook) {
    653696            return;
    654697        }
     
    670713     * Enqueue frontend scripts and styles
    671714     */
    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']) {
    675719            return;
    676720        }
     
    696740        );
    697741        // 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'),
    701745            'ai_features' => [
    702746                'text_to_speech'      => $options['ai_text_to_speech'] ?? 0,
     
    705749                'reading_assistance'  => $options['reading_assistance'] ?? 0,
    706750            ],
    707         ] );
     751        ]);
    708752    }
    709753
     
    715759     * @return array|null Button data or null if key is not found
    716760     */
    717     private function getFeatures( $key = null ) {
     761    private function getFeatures($key = null)
     762    {
    718763        $features = [
    719764            [
    720765                'id'       => 'bigger-text',
    721766                'icon'     => 'format_size',
    722                 'label'    => 'Bigger Text',
     767                'label'    => [
     768                    'en' => 'Bigger Text',
     769                    'fr' => 'Texte Plus Grand',
     770                ],
    723771                'default'  => true,
    724772                'has_step' => true,
     
    727775                'id'       => 'cursor',
    728776                'icon'     => 'arrow_selector_tool',
    729                 'label'    => 'Cursor',
     777                'label'    => [
     778                    'en' => 'Cursor',
     779                    'fr' => 'Curseur',
     780                ],
    730781                'default'  => true,
    731782                'has_step' => true,
     
    734785                'id'       => 'line-height',
    735786                'icon'     => 'format_line_spacing',
    736                 'label'    => 'Line Height',
     787                'label'    => [
     788                    'en' => 'Line Height',
     789                    'fr' => 'Hauteur de Ligne',
     790                ],
    737791                'default'  => true,
    738792                'has_step' => true,
     
    741795                'id'       => 'letter-spacing',
    742796                'icon'     => 'format_letter_spacing',
    743                 'label'    => 'Letter Spacing',
     797                'label'    => [
     798                    'en' => 'Letter Spacing',
     799                    'fr' => 'Espacement des Lettres',
     800                ],
    744801                'default'  => true,
    745802                'has_step' => true,
     
    748805                'id'      => 'readable-font',
    749806                'icon'    => 'hdr_auto',
    750                 'label'   => 'Readable Font',
     807                'label'   => [
     808                    'en' => 'Readable Font',
     809                    'fr' => 'Police Lisible',
     810                ],
    751811                'default' => true,
    752812            ],
     
    754814                'id'      => 'dyslexic-font',
    755815                'icon'    => 'brand_family',
    756                 'label'   => 'Dyslexic Font',
     816                'label'   => [
     817                    'en' => 'Dyslexic Font',
     818                    'fr' => 'Police Dyslexique',
     819                ],
    757820                'default' => true,
    758821            ],
     
    760823                'id'       => 'text-align',
    761824                'icon'     => 'format_align_left',
    762                 'label'    => 'Text Align',
     825                'label'    => [
     826                    'en' => 'Text Align',
     827                    'fr' => 'Alignement du Texte',
     828                ],
    763829                'default'  => true,
    764830                'has_step' => true,
     
    767833                'id'      => 'text-magnifier',
    768834                'icon'    => 'loupe',
    769                 'label'   => 'Text Magnifier',
     835                'label'   => [
     836                    'en' => 'Text Magnifier',
     837                    'fr' => 'Loupe de Texte',
     838                ],
    770839                'default' => true,
    771840            ],
     
    773842                'id'      => 'highlight-links',
    774843                'icon'    => 'link',
    775                 'label'   => 'Highlight Links',
     844                'label'   => [
     845                    'en' => 'Highlight Links',
     846                    'fr' => 'Mettre en Évidence les Liens',
     847                ],
    776848                'default' => true,
    777849            ],
     
    779851                'id'       => 'invert-colors',
    780852                'icon'     => 'invert_colors',
    781                 'label'    => 'Invert Colors',
     853                'label'    => [
     854                    'en' => 'Invert Colors',
     855                    'fr' => 'Inverser les Couleurs',
     856                ],
    782857                'default'  => true,
    783858                'has_step' => true,
     
    786861                'id'       => 'brightness',
    787862                'icon'     => 'brightness_6',
    788                 'label'    => 'Brightness',
     863                'label'    => [
     864                    'en' => 'Brightness',
     865                    'fr' => 'Luminosité',
     866                ],
    789867                'default'  => true,
    790868                'has_step' => true,
     
    793871                'id'       => 'contrast',
    794872                'icon'     => 'contrast',
    795                 'label'    => 'Contrast',
     873                'label'    => [
     874                    'en' => 'Contrast',
     875                    'fr' => 'Contraste',
     876                ],
    796877                'has_step' => true,
    797878                'default'  => true,
    798879            ],
    799880            [
    800                 'id'       => 'gray-scale',
     881                'id'       => 'grayscale',
    801882                'icon'     => 'filter_b_and_w',
    802                 'label'    => 'Grayscale',
     883                'label'    => [
     884                    'en' => 'Grayscale',
     885                    'fr' => 'Niveaux de Gris',
     886                ],
    803887                'default'  => true,
    804888                'has_step' => true,
     
    807891                'id'       => 'saturation',
    808892                'icon'     => 'palette',
    809                 'label'    => 'Saturation',
     893                'label'    => [
     894                    'en' => 'Saturation',
     895                    'fr' => 'Saturation',
     896                ],
    810897                'default'  => true,
    811898                'has_step' => true,
     
    814901                'id'      => 'reading-line',
    815902                'icon'    => 'insert_page_break',
    816                 'label'   => 'Reading Line',
     903                'label'   => [
     904                    'en' => 'Reading Line',
     905                    'fr' => 'Ligne de Lecture',
     906                ],
    817907                'default' => true,
    818908            ],
     
    820910                'id'      => 'reading-mask',
    821911                'icon'    => 'credit_card',
    822                 'label'   => 'Reading Mask',
     912                'label'   => [
     913                    'en' => 'Reading Mask',
     914                    'fr' => 'Masque de Lecture',
     915                ],
    823916                'default' => true,
    824917            ],
     
    826919                'id'      => 'highlight-all',
    827920                'icon'    => 'highlight',
    828                 'label'   => 'Highlight All',
     921                'label'   => [
     922                    'en' => 'Highlight All',
     923                    'fr' => 'Tout Mettre en Évidence',
     924                ],
    829925                'default' => true,
    830926            ],
     
    832928                'id'      => 'highlight-titles',
    833929                'icon'    => 'title',
    834                 'label'   => 'Highlight Titles',
     930                'label'   => [
     931                    'en' => 'Highlight Titles',
     932                    'fr' => 'Mettre en Évidence les Titres',
     933                ],
    835934                'default' => true,
    836935            ],
     
    838937                'id'      => 'keyboard',
    839938                'icon'    => 'keyboard',
    840                 'label'   => 'Keyboard',
     939                'label'   => [
     940                    'en' => 'Keyboard Navigation',
     941                    'fr' => 'Navigation au Clavier',
     942                ],
    841943                'default' => true,
    842944            ],
     
    844946                'id'      => 'hide-images',
    845947                'icon'    => 'hide_image',
    846                 'label'   => 'Hide Images',
     948                'label'   => [
     949                    'en' => 'Hide Images',
     950                    'fr' => 'Cacher les Images',
     951                ],
    847952                'default' => true,
    848953            ],
     
    850955                'id'      => 'text-to-speech',
    851956                'icon'    => 'text_to_speech',
    852                 'label'   => 'Text to Speech',
     957                'label'   => [
     958                    'en' => 'Text to Speech',
     959                    'fr' => 'Texte en Parole',
     960                ],
    853961                'default' => true,
    854962            ],
     
    856964                'id'      => 'mute-sounds',
    857965                'icon'    => 'volume_off',
    858                 'label'   => 'Mute Sounds',
     966                'label'   => [
     967                    'en' => 'Mute Sounds',
     968                    'fr' => 'Couper les Sons',
     969                ],
    859970                'default' => true,
    860971            ],
     
    862973                'id'      => 'stop-animations',
    863974                'icon'    => 'animation',
    864                 'label'   => 'Stop Animations',
     975                'label'   => [
     976                    'en' => 'Stop Animations',
     977                    'fr' => 'Arrêter les Animations',
     978                ],
    865979                'default' => true,
    866980            ],
     
    868982                'id'      => 'simplify-text',
    869983                'icon'    => 'description',
    870                 'label'   => 'Simplify Text',
     984                'label'   => [
     985                    'en' => 'Simplify Text',
     986                    'fr' => 'Simplifier le Texte',
     987                ],
    871988                'default' => false,
    872989            ],
     
    874991                'id'      => 'scan-page',
    875992                'icon'    => 'scan',
    876                 'label'   => 'Scan Page',
     993                'label'   => [
     994                    'en' => 'Scan Page',
     995                    'fr' => 'Analyser la Page',
     996                ],
    877997                'default' => false,
    878998            ]
    879999        ];
    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));
    8811001    }
    8821002
     
    8841004     * Render accessibility toolbar
    8851005     */
    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']) {
    8891010            return;
    8901011        }
    8911012        $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);
    8981031        ?>">
    8991032            <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');
    9021035        ?>">
    9031036                    <span class="accessimate-icon">accessibility</span>
     
    9051038            </div>
    9061039           
    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');
    9091042        ?>">
    9101043                <div class="accessimate-panel-header">
    911                     <h3><?php 
    912         esc_html_e( 'Accessibility', 'accessimate' );
     1044                    <h3><?php
     1045        echo esc_html($title[$language] ?? $title['en']);
    9131046        ?></h3>
    9141047                    <div class="accessimate-header-actions">
     
    9161049                            <span class="accessimate-icon">brightness_4</span>
    9171050                        </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');
    9201053        ?>">
    9211054                            <span class="accessimate-icon">close</span>
     
    9251058               
    9261059                <div class="accessimate-panel-content">
    927                     <?php 
    928         foreach ( $this->getFeatures() as $feature ) {
     1060                    <?php
     1061        foreach ($this->getFeatures() as $feature) {
    9291062            $id = $feature['id'];
    9301063            $icon = $feature['icon'];
    931             $label = $feature['label'];
     1064            $label = $feature['label'][$language] ?? $feature['label']['en'];
    9321065            $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);
    9351068            ?>
    9361069
    937                         <?php 
    938             if ( $is_active ) {
     1070                        <?php
     1071            if ($is_active) {
    9391072                ?>
    940                         <button id="accessimate-<?php 
    941                 echo esc_attr( $id );
     1073                        <button id="accessimate-<?php
     1074                echo esc_attr($id);
    9421075                ?>" 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);
    9451078                ?></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);
    9481081                ?>">
    949                                 <?php 
    950                 esc_html_e( $label, 'accessimate' );
     1082                                <?php
     1083                esc_html_e($label, 'accessimate');
    9511084                ?>
    9521085                            </span>
    953                             <?php 
    954                 if ( $has_step ) {
     1086                            <?php
     1087                if ($has_step) {
    9551088                    ?>
    9561089                                <div class="accessimate-option-step"></div>
    957                             <?php 
     1090                            <?php
    9581091                }
    9591092                ?>
    9601093                        </button>
    961                         <?php 
     1094                        <?php
    9621095            }
    9631096            ?>
    964                     <?php 
     1097                    <?php
    9651098        }
    9661099        ?>
     
    9691102                    <button id="accessimate-reset" class="accessimate-btn accessimate-btn-full accessimate-btn-reset">
    9701103                        <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']);
    9731117        ?>
    9741118                    </button>
     
    9771121        </div>
    9781122       
    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']) {
    9811125            ?>
    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');
    9841128            ?></a>
    985         <?php 
    986         }
    987         ?>
    988         <?php 
     1129        <?php
     1130        }
     1131        ?>
     1132        <?php
    9891133    }
    9901134
     
    9921136     * Save user preferences via AJAX
    9931137     */
    994     public function save_user_preferences() {
     1138    public function save_user_preferences()
     1139    {
    9951140        // 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            ]);
    10001145        }
    10011146        // 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']));
    10081153        $session_id = session_id();
    1009         if ( empty( $session_id ) ) {
     1154        if (empty($session_id)) {
    10101155            session_start();
    10111156            $session_id = session_id();
     
    10161161        // a built-in API for custom user preference storage with session handling
    10171162        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    1018         $result = $wpdb->replace( $table_name, [
     1163        $result = $wpdb->replace($table_name, [
    10191164            'user_session' => $session_id,
    10201165            '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        ]);
    10301175    }
    10311176
  • accessimate/tags/1.0.4/assets/js/accessimate-frontend.js

    r3384547 r3442731  
    1616            this.fontSize = 100;
    1717            this.isOpen = false;
     18            this.language = this.toolbar.data('accessimate-language') || 'en';
    1819            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 *";
    1920
     
    693694
    694695        grayscale(level, $notification = true) {
     696   
    695697            const filter = level === 'grayscale-v1' ? "grayscale(33%) !important;" : level === 'grayscale-v2' ? "grayscale(66%) !important;" : level === 'grayscale-v3' ? "grayscale(100%) !important;" : null;
     698
    696699            $("html").not(this.excludedElements).each(function () {
    697700                let style = $(this).attr("style") || "";
     
    706709
    707710            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';
    709712                this.showNotification(`Grayscale: ${label}`);
    710713            }
     
    13201323                button = this.getTrigger($key),
    13211324                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),
    13231326                currentType = this.getPreferences($key) || 'default',
    13241327                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'];
    13251766
    13261767            if (currentType === 'default' || currentType === 'disabled') {
     
    13291770                });
    13301771                button.removeClass('active');
     1772               
    13311773                buttonText.text(name);
    13321774            } else if (currentType === 'enabled') {
     
    13431785                button.addClass('active');
    13441786                buttonText.text(
    1345                     `${currentType.charAt(0).toUpperCase() + currentType.slice(1).replace(/-/g, ' ')}`
     1787                    labels[currentType][this.language] || labels[currentType]['en']
    13461788                );
    13471789
  • accessimate/tags/1.0.4/readme.txt

    r3420458 r3442731  
    100100
    101101== Changelog ==
     102= 1.0.4 =
     103* Added multi-language support to the Toolbox.
     104
    102105= 1.0.3 =
    103106* Tested and confirmed compatibility with current WordPress versions.
  • accessimate/trunk/accessimate.php

    r3420458 r3442731  
    22
    33/**
    4  * Plugin Name: AccessiMate
     4 * Plugin Name: AccessiMate Pro
    55 * Description: A comprehensive WordPress accessibility plugin that provides tools to make your website more accessible to users with disabilities.
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77 * Author: BDPlugins
     8 * Author URI: https://bdplugins.com/
    89 * License: GPL v2 or later
    910 * Text Domain: accessimate
    1011 */
    1112// Prevent direct access
    12 if ( !defined( 'ABSPATH' ) ) {
     13if (!defined('ABSPATH')) {
    1314    exit;
    1415}
    1516// 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__ );
     17define('ACCESSIMATE_VERSION', '1.0.4');
     18define('ACCESSIMATE_PLUGIN_DIR', plugin_dir_path(__FILE__));
     19define('ACCESSIMATE_PLUGIN_URL', plugin_dir_url(__FILE__));
     20define('ACCESSIMATE_AI_ENABLED', true);
     21if (function_exists('bdpacc_fs')) {
     22    bdpacc_fs()->set_basename(false, __FILE__);
    2223} else {
    2324    /**
     
    2526     * `function_exists` CALL ABOVE TO PROPERLY WORK.
    2627     */
    27     if ( !function_exists( 'bdpacc_fs' ) ) {
     28    if (!function_exists('bdpacc_fs')) {
    2829        // Create a helper function for easy SDK access.
    29         function bdpacc_fs() {
     30        function bdpacc_fs()
     31        {
    3032            global $bdpacc_fs;
    31             if ( !isset( $bdpacc_fs ) ) {
     33            if (!isset($bdpacc_fs)) {
    3234                // 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([
    3537                    'id'               => '20125',
    3638                    'slug'             => 'accessimate',
     
    5557                    ],
    5658                    'is_live'          => true,
    57                 ] );
     59                ]);
    5860            }
    5961            return $bdpacc_fs;
     
    6365        bdpacc_fs();
    6466        // Signal that SDK was initiated.
    65         do_action( 'bdpacc_fs_loaded' );
     67        do_action('bdpacc_fs_loaded');
    6668        // Initialize the plugin
    6769        new AccessiMate();
     
    6971    // ... Your plugin's main file logic ...
    7072}
    71 class AccessiMate {
     73class AccessiMate
     74{
    7275    /**
    7376     * Constructor
    7477     */
    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']);
    7983    }
    8084
     
    8286     * Initialize the plugin
    8387     */
    84     public function init() {
     88    public function init()
     89    {
    8590        // 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']);
    9095        }
    9196        // 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']);
    9499        // 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']);
    100105        // AI Features
    101106        // if (ACCESSIMATE_AI_ENABLED) {
     
    108113     * Plugin activation
    109114     */
    110     public function activate() {
     115    public function activate()
     116    {
    111117        // Set default options
    112118        $default_options = [
     
    139145            'cursor'            => 1,
    140146        ];
    141         add_option( 'accessimate_options', $default_options );
     147        add_option('accessimate_options', $default_options);
    142148        // Create custom table for user preferences if needed
    143149        $this->create_user_preferences_table();
     
    147153     * Plugin deactivation
    148154     */
    149     public function deactivate() {
     155    public function deactivate()
     156    {
    150157        // Clean up if needed (keeping options for now)
    151158    }
     
    154161     * Create user preferences table
    155162     */
    156     private function create_user_preferences_table() {
     163    private function create_user_preferences_table()
     164    {
    157165        global $wpdb;
    158166        $table_name = "{$wpdb->prefix}accessimate_user_prefs";
    159167        $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),\n            UNIQUE 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};";
    161169        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    162         dbDelta( $sql );
     170        dbDelta($sql);
    163171        // Create AI suggestions table
    164172        $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),\n            KEY 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);
    167175    }
    168176
     
    170178     * Add admin menu
    171179     */
    172     public function add_admin_menu() {
     180    public function add_admin_menu()
     181    {
    173182        add_options_page(
    174             __( 'AccessiMate Settings', 'accessimate' ),
    175             __( 'AccessiMate', 'accessimate' ),
     183            __('AccessiMate Settings', 'accessimate'),
     184            __('AccessiMate', 'accessimate'),
    176185            'manage_options',
    177186            'accessimate',
     
    183192     * Initialize admin settings
    184193     */
    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']);
    187197        add_settings_section(
    188198            'accessimate_main',
    189             __( 'Main Settings', 'accessimate' ),
     199            __('Main Settings', 'accessimate'),
    190200            [$this, 'main_section_callback'],
    191201            'accessimate'
     
    195205            [
    196206                'id'          => 'enable_toolbar',
    197                 'label'       => __( 'Accessibility Toolbar', 'accessimate' ),
     207                'label'       => __('Accessibility Toolbar', 'accessimate'),
    198208                'callback'    => [$this, 'checkbox_field'],
    199209                'description' => 'Display the accessibility toolbar on the frontend.',
     
    201211            [
    202212                'id'       => 'toolbar_position',
    203                 'label'    => __( 'Toolbar Position', 'accessimate' ),
     213                'label'    => __('Toolbar Position', 'accessimate'),
    204214                'callback' => [$this, 'select_field'],
    205215                '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'),
    210220                ],
    211221            ],
    212222            [
    213223                'id'       => 'toolbar_animation',
    214                 'label'    => __( 'Toolbar Animation', 'accessimate' ),
     224                'label'    => __('Toolbar Animation', 'accessimate'),
    215225                'callback' => [$this, 'select_field'],
    216226                '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'),
    223233                ],
    224234            ],
    225235            [
    226236                'id'       => 'toolbar_theme',
    227                 'label'    => __( 'Toolbar Theme', 'accessimate' ),
     237                'label'    => __('Toolbar Theme', 'accessimate'),
    228238                'callback' => [$this, 'select_field'],
    229239                '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'),
    233243                ],
    234244            ],
     
    236246            [
    237247                'id'          => 'bigger-text',
    238                 'label'       => __( 'Bigger Text', 'accessimate' ),
     248                'label'       => __('Bigger Text', 'accessimate'),
    239249                'callback'    => [$this, 'checkbox_field'],
    240250                'description' => 'Increase text size for better readability.',
     
    242252            [
    243253                'id'          => 'cursor',
    244                 'label'       => __( 'Cursor', 'accessimate' ),
     254                'label'       => __('Cursor', 'accessimate'),
    245255                'callback'    => [$this, 'checkbox_field'],
    246256                'description' => 'Improve cursor visibility for users with visual challenges.',
     
    248258            [
    249259                'id'          => 'line-height',
    250                 'label'       => __( 'Line Height', 'accessimate' ),
     260                'label'       => __('Line Height', 'accessimate'),
    251261                'callback'    => [$this, 'checkbox_field'],
    252262                'description' => 'Adjust line spacing to reduce text clutter.',
     
    254264            [
    255265                'id'          => 'letter-spacing',
    256                 'label'       => __( 'Letter Spacing', 'accessimate' ),
     266                'label'       => __('Letter Spacing', 'accessimate'),
    257267                'callback'    => [$this, 'checkbox_field'],
    258268                'description' => 'Increase spacing between letters for clarity.',
     
    260270            [
    261271                'id'          => 'readable-font',
    262                 'label'       => __( 'Readable Font', 'accessimate' ),
     272                'label'       => __('Readable Font', 'accessimate'),
    263273                'callback'    => [$this, 'checkbox_field'],
    264274                'description' => 'Use a clean, legible font for easier reading.',
     
    266276            [
    267277                'id'          => 'dyslexic-font',
    268                 'label'       => __( 'Dyslexic Font', 'accessimate' ),
     278                'label'       => __('Dyslexic Font', 'accessimate'),
    269279                'callback'    => [$this, 'checkbox_field'],
    270280                'description' => 'Enable a font designed to aid dyslexic users.',
     
    273283            [
    274284                'id'          => 'text-align',
    275                 'label'       => __( 'Text Align', 'accessimate' ),
     285                'label'       => __('Text Align', 'accessimate'),
    276286                'callback'    => [$this, 'checkbox_field'],
    277287                'description' => 'Adjust text alignment for better legibility.',
     
    279289            [
    280290                'id'          => 'text-magnifier',
    281                 'label'       => __( 'Text Magnifier', 'accessimate' ),
     291                'label'       => __('Text Magnifier', 'accessimate'),
    282292                'callback'    => [$this, 'checkbox_field'],
    283293                'description' => 'Magnify text on hover or focus for better visibility.',
     
    286296            [
    287297                'id'          => 'highlight-links',
    288                 'label'       => __( 'Highlight Links', 'accessimate' ),
     298                'label'       => __('Highlight Links', 'accessimate'),
    289299                'callback'    => [$this, 'checkbox_field'],
    290300                'description' => 'Highlight all links on the page for visibility.',
     
    292302            [
    293303                'id'          => 'invert-colors',
    294                 'label'       => __( 'Invert Colors', 'accessimate' ),
     304                'label'       => __('Invert Colors', 'accessimate'),
    295305                'callback'    => [$this, 'checkbox_field'],
    296306                'description' => 'Invert website colors to reduce eye strain.',
     
    298308            [
    299309                'id'          => 'brightness',
    300                 'label'       => __( 'Brightness', 'accessimate' ),
     310                'label'       => __('Brightness', 'accessimate'),
    301311                'callback'    => [$this, 'checkbox_field'],
    302312                'description' => 'Adjust screen brightness for comfort.',
     
    304314            [
    305315                'id'          => 'contrast',
    306                 'label'       => __( 'Contrast', 'accessimate' ),
     316                'label'       => __('Contrast', 'accessimate'),
    307317                'callback'    => [$this, 'checkbox_field'],
    308318                'description' => 'Improve content visibility with contrast adjustment.',
     
    310320            ],
    311321            [
    312                 'id'          => 'gray-scale',
    313                 'label'       => __( 'Gray Scale', 'accessimate' ),
     322                'id'          => 'grayscale',
     323                'label'       => __('Grayscale', 'accessimate'),
    314324                'callback'    => [$this, 'checkbox_field'],
    315325                'description' => 'Convert content to grayscale for focus.',
     
    317327            [
    318328                'id'          => 'saturation',
    319                 'label'       => __( 'Saturation', 'accessimate' ),
     329                'label'       => __('Saturation', 'accessimate'),
    320330                'callback'    => [$this, 'checkbox_field'],
    321331                'description' => 'Adjust saturation to reduce visual overload.',
     
    324334            [
    325335                'id'          => 'reading-line',
    326                 'label'       => __( 'Reading Line', 'accessimate' ),
     336                'label'       => __('Reading Line', 'accessimate'),
    327337                'callback'    => [$this, 'checkbox_field'],
    328338                'description' => 'Display a horizontal line to follow text.',
     
    330340            [
    331341                'id'          => 'reading-mask',
    332                 'label'       => __( 'Reading Mask', 'accessimate' ),
     342                'label'       => __('Reading Mask', 'accessimate'),
    333343                'callback'    => [$this, 'checkbox_field'],
    334344                'description' => 'Dim parts of the screen to focus on text.',
     
    336346            [
    337347                'id'          => 'highlight-all',
    338                 'label'       => __( 'Highlight All', 'accessimate' ),
     348                'label'       => __('Highlight All', 'accessimate'),
    339349                'callback'    => [$this, 'checkbox_field'],
    340350                'description' => 'Highlight all content to assist with visual tracking.',
     
    342352            [
    343353                'id'          => 'highlight-titles',
    344                 'label'       => __( 'Highlight Titles', 'accessimate' ),
     354                'label'       => __('Highlight Titles', 'accessimate'),
    345355                'callback'    => [$this, 'checkbox_field'],
    346356                'description' => 'Emphasize headings and titles for better navigation.',
     
    349359            [
    350360                'id'          => 'hide-images',
    351                 'label'       => __( 'Hide Images', 'accessimate' ),
     361                'label'       => __('Hide Images', 'accessimate'),
    352362                'callback'    => [$this, 'checkbox_field'],
    353363                'description' => 'Hide images to reduce distractions.',
     
    355365            [
    356366                'id'          => 'text-to-speech',
    357                 'label'       => __( 'Text to Speech', 'accessimate' ),
     367                'label'       => __('Text to Speech', 'accessimate'),
    358368                'callback'    => [$this, 'checkbox_field'],
    359369                'description' => 'Read out text for users with visual impairments.',
     
    362372            [
    363373                'id'          => 'mute-sounds',
    364                 'label'       => __( 'Mute Sounds', 'accessimate' ),
     374                'label'       => __('Mute Sounds', 'accessimate'),
    365375                'callback'    => [$this, 'checkbox_field'],
    366376                'description' => 'Silence all site audio for a quieter experience.',
     
    369379            [
    370380                'id'          => 'stop-animations',
    371                 'label'       => __( 'Stop Animations', 'accessimate' ),
     381                'label'       => __('Stop Animations', 'accessimate'),
    372382                'callback'    => [$this, 'checkbox_field'],
    373383                'description' => 'Stop moving elements to prevent distractions.',
     
    375385            [
    376386                'id'          => 'keyboard',
    377                 'label'       => __( 'Keyboard Navigation', 'accessimate' ),
     387                'label'       => __('Keyboard Navigation', 'accessimate'),
    378388                'callback'    => [$this, 'checkbox_field'],
    379389                'description' => 'Highlight elements during keyboard navigation.',
    380390                'is_beta'     => true,
    381391            ],
     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            ],
    382407        ];
    383408        // Register all fields
    384         foreach ( $settings as $setting ) {
     409        foreach ($settings as $setting) {
    385410            $args = [
    386411                'field' => $setting['id'],
    387412            ];
    388             if ( isset( $setting['description'] ) ) {
     413            if (isset($setting['description'])) {
    389414                $args['description'] = $setting['description'];
    390415            }
    391             if ( isset( $setting['options'] ) ) {
     416            if (isset($setting['options'])) {
    392417                $args['options'] = $setting['options'];
    393418            }
    394             if ( isset( $setting['is_beta'] ) ) {
     419            if (isset($setting['is_beta'])) {
    395420                $args['is_beta'] = $setting['is_beta'];
    396421            }
     
    409434     * Main settings section callback
    410435     */
    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>';
    413439    }
    414440
     
    418444     * @param array $args Field arguments.
    419445     */
    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');
    422449        $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);
    426453        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>';
    431458        }
    432459        echo '</label>';
     
    438465     * @param array $args Field arguments.
    439466     */
    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');
    442470        $field = $args['field'];
    443471        $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>';
    448476        }
    449477        echo '</select>';
     
    455483     * @param array $args Field arguments.
    456484     */
    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');
    459488        $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    {
    470500        $valid = [];
    471501        // 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);
    497527        // Validate toolbar position
    498528        $valid_positions = [
     
    502532            'bottom-right'
    503533        ];
    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');
    505535        // Validate toolbar theme
    506536        $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');
    508538        // Validate toolbar animation
    509539        $valid_animations = [
     
    515545            'slide-bottom'
    516546        ];
    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');
    518559        return $valid;
    519560    }
     
    522563     * Display admin page
    523564     */
    524     public function admin_page() {
     565    public function admin_page()
     566    {
    525567        // Check user capabilities
    526         if ( !current_user_can( 'manage_options' ) ) {
     568        if (!current_user_can('manage_options')) {
    527569            return;
    528570        }
    529571        ?>
    530572        <div class="wrap">
    531             <h1><?php 
    532         esc_html_e( 'AccessiMate Settings', 'accessimate' );
     573            <h1><?php
     574        esc_html_e('AccessiMate Settings', 'accessimate');
    533575        ?></h1>
    534576           
    535577            <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');
    538580        ?></p>
    539581            </div>
    540582           
    541583            <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');
    545587        submit_button();
    546588        ?>
     
    548590
    549591            <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');
    552594        ?></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');
    555597        ?></p>
    556598               
    557599                <ul>
    558600                    <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');
    561603        ?></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');
    564606        ?>
    565607                    </li>
    566608                    <li>
    567                         <strong><?php 
    568         esc_html_e( 'Follow Heading Hierarchy:', 'accessimate' );
     609                        <strong><?php
     610        esc_html_e('Follow Heading Hierarchy:', 'accessimate');
    569611        ?></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');
    572614        ?>
    573615                    </li>
    574616                    <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');
    577619        ?></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');
    580622        ?>
    581623                    </li>
    582624                    <li>
    583                         <strong><?php 
    584         esc_html_e( 'Enable Keyboard Navigation:', 'accessimate' );
     625                        <strong><?php
     626        esc_html_e('Enable Keyboard Navigation:', 'accessimate');
    585627        ?></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');
    588630        ?>
    589631                    </li>
    590632                    <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');
    593635        ?></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');
    596638        ?>
    597639                    </li>
    598640                    <li>
    599                         <strong><?php 
    600         esc_html_e( 'Provide Captions & Transcripts:', 'accessimate' );
     641                        <strong><?php
     642        esc_html_e('Provide Captions & Transcripts:', 'accessimate');
    601643        ?></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');
    604646        ?>
    605647                    </li>
    606648                    <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');
    609651        ?></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');
    612654        ?>
    613655                    </li>
    614656                    <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');
    617659        ?></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');
    620662        ?>
    621663                    </li>
    622664                    <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');
    625667        ?></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');
    628670        ?>
    629671                    </li>
    630672                    <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');
    633675        ?></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');
    636678        ?>
    637679                    </li>
     
    640682
    641683        </div>
    642         <?php 
     684        <?php
    643685    }
    644686
     
    648690     * @param string $hook The current admin page.
    649691     */
    650     public function enqueue_admin_scripts( $hook ) {
     692    public function enqueue_admin_scripts($hook)
     693    {
    651694        // Only load on AccessiMate settings page
    652         if ( 'settings_page_accessimate' !== $hook ) {
     695        if ('settings_page_accessimate' !== $hook) {
    653696            return;
    654697        }
     
    670713     * Enqueue frontend scripts and styles
    671714     */
    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']) {
    675719            return;
    676720        }
     
    696740        );
    697741        // 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'),
    701745            'ai_features' => [
    702746                'text_to_speech'      => $options['ai_text_to_speech'] ?? 0,
     
    705749                'reading_assistance'  => $options['reading_assistance'] ?? 0,
    706750            ],
    707         ] );
     751        ]);
    708752    }
    709753
     
    715759     * @return array|null Button data or null if key is not found
    716760     */
    717     private function getFeatures( $key = null ) {
     761    private function getFeatures($key = null)
     762    {
    718763        $features = [
    719764            [
    720765                'id'       => 'bigger-text',
    721766                'icon'     => 'format_size',
    722                 'label'    => 'Bigger Text',
     767                'label'    => [
     768                    'en' => 'Bigger Text',
     769                    'fr' => 'Texte Plus Grand',
     770                ],
    723771                'default'  => true,
    724772                'has_step' => true,
     
    727775                'id'       => 'cursor',
    728776                'icon'     => 'arrow_selector_tool',
    729                 'label'    => 'Cursor',
     777                'label'    => [
     778                    'en' => 'Cursor',
     779                    'fr' => 'Curseur',
     780                ],
    730781                'default'  => true,
    731782                'has_step' => true,
     
    734785                'id'       => 'line-height',
    735786                'icon'     => 'format_line_spacing',
    736                 'label'    => 'Line Height',
     787                'label'    => [
     788                    'en' => 'Line Height',
     789                    'fr' => 'Hauteur de Ligne',
     790                ],
    737791                'default'  => true,
    738792                'has_step' => true,
     
    741795                'id'       => 'letter-spacing',
    742796                'icon'     => 'format_letter_spacing',
    743                 'label'    => 'Letter Spacing',
     797                'label'    => [
     798                    'en' => 'Letter Spacing',
     799                    'fr' => 'Espacement des Lettres',
     800                ],
    744801                'default'  => true,
    745802                'has_step' => true,
     
    748805                'id'      => 'readable-font',
    749806                'icon'    => 'hdr_auto',
    750                 'label'   => 'Readable Font',
     807                'label'   => [
     808                    'en' => 'Readable Font',
     809                    'fr' => 'Police Lisible',
     810                ],
    751811                'default' => true,
    752812            ],
     
    754814                'id'      => 'dyslexic-font',
    755815                'icon'    => 'brand_family',
    756                 'label'   => 'Dyslexic Font',
     816                'label'   => [
     817                    'en' => 'Dyslexic Font',
     818                    'fr' => 'Police Dyslexique',
     819                ],
    757820                'default' => true,
    758821            ],
     
    760823                'id'       => 'text-align',
    761824                'icon'     => 'format_align_left',
    762                 'label'    => 'Text Align',
     825                'label'    => [
     826                    'en' => 'Text Align',
     827                    'fr' => 'Alignement du Texte',
     828                ],
    763829                'default'  => true,
    764830                'has_step' => true,
     
    767833                'id'      => 'text-magnifier',
    768834                'icon'    => 'loupe',
    769                 'label'   => 'Text Magnifier',
     835                'label'   => [
     836                    'en' => 'Text Magnifier',
     837                    'fr' => 'Loupe de Texte',
     838                ],
    770839                'default' => true,
    771840            ],
     
    773842                'id'      => 'highlight-links',
    774843                'icon'    => 'link',
    775                 'label'   => 'Highlight Links',
     844                'label'   => [
     845                    'en' => 'Highlight Links',
     846                    'fr' => 'Mettre en Évidence les Liens',
     847                ],
    776848                'default' => true,
    777849            ],
     
    779851                'id'       => 'invert-colors',
    780852                'icon'     => 'invert_colors',
    781                 'label'    => 'Invert Colors',
     853                'label'    => [
     854                    'en' => 'Invert Colors',
     855                    'fr' => 'Inverser les Couleurs',
     856                ],
    782857                'default'  => true,
    783858                'has_step' => true,
     
    786861                'id'       => 'brightness',
    787862                'icon'     => 'brightness_6',
    788                 'label'    => 'Brightness',
     863                'label'    => [
     864                    'en' => 'Brightness',
     865                    'fr' => 'Luminosité',
     866                ],
    789867                'default'  => true,
    790868                'has_step' => true,
     
    793871                'id'       => 'contrast',
    794872                'icon'     => 'contrast',
    795                 'label'    => 'Contrast',
     873                'label'    => [
     874                    'en' => 'Contrast',
     875                    'fr' => 'Contraste',
     876                ],
    796877                'has_step' => true,
    797878                'default'  => true,
    798879            ],
    799880            [
    800                 'id'       => 'gray-scale',
     881                'id'       => 'grayscale',
    801882                'icon'     => 'filter_b_and_w',
    802                 'label'    => 'Grayscale',
     883                'label'    => [
     884                    'en' => 'Grayscale',
     885                    'fr' => 'Niveaux de Gris',
     886                ],
    803887                'default'  => true,
    804888                'has_step' => true,
     
    807891                'id'       => 'saturation',
    808892                'icon'     => 'palette',
    809                 'label'    => 'Saturation',
     893                'label'    => [
     894                    'en' => 'Saturation',
     895                    'fr' => 'Saturation',
     896                ],
    810897                'default'  => true,
    811898                'has_step' => true,
     
    814901                'id'      => 'reading-line',
    815902                'icon'    => 'insert_page_break',
    816                 'label'   => 'Reading Line',
     903                'label'   => [
     904                    'en' => 'Reading Line',
     905                    'fr' => 'Ligne de Lecture',
     906                ],
    817907                'default' => true,
    818908            ],
     
    820910                'id'      => 'reading-mask',
    821911                'icon'    => 'credit_card',
    822                 'label'   => 'Reading Mask',
     912                'label'   => [
     913                    'en' => 'Reading Mask',
     914                    'fr' => 'Masque de Lecture',
     915                ],
    823916                'default' => true,
    824917            ],
     
    826919                'id'      => 'highlight-all',
    827920                'icon'    => 'highlight',
    828                 'label'   => 'Highlight All',
     921                'label'   => [
     922                    'en' => 'Highlight All',
     923                    'fr' => 'Tout Mettre en Évidence',
     924                ],
    829925                'default' => true,
    830926            ],
     
    832928                'id'      => 'highlight-titles',
    833929                'icon'    => 'title',
    834                 'label'   => 'Highlight Titles',
     930                'label'   => [
     931                    'en' => 'Highlight Titles',
     932                    'fr' => 'Mettre en Évidence les Titres',
     933                ],
    835934                'default' => true,
    836935            ],
     
    838937                'id'      => 'keyboard',
    839938                'icon'    => 'keyboard',
    840                 'label'   => 'Keyboard',
     939                'label'   => [
     940                    'en' => 'Keyboard Navigation',
     941                    'fr' => 'Navigation au Clavier',
     942                ],
    841943                'default' => true,
    842944            ],
     
    844946                'id'      => 'hide-images',
    845947                'icon'    => 'hide_image',
    846                 'label'   => 'Hide Images',
     948                'label'   => [
     949                    'en' => 'Hide Images',
     950                    'fr' => 'Cacher les Images',
     951                ],
    847952                'default' => true,
    848953            ],
     
    850955                'id'      => 'text-to-speech',
    851956                'icon'    => 'text_to_speech',
    852                 'label'   => 'Text to Speech',
     957                'label'   => [
     958                    'en' => 'Text to Speech',
     959                    'fr' => 'Texte en Parole',
     960                ],
    853961                'default' => true,
    854962            ],
     
    856964                'id'      => 'mute-sounds',
    857965                'icon'    => 'volume_off',
    858                 'label'   => 'Mute Sounds',
     966                'label'   => [
     967                    'en' => 'Mute Sounds',
     968                    'fr' => 'Couper les Sons',
     969                ],
    859970                'default' => true,
    860971            ],
     
    862973                'id'      => 'stop-animations',
    863974                'icon'    => 'animation',
    864                 'label'   => 'Stop Animations',
     975                'label'   => [
     976                    'en' => 'Stop Animations',
     977                    'fr' => 'Arrêter les Animations',
     978                ],
    865979                'default' => true,
    866980            ],
     
    868982                'id'      => 'simplify-text',
    869983                'icon'    => 'description',
    870                 'label'   => 'Simplify Text',
     984                'label'   => [
     985                    'en' => 'Simplify Text',
     986                    'fr' => 'Simplifier le Texte',
     987                ],
    871988                'default' => false,
    872989            ],
     
    874991                'id'      => 'scan-page',
    875992                'icon'    => 'scan',
    876                 'label'   => 'Scan Page',
     993                'label'   => [
     994                    'en' => 'Scan Page',
     995                    'fr' => 'Analyser la Page',
     996                ],
    877997                'default' => false,
    878998            ]
    879999        ];
    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));
    8811001    }
    8821002
     
    8841004     * Render accessibility toolbar
    8851005     */
    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']) {
    8891010            return;
    8901011        }
    8911012        $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);
    8981031        ?>">
    8991032            <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');
    9021035        ?>">
    9031036                    <span class="accessimate-icon">accessibility</span>
     
    9051038            </div>
    9061039           
    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');
    9091042        ?>">
    9101043                <div class="accessimate-panel-header">
    911                     <h3><?php 
    912         esc_html_e( 'Accessibility', 'accessimate' );
     1044                    <h3><?php
     1045        echo esc_html($title[$language] ?? $title['en']);
    9131046        ?></h3>
    9141047                    <div class="accessimate-header-actions">
     
    9161049                            <span class="accessimate-icon">brightness_4</span>
    9171050                        </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');
    9201053        ?>">
    9211054                            <span class="accessimate-icon">close</span>
     
    9251058               
    9261059                <div class="accessimate-panel-content">
    927                     <?php 
    928         foreach ( $this->getFeatures() as $feature ) {
     1060                    <?php
     1061        foreach ($this->getFeatures() as $feature) {
    9291062            $id = $feature['id'];
    9301063            $icon = $feature['icon'];
    931             $label = $feature['label'];
     1064            $label = $feature['label'][$language] ?? $feature['label']['en'];
    9321065            $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);
    9351068            ?>
    9361069
    937                         <?php 
    938             if ( $is_active ) {
     1070                        <?php
     1071            if ($is_active) {
    9391072                ?>
    940                         <button id="accessimate-<?php 
    941                 echo esc_attr( $id );
     1073                        <button id="accessimate-<?php
     1074                echo esc_attr($id);
    9421075                ?>" 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);
    9451078                ?></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);
    9481081                ?>">
    949                                 <?php 
    950                 esc_html_e( $label, 'accessimate' );
     1082                                <?php
     1083                esc_html_e($label, 'accessimate');
    9511084                ?>
    9521085                            </span>
    953                             <?php 
    954                 if ( $has_step ) {
     1086                            <?php
     1087                if ($has_step) {
    9551088                    ?>
    9561089                                <div class="accessimate-option-step"></div>
    957                             <?php 
     1090                            <?php
    9581091                }
    9591092                ?>
    9601093                        </button>
    961                         <?php 
     1094                        <?php
    9621095            }
    9631096            ?>
    964                     <?php 
     1097                    <?php
    9651098        }
    9661099        ?>
     
    9691102                    <button id="accessimate-reset" class="accessimate-btn accessimate-btn-full accessimate-btn-reset">
    9701103                        <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']);
    9731117        ?>
    9741118                    </button>
     
    9771121        </div>
    9781122       
    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']) {
    9811125            ?>
    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');
    9841128            ?></a>
    985         <?php 
    986         }
    987         ?>
    988         <?php 
     1129        <?php
     1130        }
     1131        ?>
     1132        <?php
    9891133    }
    9901134
     
    9921136     * Save user preferences via AJAX
    9931137     */
    994     public function save_user_preferences() {
     1138    public function save_user_preferences()
     1139    {
    9951140        // 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            ]);
    10001145        }
    10011146        // 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']));
    10081153        $session_id = session_id();
    1009         if ( empty( $session_id ) ) {
     1154        if (empty($session_id)) {
    10101155            session_start();
    10111156            $session_id = session_id();
     
    10161161        // a built-in API for custom user preference storage with session handling
    10171162        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    1018         $result = $wpdb->replace( $table_name, [
     1163        $result = $wpdb->replace($table_name, [
    10191164            'user_session' => $session_id,
    10201165            '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        ]);
    10301175    }
    10311176
  • accessimate/trunk/assets/js/accessimate-frontend.js

    r3384547 r3442731  
    1616            this.fontSize = 100;
    1717            this.isOpen = false;
     18            this.language = this.toolbar.data('accessimate-language') || 'en';
    1819            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 *";
    1920
     
    693694
    694695        grayscale(level, $notification = true) {
     696   
    695697            const filter = level === 'grayscale-v1' ? "grayscale(33%) !important;" : level === 'grayscale-v2' ? "grayscale(66%) !important;" : level === 'grayscale-v3' ? "grayscale(100%) !important;" : null;
     698
    696699            $("html").not(this.excludedElements).each(function () {
    697700                let style = $(this).attr("style") || "";
     
    706709
    707710            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';
    709712                this.showNotification(`Grayscale: ${label}`);
    710713            }
     
    13201323                button = this.getTrigger($key),
    13211324                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),
    13231326                currentType = this.getPreferences($key) || 'default',
    13241327                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'];
    13251766
    13261767            if (currentType === 'default' || currentType === 'disabled') {
     
    13291770                });
    13301771                button.removeClass('active');
     1772               
    13311773                buttonText.text(name);
    13321774            } else if (currentType === 'enabled') {
     
    13431785                button.addClass('active');
    13441786                buttonText.text(
    1345                     `${currentType.charAt(0).toUpperCase() + currentType.slice(1).replace(/-/g, ' ')}`
     1787                    labels[currentType][this.language] || labels[currentType]['en']
    13461788                );
    13471789
  • accessimate/trunk/readme.txt

    r3420458 r3442731  
    100100
    101101== Changelog ==
     102= 1.0.4 =
     103* Added multi-language support to the Toolbox.
     104
    102105= 1.0.3 =
    103106* Tested and confirmed compatibility with current WordPress versions.
Note: See TracChangeset for help on using the changeset viewer.