Exemplo n.º 1
0
 function highlight($post, $words, $content)
 {
     $high = new Highlighter($content, $words, true);
     if ($this->noindex === false) {
         global $search_spider;
         $search_spider->has_highlighted_content = true;
         $content = apply_filters('search_unleashed_content', $content, $post);
         $high->zoom($this->before, $this->after);
         $high->mark_words();
     } else {
         $high->zoom($this->before, $this->after);
     }
     return $high->reformat($high->get());
 }
Exemplo n.º 2
0
 function highlight($post, $words, $content)
 {
     global $search_spider;
     // First check if the excerpt is not the same as the content
     $highlight = new Highlighter($content, $words, true);
     if ($highlight->has_matches() && $search_spider->has_highlighted_content == false) {
         $highlight->zoom($this->before, $this->after);
         $highlight->mark_words();
         return '<p><strong>' . __('Excerpt', 'search-unleashed') . ':</strong> ' . $highlight->get() . '</p>';
     }
     return '';
 }
Exemplo n.º 3
0
 function highlight($post, $words, $content)
 {
     $meta = $this->the_post_custom($post->ID);
     if (!empty($meta)) {
         $highlight = new Highlighter($meta, $words, true);
         if ($highlight->has_matches()) {
             $highlight->zoom(40, 80);
             $highlight->mark_words();
             return '<p><strong>' . __('Meta-data', 'search-unleashed') . ':</strong> ' . $highlight->get() . '</p>';
         }
     }
     return '';
 }
Exemplo n.º 4
0
	function highlight( $post, $words, $content ) {
		if ( isset( $post->comment_id ) ) {
			$comment   = get_comment( $post->comment_id );
			$highlight = new Highlighter( $this->gather( $comment ), $words, true );

			if ( $highlight->has_matches() ) {
				$highlight->zoom( $this->before, $this->after );
				$highlight->mark_words();
			
				if ( $this->include == 'content' )
					return sprintf( __( '<p><strong>Comment:</strong> %s</p>', 'search-unleashed' ), $highlight->get() );
				else if ($this->include == 'link')
					return sprintf( __( '<p><strong>Comment by %s:</strong> %s</p>', 'search-unleashed' ), $this->get_comment_author_link( $comment ), $highlight->get() );
				else if ($this->include == 'name')
					return sprintf( __( '<p><strong>Comment by %s:</strong> %s</p>', 'search-unleashed' ), apply_filters( 'comment_author', apply_filters( 'get_comment_author', $comment->comment_author ) ), $highlight->get() );
			}
		}
		
		return '';
	}