Plugin Directory

Changeset 2449445


Ignore:
Timestamp:
01/03/2021 04:04:53 PM (5 years ago)
Author:
dougwollison
Message:

Hotfix 2.9.1.1

Location:
nlingual
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nlingual/tags/2.9.1.1/includes/class-nlingual-manager.php

    r1963115 r2449445  
    168168     * Save languages from the manager.
    169169     *
    170      * @since 2.7.0 Added downloading of WordPress language files for each language.
     170     * @since 2.9.1.1 Rewrite field checking, make accept_code optional.
     171     * @since 2.7.0   Added downloading of WordPress language files for each language.
    171172     * @since 2.0.0
    172173     *
     
    190191        $languages = $_POST['nlingual_languages'];
    191192
    192         // The fields to check
     193        // The fields whitelist + required status
    193194        $fields = array(
    194             'system_name' => '%s',
    195             'native_name' => '%s',
    196             'short_name'  => '%s',
    197             'locale_name' => '%s',
    198             'accept_code' => '%s',
    199             'iso_code'    => '%s',
    200             'slug'        => '%s',
     195            'system_name' => true,
     196            'native_name' => true,
     197            'short_name'  => true,
     198            'locale_name' => true,
     199            'accept_code' => false,
     200            'iso_code'    => true,
     201            'slug'        => true,
    201202        );
    202         $formats = array_values( $fields );
    203203
    204204        // Loop through languages and update/insert
     
    212212            }
    213213
    214             // Ensure all fields are set
    215             foreach ( $fields as $field => $format ) {
    216                 if ( ! isset( $language[ $field ] ) || empty( $language[ $field ] ) ) {
     214            $entry = array();
     215
     216            // Populate entry
     217            foreach ( $fields as $field => $required ) {
     218                // Abort if a required field missing
     219                if ( $required && empty( $language[ $field ] ) ) {
    217220                    add_settings_error(
    218221                        'nlingual-languages',
     
    221224                        'error'
    222225                    );
    223                     break;
     226                    break 2;
    224227                }
    225228
    226                 $entry[ $field ] = $language[ $field ];
     229                if ( isset( $language[ $field ] ) ) {
     230                    $entry[ $field ] = $language[ $field ];
     231                }
    227232            }
    228233
     
    231236
    232237            // Default active to 0
    233             $formats[] = '%d';
    234238            $entry['active'] = 0;
    235239            if ( isset( $language['active'] ) ) {
     
    237241            }
    238242
    239             // Default text direction to ltr if not set or otherwise not ltr
    240             $formats[] = '%s';
     243            // Default text direction to ltr if not set, rtl if not explictly ltr
    241244            $entry['direction'] = 'ltr';
    242245            if ( isset( $language['direction'] ) && $language['direction'] != 'ltr' ) {
     
    245248
    246249            // Add list_order
    247             $formats[] = '%d';
    248250            $entry['list_order'] = $i;
    249251            $i++;
  • nlingual/tags/2.9.1.1/nlingual.php

    r2449432 r2449445  
    44Plugin URI: https://github.com/dougwollison/nlingual
    55Description: Easy to manage Multilingual system, with theme development utilities and post data synchronization.
    6 Version: 2.9.1
     6Version: 2.9.1.1
    77Author: Doug Wollison
    88Author URI: https://dougw.me
     
    5151 * @var string
    5252 */
    53 define( 'NL_PLUGIN_VERSION', '2.9.1' );
     53define( 'NL_PLUGIN_VERSION', '2.9.1.1' );
    5454
    5555/**
  • nlingual/tags/2.9.1.1/readme.txt

    r2449432 r2449445  
    55Tested up to: 5.6.0
    66Requires PHP: 5.6.20
    7 Stable tag: 2.9.1
     7Stable tag: 2.9.1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8080**Details on each release can be found [on the GitHub releases page](https://github.com/dougwollison/nlingual/releases) for this project.**
    8181
     82= 2.9.1.1 =
     83Hotfix: cleanup of language saving, allow specifying no accept codes for a language.
     84
    8285= 2.9.1 =
    8386Fixed issue causing sitemap requests to redirect to posts page. Simplified accept-language handling.
  • nlingual/trunk/includes/class-nlingual-manager.php

    r1963115 r2449445  
    168168     * Save languages from the manager.
    169169     *
    170      * @since 2.7.0 Added downloading of WordPress language files for each language.
     170     * @since 2.9.1.1 Rewrite field checking, make accept_code optional.
     171     * @since 2.7.0   Added downloading of WordPress language files for each language.
    171172     * @since 2.0.0
    172173     *
     
    190191        $languages = $_POST['nlingual_languages'];
    191192
    192         // The fields to check
     193        // The fields whitelist + required status
    193194        $fields = array(
    194             'system_name' => '%s',
    195             'native_name' => '%s',
    196             'short_name'  => '%s',
    197             'locale_name' => '%s',
    198             'accept_code' => '%s',
    199             'iso_code'    => '%s',
    200             'slug'        => '%s',
     195            'system_name' => true,
     196            'native_name' => true,
     197            'short_name'  => true,
     198            'locale_name' => true,
     199            'accept_code' => false,
     200            'iso_code'    => true,
     201            'slug'        => true,
    201202        );
    202         $formats = array_values( $fields );
    203203
    204204        // Loop through languages and update/insert
     
    212212            }
    213213
    214             // Ensure all fields are set
    215             foreach ( $fields as $field => $format ) {
    216                 if ( ! isset( $language[ $field ] ) || empty( $language[ $field ] ) ) {
     214            $entry = array();
     215
     216            // Populate entry
     217            foreach ( $fields as $field => $required ) {
     218                // Abort if a required field missing
     219                if ( $required && empty( $language[ $field ] ) ) {
    217220                    add_settings_error(
    218221                        'nlingual-languages',
     
    221224                        'error'
    222225                    );
    223                     break;
     226                    break 2;
    224227                }
    225228
    226                 $entry[ $field ] = $language[ $field ];
     229                if ( isset( $language[ $field ] ) ) {
     230                    $entry[ $field ] = $language[ $field ];
     231                }
    227232            }
    228233
     
    231236
    232237            // Default active to 0
    233             $formats[] = '%d';
    234238            $entry['active'] = 0;
    235239            if ( isset( $language['active'] ) ) {
     
    237241            }
    238242
    239             // Default text direction to ltr if not set or otherwise not ltr
    240             $formats[] = '%s';
     243            // Default text direction to ltr if not set, rtl if not explictly ltr
    241244            $entry['direction'] = 'ltr';
    242245            if ( isset( $language['direction'] ) && $language['direction'] != 'ltr' ) {
     
    245248
    246249            // Add list_order
    247             $formats[] = '%d';
    248250            $entry['list_order'] = $i;
    249251            $i++;
  • nlingual/trunk/nlingual.php

    r2449432 r2449445  
    44Plugin URI: https://github.com/dougwollison/nlingual
    55Description: Easy to manage Multilingual system, with theme development utilities and post data synchronization.
    6 Version: 2.9.1
     6Version: 2.9.1.1
    77Author: Doug Wollison
    88Author URI: https://dougw.me
     
    5151 * @var string
    5252 */
    53 define( 'NL_PLUGIN_VERSION', '2.9.1' );
     53define( 'NL_PLUGIN_VERSION', '2.9.1.1' );
    5454
    5555/**
  • nlingual/trunk/readme.txt

    r2449432 r2449445  
    55Tested up to: 5.6.0
    66Requires PHP: 5.6.20
    7 Stable tag: 2.9.1
     7Stable tag: 2.9.1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8080**Details on each release can be found [on the GitHub releases page](https://github.com/dougwollison/nlingual/releases) for this project.**
    8181
     82= 2.9.1.1 =
     83Hotfix: cleanup of language saving, allow specifying no accept codes for a language.
     84
    8285= 2.9.1 =
    8386Fixed issue causing sitemap requests to redirect to posts page. Simplified accept-language handling.
Note: See TracChangeset for help on using the changeset viewer.