# Copyright (C) 2007 Alex Schroeder # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use strict; use v5.10; our ($q); our ($GoogleCustomSearchEngine); $GoogleCustomSearchEngine = 'http://www.google.com/cse?cx=004774160799092323420:6-ff2s0o6yi&q='; AddModuleDescription('google-custom-search.pl'); # disable search form sub GetSearchForm {} # No more searching of titles *OldGoogleCustomGetSearchLink = \&GetSearchLink; *GetSearchLink = \&NewGoogleCustomGetSearchLink; sub NewGoogleCustomGetSearchLink { my ($text, $class, $name, $title) = @_; $text = NormalToFree($text); # It would be complicated to use ScriptLink here because of quoting # issues: ScriptUrl expects a quoted URL, which it then proceeds to # unquote again, etc. It's safer to just copy the necessary code # from ScriptLink. my %params; $params{'-rel'} = 'nofollow'; $params{-href} = $GoogleCustomSearchEngine . UrlEncode(qq("$text")); $params{'-class'} = $class if $class; $params{'-name'} = UrlEncode($name) if $name; $params{'-title'} = $title if $title; return $q->a(\%params, $text); } *OldGoogleCustomGetHeader = \&GetHeader; *GetHeader = \&NewGoogleCustomGetHeader; sub NewGoogleCustomGetHeader { my $html = OldGoogleCustomGetHeader(@_); my $form = qq {

}; $html =~ s{}{$form}; return $html; }