Skip to content
Snippets Groups Projects
Commit 02fb23c6 authored by Brett Bieber's avatar Brett Bieber
Browse files

All multiple API keys to be set

parent 57ddbf4c
No related branches found
No related tags found
No related merge requests found
......@@ -13,4 +13,7 @@ require_once 'UNL/Autoload.php';
*/
// the following key is only "valid" for http://ucommabel.unl.edu/workspace/UNL_Search/www/
// UNL_Search::$jsapiKey = 'ABQIAAAAGAtSvF89-VbesSJ07TEeoBTpxXZziuBpIcFFfJO7Mm8wj1oQWRRwVSIfGRIEAC9DlOSQX7rAAWHjhA';
// UNL_Search::$jsapiKeys[] = 'ABQIAAAAGAtSvF89-VbesSJ07TEeoBTpxXZziuBpIcFFfJO7Mm8wj1oQWRRwVSIfGRIEAC9DlOSQX7rAAWHjhA';
<?php
class UNL_Search
{
public static $jsapiKey = '';
/**
* Array of Google JS API keys to use
*
* @var array
*/
public static $jsapiKeys = array();
function __construct()
{
......@@ -45,5 +50,19 @@ class UNL_Search
return $html;
}
/**
* Return an API key
*
* @return string
*/
function getJSAPIKey()
{
if (empty(self::$jsapiKeys)) {
return '';
}
shuffle(self::$jsapiKeys);
return self::$jsapiKeys[0];
}
}
?>
\ No newline at end of file
......@@ -16,7 +16,8 @@ if (isset($_GET['format'])
$page = UNL_Templates::factory($template);
$page->doctitle = '<title>UNL | Search</title>';
$local_results = '';
$page->addScript('http://www.google.com/jsapi' . (empty(UNL_Search::$jsapiKey) ? '' : '?key=' . UNL_Search::$jsapiKey));
$apiKey = UNL_Search::getJSAPIKey();
$page->addScript('http://www.google.com/jsapi' . (empty($apiKey) ? '' : '?key=' . $apiKey));
$page->head .= '
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="http://directory.unl.edu/css/result_lists.css" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment