forked from openSUSE/wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle-coop.php
35 lines (29 loc) · 1.81 KB
/
google-coop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
# Google Custom Search Engine Extension
#
# Tag :
# <Googlecoop></Googlecoop> or <Googlecoop/>
# Ex :
# Add this tag to the wiki page you configed at your Google co-op control panel.
#
# Enjoy !
$wgExtensionFunctions[] = 'GoogleCoop';
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Google Co-op Extension',
'description' => 'Using Google Co-op',
'author' => 'Liang Chen The BiGreat',
'url' => 'http://www.mediawiki.org/wiki/Extension:Google_Custom_Search_Engine'
);
function GoogleCoop() {
global $wgParser;
$wgParser->setHook('Googlecoop', 'renderGoogleCoop');
}
# The callback function for converting the input text to HTML output
function renderGoogleCoop($input) {
global $bento_lang;
$google_search_lang = 'en';
if (isset( $bento_lang )) $google_search_lang = $bento_lang;
$output='<form action="http://'.$_SERVER["SERVER_NAME"].'/MediaWiki:GoogleSearch" id="cse-search-box" style="margin-left:10px;"><div><input type="hidden" name="cx" value="013285077636246033335:2wluvjftece" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form><script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=' . $google_search_lang . '"></script><div id="cse-search-results" style="margin-left:10px;"></div><script type="text/javascript">var googleSearchIframeName = "cse-search-results";var googleSearchFormName = "cse-search-box";var googleSearchFrameWidth = 600;var googleSearchDomain = "www.google.com";var googleSearchPath = "/cse";</script><script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>';
return $output;
}
?>