Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL_Search
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Experience Group
UNL_Search
Commits
02fb23c6
Commit
02fb23c6
authored
13 years ago
by
Brett Bieber
Browse files
Options
Downloads
Patches
Plain Diff
All multiple API keys to be set
parent
57ddbf4c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.sample.php
+4
-1
4 additions, 1 deletion
config.sample.php
src/UNL/Search.php
+21
-2
21 additions, 2 deletions
src/UNL/Search.php
www/index.php
+2
-1
2 additions, 1 deletion
www/index.php
with
27 additions
and
4 deletions
config.sample.php
+
4
−
1
View file @
02fb23c6
...
...
@@ -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';
This diff is collapsed.
Click to expand it.
src/UNL/Search.php
+
21
−
2
View file @
02fb23c6
<?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
This diff is collapsed.
Click to expand it.
www/index.php
+
2
−
1
View file @
02fb23c6
...
...
@@ -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" />
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment