Plugin Directory

Changeset 3408432


Ignore:
Timestamp:
12/02/2025 08:01:56 PM (4 months ago)
Author:
conveythis
Message:

268.8 revert

Location:
conveythis-translate/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • conveythis-translate/trunk/app/class/ConveyThis.php

    r3408258 r3408432  
    338338        }
    339339
    340 
    341340        $exclusions = $incoming['exclusions'] ?? null;
    342341        $glossary = $incoming['glossary'] ?? null;
     
    362361                update_option($field, $value);
    363362            }
    364         }
    365 
    366         if (!array_key_exists('style_change_language', $incoming)) {
    367             update_option('style_change_language', []);
    368         }
    369 
    370         if (!array_key_exists('style_change_flag', $incoming)) {
    371             update_option('style_change_flag', []);
    372363        }
    373364
  • conveythis-translate/trunk/app/class/Variables.php

    r3408258 r3408432  
    321321
    322322    public $matchingLanguages = array(
    323         703 => array(
    324             'language_id' => 703,
    325             'title_en'   => 'English',
    326             'title'      => 'English',
    327             'code2'      => 'en',
    328             'code3'      => 'eng',
    329             'flag'       => 'us',
    330             'flag_ids'   => [498, 497, 342],
    331         ),
    332 
    333         719 => array(
    334             'language_id' => 719,
    335             'title_en'    => 'Chinese (Simplified)',
    336             'title'       => '简体',
    337             'code2'       => 'zh',
    338             'code3'       => 'zho-sim',
    339             'flag'        => 'cn',
    340             'flag_ids'    => [347, 466, 415], // China, Singapore, Malaysia
    341         ),
    342 
    343         796 => array(
    344             'language_id' => 796,
    345             'title_en'    => 'Chinese (Traditional)',
    346             'title'       => '繁體',
    347             'code2'       => 'zh-tw',
    348             'code3'       => 'zho-tra',
    349             'flag'        => 'tw',
    350             'flag_ids'    => [347, 482, 508], // China, Taiwan, Hong Kong
    351         ),
    352 
    353         707 => array(
    354             'language_id' => 707,
    355             'title_en'    => 'Arabic',
    356             'title'       => 'العربية',
    357             'code2'       => 'ar',
    358             'code3'       => 'ara',
    359             'flag'        => 'sa',
    360             'flag_ids'    => [
    361                 324, 390, 396, 401, 405, 441, 451, 461, 481, 496, 505,
    362                 314, 345, 349, 359, 363, 408, 420, 428, 470, 476, 490,
    363             ],
    364         ),
    365 
    366         768 => array(
    367             'language_id' => 768,
    368             'title_en'    => 'Portuguese',
    369             'title'       => 'Português',
    370             'code2'       => 'pt',
    371             'code3'       => 'por',
    372             'flag'        => 'br',
    373             'flag_ids'    => [336, 450],
    374         ),
    375 
    376         777 => array(
    377             'language_id' => 777,
    378             'title_en'    => 'Spanish',
    379             'title'       => 'Español',
    380             'code2'       => 'es',
    381             'code3'       => 'spa',
    382             'flag'        => 'es',
    383             'flag_ids'    => [422, 318, 348, 474], //Mexico, Argentina, Colombia, Spain
    384         ),
    385         727 => array(
    386             'language_id' => 727,
    387             'title_en'    => 'French',
    388             'title'       => 'Français',
    389             'code2'       => 'fr',
    390             'code3'       => 'fre',
    391             'flag'        => 'fr',
    392             'flag_ids'    => [371, 342], // France, Canada
    393         ),
     323        703 => array('language_id' => 703, 'title_en' => 'English', 'title' => 'English', 'code2' => 'en', 'code3' => 'eng', 'flag' => 'us', 'flag_ids' => [498, 497, 342]),
     324        768 => array('language_id' => 768, 'title_en' => 'Portuguese', 'title' => 'Português', 'code2' => 'pt', 'code3' => 'por', 'flag' => 'br', 'flag_ids' => [422, 318, 348]),
     325        777 => array('language_id' => 777, 'title_en' => 'Spanish', 'title' => 'Español', 'code2' => 'es', 'code3' => 'spa', 'flag' => 'es', 'flag_ids' => [336]),
    394326    );
    395327
    396328    public $matchingLanguageToFlag = array(
    397         // English: US / GB / CA
    398329        703 => array(498, 497, 342),
    399 
    400         // Chinese (Simplified): Mainland China, Singapore, Malaysia
    401         719 => array(347, 466, 415),
    402 
    403         // Chinese (Traditional): Taiwan, Hong Kong
    404         796 => array(482, 508),
    405 
    406         // Arabic: Middle East + North Africa
    407         707 => array(
    408             // Middle East
    409             324, // Bahrain (bh)
    410             390, // Iraq (iq)
    411             396, // Jordan (jo)
    412             401, // Kuwait (kw)
    413             405, // Lebanon (lb)
    414             441, // Oman (om)
    415             451, // Qatar (qa)
    416             461, // Saudi Arabia (sa)
    417             481, // Syria (sy)
    418             496, // United Arab Emirates (ae)
    419             505, // Yemen (ye)
    420 
    421             // North Africa
    422             314, // Algeria (dz)
    423             345, // Chad (td)
    424             349, // Comoros (km)
    425             359, // Djibouti (dj)
    426             363, // Egypt (eg)
    427             408, // Libya (ly)
    428             420, // Mauritania (mr)
    429             428, // Morocco (ma)
    430             470, // Somalia (so)
    431             476, // Sudan (sd)
    432             490, // Tunisia (tn)
    433         ),
    434 
    435         // Portuguese: Brazil, Portugal
    436330        768 => array(336, 450),
    437 
    438         // Spanish: Mexico, Argentina, Colombia, Spain
    439         777 => array(422, 318, 348, 474),
    440         727 => array(371, 342),
     331        777 => array(422, 318, 348, 474)
    441332    );
    442333
  • conveythis-translate/trunk/app/views/page/widget-style.php

    r3408258 r3408432  
    7171                    <div class="col-md-6">
    7272                        <div class="ui fluid search selection dropdown change_language">
    73                             <input type="hidden" class="style_change_flag" name="style_change_flag[]" value="">
    7473                            <i class="dropdown icon"></i>
    75                             <div class="default text">
    76                                 <?php echo esc_html(__( 'Select language', 'conveythis-translate' )); ?>
    77                             </div>
     74                            <div class="default text"><?php echo  esc_html(__( 'Select language', 'conveythis-translate' )); ?></div>
    7875                            <div class="menu">
     76
    7977                                <?php foreach( $this->variables->matchingLanguages as $id => $language ): ?>
    80                                     <div class="item" data-value="<?php echo esc_attr($id); ?>">
     78
     79                                    <div class="item" data-value="<?php echo  esc_attr($id); ?>">
    8180                                        <?php echo esc_html( $language['title_en'], 'conveythis-translate' ); ?>
    8281                                    </div>
     82
    8383                                <?php endforeach; ?>
     84
    8485                            </div>
    8586                        </div>
    8687                    </div>
    87 
    8888                    <div class="col-md-6">
    8989                        <div class="ui fluid search selection dropdown change_flag">
    90                             <input type="hidden" class="style_change_flag" name="style_change_flag[]" value="">
    9190                            <i class="dropdown icon"></i>
    92                             <div class="default text">
    93                                 <?php echo esc_html(__( 'Select Flag', 'conveythis-translate' )); ?>
    94                             </div>
     91                            <div class="default text"><?php echo  esc_html(__( 'Select Flag', 'conveythis-translate' )); ?></div>
    9592                            <div class="menu">
     93
    9694                                <?php foreach( $this->variables->matchingFlags as $flag ): ?>
    97                                     <div class="item" data-value="<?php echo esc_attr( $flag['code'] ); ?>">
    98                                         <div class="ui image" style="height:28px;width:30px;background-position:50% 50%;background-size:contain;background-repeat:no-repeat;background-image:url('//cdn.conveythis.com/images/flags/svg/<?php echo esc_attr($flag['code']); ?>.svg')"></div>
     95
     96                                    <div class="item" data-value="<?php echo  esc_attr( $flag['code'] ); ?>">
     97                                        <div class="ui image" style="height: 28px; width: 30px; background-position: 50% 50%; background-size: contain; background-repeat: no-repeat; background-image: url('//cdn.conveythis.com/images/flags/svg/<?php echo  esc_attr($flag['code']); ?>.svg')"></div>
    9998                                        <?php echo esc_html( $flag['title'], 'conveythis-translate' ); ?>
    10099                                    </div>
     100
    101101                                <?php endforeach; ?>
     102
    102103                            </div>
    103104                        </div>
  • conveythis-translate/trunk/app/widget/js/settings.js

    r3408258 r3408432  
    1313            $('.ui.dropdown').dropdown({
    1414                onChange: function () {
    15                     if (typeof conveythisSettings !== 'undefined' && conveythisSettings.view) {
    16                         conveythisSettings.view();
    17                     }
     15                    conveythisSettings.view();
    1816                }
    1917            });
     
    126124        prepareSettingsBeforeSave();
    127125
    128         //const data = Object.fromEntries(new FormData(form[0]));
    129 
    130         const raw = form.serializeArray();
    131         const data = {};
    132 
    133         raw.forEach(function (item) {
    134             const name = item.name;
    135             const value = item.value;
    136 
    137             if (name.endsWith('[]')) {
    138                 // style_change_flag[] -> style_change_flag
    139                 const key = name.slice(0, -2);
    140                 if (!Array.isArray(data[key])) {
    141                     data[key] = [];
    142                 }
    143                 data[key].push(value);
    144             } else {
    145                 if (!(name in data)) {
    146                     data[name] = value;
    147                 }
    148             }
    149         });
    150 
    151         const langs = [];
    152         const flags = [];
    153 
    154         $('#flag-style_wrapper .style-language:not(.cloned)').each(function () {
    155             const lang = $(this)
    156                 .find('.change_language input[name="style_change_language[]"]')
    157                 .val();
    158             const flag = $(this)
    159                 .find('.change_flag input[name="style_change_flag[]"]')
    160                 .val();
    161 
    162 
    163             if (lang && flag) {
    164                 langs.push(lang);
    165                 flags.push(flag);
    166             }
    167         });
    168 
    169         data.style_change_language = langs;
    170         data.style_change_flag = flags;
    171 
    172         console.log('CLEAN DATA:', data);
    173 
     126        const data = Object.fromEntries(new FormData(form[0]));
    174127        console.log(data);
    175128        console.log(conveythis_plugin_ajax.ajax_url);
     
    367320            'code3': 'eng',
    368321            'flag': 'R04',
    369             'flag_codes': {'gb': ' United Kingdom', 'ca': 'Canada', 'au': 'Australia'}
     322            'flag_codes': {'us': 'United States of America', 'gb': ' United Kingdom', 'ca': 'Canada'}
    370323        },
    371324        704: {'title_en': 'Afrikaans', 'title': 'Afrikaans', 'code2': 'af', 'code3': 'afr', 'flag': '7xS'},
    372325        705: {'title_en': 'Albanian', 'title': 'Shqip', 'code2': 'sq', 'code3': 'sqi', 'flag': '5iM'},
    373326        706: {'title_en': 'Amharic', 'title': 'አማርኛ', 'code2': 'am', 'code3': 'amh', 'flag': 'ZH1'},
    374         707: {
    375             'title_en': 'Arabic',
    376             'title': 'العربية',
    377             'code2': 'ar',
    378             'code3': 'ara',
    379             'flag': 'J06',
    380             'flag_codes': {
    381                 'bh': 'Bahrain',
    382                 'iq': 'Iraq',
    383                 'jo': 'Jordan',
    384                 'kw': 'Kuwait',
    385                 'lb': 'Lebanon',
    386                 'om': 'Oman',
    387                 'ps': 'Palestine',
    388                 'qa': 'Qatar',
    389                 'sy': 'Syria',
    390                 'ae': 'United Arab Emirates',
    391                 'ye': 'Yemen',
    392 
    393 
    394                 'dz': 'Algeria',
    395                 'td': 'Chad',
    396                 'km': 'Comoros',
    397                 'dj': 'Djibouti',
    398                 'eg': 'Egypt',
    399                 'ly': 'Libya',
    400                 'mr': 'Mauritania',
    401                 'ma': 'Morocco',
    402                 'so': 'Somalia',
    403                 'sd': 'Sudan',
    404                 'tn': 'Tunisia'
    405             }
    406         },
     327        707: {'title_en': 'Arabic', 'title': 'العربية', 'code2': 'ar', 'code3': 'ara', 'flag': 'J06'},
    407328        708: {'title_en': 'Armenian', 'title': 'Հայերեն', 'code2': 'hy', 'code3': 'hye', 'flag': 'q9U'},
    408329        709: {'title_en': 'Azerbaijan', 'title': 'Azərbaycanca', 'code2': 'az', 'code3': 'aze', 'flag': 'Wg1'},
     
    416337        717: {'title_en': 'Catalan', 'title': 'Català', 'code2': 'ca', 'code3': 'cat', 'flag': 'Pw6'},
    417338        718: {'title_en': 'Cebuano', 'title': 'Cebuano', 'code2': 'ceb', 'code3': 'ceb', 'flag': ''},
    418         719: {
    419             'title_en': 'Chinese (Simplified)',
    420             'title': '简体',
    421             'code2': 'zh',
    422             'code3': 'zh-sim',
    423             'flag': 'Z1v',
    424             'flag_codes': {
    425                 'sg': 'Singapore',
    426                 'my': 'Malaysia'
    427             }
    428         },
    429         796: {
    430             'title_en': 'Chinese (Traditional)',
    431             'title': '繁體',
    432             'code2': 'zh-tw',
    433             'code3': 'zh-tra',
    434             'flag': 'Z1v',
    435             'flag_codes': {
    436                 'tw': 'Taiwan',
    437                 'hk': 'Hong Kong',
    438                 'mo': 'Macau'
    439             }
    440         },
     339        719: {'title_en': 'Chinese (Simplified)', 'title': '简体', 'code2': 'zh', 'code3': 'zh-sim', 'flag': 'Z1v'},
     340        796: {'title_en': 'Chinese (Traditional)', 'title': '繁體', 'code2': 'zh-tw', 'code3': 'zh-tra', 'flag': 'Z1v'},
    441341        720: {'title_en': 'Croatian', 'title': 'Hrvatski', 'code2': 'hr', 'code3': 'hrv', 'flag': '7KQ'},
    442342        721: {'title_en': 'Czech', 'title': 'Čeština', 'code2': 'cs', 'code3': 'cze', 'flag': '1ZY'},
     
    453353            'flag': 'nM4'
    454354        },
    455         727: {'title_en': 'French', 'title': 'Français', 'code2': 'fr', 'code3': 'fre', 'flag': 'E77',
    456             'flag_codes': {
    457             'ca': 'Canada'
    458         }
    459         },
     355        727: {'title_en': 'French', 'title': 'Français', 'code2': 'fr', 'code3': 'fre', 'flag': 'E77'},
    460356        728: {'title_en': 'Galician', 'title': 'Galego', 'code2': 'gl', 'code3': 'glg', 'flag': 'A5d'},
    461357        729: {'title_en': 'Georgian', 'title': 'ქართული', 'code2': 'ka', 'code3': 'kat', 'flag': '8Ou'},
     
    520416            'code3': 'spa',
    521417            'flag': 'A5d',
    522             'flag_codes': {'mx': 'Mexico', 'ar': 'Argentina', 'co': 'Colombia'}
     418            'flag_codes': {'mx': 'Mexico', 'ar': 'Argentina', 'co': 'Colombia', 'es': 'Spain'}
    523419        },
    524420        778: {'title_en': 'Sundanese', 'title': 'Basa Sunda', 'code2': 'su', 'code3': 'sun', 'flag': 'Wh1'},
     
    611507    //
    612508
    613     $('.ui.dropdown').dropdown({
    614         onChange: function (value) {
    615 
    616             if ($(this).hasClass('widget-trigger')) {
    617                 hideTargetLanguage();
    618             }
    619 
    620             if (typeof conveythisSettings !== 'undefined' && conveythisSettings.view) {
    621                 conveythisSettings.view();
    622             }
    623 
    624             showDnsRecords();
    625         }
    626     });
     509    $('.ui.dropdown').dropdown(
     510        {
     511            onChange: function (e) {
     512                if ($(this).hasClass('widget-trigger')) {
     513                    hideTargetLanguage();
     514                    conveythisSettings.view();
     515                }
     516                showDnsRecords();
     517            }
     518        }
     519    );
    627520
    628521    conveythisSettings.effect(function () {
     
    670563        $(document).find('.conveythis-delete-page').on('click', function (e) {
    671564            e.preventDefault();
    672             const $parent = $(this).parent();
    673             $parent.remove();
    674             updateStyleLanguageDropdowns();
     565            $(this).parent().remove();
    675566        });
    676567
     
    698589            e.preventDefault();
    699590            $(this).parent().remove();
    700             updateStyleLanguageDropdowns();
    701591        });
    702592
     
    707597        e.preventDefault();
    708598
    709         if ($(".style-language").length == 8) {
     599        if ($(".style-language").length == 4) {
    710600            $('#add_flag_style').prop("disable", true);
    711601            return;
    712602        }
    713603
    714         $rule_style = $('.cloned').clone();
    715         $rule_style.removeClass('cloned');
    716 
    717         $rule_style.find('.change_language input[type="hidden"]').remove();
    718         $rule_style.find('.change_flag input[type="hidden"]').remove();
    719 
    720         $rule_style.find('.change_language')
    721             .prepend('<input type="hidden" name="style_change_language[]" value="">');
    722         $rule_style.find('.change_flag')
    723             .prepend('<input type="hidden" name="style_change_flag[]" value="">');
    724 
     604        let $rule_style = $('.cloned').clone()
     605
     606        $rule_style.removeClass('cloned')
     607        $rule_style.find('.change_language').prepend('<input type="hidden" name="style_change_language[]" value="">')
     608        $rule_style.find('.change_flag').prepend('<input type="hidden" name="style_change_flag[]"  value="">')
    725609        $("#flag-style_wrapper").append($rule_style);
    726         sortFlagsByLanguage();
    727610
    728611        $(document).find('.conveythis-delete-page').on('click', function (e) {
     
    733616        $('.ui.dropdown').dropdown();
    734617        sortFlagsByLanguage();
    735         updateStyleLanguageDropdowns();
    736618    });
    737619
     
    13451227
    13461228                });
    1347                 updateStyleLanguageDropdowns();
    13481229            },
    1349         });
    1350     }
    1351 
    1352     // Prevents the user from selecting same language twice
    1353     function updateStyleLanguageDropdowns() {
    1354 
    1355         const used = [];
    1356 
    1357         $('#flag-style_wrapper .style-language:not(.cloned) .ui.dropdown.change_language').each(function () {
    1358             const val = $(this).dropdown('get value');
    1359             if (val) {
    1360                 used.push(String(val));
    1361             }
    1362         });
    1363 
    1364 
    1365         $('#flag-style_wrapper .style-language:not(.cloned) .ui.dropdown.change_language').each(function () {
    1366             const current = String($(this).dropdown('get value') || '');
    1367             const $items = $(this).find('.menu .item');
    1368 
    1369             $items.each(function () {
    1370                 const val = String($(this).data('value') || '');
    1371 
    1372                 if (used.includes(val) && val !== current) {
    1373 
    1374                     $(this)
    1375                         .addClass('disabled')
    1376                         .css({ 'pointer-events': 'none', opacity: 0.4 });
    1377                 } else {
    1378 
    1379                     $(this)
    1380                         .removeClass('disabled')
    1381                         .css({ 'pointer-events': '', opacity: '' });
    1382                 }
    1383             });
    13841230        });
    13851231    }
  • conveythis-translate/trunk/changelog.txt

    r3408258 r3408432  
    11== Changelog ==
    2 = 268.9 =
    3 * Enhanced Change Flag feature with broader functionality.
    4 
    52= 268.8 =
    63* Now elements can be excluded using their class attribute.
  • conveythis-translate/trunk/config.php

    r3408258 r3408432  
    77$dev_server = 'default';
    88
    9 //$dev_server = 4;
     9//$dev_server = 3;
    1010
    1111$allowed_app_servers = array(
  • conveythis-translate/trunk/index.php

    r3408258 r3408432  
    44Plugin URI: https://www.conveythis.com/?utm_source=widget&utm_medium=wordpress
    55Description: Translate your WordPress site into over 100 languages using professional and instant machine translation technology. ConveyThis will help provide you with an SEO-friendy, multilingual website in minutes with no coding required.
    6 Version: 268.9
     6Version: 268.8
    77
    88Author: ConveyThis Translate Team
  • conveythis-translate/trunk/readme.txt

    r3408316 r3408432  
    66Tested up to: 6.8.2
    77
    8 Stable tag: 268.9
     8Stable tag: 268.8
    99
    1010License: GPLv2
     
    218218
    219219== Changelog ==
    220 = 268.9 =
    221 * Enhanced Change Flag feature with broader functionality.
    222 
    223220= 268.8 =
    224221* Now elements can be excluded using their class attribute.
Note: See TracChangeset for help on using the changeset viewer.