[dokuwiki] Search highlighting

  • From: "Todd Augsburger" <todd@xxxxxxxxxxxxxxxx>
  • To: <dokuwiki@xxxxxxxxxxxxx>
  • Date: Tue, 31 Jul 2007 12:32:25 -0400

Highlighting the search results when coming from Google is great! And only a 
trivial extension to similarly include Yahoo as a valid referrer. See patch 
below. (If there's interest, perhaps there are other popular engines I 
should include?)

Todd Augsburger
todd@xxxxxxxxxxxxxxxx
Roller Organs
www.rollerorgans.com

--------

[Yahoo! searches highlight like Google
Todd Augsburger <todd@xxxxxxxxxxxxxxxx>**20070731000001
 Use Yahoo! referrer info, just like Google
] {
hunk ./inc/common.php 905
-  if(!preg_match("#google\.#i",$url['host'])) return '';
-  $query = array();
-  parse_str($url['query'],$query);
-
-  return $query['q'];
+  if(preg_match("#yahoo\.#i",$url['host'])) {
+    $query = array();
+    parse_str($url['query'],$query);
+    return $query['p'];
+  }
+
+  if(preg_match("#google\.#i",$url['host'])) {
+    $query = array();
+    parse_str($url['query'],$query);
+    return $query['q'];
+  }
+
+  return '';
}

--------
 

-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: