import v1.0.0-RC4 | 2009-05-20
This commit is contained in:
242
libs/Zend/Service/Technorati/Author.php
Normal file
242
libs/Zend/Service/Technorati/Author.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Author.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Utils
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Utils.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a weblog Author object. It usually belongs to a Technorati account.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_Author
|
||||
{
|
||||
/**
|
||||
* Author first name
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_firstName;
|
||||
|
||||
/**
|
||||
* Author last name
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_lastName;
|
||||
|
||||
/**
|
||||
* Technorati account username
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_username;
|
||||
|
||||
/**
|
||||
* Technorati account description
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_description;
|
||||
|
||||
/**
|
||||
* Technorati account biography
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_bio;
|
||||
|
||||
/**
|
||||
* Technorati account thumbnail picture URL, if any
|
||||
*
|
||||
* @var null|Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_thumbnailPicture;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object from DOM Element.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$xpath = new DOMXPath($dom->ownerDocument);
|
||||
|
||||
$result = $xpath->query('./firstname/text()', $dom);
|
||||
if ($result->length == 1) $this->setFirstName($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./lastname/text()', $dom);
|
||||
if ($result->length == 1) $this->setLastName($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./username/text()', $dom);
|
||||
if ($result->length == 1) $this->setUsername($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./description/text()', $dom);
|
||||
if ($result->length == 1) $this->setDescription($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./bio/text()', $dom);
|
||||
if ($result->length == 1) $this->setBio($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./thumbnailpicture/text()', $dom);
|
||||
if ($result->length == 1) $this->setThumbnailPicture($result->item(0)->data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns Author first name.
|
||||
*
|
||||
* @return string Author first name
|
||||
*/
|
||||
public function getFirstName() {
|
||||
return $this->_firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Author last name.
|
||||
*
|
||||
* @return string Author last name
|
||||
*/
|
||||
public function getLastName() {
|
||||
return $this->_lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Technorati account username.
|
||||
*
|
||||
* @return string Technorati account username
|
||||
*/
|
||||
public function getUsername() {
|
||||
return $this->_username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Technorati account description.
|
||||
*
|
||||
* @return string Technorati account description
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Technorati account biography.
|
||||
*
|
||||
* @return string Technorati account biography
|
||||
*/
|
||||
public function getBio() {
|
||||
return $this->_bio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Technorati account thumbnail picture.
|
||||
*
|
||||
* @return null|Zend_Uri_Http Technorati account thumbnail picture
|
||||
*/
|
||||
public function getThumbnailPicture() {
|
||||
return $this->_thumbnailPicture;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets author first name.
|
||||
*
|
||||
* @param string $input first Name input value
|
||||
* @return Zend_Service_Technorati_Author $this instance
|
||||
*/
|
||||
public function setFirstName($input) {
|
||||
$this->_firstName = (string) $input;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets author last name.
|
||||
*
|
||||
* @param string $input last Name input value
|
||||
* @return Zend_Service_Technorati_Author $this instance
|
||||
*/
|
||||
public function setLastName($input) {
|
||||
$this->_lastName = (string) $input;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Technorati account username.
|
||||
*
|
||||
* @param string $input username input value
|
||||
* @return Zend_Service_Technorati_Author $this instance
|
||||
*/
|
||||
public function setUsername($input) {
|
||||
$this->_username = (string) $input;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Technorati account biography.
|
||||
*
|
||||
* @param string $input biography input value
|
||||
* @return Zend_Service_Technorati_Author $this instance
|
||||
*/
|
||||
public function setBio($input) {
|
||||
$this->_bio = (string) $input;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Technorati account description.
|
||||
*
|
||||
* @param string $input description input value
|
||||
* @return Zend_Service_Technorati_Author $this instance
|
||||
*/
|
||||
public function setDescription($input) {
|
||||
$this->_description = (string) $input;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Technorati account thumbnail picture.
|
||||
*
|
||||
* @param string|Zend_Uri_Http $input thumbnail picture URI
|
||||
* @return Zend_Service_Technorati_Author $this instance
|
||||
* @throws Zend_Service_Technorati_Exception if $input is an invalid URI
|
||||
* (via Zend_Service_Technorati_Utils::normalizeUriHttp)
|
||||
*/
|
||||
public function setThumbnailPicture($input) {
|
||||
$this->_thumbnailPicture = Zend_Service_Technorati_Utils::normalizeUriHttp($input);
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
161
libs/Zend/Service/Technorati/BlogInfoResult.php
Normal file
161
libs/Zend/Service/Technorati/BlogInfoResult.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: BlogInfoResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Utils
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Utils.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati BlogInfo query result object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_BlogInfoResult
|
||||
{
|
||||
/**
|
||||
* Technorati weblog url, if queried URL is a valid weblog.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_url;
|
||||
|
||||
/**
|
||||
* Technorati weblog, if queried URL is a valid weblog.
|
||||
*
|
||||
* @var Zend_Service_Technorati_Weblog
|
||||
* @access protected
|
||||
*/
|
||||
protected $_weblog;
|
||||
|
||||
/**
|
||||
* Number of unique blogs linking this blog
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_inboundBlogs;
|
||||
|
||||
/**
|
||||
* Number of incoming links to this blog
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_inboundLinks;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Document.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomDocument $dom)
|
||||
{
|
||||
$xpath = new DOMXPath($dom);
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Weblog.php';
|
||||
|
||||
$result = $xpath->query('//result/weblog');
|
||||
if ($result->length == 1) {
|
||||
$this->_weblog = new Zend_Service_Technorati_Weblog($result->item(0));
|
||||
} else {
|
||||
// follow the same behavior of blogPostTags
|
||||
// and raise an Exception if the URL is not a valid weblog
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Exception
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Exception.php';
|
||||
throw new Zend_Service_Technorati_Exception(
|
||||
"Your URL is not a recognized Technorati weblog");
|
||||
}
|
||||
|
||||
$result = $xpath->query('//result/url/text()');
|
||||
if ($result->length == 1) {
|
||||
try {
|
||||
// fetched URL often doens't include schema
|
||||
// and this issue causes the following line to fail
|
||||
$this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($result->item(0)->data);
|
||||
} catch(Zend_Service_Technorati_Exception $e) {
|
||||
if ($this->getWeblog() instanceof Zend_Service_Technorati_Weblog) {
|
||||
$this->_url = $this->getWeblog()->getUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = $xpath->query('//result/inboundblogs/text()');
|
||||
if ($result->length == 1) $this->_inboundBlogs = (int) $result->item(0)->data;
|
||||
|
||||
$result = $xpath->query('//result/inboundlinks/text()');
|
||||
if ($result->length == 1) $this->_inboundLinks = (int) $result->item(0)->data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the weblog URL.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the weblog.
|
||||
*
|
||||
* @return Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
public function getWeblog() {
|
||||
return $this->_weblog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of unique blogs linking this blog.
|
||||
*
|
||||
* @return integer the number of inbound blogs
|
||||
*/
|
||||
public function getInboundBlogs()
|
||||
{
|
||||
return (int) $this->_inboundBlogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of incoming links to this blog.
|
||||
*
|
||||
* @return integer the number of inbound links
|
||||
*/
|
||||
public function getInboundLinks()
|
||||
{
|
||||
return (int) $this->_inboundLinks;
|
||||
}
|
||||
|
||||
}
|
152
libs/Zend/Service/Technorati/CosmosResult.php
Normal file
152
libs/Zend/Service/Technorati/CosmosResult.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: CosmosResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Result
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Result.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati Cosmos query result object.
|
||||
* It is never returned as a standalone object,
|
||||
* but it always belongs to a valid Zend_Service_Technorati_CosmosResultSet object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_CosmosResult extends Zend_Service_Technorati_Result
|
||||
{
|
||||
/**
|
||||
* Technorati weblog object that links queried URL.
|
||||
*
|
||||
* @var Zend_Service_Technorati_Weblog
|
||||
* @access protected
|
||||
*/
|
||||
protected $_weblog;
|
||||
|
||||
/**
|
||||
* The nearest permalink tracked for queried URL.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_nearestPermalink;
|
||||
|
||||
/**
|
||||
* The excerpt of the blog/page linking queried URL.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_excerpt;
|
||||
|
||||
/**
|
||||
* The the datetime the link was created.
|
||||
*
|
||||
* @var Zend_Date
|
||||
* @access protected
|
||||
*/
|
||||
protected $_linkCreated;
|
||||
|
||||
/**
|
||||
* The URL of the specific link target page
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_linkUrl;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Element.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$this->_fields = array( '_nearestPermalink' => 'nearestpermalink',
|
||||
'_excerpt' => 'excerpt',
|
||||
'_linkCreated' => 'linkcreated',
|
||||
'_linkUrl' => 'linkurl');
|
||||
parent::__construct($dom);
|
||||
|
||||
// weblog object field
|
||||
$this->_parseWeblog();
|
||||
|
||||
// filter fields
|
||||
$this->_nearestPermalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_nearestPermalink);
|
||||
$this->_linkUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_linkUrl);
|
||||
$this->_linkCreated = Zend_Service_Technorati_Utils::normalizeDate($this->_linkCreated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the weblog object that links queried URL.
|
||||
*
|
||||
* @return Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
public function getWeblog() {
|
||||
return $this->_weblog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nearest permalink tracked for queried URL.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getNearestPermalink() {
|
||||
return $this->_nearestPermalink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the excerpt of the blog/page linking queried URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExcerpt() {
|
||||
return $this->_excerpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the datetime the link was created.
|
||||
*
|
||||
* @return Zend_Date
|
||||
*/
|
||||
public function getLinkCreated() {
|
||||
return $this->_linkCreated;
|
||||
}
|
||||
|
||||
/**
|
||||
* If queried URL is a valid blog,
|
||||
* returns the URL of the specific link target page.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getLinkUrl() {
|
||||
return $this->_linkUrl;
|
||||
}
|
||||
|
||||
}
|
176
libs/Zend/Service/Technorati/CosmosResultSet.php
Normal file
176
libs/Zend/Service/Technorati/CosmosResultSet.php
Normal file
@ -0,0 +1,176 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: CosmosResultSet.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_ResultSet
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/ResultSet.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Technorati Cosmos query result set.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_CosmosResultSet extends Zend_Service_Technorati_ResultSet
|
||||
{
|
||||
/**
|
||||
* Technorati weblog url, if queried URL is a valid weblog.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_url;
|
||||
|
||||
/**
|
||||
* Technorati weblog, if queried URL is a valid weblog.
|
||||
*
|
||||
* @var Zend_Service_Technorati_Weblog
|
||||
* @access protected
|
||||
*/
|
||||
protected $_weblog;
|
||||
|
||||
/**
|
||||
* Number of unique blogs linking this blog
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_inboundBlogs;
|
||||
|
||||
/**
|
||||
* Number of incoming links to this blog
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_inboundLinks;
|
||||
|
||||
/**
|
||||
* Parses the search response and retrieve the results for iteration.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
* @param array $options query options as associative array
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $options = array())
|
||||
{
|
||||
parent::__construct($dom, $options);
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/inboundlinks/text()');
|
||||
if ($result->length == 1) $this->_inboundLinks = (int) $result->item(0)->data;
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/inboundblogs/text()');
|
||||
if ($result->length == 1) $this->_inboundBlogs = (int) $result->item(0)->data;
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/weblog');
|
||||
if ($result->length == 1) {
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Weblog.php';
|
||||
$this->_weblog = new Zend_Service_Technorati_Weblog($result->item(0));
|
||||
}
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/url/text()');
|
||||
if ($result->length == 1) {
|
||||
try {
|
||||
// fetched URL often doens't include schema
|
||||
// and this issue causes the following line to fail
|
||||
$this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($result->item(0)->data);
|
||||
} catch(Zend_Service_Technorati_Exception $e) {
|
||||
if ($this->getWeblog() instanceof Zend_Service_Technorati_Weblog) {
|
||||
$this->_url = $this->getWeblog()->getUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_totalResultsReturned = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
|
||||
|
||||
// total number of results depends on query type
|
||||
// for now check only getInboundLinks() and getInboundBlogs() value
|
||||
if ((int) $this->getInboundLinks() > 0) {
|
||||
$this->_totalResultsAvailable = $this->getInboundLinks();
|
||||
} elseif ((int) $this->getInboundBlogs() > 0) {
|
||||
$this->_totalResultsAvailable = $this->getInboundBlogs();
|
||||
} else {
|
||||
$this->_totalResultsAvailable = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the weblog URL.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the weblog.
|
||||
*
|
||||
* @return Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
public function getWeblog() {
|
||||
return $this->_weblog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of unique blogs linking this blog.
|
||||
*
|
||||
* @return integer the number of inbound blogs
|
||||
*/
|
||||
public function getInboundBlogs()
|
||||
{
|
||||
return $this->_inboundBlogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of incoming links to this blog.
|
||||
*
|
||||
* @return integer the number of inbound links
|
||||
*/
|
||||
public function getInboundLinks()
|
||||
{
|
||||
return $this->_inboundLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Zend_Service_Technorati_ResultSet::current().
|
||||
*
|
||||
* @return Zend_Service_Technorati_CosmosResult current result
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
/**
|
||||
* @see Zend_Service_Technorati_CosmosResult
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/CosmosResult.php';
|
||||
return new Zend_Service_Technorati_CosmosResult($this->_results->item($this->_currentIndex));
|
||||
}
|
||||
}
|
93
libs/Zend/Service/Technorati/DailyCountsResult.php
Normal file
93
libs/Zend/Service/Technorati/DailyCountsResult.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DailyCountsResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Result
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Result.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati DailyCounts query result object.
|
||||
* It is never returned as a standalone object,
|
||||
* but it always belongs to a valid Zend_Service_Technorati_DailyCountsResultSet object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_DailyCountsResult extends Zend_Service_Technorati_Result
|
||||
{
|
||||
/**
|
||||
* Date of count.
|
||||
*
|
||||
* @var Zend_Date
|
||||
* @access protected
|
||||
*/
|
||||
protected $_date;
|
||||
|
||||
/**
|
||||
* Number of posts containing query on given date.
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_count;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Document.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$this->_fields = array( '_date' => 'date',
|
||||
'_count' => 'count');
|
||||
parent::__construct($dom);
|
||||
|
||||
// filter fields
|
||||
$this->_date = new Zend_Date(strtotime($this->_date));
|
||||
$this->_count = (int) $this->_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date of count.
|
||||
*
|
||||
* @return Zend_Date
|
||||
*/
|
||||
public function getDate() {
|
||||
return $this->_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of posts containing query on given date.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCount() {
|
||||
return $this->_count;
|
||||
}
|
||||
}
|
125
libs/Zend/Service/Technorati/DailyCountsResultSet.php
Normal file
125
libs/Zend/Service/Technorati/DailyCountsResultSet.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DailyCountsResultSet.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Date
|
||||
*/
|
||||
require_once 'Zend/Date.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_ResultSet
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/ResultSet.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Utils
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Utils.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Technorati Tag query result set.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_DailyCountsResultSet extends Zend_Service_Technorati_ResultSet
|
||||
{
|
||||
/**
|
||||
* Technorati search URL for given query.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_searchUrl;
|
||||
|
||||
/**
|
||||
* Number of days for which counts provided.
|
||||
*
|
||||
* @var Zend_Service_Technorati_Weblog
|
||||
* @access protected
|
||||
*/
|
||||
protected $_days;
|
||||
|
||||
/**
|
||||
* Parses the search response and retrieve the results for iteration.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
* @param array $options query options as associative array
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $options = array())
|
||||
{
|
||||
parent::__construct($dom, $options);
|
||||
|
||||
// default locale prevent Zend_Date to fail
|
||||
// when script is executed via shell
|
||||
// Zend_Locale::setDefault('en');
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/days/text()');
|
||||
if ($result->length == 1) $this->_days = (int) $result->item(0)->data;
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/searchurl/text()');
|
||||
if ($result->length == 1) {
|
||||
$this->_searchUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($result->item(0)->data);
|
||||
}
|
||||
|
||||
$this->_totalResultsReturned = (int) $this->_xpath->evaluate("count(/tapi/document/items/item)");
|
||||
$this->_totalResultsAvailable = (int) $this->getDays();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the search URL for given query.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getSearchUrl() {
|
||||
return $this->_searchUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of days for which counts provided.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDays() {
|
||||
return $this->_days;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Zend_Service_Technorati_ResultSet::current().
|
||||
*
|
||||
* @return Zend_Service_Technorati_DailyCountsResult current result
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
/**
|
||||
* @see Zend_Service_Technorati_DailyCountsResult
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/DailyCountsResult.php';
|
||||
return new Zend_Service_Technorati_DailyCountsResult($this->_results->item($this->_currentIndex));
|
||||
}
|
||||
}
|
39
libs/Zend/Service/Technorati/Exception.php
Normal file
39
libs/Zend/Service/Technorati/Exception.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Exception
|
||||
*/
|
||||
require_once 'Zend/Service/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_Exception extends Zend_Service_Exception
|
||||
{}
|
||||
|
103
libs/Zend/Service/Technorati/GetInfoResult.php
Normal file
103
libs/Zend/Service/Technorati/GetInfoResult.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GetInfoResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati GetInfo query result object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_GetInfoResult
|
||||
{
|
||||
/**
|
||||
* Technorati author
|
||||
*
|
||||
* @var Zend_Service_Technorati_Author
|
||||
* @access protected
|
||||
*/
|
||||
protected $_author;
|
||||
|
||||
/**
|
||||
* A list of weblogs claimed by this author
|
||||
*
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $_weblogs = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Document.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomDocument $dom)
|
||||
{
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Author
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Author.php';
|
||||
|
||||
$result = $xpath->query('//result');
|
||||
if ($result->length == 1) {
|
||||
$this->_author = new Zend_Service_Technorati_Author($result->item(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Weblog.php';
|
||||
|
||||
$result = $xpath->query('//item/weblog');
|
||||
if ($result->length >= 1) {
|
||||
foreach ($result as $weblog) {
|
||||
$this->_weblogs[] = new Zend_Service_Technorati_Weblog($weblog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the author associated with queried username.
|
||||
*
|
||||
* @return Zend_Service_Technorati_Author
|
||||
*/
|
||||
public function getAuthor() {
|
||||
return $this->_author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection of weblogs authored by queried username.
|
||||
*
|
||||
* @return array of Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
public function getWeblogs() {
|
||||
return $this->_weblogs;
|
||||
}
|
||||
|
||||
}
|
118
libs/Zend/Service/Technorati/KeyInfoResult.php
Normal file
118
libs/Zend/Service/Technorati/KeyInfoResult.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: KeyInfoResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati KeyInfo query result object.
|
||||
* It provides information about your Technorati API Key daily usage.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_KeyInfoResult
|
||||
{
|
||||
/**
|
||||
* Technorati API key
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_apiKey;
|
||||
|
||||
/**
|
||||
* Number of queries used today
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_apiQueries;
|
||||
|
||||
/**
|
||||
* Total number of available queries per day
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_maxQueries;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object from DOM Element.
|
||||
* Parses given Key element from $dom and sets API key string.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
* @param string $apiKey the API Key string
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $apiKey = null)
|
||||
{
|
||||
// $this->_dom = $dom;
|
||||
// $this->_xpath = new DOMXPath($dom);
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
$this->_apiQueries = (int) $xpath->query('/tapi/document/result/apiqueries/text()')->item(0)->data;
|
||||
$this->_maxQueries = (int) $xpath->query('/tapi/document/result/maxqueries/text()')->item(0)->data;
|
||||
$this->setApiKey($apiKey);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns API Key string.
|
||||
*
|
||||
* @return string API Key string
|
||||
*/
|
||||
public function getApiKey() {
|
||||
return $this->_apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of queries sent today.
|
||||
*
|
||||
* @return int number of queries sent today
|
||||
*/
|
||||
public function getApiQueries() {
|
||||
return $this->_apiQueries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Key's daily query limit.
|
||||
*
|
||||
* @return int maximum number of available queries per day
|
||||
*/
|
||||
public function getMaxQueries() {
|
||||
return $this->_maxQueries;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets API Key string.
|
||||
*
|
||||
* @param string $apiKey the API Key
|
||||
* @return Zend_Service_Technorati_KeyInfoResult $this instance
|
||||
*/
|
||||
public function setApiKey($apiKey) {
|
||||
$this->_apiKey = $apiKey;
|
||||
return $this;
|
||||
}
|
||||
}
|
121
libs/Zend/Service/Technorati/Result.php
Normal file
121
libs/Zend/Service/Technorati/Result.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Result.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati Search query result object.
|
||||
* It is never returned as a standalone object,
|
||||
* but it always belongs to a valid Zend_Service_Technorati_SearchResultSet object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Zend_Service_Technorati_Result
|
||||
{
|
||||
/**
|
||||
* An associative array of 'fieldName' => 'xmlfieldtag'
|
||||
*
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $_fields;
|
||||
|
||||
/**
|
||||
* The ReST fragment for this result object
|
||||
*
|
||||
* @var DomElement
|
||||
* @access protected
|
||||
*/
|
||||
protected $_dom;
|
||||
|
||||
/**
|
||||
* Object for $this->_dom
|
||||
*
|
||||
* @var DOMXpath
|
||||
* @access protected
|
||||
*/
|
||||
protected $_xpath;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object from DOM Element.
|
||||
* Properties are automatically fetched from XML
|
||||
* according to array of $_fields to be read.
|
||||
*
|
||||
* @param DomElement $result the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$this->_xpath = new DOMXPath($dom->ownerDocument);
|
||||
$this->_dom = $dom;
|
||||
|
||||
// default fields for all search results
|
||||
$fields = array();
|
||||
|
||||
// merge with child's object fields
|
||||
$this->_fields = array_merge($this->_fields, $fields);
|
||||
|
||||
// add results to appropriate fields
|
||||
foreach($this->_fields as $phpName => $xmlName) {
|
||||
$query = "./$xmlName/text()";
|
||||
$node = $this->_xpath->query($query, $this->_dom);
|
||||
if ($node->length == 1) {
|
||||
$this->{$phpName} = (string) $node->item(0)->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses weblog node and sets weblog object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _parseWeblog()
|
||||
{
|
||||
// weblog object field
|
||||
$result = $this->_xpath->query('./weblog', $this->_dom);
|
||||
if ($result->length == 1) {
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Weblog.php';
|
||||
$this->_weblog = new Zend_Service_Technorati_Weblog($result->item(0));
|
||||
} else {
|
||||
$this->_weblog = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document fragment for this object as XML string.
|
||||
*
|
||||
* @return string the document fragment for this object
|
||||
* converted into XML format
|
||||
*/
|
||||
public function getXml()
|
||||
{
|
||||
return $this->_dom->ownerDocument->saveXML($this->_dom);
|
||||
}
|
||||
}
|
290
libs/Zend/Service/Technorati/ResultSet.php
Normal file
290
libs/Zend/Service/Technorati/ResultSet.php
Normal file
@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ResultSet.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Result
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Result.php';
|
||||
|
||||
|
||||
/**
|
||||
* This is the most essential result set.
|
||||
* The scope of this class is to be extended by a query-specific child result set class,
|
||||
* and it should never be used to initialize a standalone object.
|
||||
*
|
||||
* Each of the specific result sets represents a collection of query-specific
|
||||
* Zend_Service_Technorati_Result objects.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Zend_Service_Technorati_ResultSet implements SeekableIterator
|
||||
{
|
||||
/**
|
||||
* The total number of results available
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_totalResultsAvailable;
|
||||
|
||||
/**
|
||||
* The number of results in this result set
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_totalResultsReturned;
|
||||
|
||||
/**
|
||||
* The offset in the total result set of this search set
|
||||
*
|
||||
* @var int
|
||||
* @todo
|
||||
*/
|
||||
// public $firstResultPosition;
|
||||
|
||||
|
||||
/**
|
||||
* A DomNodeList of results
|
||||
*
|
||||
* @var DomNodeList
|
||||
* @access protected
|
||||
*/
|
||||
protected $_results;
|
||||
|
||||
/**
|
||||
* Technorati API response document
|
||||
*
|
||||
* @var DomDocument
|
||||
* @access protected
|
||||
*/
|
||||
protected $_dom;
|
||||
|
||||
/**
|
||||
* Object for $this->_dom
|
||||
*
|
||||
* @var DOMXpath
|
||||
* @access protected
|
||||
*/
|
||||
protected $_xpath;
|
||||
|
||||
/**
|
||||
* XML string representation for $this->_dom
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_xml;
|
||||
|
||||
/**
|
||||
* Current Item
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_currentIndex = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Parses the search response and retrieves the results for iteration.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
* @param array $options query options as associative array
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $options = array())
|
||||
{
|
||||
$this->_init($dom, $options);
|
||||
|
||||
// Technorati loves to make developer's life really hard
|
||||
// I must read query options in order to normalize a single way
|
||||
// to display start and limit.
|
||||
// The value is printed out in XML using many different tag names,
|
||||
// too hard to get it from XML
|
||||
|
||||
// Additionally, the following tags should be always available
|
||||
// according to API documentation but... this is not the truth!
|
||||
// - querytime
|
||||
// - limit
|
||||
// - start (sometimes rankingstart)
|
||||
|
||||
// query tag is only available for some requests, the same for url.
|
||||
// For now ignore them.
|
||||
|
||||
//$start = isset($options['start']) ? $options['start'] : 1;
|
||||
//$limit = isset($options['limit']) ? $options['limit'] : 20;
|
||||
//$this->_firstResultPosition = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes this object from a DomDocument response.
|
||||
*
|
||||
* Because __construct and __wakeup shares some common executions,
|
||||
* it's useful to group them in a single initialization method.
|
||||
* This method is called once each time a new instance is created
|
||||
* or a serialized object is unserialized.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
* @param array $options query options as associative array
|
||||
* * @return void
|
||||
*/
|
||||
protected function _init(DomDocument $dom, $options = array())
|
||||
{
|
||||
$this->_dom = $dom;
|
||||
$this->_xpath = new DOMXPath($dom);
|
||||
|
||||
$this->_results = $this->_xpath->query("//item");
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of results returned.
|
||||
*
|
||||
* @return int total number of results returned
|
||||
*/
|
||||
public function totalResults()
|
||||
{
|
||||
return (int) $this->_totalResultsReturned;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Number of available results.
|
||||
*
|
||||
* @return int total number of available results
|
||||
*/
|
||||
public function totalResultsAvailable()
|
||||
{
|
||||
return (int) $this->_totalResultsAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements SeekableIterator::current().
|
||||
*
|
||||
* @return void
|
||||
* @throws Zend_Service_Exception
|
||||
* @abstract
|
||||
*/
|
||||
// abstract public function current();
|
||||
|
||||
/**
|
||||
* Implements SeekableIterator::key().
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->_currentIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements SeekableIterator::next().
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
$this->_currentIndex += 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements SeekableIterator::rewind().
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->_currentIndex = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement SeekableIterator::seek().
|
||||
*
|
||||
* @param int $index
|
||||
* @return void
|
||||
* @throws OutOfBoundsException
|
||||
*/
|
||||
public function seek($index)
|
||||
{
|
||||
$indexInt = (int) $index;
|
||||
if ($indexInt >= 0 && $indexInt < $this->_results->length) {
|
||||
$this->_currentIndex = $indexInt;
|
||||
} else {
|
||||
throw new OutOfBoundsException("Illegal index '$index'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement SeekableIterator::valid().
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return null !== $this->_results && $this->_currentIndex < $this->_results->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the response document as XML string.
|
||||
*
|
||||
* @return string the response document converted into XML format
|
||||
*/
|
||||
public function getXml()
|
||||
{
|
||||
return $this->_dom->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites standard __sleep method to make this object serializable.
|
||||
*
|
||||
* DomDocument and DOMXpath objects cannot be serialized.
|
||||
* This method converts them back to an XML string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __sleep() {
|
||||
$this->_xml = $this->getXml();
|
||||
$vars = array_keys(get_object_vars($this));
|
||||
return array_diff($vars, array('_dom', '_xpath'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites standard __wakeup method to make this object unserializable.
|
||||
*
|
||||
* Restores object status before serialization.
|
||||
* Converts XML string into a DomDocument object and creates a valid
|
||||
* DOMXpath instance for given DocDocument.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __wakeup() {
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXml($this->_xml);
|
||||
$this->_init($dom);
|
||||
$this->_xml = null; // reset XML content
|
||||
}
|
||||
}
|
150
libs/Zend/Service/Technorati/SearchResult.php
Normal file
150
libs/Zend/Service/Technorati/SearchResult.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SearchResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Result
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Result.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati Search query result object.
|
||||
* It is never returned as a standalone object,
|
||||
* but it always belongs to a valid Zend_Service_Technorati_SearchResultSet object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_SearchResult extends Zend_Service_Technorati_Result
|
||||
{
|
||||
/**
|
||||
* Technorati weblog object corresponding to queried keyword.
|
||||
*
|
||||
* @var Zend_Service_Technorati_Weblog
|
||||
* @access protected
|
||||
*/
|
||||
protected $_weblog;
|
||||
|
||||
/**
|
||||
* The title of the entry.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_title;
|
||||
|
||||
/**
|
||||
* The blurb from entry with search term highlighted.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_excerpt;
|
||||
|
||||
/**
|
||||
* The datetime the entry was created.
|
||||
*
|
||||
* @var Zend_Date
|
||||
* @access protected
|
||||
*/
|
||||
protected $_created;
|
||||
|
||||
/**
|
||||
* The permalink of the blog entry.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_permalink;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Element.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$this->_fields = array( '_permalink' => 'permalink',
|
||||
'_excerpt' => 'excerpt',
|
||||
'_created' => 'created',
|
||||
'_title' => 'title');
|
||||
parent::__construct($dom);
|
||||
|
||||
// weblog object field
|
||||
$this->_parseWeblog();
|
||||
|
||||
// filter fields
|
||||
$this->_permalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_permalink);
|
||||
$this->_created = Zend_Service_Technorati_Utils::normalizeDate($this->_created);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the weblog object that links queried URL.
|
||||
*
|
||||
* @return Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
public function getWeblog() {
|
||||
return $this->_weblog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the entry.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() {
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blurb from entry with search term highlighted.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExcerpt() {
|
||||
return $this->_excerpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the datetime the entry was created.
|
||||
*
|
||||
* @return Zend_Date
|
||||
*/
|
||||
public function getCreated() {
|
||||
return $this->_created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the permalink of the blog entry.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getPermalink() {
|
||||
return $this->_permalink;
|
||||
}
|
||||
|
||||
}
|
79
libs/Zend/Service/Technorati/SearchResultSet.php
Normal file
79
libs/Zend/Service/Technorati/SearchResultSet.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SearchResultSet.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_ResultSet
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/ResultSet.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Technorati Search query result set.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_SearchResultSet extends Zend_Service_Technorati_ResultSet
|
||||
{
|
||||
/**
|
||||
* Number of query results.
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_queryCount;
|
||||
|
||||
/**
|
||||
* Parses the search response and retrieve the results for iteration.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
* @param array $options query options as associative array
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $options = array())
|
||||
{
|
||||
parent::__construct($dom, $options);
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/querycount/text()');
|
||||
if ($result->length == 1) $this->_queryCount = (int) $result->item(0)->data;
|
||||
|
||||
$this->_totalResultsReturned = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
|
||||
$this->_totalResultsAvailable = (int) $this->_queryCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Zend_Service_Technorati_ResultSet::current().
|
||||
*
|
||||
* @return Zend_Service_Technorati_SearchResult current result
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
/**
|
||||
* @see Zend_Service_Technorati_SearchResult
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/SearchResult.php';
|
||||
return new Zend_Service_Technorati_SearchResult($this->_results->item($this->_currentIndex));
|
||||
}
|
||||
}
|
171
libs/Zend/Service/Technorati/TagResult.php
Normal file
171
libs/Zend/Service/Technorati/TagResult.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TagResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Result
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Result.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati Tag query result object.
|
||||
* It is never returned as a standalone object,
|
||||
* but it always belongs to a valid Zend_Service_Technorati_TagResultSet object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_TagResult extends Zend_Service_Technorati_Result
|
||||
{
|
||||
/**
|
||||
* Technorati weblog object corresponding to queried keyword.
|
||||
*
|
||||
* @var Zend_Service_Technorati_Weblog
|
||||
* @access protected
|
||||
*/
|
||||
protected $_weblog;
|
||||
|
||||
/**
|
||||
* The title of the entry.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_title;
|
||||
|
||||
/**
|
||||
* The blurb from entry with search term highlighted.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_excerpt;
|
||||
|
||||
/**
|
||||
* The datetime the entry was created.
|
||||
*
|
||||
* @var Zend_Date
|
||||
* @access protected
|
||||
*/
|
||||
protected $_created;
|
||||
|
||||
/**
|
||||
* The datetime the entry was updated.
|
||||
* Called 'postupdate' in original XML response,
|
||||
* it has been renamed to provide more coherence.
|
||||
*
|
||||
* @var Zend_Date
|
||||
* @access protected
|
||||
*/
|
||||
protected $_updated;
|
||||
|
||||
/**
|
||||
* The permalink of the blog entry.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_permalink;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Element.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$this->_fields = array( '_permalink' => 'permalink',
|
||||
'_excerpt' => 'excerpt',
|
||||
'_created' => 'created',
|
||||
'_updated' => 'postupdate',
|
||||
'_title' => 'title');
|
||||
parent::__construct($dom);
|
||||
|
||||
// weblog object field
|
||||
$this->_parseWeblog();
|
||||
|
||||
// filter fields
|
||||
$this->_permalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_permalink);
|
||||
$this->_created = Zend_Service_Technorati_Utils::normalizeDate($this->_created);
|
||||
$this->_updated = Zend_Service_Technorati_Utils::normalizeDate($this->_updated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the weblog object that links queried URL.
|
||||
*
|
||||
* @return Zend_Service_Technorati_Weblog
|
||||
*/
|
||||
public function getWeblog() {
|
||||
return $this->_weblog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the entry.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() {
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blurb from entry with search term highlighted.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExcerpt() {
|
||||
return $this->_excerpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the datetime the entry was created.
|
||||
*
|
||||
* @return Zend_Date
|
||||
*/
|
||||
public function getCreated() {
|
||||
return $this->_created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the datetime the entry was updated.
|
||||
*
|
||||
* @return Zend_Date
|
||||
*/
|
||||
public function getUpdated() {
|
||||
return $this->_updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the permalink of the blog entry.
|
||||
*
|
||||
* @return Zend_Uri_Http
|
||||
*/
|
||||
public function getPermalink() {
|
||||
return $this->_permalink;
|
||||
}
|
||||
|
||||
}
|
110
libs/Zend/Service/Technorati/TagResultSet.php
Normal file
110
libs/Zend/Service/Technorati/TagResultSet.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TagResultSet.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_ResultSet
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/ResultSet.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Technorati Tag query result set.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_TagResultSet extends Zend_Service_Technorati_ResultSet
|
||||
{
|
||||
/**
|
||||
* Number of posts that match the tag.
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_postsMatched;
|
||||
|
||||
/**
|
||||
* Number of blogs that match the tag.
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_blogsMatched;
|
||||
|
||||
/**
|
||||
* Parses the search response and retrieve the results for iteration.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
* @param array $options query options as associative array
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $options = array())
|
||||
{
|
||||
parent::__construct($dom, $options);
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/postsmatched/text()');
|
||||
if ($result->length == 1) $this->_postsMatched = (int) $result->item(0)->data;
|
||||
|
||||
$result = $this->_xpath->query('/tapi/document/result/blogsmatched/text()');
|
||||
if ($result->length == 1) $this->_blogsMatched = (int) $result->item(0)->data;
|
||||
|
||||
$this->_totalResultsReturned = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
|
||||
/** @todo Validate the following assertion */
|
||||
$this->_totalResultsAvailable = (int) $this->getPostsMatched();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of posts that match the tag.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPostsMatched() {
|
||||
return $this->_postsMatched;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of blogs that match the tag.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBlogsMatched() {
|
||||
return $this->_blogsMatched;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Zend_Service_Technorati_ResultSet::current().
|
||||
*
|
||||
* @return Zend_Service_Technorati_TagResult current result
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
/**
|
||||
* @see Zend_Service_Technorati_TagResult
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/TagResult.php';
|
||||
return new Zend_Service_Technorati_TagResult($this->_results->item($this->_currentIndex));
|
||||
}
|
||||
}
|
93
libs/Zend/Service/Technorati/TagsResult.php
Normal file
93
libs/Zend/Service/Technorati/TagsResult.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TagsResult.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Result
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Result.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a single Technorati TopTags or BlogPostTags query result object.
|
||||
* It is never returned as a standalone object,
|
||||
* but it always belongs to a valid Zend_Service_Technorati_TagsResultSet object.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_TagsResult extends Zend_Service_Technorati_Result
|
||||
{
|
||||
/**
|
||||
* Name of the tag.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_tag;
|
||||
|
||||
/**
|
||||
* Number of posts containing this tag.
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $_posts;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object object from DOM Document.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$this->_fields = array( '_tag' => 'tag',
|
||||
'_posts' => 'posts');
|
||||
parent::__construct($dom);
|
||||
|
||||
// filter fields
|
||||
$this->_tag = (string) $this->_tag;
|
||||
$this->_posts = (int) $this->_posts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tag name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTag() {
|
||||
return $this->_tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of posts.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPosts() {
|
||||
return $this->_posts;
|
||||
}
|
||||
}
|
67
libs/Zend/Service/Technorati/TagsResultSet.php
Normal file
67
libs/Zend/Service/Technorati/TagsResultSet.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TagsResultSet.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_ResultSet
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/ResultSet.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Technorati TopTags or BlogPostTags queries result set.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_TagsResultSet extends Zend_Service_Technorati_ResultSet
|
||||
{
|
||||
/**
|
||||
* Constructs a new object object from DOM Document.
|
||||
*
|
||||
* @param DomDocument $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomDocument $dom, $options = array())
|
||||
{
|
||||
parent::__construct($dom, $options);
|
||||
|
||||
$this->_totalResultsReturned = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
|
||||
$this->_totalResultsAvailable = (int) $this->_totalResultsReturned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Zend_Service_Technorati_ResultSet::current().
|
||||
*
|
||||
* @return Zend_Service_Technorati_TagsResult current result
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
/**
|
||||
* @see Zend_Service_Technorati_TagsResult
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/TagsResult.php';
|
||||
return new Zend_Service_Technorati_TagsResult($this->_results->item($this->_currentIndex));
|
||||
}
|
||||
}
|
136
libs/Zend/Service/Technorati/Utils.php
Normal file
136
libs/Zend/Service/Technorati/Utils.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Utils.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Collection of utilities for various Zend_Service_Technorati classes.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_Utils
|
||||
{
|
||||
/**
|
||||
* Parses, validates and returns a valid Zend_Uri object
|
||||
* from given $input.
|
||||
*
|
||||
* @param string|Zend_Uri_Http $input
|
||||
* @return null|Zend_Uri_Http
|
||||
* @throws Zend_Service_Technorati_Exception
|
||||
* @static
|
||||
*/
|
||||
public static function normalizeUriHttp($input)
|
||||
{
|
||||
// allow null as value
|
||||
if ($input === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Zend_Uri
|
||||
*/
|
||||
require_once 'Zend/Uri.php';
|
||||
if ($input instanceof Zend_Uri_Http) {
|
||||
$uri = $input;
|
||||
} else {
|
||||
try {
|
||||
$uri = Zend_Uri::factory((string) $input);
|
||||
}
|
||||
// wrap exception under Zend_Service_Technorati_Exception object
|
||||
catch (Exception $e) {
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Exception
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Exception.php';
|
||||
throw new Zend_Service_Technorati_Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// allow inly Zend_Uri_Http objects or child classes
|
||||
if (!($uri instanceof Zend_Uri_Http)) {
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Exception
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Exception.php';
|
||||
throw new Zend_Service_Technorati_Exception(
|
||||
"Invalid URL $uri, only HTTP(S) protocols can be used");
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
/**
|
||||
* Parses, validates and returns a valid Zend_Date object
|
||||
* from given $input.
|
||||
*
|
||||
* $input can be either a string, an integer or a Zend_Date object.
|
||||
* If $input is string or int, it will be provided to Zend_Date as it is.
|
||||
* If $input is a Zend_Date object, the object instance will be returned.
|
||||
*
|
||||
* @param mixed|Zend_Date $input
|
||||
* @return null|Zend_Date
|
||||
* @throws Zend_Service_Technorati_Exception
|
||||
* @static
|
||||
*/
|
||||
public static function normalizeDate($input)
|
||||
{
|
||||
/**
|
||||
* @see Zend_Date
|
||||
*/
|
||||
require_once 'Zend/Date.php';
|
||||
/**
|
||||
* @see Zend_Locale
|
||||
*/
|
||||
require_once 'Zend/Locale.php';
|
||||
|
||||
// allow null as value and return valid Zend_Date objects
|
||||
if (($input === null) || ($input instanceof Zend_Date)) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
// due to a BC break as of ZF 1.5 it's not safe to use Zend_Date::isDate() here
|
||||
// see ZF-2524, ZF-2334
|
||||
if (@strtotime($input) !== FALSE) {
|
||||
return new Zend_Date($input);
|
||||
} else {
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Exception
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Exception.php';
|
||||
throw new Zend_Service_Technorati_Exception("'$input' is not a valid Date/Time");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo public static function xpathQueryAndSet() {}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @todo public static function xpathQueryAndSetIf() {}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @todo public static function xpathQueryAndSetUnless() {}
|
||||
*/
|
||||
}
|
486
libs/Zend/Service/Technorati/Weblog.php
Normal file
486
libs/Zend/Service/Technorati/Weblog.php
Normal file
@ -0,0 +1,486 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Weblog.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Author
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Author.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Service_Technorati_Utils
|
||||
*/
|
||||
require_once 'Zend/Service/Technorati/Utils.php';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Weblog object successful recognized by Technorati.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Service
|
||||
* @subpackage Technorati
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Service_Technorati_Weblog
|
||||
{
|
||||
/**
|
||||
* Blog name as written in the feed.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $_name;
|
||||
|
||||
/**
|
||||
* Base blog URL.
|
||||
*
|
||||
* @var Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_url;
|
||||
|
||||
/**
|
||||
* RSS feed URL, if any.
|
||||
*
|
||||
* @var null|Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_rssUrl;
|
||||
|
||||
/**
|
||||
* Atom feed URL, if any.
|
||||
*
|
||||
* @var null|Zend_Uri_Http
|
||||
* @access protected
|
||||
*/
|
||||
protected $_atomUrl;
|
||||
|
||||
/**
|
||||
* Number of unique blogs linking this blog.
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_inboundBlogs;
|
||||
|
||||
/**
|
||||
* Number of incoming links to this blog.
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_inboundLinks;
|
||||
|
||||
/**
|
||||
* Last blog update UNIX timestamp.
|
||||
*
|
||||
* @var null|Zend_Date
|
||||
* @access protected
|
||||
*/
|
||||
protected $_lastUpdate;
|
||||
|
||||
/**
|
||||
* Technorati rank value for this weblog.
|
||||
*
|
||||
* Note. This property has no official documentation.
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_rank;
|
||||
|
||||
/**
|
||||
* Blog latitude coordinate.
|
||||
*
|
||||
* Note. This property has no official documentation.
|
||||
*
|
||||
* @var float
|
||||
* @access protected
|
||||
*/
|
||||
protected $_lat;
|
||||
|
||||
/**
|
||||
* Blog longitude coordinate.
|
||||
*
|
||||
* Note. This property has no official documentation.
|
||||
*
|
||||
* @var float
|
||||
* @access protected
|
||||
*/
|
||||
protected $_lon;
|
||||
|
||||
/**
|
||||
* Whether the author who claimed this weblog has a photo.
|
||||
*
|
||||
* Note. This property has no official documentation.
|
||||
*
|
||||
* @var bool
|
||||
* @access protected
|
||||
* @see Zend_Service_Technorati_Author::$thumbnailPicture
|
||||
*/
|
||||
protected $_hasPhoto = false;
|
||||
|
||||
/**
|
||||
* An array of Zend_Service_Technorati_Author who claimed this blog
|
||||
*
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $_authors = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new object from DOM Element.
|
||||
*
|
||||
* @param DomElement $dom the ReST fragment for this object
|
||||
*/
|
||||
public function __construct(DomElement $dom)
|
||||
{
|
||||
$xpath = new DOMXPath($dom->ownerDocument);
|
||||
|
||||
$result = $xpath->query('./name/text()', $dom);
|
||||
if ($result->length == 1) $this->setName($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./url/text()', $dom);
|
||||
if ($result->length == 1) $this->setUrl($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./inboundblogs/text()', $dom);
|
||||
if ($result->length == 1) $this->setInboundBlogs($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./inboundlinks/text()', $dom);
|
||||
if ($result->length == 1) $this->setInboundLinks($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./lastupdate/text()', $dom);
|
||||
if ($result->length == 1) $this->setLastUpdate($result->item(0)->data);
|
||||
|
||||
/* The following elements need more attention */
|
||||
|
||||
$result = $xpath->query('./rssurl/text()', $dom);
|
||||
if ($result->length == 1) $this->setRssUrl($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./atomurl/text()', $dom);
|
||||
if ($result->length == 1) $this->setAtomUrl($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./author', $dom);
|
||||
if ($result->length >= 1) {
|
||||
foreach ($result as $author) {
|
||||
$this->_authors[] = new Zend_Service_Technorati_Author($author);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The following are optional elements
|
||||
*
|
||||
* I can't find any official documentation about the following properties
|
||||
* however they are included in response DTD and/or test responses.
|
||||
*/
|
||||
|
||||
$result = $xpath->query('./rank/text()', $dom);
|
||||
if ($result->length == 1) $this->setRank($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./lat/text()', $dom);
|
||||
if ($result->length == 1) $this->setLat($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./lon/text()', $dom);
|
||||
if ($result->length == 1) $this->setLon($result->item(0)->data);
|
||||
|
||||
$result = $xpath->query('./hasphoto/text()', $dom);
|
||||
if ($result->length == 1) $this->setHasPhoto($result->item(0)->data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns weblog name.
|
||||
*
|
||||
* @return string Weblog name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weblog URL.
|
||||
*
|
||||
* @return null|Zend_Uri_Http object representing weblog base URL
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of unique blogs linking this blog.
|
||||
*
|
||||
* @return integer the number of inbound blogs
|
||||
*/
|
||||
public function getInboundBlogs()
|
||||
{
|
||||
return $this->_inboundBlogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of incoming links to this blog.
|
||||
*
|
||||
* @return integer the number of inbound links
|
||||
*/
|
||||
public function getInboundLinks()
|
||||
{
|
||||
return $this->_inboundLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weblog Rss URL.
|
||||
*
|
||||
* @return null|Zend_Uri_Http object representing the URL
|
||||
* of the RSS feed for given blog
|
||||
*/
|
||||
public function getRssUrl()
|
||||
{
|
||||
return $this->_rssUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weblog Atom URL.
|
||||
*
|
||||
* @return null|Zend_Uri_Http object representing the URL
|
||||
* of the Atom feed for given blog
|
||||
*/
|
||||
public function getAtomUrl()
|
||||
{
|
||||
return $this->_atomUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns UNIX timestamp of the last weblog update.
|
||||
*
|
||||
* @return integer UNIX timestamp of the last weblog update
|
||||
*/
|
||||
public function getLastUpdate()
|
||||
{
|
||||
return $this->_lastUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weblog rank value.
|
||||
*
|
||||
* Note. This property is not documented.
|
||||
*
|
||||
* @return integer weblog rank value
|
||||
*/
|
||||
public function getRank()
|
||||
{
|
||||
return $this->_rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weblog latitude coordinate.
|
||||
*
|
||||
* Note. This property is not documented.
|
||||
*
|
||||
* @return float weblog latitude coordinate
|
||||
*/
|
||||
public function getLat() {
|
||||
return $this->_lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weblog longitude coordinate.
|
||||
*
|
||||
* Note. This property is not documented.
|
||||
*
|
||||
* @return float weblog longitude coordinate
|
||||
*/
|
||||
public function getLon()
|
||||
{
|
||||
return $this->_lon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the author who claimed this weblog has a photo.
|
||||
*
|
||||
* Note. This property is not documented.
|
||||
*
|
||||
* @return bool TRUE if the author who claimed this weblog has a photo,
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
public function hasPhoto()
|
||||
{
|
||||
return (bool) $this->_hasPhoto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array of weblog authors.
|
||||
*
|
||||
* @return array of Zend_Service_Technorati_Author authors
|
||||
*/
|
||||
public function getAuthors()
|
||||
{
|
||||
return (array) $this->_authors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets weblog name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = (string) $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog URL.
|
||||
*
|
||||
* @param string|Zend_Uri_Http $url
|
||||
* @return void
|
||||
* @throws Zend_Service_Technorati_Exception if $input is an invalid URI
|
||||
* (via Zend_Service_Technorati_Utils::normalizeUriHttp)
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of inbound blogs.
|
||||
*
|
||||
* @param integer $number
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setInboundBlogs($number)
|
||||
{
|
||||
$this->_inboundBlogs = (int) $number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of Iinbound links.
|
||||
*
|
||||
* @param integer $number
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setInboundLinks($number)
|
||||
{
|
||||
$this->_inboundLinks = (int) $number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog Rss URL.
|
||||
*
|
||||
* @param string|Zend_Uri_Http $url
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
* @throws Zend_Service_Technorati_Exception if $input is an invalid URI
|
||||
* (via Zend_Service_Technorati_Utils::normalizeUriHttp)
|
||||
*/
|
||||
public function setRssUrl($url)
|
||||
{
|
||||
$this->_rssUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog Atom URL.
|
||||
*
|
||||
* @param string|Zend_Uri_Http $url
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
* @throws Zend_Service_Technorati_Exception if $input is an invalid URI
|
||||
* (via Zend_Service_Technorati_Utils::normalizeUriHttp)
|
||||
*/
|
||||
public function setAtomUrl($url)
|
||||
{
|
||||
$this->_atomUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog Last Update timestamp.
|
||||
*
|
||||
* $datetime can be any value supported by
|
||||
* Zend_Service_Technorati_Utils::normalizeDate().
|
||||
*
|
||||
* @param mixed $datetime A string representing the last update date time
|
||||
* in a valid date time format
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
* @throws Zend_Service_Technorati_Exception
|
||||
*/
|
||||
public function setLastUpdate($datetime)
|
||||
{
|
||||
$this->_lastUpdate = Zend_Service_Technorati_Utils::normalizeDate($datetime);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog Rank.
|
||||
*
|
||||
* @param integer $rank
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setRank($rank)
|
||||
{
|
||||
$this->_rank = (int) $rank;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog latitude coordinate.
|
||||
*
|
||||
* @param float $coordinate
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setLat($coordinate)
|
||||
{
|
||||
$this->_lat = (float) $coordinate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets weblog longitude coordinate.
|
||||
*
|
||||
* @param float $coordinate
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setLon($coordinate)
|
||||
{
|
||||
$this->_lon = (float) $coordinate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets hasPhoto property.
|
||||
*
|
||||
* @param bool $hasPhoto
|
||||
* @return Zend_Service_Technorati_Weblog $this instance
|
||||
*/
|
||||
public function setHasPhoto($hasPhoto)
|
||||
{
|
||||
$this->_hasPhoto = (bool) $hasPhoto;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user