Skip to content

Commit 4d8721d

Browse files
new options: 'vector_copyright_translate' and 'vector_sitenotice_translate'
Enables the user to use language specific wiki pages as translated side wide notice / copyright notice if the Translation plugin (cf. http://www.dokuwiki.org/plugin:translation) is available. Works the same way as the multilingual navigation (cf. option 'vector_navigation_translate').
1 parent ddab627 commit 4d8721d

File tree

6 files changed

+87
-33
lines changed

6 files changed

+87
-33
lines changed

conf/default.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
$conf["vector_discuss_ns"] = ":talk:"; //namespace to use for discussion page storage
4242

4343
//site notice
44-
$conf["vector_sitenotice"] = true; //TRUE: use/show sitenotice
45-
$conf["vector_sitenotice_location"] = ":wiki:site_notice"; //page/article used to store the sitenotice
44+
$conf["vector_sitenotice"] = true; //TRUE: use/show sitenotice
45+
$conf["vector_sitenotice_location"] = ":wiki:site_notice"; //page/article used to store the sitenotice
46+
$conf["vector_sitenotice_translate"] = true; //TRUE: load translated sitenotice if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
4647

4748
//navigation
4849
$conf["vector_navigation"] = true; //TRUE: use/show navigation
@@ -60,9 +61,10 @@
6061
$conf["vector_toolbox_location"] = ":wiki:toolbox"; //page/article used to store a custom toolbox
6162

6263
//custom copyright notice
63-
$conf["vector_copyright"] = true; //TRUE: use/show copyright notice
64-
$conf["vector_copyright_default"] = true; //TRUE: use default copyright notice (if copyright notice is enabled at all)
65-
$conf["vector_copyright_location"] = ":wiki:copyright"; //page/article used to store a custom copyright notice
64+
$conf["vector_copyright"] = true; //TRUE: use/show copyright notice
65+
$conf["vector_copyright_default"] = true; //TRUE: use default copyright notice (if copyright notice is enabled at all)
66+
$conf["vector_copyright_location"] = ":wiki:copyright"; //page/article used to store a custom copyright notice
67+
$conf["vector_copyright_translate"] = true; //TRUE: load translated copyright notice if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
6668

6769
//donation link/button
6870
$conf["vector_donate"] = true; //TRUE: use/show donation link/button

conf/metadata.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
$meta["vector_discuss_ns"] = array("string", "_pattern" => "/^:.{1,}:$/");
4242

4343
//site notice
44-
$meta["vector_sitenotice"] = array("onoff");
45-
$meta["vector_sitenotice_location"] = array("string");
44+
$meta["vector_sitenotice"] = array("onoff");
45+
$meta["vector_sitenotice_location"] = array("string");
46+
$meta["vector_sitenotice_translate"] = array("onoff");
4647

4748
//navigation
4849
$meta["vector_navigation"] = array("onoff");
@@ -60,9 +61,10 @@
6061
$meta["vector_toolbox_location"] = array("string");
6162

6263
//custom copyright notice
63-
$meta["vector_copyright"] = array("onoff");
64-
$meta["vector_copyright_default"] = array("onoff");
65-
$meta["vector_copyright_location"] = array("string");
64+
$meta["vector_copyright"] = array("onoff");
65+
$meta["vector_copyright_default"] = array("onoff");
66+
$meta["vector_copyright_location"] = array("string");
67+
$meta["vector_copyright_translate"] = array("onoff");
6668

6769
//donation link/button
6870
$meta["vector_donate"] = array("onoff");

lang/de-informal/settings.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
$lang["vector_discuss_ns"] = "Falls ja, folgenden ':namensraum:' als Wurzel für Diskussionen nutzen:";
4040

4141
//site notice
42-
$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
43-
$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
42+
$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
43+
$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
44+
$lang["vector_sitenotice_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Seiten-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Seiten-Hinweis(e) lautet [Wert von 'vector_sitenotice_location']_[iso-sprach-code] (z.B. ':wiki:site_notice_en').";
4445

4546
//navigation
4647
$lang["vector_navigation"] = "Navigation anzeigen?";
@@ -58,9 +59,10 @@
5859
$lang["vector_toolbox_location"] = "Falls nicht die Standard-Toolbox, folgende wiki-Seite als Toolbox verwenden:";
5960

6061
//custom copyright notice
61-
$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
62-
$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
63-
$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
62+
$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
63+
$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
64+
$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
65+
$lang["vector_copyright_translate"] = "Falls nicht den Standard-Copyright-Hinweis und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Copyright-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Copyright-Hinweis(e) lautet [Wert von 'vector_copyright_location']_[iso-sprach-code] (z.B. ':wiki:copyright_en').";
6466

6567
//donation link/button
6668
$lang["vector_donate"] = "'Spenden'-Link/button anzeigen?";

lang/de/settings.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
$lang["vector_discuss_ns"] = "Falls ja, folgenden ':namensraum:' als Wurzel für Diskussionen nutzen:";
4040

4141
//site notice
42-
$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
43-
$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
42+
$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
43+
$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
44+
$lang["vector_sitenotice_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Seiten-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Seiten-Hinweis(e) lautet [Wert von 'vector_sitenotice_location']_[iso-sprach-code] (z.B. ':wiki:site_notice_en').";
4445

4546
//navigation
4647
$lang["vector_navigation"] = "Navigation anzeigen?";
@@ -58,9 +59,10 @@
5859
$lang["vector_toolbox_location"] = "Falls nicht die Standard-Toolbox, folgende wiki-Seite als Toolbox verwenden:";
5960

6061
//custom copyright notice
61-
$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
62-
$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
63-
$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
62+
$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
63+
$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
64+
$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
65+
$lang["vector_copyright_translate"] = "Falls nicht den Standard-Copyright-Hinweis und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Copyright-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Copyright-Hinweis(e) lautet [Wert von 'vector_copyright_location']_[iso-sprach-code] (z.B. ':wiki:copyright_en').";
6466

6567
//donation link/button
6668
$lang["vector_donate"] = "'Spenden'-Link/button anzeigen?";

lang/en/settings.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
$lang["vector_discuss_ns"] = "If yes, use following ':namespace:' as root for discussions:";
4040

4141
//site notice
42-
$lang["vector_sitenotice"] = "Show site wide notice?";
43-
$lang["vector_sitenotice_location"] = "If yes, use following wiki page for the site wide notice:";
42+
$lang["vector_sitenotice"] = "Show site wide notice?";
43+
$lang["vector_sitenotice_location"] = "If yes, use following wiki page for the site wide notice:";
44+
$lang["vector_sitenotice_translate"] = "If yes and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific site wide notice?<br />The wiki page of the translated site notice(s) is [value of 'vector_sitenotice_location']_[iso lang code] (e.g. ':wiki:site_notice_de').";
4445

4546
//navigation
4647
$lang["vector_navigation"] = "Show navigation?";
@@ -58,9 +59,10 @@
5859
$lang["vector_toolbox_location"] = "If not default, use following wiki page as toolbox location:";
5960

6061
//custom copyright notice
61-
$lang["vector_copyright"] = "Show copyright notice?";
62-
$lang["vector_copyright_default"] = "If yes, use default copyright notice?";
63-
$lang["vector_copyright_location"] = "If not default, use following wiki page as copyright notice:";
62+
$lang["vector_copyright"] = "Show copyright notice?";
63+
$lang["vector_copyright_default"] = "If yes, use default copyright notice?";
64+
$lang["vector_copyright_location"] = "If not default, use following wiki page as copyright notice:";
65+
$lang["vector_copyright_translate"] = "If not default and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific copyright notice?<br />The wiki page of the translated copyright notice(s) is [value of 'vector_copyright_location']_[iso lang code] (e.g. ':wiki:copyright_de').";
6466

6567
//donation link/button
6668
$lang["vector_donate"] = "Show donation link/button?";

main.php

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,18 +526,40 @@ function _vector_renderButtons($arr)
526526
html_msgarea();
527527
//show site notice
528528
if (tpl_getConf("vector_sitenotice")){
529-
//we have to show a custom sitenotice
529+
//detect wiki page to load as content
530+
if (!empty($transplugin) && //var comes from conf/boxes.php
531+
is_object($transplugin) &&
532+
tpl_getConf("vector_sitenotice_translate")){
533+
//translated site notice?
534+
$transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
535+
$transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
536+
if (empty($transplugin_langs) ||
537+
empty($transplugin_langcur) ||
538+
!is_array($transplugin_langs) ||
539+
!in_array($transplugin_langcur, $transplugin_langs)) {
540+
//current page is no translation or something is wrong, load default site notice
541+
$sitenotice_location = tpl_getConf("vector_sitenotice_location");
542+
} else {
543+
//load language specific site notice
544+
$sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
545+
}
546+
}else{
547+
//default site notice, no translation
548+
$sitenotice_location = tpl_getConf("vector_sitenotice_location");
549+
}
550+
551+
//we have to show a custom site notice
530552
if (empty($conf["useacl"]) ||
531-
auth_quickaclcheck(cleanID(tpl_getConf("vector_sitenotice_location"))) >= AUTH_READ){ //current user got access?
553+
auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
532554
echo "\n <div id=\"siteNotice\" class=\"noprint\">\n";
533555
//get the rendered content of the defined wiki article to use as
534-
//custom sitenotice.
535-
$interim = tpl_include_page(tpl_getConf("vector_sitenotice_location"), false);
556+
//custom site notice.
557+
$interim = tpl_include_page($sitenotice_location, false);
536558
if ($interim === "" ||
537559
$interim === false){
538560
//show creation/edit link if the defined page got no content
539561
echo "[&#160;";
540-
tpl_pagelink(tpl_getConf("vector_sitenotice_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_sitenotice_location").")"));
562+
tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
541563
echo "&#160;]<br />";
542564
}else{
543565
//show the rendered page content
@@ -774,16 +796,38 @@ function _vector_renderButtons($arr)
774796
echo "</div>\n </li>\n";
775797
//show custom notice.
776798
}else{
799+
//detect wiki page to load as content
800+
if (!empty($transplugin) && //var comes from conf/boxes.php
801+
is_object($transplugin) &&
802+
tpl_getConf("vector_copyright_translate")){
803+
//translated copyright notice?
804+
$transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
805+
$transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
806+
if (empty($transplugin_langs) ||
807+
empty($transplugin_langcur) ||
808+
!is_array($transplugin_langs) ||
809+
!in_array($transplugin_langcur, $transplugin_langs)) {
810+
//current page is no translation or something is wrong, load default copyright notice
811+
$copyright_location = tpl_getConf("vector_copyright_location");
812+
} else {
813+
//load language specific copyright notice
814+
$copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
815+
}
816+
}else{
817+
//default copyright notice, no translation
818+
$copyright_location = tpl_getConf("vector_copyright_location");
819+
}
820+
777821
if (empty($conf["useacl"]) ||
778-
auth_quickaclcheck(cleanID(tpl_getConf("vector_copyright_location"))) >= AUTH_READ){ //current user got access?
822+
auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
779823
echo "<li id=\"footer-info-copyright\">\n ";
780824
//get the rendered content of the defined wiki article to use as custom notice
781-
$interim = tpl_include_page(tpl_getConf("vector_copyright_location"), false);
825+
$interim = tpl_include_page($copyright_location, false);
782826
if ($interim === "" ||
783827
$interim === false){
784828
//show creation/edit link if the defined page got no content
785829
echo "[&#160;";
786-
tpl_pagelink(tpl_getConf("vector_copyright_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_copyright_location").")"));
830+
tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
787831
echo "&#160;]<br />";
788832
}else{
789833
//show the rendered page content

0 commit comments

Comments
 (0)