Changeset 3470689
- Timestamp:
- 02/26/2026 09:11:43 PM (4 weeks ago)
- Location:
- loco-translate/trunk
- Files:
-
- 5 edited
-
languages/loco-translate.pot (modified) (8 diffs)
-
readme.txt (modified) (1 diff)
-
src/ajax/FsReferenceController.php (modified) (2 diffs)
-
src/data/Settings.php (modified) (3 diffs)
-
tpl/admin/config/settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
loco-translate/trunk/languages/loco-translate.pot
r3457848 r3470689 4 4 "Project-Id-Version: Loco Translate 2.8.2-dev\n" 5 5 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/loco-translate/\n" 6 "POT-Creation-Date: 2026-02- 10 10:05+0000\n"6 "POT-Creation-Date: 2026-02-26 21:11+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 276 276 msgstr "" 277 277 278 #: tpl/admin/config/settings.php:211 279 msgid "Admins only" 280 msgstr "" 281 278 282 #: src/admin/bundle/BaseController.php:102 tpl/admin/file/conf.php:58 279 283 #: tpl/admin/file/move.php:26 … … 300 304 msgstr "" 301 305 302 #: src/admin/config/SettingsController.php:66 306 #: src/admin/config/SettingsController.php:66 tpl/admin/config/settings.php:212 303 307 msgid "Allow" 304 308 msgstr "" … … 308 312 msgstr "" 309 313 310 #: tpl/admin/config/settings.php:2 16314 #: tpl/admin/config/settings.php:226 311 315 msgid "Allow full access to these roles" 312 316 msgstr "" … … 577 581 msgstr "" 578 582 579 #: src/admin/config/SettingsController.php:68 583 #: src/admin/config/SettingsController.php:68 tpl/admin/config/settings.php:210 580 584 msgid "Disallow" 581 585 msgstr "" 582 586 583 587 #: src/admin/file/EditController.php:132 src/admin/file/EditController.php:183 584 #: src/admin/bundle/LocaleController.php:138 tpl/admin/config/settings.php:2 34588 #: src/admin/bundle/LocaleController.php:138 tpl/admin/config/settings.php:244 585 589 #: tpl/admin/config/apis.php:167 tpl/admin/config/prefs.php:45 586 590 #: tpl/admin/common/inc-fsconn.php:16 tpl/admin/common/inc-fsconn.php:41 … … 1009 1013 msgstr "" 1010 1014 1011 #: tpl/admin/config/settings.php:2 101015 #: tpl/admin/config/settings.php:220 1012 1016 msgid "Grant access to roles" 1013 1017 msgstr "" … … 1628 1632 msgstr "" 1629 1633 1630 #: tpl/admin/config/settings.php:2 33 tpl/admin/config/apis.php:1661634 #: tpl/admin/config/settings.php:243 tpl/admin/config/apis.php:166 1631 1635 #: tpl/admin/config/prefs.php:44 1632 1636 msgid "Save settings" … … 1724 1728 #: src/admin/file/BaseController.php:118 1725 1729 msgid "Source" 1730 msgstr "" 1731 1732 #: tpl/admin/config/settings.php:207 1733 msgid "Source code viewer access" 1726 1734 msgstr "" 1727 1735 -
loco-translate/trunk/readme.txt
r3457848 r3470689 103 103 104 104 = 2.8.2 = 105 * Fix for LLMs retaining escaped forward slashes 105 106 * Bumped WordPress compatibility to 6.9.1 106 107 -
loco-translate/trunk/src/ajax/FsReferenceController.php
r3229260 r3470689 78 78 public function render(){ 79 79 $post = $this->validate(); 80 80 81 // enforce code_view access setting before doing anything else 82 $conf = Loco_data_Settings::get(); 83 $code_view = (int) $conf->code_view; 84 if( 0 === $code_view ){ 85 throw new Loco_error_Exception('Source code viewer is disabled'); 86 } 87 if( 1 === $code_view && ! current_user_can('manage_options') ){ 88 throw new Loco_error_Exception('Source code viewer requires administrator privileges'); 89 } 90 81 91 // at the very least we need a reference to examine 82 92 if( ! $post->has('ref') ){ … … 103 113 104 114 // validate allowed source file types, including custom aliases 105 $conf = Loco_data_Settings::get();106 115 $ext = strtolower( $srcfile->extension() ); 107 116 $type = $conf->ext2type($ext,'none'); -
loco-translate/trunk/src/data/Settings.php
r3256049 r3470689 21 21 * @property bool $jed_clean Whether to clean up redundant JSON files during compilation 22 22 * @property bool $ajax_files Whether to submit PO data as concrete files (requires Blob support in Ajax) 23 * 23 * @property int $code_view Access level for source code snippet viewer (0:disabled, 1:admins only, 2:all users) 24 * 24 25 * @property string $deepl_api_key API key for DeepL Translator 25 26 * @property string $google_api_key API key for Google Translate … … 37 38 /** 38 39 * Global instance of this plugin's settings 39 * @var Loco_data_Settings 40 */ 41 private static $current; 40 */ 41 private static ?Loco_data_Settings $current = null; 42 42 43 43 44 44 /** 45 45 * Available options and their defaults 46 * @var array 47 */ 48 private static $defaults = [ 46 */ 47 private static array $defaults = [ 49 48 'version' => '', 50 49 'gen_hash' => false, … … 65 64 'jed_clean' => false, 66 65 'ajax_files' => true, 66 'code_view' => 1, 67 67 'deepl_api_key' => '', 68 68 'google_api_key' => '', -
loco-translate/trunk/tpl/admin/config/settings.php
r3050582 r3470689 203 203 </select> 204 204 </p> 205 <p> 206 <label for="loco--code-view"> 207 <?php esc_html_e('Source code viewer access','loco-translate');?>: 208 </label> 209 <select name="opts[code_view]" id="loco--code-view"> 210 <option value="0"><?php esc_html_e('Disallow','loco-translate')?></option> 211 <option value="1"<?php echo 1 === $opts->code_view?' selected':''?>><?php esc_html_e('Admins only','loco-translate')?></option> 212 <option value="2"<?php echo 2 === $opts->code_view?' selected':''?>><?php esc_html_e('Allow','loco-translate')?></option> 213 </select> 214 </p> 205 215 </fieldset> 206 216 </td>
Note: See TracChangeset
for help on using the changeset viewer.