Exemplo n.º 1
0
 function highlight($post, $words, $content)
 {
     $highlight = new Highlighter($this->get_permalink($post->ID), $words, true);
     if ($highlight->has_matches()) {
         $highlight->mark_words();
         return '<p><strong>' . __('Permalink', 'search-unleashed') . ':</strong> ' . $highlight->get() . '</p>';
     }
     return '';
 }
Exemplo n.º 2
0
 function highlight($post, $words, $content)
 {
     $highlight = new Highlighter(get_the_category_list(',', '', $post->ID), $words, true);
     if ($highlight->has_matches()) {
         $highlight->mark_words();
         return '<p><strong>' . __('Category', 'search-unleashed') . ':</strong> ' . $highlight->get() . '</p>';
     }
     return '';
 }
Exemplo n.º 3
0
 function highlight($post, $words, $content)
 {
     $highlight = new Highlighter(get_the_author_meta('display_name', $post->post_author), $words, true);
     if ($highlight->has_matches()) {
         $highlight->mark_words();
         return '<p><strong>' . __('Author', 'search-unleashed') . ':</strong> ' . $this->get_author($highlight->get(), $post) . '</p>';
     }
     return '';
 }
Exemplo n.º 4
0
 function highlight($post, $words, $content)
 {
     if ($this->show) {
         $highlight = new Highlighter($this->gather($post), $words, true);
         if ($highlight->has_matches()) {
             $highlight->mark_words();
             return '<p><strong>' . __('Tags', 'search-unleashed') . ':</strong> ' . $highlight->get() . '</p>';
         }
     }
     return '';
 }
Exemplo n.º 5
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->mark_words();
             return '<p><strong>' . __('Comment author', 'search-unleashed') . ':</strong> ' . $highlight->get() . '</p>';
         }
     }
     return '';
 }
Exemplo n.º 6
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.º 7
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.º 8
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 '';
	}