Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Service/Technorati/Weblog.php
Go to the documentation of this file.
00001 <?php
00027 require_once 'Zend/Service/Technorati/Author.php';
00028 
00032 require_once 'Zend/Service/Technorati/Utils.php';
00033 
00034 
00044 class Zend_Service_Technorati_Weblog
00045 {
00052     protected $_name;
00053 
00060     protected $_url;
00061 
00068     protected $_rssUrl;
00069 
00076     protected $_atomUrl;
00077 
00084     protected $_inboundBlogs;
00085 
00092     protected $_inboundLinks;
00093 
00100     protected $_lastUpdate;
00101 
00110     protected $_rank;
00111 
00120     protected $_lat;
00121 
00130     protected $_lon;
00131 
00141     protected $_hasPhoto = false;
00142 
00149     protected $_authors = array();
00150 
00151 
00157     public function __construct(DomElement $dom)
00158     {
00159         $xpath = new DOMXPath($dom->ownerDocument);
00160 
00161         $result = $xpath->query('./name/text()', $dom);
00162         if ($result->length == 1) $this->setName($result->item(0)->data);
00163 
00164         $result = $xpath->query('./url/text()', $dom);
00165         if ($result->length == 1) $this->setUrl($result->item(0)->data);
00166 
00167         $result = $xpath->query('./inboundblogs/text()', $dom);
00168         if ($result->length == 1) $this->setInboundBlogs($result->item(0)->data);
00169 
00170         $result = $xpath->query('./inboundlinks/text()', $dom);
00171         if ($result->length == 1) $this->setInboundLinks($result->item(0)->data);
00172 
00173         $result = $xpath->query('./lastupdate/text()', $dom);
00174         if ($result->length == 1) $this->setLastUpdate($result->item(0)->data);
00175 
00176         /* The following elements need more attention */
00177 
00178         $result = $xpath->query('./rssurl/text()', $dom);
00179         if ($result->length == 1) $this->setRssUrl($result->item(0)->data);
00180 
00181         $result = $xpath->query('./atomurl/text()', $dom);
00182         if ($result->length == 1) $this->setAtomUrl($result->item(0)->data);
00183 
00184         $result = $xpath->query('./author', $dom);
00185         if ($result->length >= 1) {
00186             foreach ($result as $author) {
00187                 $this->_authors[] = new Zend_Service_Technorati_Author($author);
00188             }
00189         }
00190 
00198         $result = $xpath->query('./rank/text()', $dom);
00199         if ($result->length == 1) $this->setRank($result->item(0)->data);
00200 
00201         $result = $xpath->query('./lat/text()', $dom);
00202         if ($result->length == 1) $this->setLat($result->item(0)->data);
00203 
00204         $result = $xpath->query('./lon/text()', $dom);
00205         if ($result->length == 1) $this->setLon($result->item(0)->data);
00206 
00207         $result = $xpath->query('./hasphoto/text()', $dom);
00208         if ($result->length == 1) $this->setHasPhoto($result->item(0)->data);
00209     }
00210 
00211 
00217     public function getName()
00218     {
00219         return $this->_name;
00220     }
00221 
00227     public function getUrl()
00228     {
00229         return $this->_url;
00230     }
00231 
00237     public function getInboundBlogs()
00238     {
00239         return $this->_inboundBlogs;
00240     }
00241 
00247     public function getInboundLinks()
00248     {
00249         return $this->_inboundLinks;
00250     }
00251 
00258     public function getRssUrl()
00259     {
00260         return $this->_rssUrl;
00261     }
00262 
00269     public function getAtomUrl()
00270     {
00271         return $this->_atomUrl;
00272     }
00273 
00279     public function getLastUpdate()
00280     {
00281         return $this->_lastUpdate;
00282     }
00283 
00291     public function getRank()
00292     {
00293         return $this->_rank;
00294     }
00295 
00303     public function getLat() {
00304         return $this->_lat;
00305     }
00306 
00314     public function getLon()
00315     {
00316         return $this->_lon;
00317     }
00318 
00327     public function hasPhoto()
00328     {
00329         return (bool) $this->_hasPhoto;
00330     }
00331 
00337     public function getAuthors()
00338     {
00339         return (array) $this->_authors;
00340     }
00341 
00342 
00349     public function setName($name)
00350     {
00351         $this->_name = (string) $name;
00352         return $this;
00353     }
00354 
00363     public function setUrl($url)
00364     {
00365         $this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
00366         return $this;
00367     }
00368 
00375     public function setInboundBlogs($number)
00376     {
00377         $this->_inboundBlogs = (int) $number;
00378         return $this;
00379     }
00380 
00387     public function setInboundLinks($number)
00388     {
00389         $this->_inboundLinks = (int) $number;
00390         return $this;
00391     }
00392 
00401     public function setRssUrl($url)
00402     {
00403         $this->_rssUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
00404         return $this;
00405     }
00406 
00415     public function setAtomUrl($url)
00416     {
00417         $this->_atomUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
00418         return $this;
00419     }
00420 
00432     public function setLastUpdate($datetime)
00433     {
00434         $this->_lastUpdate = Zend_Service_Technorati_Utils::normalizeDate($datetime);
00435         return $this;
00436     }
00437 
00444     public function setRank($rank)
00445     {
00446         $this->_rank = (int) $rank;
00447         return $this;
00448     }
00449 
00456     public function setLat($coordinate)
00457     {
00458         $this->_lat = (float) $coordinate;
00459         return $this;
00460     }
00461 
00468     public function setLon($coordinate)
00469     {
00470         $this->_lon = (float) $coordinate;
00471         return $this;
00472     }
00473 
00480     public function setHasPhoto($hasPhoto)
00481     {
00482         $this->_hasPhoto = (bool) $hasPhoto;
00483         return $this;
00484     }
00485 
00486 }
 All Data Structures Namespaces Files Functions Variables Enumerations