2 rcs_id('$Id: RecentChanges.php,v 1.109 2006-03-19 14:26:29 rurban Exp $');
4 Copyright 1999, 2000, 2001, 2002 $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
25 class _RecentChanges_Formatter
27 var $_absurls = false;
29 function _RecentChanges_Formatter ($rc_args) {
30 $this->_args = $rc_args;
31 $this->_diffargs = array('action' => 'diff');
33 if ($rc_args['show_minor'] || !$rc_args['show_major'])
34 $this->_diffargs['previous'] = 'minor';
36 // PageHistoryPlugin doesn't have a 'daylist' arg.
37 if (!isset($this->_args['daylist']))
38 $this->_args['daylist'] = false;
41 function include_versions_in_URLs() {
42 return (bool) $this->_args['show_all'];
45 function date ($rev) {
47 return $WikiTheme->getDay($rev->get('mtime'));
50 function time ($rev) {
52 return $WikiTheme->formatTime($rev->get('mtime'));
55 function diffURL ($rev) {
56 $args = $this->_diffargs;
57 if ($this->include_versions_in_URLs())
58 $args['version'] = $rev->getVersion();
59 $page = $rev->getPage();
60 return WikiURL($page->getName(), $args, $this->_absurls);
63 function historyURL ($rev) {
64 $page = $rev->getPage();
65 return WikiURL($page, array('action' => _("PageHistory")),
69 function pageURL ($rev) {
70 return WikiURL($this->include_versions_in_URLs() ? $rev : $rev->getPage(),
74 function authorHasPage ($author) {
75 global $WikiNameRegexp, $request;
76 $dbi = $request->getDbh();
77 return isWikiWord($author) && $dbi->isWikiPage($author);
80 function authorURL ($author) {
81 return $this->authorHasPage() ? WikiURL($author) : false;
85 function status ($rev) {
86 if ($rev->hasDefaultContents())
88 $page = $rev->getPage();
89 $prev = $page->getRevisionBefore($rev->getVersion());
90 if ($prev->hasDefaultContents())
95 function importance ($rev) {
96 return $rev->get('is_minor_edit') ? 'minor' : 'major';
99 function summary($rev) {
100 if ( ($summary = $rev->get('summary')) )
103 switch ($this->status($rev)) {
107 return _("New page");
113 function setValidators($most_recent_rev) {
114 $rev = $most_recent_rev;
115 $validators = array('RecentChanges-top' =>
116 array($rev->getPageName(), $rev->getVersion()),
117 '%mtime' => $rev->get('mtime'));
119 $request->appendValidators($validators);
123 class _RecentChanges_HtmlFormatter
124 extends _RecentChanges_Formatter
126 function diffLink ($rev) {
128 $button = $WikiTheme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action');
129 $button->setAttr('rel', 'nofollow');
133 function historyLink ($rev) {
135 return $WikiTheme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action');
138 function pageLink ($rev, $link_text=false) {
140 return WikiLink($this->include_versions_in_URLs() ? $rev : $rev->getPage(),'auto',$link_text);
142 $page = $rev->getPage();
144 if ($this->include_versions_in_URLs()) {
145 $version = $rev->getVersion();
146 if ($rev->isCurrent())
148 $exists = !$rev->hasDefaultContents();
152 $cur = $page->getCurrentRevision();
153 $exists = !$cur->hasDefaultContents();
156 return $WikiTheme->linkExistingWikiWord($page->getName(), $link_text, $version);
158 return $WikiTheme->linkUnknownWikiWord($page->getName(), $link_text);
162 function authorLink ($rev) {
163 $author = $rev->get('author');
164 if ( $this->authorHasPage($author) ) {
165 return WikiLink($author);
170 function summaryAsHTML ($rev) {
171 if ( !($summary = $this->summary($rev)) )
173 return HTML::strong( array('class' => 'wiki-summary'),
175 TransformLinks($summary, $rev->get('markup'), $rev->getPageName()),
179 function rss_icon () {
180 global $request, $WikiTheme;
182 $rss_url = $request->getURLtoSelf(array('format' => 'rss'));
183 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'),
184 $WikiTheme->makeButton("RSS", $rss_url, 'rssicon'));
186 function rss2_icon () {
187 global $request, $WikiTheme;
189 $rss_url = $request->getURLtoSelf(array('format' => 'rss2'));
190 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'),
191 $WikiTheme->makeButton("RSS2", $rss_url, 'rssicon'));
194 function pre_description () {
195 extract($this->_args);
196 // FIXME: say something about show_all.
197 if ($show_major && $show_minor)
200 $edits = _("major edits");
202 $edits = _("minor edits");
203 if (isset($caption) and $caption == _("Recent Comments"))
204 $edits = _("comments");
206 if ($timespan = $days > 0) {
207 if (intval($days) != $days)
208 $days = sprintf("%.1f", $days);
212 * Depending how this text is split up it can be tricky or
213 * impossible to translate with good grammar. So the seperate
214 * strings for 1 day and %s days are necessary in this case
215 * for translating to multiple languages, due to differing
216 * overlapping ideal word cutting points.
218 * en: day/days "The %d most recent %s [during (the past] day) are listed below."
219 * de: 1 Tag "Die %d jüngste %s [innerhalb (von des letzten] Tages) sind unten aufgelistet."
220 * de: %s days "Die %d jüngste %s [innerhalb (von] %s Tagen) sind unten aufgelistet."
222 * en: day/days "The %d most recent %s during [the past] (day) are listed below."
223 * fr: 1 jour "Les %d %s les plus récentes pendant [le dernier (d'une] jour) sont énumérées ci-dessous."
224 * fr: %s jours "Les %d %s les plus récentes pendant [les derniers (%s] jours) sont énumérées ci-dessous."
228 if (intval($days) == 1)
229 $desc = fmt("The %d most recent %s during the past day are listed below.",
232 $desc = fmt("The %d most recent %s during the past %s days are listed below.",
233 $limit, $edits, $days);
235 $desc = fmt("The %d most recent %s are listed below.",
238 elseif ($limit < 0) { //$limit < 0 means we want oldest pages
240 if (intval($days) == 1)
241 $desc = fmt("The %d oldest %s during the past day are listed below.",
244 $desc = fmt("The %d oldest %s during the past %s days are listed below.",
245 $lmt, $edits, $days);
247 $desc = fmt("The %d oldest %s are listed below.",
253 if (intval($days) == 1)
254 $desc = fmt("The most recent %s during the past day are listed below.",
257 $desc = fmt("The most recent %s during the past %s days are listed below.",
260 $desc = fmt("All %s are listed below.", $edits);
265 function description() {
266 return HTML::p(false, $this->pre_description());
271 extract($this->_args);
272 return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
274 $this->rss_icon(), HTML::raw(' '), $this->rss2_icon(),
275 $this->sidebar_link());
278 function empty_message () {
279 if (isset($this->_args['caption']) and $this->_args['caption'] == _("Recent Comments"))
280 return _("No comments found");
282 return _("No changes found");
285 function sidebar_link() {
286 extract($this->_args);
287 $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
290 $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
293 "function addPanel() {\n"
294 ." window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
295 ." \"$sidebarurl\",\"\");\n"
297 $jsf = JavaScript($addsidebarjsfunc);
300 $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
301 $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
302 $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
303 ." (typeof window.sidebar.addPanel == 'function'))\n"
305 ." document.write('$addsidebarjsclick');\n"
308 return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
311 function format ($changes) {
312 include_once('lib/InlineParser.php');
314 $html = HTML(HTML::h2(false, $this->title()));
315 if (($desc = $this->description()))
316 $html->pushContent($desc);
318 if ($this->_args['daylist'])
319 $html->pushContent(new DayButtonBar($this->_args));
325 while ($rev = $changes->next()) {
326 if (($date = $this->date($rev)) != $last_date) {
328 $html->pushContent($lines);
329 $html->pushContent(HTML::h3($date));
334 // enforce view permission
335 if (mayAccessPage('view', $rev->_pagename)) {
336 $lines->pushContent($this->format_revision($rev));
339 $this->setValidators($rev);
344 $html->pushContent($lines);
346 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
347 $this->empty_message()));
352 function format_revision ($rev) {
353 $args = &$this->_args;
355 $class = 'rc-' . $this->importance($rev);
357 $time = $this->time($rev);
358 if (! $rev->get('is_minor_edit'))
359 $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
361 $line = HTML::li(array('class' => $class));
364 if ($args['difflinks'])
365 $line->pushContent($this->diffLink($rev), ' ');
367 if ($args['historylinks'])
368 $line->pushContent($this->historyLink($rev), ' ');
370 $line->pushContent($this->pageLink($rev), ' ',
372 $this->summaryAsHTML($rev),
374 $this->authorLink($rev));
380 class _RecentChanges_SideBarFormatter
381 extends _RecentChanges_HtmlFormatter
383 function rss_icon () {
386 function rss2_icon () { }
388 //title click opens the normal RC or RE page in the main browser frame
389 extract($this->_args);
390 $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
391 $titlelink->setAttr('target', '_content');
392 return HTML($this->logo(), $titlelink);
395 //logo click opens the HomePage in the main browser frame
397 $img = HTML::img(array('src' => $WikiTheme->getImageURL('logo'),
400 'style' => 'height:2.5ex'
402 $linkurl = WikiLink(HOME_PAGE, false, $img);
403 $linkurl->setAttr('target', '_content');
407 function authorLink ($rev) {
408 $author = $rev->get('author');
409 if ( $this->authorHasPage($author) ) {
410 $linkurl = WikiLink($author);
411 $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
417 function diffLink ($rev) {
418 $linkurl = parent::diffLink($rev);
419 $linkurl->setAttr('target', '_content');
420 $linkurl->setAttr('rel', 'nofollow');
421 // FIXME: Smelly hack to get smaller diff buttons in sidebar
422 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
425 function historyLink ($rev) {
426 $linkurl = parent::historyLink($rev);
427 $linkurl->setAttr('target', '_content');
428 // FIXME: Smelly hack to get smaller history buttons in sidebar
429 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
432 function pageLink ($rev) {
433 $linkurl = parent::pageLink($rev);
434 $linkurl->setAttr('target', '_content');
437 // Overriding summaryAsHTML, because there is no way yet to
438 // return summary as transformed text with
439 // links setAttr('target', '_content') in Mozilla sidebar.
440 // So for now don't create clickable links inside summary
441 // in the sidebar, or else they target the sidebar and not the
442 // main content window.
443 function summaryAsHTML ($rev) {
444 if ( !($summary = $this->summary($rev)) )
446 return HTML::strong(array('class' => 'wiki-summary'),
448 /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
453 function format ($changes) {
454 $this->_args['daylist'] = false; //don't show day buttons in Mozilla sidebar
455 $html = _RecentChanges_HtmlFormatter::format ($changes);
456 $html = HTML::div(array('class' => 'wikitext'), $html);
458 $request->discardOutput();
460 printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", $GLOBALS['charset']);
461 printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
462 printf(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
463 printf('<html xmlns="http://www.w3.org/1999/xhtml">');
466 extract($this->_args);
467 $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
468 printf("<title>" . $title . "</title>\n");
470 $css = $WikiTheme->getCSS();
474 printf("<body class=\"sidebar\">\n");
476 echo '<a href="http://www.feedvalidator.org/check.cgi?url=http://phpwiki.org/RecentChanges?format=rss"><img src="themes/default/buttons/valid-rss.png" alt="[Valid RSS]" title="Validate the RSS feed" width="44" height="15" /></a>';
477 printf("\n</body>\n");
480 $request->finish(); // cut rest of page processing short
484 class _RecentChanges_BoxFormatter
485 extends _RecentChanges_HtmlFormatter
487 function rss_icon () {
489 function rss2_icon () {
493 function authorLink ($rev) {
495 function diffLink ($rev) {
497 function historyLink ($rev) {
499 function summaryAsHTML ($rev) {
501 function description () {
503 function format ($changes) {
504 include_once('lib/InlineParser.php');
509 $sp = HTML::Raw("\n · ");
510 while ($rev = $changes->next()) {
511 // enforce view permission
512 if (mayAccessPage('view',$rev->_pagename)) {
513 if ($link = $this->pageLink($rev)) // some entries may be empty
514 // (/Blog/.. interim pages)
515 $html->pushContent($sp, $link, HTML::br());
517 $this->setValidators($rev);
522 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
523 $this->empty_message()));
528 class _RecentChanges_RssFormatter
529 extends _RecentChanges_Formatter
531 var $_absurls = true;
533 function time ($rev) {
534 return Iso8601DateTime($rev->get('mtime'));
537 function pageURI ($rev) {
538 return WikiURL($rev, '', 'absurl');
541 function format ($changes) {
543 include_once('lib/RssWriter.php');
544 $rss = new RssWriter;
546 $rss->channel($this->channel_properties());
548 if (($props = $this->image_properties()))
550 if (($props = $this->textinput_properties()))
551 $rss->textinput($props);
554 while ($rev = $changes->next()) {
555 // enforce view permission
556 if (mayAccessPage('view', $rev->_pagename)) {
557 $rss->addItem($this->item_properties($rev),
558 $this->pageURI($rev));
560 $this->setValidators($rev);
566 $request->discardOutput();
568 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
570 // Flush errors in comment, otherwise it's invalid XML.
571 global $ErrorManager;
572 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
573 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
575 $request->finish(); // NORETURN!!!!
578 function image_properties () {
581 $img_url = AbsoluteURL($WikiTheme->getImageURL('logo'));
585 return array('title' => WIKI_NAME,
586 'link' => WikiURL(HOME_PAGE, false, 'absurl'),
590 function textinput_properties () {
591 return array('title' => _("Search"),
592 'description' => _("Title Search"),
594 'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
597 function channel_properties () {
600 $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
601 return array('title' => WIKI_NAME,
603 'description' => _("RecentChanges"),
604 'dc:date' => Iso8601DateTime(time()),
605 'dc:language' => $GLOBALS['LANG']);
607 /* FIXME: other things one might like in <channel>:
616 * rss091:managingEditor
618 * rss091:lastBuildDate
623 function item_properties ($rev) {
624 $page = $rev->getPage();
625 $pagename = $page->getName();
627 return array( 'title' => SplitPagename($pagename),
628 'description' => $this->summary($rev),
629 'link' => $this->pageURL($rev),
630 'dc:date' => $this->time($rev),
631 'dc:contributor' => $rev->get('author'),
632 'wiki:version' => $rev->getVersion(),
633 'wiki:importance' => $this->importance($rev),
634 'wiki:status' => $this->status($rev),
635 'wiki:diff' => $this->diffURL($rev),
636 'wiki:history' => $this->historyURL($rev)
641 /** explicit application/rss+xml Content-Type,
642 * simplified xml structure (no namespace),
643 * support for xml-rpc cloud registerProcedure (not yet)
645 class _RecentChanges_Rss2Formatter
646 extends _RecentChanges_RssFormatter {
648 function format ($changes) {
649 include_once('lib/RssWriter2.php');
650 $rss = new RssWriter2;
652 $rss->channel($this->channel_properties());
653 if (($props = $this->cloud_properties()))
655 if (($props = $this->image_properties()))
657 if (($props = $this->textinput_properties()))
658 $rss->textinput($props);
660 while ($rev = $changes->next()) {
661 // enforce view permission
662 if (mayAccessPage('view', $rev->_pagename)) {
663 $rss->addItem($this->item_properties($rev),
664 $this->pageURI($rev));
666 $this->setValidators($rev);
672 $request->discardOutput();
674 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
675 // Flush errors in comment, otherwise it's invalid XML.
676 global $ErrorManager;
677 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
678 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
680 $request->finish(); // NORETURN!!!!
683 function channel_properties () {
684 $chann_10 = parent::channel_properties();
685 return array_merge($chann_10,
686 array('generator' => 'PhpWiki-'.PHPWIKI_VERSION,
687 //<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
688 //<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
689 //<docs>http://blogs.law.harvard.edu/tech/rss</docs>
690 'copyright' => COPYRIGHTPAGE_URL
694 function cloud_properties () { return false; } // xml-rpc registerProcedure not yet implemented
695 function cloud_properties_test () {
696 return array('protocol' => 'xml-rpc', // xml-rpc or soap or http-post
697 'registerProcedure' => 'wiki.rssPleaseNotify',
698 'path' => DATA_PATH.'/RPC2.php',
699 'port' => !SERVER_PORT ? '80' : (SERVER_PROTOCOL == 'https' ? '443' : '80'),
700 'domain' => SERVER_NAME);
704 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
708 * @param $revisions object a WikiDB_PageRevisionIterator.
710 function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
711 $this->_revisions = $revisions;
712 $this->_check_current_revision = $check_current_revision;
716 while (($rev = $this->_revisions->next())) {
717 if ($this->_check_current_revision) {
718 $page = $rev->getPage();
719 $check_rev = $page->getCurrentRevision();
724 if (! $check_rev->hasDefaultContents())
733 class WikiPlugin_RecentChanges
736 function getName () {
737 return _("RecentChanges");
740 function getVersion() {
741 return preg_replace("/[Revision: $]/", '',
742 "\$Revision: 1.109 $");
745 function managesValidators() {
746 // Note that this is a bit of a fig.
747 // We set validators based on the most recently changed page,
748 // but this fails when the most-recent page is deleted.
749 // (Consider that the Last-Modified time will decrease
750 // when this happens.)
752 // We might be better off, leaving this as false (and junking
753 // the validator logic above) and just falling back to the
754 // default behavior (handled by WikiPlugin) of just using
755 // the WikiDB global timestamp as the mtime.
757 // Nevertheless, for now, I leave this here, mostly as an
758 // example for how to use appendValidators() and managesValidators().
763 function getDefaultArguments() {
764 return array('days' => 2,
765 'show_minor' => false,
766 'show_major' => true,
768 'show_deleted' => 'sometimes',
773 'historylinks' => false,
778 function getArgs ($argstr, $request, $defaults = false) {
779 if (!$defaults) $defaults = $this->getDefaultArguments();
780 $args = WikiPlugin::getArgs($argstr, $request, $defaults);
782 $action = $request->getArg('action');
783 if ($action != 'browse' && ! $request->isActionPage($action))
784 $args['format'] = false; // default -> HTML
786 if ($args['format'] == 'rss' && empty($args['limit']))
787 $args['limit'] = 15; // Fix default value for RSS.
788 if ($args['format'] == 'rss2' && empty($args['limit']))
789 $args['limit'] = 15; // Fix default value for RSS2.
791 if ($args['format'] == 'sidebar' && empty($args['limit']))
792 $args['limit'] = 10; // Fix default value for sidebar.
797 function getMostRecentParams ($args) {
800 $params = array('include_minor_revisions' => $show_minor,
801 'exclude_major_revisions' => !$show_major,
802 'include_all_revisions' => !empty($show_all));
804 $params['limit'] = $limit;
807 $params['since'] = time() - 24 * 3600 * $days;
809 $params['since'] = 24 * 3600 * $days - time();
814 function getChanges ($dbi, $args) {
815 $changes = $dbi->mostRecent($this->getMostRecentParams($args));
817 $show_deleted = $args['show_deleted'];
818 if ($show_deleted == 'sometimes')
819 $show_deleted = $args['show_minor'];
822 $changes = new NonDeletedRevisionIterator($changes, !$args['show_all']);
827 function format ($changes, $args) {
829 $format = $args['format'];
831 $fmt_class = $WikiTheme->getFormatter('RecentChanges', $format);
833 if ($format == 'rss')
834 $fmt_class = '_RecentChanges_RssFormatter';
835 elseif ($format == 'rss2')
836 $fmt_class = '_RecentChanges_Rss2Formatter';
837 elseif ($format == 'rss091') {
838 include_once "lib/RSSWriter091.php";
839 $fmt_class = '_RecentChanges_RssFormatter091';
841 elseif ($format == 'sidebar')
842 $fmt_class = '_RecentChanges_SideBarFormatter';
843 elseif ($format == 'box')
844 $fmt_class = '_RecentChanges_BoxFormatter';
846 $fmt_class = '_RecentChanges_HtmlFormatter';
849 $fmt = new $fmt_class($args);
850 return $fmt->format($changes);
853 function run($dbi, $argstr, &$request, $basepage) {
854 $args = $this->getArgs($argstr, $request);
856 // HACKish: fix for SF bug #622784 (1000 years of RecentChanges ought
857 // to be enough for anyone.)
858 $args['days'] = min($args['days'], 365000);
860 // Hack alert: format() is a NORETURN for rss formatters.
861 return $this->format($this->getChanges($dbi, $args), $args);
864 // box is used to display a fixed-width, narrow version with common header.
865 // just a numbered list of limit pagenames, without date.
866 function box($args = false, $request = false, $basepage = false) {
867 if (!$request) $request =& $GLOBALS['request'];
868 if (!isset($args['limit'])) $args['limit'] = 15;
869 $args['format'] = 'box';
870 $args['show_minor'] = false;
871 $args['show_major'] = true;
872 $args['show_deleted'] = 'sometimes';
873 $args['show_all'] = false;
875 return $this->makeBox(WikiLink($this->getName(),'',SplitPagename($this->getName())),
876 $this->format($this->getChanges($request->_dbi, $args), $args));
882 class DayButtonBar extends HtmlElement {
884 function DayButtonBar ($plugin_args) {
885 $this->__construct('p', array('class' => 'wiki-rc-action'));
887 // Display days selection buttons
888 extract($plugin_args);
893 $caption = _("Show minor edits for:");
895 $caption = _("Show all changes for:");
897 $caption = _("Show changes for:");
900 $this->pushContent($caption, ' ');
903 $sep = $WikiTheme->getButtonSeparator();
906 foreach (explode(",", $daylist) as $days) {
908 $this->pushContent($sep);
909 $this->pushContent($this->_makeDayButton($days));
913 function _makeDayButton ($days) {
914 global $WikiTheme, $request;
919 $label = "..."; //alldays
921 $label = sprintf(_("%s days"), abs($days));
923 $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'days' => $days));
925 return $WikiTheme->makeButton($label, $url, 'wiki-rc-action');
929 // $Log: not supported by cvs2svn $
930 // Revision 1.108 2005/04/01 16:09:35 rurban
931 // fix defaults in RecentChanges plugins: e.g. invalid pagenames for PageHistory
933 // Revision 1.107 2005/02/04 13:45:28 rurban
934 // improve box layout a bit
936 // Revision 1.106 2005/02/02 19:39:10 rurban
937 // honor show_all=false
939 // Revision 1.105 2005/01/25 03:50:54 uckelman
940 // pre_description is a member function, so call with $this->.
942 // Revision 1.104 2005/01/24 23:15:16 uckelman
943 // The extra description for RelatedChanges was appearing in RecentChanges
944 // and PageHistory due to a bad test in _RecentChanges_HtmlFormatter. Fixed.
946 // Revision 1.103 2004/12/15 17:45:09 rurban
949 // Revision 1.102 2004/12/06 19:29:24 rurban
950 // simplify RSS: add RSS2 link (rss tag only, new content-type)
952 // Revision 1.101 2004/11/10 19:32:24 rurban
953 // * optimize increaseHitCount, esp. for mysql.
954 // * prepend dirs to the include_path (phpwiki_dir for faster searches)
955 // * Pear_DB version logic (awful but needed)
956 // * fix broken ADODB quote
957 // * _extract_page_data simplification
959 // Revision 1.100 2004/06/28 16:35:12 rurban
960 // prevent from shell commands
962 // Revision 1.99 2004/06/20 14:42:54 rurban
963 // various php5 fixes (still broken at blockparser)
965 // Revision 1.98 2004/06/14 11:31:39 rurban
966 // renamed global $Theme to $WikiTheme (gforge nameclash)
967 // inherit PageList default options from PageList
968 // default sortby=pagename
969 // use options in PageList_Selectable (limit, sortby, ...)
970 // added action revert, with button at action=diff
971 // added option regex to WikiAdminSearchReplace
973 // Revision 1.97 2004/06/03 18:58:27 rurban
974 // days links requires action=RelatedChanges arg
976 // Revision 1.96 2004/05/18 16:23:40 rurban
977 // rename split_pagename to SplitPagename
979 // Revision 1.95 2004/05/16 22:07:35 rurban
980 // check more config-default and predefined constants
981 // various PagePerm fixes:
982 // fix default PagePerms, esp. edit and view for Bogo and Password users
983 // implemented Creator and Owner
984 // BOGOUSERS renamed to BOGOUSER
985 // fixed syntax errors in signin.tmpl
987 // Revision 1.94 2004/05/14 20:55:03 rurban
988 // simplified RecentComments
990 // Revision 1.93 2004/05/14 17:33:07 rurban
991 // new plugin RecentChanges
993 // Revision 1.92 2004/04/21 04:29:10 rurban
994 // Two convenient RecentChanges extensions
995 // RelatedChanges (only links from current page)
996 // RecentEdits (just change the default args)
998 // Revision 1.91 2004/04/19 18:27:46 rurban
999 // Prevent from some PHP5 warnings (ref args, no :: object init)
1000 // php5 runs now through, just one wrong XmlElement object init missing
1001 // Removed unneccesary UpgradeUser lines
1002 // Changed WikiLink to omit version if current (RecentChanges)
1004 // Revision 1.90 2004/04/18 01:11:52 rurban
1005 // more numeric pagename fixes.
1006 // fixed action=upload with merge conflict warnings.
1007 // charset changed from constant to global (dynamic utf-8 switching)
1009 // Revision 1.89 2004/04/10 02:30:49 rurban
1010 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
1011 // Fixed "cannot setlocale..." (sf.net problem)
1013 // Revision 1.88 2004/04/01 15:57:10 rurban
1014 // simplified Sidebar theme: table, not absolute css positioning
1015 // added the new box methods.
1016 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
1018 // Revision 1.87 2004/03/30 02:14:03 rurban
1019 // fixed yet another Prefs bug
1020 // added generic PearDb_iter
1021 // $request->appendValidators no so strict as before
1022 // added some box plugin methods
1023 // PageList commalist for condensed output
1025 // Revision 1.86 2004/03/12 13:31:43 rurban
1026 // enforce PagePermissions, errormsg if not Admin
1028 // Revision 1.85 2004/02/17 12:11:36 rurban
1029 // 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, ...)
1031 // Revision 1.84 2004/02/15 22:29:42 rurban
1032 // revert premature performance fix
1034 // Revision 1.83 2004/02/15 21:34:37 rurban
1035 // PageList enhanced and improved.
1036 // fixed new WikiAdmin... plugins
1037 // editpage, Theme with exp. htmlarea framework
1038 // (htmlarea yet committed, this is really questionable)
1039 // WikiUser... code with better session handling for prefs
1040 // enhanced UserPreferences (again)
1041 // RecentChanges for show_deleted: how should pages be deleted then?
1043 // Revision 1.82 2004/01/25 03:58:43 rurban
1044 // use stdlib:isWikiWord()
1046 // Revision 1.81 2003/11/28 21:06:31 carstenklapp
1047 // Enhancement: Mozilla RecentChanges sidebar now defaults to 10 changes
1048 // instead of 1. Make diff buttons smaller with css. Added description
1049 // line back in at the top.
1051 // Revision 1.80 2003/11/27 15:17:01 carstenklapp
1052 // Theme & appearance tweaks: Converted Mozilla sidebar link into a Theme
1053 // button, to allow an image button for it to be added to Themes. Output
1054 // RSS button in small text size when theme has no button image.
1056 // Revision 1.79 2003/04/29 14:34:20 dairiki
1057 // Bug fix: "add sidebar" link didn't work when USE_PATH_INFO was false.
1059 // Revision 1.78 2003/03/04 01:55:05 dairiki
1060 // Fix to ensure absolute URL for logo in RSS recent changes.
1062 // Revision 1.77 2003/02/27 23:23:38 dairiki
1063 // Fix my breakage of CSS and sidebar RecentChanges output.
1065 // Revision 1.76 2003/02/27 22:48:44 dairiki
1066 // Fixes invalid HTML generated by PageHistory plugin.
1068 // (<noscript> is block-level and not allowed within <p>.)
1070 // Revision 1.75 2003/02/22 21:39:05 dairiki
1071 // Hackish fix for SF bug #622784.
1073 // (The root of the problem is clearly a PHP bug.)
1075 // Revision 1.74 2003/02/21 22:52:21 dairiki
1076 // Make sure to interpret relative links (like [/Subpage]) in summary
1077 // relative to correct basepage.
1079 // Revision 1.73 2003/02/21 04:12:06 dairiki
1080 // Minor fixes for new cached markup.
1082 // Revision 1.72 2003/02/17 02:19:01 dairiki
1083 // Fix so that PageHistory will work when the current revision
1084 // of a page has been "deleted".
1086 // Revision 1.71 2003/02/16 20:04:48 dairiki
1087 // Refactor the HTTP validator generation/checking code.
1089 // This also fixes a number of bugs with yesterdays validator mods.
1091 // Revision 1.70 2003/02/16 05:09:43 dairiki
1092 // Starting to fix handling of the HTTP validator headers, Last-Modified,
1095 // Last-Modified was being set incorrectly (but only when DEBUG was not
1096 // defined!) Setting a Last-Modified without setting an appropriate
1097 // Expires: and/or Cache-Control: header results in browsers caching
1098 // the page unconditionally (for a certain period of time).
1099 // This is generally bad, since it means people don't see updated
1100 // page contents right away --- this is particularly confusing to
1101 // the people who are editing pages since their edits don't show up
1102 // next time they browse the page.
1104 // Now, we don't allow caching of pages without revalidation
1105 // (via the If-Modified-Since and/or If-None-Match request headers.)
1106 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
1107 // appropriate value in index.php, but I advise against it.)
1111 // o Even when request is aborted due to the content not being
1112 // modified, we currently still do almost all the work involved
1113 // in producing the page. So the only real savings from all
1114 // this logic is in network bandwidth.
1116 // o Plugins which produce "dynamic" output need to be inspected
1117 // and made to call $request->addToETag() and
1118 // $request->setModificationTime() appropriately, otherwise the
1119 // page can change without the change being detected.
1120 // This leads to stale pages in cache again...
1122 // Revision 1.69 2003/01/18 22:01:43 carstenklapp
1124 // Reformatting & tabs to spaces;
1125 // Added copyleft, getVersion, getDescription, rcs_id.
1128 // (c-file-style: "gnu")
1132 // c-basic-offset: 4
1133 // c-hanging-comment-ender-p: nil
1134 // indent-tabs-mode: nil