Index: trunk/phase3/includes/SpecialWatchlist.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgRequest, $wgContLang; |
20 | 20 | global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname; |
21 | 21 | global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker; |
22 | | - global $wgEnotifWatchlist; |
| 22 | + global $wgEnotifWatchlist, $wgFilterRobotsWL; |
23 | 23 | $fname = 'wfSpecialWatchlist'; |
24 | 24 | |
25 | 25 | $wgOut->setPagetitle( wfMsg( 'watchlist' ) ); |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | $defaults = array( |
38 | 38 | /* float */ 'days' => 3.0, /* or 0.5, watch further below */ |
39 | 39 | /* bool */ 'hideOwn' => false, |
| 40 | + /* bool */ 'hideBots' => false, |
40 | 41 | ); |
41 | 42 | |
42 | 43 | extract($defaults); |
— | — | @@ -43,6 +44,7 @@ |
44 | 45 | # Get query variables |
45 | 46 | $days = $wgRequest->getVal( 'days' ); |
46 | 47 | $hideOwn = $wgRequest->getBool( 'hideOwn' ); |
| 48 | + $hideBots = $wgRequest->getBool( 'hideBots' ); |
47 | 49 | |
48 | 50 | # Watchlist editing |
49 | 51 | $action = $wgRequest->getVal( 'action' ); |
— | — | @@ -118,6 +120,7 @@ |
119 | 121 | |
120 | 122 | wfAppendToArrayIfNotDefault( 'days', $days, $defaults, $nondefaults); |
121 | 123 | wfAppendToArrayIfNotDefault( 'hideOwn', $hideOwn, $defaults, $nondefaults); |
| 124 | + wfAppendToArrayIfNotDefault( 'hideBots', $hideBots, $defaults, $nondefaults); |
122 | 125 | |
123 | 126 | if ( $days <= 0 ) { |
124 | 127 | $docutoff = ''; |
— | — | @@ -202,7 +205,13 @@ |
203 | 206 | # Up estimate of watched items by 15% to compensate for talk pages... |
204 | 207 | |
205 | 208 | $andHideOwn = $hideOwn ? "AND (rc_user <> $uid)" : ''; |
206 | | - |
| 209 | + if( $wgFilterRobotsWL ) { |
| 210 | + $andHideBotsOptional = $hideBots ? "AND (rc_bot = 0)" : ''; |
| 211 | + } else { |
| 212 | + $andHideBotsOptional = "AND AND rc_this_oldid=page_latest"; |
| 213 | + } |
| 214 | + |
| 215 | + |
207 | 216 | # Show watchlist header |
208 | 217 | $header = ''; |
209 | 218 | if( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist) { |
— | — | @@ -243,6 +252,7 @@ |
244 | 253 | AND rc_cur_id=page_id |
245 | 254 | AND rc_this_oldid=page_latest |
246 | 255 | $andHideOwn |
| 256 | + $andHideBotsOptional |
247 | 257 | ORDER BY rc_timestamp DESC"; |
248 | 258 | |
249 | 259 | $res = $dbr->query( $sql, $fname ); |
— | — | @@ -265,8 +275,15 @@ |
266 | 276 | $wgContLang->specialPage( 'Watchlist' ), |
267 | 277 | (0 == $hideOwn) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ), |
268 | 278 | wfArrayToCGI( array('hideOwn' => 1-$hideOwn ), $nondefaults ) ); |
| 279 | + $wgOut->addHTML( wfMsgHtml( "wlhideshowown", $s ) ); |
269 | 280 | |
270 | | - $wgOut->addHTML( wfMsgHtml( "wlhideshowown", $s ) ); |
| 281 | + if( $wgFilterRobotsWL ) { |
| 282 | + $s = $sk->makeKnownLink( |
| 283 | + $wgContLang->specialPage( 'Watchlist' ), |
| 284 | + (0 == $hideBots) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ), |
| 285 | + wfArrayToCGI( array('hideBots' => 1-$hideBots ), $nondefaults ) ); |
| 286 | + $wgOut->addHTML( wfMsgHtml( "wlhideshowbots", " $s" ) ); |
| 287 | + } |
271 | 288 | |
272 | 289 | if ( $numRows == 0 ) { |
273 | 290 | $wgOut->addWikitext( "<br />" . wfMsg( 'watchnochange' ), false ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1616,4 +1616,10 @@ |
1617 | 1617 | */ |
1618 | 1618 | $wgUseTrackbacks = false; |
1619 | 1619 | |
| 1620 | +/** |
| 1621 | + * Enable filtering of robots in Special:Watchlist |
| 1622 | + */ |
| 1623 | + |
| 1624 | +$wgFilterRobotsWL = false; |
| 1625 | + |
1620 | 1626 | ?> |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -1238,6 +1238,7 @@ |
1239 | 1239 | 'wlshowlast' => 'Show last $1 hours $2 days $3', |
1240 | 1240 | 'wlsaved' => 'This is a saved version of your watchlist.', |
1241 | 1241 | 'wlhideshowown' => '$1 my edits.', |
| 1242 | +'wlhideshowown' => '$1 robot edits.', |
1242 | 1243 | 'wlshow' => 'Show', |
1243 | 1244 | 'wlhide' => 'Hide', |
1244 | 1245 | |
Index: trunk/phase3/languages/LanguageDa.php |
— | — | @@ -1035,6 +1035,7 @@ |
1036 | 1036 | 'wlshow' => 'Vis', |
1037 | 1037 | 'wlhide' => 'Skjul', |
1038 | 1038 | 'wlhideshowown' => '$1 mine redigeringer.', |
| 1039 | +'wlhideshowown' => '$1 robotredigeringer.', |
1039 | 1040 | 'enotif_mailer' => '{{SITENAME}} informationsmail', |
1040 | 1041 | 'enotif_reset' => 'Marker alle sider som besøgt', |
1041 | 1042 | 'enotif_newpagetext'=> 'Dette er en ny side.', |
Index: trunk/extensions/Footnote.php |
— | — | @@ -1,94 +0,0 @@ |
2 | | -<?php |
3 | | -# Copyright (C) 2005 Anders Wegge Jakobsen <awegge@gmail.com> |
4 | | -# http://www.mediawiki.org/ |
5 | | -# |
6 | | -# This program is free software; you can redistribute it and/or modify |
7 | | -# it under the terms of the GNU General Public License as published by |
8 | | -# the Free Software Foundation; either version 2 of the License, or |
9 | | -# (at your option) any later version. |
10 | | -# |
11 | | -# This program is distributed in the hope that it will be useful, |
12 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | -# GNU General Public License for more details. |
15 | | -# |
16 | | -# You should have received a copy of the GNU General Public License along |
17 | | -# with this program; if not, write to the Free Software Foundation, Inc., |
18 | | -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | | -# http://www.gnu.org/copyleft/gpl.html |
20 | | - |
21 | | -/** |
22 | | - |
23 | | -* Extension to add footnotes to the wiki pages. |
24 | | -* |
25 | | -* Use with: |
26 | | -* |
27 | | -* <footnote>This text is placed at the end of the page.</footnote> |
28 | | -* |
29 | | -* @author Anders Wegge Jakobsen <awegge@gmail.com> |
30 | | -* @package MediaWiki |
31 | | -* @subpackage Extensions |
32 | | - */ |
33 | | - |
34 | | -if( !defined( 'MEDIAWIKI' ) ) { |
35 | | - die(); |
36 | | -} |
37 | | - |
38 | | - |
39 | | -$wgExtensionFunctions[] = "wfFootnote"; |
40 | | - |
41 | | -function wfFootnote() { |
42 | | - global $wgParser ; |
43 | | - $wgParser->setHook( "footnote" , 'parse_footnote' ) ; |
44 | | -} |
45 | | - |
46 | | -$footnotes = array() ; |
47 | | -$footnotecount = 1 ; |
48 | | -$recursion_guard = 0; |
49 | | - |
50 | | -function footnote_hooker( $parser , $text ) { |
51 | | - global $footnotes , $footnotecount, $recursion_guard ; |
52 | | - |
53 | | - if( $recursion_guard != 0 ) return; |
54 | | - if( count( $footnotes ) == 0 ) return ; |
55 | | - |
56 | | - $ret = "" ; |
57 | | - foreach( $footnotes AS $num => $entry ) { |
58 | | - $x = " <a name='footnote{$num}'></a>\n"; |
59 | | - $x = $x . "<li>$entry <a href='#footnoteback{$num}'>↑</a></li>\n" ; |
60 | | - $ret .= $x ; |
61 | | - } |
62 | | - $ret = "<hr/><ol>" . $ret . "</ol>" ; |
63 | | - |
64 | | - $text .= $ret ; |
65 | | -} |
66 | | - |
67 | | -function parse_footnote( $text ) { |
68 | | - $ret = "" ; |
69 | | - |
70 | | - global $footnotes , $footnotecount, $recursion_guard ; |
71 | | - |
72 | | - global $wgTitle , $wgOut, $p; |
73 | | - |
74 | | - if( !isset( $p )) { |
75 | | - $p = new Parser ; |
76 | | - } |
77 | | - |
78 | | - $recursion_guard = 1; |
79 | | - $ret = $p->parse( $text , $wgTitle , $wgOut->mParserOptions, false ) ; |
80 | | - $ret = $ret->getText(); |
81 | | - $recursion_guard = 0; |
82 | | - |
83 | | - $footnotes[$footnotecount] = $ret; |
84 | | - |
85 | | - $ret = "<a href='#footnote{$footnotecount}' name='footnoteback{$footnotecount}'><sup>$footnotecount</sup></a>" ; |
86 | | - |
87 | | - $footnotecount++ ; |
88 | | - if( $footnotecount == 2 ) { |
89 | | - global $wgHooks; |
90 | | - $wgHooks['ParserBeforeTidy'][] = 'footnote_hooker' ; |
91 | | - } |
92 | | - |
93 | | - return $ret ; |
94 | | -} |
95 | | -?> |
Index: trunk/extensions/FootNote/Footnote.php |
— | — | @@ -0,0 +1,101 @@ |
| 2 | +<?php |
| 3 | +# Copyright (C) 2005 Anders Wegge Jakobsen <awegge@gmail.com> |
| 4 | +# http://www.mediawiki.org/ |
| 5 | +# |
| 6 | +# This program is free software; you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU General Public License as published by |
| 8 | +# the Free Software Foundation; either version 2 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# This program is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU General Public License along |
| 17 | +# with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | +# http://www.gnu.org/copyleft/gpl.html |
| 20 | + |
| 21 | +/** |
| 22 | + |
| 23 | +* Extension to add footnotes to the wiki pages. |
| 24 | +* |
| 25 | +* Use with: |
| 26 | +* |
| 27 | +* <footnote>This text is placed at the end of the page.</footnote> |
| 28 | +* |
| 29 | +* @author Anders Wegge Jakobsen <awegge@gmail.com> |
| 30 | +* @package MediaWiki |
| 31 | +* @subpackage Extensions |
| 32 | + */ |
| 33 | + |
| 34 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 35 | + die(); |
| 36 | +} |
| 37 | + |
| 38 | + |
| 39 | +$wgExtensionFunctions[] = "wfFootnote"; |
| 40 | + |
| 41 | +function wfFootnote() { |
| 42 | + global $wgParser, $wgHooks ; |
| 43 | + $wgParser->setHook( "footnote" , 'parse_footnote' ) ; |
| 44 | + $wgHooks['ParserBeforeTidy'][] = 'insert_endnotes' ; |
| 45 | +} |
| 46 | + |
| 47 | +$footnoteNotes = array() ; |
| 48 | +$footnoteCount = 1 ; |
| 49 | +$footnoteRecursionGuard = false; |
| 50 | + |
| 51 | +function insert_endnotes( $parser , $text ) { |
| 52 | + global $footnoteNotes , $footnoteCount, $footnoteRecursionGuard ; |
| 53 | + |
| 54 | + wfDebug("insert_endnotes:\n<<<$text>>>\n"); |
| 55 | + |
| 56 | + if( $footnoteRecursionGuard ) return; |
| 57 | + if( count( $footnoteNotes ) == 0 ) return ; |
| 58 | + |
| 59 | + $ret = "" ; |
| 60 | + foreach( $footnoteNotes AS $num => $entry ) { |
| 61 | + $x = " <a name='footnote{$num}'></a>\n"; |
| 62 | + $x = $x . "<li>$entry <a href='#footnoteback{$num}'>↑</a></li>\n" ; |
| 63 | + $ret .= $x ; |
| 64 | + } |
| 65 | + $ret = "<hr /><ol>" . $ret . "</ol>" ; |
| 66 | + |
| 67 | + $text .= $ret ; |
| 68 | + |
| 69 | + /* Clear global array after rendering */ |
| 70 | + $footnoteNotes = array(); |
| 71 | + $footnoteCount = 1 ; |
| 72 | +} |
| 73 | + |
| 74 | +function parse_footnote( $text ) { |
| 75 | + $ret = "" ; |
| 76 | + |
| 77 | + global $footnoteNotes , $footnoteCount, $footnoteRecursionGuard ; |
| 78 | + |
| 79 | + global $wgTitle , $wgOut, $footnoteParserObj; |
| 80 | + |
| 81 | + if( !isset( $footnoteParserObj )) { |
| 82 | + $footnoteParserObj = new Parser ; |
| 83 | + } |
| 84 | + |
| 85 | + $footnoteRecursionGuard = true; |
| 86 | + $ret = $footnoteParserObj->parse( $text , $wgTitle , $wgOut->mParserOptions, false ) ; |
| 87 | + $ret = $ret->getText(); |
| 88 | + $footnoteRecursionGuard = false; |
| 89 | + |
| 90 | + $footnoteNotes[$footnoteCount] = $ret; |
| 91 | + |
| 92 | + $ret = "<a href='#footnote{$footnoteCount}' name='footnoteback{$footnoteCount}'><sup>$footnoteCount</sup></a>" ; |
| 93 | + |
| 94 | + $footnoteCount++ ; |
| 95 | + if( $footnoteCount == 2 ) { |
| 96 | + global $wgHooks; |
| 97 | + $wgHooks['ParserBeforeTidy'][] = 'insert_endnotes' ; |
| 98 | + } |
| 99 | + |
| 100 | + return $ret ; |
| 101 | +} |
| 102 | +?> |
Property changes on: trunk/extensions/FootNote/Footnote.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 103 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 104 | + native |
Index: trunk/extensions/FootNote/README |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +== Known problems == |
| 3 | + |
| 4 | +* Footnotes inside galleries does not get parsed |
| 5 | +* A footnote in a template does not expand the template parameters |
| 6 | +* The numbering of footnotes when doing page inclusions is wrong. |
| 7 | + |
Property changes on: trunk/extensions/FootNote/README |
___________________________________________________________________ |
Added: svn:keywords |
1 | 8 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 9 | + native |