Commit graph

795 commits

Author SHA1 Message Date
Niklas Laxström
019a132ebf Regression in r51797, anon signature links where prefixed with contributions/ because default value changed from '' to null 2009-06-15 15:17:40 +00:00
Siebrand Mazeland
38ca12aa82 * replace some use of deprecated makeKnownLinkObj() by link() in core
* use array type parameter instead of string to escapeLocalUrl(), getFullURL() and getFullUrl() for readability
* add FIXME in Parser.php and LogEventsList.php where I didn't know how to replace makeKnownLinkObj by link()
* return type for private method Skin::editUrlOptions() changed from string to array
* some code readability improvements

Linking this to r51559 for CodeReview as there is some discussion there, and these changes are very similar.

Todo: core special pages
2009-06-07 15:02:12 +00:00
Siebrand Mazeland
055fcbd7cb * replace use of deprecated makeLinkObj() by link() in core
* add FIXME where makeLinkObj was used in documentation
2009-06-06 15:45:43 +00:00
Rotem Liss
b57bce94c5 Multiple whitespace in TOC anchors is now stripped, for consistency with the link from the edit comment. 2009-06-02 19:32:51 +00:00
Siebrand Mazeland
0d23260d81 (bug 19017) TOC level calculation error in an odd case. Patch by Brad Jorsch. 2009-06-01 16:39:18 +00:00
Shinjiman
21c11b8f40 * (bug 5755) Introduce {{CURRENTMONTH1}} and {{LOCALMONTH1}} to display the month number without the leading zero
* added {{CURRENTMONTH2}} and {{LOCALMONTH2}} as alias of {{CURRENTMONTH}} and {{LOCALMONTH}} for consistency with other magic words
2009-05-20 07:14:03 +00:00
Arash Boostani
28a9ea2b1c Reverting the code that encloses article sections in their own div for the time being, because there are certain scenarios that break the document structure. 2009-05-19 15:12:05 +00:00
Arash Boostani
e1e727ec5d Fixed a minor problem with $wgSectionContainers that was causing some divs to not be closed properly 2009-05-06 23:21:55 +00:00
Arash Boostani
127c44f4fc Fixed problem with call to closeSectionContainers that contained references. Only the function definition needs to indicate that the input variable is a reference, not the function call. 2009-05-06 04:17:48 +00:00
Arash Boostani
f81f4c1fa6 Added an extension, called EditSectionHiliteLink, that highlights the appropriate section when the user mouses over the section edit links. Also, modified the Parser to enclose each section in a div if $wgSectionContainers is set. 2009-05-05 22:49:45 +00:00
Brion Vibber
eee6d975bd Revert r49653 "Make the link regex non-greedy so that it is possible to add '|' to $wgLegalTitleChars and still be able to pipe
links."
Pipes would definitely not work in titles. The particular regex change here would for instance break image options if | were added to $wgLegalTitleChars.
2009-04-28 23:33:28 +00:00
Remember the dot
0d499494cd Make the link regex non-greedy so that it is possible to add '|' to $wgLegalTitleChars and still be able to pipe
links. This change should have no effect on the default configuration, which does not include '|' in 
$wgLegalTitleChars because including it still breaks other things.
2009-04-19 22:20:12 +00:00
Tim Starling
2e17030282 Move the circular reference check to *after* redirect resolution, to avoid infinite loops via redirects. Was causing sysadmin issues. 2009-04-05 15:01:25 +00:00
Aaron Schulz
41d6528eab profiling fix 2009-04-05 01:10:52 +00:00
Alexandre Emsenhuber
82730b9de6 * (bug 18170) Fixed a PHP warning in Parser::preSaveTransform() in PHP 5.3: Parameter 2 was expected to be a reference but value given when $wgParser is unstubbed on that call 2009-04-02 19:16:24 +00:00
Arash Boostani
c32a1ef480 Fixed bug #11213 - [edit] section links in printable version interfere with cut-and-paste of article text 2009-03-18 23:27:48 +00:00
Chad Horohoe
56d4c64200 (bug 17897) Uninitialized string offset in <pre> tags. Patch by Luigi Corsaro. No parser test regressions. 2009-03-11 13:28:22 +00:00
Aaron Schulz
30c33a20ee Don't show deleted user names 2009-03-09 08:52:04 +00:00
Nathaniel Herman
df7ba5f52c (bug 10336) Added new magic word {{REVISIONUSER}}, which displays the user name of the last user to edit the page 2009-03-07 23:01:59 +00:00
Aaron Schulz
ee13359dd5 style/profiling tweaks 2009-03-06 02:25:28 +00:00
Aaron Schulz
d476aa6315 short-circuit replaceVariables() for all the empty text that seems to come in 2009-03-02 02:06:01 +00:00
Aaron Schulz
86e1033fc7 Add profile calls to replaceInternalLinks2. Changed ! check to === null. 2009-02-27 23:44:15 +00:00
Aaron Schulz
f7e4fc02c1 Removed strval calls from magicLinkCallback(); items already comes in as one 2009-02-27 17:56:00 +00:00
Chad Horohoe
b9119791b7 More unused globals. 2009-02-25 21:54:11 +00:00
Brion Vibber
92079d3b1c * (bug 16335) __NONEWSECTIONLINK__ magic word to suppress new section link.
Patch by Carlin: https://bugzilla.wikimedia.org/attachment.cgi?id=5680
With slight whitespace tweaks.
2009-02-19 22:14:59 +00:00
Aaron Schulz
7a5ca259be Rename new ACTIVEUSERS word to NUMBEROFACTIVEUSERS 2009-02-17 23:05:04 +00:00
Andrew Garrett
802c88e188 Add ACTIVEUSERS magic-word, complement to NUMBEROFUSERS. 2009-02-04 22:16:35 +00:00
Andrew Garrett
73965b1242 Re-implementation of r46725 (caching of Cite <references /> output).
This time, I've written a Parser method called serialiseHalfParsedText, which, as the name implies, grabs some half-parsed text, and fixes up all of the strip
markers, and link comments, and makes it safe to import some other time with unserialiseHalfParsedText. I tested it by live-hacking the cache key to be a constant,
and then putting <references /> on a completely different page, where it worked perfectly.
2009-02-03 04:58:08 +00:00
Siebrand Mazeland
3cd175834b (bug 14938) Removing a section no longer leaves excess whitespace. Contributed by Michael Walsh. 2009-02-01 18:58:18 +00:00
Niklas Laxström
311faa145c * (bug 7556) Time zone names in signatures lack i18n 2009-01-31 17:34:47 +00:00
Brion Vibber
5eb0d9dfef Roll back r46196, 46202 for now "__IGNOREUNUSED__ excludes cats from UnusedCategories (bug 17145)"
The name is very unclear; would prefer to nail that down before rolling it out.
2009-01-27 22:54:01 +00:00
Siebrand Mazeland
9e968c0bfa Re-revert r46344 because of crossing commits (r46346) 2009-01-27 15:20:31 +00:00
Siebrand Mazeland
4b9b399711 Revert r46344. PHP Fatal error: Class 'MWTidy' not found in /var/www/w/includes/parser/Parser.php on line 378 2009-01-27 15:17:45 +00:00
Alexandre Emsenhuber
c119961f31 Per Brion's comment on http://www.mediawiki.org/wiki/Special:Code/MediaWiki/46145#c1445 :
* Refactored Tidy function in a new class, MWTidy
* Only added Parser::tidy() for b/c, Parser::internalTidy() and Parser::externalTidy() were marked as private and are unused in core and extensions
* Added RELEASE-NOTES entry
2009-01-27 15:09:19 +00:00
Aryeh Gregor
9ee6ef5cc5 __IGNOREUNUSED__ excludes cats from UnusedCategories
An extra left join and filter condition added to the query.  Should
cause no significant performance issues.  Patch by Ahmad Sherif (bug
17145).
2009-01-25 12:43:55 +00:00
Aryeh Gregor
fd07d0236a Allow exempting domain names from rel="nofollow"
This introduces a new configuration option, $wgNoFollowDomainExceptions.
By default this is an empty array; perhaps it should be null by default
and initialize to something extracted from $wgServer.  An appropriate
value for Wikimedia would be something like:

$wgNoFollowDomainExceptions = array( 'wikipedia.org', 'wiktionary.org',
'wikibooks.org', ... );

It's fairly silly that we're nofollowing links to our own sites.  :)
2009-01-23 18:03:12 +00:00
Aryeh Gregor
93675d4e20 Remove unused code 2009-01-23 18:03:02 +00:00
Shinjiman
e2ed772baa * Fixing the caching issue by using -{T|xxx}- syntax (only applies on wiki with LanguageConverter class)
* Improving the efficiency by using -{A|xxx}- syntax (only applies on wiki with LanguageConverter class)
  patches by PhiLiP
2009-01-17 05:01:43 +00:00
Brion Vibber
e45312e960 Revert r45671 "Added "__\" magic word to eat up all whitespace and newlines to the next non-whitespace character, to facilitate writing readable template code where whitespace is significant."
Unplanned syntax change.
2009-01-14 19:41:30 +00:00
Brion Vibber
dd64f272b4 Revert r45642 "* Fixing the caching issue by using -{T|xxx}- syntax (only applies on wiki with LanguageConverter class) * Improving the efficiency by using -{A|xxx}- syntax (only applies on wiki with LanguageConverter class) patches by PhiLiP"
Causes parser test regression and other problems noted in code review.
2009-01-14 19:14:20 +00:00
Fran Rogers
9fd6bb8393 2009-01-12 07:45:34 +00:00
Niklas Laxström
29306635a5 * Reverting r45588, causes fatal errors when saving new sections 2009-01-10 17:16:21 +00:00
Shinjiman
7637a89d82 * Fixing the caching issue by using -{T|xxx}- syntax (only applies on wiki with LanguageConverter class)
* Improving the efficiency by using -{A|xxx}- syntax (only applies on wiki with LanguageConverter class)
  patches by PhiLiP
2009-01-10 16:13:44 +00:00
Aryeh Gregor
f7486d8642 Reduce code duplication correctly this time, again
The test cases I thought up are at:

http://www.mediawiki.org/wiki/User:Simetrical/Id_tests

All of them pass with the patch, except for some that fail on current
code as well: the ones involving templates, multiply-occurring section
headers, or numeric id's (there seems to be a weird bug with those that
probably involves string and numeric id's being used in the same array).
This is true whether $wgEnforceHtmlIds is on or off.  (Actually, the
problem with numeric keys doesn't happen with $wgEnforceHtmlIds off,
because of course numeric ids aren't allowed then.)
2009-01-08 23:59:25 +00:00
Brion Vibber
1c9ebd8072 Pulling r45473 back for now "Reduce code duplication correctly this time"
Let's hold off on further section anchor generation changes until we have decent test cases covering the different ways we we stuff through...
2009-01-07 04:23:51 +00:00
Aryeh Gregor
da5d1b714f Reduce code duplication correctly this time
This reverts r45470 and fixes the problems it identified.  Things should
now work as they always used to, but with less code duplication, and
with $wgEnforceHtmlIds = false working correctly as well.
2009-01-07 00:41:03 +00:00
Brion Vibber
4b6945cb8a Reverting r45341 " Use Sanitizer::escapeId() in another place Reduce code duplication some more, and fix section redirect after edit
when $wgEnforceHtmlIds is off."

This produces non-matching stuff like "#_Rock_on_dudes_" for == ''Rock on'' dudes ==.
2009-01-07 00:00:45 +00:00
Aryeh Gregor
72e98e4e6a When $wgEnforceHtmlIds=false, add legacy anchors
This means that old links will still work in a lot of cases.  However,
if the legacy anchor is invalid XML, we omit it.  In particular, on
non-Latin wikis, practically all old section links (from external
sources or using external links) are likely to break, since the first
character of legacy anchors starting with a non-ASCII character will be
".", which is invalid in XML as well as in HTML4.
2009-01-05 15:59:46 +00:00
Aryeh Gregor
4fde66f28d Refactor somewhat so that escapeId() works right
r45267 commented out the logic prohibiting numbers and so on at the
start of id's.  I've uncommented this logic, but passed 'noninitial' as
an option to escapeId() in all necessary circumstances.  Shouldn't
change behavior, this is to simplify some further work I'm about to do.
2009-01-05 15:59:35 +00:00
Aryeh Gregor
9bfa528584 Use Sanitizer::escapeId() in another place
Reduce code duplication some more, and fix section redirect after edit
when $wgEnforceHtmlIds is off.
2009-01-02 20:30:53 +00:00
Brion Vibber
c5d575e091 Follow-up to r45174: (bug 16806) Fix regression from r44524 that caused links to files to not get added to mLinks in ParserOutput, which caused them to not be included in LinksUpdate::LinksUpdate(), and not added to pagelinks.
Fixes other cases broken by Parser's assumptions failing to hold after change in Title::isAlwaysKnown()'s behavior:
* Links to invalid Special: pages were being recorded, but shouldn't
* Links to valid MediaWiki: pages were no longer recorded

Instead of the NS_FILE special-case in r45174, I'm just tossing *all* isAlwaysKnown links over to ParserOutput::addLink(), and letting the latter worry about what types of titles it won't record.
Just for good measure, in case any NS_MEDIA titles make it into ParserOutput::addLink() they'll be normalized to NS_FILE.
2009-01-01 00:05:08 +00:00
Alex Z
caa5d0d189 (bug 16806) Fix regression from r44524 that caused links to files to not get added to mLinks in ParserOutput, which caused them to not be included in LinksUpdate::LinksUpdate(), and not added to pagelinks. 2008-12-30 05:34:37 +00:00
Aryeh Gregor
d7371cc695 Optionally allow non-HTML4-compatible ids
This adds a config option, $wgEnforceHtmlIds, true by default.  If this
is set to false, all characters that are allowed in XML ids are let
through in header ids and manually-specified ids.  In particular, this
should include all alphabetic and numeric characters.

Some remaining issues to work out:

* This will cause backward-compatibility issues for some types of links
and references: links from non-MediaWiki sources, links from MediaWiki
sources running a different version, external links, and references from
stylesheets/scripts.  These could be partially alleviated by having a
second <a name="" id=""> for headers where the two versions differ, but
it would remain an issue for manually-specified id's.
* Any invalid characters are now, effectively, stripped (replaced with
underscores).  This might cause problems if some writing systems are
invalid in id's for some reason: we'll want to double-check the list of
prohibited characters carefully.
* Some user agents might not support these links.  IE5 appears to, and
so do recent versions of Opera and Firefox, but I didn't do extensive
testing.
* Not tested extensively, there are probably some bugs.

I think this would be good to enable on testwiki for the moment to see
how it goes.

No parser test regressions.  No change to RELEASE-NOTES, we can add that
when the option is enabled by default (ideally, removed entirely).
2008-12-30 00:22:34 +00:00
Aryeh Gregor
69d11310ff Improve ugly interface for Sanitizer::escapeId()
Calling it with no extra arguments will now assume that you're escaping
a whole id, not an id fragment, which is safer.  Also, instead of ugly
bitfield-based options, I've changed the options to use an array of
strings.  I fixed all callers in trunk.  Out-of-tree callers that were
using Sanitizer::NONE will get correct behavior, while those that were
calling it with no arguments will get slightly changed behavior (an x
will be prepended).  I think this is harmless enough that we can skip
back-compat cruft here.

This should cause no visible changes.  No parser test regressions.
2008-12-30 00:22:14 +00:00
Aryeh Gregor
ef56978780 Prepend x to section ids not starting with [a-z]
This will break any preexisting links to such sections (other than
those generated by the software, of course).  There should be no parser
test regressions.
2008-12-28 00:05:14 +00:00
Chad Horohoe
be374a912a War on wfElement() and friends. Call the Xml members directly, rather than using old wrappers. 2008-12-14 19:14:21 +00:00
Ilmari Karonen
0c9e9c8e7a (Actually, we can simplify that a bit more.) 2008-12-13 21:21:40 +00:00
Ilmari Karonen
2b796b766a Fix interwiki link regression from r44524. 2008-12-13 21:14:50 +00:00
Ilmari Karonen
7f71d9e38f followup to r44520: simplify various bits by removing checks now made redundant 2008-12-13 04:14:40 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Steve Sanbeg
5ec8bddd10 undo 43772; there seems to be various special behavior hacked onto <div>, some of which may be intentional 2008-11-20 23:55:38 +00:00
Steve Sanbeg
6c54601676 this should prevent the parser from inserting <p> tags around the second line of divs 2008-11-20 20:50:12 +00:00
Chad Horohoe
d8119bd420 Revert r41710, r41978, r42012, r42048 (integration of Poem extension to core plus misc. fixes). Per Wikitech-l, this isn't properly attributed to the original authors of the extension. Furthermore, "Poem" is entirely too narrow a name for the functionality this tag provides. If this is to be integrated, a better name should be chosen. 2008-11-15 01:19:46 +00:00
Raimond Spekking
c34f717965 Add messages for hardcoded parser warnings 2008-11-12 21:00:59 +00:00
Ilmari Karonen
a3fbf7fc49 Emit a warning message if a single page has multiple conflicting {{DEFAULTSORT:}} keys.
(Also, replace wfMsg() with wfMsgForContent() for the unknown_extension_tag message.)
2008-11-02 14:21:04 +00:00
Fran Rogers
7c1712c550 Convert literal tabs to &#9; when passing them through Tidy, to prevent them from being clobbered. 2008-10-20 06:46:09 +00:00
Nicolas Dumazet
6198592553 (bug 13701) {{NUMBEROFVIEWS}} magic word to show number of total views. 2008-10-19 04:11:02 +00:00
Brion Vibber
5ad630fca0 Fix for r41837 -- apply HTML stripping to explicit alt text as well as implicit.
Added parser test cases to confirm.
2008-10-15 21:20:13 +00:00
Brion Vibber
2b8a8b2624 Pulling out r42105 for now -- "Added 2 hooks. One in Parser to allow custom handling of namespace links, and one in EditPage, to allow custom output/handling when a user has no edit rights"
The namespace parsing thing feels very hacky and grabs bits out of an internal implementation function which doesn't feel like a stable interface.
Would recommend thinking about this and coming up with a more serious stable interface for it.
2008-10-15 20:57:02 +00:00
Jason Richey
a719d5ff1c Added 2 hooks. One in Parser to allow custom handling of namespace links, and one in EditPage, to allow custom output/handling when a user has no edit rights 2008-10-15 19:32:59 +00:00
Brion Vibber
88786f760f Cleanup for r41952: > is usually easier to understand than !<= :) 2008-10-13 02:38:31 +00:00
Ryan Schmidt
4f655ca3ba * re-implement r41983 (forgot to add log message). Changes made:
** <poem> handling fixes: use DoubleReplacer class instead of create_function(), moving recursiveTagParse above line-break replacements, removed strip items, updated parser tests to reflect new output when combined with <nowiki>
2008-10-13 02:18:49 +00:00
Brion Vibber
65ed1fd91b Revert mystery change r41983 -- no explanation of the change or its purpose.
Appears to be an attempt to remove some extra whitespace, but it's kind of unclear.
2008-10-12 23:14:39 +00:00
Ryan Schmidt
2595b8fd25 2008-10-12 02:20:08 +00:00
Ryan Schmidt
f9a901e6a5 * fixes for the merged Poem extension, per comments by Tim Starling on CodeReview (r41710)
* adding <poem> tests to the parser tests file
2008-10-11 21:53:44 +00:00
Alex Z
e6a33f0c81 Adding file cache to the parser to improve rendering time on pages with several uses of the same image; designed with input from Brion and Tim. Cache size is limited to 1000. 2008-10-10 22:19:55 +00:00
Aryeh Gregor
bc65c6bb12 (bug 368) Allow alt= attribute for images
Alt text is now set in the following ways, in decreasing priority:

1) Set to the alt= parameter if present.
2) Set to the unnamed (caption) parameter if present, and if the image does not have the thumb or frame option set (i.e., if the unnamed parameter is not actually being used for a caption -- using it as both caption and alt text would just lead to text being repeated).
3) Set to the empty string.

Title text and captions should not be affected in any case.  The only backward-compatibility effect (i.e., on images not using the new alt= syntax) should be that if previously the same text was repeated in the alt text and then again in the caption, the alt text will now be empty.  Setting the alt parameter should never change the HTML output compared to not setting it, except of course changing the alt text.

All parser tests pass, except the usual ones.
2008-10-08 16:33:36 +00:00
Brion Vibber
86055bdfa4 Update to r41727 (bug 539) "click" parameter on images.
* Renamed to "link", which seems clearer and less mouse-centric ;)
* Added parser test cases:
   3 new PASSING test(s) :)
      * Image with link parameter, wiki target  [Has never failed]
      * Image with link parameter, URL target  [Has never failed]
      * Image with empty link parameter  [Has never failed]
2008-10-07 00:31:26 +00:00
Tim Starling
77d634b922 * Added "click" parameter to image links, to allow images to link to an arbitrary title or URL. This should replace inaccessible and incomplete solutions such as CSS-based overlays and ImageMap. 2008-10-06 05:55:27 +00:00
Tim Starling
0d322a394e * Allow $wgDiff3=false
* Don't call quickUserCan('edit') unless section edit is enabled
* In DatabasePostgres and DatabaseSqlite: throw an exception on connection error
* In DatabasePostgres: don't send an invalid connection string whenever one of the fields is empty. Use quoting.
* In Database: make the captured PHP error prettier
* Display a descriptive error message when the user navigates to index.php with PHP 4, not a parse error. Check to see if the *.php5 extension works, using file_get_contents().
* The default port number for PostgreSQL is 5432, not blank.
* Better default for $wgDBname
2008-10-06 00:45:18 +00:00
Ryan Schmidt
8f521476a8 * integrate Poem extension into core (patch by Nathaniel Herman) 2008-10-05 20:27:23 +00:00
Tim Starling
110c0bb72f Revert revert r41406 of r41333, and removed one space between attributes. 2008-09-30 01:00:40 +00:00
Brion Vibber
b74cc54810 Revert r41364 -- broke 22 parser test cases with change of alt behavior.
The caption was originally defined *as* the alt text (defaulting to the image file name if there is no alt text). Note that a separate caption text is only displayed in some display modes ('frame' and 'thumb', iirc), and not by default.

Please run the parser tests and check the effect you have on them. If it's really an appropriate change, then update the test cases. If you're not sure, consider backing out pending further discussion. :)

It might be appropriate to not set the 'alt' attribute for frame/thumb cases, but definitely not for inline images where we already have a way of setting the alt text which you're removing!
2008-09-30 00:21:59 +00:00
Brion Vibber
0dd22a5406 Back out r41333 -- causes lots of parser test regressions due to funny spacing. Probably an easy fix but it wasn't tested apparently. :) 2008-09-30 00:14:25 +00:00
Aryeh Gregor
a53fa1decd (bug 368) Allow alt= attribute for images
If the attribute is not specified, default to empty string, not repeating the caption.
2008-09-28 21:07:34 +00:00
Alexandre Emsenhuber
83cab059b3 Use $wgContLang here, this should not vary with the user language. 2008-09-28 10:51:58 +00:00
Niklas Laxström
7928acbcd4 * (bug 15196) Free external links should be numbered in a localised manner 2008-09-28 08:45:03 +00:00
Tim Starling
cdfdb50943 * Added the ability to set the target attribute on external links with $wgExternalLinkTarget
* Removed the namespace parameter from Linker::makeExternalLink(), added a generic associative array of attributes instead. Let the Parser decide whether to use rel=nofollow.
2008-09-28 02:35:37 +00:00
Chad Horohoe
8b9e04434f Call Xml class directly, rather than the global function. 2008-09-22 17:01:44 +00:00
Niklas Laxström
78f44d3447 * $name is not defined here 2008-09-21 07:18:24 +00:00
Tim Starling
93a66a41aa Revert r40712, replace_variables is correct. 2008-09-15 06:37:57 +00:00
Chad Horohoe
793526a920 Revert r40707. Could produce broken XHTML if the source wiki has unclosed div tags. 2008-09-10 23:02:48 +00:00
Alexandre Emsenhuber
5193105e5c (bug 15555) misspelled replace_variables() function in doc of Parser::preprocessToDom(), changed to replaceVariables() 2008-09-10 19:31:01 +00:00
Chad Horohoe
128d51a4fe (bug 12400) Add class to content transcluded from IW source. 2008-09-10 18:18:26 +00:00
Tim Starling
371d2a0926 Fix for bug 13770, second attempt. Tested with a conflicting install of both dom and domxml, as per the report. 2008-09-04 06:19:27 +00:00
Ryan Schmidt
b3b81715d5 * $wgAllowExternalImagesFrom may now be an array of multiple strings.
* Added an on-wiki external image whitelist. Items in this whitelist are
  treated as regular expression fragments to match for when possibly
  displaying an external image inline. Controlled by $wgEnableImageWhitelist
  (true by default)
2008-09-01 18:49:14 +00:00
Shinjiman
ec8f064efc * Added support of piped wikilinks using double-width brackets
patch by PhiLiP
2008-08-30 13:33:05 +00:00
Tim Starling
350b498b9f * Revert back to my parser pseudo-branch again. Note: if you feel like reverting this, reverting Parser.php alone to r40010 will work just fine.
* Merged replaceFreeExternalLinks() with doMagicLinks(). Makes a lot of sense, very similar operations, doesn't break any parser tests. Stops free links from interacting with other parser stages, the same way ISBN links don't. 
* The pass order change fixes Brion's complaint in r39980. Early link expansion, triggered by having more than 1000 links in the page, was outputting URLs which were destroyed by RFEL. Added parser test.
* Fixed an unrelated bug in LinkHolderArray::replace(): if a link to a redirect appears in two separate RLH calls, the second and subsequent calls do not add the mw-redirect class. Caused by an unmigrated LinkCache fetch.
* Added a parser test for a pass interaction bug that the pass order change fixes.
* The fuzzer told me to tell you that free external links in non-caption image parameters, which are and have always been invisible, are now not registered either.
* Miscellaneous supporting updates to the test infrastructure.
2008-08-26 14:37:15 +00:00
Tim Starling
367607ae97 Added __destruct(), for stable pseudo-branch 2008-08-26 06:48:24 +00:00
Brion Vibber
c83882e96e Revert r39949 "* Revert revert r39662 of my parser changes."
Causes weird regressions on http://meta.wikimedia.org/wiki/Talk:Spam_blacklist
Couldn't isolate to a parser test in a few minutes; some kind of template interaction perhaps.

Sample bad HTML like:
The associated page is used by the Mediawiki <a href="&lt;a href=" class="external free" title="http://www.mediawiki.org/wiki/Extension:SpamBlacklist" rel="nofollow">http://www.mediawiki.org/wiki/Extension:SpamBlacklist</a>" class="extiw" title="mw:Extension:SpamBlacklist"&gt;Spam Blacklist extension, and lists strings of text that may not be used in URLs in any page in Wikimedia Foundation projects (as well as many external wikis). Any meta <a href="/wiki/Administrator" title="Administrator">administrator</a> can edit the spam blacklist. There is also a more aggressive way to block spamming through direct use of <a href="/wiki/Anti-spam_features#.24wgSpamRegex" title="Anti-spam features">$wgSpamRegex</a>. Only <a href="/wiki/Developers" title="Developers" class="mw-redirect">developers</a> can make changes to $wgSpamRegex, and its use is to be avoided whenever possible.
2008-08-25 22:19:50 +00:00
Alexandre Emsenhuber
05b0fbd558 (bug 15303) Title conversion for templates wasn't working in some cases 2008-08-25 18:06:54 +00:00
Tim Starling
ccacba9f3a * Revert revert r39662 of my parser changes.
* Fixed image link whitespace handling (Brion's complaint, r39662)
* Added fuzz test capability to parserTests.php
* Added __destruct() functions to Parser and Language, and called them explicitly from parserTests.inc, to avoid unconstrained memory usage during fuzz testing.
* Added unified diff to output of Parser_DiffTest
* Fixed whitespace change in Parser::doTableStuff() (found by fuzzing)
* Added feature to RELEASE-NOTES which I'd committed last time but forgotten to note: <gallery> will accept image names with no "Image:" prefix (rediscovered by fuzzing)
* Limit memory usage in Title::getInterwikiLink()
* Fixed chronic fail of all interwiki link parser tests (hid Siebrand's complaint, r39464)
* Fixed chronic fail of one of the LanguageConverter parser tests. Was actually an ignored bug.
2008-08-25 16:08:19 +00:00
Tim Starling
af5cd9d05f Revert r39675, which made functions that don't depend on $this static, for performance. See wikitech-l for a full explanation. 2008-08-25 04:27:40 +00:00
Aaron Schulz
b16705dcb1 Remark static functions for performance. Same 15 test failures as before this change. 2008-08-20 01:03:01 +00:00
Brion Vibber
915c24e8bd Revert Parser.php to r39295 good state.
Whitespace handling for image width magic words failed, possibly other problems.
NEEDS PARSER TESTS
2008-08-19 20:59:18 +00:00
Aaron Schulz
7e888fc473 Use !== here 2008-08-18 21:03:59 +00:00
Aaron Schulz
51e27add8f Use more simple strict comparisons 2008-08-18 20:52:24 +00:00
Aaron Schulz
e74f1ffb25 mark static functions 2008-08-18 20:27:35 +00:00
Aaron Schulz
79ef147973 fix broken profiling 2008-08-18 05:58:54 +00:00
Aaron Schulz
8266bb1b1d move "continue" statement. Broken position broke mImages and thus flaggedrevs. 2008-08-17 00:20:47 +00:00
Fran Rogers
3ad5bfb749 Fix for problems with r39414; LinkHolderArray::replaceInterwiki() was badly broken 2008-08-16 10:13:35 +00:00
Siebrand Mazeland
2dedbbdfa1 Revert r39414. Breaks processing links like [[:wikipedia:nl:User:Siebrand|Dutch language Wikipedia]]. It will add a comment like "<!--IWLINK 0-->" in the HTML output. Happens even if there is one such link on a page. 2008-08-16 09:33:11 +00:00
Tim Starling
c45292ac40 * In the parser: do link existence tests in batches of 1000. Avoids using excessive memory to store Title objects.
* Split link placeholder/replacement handling into a separate object, LinkHolderArray.
* Remove Title objects from LinkCache, they apparently weren't being used at all. Same unconstrained memory usage as the former $parser->mLinkHolders.
* Introduced ExplodeIterator -- a workalike for explode() which doesn't use a significant amount of memory
* Introduced StringUtils::explode() -- select whether to use the simulated or native explode() depending on how many items there are
* Migrated most instances of explode() in Parser.php to StringUtils::explode()
* Renamed some variables in Parser::doBlockLevels()
* In Parser.php: $fname => __METHOD__, Parser => self/__CLASS__, to support Parser_DiffTest more easily
* Doc update in includes/MessageCache.php for r39412
* MW_TITLECACHE_MAX => Title::CACHE_MAX, nicer name, easier to access from another module
2008-08-15 16:35:03 +00:00
Chad Horohoe
cde6bce545 Catch php installs who have proc_open() disabled. 2008-08-13 16:23:41 +00:00
Tim Starling
e4ecf89421 Fixed incorrect detection of PHP's DOM module (bug 13770) 2008-08-11 17:24:35 +00:00
Alexandre Emsenhuber
edce5989d4 For compatibility with PHP 5.3.0alpha1: specify class name instead of passing by ref the title object: was throwing the following error:
Warning: Parameter 2 to Parser::parse() expected to be a reference, value given in ./includes/StubObject.php on line 58
followed by:
Fatal error: Call to a member function getLanguageLinks() on a non-object in ./includes/OutputPage.php on line 463
2008-08-09 13:31:15 +00:00
Leon Weber
8f821b6549 (bug 6387) Introduced new setting $wgCategoryPrefixedDefaultSortkey which
allows having the unprefixed page title as the default category sortkey.

Although creating sane defaults should always be preferred over introducing
new config options, we cannot just remove the old behaviour here, as some
peoply might still rely on it. However, the sortkey {{PAGENAME}} is already
widely used for circumventing the current behaviour.
2008-08-09 11:19:18 +00:00
Brion Vibber
ee7d2a4663 Revert r38876 "(bug 2443) Add image name as alt-text when no caption is provided."
This broke four test cases:

   4 previously failing test(s) now PASSING! :)
      * Right-aligned image  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]
      * Centre-aligned image  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]
      * None-aligned image  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]
      * Width + Height sized image (using px) (height is ignored)  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]

Please recommit with fixes to the existing test cases and some new test cases to cover cases where an empty caption is explicitly requested, see https://bugzilla.wikimedia.org/show_bug.cgi?id=2443#c11
2008-08-08 21:50:37 +00:00
Andrew Garrett
ebbee769bf * (bug 2443) Add image name as alt-text when no caption is provided. 2008-08-08 10:24:09 +00:00
Andrew Garrett
7a281ca6f6 Ignore self-links for special pages. They might be there for a good reason, and the current parsing of special-page output means that a link from any subpage of a special page to the special page itself is considered to be a self-link. This is evil, and doesn't take into account parameters added to other parts of the URL (e.g. the unblock form on Special:Ipblocklist) 2008-08-06 13:54:36 +00:00
Raimond Spekking
e831d9b6ee Allow PLURAL for 'expensive-parserfunction-warning' 2008-08-06 08:04:11 +00:00
Aryeh Gregor
efb774b085 Convert two more Parser uses, no parser test failures. Any more conversions look like they'll have to get the parser to use arrays for query strings instead of storing them as strings. 2008-08-01 15:09:57 +00:00
Aryeh Gregor
91ac68478f Start finding more bugs in Linker::link() by having the Parser use it, and running the parser tests.
* Support class="extiw"
* Do not double the fragment for external links with fragments.  Move the code for this into a new Title::getLinkUrl() instead of a Linker method, because it seems like a useful concept to be able to get a *usable* link to the current Title.
* Fix a few parser tests that expected attributes in the opposite order.
* Don't overwrite actions for broken links.
* Style

If you want me to stop doing this, by the way, please say so before I spend too many more hours of my life on it.
2008-08-01 15:02:46 +00:00
Tim Starling
64378ddf3b $wgCleanSignatures to disable Parser::cleanSig(). Requested by Wikia. 2008-07-31 09:41:28 +00:00
Brion Vibber
be32f516df Revert r38196, r38204 -- "(bugs 6089, 13079) Show edit section links for transcluded template if, and only if the user can edit it, made Title::getUserPermissionsErrorsInternal() public so that it can be used in Parser and it can pass the User object from ParserOptions. " & co
Cause regression in 19 parser test cases, looks like messing up the tooltips for section edit links.

  19 previously failing test(s) now PASSING! :)
      * Bug 6563: Edit link generation for section shown by <includeonly>  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Bug 6563: Edit link generation for section suppressed by <includeonly>  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Basic section headings  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Section headings with TOC  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Handling of sections up to level 6 and beyond  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * TOC regression (bug 9764)  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * TOC with wgMaxTocLevel=3 (bug 6204)  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Resolving duplicate section names  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Resolving duplicate section names with differing case (bug 10721)  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Template with sections, __NOTOC__  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Link inside a section heading  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * TOC regression (bug 12077)  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Fuzz testing: Parser14  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Fuzz testing: Parser14-table  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Inclusion of !userCanEdit() content  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Out-of-order TOC heading levels  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * -{}- tags within headlines (within html for parserConvert())  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * Morwen/13: Unclosed link followed by heading  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
      * HHP2.2: Heuristics for headings in preprocessor parenthetical structures  [Fixed between 29-Jul-2008 22:42:06, 1.14alpha (r38207) and 29-Jul-2008 23:54:51, 1.14alpha (r38207)]
2008-07-29 23:56:30 +00:00
Alexandre Emsenhuber
b19693ddb4 Per talk with Simetrical, add a param to Title::quickUserCan and Title::userCan instead of making Title::getUserPermissionsErrorsInternal() public, also update ParserCache to use this param 2008-07-29 20:35:11 +00:00
Alexandre Emsenhuber
9b44e8f749 * (bugs 6089, 13079) Show edit section links for transcluded template if, and only if the user can edit it, made Title::getUserPermissionsErrorsInternal() public so that it can be used in Parser and it can pass the User object from ParserOptions.
* Get the stubthreshold option from ParserOptions and not from $wgUser
2008-07-29 17:28:26 +00:00
Aryeh Gregor
39273d2c67 Recommit r38149, with the fatal error fixed. The EditSectionLinkForOther hook is now removed entirely -- EditSectionLink is run unconditionally instead. This is extremely unlikely to break any extensions. 2008-07-28 23:52:55 +00:00
Brion Vibber
8cce306e05 Revert r38149 for now, causes regressions in API parsing.
Bug 14965 - https://bugzilla.wikimedia.org/show_bug.cgi?id=14965

PHP Catchable fatal error:  Argument 1 passed to Title::equals() must be an instance of Title, null given, called in /usr/local/apache/common-local/php-1.5/includes/Linker.php on line 1323 and defined in /usr/local/apache/common-local/php-1.5/includes/Title.php on line 3003 
$wgTitle isn't available in this sort of background rendering.
2008-07-28 23:00:14 +00:00
Aryeh Gregor
34bf34d923 Linker::doEditSectionLink() and Linker::doEditSectionLinkForOther() and their respective hooks are redundant and confusing. They do exactly the same thing with a slightly different interface. Their hooks are not only redundant but relatively ineffective, because they wrap in brackets and a span *after* the hook returns. This makes them useless for, e.g., changing the section edit link to an image (can't remove brackets), or using any block-level element (wrapped in a span).
Make Linker::doEditSectionLink() public, and change its interface to be like that of editSectionLink().  Use that in Parser (which is the only place that uses the old functions that I can find), and mark the old two functions deprecated.  Add a hook 'DoEditSectionLink' with a new, clean interface, which is run immediately before the return so it can override the whole function.  Advise people in hooks.txt to use the new hook, not the old ones.
2008-07-28 20:33:43 +00:00
Chad Horohoe
14a80040bf Deprecate SiteStats::admins() in favor of SiteStats::numberingroup('sysop'). Should make bug 13471 easy. 2008-07-28 15:49:44 +00:00
Aryeh Gregor
daa32e8ccb Break at 80 columns in some comments. Also improve documentation for $wgArticleRobotPolicies. 2008-07-24 18:10:35 +00:00
Aryeh Gregor
9bf022910a (bug 8068) New __INDEX__ and __NOINDEX__ magic words allow control of search engine indexing on a per-article basis. Remarks:
* Currently __INDEX__ will override __NOINDEX__ regardless of their relative positions, due to the way things are written.  Instead, the last one on the page should win.  This should be pretty easy to fix.
* __INDEX__ and __NOINDEX__ override $wgArticleRobotPolicies.  This is almost certainly incorrect, but it's not totally obvious how to fix it, because of the way the code is structured.  Probably not a big deal, but should probably be fixed at some point.
* Anyone can add and remove the magic words, and there's no config option to disable them.  It's not obvious whether this is okay or not.  It would be a one-line change to OutputPage.php to have a config option to ignore the magic words, maybe per-namespace or who knows what.
2008-07-23 19:49:46 +00:00
Aryeh Gregor
258740c2df Revert last commit for a moment, committed lots of stuff I didn't mean to. 2008-07-23 19:27:13 +00:00
Aryeh Gregor
0e7fa5b28b Follow-up to r37968: forgot to commit the change setRobotpolicy -> setRobotPolicy in extensions. 2008-07-23 19:25:48 +00:00
Tim Starling
3e541d529b Some documentation for SFH_OBJECT_ARGS 2008-07-23 14:51:39 +00:00
Tim Starling
d6f0a95465 * Split off DB load monitoring logic into a LoadMonitor class hierarchy, to allow for plugins in this area.
* Use an associative array to initialise LoadBalancer objects
* By default, use Preprocessor_DOM if available, otherwise use Preprocessor_Hash. Preprocessor_Hash has worse performance.
* Fix parserTests.php for replicated databases. Use CREATE TABLE instead of CREATE TEMPORARY TABLE if there is more than one server configured.
* Log exceptions even in command-line mode.
2008-07-07 03:31:00 +00:00
Brion Vibber
742973c85b Revert r37078, 37132 "New hook ParserBeforeTranscludeTemplate:
This hook allows for modification of the title and text of a template which is being transcluded.

Use of this hook will allow extensions to create features such as TransWiki for an alternative to ScaryTransclusions."

This hook seems a bit oddly placed to me; the template gets fetched locally, and *then* we give the opportunity to fetch it remotely instead? Just seems to be in the wrong order, and pretty unclear.
2008-07-05 22:45:37 +00:00
Daniel Friesen
1154642f75 Minor fix, $parser was passed instead of $this like it should have been. 2008-07-05 20:38:02 +00:00
Daniel Friesen
e339f61471 New hook ParserBeforeTranscludeTemplate:
This hook allows for modification of the title and text of a template which is being transcluded.

Use of this hook will allow extensions to create features such as TransWiki for an alternative to ScaryTransclusions.
2008-07-05 03:36:12 +00:00
Brion Vibber
f54ec4339e Some cleanup for r36609:
$url and $alt parameters in makeExternalImage() are now normalized to be escaped on output instead of before they reach the function. This ensures that any hooks processing them won't accidentally send plaintext which might become an injection vector, or just get confused on pre-escaped input they didn't expect.
2008-07-02 01:19:00 +00:00
Daniel Kinzler
24d5e941a0 added PPCustomFrame classes to restore ability to use replaceVariables with a custom map of values. This should unbreak some extensions that were broken by the new PP stuff, like the News extension. 2008-06-26 13:05:40 +00:00
Raimond Spekking
1701f46f07 Fix for r36587:
* Do not overwrite the previous found $tz when $wgLocaltimezone is set
* Rename message name to a more specific one
* Add message to the message files
2008-06-25 12:09:32 +00:00
Mohamed Magdy
96cc2819c7 Patch that fixes bug number 14452. patch by AhmadSherif. 2008-06-23 22:39:49 +00:00
Tim Starling
c6b902f180 * Reorganised the includes directory, creating subdirectories db, parser and specials
* Wrote a tool to check the integrity of the autoloader class list, fixed some issues that came up.
* Start the autoloader before LocalSettings.php, so that when an extension writer thinks an inefficient one-file special page extension is the way to go, they don't have to use explicit includes to make the class inheritance work. Should continue to work with $IP set in LocalSettings.php as long as $IP is set before extensions are included.
2008-06-16 20:21:26 +00:00
Renamed from includes/Parser.php (Browse further)