diff --git a/config.sample.php b/config.sample.php index f852ef58cde0173f1de834bf470cb96e7e1240cb..c5d4ee2273b67f880489fd92bde585f9c8cfd112 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 794837d43adcae79057ba9b762a2f5a0662567ee..c72f30aeaf0e1cdbc555065649fbb50c90204896 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