checkSkin( 'monobook', $skin ) ) { Wikia::addAssetsToOutput( 'portable_infobox_monobook_scss' ); } else { Wikia::addAssetsToOutput( 'portable_infobox_scss' ); } return true; } public static function onImageServingCollectImages( &$imageNamesArray, $articleTitle ) { if ( $articleTitle ) { $infoboxImages = PortableInfoboxDataService::newFromTitle( $articleTitle )->getImages(); if ( !empty( $infoboxImages ) ) { $imageNamesArray = array_merge( $infoboxImages, (array)$imageNamesArray ); } } return true; } /** * Store information about raw content of all galleries in article to handle images in infoboxes * * @param $name Parser tag name * @param $marker substitution marker * @param $content raw tag contents * @param $attributes * @param $parser * @param $frame * * @return bool */ public static function onParserTagHooksBeforeInvoke( $name, $marker, $content, $attributes, $parser, $frame ) { if ( $name === self::PARSER_TAG_GALLERY ) { \Wikia\PortableInfobox\Helpers\PortableInfoboxDataBag::getInstance()->setGallery( $marker, $content ); } return true; } public static function onWgQueryPages( &$queryPages = [ ] ) { $queryPages[] = [ 'AllinfoboxesQueryPage', 'AllInfoboxes' ]; return true; } public static function onAddPortableInfoboxBuilderText( &$article, &$text, &$wgOut ) { //check if extension is on and user has rights global $wgArticlePath; $text = ''; $newInfoboxTemplate = wfMessage( 'portable-infobox-builder-entry-point-new-template-infobox' )->escaped(); $newTemplate = wfMessage( 'portable-infobox-builder-entry-point-new-template-normal' )->escaped(); $templateTitle = $article->getTitle()->getText(); $templatePath = preg_replace('/(.+)/', $wgArticlePath, $templateTitle); $infoboxBuilderLink = "/Special:PortableInfoboxBuilder/" . $templateTitle; $editorLink = $templatePath . "?action=edit"; $HTML = '' . $newInfoboxTemplate . ' ' . $newTemplate . ''; $wgOut->addHTML($HTML); return true; } /** * @param Skin $skin * @param string $text * * @return bool */ public static function onSkinAfterBottomScripts( $skin, &$text ) { $title = $skin->getTitle(); if ( $title->isSpecial( PortableInfoboxBuilderSpecialController::PAGE_NAME ) ) { $scripts = AssetsManager::getInstance()->getURL( 'portable_infobox_builder_js' ); foreach ( $scripts as $script ) { $text .= Html::linkedScript( $script ); } } return true; } }