|
MediaWiki
REL1_24
|
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. | |
| highlightNone ($text, $contextlines, $contextchars) | |
| Returns the first few lines of the text. | |
| 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. | |
Protected Attributes | |
| $mCleanWikitext = true | |
Highlight bits of wikitext.
Definition at line 29 of file SearchHighlighter.php.
| SearchHighlighter::__construct | ( | $ | cleanupWikitext = true | ) |
Definition at line 32 of file SearchHighlighter.php.
| SearchHighlighter::caseCallback | ( | $ | matches | ) |
Do manual case conversion for non-ascii chars.
| array | $matches |
Definition at line 318 of file SearchHighlighter.php.
References $matches, $wgContLang, and global.
| SearchHighlighter::extract | ( | $ | text, |
| $ | start, | ||
| $ | end, | ||
| &$ | posStart = null, |
||
| &$ | posEnd = null |
||
| ) |
Extract part of the text from start to end, but by not chopping up words.
| string | $text | |
| int | $start | |
| int | $end | |
| int | $posStart | (out) actual start position |
| int | $posEnd | (out) actual end position |
Definition at line 337 of file SearchHighlighter.php.
References position().
Referenced by highlightText(), and process().
| SearchHighlighter::highlightNone | ( | $ | text, |
| $ | contextlines, | ||
| $ | contextchars | ||
| ) |
Returns the first few lines of the text.
| string | $text | |
| int | $contextlines | Max number of returned lines |
| int | $contextchars | Average number of characters per line |
Definition at line 567 of file SearchHighlighter.php.
References array().
| SearchHighlighter::highlightSimple | ( | $ | text, |
| $ | terms, | ||
| $ | contextlines, | ||
| $ | contextchars | ||
| ) |
Simple & fast snippet extraction, but gives completely unrelevant snippets.
| string | $text | |
| array | $terms | |
| int | $contextlines | |
| int | $contextchars |
Definition at line 513 of file SearchHighlighter.php.
References $fname, $lines, $pre, $wgContLang, array(), as, global, wfProfileIn(), and wfProfileOut().
| SearchHighlighter::highlightText | ( | $ | text, |
| $ | terms, | ||
| $ | contextlines, | ||
| $ | contextchars | ||
| ) |
Default implementation of wikitext highlighting.
| string | $text | |
| array | $terms | Terms to highlight (unescaped) |
| int | $contextlines | |
| int | $contextchars |
Definition at line 45 of file SearchHighlighter.php.
References $count, $fname, $key, $last, $matches, $processed, $term, $wgContLang, array(), as, extract(), global, 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
| array | $matches |
Definition at line 488 of file SearchHighlighter.php.
References $matches, $wgContLang, and global.
| SearchHighlighter::position | ( | $ | text, |
| $ | point, | ||
| $ | offset = 0 |
||
| ) |
Find a nonletter near a point (index) in the text.
| string | $text | |
| int | $point | |
| int | $offset | Offset to found index |
Definition at line 369 of file SearchHighlighter.php.
Referenced by extract().
| SearchHighlighter::process | ( | $ | pattern, |
| $ | extracts, | ||
| &$ | linesleft, | ||
| &$ | contextchars, | ||
| &$ | out, | ||
| &$ | offsets | ||
| ) |
Search extracts for a pattern, and return snippets.
| string | $pattern | Regexp for matching lines |
| array | $extracts | Extracts to search |
| int | $linesleft | Number of extracts to make |
| int | $contextchars | Length of snippet |
| array | $out | Map for highlighted snippets |
| array | $offsets | Map of starting points of snippets |
Definition at line 410 of file SearchHighlighter.php.
References $out, array(), as, and extract().
Referenced by highlightText().
| SearchHighlighter::removeWiki | ( | $ | text | ) |
Basic wikitext removal.
| string | $text |
Definition at line 453 of file SearchHighlighter.php.
References $fname, array(), wfProfileIn(), and wfProfileOut().
Referenced by splitAndAdd().
| SearchHighlighter::splitAndAdd | ( | &$ | extracts, |
| &$ | count, | ||
| $ | text | ||
| ) |
Split text into lines and add it to extracts array.
| array | $extracts | Index -> $line |
| int | $count | |
| string | $text |
Definition at line 302 of file SearchHighlighter.php.
References $count, as, and removeWiki().
Referenced by highlightText().
SearchHighlighter::$mCleanWikitext = true [protected] |
Definition at line 30 of file SearchHighlighter.php.