From e01e4012c2edb8ef3007d517417af0dbfbe5c579 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Thu, 2 Feb 2023 21:51:47 +0100 Subject: [PATCH 1/6] Fix "undefined method helper_plugin_translation::getTransItem()" with translation plugin #584 --- template.info.txt | 2 +- tpl/translation.php | 62 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/template.info.txt b/template.info.txt index 47058385..b5092883 100755 --- a/template.info.txt +++ b/template.info.txt @@ -5,4 +5,4 @@ date 2022-07-27 name Bootstrap3 Template desc Bootstrap-based template for Dokuwiki url https://www.dokuwiki.org/template:bootstrap3 -build stable/20220727 +build dev/20230202 diff --git a/tpl/translation.php b/tpl/translation.php index ac551a53..db2bc710 100755 --- a/tpl/translation.php +++ b/tpl/translation.php @@ -12,7 +12,7 @@ global $conf; $show_translation = false; -$translation_items = ''; +$translation_items = []; $translation_label = ''; $translation = $TPL->getPlugin('translation'); @@ -28,7 +28,40 @@ $translation_label = $translation->getLang('translations'); foreach ($translation->translations as $t) { - $translation_items .= str_replace(array('
', '
'), '', $translation->getTransItem($t, $idpart)); + + // Old version of Translation plugin + if (method_exists($translation, 'getTransItem')) { + $translation_items[] = str_replace(array('
', '
'), '', $translation->getTransItem($t, $idpart)); + } else { + + list($target, $language) = $translation->buildTransID($t, $idpart); + + $target = cleanID($target); + $exists = page_exists($target, '', false); + $link = wl($target); + + $text = ''; + $title = hsc($translation->getLocalName($language)); + + if (isset($translation->opts['flag'])) { + $text .= '' . inlineSVG(DOKU_PLUGIN . 'translation/flags/' . $language . '.svg', 1024 * 12) . ''; + } + + if (isset($translation->opts['name'])) { + + $text .= hsc($translation->getLocalName($language)); + + if (isset($translation->opts['langcode'])) { + $text .= ' (' . hsc($language) . ')'; + } + + } elseif (isset($translation->opts['langcode'])) { + $text .= hsc($language); + } + + $translation_items[] = ''; + + } } } @@ -38,16 +71,33 @@ - + From eca76708a27931bb9749a6c7fb1d9091a62485c7 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Thu, 2 Feb 2023 23:11:10 +0100 Subject: [PATCH 2/6] FIX Theme changing doesn't work in Firefox/Gecko #582 --- tpl/theme-switcher.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tpl/theme-switcher.php b/tpl/theme-switcher.php index bf8a63d3..1f6e2d87 100755 --- a/tpl/theme-switcher.php +++ b/tpl/theme-switcher.php @@ -25,14 +25,14 @@ > - Default + Default getAvailableBootswatchThemes() as $theme): ?> > - + From 8927a59e483eb64ab003adbade28e3d4399a6ac6 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Thu, 2 Feb 2023 23:48:17 +0100 Subject: [PATCH 3/6] Added "disableSearchSuggest" config #573 --- Template.php | 2 ++ conf/default.php | 1 + conf/metadata.php | 1 + lang/en/settings.php | 1 + script.js | 7 ++++++- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Template.php b/Template.php index 1614b55a..33804e61 100755 --- a/Template.php +++ b/Template.php @@ -57,6 +57,7 @@ public function __construct() 'tocLayout' => $this->getConf('tocLayout'), 'useAnchorJS' => (int) $this->getConf('useAnchorJS'), 'useAlternativeToolbarIcons' => (int) $this->getConf('useAlternativeToolbarIcons'), + 'disableSearchSuggest' => (int) $this->getConf('disableSearchSuggest'), ], ]; @@ -492,6 +493,7 @@ public function getTheme() $bootstrap_theme = $this->getConf('bootstrapTheme'); $bootswatch_theme = $this->getBootswatchTheme(); $theme = (($bootstrap_theme == 'bootswatch') ? $bootswatch_theme : $bootstrap_theme); + return $theme; } diff --git a/conf/default.php b/conf/default.php index 591cc9cd..abe97ed6 100755 --- a/conf/default.php +++ b/conf/default.php @@ -85,3 +85,4 @@ $conf['useAvatar'] = 'off'; $conf['useGoogleAnalytics'] = 0; $conf['notifyExtensionsUpdate'] = 0; +$conf['disableSearchSuggest'] = 0; diff --git a/conf/metadata.php b/conf/metadata.php index af8861de..5ff5f34c 100755 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -41,6 +41,7 @@ $meta['navbarLabels'] = array('multicheckbox', '_choices' => array('login', 'register', 'admin', 'tools', 'user', 'site', 'page', 'themes', 'expand', 'profile')); $meta['showAddNewPage'] = array('multichoice', '_choices' => array('never', 'logged', 'always')); $meta['notifyExtensionsUpdate'] = array('onoff'); +$meta['disableSearchSuggest'] = array('onoff'); // Semantic $meta['schemaOrgType'] = array('multichoice', '_choices' => array('Article', 'NewsArticle', 'TechArticle', 'BlogPosting', 'Recipe')); diff --git a/lang/en/settings.php b/lang/en/settings.php index e8234499..238ac300 100755 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -118,3 +118,4 @@ $lang['useAvatar_o_activedirectory'] = 'Active Directory'; $lang['useGoogleAnalytics'] = 'Enable Google Analytics'; $lang['useLegacyNavbar'] = 'Use legacy and deprecated navbar.html hook (consider in the future to use the :navbar hook)'; +$lang['disableSearchSuggest'] = 'Disable the search suggest'; diff --git a/script.js b/script.js index b6a70511..a45445e7 100644 --- a/script.js +++ b/script.js @@ -60,11 +60,16 @@ var dw_template = { dw_template.pageRestoreConfirm(); dw_template.alerts(); dw_template.detail(); - dw_template.typeahead(); + dw_template.menuitem(); dw_template.cookieLaw(); dw_template.plugins(); + // Enable Typeahead + if (! JSINFO.bootstrap3.config.disableSearchSuggest) { + dw_template.typeahead(); + } + // Preload icons Iconify.preloadImages(['mdi:folder-open', 'mdi:folder', 'mdi:file-document-outline', 'mdi:chevron-up', 'mdi:chevron-down']); From 6414beee7d652c839b5e4e456885cd9c38f61c31 Mon Sep 17 00:00:00 2001 From: Eduardo Villegas Date: Sat, 1 Apr 2023 03:55:50 -0600 Subject: [PATCH 4/6] Update template.less Add support to Russian Wikipedia interwiki link --- css/template.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/template.less b/css/template.less index 34ee368a..2e745de5 100755 --- a/css/template.less +++ b/css/template.less @@ -37,7 +37,7 @@ a.iw_user { background-image: url('iconify.php?icon=mdi-account.svg'); } -a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpmeta, a.iw_wppl { +a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpru, a.iw_wpmeta, a.iw_wppl { background-image: url('iconify.php?icon=mdi-wikipedia.svg'); } @@ -869,7 +869,7 @@ body { a.iw_man { background-image: url('iconify.php?icon=mdi-book.svg&color=%23ffffff'); } - a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpmeta, a.iw_wppl { + a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpru, a.iw_wpmeta, a.iw_wppl { background-image: url('iconify.php?icon=mdi-wikipedia.svg&color=%23ffffff'); } } From c03e0482f85bc406c43e94cdd0d9b1ee93ea2609 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Tue, 6 Feb 2024 18:40:28 +0100 Subject: [PATCH 5/6] Fix warnings #596 #597 --- RELEASE.md | 13 +++++++++++++ Template.php | 2 +- iconify.php | 8 +++++--- template.info.txt | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 0a4935b5..5a972915 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,18 @@ # Bootstrap3 DokuWiki Template ChangeLog +## [develop] + +This release increase the compatibility with the latest DokuWiki and PHP releases. + +### Changes + + * #589: Missing Wikipedia logo in interwiki links to Russian language + * #584, #604: Improved compatibility with new Translation Plugin + * #582: Theme changing doesn't work in Firefox/Gecko + * #573: Typeahead blocks global search if match is found + * #596, #597: Warnings after upgrade to 2023-04-04a "Jack Jackrum" + + ## [v2022-07-27] This release increase the compatibility with Hogfather and the upcoming Igor release and fix some regression. diff --git a/Template.php b/Template.php index 33804e61..f5b49ff9 100755 --- a/Template.php +++ b/Template.php @@ -2230,7 +2230,7 @@ public function getTOC($return = false) $toc_undefined = array_pop($toc); } - trigger_event('TPL_TOC_RENDER', $toc, null, false); + \dokuwiki\Extension\Event::createAndTrigger('TPL_TOC_RENDER', $toc, null, false); if ($ACT == 'admin' && $INPUT->str('page') == 'config') { $bootstrap3_sections = [ diff --git a/iconify.php b/iconify.php index 17efba7f..6c31e1c8 100644 --- a/iconify.php +++ b/iconify.php @@ -78,13 +78,15 @@ $iconify_dir = dirname(__FILE__) . '/assets/iconify/json'; $cache_key = md5(serialize($params) . $conf['template'] . filemtime(__FILE__)); -$cache = new cache($cache_key, '.js'); -$cache->_event = 'ICONIFY_CACHE'; $cache_files = $params; $cache_files[] = __FILE__; -$cache_ok = $cache->useCache(array('files' => $cache_files)); $content_type = 'application/javascript; charset=utf-8'; +$cache = new dokuwiki\Cache\Cache($cache_key, '.js'); +$cache->setEvent('ICONIFY_CACHE'); +$cache_ok = $cache->useCache(array('files' => $cache_files)); + + if ($params['icon']) { $content_type = 'image/svg+xml; charset=utf-8'; list($params['prefix'], $params['icons']) = explode('-', str_replace('.svg', '', $params['icon']), 2); diff --git a/template.info.txt b/template.info.txt index b5092883..44bcf8be 100755 --- a/template.info.txt +++ b/template.info.txt @@ -5,4 +5,4 @@ date 2022-07-27 name Bootstrap3 Template desc Bootstrap-based template for Dokuwiki url https://www.dokuwiki.org/template:bootstrap3 -build dev/20230202 +build dev/20240206 From 3ff03dde011cf9a8c07057ebf36f29c91dd53b90 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Tue, 6 Feb 2024 18:43:16 +0100 Subject: [PATCH 6/6] Fix typo in detail.php #605 --- RELEASE.md | 2 +- Template.php | 2 +- detail.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 5a972915..2020ad46 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -5,12 +5,12 @@ This release increase the compatibility with the latest DokuWiki and PHP releases. ### Changes - * #589: Missing Wikipedia logo in interwiki links to Russian language * #584, #604: Improved compatibility with new Translation Plugin * #582: Theme changing doesn't work in Firefox/Gecko * #573: Typeahead blocks global search if match is found * #596, #597: Warnings after upgrade to 2023-04-04a "Jack Jackrum" + * #605: detail.php plural of "information" ## [v2022-07-27] diff --git a/Template.php b/Template.php index f5b49ff9..16069baa 100755 --- a/Template.php +++ b/Template.php @@ -1476,7 +1476,7 @@ public function normalizeContent($content) # Page Heading (h1-h2) # TODO this class will be removed in Bootstrap >= 4.0 version foreach ($html->find('h1,h2,h3') as $elm) { - $elm->class .= ' page-header pb-3 mb-4 mt-5'; # TODO replace page-header with border-bottom in BS4 + $elm->class .= ' page-header pb-3 mb-4 mt-0'; # TODO replace page-header with border-bottom in BS4 } # Media Images diff --git a/detail.php b/detail.php index 21b54f28..fbc2d043 100755 --- a/detail.php +++ b/detail.php @@ -381,7 +381,7 @@

- 'text-primary')) ?> Informations + 'text-primary')) ?> Information