From fdf34fc078b2d77b63c6a911fe02d793af3e3d6a Mon Sep 17 00:00:00 2001 From: Kevin Abel <kabel2@unl.edu> Date: Tue, 16 Aug 2011 16:23:19 +0000 Subject: [PATCH] Added a new static member for the jsapi from google. Bad things happen if you use the wrong key. --- config.sample.php | 8 ++++++++ src/UNL/Search.php | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/config.sample.php b/config.sample.php index f852ef5..c5d4ee2 100644 --- a/config.sample.php +++ b/config.sample.php @@ -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'; diff --git a/src/UNL/Search.php b/src/UNL/Search.php index 794837d..c72f30a 100644 --- a/src/UNL/Search.php +++ b/src/UNL/Search.php @@ -1,17 +1,19 @@ <?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 -- GitLab