From: <var...@us...> - 2009-02-24 15:42:06
|
Revision: 6547 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6547&view=rev Author: vargenau Date: 2009-02-24 15:42:01 +0000 (Tue, 24 Feb 2009) Log Message: ----------- Honor <noinclude> and <includeonly> in IncludePage Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2009-02-24 14:20:31 UTC (rev 6546) +++ trunk/lib/plugin/IncludePage.php 2009-02-24 15:42:01 UTC (rev 6547) @@ -2,6 +2,7 @@ rcs_id('$Id$'); /* Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam + Copyright 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -20,7 +21,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /** * IncludePage: include text from another wiki page in this one * usage: <?plugin IncludePage page=OtherPage rev=6 quiet=1 words=50 lines=6?> @@ -117,6 +117,13 @@ $ct = $this->extractParts ($c, $page, $args); + // exclude from expansion + if (preg_match('/<noinclude>.+<\/noinclude>/s', $ct)) { + $ct = preg_replace("/<noinclude>.+?<\/noinclude>/s", "", $ct); + } + // only in expansion + $ct = preg_replace("/<includeonly>(.+)<\/includeonly>/s", "\\1", $ct); + array_push($included_pages, $page); include_once('lib/BlockParser.php'); @@ -190,52 +197,6 @@ // margin: 0.5ex 0px; // } -// KNOWN ISSUES: -// - line & word limit doesn't work if the included page itself -// includes a plugin - - -// $Log: not supported by cvs2svn $ -// Revision 1.30 2008/07/02 17:48:01 vargenau -// Fix mix-up of bytes and lines -// -// Revision 1.29 2007/06/03 21:58:51 rurban -// Fix for Bug #1713784 -// Includes this patch and a refactoring. -// RedirectTo is still not handled correctly. -// -// Revision 1.28 2006/04/17 17:28:21 rurban -// honor getWikiPageLinks change linkto=>relation -// -// Revision 1.27 2004/11/17 20:07:18 rurban -// just whitespace -// -// Revision 1.26 2004/09/25 16:35:09 rurban -// use stdlib firstNWordsOfContent, extractSection -// -// Revision 1.25 2004/07/08 20:30:07 rurban -// plugin->run consistency: request as reference, added basepage. -// encountered strange bug in AllPages (and the test) which destroys ->_dbi -// -// Revision 1.24 2004/02/17 12:11:36 rurban -// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) -// -// Revision 1.23 2003/03/25 21:01:52 dairiki -// Remove debugging cruft. -// -// Revision 1.22 2003/03/13 18:57:56 dairiki -// Hack so that (when using the IncludePage plugin) the including page shows -// up in the BackLinks of the included page. -// -// Revision 1.21 2003/02/21 04:12:06 dairiki -// Minor fixes for new cached markup. -// -// Revision 1.20 2003/01/18 21:41:02 carstenklapp -// Code cleanup: -// Reformatting & tabs to spaces; -// Added copyleft, getVersion, getDescription, rcs_id. -// - // For emacs users // Local Variables: // mode: php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-07-29 20:26:54
|
Revision: 7050 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7050&view=rev Author: vargenau Date: 2009-07-29 20:26:26 +0000 (Wed, 29 Jul 2009) Log Message: ----------- Test isset Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2009-07-24 06:22:16 UTC (rev 7049) +++ trunk/lib/plugin/IncludePage.php 2009-07-29 20:26:26 UTC (rev 7050) @@ -59,6 +59,8 @@ function getWikiPageLinks($argstr, $basepage) { extract($this->getArgs($argstr)); + if (!isset($page)) + return false; if ($page) { // Expand relative page names. $page = new WikiPageName($page, $basepage); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-08-19 19:35:36
|
Revision: 7070 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7070&view=rev Author: vargenau Date: 2009-08-19 19:35:29 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Improve redirect handling: allow Wikicreole syntax for plugin, handle quotes around page name Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2009-08-19 19:31:06 UTC (rev 7069) +++ trunk/lib/plugin/IncludePage.php 2009-08-19 19:35:29 UTC (rev 7070) @@ -109,9 +109,16 @@ $c = $r->getContent(); // follow redirects - if (preg_match('/<'.'\?plugin\s+RedirectTo\s+page=(\w+)\s+\?'.'>/', + if ((preg_match('/<'.'\?plugin\s+RedirectTo\s+page=(\S+)\s*\?'.'>/', implode("\n", $c), $m)) + or (preg_match('/<<\s*RedirectTo\s+page=(\S+)\s*>>/', + implode("\n", $c), $m))) { + // Strip quotes (simple or double) from page name if any + if ((string_starts_with($m[1], "'")) + or (string_starts_with($m[1], "\""))) { + $m[1] = substr($m[1], 1, -1); + } // trap recursive redirects if (in_array($m[1], $included_pages)) { return $this->error(sprintf(_("recursive inclusion of page %s ignored"), @@ -122,7 +129,7 @@ $r = $p->getCurrentRevision(); $c = $r->getContent(); // array of lines } - + $ct = $this->extractParts ($c, $page, $args); // exclude from expansion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-01-05 16:51:47
|
Revision: 7812 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7812&view=rev Author: vargenau Date: 2011-01-05 16:51:41 +0000 (Wed, 05 Jan 2011) Log Message: ----------- Styles for transclusion and transclusion-title are now in every theme Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2011-01-05 16:49:59 UTC (rev 7811) +++ trunk/lib/plugin/IncludePage.php 2011-01-05 16:51:41 UTC (rev 7812) @@ -198,26 +198,6 @@ } }; -// This is an excerpt from the css file I use: -// -// .transclusion-title { -// font-style: oblique; -// font-size: 0.75em; -// text-decoration: underline; -// text-align: right; -// } -// -// DIV.transclusion { -// background: lightgreen; -// border: thin; -// border-style: solid; -// padding-left: 0.8em; -// padding-right: 0.8em; -// padding-top: 0px; -// padding-bottom: 0px; -// margin: 0.5ex 0px; -// } - // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-01-18 08:45:04
|
Revision: 7840 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7840&view=rev Author: vargenau Date: 2011-01-18 08:44:58 +0000 (Tue, 18 Jan 2011) Log Message: ----------- Add revision (if any) to transclusion title Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2011-01-17 16:16:15 UTC (rev 7839) +++ trunk/lib/plugin/IncludePage.php 2011-01-18 08:44:58 UTC (rev 7840) @@ -150,11 +150,13 @@ if ($quiet) return $content; - return HTML(HTML::p(array('class' => 'transclusion-title'), - fmt("Included from %s", WikiLink($page))), - - HTML::div(array('class' => 'transclusion'), - false, $content)); + if ($rev) { + $transclusion_title = fmt("Included from %s (revision %d)", WikiLink($page), $rev); + } else { + $transclusion_title = fmt("Included from %s", WikiLink($page)); + } + return HTML(HTML::p(array('class' => 'transclusion-title'), $transclusion_title), + HTML::div(array('class' => 'transclusion'), false, $content)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-09 15:40:48
|
Revision: 8402 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8402&view=rev Author: vargenau Date: 2012-10-09 15:40:38 +0000 (Tue, 09 Oct 2012) Log Message: ----------- Avoid warning in: <<IncludePages pages=<!plugin-list BackLinks page=CategoryWikiPlugin !> >> Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2012-10-08 23:19:11 UTC (rev 8401) +++ trunk/lib/plugin/IncludePage.php 2012-10-09 15:40:38 UTC (rev 8402) @@ -69,6 +69,13 @@ return array(array('linkto' => $page->name, 'relation' => 0)); } + // Avoid warning in: + // <<IncludePages pages=<!plugin-list BackLinks page=CategoryWikiPlugin !> >> + function handle_plugin_args_cruft($argstr, $args) + { + return; + } + function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-11 16:45:42
|
Revision: 8652 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8652&view=rev Author: vargenau Date: 2012-12-11 16:45:36 +0000 (Tue, 11 Dec 2012) Log Message: ----------- Less messages Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2012-12-11 16:44:31 UTC (rev 8651) +++ trunk/lib/plugin/IncludePage.php 2012-12-11 16:45:36 UTC (rev 8652) @@ -100,7 +100,7 @@ // Check if page exists if (!($dbi->isWikiPage($page))) { - return $this->error(sprintf(_("Page “%s” does not exist"), $page)); + return $this->error(sprintf(_("Page “%s” does not exist."), $page)); } // Check if user is allowed to get the Page. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2013-04-17 13:15:33
|
Revision: 8766 http://sourceforge.net/p/phpwiki/code/8766 Author: vargenau Date: 2013-04-17 13:15:30 +0000 (Wed, 17 Apr 2013) Log Message: ----------- protected function extractParts Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2013-04-17 10:36:49 UTC (rev 8765) +++ trunk/lib/plugin/IncludePage.php 2013-04-17 13:15:30 UTC (rev 8766) @@ -179,7 +179,7 @@ * handles the arguments: section, sectionhead, lines, words, bytes, * for UnfoldSubpages, IncludePage, ... */ - function extractParts($c, $pagename, $args) + protected function extractParts($c, $pagename, $args) { extract($args); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-10-02 10:09:08
|
Revision: 9156 http://sourceforge.net/p/phpwiki/code/9156 Author: vargenau Date: 2014-10-02 10:09:02 +0000 (Thu, 02 Oct 2014) Log Message: ----------- Fix syntax Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2014-10-01 16:56:30 UTC (rev 9155) +++ trunk/lib/plugin/IncludePage.php 2014-10-02 10:09:02 UTC (rev 9156) @@ -51,7 +51,7 @@ function getWikiPageLinks($argstr, $basepage) { - $args = $this->getArgs($argstr)); + $args = $this->getArgs($argstr); $page = $args['page']; if ($page) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-02-22 17:04:21
|
Revision: 10254 http://sourceforge.net/p/phpwiki/code/10254 Author: vargenau Date: 2021-02-22 17:04:18 +0000 (Mon, 22 Feb 2021) Log Message: ----------- plugin IncludePage: better test boolean arguments "sectionhead" and "quiet" Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2021-02-22 16:54:52 UTC (rev 10253) +++ trunk/lib/plugin/IncludePage.php 2021-02-22 17:04:18 UTC (rev 10254) @@ -93,6 +93,22 @@ $args = $this->getArgs($argstr, $request); extract($args); + if (($quiet == '0') || ($quiet == 'false')) { + $quiet = false; + } elseif (($quiet == '1') || ($quiet == 'true')) { + $quiet = true; + } else { + return $this->error(sprintf(_("Argument '%s' must be a boolean"), "quiet")); + } + + if (($sectionhead == '0') || ($sectionhead == 'false')) { + $sectionhead = false; + } elseif (($sectionhead == '1') || ($sectionhead == 'true')) { + $sectionhead = true; + } else { + return $this->error(sprintf(_("Argument '%s' must be a boolean"), "sectionhead")); + } + if ($page) { // Expand relative page names. $page = new WikiPageName($page, $basepage); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2022-02-15 15:07:18
|
Revision: 10996 http://sourceforge.net/p/phpwiki/code/10996 Author: vargenau Date: 2022-02-15 15:07:16 +0000 (Tue, 15 Feb 2022) Log Message: ----------- lib/plugin/IncludePage.php: get code closer to lib/plugin/Template.php Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2022-02-15 14:45:19 UTC (rev 10995) +++ trunk/lib/plugin/IncludePage.php 2022-02-15 15:07:16 UTC (rev 10996) @@ -39,7 +39,8 @@ function getDefaultArguments() { - return array('page' => false, // the page to include + return array( + 'page' => false, // the page to include 'rev' => false, // the revision (defaults to most recent) 'quiet' => false, // if set, inclusion appears as normal content 'bytes' => false, // maximum number of bytes to include @@ -46,7 +47,7 @@ 'words' => false, // maximum number of words to include 'lines' => false, // maximum number of lines to include 'sections' => false, // maximum number of sections to include - 'section' => false, // include a named section + 'section' => false, // just include a named section 'sectionhead' => false // when including a named section show the heading ); } @@ -150,13 +151,12 @@ } else { $r = $p->getCurrentRevision(); } - $c = $r->getContent(); - + $content = $r->getContent(); // follow redirects - if ((preg_match('/<' . '\?plugin\s+RedirectTo\s+page=(\S+)\s*\?' . '>/', implode("\n", $c), $m)) - or (preg_match('/<' . '\?plugin\s+RedirectTo\s+page=(.*?)\s*\?' . '>/', implode("\n", $c), $m)) - or (preg_match('/<<\s*RedirectTo\s+page=(\S+)\s*>>/', implode("\n", $c), $m)) - or (preg_match('/<<\s*RedirectTo\s+page="(.*?)"\s*>>/', implode("\n", $c), $m)) + if ((preg_match('/<' . '\?plugin\s+RedirectTo\s+page=(\S+)\s*\?' . '>/', implode("\n", $content), $m)) + or (preg_match('/<' . '\?plugin\s+RedirectTo\s+page=(.*?)\s*\?' . '>/', implode("\n", $content), $m)) + or (preg_match('/<<\s*RedirectTo\s+page=(\S+)\s*>>/', implode("\n", $content), $m)) + or (preg_match('/<<\s*RedirectTo\s+page="(.*?)"\s*>>/', implode("\n", $content), $m)) ) { // Strip quotes (simple or double) from page name if any if ((string_starts_with($m[1], "'")) @@ -172,10 +172,10 @@ $page = $m[1]; $p = $dbi->getPage($page); $r = $p->getCurrentRevision(); - $c = $r->getContent(); // array of lines + $content = $r->getContent(); // array of lines } - $ct = $this->extractParts($c, $page, $args); + $ct = $this->extractParts($content, $page, $args); // exclude from expansion if (preg_match('/<noinclude>.+<\/noinclude>/s', $ct)) { @@ -187,8 +187,9 @@ include_once 'lib/BlockParser.php'; $content = TransformText($ct, $page); - if ($quiet) + if ($quiet) { return $content; + } if ($rev) { $transclusion_title = fmt("Included from %s (revision %d)", WikiLink($page), $rev); @@ -200,7 +201,7 @@ } /** - * handles the arguments: section, sectionhead, lines, words, bytes, + * Handles the arguments: section, sectionhead, lines, words, bytes, * for UnfoldSubpages, IncludePage, ... */ protected function extractParts($c, $pagename, $args) @@ -209,7 +210,7 @@ if ($section) { if ($sections) { - $c = extractSection($section, $c, $pagename, $quiet, 1); + $c = extractSection($section, $c, $pagename, $quiet, true); } else { $c = extractSection($section, $c, $pagename, $quiet, $sectionhead); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2022-02-15 16:55:34
|
Revision: 11000 http://sourceforge.net/p/phpwiki/code/11000 Author: vargenau Date: 2022-02-15 16:55:31 +0000 (Tue, 15 Feb 2022) Log Message: ----------- lib/plugin/IncludePage.php: getWikiPageLinks returns links in the included page (as well as the included page) Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2022-02-15 15:32:18 UTC (rev 10999) +++ trunk/lib/plugin/IncludePage.php 2022-02-15 16:55:31 UTC (rev 11000) @@ -54,18 +54,28 @@ function getWikiPageLinks($argstr, $basepage) { - extract($this->getArgs($argstr)); + $args = $this->getArgs($argstr); + $page = isset($args['page']) ? $args['page'] : ''; - if (!isset($page)) - return false; - if ($page) { - // Expand relative page names. - $page = new WikiPageName($page, $basepage); + if (!$page) { + return array(); } - if (!$page or !$page->name) - return false; - return array(array('linkto' => $page->name)); + global $request; + $dbi = $request->_dbi; + $page_handle = $dbi->getPage($page); + $links = $page_handle->getPageLinks(); + $alllinks = array(); + while ($link_handle = $links->next()) { + $linkname = $link_handle->getName(); + $alllinks[] = array('linkto' => $linkname); + } + $page = new WikiPageName($page, $basepage); + if (!$page or !$page->name) { + return array(); + } + $alllinks[] = array('linkto' => $page->name); + return $alllinks; } // Avoid warning in: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |