Commit graph

53 commits

Author SHA1 Message Date
Sam Reed
15df9a9d5c Kill off the long deprecated $wgInputEncoding and $wgOutputEncoding globals 2011-05-06 22:09:47 +00:00
Sam Reed
5db2450c55 Documentation
Remove unused variables
2011-05-04 21:23:25 +00:00
Mark A. Hershberger
b3df4babc2 misc w/s cleanups, “svn diff -x-w” clean 2011-03-08 18:12:17 +00:00
Daniel Friesen
95e6386122 Html::expandAttributes( array( 'foo' => null ) ); ' foo=""' -> ''
Outputting ' foo="" on `foo = null` promotes the writing of overly verbose code to avoid it, and ugly methods like our old Linker::getLinkAttributesInternal, both of which are completely counter to the purpose of Html::.
2011-02-05 20:28:04 +00:00
Jeroen De Dauw
36f4b7a6e6 Added since notice to indicate method was not present in MW 1.16 yet 2011-01-20 19:26:30 +00:00
Sam Reed
84fed26fd4 Add missing credits from r75975
Remove a few unused array keys in API foreach loops

Remove part of Html::Hidden comment
2010-11-06 15:10:18 +00:00
Alexandre Emsenhuber
85e0c158ee * Standardised file description headers
* added @file where needed
* added file description headers where needed
2010-10-23 14:16:26 +00:00
Sam Reed
ecf56c33fa Braces and spaces 2010-09-04 03:43:33 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +00:00
Niklas Laxström
55493f65e8 Introduce $wgBetterDirectionality that lets us work on support for rtl ui in ltr wiki and vice versa. 2010-07-08 13:34:03 +00:00
Aryeh Gregor
45db6ec98d Use <!DOCTYPE html> unconditionally
See r67090 for context.  Everywhere that I've found this breaking
well-formedness is fixed.  Tested with the following Python:

import xml.sax
class Myhandler(xml.sax.ContentHandler):
    pass

h = Myhandler()
for page in ('BrokenRedirects', 'Deadendpages', 'DoubleRedirects', 'Longpages', 'Ancientpages', 'Lonelypages', 'Fewestrevisions', 'Withoutinterwiki', 'Protectedpages', 'Protectedtitles', 'Shortpages', 'Uncategorizedcategories', 'Uncategorizedimages', 'Uncategorizedpages', 'Uncategorizedtemplates', 'Unusedcategories', 'Unusedimages', 'Unusedtemplates', 'Unwatchedpages', 'Wantedcategories', 'Wantedfiles', 'Wantedpages', 'Wantedtemplates', 'Allpages', 'Prefixindex', 'Categories', 'Disambiguations', 'Listredirects', 'Userlogin', 'CreateAccount', 'Blockip', 'Ipblocklist', 'Unblock', 'Resetpass', 'DeletedContributions', 'Preferences', 'Contributions', 'Listgrouprights', 'Listusers', 'Activeusers', 'Userrights', 'Newimages', 'Log', 'Watchlist', 'Newpages', 'Recentchanges', 'Recentchangeslinked', 'Tags', 'Listfiles', 'Filepath', 'MIMEsearch', 'FileDuplicateSearch', 'Upload', 'Statistics', 'Allmessages', 'Version', 'Lockdb', 'Unlockdb', 'LinkSearch', 'Randompage', 'Randomredirect', 'Mostlinkedcategories', 'Mostimages', 'Mostlinked', 'Mostlinkedtemplates', 'Mostcategories', 'Mostrevisions', 'ComparePages', 'Export', 'Import', 'Undelete', 'Whatlinkshere', 'MergeHistory', 'Booksources', 'Blankpage', 'Blockme', 'Emailuser', 'Listadmins', 'Listbots', 'Movepage', 'Mycontributions', 'Mypage', 'Mytalk', 'Revisiondelete', 'RevisionMove', 'Specialpages', 'Userlogout'):
    xml.sax.parse("http://localhost/git-trunk/phase3/index.php?title=Special:" + page, h)

I had to manually skip some of these for unrelated reasons, but none of
them became malformed because of this commit.  Also tested the main page
and Special:Random a bunch of separate times.  There are probably other
well-formedness errors lurking, but they can be fixed as they're
reported.
2010-06-30 23:08:49 +00:00
Aryeh Gregor
76a543ea30 Disable form validation more thoroughly
Expands on r67283 by not using any HTML5 input types either, except
search.  Otherwise you'd still have problems when changing integer
fields in Special:Preferences, say.  Sad, since in Opera it had a cute
little widget for incrementing/decrementing, and types like email have
some neat effects on platforms like the iPhone (see
<http://diveintohtml5.org/forms.html#type-email>).  But there's no other
way to disable the constraints these impose without using JS, and given
how broken WebKit is right now . . .
2010-06-30 22:14:36 +00:00
Aryeh Gregor
9fb4b59f35 Don't allow boolean HTML5 attribs into XHTML1
The code didn't handle the case where a non-associative array was passed
for the attributes, like array( 'autofocus' ) instead of array(
'autofocus' => '' ).  In retrospect, allowing this syntax was a bad
decision and I wish I hadn't.  Associative arrays shouldn't pretend to
be lists.  Probably too much trouble to change it now.
2010-06-11 21:57:20 +00:00
Aryeh Gregor
14da10c663 Update boolean attribute list from HTML5 draft 2010-06-07 21:07:13 +00:00
Aryeh Gregor
e347b2bab5 (bug 23769) Disable HTML5 form validation for now
Is implemented in recent WebKit but with no UI, so it's worse than just
giving a server-side error.  The only other implementation right now is
Opera and its UI is pretty ugly, so not yet worth the effort to do UA
sniffing.  Will backport to 1.16, as a regression fix.
2010-06-03 17:18:21 +00:00
Chad Horohoe
af304dfd44 (bug 23440) Add "selected" to $boolAttribs 2010-05-09 09:32:43 +00:00
Niklas Laxström
0e3ed4741c Installer is no longer hardcoded to xhtml doctype
Refactored the doctype and html tag building into Html::htmlHeader()
from OutputPage.
2010-05-08 13:45:14 +00:00
Aryeh Gregor
eefe1b13a3 Omit some start/end tags if not well-formed XML 2010-03-21 05:12:02 +00:00
Niklas Laxström
e1065a1d57 Little docs to help developers keep track of versions... 2010-02-24 16:06:55 +00:00
Aryeh Gregor
23bc48ea35 Fix comment, remove unused global 2010-02-21 01:44:25 +00:00
Chad Horohoe
02a59dce9f Use isset() instead of array_key_exists() 2010-01-27 19:14:18 +00:00
Aryeh Gregor
010c456825 Merge all skins' output of opening <body> tag
This fixes a few minor discrepancies, like Vector outputting dir=""
(redundant to the one on <html>), and non-Monobook-based skins omitting
the capitalize-all-nouns class (!).  This adds Html::openElement() and
refactors Html::rawElement() accordingly, so I checked that all parser
tests still pass.

I wasn't able to figure out if I broke some feature of right-floating
quickbars in the Standard skin, because I wasn't able to figure out what
the feature was in the first place.  Hopefully either it works, or
nobody cares, or someone else will figure out what it was supposed to
do.  (This is the stuff in getBodyOptions() in Standard.php I deleted;
I'm not sure the addition to sticky.js does what I want.)
2010-01-15 01:16:52 +00:00
Raimond Spekking
18ed54d077 Tweak 'HMTL 5' -> 'HTML5' per suggestion on translatewiki: http://translatewiki.net/wiki/Thread:Support/HTML5
See http://en.wikipedia.org/wiki/HTML5 too.
2009-12-30 07:08:52 +00:00
Aryeh Gregor
e71ffbd5ba maxlength=200 for page move summary in HTML5
Bug 16921.  maxlength is not allowed on textareas in HTML4, so this only
works in HTML5.  Note that Firefox 3.5 and Opera 9.22 ignore the
attribute (didn't test IE), so this isn't a complete fix.  Recent WebKit
does respect the attribute (tested in Chrome 4).

Of course, the length limit of 200 is a hack, just like for edit
summaries, and we really need to move to a non-varchar(255) backend for
all these fields.

Relevant to r45517, r45571.
2009-12-15 00:11:47 +00:00
Aryeh Gregor
5d768de96e Fix bugs in r59360, r59361, r59363
* spellcheck is not a boolean attribute; it is an enumerated attribute
  whose possible values are "true" and "false".  If it were boolean, the
  permitted constructs would be <input spellcheck>, <input
  spellcheck="spellcheck">, and <input spellcheck="">, which would all
  set it true, and it would only be set to false if omitted entirely.
  (It would be boolean if HTML5 had invented it, but can't be for
  historical reasons.)
* spellcheck is valid on any HTML element, not just input, and so should
  be stripped on any element.

For reference, a table of all HTML5 attributes can be found at:

<http://www.whatwg.org/specs/web-apps/current-work/multipage/section-index.html#attributes-0>
2009-12-11 19:01:16 +00:00
Daniel Friesen
fa3aa9653e EditPage refactor and improvements.
- EditPage::showEditForm broken up into task specific methods
- Subclasses can indicate they can't support section mode
- Standard inputs should all be now in methods they can be grabbed from by subclasses that want to re-arange things
- Many more places to override and hook into to change behavior
- showTextbox1 parameters changed from $classes to $customAttribs and $textoverride
- showContentForm and importContentFormData added; New workflow to override the wpTextbox1 behavior to use an alternate edit form ui or handle wpTextbox1 content in an alternate way.
- getActionURL added for EditPage subclasses used in places where $this->action isn't enough (ie: EditPage on special pages)
Html::textarea added
2009-12-02 07:22:29 +00:00
Sam Reed
258009f383 Further followup to r59360
Add spellcheck to html5attribs for blacklisting

Switch from xml to html input
2009-11-23 19:16:43 +00:00
Aryeh Gregor
0120d492b0 Escape '<' in attribute values for well-formed XML
This fixes r56407, which fixed bug 20655.  Now $wgWellFormedXml is used,
not $wgHtml5.  The previous code was outputting malformed XML if
$wgHtml5 and $wgWellFormedXml were both true.

I wish we had unit tests for this.  :(
2009-10-01 01:30:58 +00:00
Aryeh Gregor
5db865d453 Improve $attribs documentation in Html
As suggested by Nikerabbit on code review for r56778, noted how boolean
attributes are handled in a function-level comment.  Also adjusted
comments to reduce duplication by referring to other functions'
comments.
2009-09-23 15:16:05 +00:00
Aryeh Gregor
a3cdf1ab2f Fix "Invalid argument for foreach()" in Html
Reported by Nikerabbit on IRC to happen on Preferences, although I
couldn't reproduce immediately.  The change should be helpful for this
kind of thing anyway.
2009-09-22 17:41:34 +00:00
Aryeh Gregor
5c1205314c Tighten up unquoted attribute output
Only affects wikis with $wgWellFormedXml = false.  In principle, the old
behavior might have permitted XSS in IE if that setting is false (which
is not the default), but I haven't checked.  See
<http://code.google.com/p/html5lib/issues/detail?id=92>.
2009-09-18 15:28:46 +00:00
Aaron Schulz
6c182ab889 typecast $attribs to an array to avoid on-site notices 2009-09-18 14:55:42 +00:00
Aryeh Gregor
4a02cca0a3 Don't drop default attrib values in non-HTML5
Some attributes that have defaults in HTML5 don't have defaults in
XHTML1, particularly type="" on scripts and styles (bug 20713).  There's
not much point in trying to maintain two separate sets of defaults,
so I've just kept the HTML5 ones and haven't tried to strip any defaults
in XHTML1 mode.
2009-09-18 14:19:34 +00:00
Aaron Schulz
539dbc2d31 Default $attribs to an array in expandAttributes() 2009-09-16 22:52:15 +00:00
Alex Z
e886186e41 (bug 20655) If $wgHtml5 is false, run attribute values through Sanitizer::encodeAttribute() 2009-09-16 05:29:44 +00:00
Aryeh Gregor
f03c53b8a7 Fix silly <table class=''> 2009-09-07 15:25:22 +00:00
Aryeh Gregor
a039be051b Refactor redundant attrib dropping into new method
This saves code in a few places on the caller's side, and will reduce
the size of output HTML more consistently.
2009-09-07 00:21:55 +00:00
Aryeh Gregor
1cdedb1d44 Fix YET ANOTHER PHP WEAK TYPING BUG
Literal "0" was getting quoted.  Because, of course, 0 is equal to the
empty string.
2009-09-06 15:08:10 +00:00
Aryeh Gregor
e476e97314 Move more <input> logic from input() to element() 2009-09-06 15:07:52 +00:00
Aryeh Gregor
49e2599368 Use type=search for Monobook sidebar
Didn't bother to do this for other skins at the moment.  This should
allow more native-looking styling on some platforms (e.g., Safari on
Mac).
2009-08-26 14:59:59 +00:00
Aryeh Gregor
5e72d3501e Emit CDATA more intelligently
This fixes some possible XML invalidity from r54767: CDATA stuff was
being added only if $wgHtml5 was false, instead of whenever
$wgWellFormedXml is true.  Also, it uses CDATA for script as well as
style, but in both cases only uses it if there's a & or < somewhere.
2009-08-23 21:06:54 +00:00
Aryeh Gregor
daa8ed1a6e Typo in comment 2009-08-21 22:30:51 +00:00
Aryeh Gregor
faedd9d09f Autofocus Special:Search box
Also generally clean up the code around there: add some line breaks, use
Html instead of Xml (using new Html::hidden()).
2009-08-21 21:57:26 +00:00
Aryeh Gregor
f61d9e089d Omit useless value="" in Html::input() 2009-08-21 21:34:52 +00:00
Aryeh Gregor
3d3aa7c369 Only require necessary fields in Special:ResetPass
This fixes r54567.  That made the password fields on Special:ResetPass
always required, but in fact the current password should never be
required (existing users always might have empty passwords), and the new
password is only required if $wgMinimalPasswordLength > 0.

This commit also permits passing array( 'required' ) to
Html::(rawE|e)lement() instead of array( 'required' => 'meaningless' ),
for boolean attribs only.  This syntax is used in SpecialResetpass.
2009-08-21 21:06:06 +00:00
Aryeh Gregor
f103c057d0 Move validation logic from input() to rawElement()
This way callers of rawElement() or element() will also get correct
behavior.
2009-08-21 20:50:35 +00:00
Aryeh Gregor
defb1eeaf0 Correct outdated comments 2009-08-21 20:39:16 +00:00
Aryeh Gregor
ef664913d1 Don't escape >" in tag contents, no point 2009-08-21 20:38:53 +00:00
Aryeh Gregor
643dad9da3 Remove somewhat braindead comments
On second thought, if you're outputting user-supplied JS without careful
validation, it doesn't really matter if it's HTML-escaped or not.  :D
CSS has expr() and such too.
2009-08-20 21:30:47 +00:00
Brion Vibber
9bcb7bc8b0 Cleanup from r54770 "Add Html::input() convenience function"
Split the giant arrays of attributes/values to one item per line, which makes them easier to look at, easier to grep, and easier to see what's happening when they're changed in diffs.
We're not printing; vertical space isn't at a premium. ;)
2009-08-19 01:39:05 +00:00