Index: trunk/phase3/includes/SpecialAllpages.php |
— | — | @@ -6,7 +6,8 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** |
10 | | - * |
| 10 | + * Entry point : initialise variables and call subfunctions. |
| 11 | + * @param string $par ????? (default NULL) |
11 | 12 | */ |
12 | 13 | function wfSpecialAllpages( $par=NULL ) { |
13 | 14 | global $indexMaxperpage, $toplevelMaxperpage, $wgRequest, $wgOut, $wgContLang; |
— | — | @@ -30,6 +31,11 @@ |
31 | 32 | } |
32 | 33 | } |
33 | 34 | |
| 35 | +/** |
| 36 | + * HTML for the top form |
| 37 | + * @param integer $namespace A namespace constant (default NS_MAIN). |
| 38 | + * @param string $from Article name we are starting listing at. |
| 39 | + */ |
34 | 40 | function namespaceForm ( $namespace = NS_MAIN, $from = '' ) { |
35 | 41 | global $wgContLang, $wgScript; |
36 | 42 | |
— | — | @@ -38,7 +44,7 @@ |
39 | 45 | $namespaceselect = '<select name="namespace">'; |
40 | 46 | $arr = $wgContLang->getNamespaces(); |
41 | 47 | for ( $i = 0; $i < 14; $i++ ) { |
42 | | - $namespacename = str_replace ( "_", " ", $arr[$i] ); |
| 48 | + $namespacename = str_replace ( '_', ' ', $arr[$i] ); |
43 | 49 | $n = ($i == 0) ? wfMsg ( 'articlenamespace' ) : $namespacename; |
44 | 50 | $sel = ($i == $namespace) ? ' selected="selected"' : ''; |
45 | 51 | $namespaceselect .= "<option value='{$i}'{$sel}>{$n}</option>"; |
— | — | @@ -57,6 +63,10 @@ |
58 | 64 | return $out; |
59 | 65 | } |
60 | 66 | |
| 67 | +/** |
| 68 | + * @todo Document |
| 69 | + * @param integer $namespace (default NS_MAIN) |
| 70 | + */ |
61 | 71 | function indexShowToplevel ( $namespace = NS_MAIN ) { |
62 | 72 | global $wgOut, $indexMaxperpage, $toplevelMaxperpage, $wgContLang, $wgRequest, $wgUser; |
63 | 73 | $sk = $wgUser->getSkin(); |
— | — | @@ -124,29 +134,29 @@ |
125 | 135 | $outpoint = array_shift ( $lines ); |
126 | 136 | $out .= indexShowline ( $inpoint, $outpoint, $namespace ); |
127 | 137 | } |
128 | | - $out .= "</table>"; |
| 138 | + $out .= '</table>'; |
129 | 139 | |
130 | 140 | $nsForm = namespaceForm ( $namespace ); |
131 | 141 | |
132 | 142 | # Is there more? |
133 | | - $morelinks = ""; |
| 143 | + $morelinks = ''; |
134 | 144 | if ( $offset > 0 ) { |
135 | 145 | $morelinks = $sk->makeKnownLink ( |
136 | | - $wgContLang->specialPage ( "Allpages" ), |
| 146 | + $wgContLang->specialPage ( 'Allpages' ), |
137 | 147 | wfMsg ( 'allpagesprev' ), |
138 | 148 | ( $offset > $toplevelMaxperpage ) ? 'offset='.($offset-$toplevelMaxperpage) : '' |
139 | 149 | ); |
140 | 150 | } |
141 | 151 | if ( $stopat < $sections-1 ) { |
142 | | - if ( $morelinks != "" ) { $morelinks .= " | "; } |
| 152 | + if ( $morelinks != '' ) { $morelinks .= " | "; } |
143 | 153 | $morelinks .= $sk->makeKnownLink ( |
144 | | - $wgContLang->specialPage ( "Allpages" ), |
| 154 | + $wgContLang->specialPage ( 'Allpages' ), |
145 | 155 | wfMsg ( 'allpagesnext' ), |
146 | 156 | 'offset=' . ($offset + $toplevelMaxperpage) |
147 | 157 | ); |
148 | 158 | } |
149 | 159 | |
150 | | - if ( $morelinks != "" ) { |
| 160 | + if ( $morelinks != '' ) { |
151 | 161 | $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
152 | 162 | $out2 .= '<tr valign="top"><td align="left">' . $nsForm; |
153 | 163 | $out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">'; |
— | — | @@ -158,13 +168,18 @@ |
159 | 169 | $wgOut->addHtml( $out2 . $out ); |
160 | 170 | } |
161 | 171 | |
| 172 | +/** |
| 173 | + * @todo Document |
| 174 | + * @param string $from |
| 175 | + * @param integer $namespace (Default NS_MAIN) |
| 176 | + */ |
162 | 177 | function indexShowline( $inpoint, $outpoint, $namespace = NS_MAIN ) { |
163 | 178 | global $wgOut, $wgLang, $wgUser; |
164 | 179 | $sk = $wgUser->getSkin(); |
165 | 180 | $dbr =& wfGetDB( DB_SLAVE ); |
166 | 181 | |
167 | | - $inpointf = htmlspecialchars( str_replace( "_", " ", $inpoint ) ); |
168 | | - $outpointf = htmlspecialchars( str_replace( "_", " ", $outpoint ) ); |
| 182 | + $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); |
| 183 | + $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); |
169 | 184 | $queryparams = $namespace ? ('namespace='.intval($namespace)) : ''; |
170 | 185 | $special = Title::makeTitle( NS_SPECIAL, 'Allpages/' . $inpoint ); |
171 | 186 | $link = $special->escapeLocalUrl( $queryparams ); |
— | — | @@ -183,7 +198,7 @@ |
184 | 199 | $maxPlusOne = $indexMaxperpage + 1; |
185 | 200 | $namespacee = intval($namespace); |
186 | 201 | |
187 | | - $out = ""; |
| 202 | + $out = ''; |
188 | 203 | $dbr =& wfGetDB( DB_SLAVE ); |
189 | 204 | $page = $dbr->tableName( 'page' ); |
190 | 205 | |
— | — | @@ -193,7 +208,7 @@ |
194 | 209 | $sql = "SELECT page_title FROM $page WHERE page_namespace=$namespacee" . |
195 | 210 | " AND page_title >= ". $dbr->addQuotes( $fromKey ) . |
196 | 211 | " ORDER BY page_title LIMIT " . $maxPlusOne; |
197 | | - $res = $dbr->query( $sql, "indexShowChunk" ); |
| 212 | + $res = $dbr->query( $sql, 'indexShowChunk' ); |
198 | 213 | |
199 | 214 | ### FIXME: side link to previous |
200 | 215 | |