hack support for <includeonly> into preload parameter so that categories can
authorErik Moeller <erik@users.mediawiki.org>
Sat, 26 Nov 2005 17:39:59 +0000 (17:39 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Sat, 26 Nov 2005 17:39:59 +0000 (17:39 +0000)
be removed from new article templates.

includes/Article.php

index 35a23f5..f4b5f75 100644 (file)
@@ -142,7 +142,8 @@ class Article {
        /**
                This function accepts a title string as parameter
                ($preload). If this string is non-empty, it attempts
-               to fetch the current revision text.
+               to fetch the current revision text. It respects
+               <includeonly>.
        */
        function getPreloadedText($preload) {
                if($preload) {
@@ -150,7 +151,9 @@ class Article {
                        if(isset($preloadTitle) && $preloadTitle->userCanRead()) {
                        $rev=Revision::newFromTitle($preloadTitle);
                        if($rev) {
-                               return $rev->getText();
+                               $text=$rev->getText();
+                               $text=preg_replace('/<\/?includeonly>/i','',$text);
+                               return $text;
                                }
                        }
                }