Restore deprecation warnings from 1.16. The methods Linker::makeLinkObj
and Linker::makeKnownLinkObj should be replaced by calls to link().
Change-Id: I658289ac2b52a193b76edd946368e228cfa389cb
Moved the logic from the old static User::edits() into
User::getEditCount() and deprecated User::edits() as it's
not following the class hierarchy.
Change-Id: Id2b939ffb903accb8f4dc132a6ac6b6576f81beb
* adds $wgResponsiveImages setting, defaulting to true, to enable the feature
* adds 'srcset' attribute with 1.5x and 2x URLs to image links and image thumbs
* adds jquery.hidpi plugin to check pixel density and implement partial 'srcset' polyfill
** $.devicePixelRatio() returns window.devicePixelRatio, with compat fallback for IE 10
** $().hidpi() performs a 'srcset' polyfill for browsers with no native 'srcset' support
* adds mediawiki.hidpi RL script to trigger hidpi loads after main images load
Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload.
Confirmed basic images and thumbs in wikitext appear to work in Safari 6, Chrome 21, Firefox 18 nightly on MacBook Pro Retina display, and IE 10 in Windows 8 at 150% zoom, 200% zoom, and 140% and 180%-ratio Metro tablet sizes.
Internally this is still a bit of a hack; Linker::makeImageLink and Linker::makeThumbLink explicitly ask for 1.5x and 2x scaled versions and insert their URLs, if different, into the original thumbnail object which (in default handler) outputs the srcset. This means that a number of places that handle images differently won't see the higher-resolution versions, such as <gallery> and the large thumbnail on the File: description page.
At some point we may wish to redo some of how the MediaHandler stuff works so that requesting a single thumbnail automatically produces the extra sizes in all circumstances. We might also consider outputting a 'srcset' or multiple src sizes in 'imageinfo' API requests, which would make ApiForeignRepo/InstantCommons more efficient. (Currently it has to make three requests for each image to get the three sizes.)
Change-Id: Id80ebd07a1a9f401a2c2bfeb21aae987e5aa863b
Added new argument to the Linker options array to allow
the forcing of an HTTP or HTTPS protocol. In order to facilitate
this, a protocol argument was added to Title::getLinkURL.
Also, an options argument was added to OutputPage::addReturnTo
so that options can be passed to the linker and so that the
returnto URL can be forced to a certain protocol.
Change-Id: Ia9cc11e310ad6ef23c221bdba3a4834e7c5556e7
Adds htmlspecialchars encoding to the link label, passed
into Linker::makeBrokenImageLinkObj.
This fixes a stored XSS (HTML injection) vulnerability.
* Released as part of 1.20wmf10, 1.19.2, 1.18.5
Change-Id: I0e5f9eeb1f3561b1354aecced74f68ae2fa20dfa
The $lang parameter defaults to false, but Message::inLanguage() doesn't
like false, so do an explicit check for false.
Change-Id: I66fb2d11269a988ae92b1594314807a4eed54f1b
If we detect and warn that the $query parameter is in an incorrect
format, we may as well convert it to the correct one.
Change-Id: Ief137ab758c65ec562c2a523f76b1a4f8c2617b5
Add Parser's extLinkAttribs attributes when an image has a link
parameter, when generating the html. Currently, these may include
rel="nofollow" and the target attribute.
This will correctly add rel="nofollow", respecting $wgNoFollowLinks,
$wgNoFollowDomainExceptions, and $wgNoFollowNsExceptions settings.
Updated parser tests for expected results, added new tests for
$wgNoFollowLinks and $wgNoFollowDomainExceptions exceptions.
Change-Id: Ib4677760ec78a3f0c4ba781d893e0484cc8db3ed
The alignment of image thumbs should follow the page content language instead of the wiki content language.
For this it needs the parser context, and because it makes sense to have it as first parameter, I renamed makeImageLink2() to makeImageLink(), the 2 seemed to be redundant anyway.
The old function name keeps the old behaviour, but can be removed quite soon since almost no extension is using it.
Change-Id: I0c35b06a85528dcc43fdd0578dc9b327c495cf4a
This change replaces I85f480726b41871cdf5349a19e3f650285d1dda6 (includes
the change of Catrope).
Add a feature to disable the rollback edit count (change
9bae2198c9) on special pages. Default it
will be disabled on Recentchanges and Watchlist.
Change-Id: Ifbbf802472ce678694b2b3ba4ef441344cc1d572
Add an edit count to rollback link to show how many edits will be
rollbacked. When the count is over 10 the text "more than 10 edits" will
be outputed.
Change-Id: I5c4050e0a9197d4c505e85685a9780c97138d427
There's no point doing potentially expensive checks (exists() and
getLength()) if the page is simply not in a content namespace.
Change-Id: I86a2b3a36071cf508b8e99ef20bdf3e0e20f3c82
This allows both methods to not always rely on global object, but also to use the local context when possible.
Change-Id: Id10f55ed9b18c889afd8d9937d9f35acb376cce4
Removed some spurious whitespace
Changed how wfRunHooks are used, and also the test for default formatting
Change-Id: I4c3fc1080f83166d7b89aeb9a1487e173e9ccb65
This method will use two new messages 'invalidtitle-knownnamespace' and 'invalidtitle-unknownnamespace' depending on the fact that the given namespace number exists or not.
I did put that method in Linker because I plan to use it in various places, notably in other QueryPage and Pager subclasses.
Change-Id: I13e7cdc2c0a8e86dc5e4b144b6012f3864d2ec06
When doing a change that break tests, update the tests in the same
commit. That makes the change more obvious and let us merge in
another branch easily.
Fixed this by "abusing" of the $options parameter of Linker::link() to pass the Language object (as we did for wfMsgExt()), has the two following advantages:
* The tooltip is displayed in the requested language instead of depending on $wgLang
* The usage of the Language object is detected in the ParserOptions, thus the parser cache key will not have "*" for the language
* Pass the User object to Revision::userCan() in Linker::getRevDeleteLink()
* Return the result Linker::revDeleteLinkDisabled() in Linker::getRevDeleteLink() instead of storing it in a variable that will not be used
PHP Notice: Use of Linker::makeLinkObj was deprecated in MediaWiki 1.16. [Called from call_user_func_array in (internal function)] in /www/w/includes/GlobalFunctions.php on line 3520
PHP Notice: Use of Linker::makeKnownLinkObj was deprecated in MediaWiki 1.16. [Called from call_user_func_array in (internal function)] in /www/w/includes/GlobalFunctions.php on line 3520
Was marked deprecated with r42702 although that helper makes code a bit
nicer:
Linker::tooltip( 'message' );
Xml::expandAttributes( array(
'title' => Linker::titleAttrib( 'message' )
) );
(the later would give you 'title=""' when 'tooltip-message' message does
not exist.
This shouldn't cause any back or forward compat issues since php treats method names as case-insensitive. So this change shouldn't break any old extensions, and extensions are free to start using getLinkURL and won't have any issue breaking with old versions of MediaWiki.
PHP fatal error in /home/wikipedia/common/php-1.18/includes/Linker.php line 831:
Argument 1 passed to Linker::makeMediaLinkObj() must be an instance of Title, null given, called in /home/wikipedia/common/php-1.18/includes/Linker.php on line 1221 and defined
He suggested protected, because of the @private comment, but as we have made more methods public static in the Linker class recently, this seems appropriate.
Breaks unit tests as below, not going to be able to fix them before I disappear for the evening, so might aswell leave trunk clean
ArticleTablesTest testbug14404
Error:
ArticleTablesTest::testbug14404
Undefined offset: 0
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/ArticleTablesTest.php:31
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60
ParserTests testParserTest #552 - testParserTest with data set #551
Failure:
ParserTests::testParserTest with data set #551 ('RAW magic word', '{{RAW:QUERTY}}', '<p><a href="/index.php?title=Template:QUERTY&action=edit&redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
</p>', '', '')
RAW magic word
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-<p><a href="/index.php?title=Template:QUERTY&action=edit&redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
+<p><a href="/index.php?title=Template:RAW:QUERTY&action=edit&redlink=1" class="new" title="Template:RAW:QUERTY (page does not exist)">Template:RAW:QUERTY</a>
</p>
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/parser/NewParserTest.php:545
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60
Definitely shows different padding with the old cached markup and new styles in FF 5 though it's not a huge difference. Haven't tested in other browsers; IE needs testing in particular as it has funky special style bits.
Recommend:
* old markup should work uncahnged with the new styles -- this avoids any transition problems
* secondarily, consider updating parser cache version to force updates .... but you'd still want to do the above for pages that have been HTTP-cached!
* test all these renderings in all supported browsers and confirm that all is well with old & new markup
Patch by Aryeh Gregor, updated by Roan Kattouw, and updated again by me. I also fixed one bug with modern.css.
Tested in IE6,7,8, Chrome & FF in all skins and both LTR and RTL contexts. I tested with floating images above and below the headers and couldn't find regressions.
commentBlock() exists for the sole purpose of embedding a comment into parentheses if it exists so you can append it to a line of text -- if you're not putting stuff in parentheses, don't use commentBlock() because you're not generating a parenthesized comment block.
Opaque boolean parameters are also very poor form, especially when tacking on multiple ones. There was already a nasty optional '$local' boolean param, forcing all uses of this other parameter to add *two* parameters, making illegible stuff like 'false, false'.
PHP Notice: Use of Linker::makeLinkObj is deprecated. [Called from call_user_func_array in (internal function)] for /w/i.php?title=Special:RecentChanges&translations=filter<ul>
<li>- line - calls Linker::makeLinkObj()</li>
<li>Skin.php line 1552 calls call_user_func_array()</li>
<li>- line - calls Skin::__call()</li>
<li>Renameuser.php line 58 calls SkinVector::makeLinkObj()</li>
<li>- line - calls wfRenameUserLogActionText()</li>
Also make a few changes to the functions available. SpecialPageFactory::resolveAlias() now takes an optional subpage and returns array(<name>,<subpage>). Similarly merge getPage() and getPageByAlias(). There were many examples of (extensions particularly) making dubious assumptions about the presence or absence of subpages or canonical-ness.
I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred calls. I'm rather undecided on the best position of getPage()/executePath(). Although the latter needs cleanup anyway.
Patch to ca, kaa linktrails to exclude multiple apostrophes by Platonides: https://bugzilla.wikimedia.org/attachment.cgi?id=8337
Added parser test cases to confirm that the linktrail apostrophe works on those languages, and to confirm that the bug where a link is surrounded by bold or italics is resolved.
Tweaked Linker::splitTrail() to keep it from permanently caching $wgContLang's linktrail; when we change content languages during a script run as we do with parser tests, that was leaving us stuck forever on English's linktrail.
This may slightly slow down that path, since it'll have to make a couple brief function calls into the Language object and its data cache.
* Made FlaggedRevs specify files by sha1,timestamp to handle renames with no redirects. This makes them handled as well as templates in this regard. (bug 27836)
* Moved BeforeGalleryFindFile hook to proper place (don't trigger for non-NS_FILE titles)
* Removed unused mRevisionId field from ImageGallery
* Removed old hotfix from makeMediaLinkObj(); all the current callers would crash beforehand if the title was null anyway
* Updated hook docs (some prior params were missing)
* Broke some long lines and cleaned up some whitespace
* TODO: track file info in core rather than fr_fileSHA1Keys and ugly, duplicated, queries. This should be easy to do now.
Was a double escape in Linker::makeBrokenImageLinkObj. I checked the callers and other usages in the function and $prefix and $inside appear to be assumed HTML fragments
Added parser tests: Passed 622 of 624 tests (99.68%)... 2 tests failed! Those two tests already failed for me before this patch
* Linker::postParseLinkColour() - 1.5 (r8662)
* Linker::editSectionLink() and editSectionLinkForOther() - 1.14 (r38161)
Linker::tooltip() and Linker::tooltipWithAccessKey() are old, but still used all over the place.
has a % sign in it, but interperted as a + if no % sign is present.
This changes how the parser interperts links slightly. However:
*I can't imagine anyone is relying on this behaviour
*Things should be consistent. a + sign shouldn't magically change meaning
if there is a % sign somewhere else in the link.
*Pages are allowed to contain % signs in their title, and + signs,
you should be able to link to such pages just by typing there name without
resorting to %2B.
*If you have a page named foo%+ having [[{{PAGENAME}}]] link to a different
page seems inherently wrong.
*The previous behaviour seemed accidental.
Bug 24835. The use of <a> made the parser put <p> around the tag, so
use <div> instead. (Something was also adding a name="" attribute, but
I'm not sure what. That should be killed.)
r70433 addressed the UI. Here we proxy its access via a new method getStubThreshold() that disables it if a page of such size cannot be
created (by an user), so we can serve them parser cached articles again.
Deprecate makeSizeLinkObj. The only usage is in CategoryPage, which we can change to link() without penalty, since the created Title is already loaded with its length.
* Fixed the coding style and escaping of some nearby code. The lack of escaping on $url would have caused invalid HTML (bare ampersand) if ugly URLs were combined with page parameters.
Pretty italics mean that italics go across links: ''Some [[Link|pretty ''italics'' and stuff]]! -> ''Some [[Link|pretty ''italics'' and stuff]]! -> <i>Some <a>pretty <i>italics</i> and stuff</a>!</i>
This also fixes bug 24093, where interface messages saying '''[[$1]]''' has been deleted/renamed/links here were being bitten by this feature.
The best resolution would be to make pretty italics still work inside alternates, feel free to do so, but doesn't seem worth at this point. The right solution should be to rewrite the quotes handling so it takes its scope into account.
Before this change, there were (? being regex 0 or 1)
"" ===? 1
'' ===? 24
"" !==? 8
'' !==? 32
== "" 14
== '' 344
!= "" 9
!== "" 4
!= '' 151
!== '' 85
Rhs was the much more common, and the preferred style by many developers.. (Was a similar discussion in #mediawiki recently.. After that lolbugreport i think)
Where there is a string (non empty) on the lhs, and variable/method call on the rhs still need normalising
$wgUploadNavigationUrl now also affects images inline images that do not
exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to
it as appropriate.
* Add support for edittools
* Add support for multipart/form-data
* Set id for wpEditToken
* Add support for tooltip and accesskey
* Allow setting a name for the submit button
* Give sections an id
Introduced helpers:
$lang->getDir() returns 'ltr' or 'rtl' for HTML 'dir' attrib
$lang->alignStart() returns 'left' or 'right' for HTML 'align' attrib or CSS 'text-align' property
$lang->alignEnd() returns 'right' or 'left'
And cleaned up a couple arrays of icons to just reverse the order of items rather than repeating the items twice for each possibility.
These should all theoretically be covered by the parser tests. All
tests pass, the only change needed was to account for less overescaping
in Html::expandAttributes(). There's no reason to escape <>' in
"-quoted attributes, unless I'm mistaken and have just added some XSS.
* Fixed the formal parameter bloat in the file finding functions by making wfFindFile(), RepoGroup::findFile() and FileRepo::findFile() take an associative array of options instead of a rapidly growing collection of formal parameters. Maintained backwards compatibility for the $time parameter, which was the only one used in an extension.
* Took the advice of the todo comment on FileRepo::findFiles() and implemented a calling convention for specifying times (and other options)
* Removed the file object cache from Parser, redundant with the RepoGroup file cache
* Deleted clueless and non-functional LocalRepo::findFiles(). Does not respect redirects, deletion bitfields, or anything else nuanced about FileRepo::findFile(). Does not have the same calling convention as FileRepo::findFiles().
This time done in a nice, centralized fashion, reducing LOC for callers
even if HTML 5 is disabled. The implementation is a new Html class,
similar to Xml but intended to be HTML-specific from the beginning
instead of half-heartedly attempting to provide generic XML services but
actually with lots of HTML-specific stuff tacked on.
As part of the new Html class, a global config option $wgWellFormedXml
is added. It's set to true by default, but if set to false, the Html
class will drop some things that HTML 5 doesn't require, like
self-closing " />" syntax and attribute quotation marks (sometimes).
The summary attribute is obsolete in HTML 5. It wasn't serving any
useful purpose anyway, since it duplicated the h2 inside the table. (Of
course, we should really stop using <table> for TOCs altogether!)
Moved Parser::maybeDoSubpage guts to Linker to call from both locations.
Added some parser test cases.
Note that this might not behave exactly like the main parser in cases where the link text would get altered, but the links are functional. Yay!
* Always generate the section tree, even when we're not generating a TOC
* Add Parser::mergeSectionTrees() to merge two section trees into one
* Add Linker::generateTOC() to generate the HTML for a TOC from a section tree, and add the section anchor to the section tree to facilitate this. This adds the ability to generate TOCs in extensions; haven't converted Parser.php to use it (yet?). As a side effect, this fixes API bug 18720
* Add TOC HTML to ParserOutput
* Add class tocsection-$section to <li> elements in the TOC representing sections in the current page (as opposed to transcluded sections)
* add FIXME where I was not able to replace a deprecated method
* add doxygen @deprecated where wfDeprecated() was present, but not the doc
Should conclude replacing or tagging remaining deprecated Linker::make*Link*() in core. Linking to r51559 for code review
* Fails to explain purpose of patch
* use of SQL variable interpolation without using standard encoded variable naming convention; looks unsafe and makes review harder
* Code has issues already noted; follow-up code was also reverted.
Code needs a little more cooking I think. :)