mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
Update Extension.php
This commit is contained in:
@ -44,26 +44,26 @@ class Extension {
|
||||
* This handler is used if the parseOnEdit configuration option is set.
|
||||
*/
|
||||
public static function onMultiContentSave( RenderedRevision $renderedRevision, User $user, CommentStoreComment $summary, $flags, Status $hookStatus ) {
|
||||
$config = new Config();
|
||||
if ( !$config->parseOnEdit ) return true;
|
||||
$config = new Config();
|
||||
if ( !$config->parseOnEdit ) return true;
|
||||
$title = $renderedRevision->getRevision()->getPageAsLinkTarget();
|
||||
$slots = $renderedRevision->getRevision()->getSlots();
|
||||
$content = $renderedRevision->getRevision()->getSlots()->getContent( SlotRecord::MAIN );
|
||||
$articleID = $renderedRevision->getRevision()->getPageId();
|
||||
$wikiPage = WikiPage::newFromID( $articleID );
|
||||
$content = $renderedRevision->getRevision()->getSlots()->getContent( SlotRecord::MAIN );
|
||||
$articleID = $renderedRevision->getRevision()->getPageId();
|
||||
$wikiPage = WikiPage::newFromID( $articleID );
|
||||
if ( $wikiPage == null ) {
|
||||
return true;
|
||||
}
|
||||
$source = Source::createFromPageandContent( $wikiPage, $content, $config );
|
||||
$linker = new Linker( $config );
|
||||
$result = $linker->linkContent( $source );
|
||||
if ( $result ) {
|
||||
$source->setText( $result );
|
||||
$source = Source::createFromPageandContent( $wikiPage, $content, $config );
|
||||
$linker = new Linker( $config );
|
||||
$result = $linker->linkContent( $source );
|
||||
if ( $result ) {
|
||||
$source->setText( $result );
|
||||
|
||||
$text = $source->getText($result);
|
||||
$text = $source->getText($result);
|
||||
$slots = $renderedRevision->getRevision()->getSlots();
|
||||
$slots->setContent( 'main', ContentHandler::makeContent( $text, $title ) );
|
||||
}
|
||||
$slots->setContent( 'main', ContentHandler::makeContent( $text, $title ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user