Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (79)

View Page History

{zone-data:component-name}
Zend_Service_Yadis
{zone-data}


{zone-data:requirements}
* Zend_Service_Yadis *must* implement the Yadis Specification 1.0 including the Yadis protocol for discovering the XRDS document for an identity.
* Zend_Service_Yadis *must* implement discovery where the Yadis ID is a valid URI
* Zend_Service_Yadis *must* implement discovery where the Yadis ID is an i-name (XRI)
* Zend_Service_Yadis *must* be able to parse an XRDS document into a set of Zend_Service_Yadis_Service objects each holding URL/Type and other data capable of lookup via an XPath query on the object.
* Zend_Service_Yadis *will* use SimpleXML for parsing XRDS documents.
* Zend_Service_Yadis *will* support IRIs (Internationalised Resource Identifiers) once they are supported by the core Zend_Uri component of the framework.
{zone-data}


{zone-data:operation}
The purpose of Zend_Service_Yadis is to implement, in full, the Yadis Specification 1.0.

Upon receipt of any viable Identity (URL, XRI, OpenID, other), Zend_Service_Yadis may be called upon to retrieve a list of all services available for that Identity in an iterable list ordered by priority. The definition of "priority" in this case is as defined by the XRI Technical Committee's XRI Resolution 2.0 working draft.

The initial Identity must either be a URI, or another form capable of being normalised to a URI. XRI normalisation allows for the use of the XDI XRI proxy since HTTP clients typically have no native XRI resolution support.

{zone-data:class-list}
* Zend_Service_Yadis
* Zend_Service_Yadis_Xrds_Namespace
* Zend_Service_Yadis_Xrds
* Zend_Service_Yadis_Xrds_Service
* Zend_Service_Yadis_Service
* Zend_Service_Yadis_Xri
* Zend_Service_Yadis_Exception
{zone-data}

require_once 'Zend/Service/Yadis.php';
$openid = 'http://padraic.astrumfutura.com';
$yadis = new Zend_Service_Yadis($openid);
$services = $yadis->discover();

require_once 'Zend/Service/Yadis.php';
$userOpenid = '=user.name';
$yadis = new Zend_Service_Yadis($userOpenid);
$services = $yadis->discovery();


/**
* Zend_Service_Yadis will provide a method of Service Discovery implemented
* in accordance with the Yadis Specification 1.0. This describes a protocol
* for locating an XRD document which details Services available. The XRD is
* typically specific to a single user, identified by their Yadis ID.
* Zend_Service_Yadis_XRDS will be a wrapper which is responsible for parsing
* and presenting an iterable list of Zend_Service_Yadis_Service objects
* holding the data for each specific Service discovered.
*
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yadis extends Zend_Service_Abstract
{


/**
* Instance of Zend_Service_Yadis_Xrds_Namespace for managing namespaces
* associated with an XRDS document.
*
* @var Zend_Service_Yadis_Xrds_Namespace
*/
protected $_namespace = null;
* an optional list of additional namespaces. For example, OpenID uses a
* namespace such as: xmlns:openid="http://openid.net/xmlns/1.0"
* Namespaces are assigned to a Zend_Service_Yadis_Xrds_Namespace container
* object to be passed more easily to other objects being
*
public function __construct($yadisId = null, array $namespaces = null)
{
$this->_namespace = new Zend_Service_Yadis_Xrds_Namespace;
if (isset($namespaces) && count($namespaces) > 0) {
$this->addNamespaces($namespaces);
} elseif (isset($namespaces)) {
require_once 'Zend/Service/Yadis/Exception.php';
throw new Zend_Service_Yadis_Exception('Expected parameter $namespaces to be an array; but array appears to be empty');
}
if (isset($yadisId)) {
*
* @param string $yadisId
* @return Zend_Service_Yadis
* @throws Zend_Service_Yadis_Exception
*/
public function setYadisUrl($yadisId)
*
* @param array $namespaces
* @return Zend_Service_Yadis
*/
public function addNamespaces(array $namespaces)
* @param string $namespace
* @param string $namespaceUrl
* @return Zend_Service_Yadis
*/
public function addNamespace($namespace, $namespaceUrl)
* Performs Service Discovery, i.e. the requesting and parsing of a valid
* Yadis (XRD) document into a list of Services and Service Data. The
* return value will be an instance of Zend_Service_Yadis_Xrds which will
* implement SeekableIterator. Returns FALSE on failure.
*
* @return Zend_Service_Yadis_Xrds|boolean
* @throws Zend_Service_Yadis_Exception
* @uses Zend_Http_Response
*/
* @param Zend_Http_Response $response
* @return boolean
* @throws Zend_Service_Yadis_Exception
*/
protected function _isXrdsLocationHeader(Zend_Http_Response $response)
* @param Zend_Http_Response $response
* @return boolean
* @throws Zend_Service_Yadis_Exception
*/
protected function _isMetaHttpEquiv(Zend_Http_Response $response)

/**
* Creates a new Zend_Service_Yadis_Xrds object which uses SimpleXML to
* parse the XML into a list of Iterable Zend_Service_Yadis_Service
* objects.
*
* @param string $xrdsDocument
* @return Zend_Service_Yadis_Xrds|boolean
*/
protected function _parseXrds($xrdsDocument)

/**
* The Zend_Service_Yadis_Xrds_Namespace class is a container for namespaces
* which need to be registered to an XML parser in order to correctly consume
* an XRDS document using the parser's XPath functionality.
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yadis_Xrds_Namespace
{


/**
* The Zend_Service_Yadis_Xrds class is a wrapper for elements of an
* XRD document which is parsed using SimpleXML, and contains methods for
* retrieving data about the document. The concrete aspects of retrieving
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yadis_Xrds
{


/**
* Instance of Zend_Service_Yadis_Xrds_Namespace for managing namespaces
* associated with an XRDS document.
*
* @var Zend_Service_Yadis_Xrds_Namespace
*/
protected $_namespace = null;
*
* @param SimpleXMLElement $xrds
* @param Zend_Service_Yadis_Xrds_Namespace $namespace
*/
protected function __construct(SimpleXMLElement $xrds, Zend_Service_Yadis_Xrds_Namespace $namespace)
{}

*
* @param array $namespaces
* @return Zend_Service_Yadis
*/
public function addNamespaces(array $namespaces)
* @param string $namespace
* @param string $namespaceUrl
* @return Zend_Service_Yadis
*/
public function addNamespace($namespace, $namespaceUrl)
* http://yadis.org/wiki/XRI_Resolution_2.0_specification
*
* @param Zend_Service_Yadis_Service $service
*/
protected function _sortByPriority(array $elements)

/**
* The Zend_Service_Yadis_Xrds_Service class is a wrapper for Service elements of an
* XRD document which is parsed using SimpleXML, and contains methods for
* retrieving data about each Service, including Type, Url and other arbitrary
* data added in a separate namespace, e.g. openid:Delegate.
*
* This class extends the basic Zend_Service_Yadis_Xrds wrapper to implement a
* Service object specific to the Yadis Specification 1.0. XRDS itself is not
* an XML format ruled by Yadis, but by an OASIS proposal.
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yadis_Xrds_Service extends Zend_Service_Yadis_Xrds implements Iterator implements Iterator
{

* Constructor; Accepts an XRD document for parsing.
* Parses the XRD document by <xrd:Service> element to construct an array
* of Zend_Service_Yadis_Service objects ordered by their priority.
*
* @param SimpleXMLElement $xrds
* @param Zend_Service_Yadis_Xrds_Namespace $namespace
*/
public function __construct(SimpleXMLElement $xrds, Zend_Service_Yadis_Xrds_Namespace $namespace)
{}

* Return the current element.
*
* @return Zend_Service_Yadis_Service
*/
public function current()
* of the priority order.
*
* @param Zend_Service_Yadis_Service $service
*/
protected function _addService(Zend_Service_Yadis_Service $service)
{}


/**
* The Zend_Service_Yadis_Service class represents a service parsed from the
* XRD node of a Yadis 1.0 XRDS document.
*
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yadis_Service
{

*
* @param SimpleXMLElement $serviceNode
* @param Zend_Service_Yadis_Xrds_Namespace $namespace
*/
public function __construct(SimpleXMLElement $serviceNode, Zend_Service_Yadis_Xrds_Namespace $namespace)
{}


/**
* Return the current Zend_Service_Yadis_Xrds_Namespace object.
*
* @return Zend_Service_Yadis_Xrds_Namespace
*/
public function getNamespaceObject()
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yadis_Xri extends Zend_Service_Abstract
{

* Hold an instance of this object per the Singleton Pattern.
*
* @var Zend_Service_Yadis_Xri
*/
protected static $_instance = null;

/**
* Instance of Zend_Service_Yadis_Xrds_Namespace for managing namespaces
* associated with an XRDS document.
*
* @var Zend_Service_Yadis_Xrds_Namespace
*/
protected $_namespace = null;
* Return a singleton instance of this class.
*
* @return Zend_Service_Yadis_Xri
*/
public static function getInstance()
* received while resolving an XRI, to a URI and finally a Canonical Id.
*/
public function setNamespace(Zend_Service_Yadis_Xrds_Namespace $namespace)
{}

*
* @param string $proxy
* @return Zend_Service_Yadis_Xri
* @throws Zend_Service_Yadis_Exception
* @uses Zend_Uri
*/
*
* @param string $url
* @return Zend_Service_Yadis_Xri
* @throws Zend_Service_Yadis_Exception
*/
public function setXri($xri)
* @param string $xri
* @return string
* @throws Zend_Service_Yadis_Exception
* @uses Zend_Uri
*/
* @param string $xri
* @return string
* @throws Zend_Service_Yadis_Exception
* @uses Zend_Uri
*/
}

class Zend_Service_Yadis_Exception extends Zend_Service_Exception
class Zend_Yadis_Exception extends Zend_Exception
{}
{code}