Commit graph

730 commits

Author SHA1 Message Date
Brad Jorsch
dc15ea106a ApiHelp: Make 'toc' parameter work
Bug: T98378
Change-Id: I0219689f621e325fc22f0eab6e4c000e1b2fa06f
2015-05-06 13:37:41 -04:00
Bartosz Dziewoński
5205405385 Emergency remove .mw-headline-anchor
Follows-up 6c7480e5f0, d2a6a73d2.

The should stop the § character from being indexed by Google et al.

Bug: T18691
Bug: T93000
Change-Id: Ie9e334e973e3ded270f1897a2c3816d9df739fc0
2015-03-17 22:31:45 +00:00
Amir E. Aharoni
3000e59762 Shorten long lines in Linker.php to make phpcs pass
Change-Id: Ia3376560dfd321252babc2ac3edd88764a16bce1
2015-03-03 22:00:32 +00:00
Bartosz Dziewoński
d2a6a73d29 Hide section anchor links from screen readers using aria-hidden
Hide from screen readers, as it is inside a heading (the programs use
headings to navigate, so the symbol is being read during navigation).
Pending T13555 being fixed.

See <https://phabricator.wikimedia.org/T18691#1076371> and
<https://phabricator.wikimedia.org/T18691#1076857> for reasoning.

Bug: T18691
Change-Id: I736cb7f52d5ce37eb7e8d3a3648ffd0bd40f2c83
2015-03-02 10:16:29 +01:00
jenkins-bot
6a3782ec14 Merge "Avoid double word-separator when using Linker::userToolLinks" 2015-02-20 08:21:46 +00:00
Vivek Ghaisas
6c7480e5f0 Add clickable link for section headers
Changed the Linker::makeHeadline function to additionally generate an
anchor that uses a section symbol. Created mediawiki.sectionAnchor
module to style the anchors and included it in SkinTemplate so that
other skins automatically get those styles.

Bug: T18691
Change-Id: I562e437ec0bd337c9db0406f5dcab504dfa37034
2015-02-19 22:53:57 +01:00
umherirrender
6dcb4408c7 Avoid double word-separator when using Linker::userToolLinks
The word-separator is already part of the return value of
Linker::userToolLinks which results in a double space when add an own
word-separator

Change-Id: Id9d3125b9cae4a92f489215dda0b32c487f3fb11
2015-02-12 18:54:18 +01:00
jenkins-bot
4d22e6ff4e Merge "Don't double escape in Linker::formatLinksInComment" 2015-02-04 07:16:20 +00:00
Niklas Laxström
acc2bcaf37 Escape unescaped messages shown in action=info
Change-Id: Id16d8c8dff73fdacad6c9a4ff7f2919945b7e893
2015-01-30 16:56:11 +00:00
Ricordisamoa
4ece7f53aa Revision: mark getRaw*() methods as deprecated
Revision->getRawUser()
=> Revision->getUser( Revision::RAW )

   Revision->getRawUserText()
=> Revision->getUserText( Revision::RAW )

   Revision->getRawComment()
=> Revision->getComment( Revision::RAW )

The body of Revision->getRawUserText() has been moved
into Revision->getUserText().
Every usage has been replaced.

Change-Id: Ic6fbfbc0507dcf88072fcb2a2e2364ae1436dce7
2015-01-18 06:57:56 +01:00
Marius Hoch
dd740a65dc Don't double escape in Linker::formatLinksInComment
Affected both the linked text and the actual URL.

For an example please see the ukwiki link on:
https://www.mediawiki.org/wiki/Special:CentralAuth/Admin

Follow-Up: Ibdedf087f85046646450367cbf1811db578d8f4b
Change-Id: Ie73796dcde4e0a096a6baa86a53245e6fe2b48b5
2015-01-15 18:14:42 +00:00
Marius Hoch
d14f6c0de3 Make Linker::formatLinksInComment format links to other wikis
Needed for CentralAuth.

Change-Id: Ibdedf087f85046646450367cbf1811db578d8f4b
2015-01-09 11:22:31 -08:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Aaron Schulz
4ff8136807 Removed remaining profile calls
Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
2015-01-08 02:49:33 -08:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Brad Jorsch
29951907f7 Format multiple autocomments in edit summaries
Before r39373, all autocomments in an edit summary were formatted. In
fixing a bug with page titles containing "/*" this was accidentally
broken.

To use a single preg_replace_callback call to replace multiple
autocomments, we need to make sure that the match of one autocomment
doesn't overlap the match of another, which means we can't have "(.*)"
before and after. But we do still need to detect whether there is
anything before or after. "(?=(.?))" and "(?<=(.?))" would do nicely,
except the latter isn't actually supported. "(?=(.))?" and "(?<=(.))?"
work too, but older versions of PCRE don't support that. They do,
however, support "(?:(?=(.)))?" and "(?:(?<=(.)))?", so that's what
we'll go with.

This change does change the values for $pre and $post passed to the
FormatAutocomments hook; extensions need to be updated to accept (and
not prepend/append) booleans for these parameters.

Bug: T18530
Bug: T70361
Change-Id: I36c3a9e548a4ef72f93974bb35f9add8c29e9287
2014-12-31 10:24:05 +11:00
Niklas Laxström
4741900b5e Escape unescaped messages shown on a diff page
Change-Id: I05c07625a2dbb3c5d3ab46d1cfafeaed6a248bba
2014-12-18 20:01:32 +00:00
Ricordisamoa
fc5fd5c37a Typo fixes and non-code tweaks
Skipped replacements:
* prefered → preferred
* prolly → probably

Skipped files:
* resources/lib/jquery.ui/jquery.ui.mouse.js
* resources/lib/jquery/jquery.form.js

Change-Id: Ib7923f362ddfca1b892bf5d601785d6b5aa5d44c
2014-12-12 18:31:15 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
jenkins-bot
478272b6e5 Merge "Consistently handle trailing slashes in subpage links." 2014-11-17 17:05:58 +00:00
Bartosz Dziewoński
3e85dfb8ad Standardize indentation of multiline 'if'/'elseif' conditions
Always indent the continuation one level deeper, and always place the
closing parenthesis on the next line, per coding conventions.
https://www.mediawiki.org/wiki/Manual:Coding_conventions#Indenting_and_alignment
https://www.mediawiki.org/wiki/Manual:Coding_conventions#Line_continuation

Regexp used: (\t+)(if|while|\} elseif|foreach).+(?<![;}])\n\1\S

Also:
* Change to just one line if line length stays under 100 characters.
* Add "// Do nothing" comment in empty 'if' bodies.
* Change '#' comments to '//' comments near affected code.

Change-Id: I4f62658fddb5a0ed18bbf9b2231cd794683d6402
2014-11-17 15:33:34 +00:00
C. Scott Ananian
8a797162f0 Consistently handle trailing slashes in subpage links.
The link text for [[/Foo/]] is `Foo` and the link text for
[[../Foo/]] is `Foo`.  So far so good.

But the link text for [[/Foo//]] is `Foo` while the link text
for [[../Foo//]] is `Foo/`.  We are stripping all trailing slashes
in the first case, but not the second.

Fix the code so that we strip all trailing slashes in both cases.
Update some of the comments in the code while we are at it.

Change-Id: Id61eacafea9820c404699a7902c8eb8102779516
2014-11-14 17:09:00 -05:00
aude
7c023b5771 Deprecate rarely or unused *LinkAttributes methods in Linker
Linker::getInterwikiLinkAttributes and Linker::getInternalLinkAttributesObj
are not not used any code in gerrit.

Linker::getInternalLinkAttributes is used once, in the Video extension.

Change-Id: I76d9b549e0fdccb9c1b4d9c12ba40a67c2733637
2014-11-13 17:19:38 +01:00
aude
203c5baf12 Remove deprecated Linker::getExternalLinkAttributes method
deprecated since 1.18 and unused anywhere else in
core or all the extensions in gerrit:

https://github.com/search?utf8=%E2%9C%93&q=getExternalLinkAttributes+%40wikimedia&type=Code&ref=searchresults

Change-Id: Id5ae9186b3a83672c8310adb5dfdaf07bfec3d74
2014-11-13 14:39:16 +01:00
Kevin Israel
36c0da63cd Replace a few more logical operators
Changed all remaining uses of 'and' (T_LOGICAL_AND) and 'or'
(T_LOGICAL_OR) except those in includes/libs/lessc.inc.php.

In maintenance/generateSitemap.php, also slightly cleaned up
touched code:

* Inlined GenerateSitemap::init_path().
* Removed the redundant `$fspath && !is_dir( $fspath )` check.
* Return a nonzero exit code if wfMkdirParents() fails.

There are still uses of 'xor' (T_LOGICAL_XOR) in the following
files, which I left as-is:

* includes/Export.php
* includes/htmlform/HTMLCheckField.php
* includes/Autopromote.php
* maintenance/importDump.php
* maintenance/backup.inc

Change-Id: I73cb20da989e90b52782e7499f633debd5ad265d
2014-10-24 11:41:00 -04:00
Chad Horohoe
6c30fff0ba Swap and for &&
Change-Id: I7821a62586cc2d2f929fb3d7d5046958a70efbd0
2014-10-23 13:03:14 -07:00
Niklas Laxström
368a948bb6 Make linker warning useful
Follow-up to I4c397de289ae51bc463b5ae

Change-Id: I4695172b13988fc333707e09fc9d909f20adb7c1
2014-09-23 09:13:33 +02:00
withoutaname
d89deb8466 Enforce some type hinting in Linker class
Specifically for link(), linkText(), makeImageLink(),
and makeBrokenImageLinkObj() functions

Change-Id: I4c397de289ae51bc463b5ae7c2968703d1424368
2014-09-15 18:55:57 -07:00
Brian Wolff
c2665e2cb2 Make sure processResponsiveImages checks for valid thumb object
If the thumbnail is an error (or worse yet, if the MediaHandler
returns false, like TMH does in certain circumstances), we
should not add responsive thumbnail links.

Change-Id: I2aafbd07e8435ce2d1b4cb32e49e98cb5f6c00ab
2014-09-14 21:40:27 +00:00
Stephan Gambke
f09e458d39 Fix for Ia9baaf0b: Make previously public variables public again
Change Ia9baaf0b changed the visibility of member variables (many of which are not
otherwise exposed, e.g. by a method) and by that introduced a major API change
breaking extensions.

This patch explicitly marks affected variables as public again, keeping the intent
of the original patch of making phpcs-strict pass on includes/ directory.

Bug: 67522
Bug: 67984
Change-Id: I498512b2a1e615365bb477c1fd210aaa3241ca03
2014-08-29 23:01:53 +02:00
jenkins-bot
abb5869cba Merge "Check for error before outputting srcset urls" 2014-08-28 07:35:17 +00:00
umherirrender
51adb81e6e Add some @see to doc blocks
This avoids repeating the @params for the functions

Change-Id: Ie1f4488a0a7aa30ab128b9ea7ff6f3af12a88884
2014-08-24 11:19:32 +02:00
umherirrender
83561c5ca7 Correct type of @param of Linker::getRevDeleteLink
Change-Id: Ie382e2f7b68e27f56de469bfead1588b97b5f9c3
2014-08-20 06:25:16 +00:00
Bartosz Dziewoński
4f056b4e15 Generate 'Enlarge' image in CSS rather than HTML (Linker)
There is an ungodly number of requests for magnify-clip.png, embedding
it in CSS is probably good for performance.

It also makes it a lot easier to change the icon, or provide a vector
version (SVG or icon font).

We need to be careful to keep new CSS compatible with old HTML (HTML
is cached for up to 30 days in WMF environment), but luckily in this
case this requires just one CSS rule. Follow-up to remove it: I7a920105.

Bug: 69673
Change-Id: I849a2222fdf708573e54fa0658dbef4d9f2f665f
2014-08-19 23:14:02 +00:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
jenkins-bot
3ff03a1ccd Merge "Fixed spacing" 2014-07-24 12:49:17 +00:00
umherirrender
4ee680a8b3 Fixed spacing
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts

Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
2014-07-24 11:53:04 +02:00
umherirrender
7ff005407e Remove colon after @deprecated/@param/@todo/@note
Change-Id: I4e66dad85eecf7e8e03ac760af900395e1bc11b6
2014-07-24 11:30:25 +02:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
Brian Wolff
3f659fb963 Check for error before outputting srcset urls
If $thumb returns a MediaTransformError object, then $thumb->getUrl()
will return false, which will result in srcset="1.5x, 2x".

Bug: 67081
Change-Id: Idb6bbff6995536d20dac67ce12592f68f6d1235a
2014-06-25 21:48:16 -03:00
umherirrender
b4cfdb9dd9 Use anonymous function in Linker::formatAutocomments/formatLinksInComment
A anonym function has no own scope, so it is not possible to call the
private callback, so moved the code of the callback into the function.

This avoids passing parameters with static variables to the callback.

Change-Id: I41ad85545301f6699817135b7e8ceba0f8b26851
2014-06-10 20:32:23 +00:00
Tim Starling
4ba7a9c102 Revert "Use square bounding boxes for default-sized thumbnails"
Reverting for further discussion, due to community complaints at https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=611154541#Infobox_Image

This reverts commit 7db5534179.

Change-Id: Ieea6224b2a295b5d65bbd486e30cf0573376c7e9
2014-06-02 11:24:09 +10:00
jenkins-bot
27f8aa732e Merge "Add SelfLinkBeginHook" 2014-05-28 22:07:37 +00:00
cicalese
4202d4a881 Add SelfLinkBeginHook
Called before a link to the current article is displayed to allow the display
of the link to be customized.

Bug: 63592
Change-Id: I343e1b1b08ec841d22a1b22bcb8af43bb65a5a50
2014-05-27 19:54:44 -04:00
C. Scott Ananian
7db5534179 Use square bounding boxes for default-sized thumbnails
Thumbnails for portrait-orientation images have always been "too big",
especially when displayed in a gallery.  The 'upright' option did not
completely fix the issue.  Using a square bounding box for thumbnails
(and 'framed' images) without an explicit size specifiction provides
a better default appearance.

This also provides a clean syntax for content authored using
Parsoid/Visual Editor, which prefers square bounding boxes.

See:
https://www.mediawiki.org/wiki/Requests_for_comment/Square_bounding_boxes

Bug: 63903
Change-Id: I665d8945843d3b5437a74e376b63c44965590116
2014-05-21 14:30:06 -07:00
Siebrand Mazeland
a7fbdd6503 Make phpcs-strict pass on includes/ (7/7)
Change-Id: Ia9baaf0b3cdbe1a3c6b50ef8c4fe86fead88f909
2014-05-15 20:07:09 +02:00
jenkins-bot
4a4c242085 Merge "Linker.php: Do not double escape accesskey in tooltip" 2014-05-14 18:31:00 +00:00
Fomafix
416ec6298a jquery.accessKeyLabel: Replace hardcoded brackets and space
Since If914e26f2af23f04c46f011ad8a276a9d3190583 the brackets of the
accesskey are localized, so do it also on the client side.

Also added a comment to match php and js.
Adjust tests to work on wikis with changed messages.

Bug: 65010
Change-Id: Id9908b9efcb923f0b740e2c8fd77d1ef676b489f
2014-05-13 18:23:05 +00:00
Brion VIBBER
7bbc880626 Merge "Allow mobile to reduce image quality" 2014-05-09 21:50:47 +00:00