4 * Copyright 2007 $ThePhpWikiProgrammingTeam
6 * This file is part of PhpWiki.
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.
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.
18 * You should have received a copy of the GNU General Public License
19 * along with PhpWiki; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Only useful for link and parser debugging purposes.
26 class WikiPlugin__Retransform
30 return _("Retransform CachedMarkup");
33 function getDescription () {
34 return sprintf(_("Show a markup retransformation of page %s."), '[pagename]');
37 function getVersion() {
38 return preg_replace("/[Revision: $]/", '',
42 function getDefaultArguments() {
43 return array('page' => '[pagename]',
47 function run($dbi, $argstr, &$request, $basepage) {
48 $args = $this->getArgs($argstr, $request);
53 $html = HTML(HTML::h3(fmt("Retransform page '%s'",
56 // bypass WikiDB and cache, go directly through the backend.
57 $backend = &$dbi->_backend;
58 //$pagedata = $backend->get_pagedata($page);
59 $version = $backend->get_latest_version($page);
60 $vdata = $backend->get_versiondata($page, $version, true);
62 include_once('lib/PageType.php');
63 $formatted = new TransformedText($dbi->getPage($page), $vdata['%content'], $vdata);
64 $content =& $formatted->_content;
65 $html->pushContent($this->_DebugPrintArray($content));
66 $links = $formatted->getWikiPageLinks();
67 if (count($links) > 0) {
68 $html->pushContent(HTML::h3("Links"));
69 $html->pushContent($this->_DebugPrintArray($links));
74 function _DebugPrintArray(&$array) {
76 foreach ($array as $line) {
79 $s = HTML::pre(ob_get_contents());
81 $html->pushContent($s);
88 // (c-file-style: "gnu")
93 // c-hanging-comment-ender-p: nil
94 // indent-tabs-mode: nil