Merge "Add framework for file warnings"
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index 6f19a23..2b495b1 100644 (file)
@@ -111,7 +111,7 @@ class CoreParserFunctions {
 
                $pref = $parser->getOptions()->getDateFormat();
 
-               // Specify a different default date format other than the the normal default
+               // Specify a different default date format other than the normal default
                // if the user has 'default' for their setting
                if ( $pref == 'default' && $defaultPref ) {
                        $pref = $defaultPref;
@@ -309,15 +309,12 @@ class CoreParserFunctions {
         * @return string
         */
        public static function gender( $parser, $username ) {
-               wfProfileIn( __METHOD__ );
                $forms = array_slice( func_get_args(), 2 );
 
                // Some shortcuts to avoid loading user data unnecessarily
                if ( count( $forms ) === 0 ) {
-                       wfProfileOut( __METHOD__ );
                        return '';
                } elseif ( count( $forms ) === 1 ) {
-                       wfProfileOut( __METHOD__ );
                        return $forms[0];
                }
 
@@ -341,7 +338,6 @@ class CoreParserFunctions {
                        $gender = GenderCache::singleton()->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
                }
                $ret = $parser->getFunctionLang()->gender( $gender, $forms );
-               wfProfileOut( __METHOD__ );
                return $ret;
        }
 
@@ -953,13 +949,6 @@ class CoreParserFunctions {
                        $inner = null;
                }
 
-               $stripList = $parser->getStripList();
-               if ( !in_array( $tagName, $stripList ) ) {
-                       return '<span class="error">' .
-                               wfMessage( 'unknown_extension_tag', $tagName )->inContentLanguage()->text() .
-                               '</span>';
-               }
-
                $attributes = array();
                foreach ( $args as $arg ) {
                        $bits = $arg->splitArg();
@@ -973,6 +962,19 @@ class CoreParserFunctions {
                        }
                }
 
+               $stripList = $parser->getStripList();
+               if ( !in_array( $tagName, $stripList ) ) {
+                       // we can't handle this tag (at least not now), so just re-emit it as an ordinary tag
+                       $attrText = '';
+                       foreach ( $attributes as $name => $value ) {
+                               $attrText .= ' ' . htmlspecialchars( $name ) . '="' . htmlspecialchars( $value ) . '"';
+                       }
+                       if ( $inner === null ) {
+                               return "<$tagName$attrText/>";
+                       }
+                       return "<$tagName$attrText>$inner</$tagName>";
+               }
+
                $params = array(
                        'name' => $tagName,
                        'inner' => $inner,