bug 5210 - add getTransclusionText() to the Parser to remove the horrible (and
[lhc/web/wiklou.git] / includes / EditPage.php
index ad9c993..7cf8abf 100644 (file)
@@ -227,22 +227,13 @@ class EditPage {
         * @return string The contents of the page.
         */
        protected function getPreloadedText( $preload ) {
+               global $wgParser;
                if ( !empty( $this->mPreloadText ) ) {
                        return $this->mPreloadText;
-               } elseif ( $preload === '' ) {
-                       return '';
                } else {
                        $preloadTitle = Title::newFromText( $preload );
                        if ( isset( $preloadTitle ) && $preloadTitle->userCanRead() ) {
-                               $rev = Revision::newFromTitle( $preloadTitle );
-                               if ( is_object( $rev ) ) {
-                                       $text = $rev->getText();
-                                       // TODO FIXME: AAAAAAAAAAA, this shouldn't be implementing
-                                       // its own mini-parser! -ævar
-                                       $text = preg_replace( '~</?includeonly>~', '', $text );
-                                       return $text;
-                               } else
-                                       return '';
+                               return $wgParser->getTransclusionText( $preloadTitle );
                        }
                }
        }