static $htmlpairsStatic, $htmlsingle, $htmlsingleonly, $htmlnest, $tabletags,
$htmllist, $listtags, $htmlsingleallowed, $htmlelementsStatic, $staticInitialised;
- wfProfileIn( __METHOD__ );
-
// 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' ) );
$newparams = '';
} else {
# Keep track for later
- if ( isset( $tabletags[$t] ) &&
- !in_array( 'table', $tagstack ) ) {
+ if ( isset( $tabletags[$t] ) && !in_array( 'table', $tagstack ) ) {
$badtag = true;
- } elseif ( in_array( $t, $tagstack ) &&
- !isset( $htmlnest[$t] ) ) {
+ } elseif ( in_array( $t, $tagstack ) && !isset( $htmlnest[$t] ) ) {
$badtag = true;
# Is it a self closed htmlpair ? (bug 5487)
- } elseif ( $brace == '/>' &&
- isset( $htmlpairs[$t] ) ) {
+ } elseif ( $brace == '/>' && isset( $htmlpairs[$t] ) ) {
$badtag = true;
} elseif ( isset( $htmlsingleonly[$t] ) ) {
# Hack to force empty tag for unclosable elements
# the tag stack so that we can match end tags
# instead of marking them as bad.
array_push( $tagstack, $t );
- } elseif ( isset( $tabletags[$t] )
- && in_array( $t, $tagstack ) ) {
+ } elseif ( isset( $tabletags[$t] ) && in_array( $t, $tagstack ) ) {
// New table tag but forgot to close the previous one
$text .= "</$t>";
} else {
$text .= '<' . str_replace( '>', '>', $x );
}
}
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string
*/
static function removeHTMLcomments( $text ) {
- wfProfileIn( __METHOD__ );
while ( ( $start = strpos( $text, '<!--' ) ) !== false ) {
$end = strpos( $text, '-->', $start + 4 );
if ( $end === false ) {
$text = substr_replace( $text, '', $start, $end - $start );
}
}
- wfProfileOut( __METHOD__ );
return $text;
}
$id = preg_replace( '/[ \t\n\r\f_\'"&#%]+/', '_', $id );
$id = trim( $id, '_' );
if ( $id === '' ) {
- # Must have been all whitespace to start with.
+ // Must have been all whitespace to start with.
return '_';
} else {
return $id;
}
}
- # HTML4-style escaping
+ // HTML4-style escaping
static $replace = array(
'%3A' => ':',
'%' => '.'
$id = urlencode( strtr( $id, ' ', '_' ) );
$id = str_replace( array_keys( $replace ), array_values( $replace ), $id );
- if ( !preg_match( '/^[a-zA-Z]/', $id )
- && !in_array( 'noninitial', $options ) ) {
+ if ( !preg_match( '/^[a-zA-Z]/', $id ) && !in_array( 'noninitial', $options ) ) {
// Initial character must be a letter!
$id = "x$id";
}
}
}
- /**
- * Normalize whitespace and character references in an XML source-
- * encoded text for an attribute value.
- *
- * See http://www.w3.org/TR/REC-xml/#AVNormalize for background,
- * but note that we're not returning the value, but are returning
- * XML source fragments that will be slapped into output.
- *
- * @param string $text
- * @return string
- * @todo Remove, unused?
- */
- private static function normalizeAttributeValue( $text ) {
- return str_replace( '"', '"',
- self::normalizeWhitespace(
- Sanitizer::normalizeCharReferences( $text ) ) );
- }
-
/**
* @param string $text
* @return string
static function normalizeEntity( $name ) {
if ( isset( self::$htmlEntityAliases[$name] ) ) {
return '&' . self::$htmlEntityAliases[$name] . ';';
- } elseif ( in_array( $name,
- array( 'lt', 'gt', 'amp', 'quot' ) ) ) {
+ } elseif ( in_array( $name, array( 'lt', 'gt', 'amp', 'quot' ) ) ) {
return "&$name;";
} elseif ( isset( self::$htmlEntities[$name] ) ) {
return '&#' . self::$htmlEntities[$name] . ';';
*/
public static function validateEmail( $addr ) {
$result = null;
- if ( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result ) ) ) {
+ if ( !Hooks::run( 'isValidEmailAddr', array( $addr, &$result ) ) ) {
return $result;
}