| 1 |
|
<?php |
| 2 |
|
/* |
| 3 |
|
* Created on Apr 6, 2007 |
| 4 |
|
* |
| 5 |
|
* To change the template for this generated file go to |
| 6 |
|
* Window - Preferences - PHPeclipse - PHP - Code Templates |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
|
|
| 10 |
|
function leech_keywords_engine_google_news_keywords_engine_api($action, $args = array()) { |
| 11 |
|
switch($action) { |
| 12 |
|
case 'list_engines': |
| 13 |
|
return array('engine_google_news' => t('Google News engine')); |
| 14 |
|
break; |
| 15 |
|
case 'parse_url': |
| 16 |
|
if( isset( $args['engines']['engine_google_news'] ) && $args['engines']['engine_google_news'] != FALSE ) { |
| 17 |
|
return array('engine_google_news' => _google_news_engine_parse_url($args['keywords'])); |
| 18 |
|
} |
| 19 |
|
break; |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|
| 23 |
|
function _google_news_engine_parse_url ($keywords = ""){ |
| 24 |
|
$keywords = urlencode($keywords); |
| 25 |
|
$url = "http://news.google.com/news?hl=en&ned=us&ie=UTF-8&q=$keywords&output=rss"; |
| 26 |
|
return $url; |
| 27 |
|
} |