From: Carsten K. <car...@us...> - 2003-11-19 00:02:45
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory sc8-pr-cvs1:/tmp/cvs-serv9085 Modified Files: PluginManager.php Log Message: Include found locale-specific pages for the current (non-English) locale. Index: PluginManager.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/PluginManager.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -2 -b -p -d -r1.8 -r1.9 --- PluginManager.php 15 Nov 2003 21:53:53 -0000 1.8 +++ PluginManager.php 19 Nov 2003 00:02:42 -0000 1.9 @@ -21,4 +21,8 @@ rcs_id('$Id$'); */ +// TODO: +// Some of this code can be simplified with the relatively new +// WikiLink($p, 'auto') function. + // Set this to true if you don't want regular users to view this page. // So far there are no known security issues. @@ -135,12 +139,24 @@ extends WikiPlugin $pnamelink = $pname; $plink = false; + // Also look for pages in the current locale + if (_($pname) != $pname) { + $l1 = _($pname); + } else + $l1 = ''; if (preg_match("/^$WikiNameRegexp\$/", $pname) - && $dbi->isWikiPage($pname)) - $pnamelink = WikiLink($pname); + && $dbi->isWikiPage($pname)) { + $pnamelink = HTML(WikiLink($pname)); + } // make another link if an XxxYyyPlugin page exists $ppname = $pname . "Plugin"; + // Also look for pages in the current locale + if (_($ppname) != $ppname) { + $l2 = _($ppname); + } else + $l2 = ''; if (preg_match("/^$WikiNameRegexp\$/", $ppname) - && $dbi->isWikiPage($ppname)) - $plink = WikiLink($ppname); + && $dbi->isWikiPage($ppname)) { + $plink = HTML(WikiLink($ppname)); + } else { // don't link to actionpages and plugins starting with @@ -156,4 +172,35 @@ extends WikiPlugin $plink = false; } + // insert any found locale-specific pages at the bottom of the td + if ($l1 || $l2) { + // really this should all just be put into a new <p> + $par = HTML::p(); + //$plink->pushContent(HTML::br()); + //$plink->pushContent(HTML::br()); + if ($l1) { + // Don't offer to create a link to a non-wikiword localized plugin page + // but show those that already exist (Calendar, Comment, etc.) + // (Non non-wikiword plugins are okay, they just can't become actionPages.) + if (preg_match("/^$WikiNameRegexp\$/", $l1) || $dbi->isWikiPage($l1)) { + $par->pushContent(WikiLink($l1, 'auto')); + } else { + // probably incorrectly translated, so no page link + $par->pushContent($l1, ' ' . _("(Not a WikiWord)")); + } + } + if ($l1 && $l2) + $par->pushContent(HTML::br()); + if ($l2) { + if (preg_match("/^$WikiNameRegexp\$/", $l2) || $dbi->isWikiPage($l2)) { + $par->pushContent(WikiLink($l2, 'auto')); + } else { + // probably incorrectly translated, so no page link + $par->pushContent($l2, ' ' . _("(Not a WikiWord)")); + } + } + + $plink->pushContent($par); + } + // highlight alternate rows $row_no++; @@ -186,4 +233,8 @@ extends WikiPlugin // $Log$ +// Revision 1.9 2003/11/19 00:02:42 carstenklapp +// Include found locale-specific pages for the current (non-English) +// locale. +// // Revision 1.8 2003/11/15 21:53:53 wainstead // Minor change: list plugins in asciibetical order. It'd be better if |