MediaWiki
REL1_19
|
Highlight bits of wikitext. More...
Public Member Functions | |
__construct ($cleanupWikitext=true) | |
caseCallback ($matches) | |
Do manual case conversion for non-ascii chars. | |
extract ($text, $start, $end, &$posStart=null, &$posEnd=null) | |
Extract part of the text from start to end, but by not chopping up words. | |
highlightSimple ($text, $terms, $contextlines, $contextchars) | |
Simple & fast snippet extraction, but gives completely unrelevant snippets. | |
highlightText ($text, $terms, $contextlines, $contextchars) | |
Default implementation of wikitext highlighting. | |
linkReplace ($matches) | |
callback to replace [[target|caption]] kind of links, if the target is category or image, leave it | |
position ($text, $point, $offset=0) | |
Find a nonletter near a point (index) in the text. | |
process ($pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets) | |
Search extracts for a pattern, and return snippets. | |
removeWiki ($text) | |
Basic wikitext removal. | |
splitAndAdd (&$extracts, &$count, $text) | |
Split text into lines and add it to extracts array. | |
Public Attributes | |
$mCleanWikitext = true |
Highlight bits of wikitext.
Definition at line 917 of file SearchEngine.php.
SearchHighlighter::__construct | ( | $ | cleanupWikitext = true | ) |
Definition at line 920 of file SearchEngine.php.
SearchHighlighter::caseCallback | ( | $ | matches | ) |
Do manual case conversion for non-ascii chars.
$matches | Array |
Definition at line 1189 of file SearchEngine.php.
References $matches, and $wgContLang.
SearchHighlighter::extract | ( | $ | text, |
$ | start, | ||
$ | end, | ||
&$ | posStart = null , |
||
&$ | posEnd = null |
||
) |
Extract part of the text from start to end, but by not chopping up words.
$text | String |
$start | Integer |
$end | Integer |
$posStart | Integer: (out) actual start position |
$posEnd | Integer: (out) actual end position |
Definition at line 1208 of file SearchEngine.php.
References position().
Referenced by highlightText(), and process().
SearchHighlighter::highlightSimple | ( | $ | text, |
$ | terms, | ||
$ | contextlines, | ||
$ | contextchars | ||
) |
Simple & fast snippet extraction, but gives completely unrelevant snippets.
$text | String |
$terms | Array |
$contextlines | Integer |
$contextchars | Integer |
Definition at line 1363 of file SearchEngine.php.
References $fname, $lines, $wgContLang, wfProfileIn(), and wfProfileOut().
SearchHighlighter::highlightText | ( | $ | text, |
$ | terms, | ||
$ | contextlines, | ||
$ | contextchars | ||
) |
Default implementation of wikitext highlighting.
$text | String |
$terms | Array: terms to highlight (unescaped) |
$contextlines | Integer |
$contextchars | Integer |
Definition at line 933 of file SearchEngine.php.
References $count, $fname, $matches, $processed, $wgContLang, $wgSearchHighlightBoundaries, extract(), process(), splitAndAdd(), wfProfileIn(), and wfProfileOut().
SearchHighlighter::linkReplace | ( | $ | matches | ) |
callback to replace [[target|caption]] kind of links, if the target is category or image, leave it
$matches | Array |
Definition at line 1339 of file SearchEngine.php.
References $matches, and $wgContLang.
SearchHighlighter::position | ( | $ | text, |
$ | point, | ||
$ | offset = 0 |
||
) |
Find a nonletter near a point (index) in the text.
$text | String |
$point | Integer |
$offset | Integer: offset to found index |
Definition at line 1240 of file SearchEngine.php.
Referenced by extract().
SearchHighlighter::process | ( | $ | pattern, |
$ | extracts, | ||
&$ | linesleft, | ||
&$ | contextchars, | ||
&$ | out, | ||
&$ | offsets | ||
) |
Search extracts for a pattern, and return snippets.
$pattern | String: regexp for matching lines |
$extracts | Array: extracts to search |
$linesleft | Integer: number of extracts to make |
$contextchars | Integer: length of snippet |
$out | Array: map for highlighted snippets |
$offsets | Array: map of starting points of snippets |
Definition at line 1273 of file SearchEngine.php.
References $out, and extract().
Referenced by highlightText().
SearchHighlighter::removeWiki | ( | $ | text | ) |
Basic wikitext removal.
Definition at line 1309 of file SearchEngine.php.
References $fname, wfProfileIn(), and wfProfileOut().
Referenced by splitAndAdd().
SearchHighlighter::splitAndAdd | ( | &$ | extracts, |
&$ | count, | ||
$ | text | ||
) |
Split text into lines and add it to extracts array.
$extracts | Array: index -> $line |
$count | Integer |
$text | String |
Definition at line 1175 of file SearchEngine.php.
References $count, and removeWiki().
Referenced by highlightText().
SearchHighlighter::$mCleanWikitext = true |
Definition at line 918 of file SearchEngine.php.