SourceForge logo
SourceForge logo
Menu

phpwiki-checkins

From: Reini U. <ru...@us...> - 2002年09月27日 13:27:21
Update of /cvsroot/phpwiki/phpwiki/lib/plugin
In directory usw-pr-cvs1:/tmp/cvs-serv2610
Added Files:
	PageTrail.php 
Log Message:
new experimental plugin by Paul Pearson <wa...@gl...>,
 improved to store a single cookie only, and invisible parameter added
--- NEW FILE: PageTrail.php ---
<?php // -*-php-*-
rcs_id('$Id: PageTrail.php,v 1.1 2002年09月27日 13:27:17 rurban Exp $');
/**
 * A simple PageTrail WikiPlugin.
 * Put this at the end of each page to store the trail.
 *
 * Usage:
 * <?plugin PageTrail?>
 * <?plugin PageTrail numberlinks=5?>
 * <?plugin PageTrail invisible=1?> 
 */
// Constants are defined before the class.
if (!defined('THE_END'))
 define('THE_END', "!");
class WikiPlugin_PageTrail
extends WikiPlugin
{
 // Four required functions in a WikiPlugin.
 var $def_numberlinks = 5;
 function getName () {
 return _("PageTrail");
 }
 function getDescription () {
 return _("PageTrail Plugin");
 }
 // default values
 function getDefaultArguments() {
 return array('numberlinks' => $this->def_numberlinks, 
 'invisible' => false,
 );
 }
 function run($dbi, $argstr, $request) {
 extract($this->getArgs($argstr, $request));
 if ($numberlinks > 10 || $numberlinks < 0) { $numberlinks = $this->def_numberlinks; }
 // Get name of the current page we are on
 $thispage = $request->getArg('pagename');
 $thiscookie = $request->cookies->get("Wiki_PageTrail");
 $Pages = explode(':',$thiscookie);
 array_unshift($Pages, $thispage);
 $request->cookies->set("Wiki_PageTrail",implode(':',$Pages));
 if (! $invisible) {
 $numberlinks = min(count($Pages)-1, $numberlinks);
 $html = HTML::tt(fmt('%s', WikiLink($Pages[$numberlinks-1]), 'auto'));
 for ($i = $numberlinks-2; $i >= 0; $i--) {
 if (!empty($Pages[$i]))
 $html->pushContent(fmt(' ==> %s', WikiLink($Pages[$i], 'auto')));
 }
 $html->pushContent(THE_END);
 return $html;
 } else 
 return HTML();
 }
};
// For emacs users
// Local Variables:
// mode: php
// tab-width: 8
// c-basic-offset: 4
// c-hanging-comment-ender-p: nil
// indent-tabs-mode: nil
// End:
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /