Index: trunk/phase3/maintenance/archives/patch-interwiki-trans.sql |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +ALTER TABLE /*$wgDBprefix*/interwiki |
| 3 | + ADD COLUMN iw_trans TINYINT(1) NOT NULL DEFAULT 0; |
Property changes on: trunk/phase3/maintenance/archives/patch-interwiki-trans.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 4 | + native |
Added: svn:keywords |
2 | 5 | + Author Date Id Revision |
Index: trunk/phase3/maintenance/archives/patch-transcache.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +CREATE TABLE /*$wgDBprefix*/transcache ( |
| 3 | + tc_url TEXT NOT NULL, |
| 4 | + tc_contents TEXT, |
| 5 | + tc_time INT NOT NULL, |
| 6 | + UNIQUE INDEX tc_url_idx(tc_url(512)) |
| 7 | +); |
| 8 | + |
Property changes on: trunk/phase3/maintenance/archives/patch-transcache.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Added: svn:keywords |
2 | 10 | + Author Date Id Revision |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | array( 'logging', 'patch-logging.sql' ), |
26 | 26 | array( 'validate', 'patch-validate.sql' ), |
27 | 27 | array( 'user_newtalk', 'patch-usernewtalk2.sql' ), |
| 28 | + array( 'transcache', 'patch-transcache.sql' ), |
28 | 29 | ); |
29 | 30 | |
30 | 31 | $wgNewFields = array( |
— | — | @@ -47,6 +48,7 @@ |
48 | 49 | array( 'image', 'img_media_type', 'patch-img_media_type.sql' ), |
49 | 50 | array( 'validate', 'val_ip', 'patch-val_ip.sql' ), |
50 | 51 | array( 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ), |
| 52 | + array( 'interwiki', 'iw_trans', 'patch-interwiki-trans.sql' ), |
51 | 53 | ); |
52 | 54 | |
53 | 55 | function rename_table( $from, $to, $patch ) { |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | |
10 | 10 | /** */ |
11 | 11 | require_once( 'Sanitizer.php' ); |
| 12 | +require_once( 'HttpFunctions.php' ); |
12 | 13 | |
13 | 14 | /** |
14 | 15 | * Update this version number when the ParserOutput format |
— | — | @@ -63,7 +64,7 @@ |
64 | 65 | |
65 | 66 | /** |
66 | 67 | * PHP Parser |
67 | | - * |
| 68 | + * |
68 | 69 | * Processes wiki markup |
69 | 70 | * |
70 | 71 | * <pre> |
— | — | @@ -110,11 +111,13 @@ |
111 | 112 | $mTemplatePath; // stores an unsorted hash of all the templates already loaded |
112 | 113 | // in this path. Used for loop detection. |
113 | 114 | |
| 115 | + var $mIWTransData = array(); |
| 116 | + |
114 | 117 | /**#@-*/ |
115 | 118 | |
116 | 119 | /** |
117 | 120 | * Constructor |
118 | | - * |
| 121 | + * |
119 | 122 | * @access public |
120 | 123 | */ |
121 | 124 | function Parser() { |
— | — | @@ -179,11 +182,11 @@ |
180 | 183 | $this->mOutputType = OT_HTML; |
181 | 184 | |
182 | 185 | $this->mStripState = NULL; |
183 | | - |
| 186 | + |
184 | 187 | //$text = $this->strip( $text, $this->mStripState ); |
185 | 188 | // VOODOO MAGIC FIX! Sometimes the above segfaults in PHP5. |
186 | 189 | $x =& $this->mStripState; |
187 | | - |
| 190 | + |
188 | 191 | wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$x ) ); |
189 | 192 | $text = $this->strip( $text, $x ); |
190 | 193 | wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) ); |
— | — | @@ -191,7 +194,7 @@ |
192 | 195 | $text = $this->internalParse( $text ); |
193 | 196 | |
194 | 197 | $text = $this->unstrip( $text, $this->mStripState ); |
195 | | - |
| 198 | + |
196 | 199 | # Clean up special characters, only run once, next-to-last before doBlockLevels |
197 | 200 | $fixtags = array( |
198 | 201 | # french spaces, last one Guillemet-left |
— | — | @@ -203,14 +206,14 @@ |
204 | 207 | '/<\\/center *>/i' => '</div>', |
205 | 208 | ); |
206 | 209 | $text = preg_replace( array_keys($fixtags), array_values($fixtags), $text ); |
207 | | - |
| 210 | + |
208 | 211 | # only once and last |
209 | 212 | $text = $this->doBlockLevels( $text, $linestart ); |
210 | 213 | |
211 | 214 | $this->replaceLinkHolders( $text ); |
212 | 215 | |
213 | | - # the position of the convert() call should not be changed. it |
214 | | - # assumes that the links are all replaces and the only thing left |
| 216 | + # the position of the convert() call should not be changed. it |
| 217 | + # assumes that the links are all replaces and the only thing left |
215 | 218 | # is the <nowiki> mark. |
216 | 219 | $text = $wgContLang->convert($text); |
217 | 220 | $this->mOutput->setTitleText($wgContLang->getParsedTitle()); |
— | — | @@ -218,7 +221,7 @@ |
219 | 222 | $text = $this->unstripNoWiki( $text, $this->mStripState ); |
220 | 223 | |
221 | 224 | wfRunHooks( 'ParserBeforeTidy', array( &$this, &$text ) ); |
222 | | - |
| 225 | + |
223 | 226 | $text = Sanitizer::normalizeCharReferences( $text ); |
224 | 227 | global $wgUseTidy; |
225 | 228 | if ($wgUseTidy) { |
— | — | @@ -242,12 +245,12 @@ |
243 | 246 | return dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff)); |
244 | 247 | } |
245 | 248 | |
246 | | - /** |
| 249 | + /** |
247 | 250 | * Replaces all occurrences of <$tag>content</$tag> in the text |
248 | 251 | * with a random marker and returns the new text. the output parameter |
249 | 252 | * $content will be an associative array filled with data on the form |
250 | 253 | * $unique_marker => content. |
251 | | - * |
| 254 | + * |
252 | 255 | * If $content is already set, the additional entries will be appended |
253 | 256 | * If $tag is set to STRIP_COMMENTS, the function will extract |
254 | 257 | * <!-- HTML comments --> |
— | — | @@ -262,11 +265,11 @@ |
263 | 266 | } |
264 | 267 | $n = 1; |
265 | 268 | $stripped = ''; |
266 | | - |
| 269 | + |
267 | 270 | if ( !$tags ) { |
268 | 271 | $tags = array( ); |
269 | 272 | } |
270 | | - |
| 273 | + |
271 | 274 | if ( !$params ) { |
272 | 275 | $params = array( ); |
273 | 276 | } |
— | — | @@ -287,13 +290,13 @@ |
288 | 291 | } |
289 | 292 | $attributes = $p[1]; |
290 | 293 | $inside = $p[2]; |
291 | | - |
| 294 | + |
292 | 295 | $marker = $rnd . sprintf('%08X', $n++); |
293 | 296 | $stripped .= $marker; |
294 | | - |
| 297 | + |
295 | 298 | $tags[$marker] = "<$tag$attributes>"; |
296 | 299 | $params[$marker] = Sanitizer::decodeTagAttributes( $attributes ); |
297 | | - |
| 300 | + |
298 | 301 | $q = preg_split( $end, $inside, 2 ); |
299 | 302 | $content[$marker] = $q[0]; |
300 | 303 | if( count( $q ) < 1 ) { |
— | — | @@ -317,11 +320,11 @@ |
318 | 321 | function extractTags( $tag, $text, &$content, $uniq_prefix = '' ) { |
319 | 322 | $dummy_tags = array(); |
320 | 323 | $dummy_params = array(); |
321 | | - |
| 324 | + |
322 | 325 | return Parser::extractTagsAndParams( $tag, $text, $content, |
323 | 326 | $dummy_tags, $dummy_params, $uniq_prefix ); |
324 | 327 | } |
325 | | - |
| 328 | + |
326 | 329 | /** |
327 | 330 | * Strips and renders nowiki, pre, math, hiero |
328 | 331 | * If $render is set, performs necessary rendering operations on plugins |
— | — | @@ -555,7 +558,7 @@ |
556 | 559 | } |
557 | 560 | return $correctedtext; |
558 | 561 | } |
559 | | - |
| 562 | + |
560 | 563 | /** |
561 | 564 | * Spawn an external HTML tidy process and get corrected markup back from it. |
562 | 565 | * |
— | — | @@ -612,7 +615,7 @@ |
613 | 616 | global $wgTidyConf; |
614 | 617 | $fname = 'Parser::internalTidy'; |
615 | 618 | wfProfileIn( $fname ); |
616 | | - |
| 619 | + |
617 | 620 | tidy_load_config( $wgTidyConf ); |
618 | 621 | tidy_set_encoding( 'utf8' ); |
619 | 622 | tidy_parse_string( $text ); |
— | — | @@ -764,20 +767,28 @@ |
765 | 768 | } |
766 | 769 | $text = $this->doAllQuotes( $text ); |
767 | 770 | $text = $this->replaceInternalLinks( $text ); |
768 | | - $text = $this->replaceExternalLinks( $text ); |
769 | | - |
| 771 | + $text = $this->replaceExternalLinks( $text ); |
| 772 | + |
770 | 773 | # replaceInternalLinks may sometimes leave behind |
771 | 774 | # absolute URLs, which have to be masked to hide them from replaceExternalLinks |
772 | 775 | $text = str_replace("http-noparse://","http://",$text); |
773 | | - |
| 776 | + |
774 | 777 | $text = $this->doMagicLinks( $text ); |
775 | 778 | $text = $this->doTableStuff( $text ); |
776 | 779 | $text = $this->formatHeadings( $text, $isMain ); |
777 | 780 | |
| 781 | + $regex = '/<!--IW_TRANSCLUDE (\d+)-->/'; |
| 782 | + $text = preg_replace_callback($regex, array(&$this, 'scarySubstitution'), $text); |
| 783 | + |
778 | 784 | wfProfileOut( $fname ); |
779 | 785 | return $text; |
780 | 786 | } |
781 | 787 | |
| 788 | + function scarySubstitution($matches) { |
| 789 | +# return "[[".$matches[0]."]]"; |
| 790 | + return $this->mIWTransData[(int)$matches[0]]; |
| 791 | + } |
| 792 | + |
782 | 793 | /** |
783 | 794 | * Replace special strings like "ISBN xxx" and "RFC xxx" with |
784 | 795 | * magic external links. |
— | — | @@ -1018,7 +1029,7 @@ |
1019 | 1030 | wfProfileIn( $fname ); |
1020 | 1031 | |
1021 | 1032 | $sk =& $this->mOptions->getSkin(); |
1022 | | - |
| 1033 | + |
1023 | 1034 | $bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); |
1024 | 1035 | |
1025 | 1036 | $s = $this->replaceFreeExternalLinks( array_shift( $bits ) ); |
— | — | @@ -1098,7 +1109,7 @@ |
1099 | 1110 | global $wgContLang; |
1100 | 1111 | $fname = 'Parser::replaceFreeExternalLinks'; |
1101 | 1112 | wfProfileIn( $fname ); |
1102 | | - |
| 1113 | + |
1103 | 1114 | $bits = preg_split( '/(\b(?:'.URL_PROTOCOLS.'):)/S', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); |
1104 | 1115 | $s = array_shift( $bits ); |
1105 | 1116 | $i = 0; |
— | — | @@ -1170,7 +1181,7 @@ |
1171 | 1182 | } |
1172 | 1183 | return $text; |
1173 | 1184 | } |
1174 | | - |
| 1185 | + |
1175 | 1186 | /** |
1176 | 1187 | * Process [[ ]] wikilinks |
1177 | 1188 | * |
— | — | @@ -1186,7 +1197,7 @@ |
1187 | 1198 | static $tc = FALSE; |
1188 | 1199 | # the % is needed to support urlencoded titles as well |
1189 | 1200 | if ( !$tc ) { $tc = Title::legalChars() . '#%'; } |
1190 | | - |
| 1201 | + |
1191 | 1202 | $sk =& $this->mOptions->getSkin(); |
1192 | 1203 | |
1193 | 1204 | #split the entire text string on occurences of [[ |
— | — | @@ -1228,7 +1239,7 @@ |
1229 | 1240 | |
1230 | 1241 | $checkVariantLink = sizeof($wgContLang->getVariants())>1; |
1231 | 1242 | $useSubpages = $this->areSubpagesAllowed(); |
1232 | | - |
| 1243 | + |
1233 | 1244 | # Loop for each link |
1234 | 1245 | for ($k = 0; isset( $a[$k] ); $k++) { |
1235 | 1246 | $line = $a[$k]; |
— | — | @@ -1249,7 +1260,7 @@ |
1250 | 1261 | } |
1251 | 1262 | |
1252 | 1263 | $might_be_img = false; |
1253 | | - |
| 1264 | + |
1254 | 1265 | if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt |
1255 | 1266 | $text = $m[2]; |
1256 | 1267 | # If we get a ] at the beginning of $m[3] that means we have a link that's something like: |
— | — | @@ -1297,7 +1308,7 @@ |
1298 | 1309 | # Strip off leading ':' |
1299 | 1310 | $link = substr($link, 1); |
1300 | 1311 | } |
1301 | | - |
| 1312 | + |
1302 | 1313 | $nt =& Title::newFromText( $this->unstripNoWiki($link, $this->mStripState) ); |
1303 | 1314 | if( !$nt ) { |
1304 | 1315 | $s .= $prefix . '[[' . $line; |
— | — | @@ -1313,7 +1324,7 @@ |
1314 | 1325 | |
1315 | 1326 | $ns = $nt->getNamespace(); |
1316 | 1327 | $iw = $nt->getInterWiki(); |
1317 | | - |
| 1328 | + |
1318 | 1329 | if ($might_be_img) { # if this is actually an invalid link |
1319 | 1330 | if ($ns == NS_IMAGE && $noforce) { #but might be an image |
1320 | 1331 | $found = false; |
— | — | @@ -1353,7 +1364,7 @@ |
1354 | 1365 | $wasblank = ( '' == $text ); |
1355 | 1366 | if( $wasblank ) $text = $link; |
1356 | 1367 | |
1357 | | - |
| 1368 | + |
1358 | 1369 | # Link not escaped by : , create the various objects |
1359 | 1370 | if( $noforce ) { |
1360 | 1371 | |
— | — | @@ -1364,7 +1375,7 @@ |
1365 | 1376 | $s .= trim($prefix . $trail, "\n") == '' ? '': $prefix . $trail; |
1366 | 1377 | continue; |
1367 | 1378 | } |
1368 | | - |
| 1379 | + |
1369 | 1380 | if ( $ns == NS_IMAGE ) { |
1370 | 1381 | wfProfileIn( "$fname-image" ); |
1371 | 1382 | if ( !wfIsBadImage( $nt->getDBkey() ) ) { |
— | — | @@ -1373,18 +1384,18 @@ |
1374 | 1385 | # but it might be hard to fix that, and it doesn't matter ATM |
1375 | 1386 | $text = $this->replaceExternalLinks($text); |
1376 | 1387 | $text = $this->replaceInternalLinks($text); |
1377 | | - |
| 1388 | + |
1378 | 1389 | # cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them |
1379 | 1390 | $s .= $prefix . str_replace('http://', 'http-noparse://', $this->makeImage( $nt, $text ) ) . $trail; |
1380 | 1391 | $wgLinkCache->addImageLinkObj( $nt ); |
1381 | | - |
| 1392 | + |
1382 | 1393 | wfProfileOut( "$fname-image" ); |
1383 | 1394 | continue; |
1384 | 1395 | } |
1385 | 1396 | wfProfileOut( "$fname-image" ); |
1386 | 1397 | |
1387 | 1398 | } |
1388 | | - |
| 1399 | + |
1389 | 1400 | if ( $ns == NS_CATEGORY ) { |
1390 | 1401 | wfProfileIn( "$fname-category" ); |
1391 | 1402 | $t = $wgContLang->convertHtml( $nt->getText() ); |
— | — | @@ -1406,13 +1417,13 @@ |
1407 | 1418 | $sortkey = $wgContLang->convertCategoryKey( $sortkey ); |
1408 | 1419 | $wgLinkCache->addCategoryLinkObj( $nt, $sortkey ); |
1409 | 1420 | $this->mOutput->addCategoryLink( $t ); |
1410 | | - |
| 1421 | + |
1411 | 1422 | /** |
1412 | 1423 | * Strip the whitespace Category links produce, see bug 87 |
1413 | 1424 | * @todo We might want to use trim($tmp, "\n") here. |
1414 | 1425 | */ |
1415 | 1426 | $s .= trim($prefix . $trail, "\n") == '' ? '': $prefix . $trail; |
1416 | | - |
| 1427 | + |
1417 | 1428 | wfProfileOut( "$fname-category" ); |
1418 | 1429 | continue; |
1419 | 1430 | } |
— | — | @@ -1445,7 +1456,7 @@ |
1446 | 1457 | } else { |
1447 | 1458 | /** |
1448 | 1459 | * Add a link placeholder |
1449 | | - * Later, this will be replaced by a real link, after the existence or |
| 1460 | + * Later, this will be replaced by a real link, after the existence or |
1450 | 1461 | * non-existence of all the links is known |
1451 | 1462 | */ |
1452 | 1463 | $s .= $this->makeLinkHolder( $nt, $text, '', $trail, $prefix ); |
— | — | @@ -1457,8 +1468,8 @@ |
1458 | 1469 | |
1459 | 1470 | /** |
1460 | 1471 | * Make a link placeholder. The text returned can be later resolved to a real link with |
1461 | | - * replaceLinkHolders(). This is done for two reasons: firstly to avoid further |
1462 | | - * parsing of interwiki links, and secondly to allow all extistence checks and |
| 1472 | + * replaceLinkHolders(). This is done for two reasons: firstly to avoid further |
| 1473 | + * parsing of interwiki links, and secondly to allow all extistence checks and |
1463 | 1474 | * article length checks (for stub links) to be bundled into a single query. |
1464 | 1475 | * |
1465 | 1476 | */ |
— | — | @@ -1469,7 +1480,7 @@ |
1470 | 1481 | } else { |
1471 | 1482 | # Separate the link trail from the rest of the link |
1472 | 1483 | list( $inside, $trail ) = Linker::splitTrail( $trail ); |
1473 | | - |
| 1484 | + |
1474 | 1485 | if ( $nt->isExternal() ) { |
1475 | 1486 | $nr = array_push( $this->mInterwikiLinkHolders['texts'], $prefix.$text.$inside ); |
1476 | 1487 | $this->mInterwikiLinkHolders['titles'][] = $nt; |
— | — | @@ -1496,7 +1507,7 @@ |
1497 | 1508 | global $wgNamespacesWithSubpages; |
1498 | 1509 | return !empty($wgNamespacesWithSubpages[$this->mTitle->getNamespace()]); |
1499 | 1510 | } |
1500 | | - |
| 1511 | + |
1501 | 1512 | /** |
1502 | 1513 | * Handle link to subpage if necessary |
1503 | 1514 | * @param string $target the source of the link |
— | — | @@ -1516,10 +1527,10 @@ |
1517 | 1528 | $fname = 'Parser::maybeDoSubpageLink'; |
1518 | 1529 | wfProfileIn( $fname ); |
1519 | 1530 | $ret = $target; # default return value is no change |
1520 | | - |
1521 | | - # Some namespaces don't allow subpages, |
| 1531 | + |
| 1532 | + # Some namespaces don't allow subpages, |
1522 | 1533 | # so only perform processing if subpages are allowed |
1523 | | - if( $this->areSubpagesAllowed() ) { |
| 1534 | + if( $this->areSubpagesAllowed() ) { |
1524 | 1535 | # Look at the first character |
1525 | 1536 | if( $target != '' && $target{0} == '/' ) { |
1526 | 1537 | # / at end means we don't want the slash to be shown |
— | — | @@ -1529,7 +1540,7 @@ |
1530 | 1541 | } else { |
1531 | 1542 | $noslash = substr( $target, 1 ); |
1532 | 1543 | } |
1533 | | - |
| 1544 | + |
1534 | 1545 | $ret = $this->mTitle->getPrefixedText(). '/' . trim($noslash); |
1535 | 1546 | if( '' === $text ) { |
1536 | 1547 | $text = $target; |
— | — | @@ -1853,14 +1864,14 @@ |
1854 | 1865 | */ |
1855 | 1866 | function getVariableValue( $index ) { |
1856 | 1867 | global $wgContLang, $wgSitename, $wgServer, $wgServerName, $wgArticle, $wgScriptPath; |
1857 | | - |
| 1868 | + |
1858 | 1869 | /** |
1859 | 1870 | * Some of these require message or data lookups and can be |
1860 | 1871 | * expensive to check many times. |
1861 | 1872 | */ |
1862 | 1873 | static $varCache = array(); |
1863 | 1874 | if( isset( $varCache[$index] ) ) return $varCache[$index]; |
1864 | | - |
| 1875 | + |
1865 | 1876 | switch ( $index ) { |
1866 | 1877 | case MAG_CURRENTMONTH: |
1867 | 1878 | return $varCache[$index] = $wgContLang->formatNum( date( 'm' ) ); |
— | — | @@ -1934,7 +1945,7 @@ |
1935 | 1946 | * OT_WIKI: only {{subst:}} templates |
1936 | 1947 | * OT_MSG: only magic variables |
1937 | 1948 | * OT_HTML: all templates and magic variables |
1938 | | - * |
| 1949 | + * |
1939 | 1950 | * @param string $tex The text to transform |
1940 | 1951 | * @param array $args Key-value pairs representing template parameters to substitute |
1941 | 1952 | * @access private |
— | — | @@ -1956,7 +1967,7 @@ |
1957 | 1968 | |
1958 | 1969 | # Variable substitution |
1959 | 1970 | $text = preg_replace_callback( "/{{([$titleChars]*?)}}/", array( &$this, 'variableSubstitution' ), $text ); |
1960 | | - |
| 1971 | + |
1961 | 1972 | if ( $this->mOutputType == OT_HTML || $this->mOutputType == OT_WIKI ) { |
1962 | 1973 | # Argument substitution |
1963 | 1974 | $text = preg_replace_callback( "/{{{([$titleChars]*?)}}}/", array( &$this, 'argSubstitution' ), $text ); |
— | — | @@ -2015,7 +2026,7 @@ |
2016 | 2027 | # merged with the next arg because the '|' character between belongs |
2017 | 2028 | # to the link syntax and not the template parameter syntax. |
2018 | 2029 | $argc = count($args); |
2019 | | - |
| 2030 | + |
2020 | 2031 | for ( $i = 0; $i < $argc-1; $i++ ) { |
2021 | 2032 | if ( substr_count ( $args[$i], '[[' ) != substr_count ( $args[$i], ']]' ) ) { |
2022 | 2033 | $args[$i] .= '|'.$args[$i+1]; |
— | — | @@ -2042,7 +2053,7 @@ |
2043 | 2054 | global $wgLinkCache, $wgContLang; |
2044 | 2055 | $fname = 'Parser::braceSubstitution'; |
2045 | 2056 | wfProfileIn( $fname ); |
2046 | | - |
| 2057 | + |
2047 | 2058 | $found = false; |
2048 | 2059 | $nowiki = false; |
2049 | 2060 | $noparse = false; |
— | — | @@ -2191,6 +2202,12 @@ |
2192 | 2203 | $ns = $this->mTitle->getNamespace(); |
2193 | 2204 | } |
2194 | 2205 | $title = Title::newFromText( $part1, $ns ); |
| 2206 | + |
| 2207 | + $interwiki = Title::getInterwikiLink($title->getInterwiki()); |
| 2208 | + if ($interwiki != '' && $title->isTrans()) { |
| 2209 | + return $this->scarytransclude($title, $interwiki); |
| 2210 | + } |
| 2211 | + |
2195 | 2212 | if ( !is_null( $title ) && !$title->isExternal() ) { |
2196 | 2213 | # Check for excessive inclusion |
2197 | 2214 | $dbk = $title->getPrefixedDBkey(); |
— | — | @@ -2275,14 +2292,14 @@ |
2276 | 2293 | } |
2277 | 2294 | # Prune lower levels off the recursion check path |
2278 | 2295 | $this->mTemplatePath = $lastPathLevel; |
2279 | | - |
| 2296 | + |
2280 | 2297 | if ( !$found ) { |
2281 | 2298 | wfProfileOut( $fname ); |
2282 | 2299 | return $matches[0]; |
2283 | 2300 | } else { |
2284 | 2301 | if ( $isHTML ) { |
2285 | 2302 | # Replace raw HTML by a placeholder |
2286 | | - # Add a blank line preceding, to prevent it from mucking up |
| 2303 | + # Add a blank line preceding, to prevent it from mucking up |
2287 | 2304 | # immediately preceding headings |
2288 | 2305 | $text = "\n\n" . $this->insertStripItem( $text, $this->mStripState ); |
2289 | 2306 | } else { |
— | — | @@ -2308,16 +2325,16 @@ |
2309 | 2326 | preg_match('/^(={1,6})(.*?)(={1,6})\s*?$/m', $hl, $m2); |
2310 | 2327 | $text .= $m2[1] . $m2[2] . "<!--MWTEMPLATESECTION=" |
2311 | 2328 | . $encodedname . "&" . base64_encode("$nsec") . "-->" . $m2[3]; |
2312 | | - |
| 2329 | + |
2313 | 2330 | $nsec++; |
2314 | 2331 | } |
2315 | 2332 | } |
2316 | 2333 | } |
2317 | 2334 | } |
2318 | | - |
| 2335 | + |
2319 | 2336 | # Prune lower levels off the recursion check path |
2320 | 2337 | $this->mTemplatePath = $lastPathLevel; |
2321 | | - |
| 2338 | + |
2322 | 2339 | if ( !$found ) { |
2323 | 2340 | wfProfileOut( $fname ); |
2324 | 2341 | return $matches[0]; |
— | — | @@ -2328,6 +2345,47 @@ |
2329 | 2346 | } |
2330 | 2347 | |
2331 | 2348 | /** |
| 2349 | + * Translude an interwiki link. |
| 2350 | + */ |
| 2351 | + function scarytransclude($title, $interwiki) { |
| 2352 | + global $wgEnableScaryTranscluding; |
| 2353 | + |
| 2354 | + if (!$wgEnableScaryTranscluding) |
| 2355 | + return wfMsg('scarytranscludedisabled'); |
| 2356 | + |
| 2357 | + $articlename = "Template:" . $title->getDBkey(); |
| 2358 | + $url = str_replace('$1', urlencode($articlename), $interwiki); |
| 2359 | + $text = $this->fetchScaryTemplateMaybeFromCache($url); |
| 2360 | + $this->mIWTransData[] = $text; |
| 2361 | + return "<!--IW_TRANSCLUDE ".(count($this->mIWTransData) - 1)."-->"; |
| 2362 | + } |
| 2363 | + |
| 2364 | + function fetchScaryTemplateMaybeFromCache($url) { |
| 2365 | + $dbr = wfGetDB(DB_SLAVE); |
| 2366 | + $obj = $dbr->selectRow('transcache', array('tc_time', 'tc_contents'), |
| 2367 | + array('tc_url' => $url)); |
| 2368 | + if ($obj) { |
| 2369 | + $time = $obj->tc_time; |
| 2370 | + $text = $obj->tc_contents; |
| 2371 | + if ($time && $time < (time() + (60*60))) { |
| 2372 | + return $text; |
| 2373 | + } |
| 2374 | + } |
| 2375 | + |
| 2376 | + $text = wfGetHTTP($url . '?action=render'); |
| 2377 | + if (!$text) |
| 2378 | + return wfMsg('scarytranscludefailed'); |
| 2379 | + |
| 2380 | + $dbw = wfGetDB(DB_MASTER); |
| 2381 | + $dbw->replace('transcache', array(), array( |
| 2382 | + 'tc_url' => $url, |
| 2383 | + 'tc_time' => time(), |
| 2384 | + 'tc_contents' => $text)); |
| 2385 | + return $text; |
| 2386 | + } |
| 2387 | + |
| 2388 | + |
| 2389 | + /** |
2332 | 2390 | * Triple brace replacement -- used for template arguments |
2333 | 2391 | * @access private |
2334 | 2392 | */ |
— | — | @@ -2364,10 +2422,10 @@ |
2365 | 2423 | * 2) Add an [edit] link to sections for logged in users who have enabled the option |
2366 | 2424 | * 3) Add a Table of contents on the top for users who have enabled the option |
2367 | 2425 | * 4) Auto-anchor headings |
2368 | | - * |
| 2426 | + * |
2369 | 2427 | * It loops through all headlines, collects the necessary data, then splits up the |
2370 | 2428 | * string and re-inserts the newly formatted headlines. |
2371 | | - * |
| 2429 | + * |
2372 | 2430 | * @param string $text |
2373 | 2431 | * @param boolean $isMain |
2374 | 2432 | * @access private |
— | — | @@ -2464,9 +2522,9 @@ |
2465 | 2523 | $prevtoclevel = $toclevel; |
2466 | 2524 | } |
2467 | 2525 | $level = $matches[1][$headlineCount]; |
2468 | | - |
| 2526 | + |
2469 | 2527 | if( $doNumberHeadings || $doShowToc ) { |
2470 | | - |
| 2528 | + |
2471 | 2529 | if ( $level > $prevlevel ) { |
2472 | 2530 | # Increase TOC level |
2473 | 2531 | $toclevel++; |
— | — | @@ -2500,7 +2558,7 @@ |
2501 | 2559 | # No change in level, end TOC line |
2502 | 2560 | $toc .= $sk->tocLineEnd(); |
2503 | 2561 | } |
2504 | | - |
| 2562 | + |
2505 | 2563 | $levelCount[$toclevel] = $level; |
2506 | 2564 | |
2507 | 2565 | # count number of headlines for each level |
— | — | @@ -2524,7 +2582,7 @@ |
2525 | 2583 | |
2526 | 2584 | # Remove link placeholders by the link text. |
2527 | 2585 | # <!--LINK number--> |
2528 | | - # turns into |
| 2586 | + # turns into |
2529 | 2587 | # link text with suffix |
2530 | 2588 | $canonized_headline = preg_replace( '/<!--LINK ([0-9]*)-->/e', |
2531 | 2589 | "\$this->mLinkHolders['texts'][\$1]", |
— | — | @@ -2676,7 +2734,7 @@ |
2677 | 2735 | * @return string |
2678 | 2736 | */ |
2679 | 2737 | function magicRFC( $text, $keyword='RFC ', $urlmsg='rfcurl' ) { |
2680 | | - |
| 2738 | + |
2681 | 2739 | $valid = '0123456789'; |
2682 | 2740 | $internal = false; |
2683 | 2741 | |
— | — | @@ -2685,7 +2743,7 @@ |
2686 | 2744 | return $text; |
2687 | 2745 | } |
2688 | 2746 | $text = substr( array_shift( $a ), 1); |
2689 | | - |
| 2747 | + |
2690 | 2748 | /* Check if keyword is preceed by [[. |
2691 | 2749 | * This test is made here cause of the array_shift above |
2692 | 2750 | * that prevent the test to be done in the foreach. |
— | — | @@ -2728,7 +2786,7 @@ |
2729 | 2787 | $la = $sk->getExternalLinkAttributes( $url, $keyword.$id ); |
2730 | 2788 | $text .= "<a href='{$url}'{$la}>{$keyword}{$id}</a>{$x}"; |
2731 | 2789 | } |
2732 | | - |
| 2790 | + |
2733 | 2791 | /* Check if the next RFC keyword is preceed by [[ */ |
2734 | 2792 | $internal = ( substr($x,-2) == '[[' ); |
2735 | 2793 | } |
— | — | @@ -2861,7 +2919,7 @@ |
2862 | 2920 | |
2863 | 2921 | /** |
2864 | 2922 | * Transform a MediaWiki message by replacing magic variables. |
2865 | | - * |
| 2923 | + * |
2866 | 2924 | * @param string $text the text to transform |
2867 | 2925 | * @param ParserOptions $options options |
2868 | 2926 | * @return string the text with variables substituted |
— | — | @@ -2918,16 +2976,16 @@ |
2919 | 2977 | $pdbks = array(); |
2920 | 2978 | $colours = array(); |
2921 | 2979 | $sk = $this->mOptions->getSkin(); |
2922 | | - |
| 2980 | + |
2923 | 2981 | if ( !empty( $this->mLinkHolders['namespaces'] ) ) { |
2924 | 2982 | wfProfileIn( $fname.'-check' ); |
2925 | 2983 | $dbr =& wfGetDB( DB_SLAVE ); |
2926 | 2984 | $page = $dbr->tableName( 'page' ); |
2927 | 2985 | $threshold = $wgUser->getOption('stubthreshold'); |
2928 | | - |
| 2986 | + |
2929 | 2987 | # Sort by namespace |
2930 | 2988 | asort( $this->mLinkHolders['namespaces'] ); |
2931 | | - |
| 2989 | + |
2932 | 2990 | # Generate query |
2933 | 2991 | $query = false; |
2934 | 2992 | foreach ( $this->mLinkHolders['namespaces'] as $key => $val ) { |
— | — | @@ -2961,7 +3019,7 @@ |
2962 | 3020 | } else { |
2963 | 3021 | $query .= ', '; |
2964 | 3022 | } |
2965 | | - |
| 3023 | + |
2966 | 3024 | $query .= $dbr->addQuotes( $this->mLinkHolders['dbkeys'][$key] ); |
2967 | 3025 | } |
2968 | 3026 | } |
— | — | @@ -2970,9 +3028,9 @@ |
2971 | 3029 | if ( $options & RLH_FOR_UPDATE ) { |
2972 | 3030 | $query .= ' FOR UPDATE'; |
2973 | 3031 | } |
2974 | | - |
| 3032 | + |
2975 | 3033 | $res = $dbr->query( $query, $fname ); |
2976 | | - |
| 3034 | + |
2977 | 3035 | # Fetch data and form into an associative array |
2978 | 3036 | # non-existent = broken |
2979 | 3037 | # 1 = known |
— | — | @@ -2981,7 +3039,7 @@ |
2982 | 3040 | $title = Title::makeTitle( $s->page_namespace, $s->page_title ); |
2983 | 3041 | $pdbk = $title->getPrefixedDBkey(); |
2984 | 3042 | $wgLinkCache->addGoodLinkObj( $s->page_id, $title ); |
2985 | | - |
| 3043 | + |
2986 | 3044 | if ( $threshold > 0 ) { |
2987 | 3045 | $size = $s->page_len; |
2988 | 3046 | if ( $s->page_is_redirect || $s->page_namespace != 0 || $size >= $threshold ) { |
— | — | @@ -2995,7 +3053,7 @@ |
2996 | 3054 | } |
2997 | 3055 | } |
2998 | 3056 | wfProfileOut( $fname.'-check' ); |
2999 | | - |
| 3057 | + |
3000 | 3058 | # Construct search and replace arrays |
3001 | 3059 | wfProfileIn( $fname.'-construct' ); |
3002 | 3060 | $wgOutputReplace = array(); |
— | — | @@ -3023,7 +3081,7 @@ |
3024 | 3082 | |
3025 | 3083 | # Do the thing |
3026 | 3084 | wfProfileIn( $fname.'-replace' ); |
3027 | | - |
| 3085 | + |
3028 | 3086 | $text = preg_replace_callback( |
3029 | 3087 | '/(<!--LINK .*?-->)/', |
3030 | 3088 | "wfOutputReplaceMatches", |
— | — | @@ -3042,18 +3100,18 @@ |
3043 | 3101 | $title = $this->mInterwikiLinkHolders['titles'][$key]; |
3044 | 3102 | $wgOutputReplace[$key] = $sk->makeLinkObj( $title, $link ); |
3045 | 3103 | } |
3046 | | - |
| 3104 | + |
3047 | 3105 | $text = preg_replace_callback( |
3048 | 3106 | '/<!--IWLINK (.*?)-->/', |
3049 | 3107 | "wfOutputReplaceMatches", |
3050 | 3108 | $text ); |
3051 | 3109 | wfProfileOut( $fname.'-interwiki' ); |
3052 | 3110 | } |
3053 | | - |
| 3111 | + |
3054 | 3112 | wfProfileOut( $fname ); |
3055 | 3113 | return $colours; |
3056 | 3114 | } |
3057 | | - |
| 3115 | + |
3058 | 3116 | /** |
3059 | 3117 | * Replace <!--LINK--> link placeholders with plain text of links |
3060 | 3118 | * (not HTML-formatted). |
— | — | @@ -3071,11 +3129,11 @@ |
3072 | 3130 | '/<!--(LINK|IWLINK) (.*?)-->/', |
3073 | 3131 | array( &$this, 'replaceLinkHoldersTextCallback' ), |
3074 | 3132 | $text ); |
3075 | | - |
| 3133 | + |
3076 | 3134 | wfProfileOut( $fname ); |
3077 | 3135 | return $text; |
3078 | 3136 | } |
3079 | | - |
| 3137 | + |
3080 | 3138 | /** |
3081 | 3139 | * @param array $matches |
3082 | 3140 | * @return string |
— | — | @@ -3112,7 +3170,7 @@ |
3113 | 3171 | global $wgUser, $wgTitle; |
3114 | 3172 | $parserOptions = ParserOptions::newFromUser( $wgUser ); |
3115 | 3173 | $localParser = new Parser(); |
3116 | | - |
| 3174 | + |
3117 | 3175 | global $wgLinkCache; |
3118 | 3176 | $ig = new ImageGallery(); |
3119 | 3177 | $ig->setShowBytes( false ); |
— | — | @@ -3137,10 +3195,10 @@ |
3138 | 3196 | } else { |
3139 | 3197 | $label = ''; |
3140 | 3198 | } |
3141 | | - |
| 3199 | + |
3142 | 3200 | $html = $localParser->parse( $label , $wgTitle, $parserOptions ); |
3143 | 3201 | $html = $html->mText; |
3144 | | - |
| 3202 | + |
3145 | 3203 | $ig->add( new Image( $nt ), $html ); |
3146 | 3204 | $wgLinkCache->addImageLinkObj( $nt ); |
3147 | 3205 | } |
— | — | @@ -3153,7 +3211,7 @@ |
3154 | 3212 | function makeImage( &$nt, $options ) { |
3155 | 3213 | global $wgContLang, $wgUseImageResize; |
3156 | 3214 | global $wgUser, $wgThumbLimits; |
3157 | | - |
| 3215 | + |
3158 | 3216 | $align = ''; |
3159 | 3217 | |
3160 | 3218 | # Check if the options text is of the form "options|alt text" |
— | — | @@ -3346,7 +3404,7 @@ |
3347 | 3405 | |
3348 | 3406 | /** Get user options */ |
3349 | 3407 | function initialiseFromUser( &$userInput ) { |
3350 | | - global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages, |
| 3408 | + global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages, |
3351 | 3409 | $wgAllowSpecialInclusion; |
3352 | 3410 | $fname = 'ParserOptions::initialiseFromUser'; |
3353 | 3411 | wfProfileIn( $fname ); |
— | — | @@ -3396,12 +3454,12 @@ |
3397 | 3455 | */ |
3398 | 3456 | function wfNumberOfFiles() { |
3399 | 3457 | $fname = 'Parser::wfNumberOfFiles'; |
3400 | | - |
| 3458 | + |
3401 | 3459 | wfProfileIn( $fname ); |
3402 | 3460 | $dbr =& wfGetDB( DB_SLAVE ); |
3403 | 3461 | $res = $dbr->selectField('image', 'COUNT(*)', array(), $fname ); |
3404 | 3462 | wfProfileOut( $fname ); |
3405 | | - |
| 3463 | + |
3406 | 3464 | return $res; |
3407 | 3465 | } |
3408 | 3466 | |
— | — | @@ -3432,7 +3490,7 @@ |
3433 | 3491 | /** |
3434 | 3492 | * Escape html tags |
3435 | 3493 | * Basicly replacing " > and < with HTML entities ( ", >, <) |
3436 | | - * |
| 3494 | + * |
3437 | 3495 | * @param string $in Text that might contain HTML tags |
3438 | 3496 | * @return string Escaped string |
3439 | 3497 | */ |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -385,7 +385,7 @@ |
386 | 386 | * @static (arguably) |
387 | 387 | * @access public |
388 | 388 | */ |
389 | | - function getInterwikiLink( $key ) { |
| 389 | + function getInterwikiLink( $key, $transludeonly = false ) { |
390 | 390 | global $wgMemc, $wgDBname, $wgInterwikiExpiry, $wgTitleInterwikiCache; |
391 | 391 | $fname = 'Title::getInterwikiLink'; |
392 | 392 | |
— | — | @@ -407,7 +407,7 @@ |
408 | 408 | |
409 | 409 | $dbr =& wfGetDB( DB_SLAVE ); |
410 | 410 | $res = $dbr->select( 'interwiki', |
411 | | - array( 'iw_url', 'iw_local' ), |
| 411 | + array( 'iw_url', 'iw_local', 'iw_trans' ), |
412 | 412 | array( 'iw_prefix' => $key ), $fname ); |
413 | 413 | if( !$res ) { |
414 | 414 | wfProfileOut( $fname ); |
— | — | @@ -420,6 +420,7 @@ |
421 | 421 | $s = (object)false; |
422 | 422 | $s->iw_url = ''; |
423 | 423 | $s->iw_local = 0; |
| 424 | + $s->iw_trans = 0; |
424 | 425 | } |
425 | 426 | $wgMemc->set( $k, $s, $wgInterwikiExpiry ); |
426 | 427 | $wgTitleInterwikiCache[$k] = $s; |
— | — | @@ -450,6 +451,24 @@ |
451 | 452 | } |
452 | 453 | |
453 | 454 | /** |
| 455 | + * Determine whether the object refers to a page within |
| 456 | + * this project and is transcludable. |
| 457 | + * |
| 458 | + * @return bool TRUE if this is transcludable |
| 459 | + * @access public |
| 460 | + */ |
| 461 | + function isTrans() { |
| 462 | + global $wgTitleInterwikiCache, $wgDBname; |
| 463 | + |
| 464 | + if ($this->mInterwiki == '' || !$this->isLocal()) |
| 465 | + return false; |
| 466 | + # Make sure key is loaded into cache |
| 467 | + $this->getInterwikiLink( $this->mInterwiki ); |
| 468 | + $k = $wgDBname.':interwiki:' . $this->mInterwiki; |
| 469 | + return (bool)($wgTitleInterwikiCache[$k]->iw_trans); |
| 470 | + } |
| 471 | + |
| 472 | + /** |
454 | 473 | * Update the page_touched field for an array of title objects |
455 | 474 | * @todo Inefficient unless the IDs are already loaded into the |
456 | 475 | * link cache |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1556,4 +1556,14 @@ |
1557 | 1557 | */ |
1558 | 1558 | $wgHTTPTimeout = 3; |
1559 | 1559 | |
| 1560 | +/** |
| 1561 | + * Proxy to use for CURL requests. |
| 1562 | + */ |
| 1563 | +$wgHTTPProxy = false; |
| 1564 | + |
| 1565 | +/** |
| 1566 | + * Enable interwiki transcluding. Only when iw_trans=1. |
| 1567 | + */ |
| 1568 | +$wgEnableScaryTransclude = false; |
| 1569 | + |
1560 | 1570 | ?> |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * if $timeout is 'default', $wgHTTPTimeout is used |
8 | 8 | */ |
9 | 9 | function wfGetHTTP( $url, $timeout = 'default' ) { |
10 | | - global $wgServer, $wgHTTPTimeout; |
| 10 | + global $wgServer, $wgHTTPTimeout, $wgHTTPProxy; |
11 | 11 | |
12 | 12 | |
13 | 13 | # Use curl if available |
— | — | @@ -14,7 +14,9 @@ |
15 | 15 | $c = curl_init( $url ); |
16 | 16 | if ( wfIsLocalURL( $url ) ) { |
17 | 17 | curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' ); |
18 | | - } |
| 18 | + } else if ($wgHTTPProxy) |
| 19 | + curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy); |
| 20 | + |
19 | 21 | if ( $timeout == 'default' ) { |
20 | 22 | $timeout = $wgHTTPTimeout; |
21 | 23 | } |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | MAG_NOCONTENTCONVERT => array( 0, '__NOCONTENTCONVERT__', '__NOCC__'), |
238 | 238 | MAG_CURRENTWEEK => array( 1, 'CURRENTWEEK' ), |
239 | 239 | MAG_CURRENTDOW => array( 1, 'CURRENTDOW' ), |
240 | | - MAG_REVISIONID => array( 1, 'REVISIONID' ), |
| 240 | + MAG_REVISIONID => array( 1, 'REVISIONID' ), |
241 | 241 | ); |
242 | 242 | |
243 | 243 | #------------------------------------------------------------------- |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | # The navigation toolbar, int: is used here to make sure that the appropriate |
256 | 256 | # messages are automatically pulled from the user-selected language file. |
257 | 257 | |
258 | | -/* |
| 258 | +/* |
259 | 259 | The sidebar for MonoBook is generated from this message, lines that do not |
260 | 260 | begin with * or ** are discarded, furthermore lines that do begin with ** and |
261 | 261 | do not contain | are also discarded, but don't depend on this behaviour for |
— | — | @@ -624,19 +624,19 @@ |
625 | 625 | 'passwordsent' => "A new password has been sent to the e-mail address |
626 | 626 | registered for \"$1\". |
627 | 627 | Please log in again after you receive it.", |
628 | | -'eauthentsent' => "A confirmation email has been sent to the nominated email address. |
629 | | -Before any other mail is sent to the account, you will have to follow the instructions in the email, |
| 628 | +'eauthentsent' => "A confirmation email has been sent to the nominated email address. |
| 629 | +Before any other mail is sent to the account, you will have to follow the instructions in the email, |
630 | 630 | to confirm that the account is actually yours.", |
631 | 631 | 'loginend' => ' ', |
632 | 632 | 'mailerror' => "Error sending mail: $1", |
633 | 633 | 'acct_creation_throttle_hit' => 'Sorry, you have already created $1 accounts. You can\'t make any more.', |
634 | 634 | 'emailauthenticated' => 'Your email address was authenticated on $1.', |
635 | | -'emailnotauthenticated' => 'Your email address is <strong>not yet authenticated</strong>. No email |
| 635 | +'emailnotauthenticated' => 'Your email address is <strong>not yet authenticated</strong>. No email |
636 | 636 | will be sent for any of the following features.', |
637 | | -'noemailprefs' => '<strong>No email address has been specified</strong>, the following |
| 637 | +'noemailprefs' => '<strong>No email address has been specified</strong>, the following |
638 | 638 | features will not work.', |
639 | 639 | 'emailconfirmlink' => 'Confirm your e-mail address', |
640 | | -'invalidemailaddress' => 'The email address cannot be accepted as it appears to have an invalid |
| 640 | +'invalidemailaddress' => 'The email address cannot be accepted as it appears to have an invalid |
641 | 641 | format. Please enter a well-formatted address or empty that field.', |
642 | 642 | |
643 | 643 | # Edit page toolbar |
— | — | @@ -828,7 +828,7 @@ |
829 | 829 | <input type="hidden" name="num" value="50" /> |
830 | 830 | <input type="hidden" name="ie" value="$2" /> |
831 | 831 | <input type="hidden" name="oe" value="$2" /> |
832 | | - |
| 832 | + |
833 | 833 | <input type="text" name="q" size="31" maxlength="255" value="$1" /> |
834 | 834 | <input type="submit" name="btnG" value="$3" /> |
835 | 835 | <div> |
— | — | @@ -908,8 +908,8 @@ |
909 | 909 | # group editing |
910 | 910 | 'groups-editgroup' => 'Edit group', |
911 | 911 | 'groups-addgroup' => 'Add group', |
912 | | -'groups-editgroup-preamble' => 'If the name or description starts with a colon, the |
913 | | -remainder will be treated as a message name, and hence the text will be localised |
| 912 | +'groups-editgroup-preamble' => 'If the name or description starts with a colon, the |
| 913 | +remainder will be treated as a message name, and hence the text will be localised |
914 | 914 | using the MediaWiki namespace', |
915 | 915 | 'groups-editgroup-name' => 'Group name: ', |
916 | 916 | 'groups-editgroup-description' => 'Group description (max 255 characters):<br />', |
— | — | @@ -933,7 +933,7 @@ |
934 | 934 | 'userrights-logcomment' => 'Changed group membership from $1 to $2', |
935 | 935 | |
936 | 936 | # Default group names and descriptions |
937 | | -# |
| 937 | +# |
938 | 938 | 'group-anon-name' => 'Anonymous', |
939 | 939 | 'group-anon-desc' => 'Anonymous users', |
940 | 940 | 'group-loggedin-name' => 'User', |
— | — | @@ -987,9 +987,9 @@ |
988 | 988 | 'uploaderror' => 'Upload error', |
989 | 989 | 'uploadtext' => |
990 | 990 | " |
991 | | -Use the form below to upload new files, |
| 991 | +Use the form below to upload new files, |
992 | 992 | to view or search previously uploaded images |
993 | | -go to the [[Special:Imagelist|list of uploaded files]], |
| 993 | +go to the [[Special:Imagelist|list of uploaded files]], |
994 | 994 | uploads and deletions are also logged in the [[Special:Log|project log]]. |
995 | 995 | |
996 | 996 | You must also check the box affirming that you are not |
— | — | @@ -997,7 +997,7 @@ |
998 | 998 | Press the \"Upload\" button to finish the upload. |
999 | 999 | |
1000 | 1000 | To include the image in a page, use a link in the form |
1001 | | -'''<nowiki>[[{{ns:6}}:file.jpg]]</nowiki>''', |
| 1001 | +'''<nowiki>[[{{ns:6}}:file.jpg]]</nowiki>''', |
1002 | 1002 | '''<nowiki>[[{{ns:6}}:file.png|alt text]]</nowiki>''' or |
1003 | 1003 | '''<nowiki>[[{{ns:-2}}:file.ogg]]</nowiki>''' for directly linking to the file. |
1004 | 1004 | ", |
— | — | @@ -1582,7 +1582,7 @@ |
1583 | 1583 | 'movereason' => 'Reason', |
1584 | 1584 | 'revertmove' => 'revert', |
1585 | 1585 | 'delete_and_move' => 'Delete and move', |
1586 | | -'delete_and_move_text' => |
| 1586 | +'delete_and_move_text' => |
1587 | 1587 | '==Deletion required== |
1588 | 1588 | |
1589 | 1589 | The destination article "[[$1]]" already exists. Do you want to delete it to make way for the move?', |
— | — | @@ -1776,7 +1776,7 @@ |
1777 | 1777 | 'newimages' => 'New images gallery', |
1778 | 1778 | 'noimages' => 'Nothing to see.', |
1779 | 1779 | |
1780 | | -# short names for language variants used for language conversion links. |
| 1780 | +# short names for language variants used for language conversion links. |
1781 | 1781 | # to disable showing a particular link, set it to 'disable', e.g. |
1782 | 1782 | # 'variantname-zh-sg' => 'disable', |
1783 | 1783 | 'variantname-zh-cn' => 'cn', |
— | — | @@ -2119,11 +2119,15 @@ |
2120 | 2120 | 'searchfulltext' => 'Search full text', |
2121 | 2121 | 'createarticle' => 'Create article', |
2122 | 2122 | |
| 2123 | +# Scary transclusion |
| 2124 | +'scarytranscludedisabled' => '[Interwiki transcluding is disabled]', |
| 2125 | +'scarytranscludefailed' => '[Template fetch failed; sorry]', |
| 2126 | + |
2123 | 2127 | ); |
2124 | 2128 | |
2125 | 2129 | /* a fake language converter */ |
2126 | 2130 | class fakeConverter { |
2127 | | - var $mLang; |
| 2131 | + var $mLang; |
2128 | 2132 | function fakeConverter($langobj) {$this->mLang = $langobj;} |
2129 | 2133 | function convert($t, $i) {return $t;} |
2130 | 2134 | function getVariants() { return array( strtolower( substr( get_class( $this->mLang ), 8 ) ) ); } |
— | — | @@ -2163,19 +2167,19 @@ |
2164 | 2168 | } |
2165 | 2169 | $this->mConverter = new fakeConverter($this); |
2166 | 2170 | } |
2167 | | - |
| 2171 | + |
2168 | 2172 | /** |
2169 | 2173 | * Exports the default user options as defined in |
2170 | 2174 | * $wgDefaultUserOptionsEn, user preferences can override some of these |
2171 | 2175 | * depending on what's in (Local|Default)Settings.php and some defines. |
2172 | | - * |
| 2176 | + * |
2173 | 2177 | * @return array |
2174 | 2178 | */ |
2175 | 2179 | function getDefaultUserOptions() { |
2176 | 2180 | global $wgDefaultUserOptionsEn ; |
2177 | 2181 | return $wgDefaultUserOptionsEn ; |
2178 | 2182 | } |
2179 | | - |
| 2183 | + |
2180 | 2184 | /** |
2181 | 2185 | * Exports $wgBookstoreListEn |
2182 | 2186 | * @return array |
— | — | @@ -2184,7 +2188,7 @@ |
2185 | 2189 | global $wgBookstoreListEn ; |
2186 | 2190 | return $wgBookstoreListEn ; |
2187 | 2191 | } |
2188 | | - |
| 2192 | + |
2189 | 2193 | /** |
2190 | 2194 | * @return array |
2191 | 2195 | */ |
— | — | @@ -2223,7 +2227,7 @@ |
2224 | 2228 | $ns = $this->getNamespaces(); |
2225 | 2229 | return isset( $ns[$index] ) ? $ns[$index] : false; |
2226 | 2230 | } |
2227 | | - |
| 2231 | + |
2228 | 2232 | /** |
2229 | 2233 | * A convenience function that returns the same thing as |
2230 | 2234 | * getNsText() except with '_' changed to ' ', useful for |
— | — | @@ -2244,7 +2248,7 @@ |
2245 | 2249 | */ |
2246 | 2250 | function getNsIndex( $text ) { |
2247 | 2251 | $ns = $this->getNamespaces(); |
2248 | | - |
| 2252 | + |
2249 | 2253 | foreach ( $ns as $i => $n ) { |
2250 | 2254 | if ( strcasecmp( $n, $text ) == 0) |
2251 | 2255 | return $i; |
— | — | @@ -2253,7 +2257,7 @@ |
2254 | 2258 | } |
2255 | 2259 | |
2256 | 2260 | /** |
2257 | | - * short names for language variants used for language conversion links. |
| 2261 | + * short names for language variants used for language conversion links. |
2258 | 2262 | * |
2259 | 2263 | * @param string $code |
2260 | 2264 | * @return string |
— | — | @@ -2380,7 +2384,7 @@ |
2381 | 2385 | (int)substr( $ts, 0, 4 ) ); #Year |
2382 | 2386 | return date( 'YmdHis', $t ); |
2383 | 2387 | } |
2384 | | - |
| 2388 | + |
2385 | 2389 | /** |
2386 | 2390 | * This is meant to be used by time(), date(), and timeanddate() to get |
2387 | 2391 | * the date preference they're supposed to use, it should be used in |
— | — | @@ -2405,7 +2409,7 @@ |
2406 | 2410 | return $wgUser->getOption( 'date' ); |
2407 | 2411 | } |
2408 | 2412 | } |
2409 | | - |
| 2413 | + |
2410 | 2414 | /** |
2411 | 2415 | * @access public |
2412 | 2416 | * @param mixed $ts the time format which needs to be turned into a |
— | — | @@ -2420,17 +2424,17 @@ |
2421 | 2425 | */ |
2422 | 2426 | function date( $ts, $adj = false, $format = true, $timecorrection = false ) { |
2423 | 2427 | global $wgAmericanDates, $wgUser; |
2424 | | - |
| 2428 | + |
2425 | 2429 | if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } |
2426 | | - |
| 2430 | + |
2427 | 2431 | $datePreference = $this->dateFormat($format); |
2428 | | - |
| 2432 | + |
2429 | 2433 | if ($datePreference == '0') {$datePreference = $wgAmericanDates ? '0' : '2';} |
2430 | 2434 | |
2431 | 2435 | $month = $this->getMonthName( substr( $ts, 4, 2 ) ); |
2432 | 2436 | $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) ); |
2433 | 2437 | $year = $this->formatNum( substr( $ts, 0, 4 ), true ); |
2434 | | - |
| 2438 | + |
2435 | 2439 | switch( $datePreference ) { |
2436 | 2440 | case '2': return "$day $month $year"; |
2437 | 2441 | case '3': return "$year $month $day"; |
— | — | @@ -2456,17 +2460,17 @@ |
2457 | 2461 | |
2458 | 2462 | if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } |
2459 | 2463 | $datePreference = $this->dateFormat($format); |
2460 | | - |
| 2464 | + |
2461 | 2465 | if ($datePreference == '0') {$datePreference = $wgAmericanDates ? '0' : '2';} |
2462 | 2466 | |
2463 | 2467 | $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ); |
2464 | | - |
| 2468 | + |
2465 | 2469 | if ( $datePreference === 'ISO 8601' ) { |
2466 | 2470 | $t .= ':' . substr( $ts, 12, 2 ); |
2467 | 2471 | } |
2468 | 2472 | return $this->formatNum( $t ); |
2469 | 2473 | } |
2470 | | - |
| 2474 | + |
2471 | 2475 | /** |
2472 | 2476 | * @access public |
2473 | 2477 | * @param mixed $ts the time format which needs to be turned into a |
— | — | @@ -2481,9 +2485,9 @@ |
2482 | 2486 | */ |
2483 | 2487 | function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) { |
2484 | 2488 | global $wgUser, $wgAmericanDates; |
2485 | | - |
| 2489 | + |
2486 | 2490 | $datePreference = $this->dateFormat($format); |
2487 | | - |
| 2491 | + |
2488 | 2492 | switch ( $datePreference ) { |
2489 | 2493 | case 'ISO 8601': return $this->date( $ts, $adj, $datePreference, $timecorrection ) . ' ' . |
2490 | 2494 | $this->time( $ts, $adj, $datePreference, $timecorrection ); |
— | — | @@ -2550,7 +2554,7 @@ |
2551 | 2555 | # it with one to detect and convert another legacy encoding. |
2552 | 2556 | return $s; |
2553 | 2557 | } |
2554 | | - |
| 2558 | + |
2555 | 2559 | /** |
2556 | 2560 | * Some languages have special punctuation to strip out |
2557 | 2561 | * or characters which need to be converted for MySQL's |
— | — | @@ -2567,7 +2571,7 @@ |
2568 | 2572 | # some languages, e.g. Chinese, need to do a conversion |
2569 | 2573 | # in order for search results to be displayed correctly |
2570 | 2574 | return $termsArray; |
2571 | | - } |
| 2575 | + } |
2572 | 2576 | |
2573 | 2577 | /** |
2574 | 2578 | * Get the first character of a string. In ASCII, return |
— | — | @@ -2659,8 +2663,8 @@ |
2660 | 2664 | $mw->mCaseSensitive = $rawEntry[0]; |
2661 | 2665 | $mw->mSynonyms = array_slice( $rawEntry, 1 ); |
2662 | 2666 | } |
2663 | | - |
2664 | | - /** |
| 2667 | + |
| 2668 | + /** |
2665 | 2669 | * Italic is unsuitable for some languages |
2666 | 2670 | * |
2667 | 2671 | * @access public |
— | — | @@ -2675,34 +2679,34 @@ |
2676 | 2680 | /** |
2677 | 2681 | * This function enables formatting of numbers, it should only come |
2678 | 2682 | * into effect when the $wgTranslateNumerals variable is TRUE. |
2679 | | - * |
| 2683 | + * |
2680 | 2684 | * Normally we output all numbers in plain en_US style, that is |
2681 | 2685 | * 293,291.235 for twohundredninetythreethousand-twohundredninetyone |
2682 | 2686 | * point twohundredthirtyfive. However this is not sutable for all |
2683 | 2687 | * languages, some such as Pakaran want ੨੯੩,੨੯੫.੨੩੫ and others such as |
2684 | 2688 | * Icelandic just want to use commas instead of dots, and dots instead |
2685 | 2689 | * of commas like "293.291,235". |
2686 | | - * |
| 2690 | + * |
2687 | 2691 | * An example of this function being called: |
2688 | 2692 | * <code> |
2689 | 2693 | * wfMsg( 'message', $wgLang->formatNum( $num ) ) |
2690 | 2694 | * </code> |
2691 | | - * |
| 2695 | + * |
2692 | 2696 | * See LanguageGu.php for the Gujarati implementation and |
2693 | 2697 | * LanguageIs.php for the , => . and . => , implementation. |
2694 | | - * |
| 2698 | + * |
2695 | 2699 | * @todo check if it's viable to use localeconv() for the decimal |
2696 | 2700 | * seperator thing. |
2697 | 2701 | * @access public |
2698 | 2702 | * @param mixed $number the string to be formatted, should be an integer or |
2699 | | - * a floating point number. |
| 2703 | + * a floating point number. |
2700 | 2704 | * @param bool $year are we being passed a year? (turns off commafication) |
2701 | 2705 | * @return mixed whatever we're fed if it's a year, a string otherwise. |
2702 | 2706 | */ |
2703 | 2707 | function formatNum( $number, $year = false ) { |
2704 | 2708 | return $year ? $number : $this->commafy($number); |
2705 | 2709 | } |
2706 | | - |
| 2710 | + |
2707 | 2711 | /** |
2708 | 2712 | * Adds commas to a given number |
2709 | 2713 | * |
— | — | @@ -2779,7 +2783,7 @@ |
2780 | 2784 | function segmentForDiff( $text ) { |
2781 | 2785 | return $text; |
2782 | 2786 | } |
2783 | | - |
| 2787 | + |
2784 | 2788 | /** |
2785 | 2789 | * and unsegment to show the result |
2786 | 2790 | * |
— | — | @@ -2794,7 +2798,7 @@ |
2795 | 2799 | function convert( $text, $isTitle = false) { |
2796 | 2800 | return $this->mConverter->convert($text, $isTitle); |
2797 | 2801 | } |
2798 | | - |
| 2802 | + |
2799 | 2803 | /** |
2800 | 2804 | * Perform output conversion on a string, and encode for safe HTML output. |
2801 | 2805 | * @param string $text |
— | — | @@ -2828,7 +2832,7 @@ |
2829 | 2833 | /** |
2830 | 2834 | * if a language supports multiple variants, it is |
2831 | 2835 | * possible that non-existing link in one variant |
2832 | | - * actually exists in another variant. this function |
| 2836 | + * actually exists in another variant. this function |
2833 | 2837 | * tries to find it. See e.g. LanguageZh.php |
2834 | 2838 | * |
2835 | 2839 | * @param string $link the name of the link |
— | — | @@ -2854,17 +2858,17 @@ |
2855 | 2859 | * for languages that support multiple variants, the title of an |
2856 | 2860 | * article may be displayed differently in different variants. this |
2857 | 2861 | * function returns the apporiate title defined in the body of the article. |
2858 | | - * |
| 2862 | + * |
2859 | 2863 | * @return string |
2860 | 2864 | */ |
2861 | 2865 | function getParsedTitle() { |
2862 | 2866 | return $this->mConverter->getParsedTitle(); |
2863 | 2867 | } |
2864 | | - |
| 2868 | + |
2865 | 2869 | /** |
2866 | 2870 | * Enclose a string with the "no conversion" tag. This is used by |
2867 | 2871 | * various functions in the Parser |
2868 | | - * |
| 2872 | + * |
2869 | 2873 | * @param string $text text to be tagged for no conversion |
2870 | 2874 | * @return string the tagged text |
2871 | 2875 | */ |