Index: branches/Wikidata/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -486,20 +486,21 @@ |
487 | 487 | $out->setRevisionTimestamp( $this->mNewRev->getTimestamp() ); |
488 | 488 | $out->setArticleFlag( true ); |
489 | 489 | |
490 | | - if ( $this->mNewPage->isCssJsSubpage() || $this->mNewPage->isCssOrJsPage() ) { #FIXME: don't do this, use the content handler instead!! |
| 490 | + if ( $this->mNewPage->isCssJsSubpage() || $this->mNewPage->isCssOrJsPage() ) { #NOTE: only needed for B/C: custom rendering of JS/CSS via hook |
491 | 491 | // Stolen from Article::view --AG 2007-10-11 |
492 | 492 | // Give hooks a chance to customise the output |
493 | 493 | // @TODO: standardize this crap into one function |
494 | | - if ( wfRunHooks( 'ShowRawCssJs', array( $this->mNewtext, $this->mNewPage, $out ) ) ) { #FIXME: what to do with this hook?? |
495 | | - // Wrap the whole lot in a <pre> and don't parse |
496 | | - $m = array(); |
497 | | - preg_match( '!\.(css|js)$!u', $this->mNewPage->getText(), $m ); |
498 | | - $out->addHTML( "<pre class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" ); |
499 | | - $out->addHTML( htmlspecialchars( $this->mNewtext ) ); |
500 | | - $out->addHTML( "\n</pre>\n" ); |
| 494 | + if ( !Hook::isRegistered( 'ShowRawCssJs' ) |
| 495 | + || wfRunHooks( 'ShowRawCssJs', array( ContentHandler::getContentText( $this->mNewContent ), $this->mNewPage, $out ) ) ) { #NOTE: deperecated hook, B/C only |
| 496 | + // use the content object's own rendering |
| 497 | + $po = $this->mContentObject->getParserOutput(); |
| 498 | + $out->addHTML( $po->getText() ); |
501 | 499 | } |
502 | | - } elseif ( !wfRunHooks( 'ArticleViewCustom', array( $this->mNewtext, $this->mNewPage, $out ) ) ) { #FIXME: what do we pass here |
503 | | - // Handled by extension |
| 500 | + } elseif( !wfRunHooks( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { |
| 501 | + // Handled by extension |
| 502 | + } elseif( Hooks::isRegistered( 'ArticleViewCustom' ) |
| 503 | + && !wfRunHooks( 'ArticleViewCustom', array( ContentHandler::getContentText( $this->mNewContent ), $this->mNewPage, $out ) ) ) { #NOTE: deperecated hook, B/C only |
| 504 | + // Handled by extension |
504 | 505 | } else { |
505 | 506 | // Normal page |
506 | 507 | if ( $this->getTitle()->equals( $this->mNewPage ) ) { |
Index: branches/Wikidata/phase3/includes/Article.php |
— | — | @@ -324,7 +324,7 @@ |
325 | 325 | |
326 | 326 | $content = $this->fetchContentObject(); |
327 | 327 | |
328 | | - $this->mContent = ContentHandler::getContentText( $content ); |
| 328 | + $this->mContent = ContentHandler::getContentText( $content ); #FIXME: get rid of mContent everywhere! |
329 | 329 | wfRunHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) ); #BC cruft! |
330 | 330 | |
331 | 331 | wfProfileOut( __METHOD__ ); |
— | — | @@ -609,7 +609,10 @@ |
610 | 610 | wfDebug( __METHOD__ . ": showing CSS/JS source\n" ); |
611 | 611 | $this->showCssOrJsPage(); |
612 | 612 | $outputDone = true; |
613 | | - } elseif( !wfRunHooks( 'ArticleViewCustom', array( $this->mContent, $this->getTitle(), $wgOut ) ) ) { |
| 613 | + } elseif( !wfRunHooks( 'ArticleContentViewCustom', array( $this->fetchContentObject(), $this->getTitle(), $wgOut ) ) ) { #FIXME: document new hook! |
| 614 | + # Allow extensions do their own custom view for certain pages |
| 615 | + $outputDone = true; |
| 616 | + } elseif( Hooks::isRegistered( 'ArticleViewCustom' ) && !wfRunHooks( 'ArticleViewCustom', array( $this->fetchContent(), $this->getTitle(), $wgOut ) ) ) { #FIXME: fetchContent() is deprecated! #FIXME: deprecate hook! |
614 | 617 | # Allow extensions do their own custom view for certain pages |
615 | 618 | $outputDone = true; |
616 | 619 | } else { |
— | — | @@ -745,17 +748,17 @@ |
746 | 749 | * This is hooked by SyntaxHighlight_GeSHi to do syntax highlighting of these |
747 | 750 | * page views. |
748 | 751 | */ |
749 | | - protected function showCssOrJsPage() { #FIXME: move this to ContentHandler! |
| 752 | + protected function showCssOrJsPage() { |
750 | 753 | global $wgOut; |
751 | 754 | |
752 | 755 | $dir = $this->getContext()->getLanguage()->getDir(); |
753 | 756 | $lang = $this->getContext()->getLanguage()->getCode(); |
754 | 757 | |
755 | 758 | $wgOut->wrapWikiMsg( "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>", |
756 | | - 'clearyourcache' ); #FIXME: do this in handler |
| 759 | + 'clearyourcache' ); |
757 | 760 | |
758 | 761 | // Give hooks a chance to customise the output |
759 | | - if ( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->getTitle(), $wgOut ) ) ) { |
| 762 | + if ( !Hooks::isRegistered('ShowRawCssJs') || wfRunHooks( 'ShowRawCssJs', array( $this->fetchContent(), $this->getTitle(), $wgOut ) ) ) { #FIXME: fetchContent() is deprecated #FIXME: hook is deprecated |
760 | 763 | $po = $this->mContentObject->getParserOutput(); |
761 | 764 | $wgOut->addHTML( $po->getText() ); |
762 | 765 | } |