|
1 <?php |
|
2 |
|
3 /** |
|
4 * Zend Framework |
|
5 * |
|
6 * LICENSE |
|
7 * |
|
8 * This source file is subject to the new BSD license that is bundled |
|
9 * with this package in the file LICENSE.txt. |
|
10 * It is also available through the world-wide-web at this URL: |
|
11 * http://framework.zend.com/license/new-bsd |
|
12 * If you did not receive a copy of the license and are unable to |
|
13 * obtain it through the world-wide-web, please send an email |
|
14 * to license@zend.com so we can send you a copy immediately. |
|
15 * |
|
16 * @category Zend |
|
17 * @package Zend_Service |
|
18 * @subpackage Yahoo |
|
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
21 * @version $Id: WebResult.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
22 */ |
|
23 |
|
24 |
|
25 /** |
|
26 * @see Zend_Service_Yahoo_Result |
|
27 */ |
|
28 require_once 'Zend/Service/Yahoo/Result.php'; |
|
29 |
|
30 |
|
31 /** |
|
32 * @category Zend |
|
33 * @package Zend_Service |
|
34 * @subpackage Yahoo |
|
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
36 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
37 */ |
|
38 class Zend_Service_Yahoo_WebResult extends Zend_Service_Yahoo_Result |
|
39 { |
|
40 /** |
|
41 * A summary of the result |
|
42 * |
|
43 * @var string |
|
44 */ |
|
45 public $Summary; |
|
46 |
|
47 /** |
|
48 * The file type of the result (text, html, pdf, etc.) |
|
49 * |
|
50 * @var string |
|
51 */ |
|
52 public $MimeType; |
|
53 |
|
54 /** |
|
55 * The modification time of the result (as a unix timestamp) |
|
56 * |
|
57 * @var string |
|
58 */ |
|
59 public $ModificationDate; |
|
60 |
|
61 /** |
|
62 * The URL for the Yahoo cache of this page, if it exists |
|
63 * |
|
64 * @var string |
|
65 */ |
|
66 public $CacheUrl; |
|
67 |
|
68 /** |
|
69 * The size of the cache entry |
|
70 * |
|
71 * @var int |
|
72 */ |
|
73 public $CacheSize; |
|
74 |
|
75 /** |
|
76 * Web result namespace |
|
77 * |
|
78 * @var string |
|
79 */ |
|
80 protected $_namespace = 'urn:yahoo:srch'; |
|
81 |
|
82 |
|
83 /** |
|
84 * Initializes the web result |
|
85 * |
|
86 * @param DOMElement $result |
|
87 * @return void |
|
88 */ |
|
89 public function __construct(DOMElement $result) |
|
90 { |
|
91 $this->_fields = array('Summary', 'MimeType', 'ModificationDate'); |
|
92 parent::__construct($result); |
|
93 |
|
94 $this->_xpath = new DOMXPath($result->ownerDocument); |
|
95 $this->_xpath->registerNamespace('yh', $this->_namespace); |
|
96 |
|
97 // check if the cache section exists |
|
98 $cacheUrl = $this->_xpath->query('./yh:Cache/yh:Url/text()', $result)->item(0); |
|
99 if ($cacheUrl instanceof DOMNode) |
|
100 { |
|
101 $this->CacheUrl = $cacheUrl->data; |
|
102 } |
|
103 $cacheSize = $this->_xpath->query('./yh:Cache/yh:Size/text()', $result)->item(0); |
|
104 if ($cacheSize instanceof DOMNode) |
|
105 { |
|
106 $this->CacheSize = (int) $cacheSize->data; |
|
107 } |
|
108 } |
|
109 } |