|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Service |
|
17 * @subpackage Technorati |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: CosmosResult.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 |
|
24 /** |
|
25 * @see Zend_Service_Technorati_Result |
|
26 */ |
|
27 require_once 'Zend/Service/Technorati/Result.php'; |
|
28 |
|
29 |
|
30 /** |
|
31 * Represents a single Technorati Cosmos query result object. |
|
32 * It is never returned as a standalone object, |
|
33 * but it always belongs to a valid Zend_Service_Technorati_CosmosResultSet object. |
|
34 * |
|
35 * @category Zend |
|
36 * @package Zend_Service |
|
37 * @subpackage Technorati |
|
38 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
39 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
40 */ |
|
41 class Zend_Service_Technorati_CosmosResult extends Zend_Service_Technorati_Result |
|
42 { |
|
43 /** |
|
44 * Technorati weblog object that links queried URL. |
|
45 * |
|
46 * @var Zend_Service_Technorati_Weblog |
|
47 * @access protected |
|
48 */ |
|
49 protected $_weblog; |
|
50 |
|
51 /** |
|
52 * The nearest permalink tracked for queried URL. |
|
53 * |
|
54 * @var Zend_Uri_Http |
|
55 * @access protected |
|
56 */ |
|
57 protected $_nearestPermalink; |
|
58 |
|
59 /** |
|
60 * The excerpt of the blog/page linking queried URL. |
|
61 * |
|
62 * @var string |
|
63 * @access protected |
|
64 */ |
|
65 protected $_excerpt; |
|
66 |
|
67 /** |
|
68 * The the datetime the link was created. |
|
69 * |
|
70 * @var Zend_Date |
|
71 * @access protected |
|
72 */ |
|
73 protected $_linkCreated; |
|
74 |
|
75 /** |
|
76 * The URL of the specific link target page |
|
77 * |
|
78 * @var Zend_Uri_Http |
|
79 * @access protected |
|
80 */ |
|
81 protected $_linkUrl; |
|
82 |
|
83 |
|
84 /** |
|
85 * Constructs a new object object from DOM Element. |
|
86 * |
|
87 * @param DomElement $dom the ReST fragment for this object |
|
88 */ |
|
89 public function __construct(DomElement $dom) |
|
90 { |
|
91 $this->_fields = array( '_nearestPermalink' => 'nearestpermalink', |
|
92 '_excerpt' => 'excerpt', |
|
93 '_linkCreated' => 'linkcreated', |
|
94 '_linkUrl' => 'linkurl'); |
|
95 parent::__construct($dom); |
|
96 |
|
97 // weblog object field |
|
98 $this->_parseWeblog(); |
|
99 |
|
100 // filter fields |
|
101 $this->_nearestPermalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_nearestPermalink); |
|
102 $this->_linkUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_linkUrl); |
|
103 $this->_linkCreated = Zend_Service_Technorati_Utils::normalizeDate($this->_linkCreated); |
|
104 } |
|
105 |
|
106 /** |
|
107 * Returns the weblog object that links queried URL. |
|
108 * |
|
109 * @return Zend_Service_Technorati_Weblog |
|
110 */ |
|
111 public function getWeblog() { |
|
112 return $this->_weblog; |
|
113 } |
|
114 |
|
115 /** |
|
116 * Returns the nearest permalink tracked for queried URL. |
|
117 * |
|
118 * @return Zend_Uri_Http |
|
119 */ |
|
120 public function getNearestPermalink() { |
|
121 return $this->_nearestPermalink; |
|
122 } |
|
123 |
|
124 /** |
|
125 * Returns the excerpt of the blog/page linking queried URL. |
|
126 * |
|
127 * @return string |
|
128 */ |
|
129 public function getExcerpt() { |
|
130 return $this->_excerpt; |
|
131 } |
|
132 |
|
133 /** |
|
134 * Returns the datetime the link was created. |
|
135 * |
|
136 * @return Zend_Date |
|
137 */ |
|
138 public function getLinkCreated() { |
|
139 return $this->_linkCreated; |
|
140 } |
|
141 |
|
142 /** |
|
143 * If queried URL is a valid blog, |
|
144 * returns the URL of the specific link target page. |
|
145 * |
|
146 * @return Zend_Uri_Http |
|
147 */ |
|
148 public function getLinkUrl() { |
|
149 return $this->_linkUrl; |
|
150 } |
|
151 |
|
152 } |