- function showHit( $row )
- {
- global $wgUser, $wgOut;
-
- $t = Title::makeName( $row->cur_namespace, $row->cur_title );
- $sk = $wgUser->getSkin();
-
- $contextlines = $wgUser->getOption( "contextlines" );
- if ( "" == $contextlines ) { $contextlines = 5; }
- $contextchars = $wgUser->getOption( "contextchars" );
- if ( "" == $contextchars ) { $contextchars = 50; }
-
- $link = $sk->makeKnownLink( $t, "" );
- $size = str_replace( "$1", strlen( $row->cur_text ), WfMsg( "nbytes" ) );
- $wgOut->addHTML( "<li>{$link} ({$size})" );
-
- $lines = explode( "\n", $row->cur_text );
- $pat1 = "/(.*)(" . implode( "|", $this->mSearchterms ) . ")(.*)/i";
- $lineno = 0;
-
- foreach ( $lines as $line ) {
- if ( 0 == $contextlines ) { break; }
- --$contextlines;
- ++$lineno;
- if ( ! preg_match( $pat1, $line, $m ) ) { continue; }
-
- $pre = $m[1];
- if ( 0 == $contextchars ) { $pre = "..."; }
- else {
- if ( strlen( $pre ) > $contextchars ) {
- $pre = "..." . substr( $pre, -$contextchars );
- }
- }
- $pre = wfEscapeHTML( $pre );
-
- if ( count( $m ) < 3 ) { $post = ""; }
- else { $post = $m[3]; }