]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/UriResolver.php
function run: @return mixed
[SourceForge/phpwiki.git] / lib / plugin / UriResolver.php
1 <?php
2
3 /*
4  * Copyright 2007 $ThePhpWikiProgrammingTeam
5  *
6  * This file is part of PhpWiki.
7  *
8  * PhpWiki is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * PhpWiki is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 /**
24  * UriResolver/uri => xml-id
25  *   This function transforms a valid url-encoded URI into a string
26  *   that can be used as an XML-ID. The mapping should be injective.
27  * Inverse to RdfWriter::makeURIfromXMLExportId()
28  * Usage: internal
29  */
30 require_once 'lib/SemanticWeb.php';
31
32 class WikiPlugin_UriResolver
33     extends WikiPlugin
34 {
35     function getDescription()
36     {
37         return _("Converts an URI-escaped identifier back to an unique XML-ID.");
38     }
39
40     function getDefaultArguments()
41     {
42         return array();
43     }
44
45     function allow_undeclared_arg()
46     {
47         return true;
48     }
49
50     /**
51      * @param WikiDB $dbi
52      * @param string $argstr
53      * @param WikiRequest $request
54      * @param string $basepage
55      * @return mixed
56      */
57     function run($dbi, $argstr, &$request, $basepage)
58     {
59         $args = $request->getArgs();
60         unset($args['pagename']);
61         unset($args['action']);
62         unset($args['start_debug']);
63         // FIXME: ?Test=1 => Test
64         $arg = join("/", array_keys($args));
65         $xmlid = RdfWriter::makeXMLExportId($arg);
66         return $xmlid;
67     }
68 }
69
70 // Local Variables:
71 // mode: php
72 // tab-width: 8
73 // c-basic-offset: 4
74 // c-hanging-comment-ender-p: nil
75 // indent-tabs-mode: nil
76 // End: