diff options
author | Satoshi Sahara <sahara.satoshi@gmail.com> | 2020-07-24 09:09:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-24 09:09:05 +0900 |
commit | 23a8b8f814821853bb3075cb411a68db2ae97e3f (patch) | |
tree | eb66f7652701f5834f4d57c95f350cf025178b9e /lib | |
parent | feee32dc5882f2ec122feaa7f6096a5897af1ddc (diff) | |
parent | 499d9bcd9036da8a75b9ab35154ad4eb820d21a0 (diff) | |
download | dokuwiki-23a8b8f814821853bb3075cb411a68db2ae97e3f.tar.gz dokuwiki-23a8b8f814821853bb3075cb411a68db2ae97e3f.zip |
Merge branch 'master' into form
Diffstat (limited to 'lib')
-rw-r--r-- | lib/plugins/config/lang/cs/lang.php | 5 | ||||
-rw-r--r-- | lib/plugins/extension/lang/cs/lang.php | 2 | ||||
-rw-r--r-- | lib/plugins/revert/lang/cs/lang.php | 2 | ||||
-rw-r--r-- | lib/plugins/styling/_test/colors.test.php | 72 | ||||
-rw-r--r-- | lib/plugins/styling/admin.php | 43 | ||||
-rw-r--r-- | lib/plugins/styling/plugin.info.txt | 2 | ||||
-rw-r--r-- | lib/scripts/media.js | 8 |
7 files changed, 109 insertions, 25 deletions
diff --git a/lib/plugins/config/lang/cs/lang.php b/lib/plugins/config/lang/cs/lang.php index a72ab7b2c..307da8684 100644 --- a/lib/plugins/config/lang/cs/lang.php +++ b/lib/plugins/config/lang/cs/lang.php @@ -3,8 +3,8 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * - * @author Aleksandr Selivanov <alexgearbox@yandex.ru> * @author Petr Kajzar <petr.kajzar@lf1.cuni.cz> + * @author Aleksandr Selivanov <alexgearbox@yandex.ru> * @author Robert Surý <rsurycz@seznam.cz> * @author Martin Hořínek <hev@hev.cz> * @author Jonáš Dyba <jonas.dyba@gmail.com> @@ -146,6 +146,7 @@ $lang['rss_linkto'] = 'XML kanál odkazuje na'; $lang['rss_content'] = 'Co zobrazovat v položkách XML kanálu?'; $lang['rss_update'] = 'Interval aktualizace XML kanálu (v sekundách)'; $lang['rss_show_summary'] = 'XML kanál ukazuje souhrn v titulku'; +$lang['rss_show_deleted'] = 'XML kanál Zobrazit smazané kanály'; $lang['rss_media'] = 'Jaký typ změn má být uveden v kanálu XML'; $lang['rss_media_o_both'] = 'oba'; $lang['rss_media_o_pages'] = 'stránky'; @@ -174,6 +175,8 @@ $lang['search_fragment_o_starts_with'] = 'začíná s'; $lang['search_fragment_o_ends_with'] = 'končí s'; $lang['search_fragment_o_contains'] = 'obsahuje'; $lang['trustedproxy'] = 'Důvěřovat proxy serverům odpovídajícím tomuto regulárním výrazu ohledně skutečné IP adresy klienta, kterou hlásí. Výchozí hodnota odpovídá místním sítím. Ponechejte prázdné, pokud nechcete důvěřovat žádné proxy.'; +$lang['_feature_flags'] = 'Feature flags'; +$lang['defer_js'] = 'Odložit spuštění javascriptu až po zpracování HTML kódu stránky. Zlepšuje vnímanou rychlost načtení stránky, ale může narušit funkci některých zásuvných modulů.'; $lang['dnslookups'] = 'DokuWiki zjišťuje DNS jména pro vzdálené IP adresy uživatelů, kteří editují stránky. Pokud máte pomalý, nebo nefunkční DNS server, nebo nepotřebujete tuto funkci, tak tuto volbu zrušte.'; $lang['jquerycdn'] = 'Mají být skripty jQuery a jQuery UI načítány z CDN? Vzniknou tím další HTTP dotazy, ale soubory se mohou načíst rychleji a uživatelé je už mohou mít ve vyrovnávací paměti.'; diff --git a/lib/plugins/extension/lang/cs/lang.php b/lib/plugins/extension/lang/cs/lang.php index 4438376dd..dd54ed222 100644 --- a/lib/plugins/extension/lang/cs/lang.php +++ b/lib/plugins/extension/lang/cs/lang.php @@ -3,6 +3,7 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * + * @author Petr Kajzar <petr.kajzar@lf1.cuni.cz> * @author Viktor Zavadil <vzavadil@newps.cz> * @author Jaroslav Lichtblau <jlichtblau@seznam.cz> * @author Turkislav <turkislav@blabla.com> @@ -75,6 +76,7 @@ $lang['msg_template_update_success'] = 'Šablona %s úspěšně aktualizována'; $lang['msg_plugin_install_success'] = 'Zásuvný modul %s úspěšně nainstalován.'; $lang['msg_plugin_update_success'] = 'Zásuvný modul %s úspěšně aktualizován.'; $lang['msg_upload_failed'] = 'Nahrávání souboru selhalo'; +$lang['msg_nooverwrite'] = 'Rozšíření %s již existuje, proto nebylo přepsáno; pro přepsání zatrhněte příslušnou možnost'; $lang['missing_dependency'] = '<strong>Chybějící nebo zakázaná závislost:</strong> %s'; $lang['security_issue'] = '<strong>Bezpečnostní problém:</strong> %s'; $lang['security_warning'] = '<strong>Bezpečnostní varování:</strong> %s'; diff --git a/lib/plugins/revert/lang/cs/lang.php b/lib/plugins/revert/lang/cs/lang.php index 98d6e9e57..a9460659a 100644 --- a/lib/plugins/revert/lang/cs/lang.php +++ b/lib/plugins/revert/lang/cs/lang.php @@ -3,8 +3,8 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * - * @author Aleksandr Selivanov <alexgearbox@yandex.ru> * @author Petr Kajzar <petr.kajzar@lf1.cuni.cz> + * @author Aleksandr Selivanov <alexgearbox@yandex.ru> * @author Robert Surý <rsurycz@seznam.cz> * @author Martin Hořínek <hev@hev.cz> * @author Jonáš Dyba <jonas.dyba@gmail.com> diff --git a/lib/plugins/styling/_test/colors.test.php b/lib/plugins/styling/_test/colors.test.php new file mode 100644 index 000000000..5f5425437 --- /dev/null +++ b/lib/plugins/styling/_test/colors.test.php @@ -0,0 +1,72 @@ +<?php + +/** + * Color handling tests for the styling plugin + * + * @group plugin_styling + * @group plugins + */ +class colors_plugin_styling_test extends DokuWikiTest +{ + + /** + * @return array + * @see testColorType + */ + public function provideColorType() + { + return [ + ['foobar', 'text'], + ['white', 'text'], + ['#fff', 'color'], + ['#f0f0f0', 'color'], + ['#f0f0', 'text'], + ['some #f0f0f0 color', 'text'], + ]; + } + + /** + * @param string $input + * @param string $expect + * @dataProvider provideColorType + * @noinspection PhpUnhandledExceptionInspection + * @noinspection PhpDocMissingThrowsInspection + */ + public function testColorType($input, $expect) + { + $plugin = new admin_plugin_styling(); + $output = $this->callInaccessibleMethod($plugin, 'colorType', [$input]); + $this->assertEquals($expect, $output); + } + + /** + * @return array + * @see testColorValue + */ + public function provideColorValue() + { + return [ + ['foobar', 'foobar'], + ['white', 'white'], + ['#fff', '#ffffff'], + ['#123', '#112233'], + ['#f0f0f0', '#f0f0f0'], + ['#f0f0', '#f0f0'], + ['some #f0f0f0 color', 'some #f0f0f0 color'], + ]; + } + + /** + * @param string $input + * @param string $expect + * @dataProvider provideColorValue + * @noinspection PhpUnhandledExceptionInspection + * @noinspection PhpDocMissingThrowsInspection + */ + public function testColorValue($input, $expect) + { + $plugin = new admin_plugin_styling(); + $output = $this->callInaccessibleMethod($plugin, 'colorValue', [$input]); + $this->assertEquals($expect, $output); + } +} diff --git a/lib/plugins/styling/admin.php b/lib/plugins/styling/admin.php index 70c0572ea..d454422ef 100644 --- a/lib/plugins/styling/admin.php +++ b/lib/plugins/styling/admin.php @@ -60,7 +60,7 @@ class admin_plugin_styling extends DokuWiki_Admin_Plugin global $conf; global $ID; - $styleUtil = new \dokuwiki\StyleUtils($conf['template'], true); + $styleUtil = new \dokuwiki\StyleUtils($conf['template'], true, true); $styleini = $styleUtil->cssStyleini(); $replacements = $styleini['replacements']; @@ -85,8 +85,8 @@ class admin_plugin_styling extends DokuWiki_Admin_Plugin echo '<tr>'; echo '<td><label for="tpl__'.hsc($key).'">'.$name.'</label></td>'; - echo '<td><input type="'.$this->colorType($key).'" name="tpl['.hsc($key).']" id="tpl__'.hsc($key).'" - value="'.hsc($value).'" dir="ltr" /></td>'; + echo '<td><input type="'.$this->colorType($value).'" name="tpl['.hsc($key).']" id="tpl__'.hsc($key).'" + value="'.hsc($this->colorValue($value)).'" dir="ltr" /></td>'; echo '</tr>'; } echo '</tbody></table>'; @@ -114,29 +114,28 @@ class admin_plugin_styling extends DokuWiki_Admin_Plugin } /** - * Decide the input type based on the key name + * Adjust three char color codes to the 6 char one supported by browser's color input * - * @param string $key + * @param string $value + * @return string + */ + protected function colorValue($value) + { + if (preg_match('/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/', $value, $match)) { + return '#' . $match[1] . $match[1] . $match[2] . $match[2] . $match[3] . $match[3]; + } + return $value; + } + + /** + * Decide the input type based on the value + * + * @param string $value * @return string color|text */ - protected function colorType($key) + protected function colorType($value) { - static $colors = array( - 'text', - 'background', - 'text_alt', - 'background_alt', - 'text_neu', - 'background_neu', - 'border', - 'highlight', - 'background_site', - 'link', - 'existing', - 'missing', - ); - - if (preg_match('/colou?r/', $key) || in_array(trim($key, '_'), $colors)) { + if (preg_match('/^#([0-9a-fA-F]{3}){1,2}$/', $value)) { return 'color'; } else { return 'text'; diff --git a/lib/plugins/styling/plugin.info.txt b/lib/plugins/styling/plugin.info.txt index 9f002e282..e374eaf54 100644 --- a/lib/plugins/styling/plugin.info.txt +++ b/lib/plugins/styling/plugin.info.txt @@ -1,7 +1,7 @@ base styling author Andreas Gohr email andi@splitbrain.org -date 2015-07-26 +date 2020-06-14 name styling plugin desc Allows to edit style.ini replacements url https://www.dokuwiki.org/plugin:styling diff --git a/lib/scripts/media.js b/lib/scripts/media.js index 6f36d3b2e..fda64635c 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -696,6 +696,14 @@ var dw_mediamanager = { prepare_content: function ($content) { // hide syntax example $content.find('div.example:visible').hide(); + // toggle list of allowed mime types + $content.find('a.allowedmime').on('click', function (event) { + event.preventDefault(); + $toggle = jQuery(this); + $list = $toggle.next('span'); + $list.toggle(); + }).next('span').hide(); + }, /** |