File indexing completed on 2025-01-26 05:25:30
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Service 0018 * @subpackage Yahoo 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 0025 /** 0026 * @see Zend_Service_Yahoo_Result 0027 */ 0028 // require_once 'Zend/Service/Yahoo/Result.php'; 0029 0030 0031 /** 0032 * @category Zend 0033 * @package Zend_Service 0034 * @subpackage Yahoo 0035 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0036 * @license http://framework.zend.com/license/new-bsd New BSD License 0037 */ 0038 class Zend_Service_Yahoo_WebResult extends Zend_Service_Yahoo_Result 0039 { 0040 /** 0041 * A summary of the result 0042 * 0043 * @var string 0044 */ 0045 public $Summary; 0046 0047 /** 0048 * The file type of the result (text, html, pdf, etc.) 0049 * 0050 * @var string 0051 */ 0052 public $MimeType; 0053 0054 /** 0055 * The modification time of the result (as a unix timestamp) 0056 * 0057 * @var string 0058 */ 0059 public $ModificationDate; 0060 0061 /** 0062 * The URL for the Yahoo cache of this page, if it exists 0063 * 0064 * @var string 0065 */ 0066 public $CacheUrl; 0067 0068 /** 0069 * The size of the cache entry 0070 * 0071 * @var int 0072 */ 0073 public $CacheSize; 0074 0075 /** 0076 * Web result namespace 0077 * 0078 * @var string 0079 */ 0080 protected $_namespace = 'urn:yahoo:srch'; 0081 0082 0083 /** 0084 * Initializes the web result 0085 * 0086 * @param DOMElement $result 0087 * @return void 0088 */ 0089 public function __construct(DOMElement $result) 0090 { 0091 $this->_fields = array('Summary', 'MimeType', 'ModificationDate'); 0092 parent::__construct($result); 0093 0094 $this->_xpath = new DOMXPath($result->ownerDocument); 0095 $this->_xpath->registerNamespace('yh', $this->_namespace); 0096 0097 // check if the cache section exists 0098 $cacheUrl = $this->_xpath->query('./yh:Cache/yh:Url/text()', $result)->item(0); 0099 if ($cacheUrl instanceof DOMNode) 0100 { 0101 $this->CacheUrl = $cacheUrl->data; 0102 } 0103 $cacheSize = $this->_xpath->query('./yh:Cache/yh:Size/text()', $result)->item(0); 0104 if ($cacheSize instanceof DOMNode) 0105 { 0106 $this->CacheSize = (int) $cacheSize->data; 0107 } 0108 } 0109 }