Changeset 2449445
- Timestamp:
- 01/03/2021 04:04:53 PM (5 years ago)
- Location:
- nlingual
- Files:
-
- 6 edited
- 1 copied
-
tags/2.9.1.1 (copied) (copied from nlingual/trunk)
-
tags/2.9.1.1/includes/class-nlingual-manager.php (modified) (7 diffs)
-
tags/2.9.1.1/nlingual.php (modified) (2 diffs)
-
tags/2.9.1.1/readme.txt (modified) (2 diffs)
-
trunk/includes/class-nlingual-manager.php (modified) (7 diffs)
-
trunk/nlingual.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nlingual/tags/2.9.1.1/includes/class-nlingual-manager.php
r1963115 r2449445 168 168 * Save languages from the manager. 169 169 * 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. 171 172 * @since 2.0.0 172 173 * … … 190 191 $languages = $_POST['nlingual_languages']; 191 192 192 // The fields to check193 // The fields whitelist + required status 193 194 $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, 201 202 ); 202 $formats = array_values( $fields );203 203 204 204 // Loop through languages and update/insert … … 212 212 } 213 213 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 ] ) ) { 217 220 add_settings_error( 218 221 'nlingual-languages', … … 221 224 'error' 222 225 ); 223 break ;226 break 2; 224 227 } 225 228 226 $entry[ $field ] = $language[ $field ]; 229 if ( isset( $language[ $field ] ) ) { 230 $entry[ $field ] = $language[ $field ]; 231 } 227 232 } 228 233 … … 231 236 232 237 // Default active to 0 233 $formats[] = '%d';234 238 $entry['active'] = 0; 235 239 if ( isset( $language['active'] ) ) { … … 237 241 } 238 242 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 241 244 $entry['direction'] = 'ltr'; 242 245 if ( isset( $language['direction'] ) && $language['direction'] != 'ltr' ) { … … 245 248 246 249 // Add list_order 247 $formats[] = '%d';248 250 $entry['list_order'] = $i; 249 251 $i++; -
nlingual/tags/2.9.1.1/nlingual.php
r2449432 r2449445 4 4 Plugin URI: https://github.com/dougwollison/nlingual 5 5 Description: Easy to manage Multilingual system, with theme development utilities and post data synchronization. 6 Version: 2.9.1 6 Version: 2.9.1.1 7 7 Author: Doug Wollison 8 8 Author URI: https://dougw.me … … 51 51 * @var string 52 52 */ 53 define( 'NL_PLUGIN_VERSION', '2.9.1 ' );53 define( 'NL_PLUGIN_VERSION', '2.9.1.1' ); 54 54 55 55 /** -
nlingual/tags/2.9.1.1/readme.txt
r2449432 r2449445 5 5 Tested up to: 5.6.0 6 6 Requires PHP: 5.6.20 7 Stable tag: 2.9.1 7 Stable tag: 2.9.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 80 80 **Details on each release can be found [on the GitHub releases page](https://github.com/dougwollison/nlingual/releases) for this project.** 81 81 82 = 2.9.1.1 = 83 Hotfix: cleanup of language saving, allow specifying no accept codes for a language. 84 82 85 = 2.9.1 = 83 86 Fixed issue causing sitemap requests to redirect to posts page. Simplified accept-language handling. -
nlingual/trunk/includes/class-nlingual-manager.php
r1963115 r2449445 168 168 * Save languages from the manager. 169 169 * 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. 171 172 * @since 2.0.0 172 173 * … … 190 191 $languages = $_POST['nlingual_languages']; 191 192 192 // The fields to check193 // The fields whitelist + required status 193 194 $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, 201 202 ); 202 $formats = array_values( $fields );203 203 204 204 // Loop through languages and update/insert … … 212 212 } 213 213 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 ] ) ) { 217 220 add_settings_error( 218 221 'nlingual-languages', … … 221 224 'error' 222 225 ); 223 break ;226 break 2; 224 227 } 225 228 226 $entry[ $field ] = $language[ $field ]; 229 if ( isset( $language[ $field ] ) ) { 230 $entry[ $field ] = $language[ $field ]; 231 } 227 232 } 228 233 … … 231 236 232 237 // Default active to 0 233 $formats[] = '%d';234 238 $entry['active'] = 0; 235 239 if ( isset( $language['active'] ) ) { … … 237 241 } 238 242 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 241 244 $entry['direction'] = 'ltr'; 242 245 if ( isset( $language['direction'] ) && $language['direction'] != 'ltr' ) { … … 245 248 246 249 // Add list_order 247 $formats[] = '%d';248 250 $entry['list_order'] = $i; 249 251 $i++; -
nlingual/trunk/nlingual.php
r2449432 r2449445 4 4 Plugin URI: https://github.com/dougwollison/nlingual 5 5 Description: Easy to manage Multilingual system, with theme development utilities and post data synchronization. 6 Version: 2.9.1 6 Version: 2.9.1.1 7 7 Author: Doug Wollison 8 8 Author URI: https://dougw.me … … 51 51 * @var string 52 52 */ 53 define( 'NL_PLUGIN_VERSION', '2.9.1 ' );53 define( 'NL_PLUGIN_VERSION', '2.9.1.1' ); 54 54 55 55 /** -
nlingual/trunk/readme.txt
r2449432 r2449445 5 5 Tested up to: 5.6.0 6 6 Requires PHP: 5.6.20 7 Stable tag: 2.9.1 7 Stable tag: 2.9.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 80 80 **Details on each release can be found [on the GitHub releases page](https://github.com/dougwollison/nlingual/releases) for this project.** 81 81 82 = 2.9.1.1 = 83 Hotfix: cleanup of language saving, allow specifying no accept codes for a language. 84 82 85 = 2.9.1 = 83 86 Fixed issue causing sitemap requests to redirect to posts page. Simplified accept-language handling.
Note: See TracChangeset
for help on using the changeset viewer.