[Fusionforge-commits] r9969 - in trunk/gforge/plugins/externalsearch: etc etc/plugins/externalsearch include

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Jun 2 18:43:31 CEST 2010


Author: lolando
Date: 2010-06-02 18:43:31 +0200 (Wed, 02 Jun 2010)
New Revision: 9969

Modified:
   trunk/gforge/plugins/externalsearch/etc/config.ini
   trunk/gforge/plugins/externalsearch/etc/plugins/externalsearch/config.php
   trunk/gforge/plugins/externalsearch/include/ExternalSearchPlugin.class.php
Log:
Use variable substitution in config for external search

Modified: trunk/gforge/plugins/externalsearch/etc/config.ini
===================================================================
--- trunk/gforge/plugins/externalsearch/etc/config.ini	2010-06-02 16:36:27 UTC (rev 9968)
+++ trunk/gforge/plugins/externalsearch/etc/config.ini	2010-06-02 16:43:31 UTC (rev 9969)
@@ -2,4 +2,4 @@
 
 # JSON-encoded array of name->URL key/value pairs
 # %web_host% will be replaced with the web_host value from the forge's config
-engines = {"Google":"http:\/\/www.google.com\/search?as_sitesearch=%web_host%&as_q=","AllTheWeb":"http:\/\/alltheweb.com\/search?advanced=1&dincl=%web_host%&q="}
\ No newline at end of file
+engines = {"Google":"http:\/\/www.google.com\/search?as_sitesearch=$core/web_host&as_q=","AllTheWeb":"http:\/\/alltheweb.com\/search?advanced=1&dincl=$core/web_host&q="}

Modified: trunk/gforge/plugins/externalsearch/etc/plugins/externalsearch/config.php
===================================================================
--- trunk/gforge/plugins/externalsearch/etc/plugins/externalsearch/config.php	2010-06-02 16:36:27 UTC (rev 9968)
+++ trunk/gforge/plugins/externalsearch/etc/plugins/externalsearch/config.php	2010-06-02 16:43:31 UTC (rev 9969)
@@ -1,8 +1,8 @@
 <?php
 
 $externalSearchEngines = array(
-	'Google' => 'http://www.google.com/search?as_sitesearch=%web_host%&as_q=',
-	'AllTheWeb' => 'http://alltheweb.com/search?advanced=1&dincl=%web_host%&q='
+	'Google' => 'http://www.google.com/search?as_sitesearch='.forge_get_config('web_host').'&as_q=',
+	'AllTheWeb' => 'http://alltheweb.com/search?advanced=1&dincl='.forge_get_config('web_host').'&q='
 );
 
 // Local Variables:

Modified: trunk/gforge/plugins/externalsearch/include/ExternalSearchPlugin.class.php
===================================================================
--- trunk/gforge/plugins/externalsearch/include/ExternalSearchPlugin.class.php	2010-06-02 16:36:27 UTC (rev 9968)
+++ trunk/gforge/plugins/externalsearch/include/ExternalSearchPlugin.class.php	2010-06-02 16:43:31 UTC (rev 9969)
@@ -15,7 +15,7 @@
 require_once $gfplugins.'externalsearch/include/ExternalSearchEngine.class.php';
 
 forge_define_config_item('engines','externalsearch',
-			 '{"Google":"http:\/\/www.google.com\/search?as_sitesearch=%web_host%&as_q=","AllTheWeb":"http:\/\/alltheweb.com\/search?advanced=1&dincl=%web_host%&q="}'
+			 '{"Google":"http:\/\/www.google.com\/search?as_sitesearch=$core/web_host&as_q=","AllTheWeb":"http:\/\/alltheweb.com\/search?advanced=1&dincl=$core/web_host&q="}'
 	) ;
 
 class ExternalSearchPlugin extends Plugin {
@@ -34,12 +34,9 @@
 				$externalSearchEngines = json_decode (forge_get_config ('engines', 'externalsearch')) ;
 				foreach($externalSearchEngines AS $name => $url) {
 					$type = SEARCH__TYPE_IS_EXTERNAL.'_'.$name;
-					$parsedurl = preg_replace ('%web_host%',
-								   forge_get_config ('web_host',
-										     $url)) ;
 					$searchManager->addSearchEngine(
 						$type,
-						new ExternalSearchEngine($type, $name, $parsedurl)
+						new ExternalSearchEngine($type, $name, $url)
 					);
 				}
 				break;




More information about the Fusionforge-commits mailing list