$this->parserOutput = $parserOutput;
}
- /**
- * Get categories in the text.
- * @return string[]
- */
- public function categories() {
- $categories = [];
- foreach ( array_keys( $this->parserOutput->getCategories() ) as $key ) {
- $categories[] = Category::newFromName( $key )->getTitle()->getText();
- }
- return $categories;
- }
-
- /**
- * Get outgoing links.
- * @return string[]
- */
- public function outgoingLinks() {
- $outgoingLinks = [];
- foreach ( $this->parserOutput->getLinks() as $linkedNamespace => $namespaceLinks ) {
- foreach ( array_keys( $namespaceLinks ) as $linkedDbKey ) {
- $outgoingLinks[] =
- Title::makeTitle( $linkedNamespace, $linkedDbKey )->getPrefixedDBkey();
- }
- }
- return $outgoingLinks;
- }
-
- /**
- * Get templates in the text.
- * @return string[]
- */
- public function templates() {
- $templates = [];
- foreach ( $this->parserOutput->getTemplates() as $tNS => $templatesInNS ) {
- foreach ( array_keys( $templatesInNS ) as $tDbKey ) {
- $templateTitle = Title::makeTitleSafe( $tNS, $tDbKey );
- if ( $templateTitle && $templateTitle->exists() ) {
- $templates[] = $templateTitle->getPrefixedText();
- }
- }
- }
- return $templates;
- }
-
/**
* Get headings on the page.
* @return string[]
private function getIgnoredHeadings() {
static $ignoredHeadings = null;
if ( $ignoredHeadings === null ) {
- // FIXME: will be renamed in next patches to search-ignored-headings
- $source = wfMessage( 'cirrussearch-ignored-headings' )->inContentLanguage();
$ignoredHeadings = [];
+ $source = wfMessage( 'search-ignored-headings' )->inContentLanguage();
+ if ( $source->isBlank() ) {
+ // Try old version too, just in case
+ $source = wfMessage( 'cirrussearch-ignored-headings' )->inContentLanguage();
+ }
if ( !$source->isDisabled() ) {
$lines = self::parseSettingsInMessage( $source->plain() );
$ignoredHeadings = $lines; // Now we just have headings!