[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/search/ -> SearchHighlighter.php (summary)

Basic search engine highlighting This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 575 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SearchHighlighter:: (11 methods):
  __construct()
  highlightText()
  splitAndAdd()
  caseCallback()
  extract()
  position()
  process()
  removeWiki()
  linkReplace()
  highlightSimple()
  highlightNone()


Class: SearchHighlighter  - X-Ref

Highlight bits of wikitext

__construct( $cleanupWikitext = true )   X-Ref
No description

highlightText( $text, $terms, $contextlines, $contextchars )   X-Ref
Default implementation of wikitext highlighting

param: string $text
param: array $terms Terms to highlight (unescaped)
param: int $contextlines
param: int $contextchars
return: string

splitAndAdd( &$extracts, &$count, $text )   X-Ref
Split text into lines and add it to extracts array

param: array $extracts Index -> $line
param: int $count
param: string $text

caseCallback( $matches )   X-Ref
Do manual case conversion for non-ascii chars

param: array $matches
return: string

extract( $text, $start, $end, &$posStart = null, &$posEnd = null )   X-Ref
Extract part of the text from start to end, but by
not chopping up words

param: string $text
param: int $start
param: int $end
param: int $posStart (out) actual start position
param: int $posEnd (out) actual end position
return: string

position( $text, $point, $offset = 0 )   X-Ref
Find a nonletter near a point (index) in the text

param: string $text
param: int $point
param: int $offset Offset to found index
return: int Nearest nonletter index, or beginning of utf8 char if none

process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets )   X-Ref
Search extracts for a pattern, and return snippets

param: string $pattern Regexp for matching lines
param: array $extracts Extracts to search
param: int $linesleft Number of extracts to make
param: int $contextchars Length of snippet
param: array $out Map for highlighted snippets
param: array $offsets Map of starting points of snippets

removeWiki( $text )   X-Ref
Basic wikitext removal

param: string $text
return: mixed

linkReplace( $matches )   X-Ref
callback to replace [[target|caption]] kind of links, if
the target is category or image, leave it

param: array $matches
return: string

highlightSimple( $text, $terms, $contextlines, $contextchars )   X-Ref
Simple & fast snippet extraction, but gives completely unrelevant
snippets

param: string $text
param: array $terms
param: int $contextlines
param: int $contextchars
return: string

highlightNone( $text, $contextlines, $contextchars )   X-Ref
Returns the first few lines of the text

param: string $text
param: int $contextlines Max number of returned lines
param: int $contextchars Average number of characters per line
return: string



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1