Esempio n. 1
0
function hlst_query()
{
    global $hlst_do_extend;
    $areas = array('div.hentry', '#content', '#main', 'div.content', '#middle', '#container', '#wrapper');
    // Using the tag 'body' is known to cause conflicts.
    // js >> var hlst_ids = new Array("'.$id'","#main","#wrapper");
    //$bgclr = '#D3E18A';	// default moss background
    // dark orange:#9CD4FF; lightblue:#9CD4FF; light orange:#FFCA61
    $terms = hlst_get_search_query();
    $filtered = array();
    foreach ($terms as $term) {
        $term = attribute_escape(trim(str_replace(array('"', '\'', '%22'), '', $term)));
        if (!empty($term)) {
            $filtered[] = '"' . $term . '"';
        }
    }
    if (count($filtered) > 0) {
        $hlst_do_extend = true;
        echo '
<!-- Highlight Search Terms ' . HLST_VERSION . ' ( RavanH - http://4visions.nl/en/wordpress-plugins/highlight-search-terms/ ) -->
<script type="text/javascript">
var hlst_query = new Array(' . implode(',', $filtered) . ');
var hlst_areas = new Array("' . implode('","', $areas) . '");
</script>
';
    }
}
Esempio n. 2
0
function hlst_query() {
	global $hlst_do_extend;

	$areas = array(		// Change or extend this to match themes content div ID or classes.
		'div.hentry',	// The hilite script will test div ids/classes and use the first one it
		'#content',	// finds so put the most common one first, then follow with the less
		'#main',	// used or common outer wrapper div ids.
		'div.content',	// When referencing an *ID name*, just be sure to begin with a '#'.
		'#middle',	// When referencing a *class name*, try to put the tag in front,
		'#container',	// followed by a '.' and then the class name to *improve script speed*.
		'#wrapper',	// Example: div.hentry instead of just .hentry
		);		// Using the tag 'body' is known to cause conflicts.
			
	// js >> var hlst_ids = new Array("'.$id'","#main","#wrapper");
	//$bgclr = '#D3E18A';	// default moss background 
				// dark orange:#9CD4FF; lightblue:#9CD4FF; light orange:#FFCA61

	$terms = hlst_get_search_query();
	$filtered = array();
	foreach($terms as $term){
		$term = attribute_escape(trim(str_replace(array('"','\'','%22'), '', $term)));
		if ( !empty($term) ){
			$filtered[] = '"'.$term.'"';
		}
	}	
	if (count($filtered) > 0) { 
		$hlst_do_extend = true;
		echo '
<!-- Highlight Search Terms ' . HLST_VERSION . ' ( RavanH - http://4visions.nl/en/wordpress-plugins/highlight-search-terms/ ) -->
<script type="text/javascript">
var hlst_query = new Array(' . implode(',',$filtered) . ');
var hlst_areas = new Array("' . implode('","',$areas) . '");
</script>
';
	}
}