Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Service/Yahoo/Result.php
Go to the documentation of this file.
00001 <?php
00002 
00032 class Zend_Service_Yahoo_Result
00033 {
00039     public $Title;
00040 
00046     public $Url;
00047 
00053     public $ClickUrl;
00054 
00060     protected $_fields;
00061 
00067     protected $_result;
00068 
00074     protected $_xpath;
00075 
00076 
00083     public function __construct(DOMElement $result)
00084     {
00085         // default fields for all search results:
00086         $fields = array('Title', 'Url', 'ClickUrl');
00087 
00088         // merge w/ child's fields
00089         $this->_fields = array_merge($this->_fields, $fields);
00090 
00091         $this->_xpath = new DOMXPath($result->ownerDocument);
00092         $this->_xpath->registerNamespace('yh', $this->_namespace);
00093 
00094         // add search results to appropriate fields
00095 
00096         foreach ($this->_fields as $f) {
00097             $query = "./yh:$f/text()";
00098             $node = $this->_xpath->query($query, $result);
00099             if ($node->length == 1) {
00100                 $this->{$f} = $node->item(0)->data;
00101             }
00102         }
00103 
00104         $this->_result = $result;
00105     }
00106 
00107 
00113     protected function _setThumbnail()
00114     {
00115         $node = $this->_xpath->query('./yh:Thumbnail', $this->_result);
00116         if ($node->length == 1) {
00120             require_once 'Zend/Service/Yahoo/Image.php';
00121             $this->Thumbnail = new Zend_Service_Yahoo_Image($node->item(0), $this->_namespace);
00122         } else {
00123             $this->Thumbnail = null;
00124         }
00125     }
00126 }
 All Data Structures Namespaces Files Functions Variables Enumerations