/**
* Defines the value of the version attribute in the <html> tag, if any.
- * If $wgAllowRdfaAttributes is true, and this evaluates to boolean false
- * (like if it's left at the default null value), it will be auto-initialized
- * to the correct value for RDFa+HTML5. As such, you should have no reason to
- * ever actually set this to anything.
+ *
+ * If your wiki uses RDFa, set it to the correct value for RDFa+HTML5.
+ * Correct current values are 'HTML+RDFa 1.0' or 'XHTML+RDFa 1.0'.
+ * See also http://www.w3.org/TR/rdfa-in-html/#document-conformance
+ * @since 1.16
*/
$wgHtml5Version = null;
*/
$wgUseMediaWikiUIEverywhere = false;
-/**
- * Enabled RDFa attributes for use in wikitext.
- * NOTE: Interaction with HTML5 is somewhat underspecified.
- */
-$wgAllowRdfaAttributes = false;
-
-/**
- * Enabled HTML5 microdata attributes for use in wikitext.
- */
-$wgAllowMicrodataAttributes = false;
-
/**
* Should we try to make our HTML output well-formed XML? If set to false,
* output will be a few bytes shorter, and the HTML will arguably be more
* @return array
*/
public static function getRecognizedTagData( $extratags = [], $removetags = [] ) {
- global $wgAllowMicrodataAttributes, $wgAllowImageTag;
+ global $wgAllowImageTag;
static $htmlpairsStatic, $htmlsingle, $htmlsingleonly, $htmlnest, $tabletags,
$htmllist, $listtags, $htmlsingleallowed, $htmlelementsStatic, $staticInitialised;
// Base our staticInitialised variable off of the global config state so that if the globals
// are changed (like in the screwed up test system) we will re-initialise the settings.
- $globalContext = implode( '-', compact( 'wgAllowMicrodataAttributes', 'wgAllowImageTag' ) );
+ $globalContext = $wgAllowImageTag;
if ( !$staticInitialised || $staticInitialised != $globalContext ) {
$htmlpairsStatic = [ # Tags that must be closed
'b', 'bdi', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1',
$htmlsingleonly = [ # Elements that cannot have close tags
'br', 'wbr', 'hr'
];
- if ( $wgAllowMicrodataAttributes ) {
- $htmlsingle[] = $htmlsingleonly[] = 'meta';
- $htmlsingle[] = $htmlsingleonly[] = 'link';
- }
+
+ $htmlsingle[] = $htmlsingleonly[] = 'meta';
+ $htmlsingle[] = $htmlsingleonly[] = 'link';
+
$htmlnest = [ # Tags that can be nested--??
'table', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul',
'li', 'dl', 'dt', 'dd', 'font', 'big', 'small', 'sub', 'sup', 'span',
* @todo Check for unique id attribute :P
*/
static function validateAttributes( $attribs, $whitelist ) {
- global $wgAllowRdfaAttributes, $wgAllowMicrodataAttributes;
-
$whitelist = array_flip( $whitelist );
$hrefExp = '/^(' . wfUrlProtocols() . ')[^\s]+$/';
$out = [];
foreach ( $attribs as $attribute => $value ) {
- # allow XML namespace declaration if RDFa is enabled
- if ( $wgAllowRdfaAttributes && preg_match( self::XMLNS_ATTRIBUTE_PATTERN, $attribute ) ) {
+ # Allow XML namespace declaration to allow RDFa
+ if ( preg_match( self::XMLNS_ATTRIBUTE_PATTERN, $attribute ) ) {
if ( !preg_match( self::EVIL_URI_PATTERN, $value ) ) {
$out[$attribute] = $value;
}
$out[$attribute] = $value;
}
- if ( $wgAllowMicrodataAttributes ) {
- # itemtype, itemid, itemref don't make sense without itemscope
- if ( !array_key_exists( 'itemscope', $out ) ) {
- unset( $out['itemtype'] );
- unset( $out['itemid'] );
- unset( $out['itemref'] );
- }
- # TODO: Strip itemprop if we aren't descendants of an itemscope or pointed to by an itemref.
+ # itemtype, itemid, itemref don't make sense without itemscope
+ if ( !array_key_exists( 'itemscope', $out ) ) {
+ unset( $out['itemtype'] );
+ unset( $out['itemid'] );
+ unset( $out['itemref'] );
}
+ # TODO: Strip itemprop if we aren't descendants of an itemscope or pointed to by an itemref.
+
return $out;
}
* @return array
*/
static function setupAttributeWhitelist() {
- global $wgAllowRdfaAttributes, $wgAllowMicrodataAttributes;
- static $whitelist, $staticInitialised;
+ static $whitelist;
- $globalContext = implode( '-', compact( 'wgAllowRdfaAttributes', 'wgAllowMicrodataAttributes' ) );
-
- if ( $whitelist !== null && $staticInitialised == $globalContext ) {
+ if ( $whitelist !== null ) {
return $whitelist;
}
'aria-labelledby',
'aria-owns',
'role',
- ];
- if ( $wgAllowRdfaAttributes ) {
- # RDFa attributes as specified in section 9 of
+ # RDFa
+ # These attributes are specified in section 9 of
# http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014
- $common = array_merge( $common, [
- 'about', 'property', 'resource', 'datatype', 'typeof',
- ] );
- }
+ 'about',
+ 'property',
+ 'resource',
+ 'datatype',
+ 'typeof',
- if ( $wgAllowMicrodataAttributes ) {
- # add HTML5 microdata tags as specified by
+ # Microdata. These are specified by
# http://www.whatwg.org/html/microdata.html#the-microdata-model
- $common = array_merge( $common, [
- 'itemid', 'itemprop', 'itemref', 'itemscope', 'itemtype'
- ] );
- }
+ 'itemid',
+ 'itemprop',
+ 'itemref',
+ 'itemscope',
+ 'itemtype',
+ ];
$block = array_merge( $common, [ 'align' ] );
$tablealign = [ 'align', 'valign' ];
'link' => [ 'itemprop', 'href' ],
];
- $staticInitialised = $globalContext;
-
return $whitelist;
}