Skip to content
Snippets Groups Projects
Commit fdf34fc0 authored by Kevin Abel's avatar Kevin Abel
Browse files

Added a new static member for the jsapi from google. Bad things happen if you use the wrong key.

parent 6f86376d
Branches
No related tags found
No related merge requests found
......@@ -6,3 +6,11 @@ error_reporting(E_ALL);
set_include_path(dirname(__FILE__).'/src:'.dirname(__FILE__).'/lib/php:'.get_include_path());
require_once 'UNL/Autoload.php';
/* A Google Loader API Key is presumably needed to ensure proper functionality.
* Register for an API Key at http://code.google.com/apis/loader/signup.html
* The key is tied to a Google Account and specific to a given URL "referrer"
*/
// the following key is only "valid" for http://ucommabel.unl.edu/workspace/UNL_Search/www/
// UNL_Search::$jsapiKey = 'ABQIAAAAGAtSvF89-VbesSJ07TEeoBTpxXZziuBpIcFFfJO7Mm8wj1oQWRRwVSIfGRIEAC9DlOSQX7rAAWHjhA';
<?php
class UNL_Search
{
public static $jsapiKey = '';
function __construct()
{
}
public static function removeRelativePaths($html, $base_url)
{
$needles = array('href="', 'src="', 'background="');
$new_base_url = $base_url;
$base_url_parts = parse_url($base_url);
if (substr($base_url,-1) != '/') {
if (isset($base_url_parts['path'])) {
$path = pathinfo($base_url_parts['path']);
......@@ -20,7 +22,7 @@ class UNL_Search
}
$new_base_url = substr($new_base_url, 0, strlen($new_base_url)-strlen($path['basename']));
}
foreach ($needles as $needle) {
$new_txt = '';
while ($pos = strpos($html, $needle)) {
......@@ -42,6 +44,6 @@ class UNL_Search
}
return $html;
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment