1<?php 2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 3 4/** 5 * Image search class 6 * 7 * Copyright 2005-2006 Martin Jansen 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 * @category Services 22 * @package Services_Yahoo 23 * @author Martin Jansen <mj@php.net> 24 * @copyright 2005-2006 Martin Jansen 25 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 26 * @version CVS: $Id: news.php,v 1.5 2006/10/04 13:30:31 mj Exp $ 27 * @link http://pear.php.net/package/Services_Yahoo 28 */ 29 30require_once "AbstractSearch.php"; 31 32/** 33 * News search class 34 * 35 * This class implements an interface to Yahoo's News search by using 36 * the Yahoo API. 37 * 38 * @category Services 39 * @package Services_Yahoo 40 * @author Martin Jansen <mj@php.net> 41 * @copyright 2005-2006 Martin Jansen 42 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 43 * @version CVS: $Id: news.php,v 1.5 2006/10/04 13:30:31 mj Exp $ 44 * @link http://pear.php.net/package/Services_Yahoo 45 * @link http://developer.yahoo.net/news/V1/newsSearch.html 46 */ 47class Services_Yahoo_Search_news extends Services_Yahoo_Search_AbstractSearch { 48 49 protected $requestURL = "http://api.search.yahoo.com/NewsSearchService/V1/newsSearch"; 50 51 /** 52 * Set whether to sort articles by relevance or most-recent 53 * 54 * 55 * @access public 56 * @param string Sort type (either "rank" or "date") 57 * @return Services_Yahoo_AbstractSearch Object which contains the method 58 */ 59 public function sortedBy($sort) 60 { 61 $this->parameters['sort'] = $sort; 62 63 return $this; 64 } 65 66 /** 67 * Set the language the results are written in 68 * 69 * A list of supported languages can be found on 70 * http://developer.yahoo.net/documentation/languages.html. 71 * 72 * @link http://developer.yahoo.net/documentation/languages.html 73 * @access public 74 * @param string Language code 75 * @return Services_Yahoo_AbstractSearch Object which contains the method 76 */ 77 public function inLanguage($language) 78 { 79 $this->parameters['language'] = $language; 80 81 return $this; 82 } 83} 84