Plugin Directory

Changeset 3085515


Ignore:
Timestamp:
05/13/2024 08:28:48 AM (23 months ago)
Author:
misterplan
Message:

Version 1.1.14

Location:
misterplan
Files:
342 added
8 edited

Legend:

Unmodified
Added
Removed
  • misterplan/trunk/assets/css/motor.css

    r3078617 r3085515  
    113113    margin: 0 auto;
    114114    display: flow-root;
     115}
     116
     117.MrPlanPlugin_CapaConfirmacion #bdg2_contenido_confirmacion{
     118    text-align: left;
     119}
     120
     121.MrPlanPlugin_CapaConfirmacion .TCCompleta .form-group {
     122    line-height: 29px !important;
    115123}
    116124
  • misterplan/trunk/class.mrplan_TMrPlanPlugin.php

    r3082281 r3085515  
    204204        }else if(!is_null($boton_atts['id_idioma'])){
    205205            $motor->datos->id_idioma    = (int) $boton_atts['id_idioma'];
     206        }
     207
     208        if($motor->datos->id_idioma==-1){
     209            // Idioma automatico
     210            $motor->datos->id_idioma = $this->getLanguageBrowser();
    206211        }
    207212       
     
    249254                default:
    250255            }
    251         }
    252        
     256        }   
    253257
    254258
     
    327331
    328332
     333    /**
     334     * Según el idioma configurado en el navegador, devolvemos el identificador para el motor.
     335     * Si no encuentra ninguno, devuelve el 1 (iingles)
     336     *
     337     * @return integer
     338     */
    329339    private function getLanguageBrowser(){
    330340        $languageList   = null;
     
    339349        foreach ($languageRanges as $languageRange) {
    340350            if (preg_match('/(\*|[a-zA-Z0-9]{1,8}(?:-[a-zA-Z0-9]{1,8})*)(?:\s*;\s*q\s*=\s*(0(?:\.\d{0,3})|1(?:\.0{0,3})))?/', trim($languageRange), $match)) {
    341                 if (!isset($match[2])) {
    342                     $match[2] = '1.0';
    343                 } else {
    344                     $match[2] = (string) floatval($match[2]);
     351                $languages[] = reset(explode('-', strtolower($match[1])));
     352            }
     353        }
     354
     355        if(count($languages)>0){
     356            foreach($languages as $l){
     357                switch($l){
     358                    case 'es':      return 0;
     359                    case 'en':      return 1;
     360                    case 'pt':      return 2;
     361                    case 'fr':      return 3;
     362                    case 'it':      return 4;
     363                    case 'de':      return 5;
     364                    case 'ca':      return 6;
     365                    case 'gl':      return 7;
     366                    case 'eu':      return 8;
    345367                }
    346                 if (!isset($languages[$match[2]])) {
    347                     $languages[$match[2]] = array();
    348                 }
    349                 $languages[$match[2]][] = strtolower($match[1]);
    350             }
    351         }
    352         krsort($languages);
    353         return $languages;
     368            }
     369        }   
     370
     371        return 1;
    354372    }
    355373}
  • misterplan/trunk/init.php

    r3082285 r3085515  
    88 * Author: MisterPlan
    99 * Author URI: https://misterplan.es
    10  * Version: 1.1.13
     10 * Version: 1.1.14
    1111 * Text Domain: misterplan
    1212 * Domain Path: /languages
  • misterplan/trunk/readme.txt

    r3082285 r3085515  
    44Tested up to: 6.4.3
    55Requires PHP: 7.2.5
    6 Stable tag: 1.1.13
     6Stable tag: 1.1.14
    77License: GPLv2 or later
    88Contributors: jorgealonso
     
    108108Fixed other bugs
    109109
     110= 1.1.14 =
     111
     112You can now set up an engine with automatic language. It will take the language that the user has in his browser.
     113
    110114== Screenshots ==
    111115
  • misterplan/trunk/templates_php/admin/motor/tipo_1.php

    r3082039 r3085515  
    118118                            <option value="<?php echo (int) $idioma->id_idioma; ?>" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==$idioma->id_idioma) echo esc_attr('selected'); ?> ><?php echo esc_attr($idioma->nombre_idioma); ?></option>
    119119                        <?php }?>
     120                        <option value="-1" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==-1) echo esc_attr('selected'); ?> ><?php echo esc_html__('Automatic, according to user settings', 'misterplan'); ?></option>
    120121                    </select>
    121122                </label>
  • misterplan/trunk/templates_php/admin/motor/tipo_2.php

    r3055932 r3085515  
    116116                            <option value="<?php echo (int) $idioma->id_idioma; ?>" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==$idioma->id_idioma) echo esc_attr('selected'); ?> ><?php echo esc_attr($idioma->nombre_idioma); ?></option>
    117117                        <?php }?>
     118                        <option value="-1" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==-1) echo esc_attr('selected'); ?> ><?php echo esc_html__('Automatic, according to user settings', 'misterplan'); ?></option>
    118119                    </select>
    119120                </label>
  • misterplan/trunk/templates_php/admin/motor/tipo_3.php

    r3050339 r3085515  
    9797                                <option value="<?php echo (int) $idioma->id_idioma; ?>" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==$idioma->id_idioma) echo esc_attr('selected'); ?> ><?php echo esc_attr($idioma->nombre_idioma); ?></option>
    9898                            <?php }?>
     99                            <option value="-1" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==-1) echo esc_attr('selected'); ?> ><?php echo esc_html__('Automatic, according to user settings', 'misterplan'); ?></option>
    99100                        </select>
    100101                    </label>
  • misterplan/trunk/templates_php/admin/motor/tipo_5.php

    r3049701 r3085515  
    100100                            <option value="<?php echo (int) $idioma->id_idioma; ?>" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==$idioma->id_idioma) echo esc_attr('selected'); ?> ><?php echo esc_attr($idioma->nombre_idioma); ?></option>
    101101                        <?php }?>
     102                        <option value="-1" <?php if(isset($motor->datos->id_idioma) && $motor->datos->id_idioma==-1) echo esc_attr('selected'); ?> ><?php echo esc_html__('Automatic, according to user settings', 'misterplan'); ?></option>
    102103                    </select>
    103104                </label>
Note: See TracChangeset for help on using the changeset viewer.