diff options
author | Sem <sembrestels@riseup.net> | 2011-12-30 04:50:08 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2011-12-30 04:50:08 +0100 |
commit | 7803f4e28220c11ce6250fbf28e93cd1411a6e48 (patch) | |
tree | 0340113d2a5e8ce2edd43af0feb1ae45ffafad84 /views/xml/opensearch/description.php | |
parent | 7f6149b755b42125e18b767c7a361132c7a2f8c9 (diff) | |
download | elgg-7803f4e28220c11ce6250fbf28e93cd1411a6e48.tar.gz elgg-7803f4e28220c11ce6250fbf28e93cd1411a6e48.tar.bz2 |
No more config file. Cofiguration is now set by settings.
Diffstat (limited to 'views/xml/opensearch/description.php')
-rw-r--r-- | views/xml/opensearch/description.php | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/views/xml/opensearch/description.php b/views/xml/opensearch/description.php index 78aadc699..586cadf83 100644 --- a/views/xml/opensearch/description.php +++ b/views/xml/opensearch/description.php @@ -1,6 +1,6 @@ <?php /** - * Creates an OpenSearch description document from config.ini + * Creates an OpenSearch description document from plugin settings * http://www.opensearch.org/Specifications/OpenSearch/1.1 */ @@ -8,18 +8,31 @@ header('Pragma: public', true); header('Cache-Control: public', true); -$config_ini = dirname(dirname(dirname(dirname(__FILE__)))) . '/config.ini'; -$config = parse_ini_file($config_ini); -if ($config == false) { - elgg_log("Unable to parse OpenSearch config file", 'ERROR'); - return true; -} - -extract($config); - $site = elgg_get_site_entity(); $email = $site->email; +$shortname = elgg_get_plugin_setting('shortname', 'opensearch'); +$description = elgg_get_plugin_setting('desc', 'opensearch'); +$longname = elgg_get_plugin_setting('longname', 'opensearch'); +$icon = elgg_get_plugin_setting('icon', 'opensearch'); +$tags = elgg_get_plugin_setting('tags', 'opensearch'); +$lang = string_to_tag_array(elgg_get_plugin_setting('lang', 'opensearch')); +$query = elgg_get_plugin_setting('query', 'opensearch'); + +if (empty($shortname)) { + $shortname = $site->name; +} +if (empty($description)) { + $description = elgg_echo('opensearch:engine', array(elgg_get_site_entity()->name)); +} +if (empty($icon)) { + $icon = '_graphics/favicon.ico'; +} +if (empty($lang)) { + $lang = 'en-us'; +} + + $rss_url = elgg_normalize_url('search/?q={searchTerms}&view=opensearch_rss'); $rss_url = elgg_format_url($rss_url); $html_url = elgg_normalize_url('search/?q={searchTerms}'); @@ -35,11 +48,10 @@ $site_url = elgg_get_site_url(); <Contact><?php echo $site->email; ?></Contact> <Url type="text/html" template="<?php echo $html_url; ?>"/> <Url type="application/rss+xml" template="<?php echo $rss_url; ?>"/> -<?php if (isset($ico)): ?> - <Image height="16" width="16" type="image/vnd.microsoft.icon"><?php echo "{$site_url}$ico"; ?></Image> -<?php endif; ?> -<?php if (isset($png)): ?> - <Image height="64" width="64" type="image/png"><?php echo "{$site_url}$png"; ?></Image> +<?php if (preg_match("/.ico$/", $icon)): ?> + <Image height="16" width="16" type="image/vnd.microsoft.icon"><?php echo "{$site_url}$icon"; ?></Image> +<?php elseif (preg_match("/.png$/", $icon)): ?> + <Image height="64" width="64" type="image/png"><?php echo "{$site_url}$icon"; ?></Image> <?php endif; ?> <?php if (isset($tags)): ?> <Tags><?php echo $tags; ?></Tags> |