Feed/Pubsubhubbub/Subscriber.php

Show: PublicProtectedPrivateinherited
Table of Contents
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 [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Feed_Pubsubhubbub  
Version
$Id$  

\Zend_Feed_Pubsubhubbub_Subscriber

Package: Zend_Feed_Pubsubhubbub
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedarray $_asyncHubs = array()
An array of Hub Server URLs for Hubs operating at this time in asynchronous verification mode.
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_authentications = array()
An array of authentication credentials for HTTP Basic Authentication if required by specific Hubs. The array is indexed by Hub Endpoint URI and the value is a simple array of the username and password to apply.
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_callbackUrl = ''
The URL Hub Servers must use when communicating with this Subscriber
Default value''Details
Type
string
>VPropertyprotectedarray $_errors = array()
An array of any errors including keys for 'response', 'hubUrl'.
The response is the actual Zend_Http_Response object.
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_hubUrls = array()
An array of URLs for all Hub Servers to subscribe/unsubscribe.
Default valuearray()Details
Type
array
>VPropertyprotectedint $_leaseSeconds = null
The number of seconds for which the subscriber would like to have the subscription active. Defaults to null, i.e. not sent, to setup a permanent subscription if possible.
Default valuenullDetails
Type
int
>VPropertyprotectedarray $_parameters = array()
An array of optional parameters to be included in any (un)subscribe requests.
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_preferredVerificationMode = \Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC
The preferred verification mode (sync or async). By default, this Subscriber prefers synchronous verification, but is considered desireable to support asynchronous verification if possible.
Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose order of occurance in the parameter list determines this preference.
Default value\Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNCDetails
Type
string
>VPropertyprotected\Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $_storage = null
An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background save any verification tokens associated with a subscription or other.
>VPropertyprotected$_testStaticToken = null
This is STRICTLY for testing purposes only.
..
Default valuenullDetails
Type
n/a
>VPropertyprotectedstring $_topicUrl = ''
The URL of the topic (Rss or Atom feed) which is the subject of our current intent to subscribe to/unsubscribe from updates from the currently configured Hub Servers.
Default value''Details
Type
string
>VPropertyprotectedstring $_usePathParameter = false
Tells the Subscriber to append any subscription identifier to the path of the base Callback URL. E.g. an identifier "subkey1" would be added to the callback URL "http://www.example.com/callback" to create a subscription specific Callback URL of "http://www.example.com/callback/subkey1".
This is required for all Hubs using the Pubsubhubbub 0.1 Specification. It should be manually intercepted and passed to the Callback class using Zend_Feed_Pubsubhubbub_Subscriber_Callback::setSubscriptionKey(). Will require a route in the form "callback/:subkey" to allow the parameter be retrieved from an action using the Zend_Controller_Action::_getParam() method.
Default valuefalseDetails
Type
string

Methods

methodpublic__construct( $config = null) : void

Constructor; accepts an array or Zend_Config instance to preset options for the Subscriber without calling all supported setter methods in turn.

Parameters
NameTypeDescription
$config
methodprotected_doRequest(string $mode) : void

Executes an (un)subscribe request

Parameters
NameTypeDescription
$modestring
methodprotected_generateSubscriptionKey( $params, string $hubUrl) : string

Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server.

Parameters
NameTypeDescription
$params
$hubUrlstring

The Hub Server URL for which this token will apply

Returns
TypeDescription
string
methodprotected_generateVerifyToken() : string

Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server. Follows no particular method, which means it might be improved/changed in future.

Returns
TypeDescription
string
methodprotected_getHttpClient() : \Zend_Http_Client

Get a basic prepared HTTP client for use

Returns
TypeDescription
\Zend_Http_Client
methodprotected_getRequestParameters(string | \mode $hubUrl,  $mode) : string

Return a list of standard protocol/optional parameters for addition to client's POST body that are specific to the current Hub Server URL

Parameters
NameTypeDescription
$hubUrlstring | \mode
$mode
Returns
TypeDescription
string
methodprotected_toByteValueOrderedString(array $params) : array

Order outgoing parameters

Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
methodprotected_urlEncode(array $params) : array

URL Encode an array of parameters

Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
methodpublicaddAuthentication(string $url, array $authentication) : \Zend_Feed_Pubsubhubbub_Subscriber

Add authentication credentials for a given URL

Parameters
NameTypeDescription
$urlstring
$authenticationarray
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicaddAuthentications(array $authentications) : \Zend_Feed_Pubsubhubbub_Subscriber

Add authentication credentials for hub URLs

Parameters
NameTypeDescription
$authenticationsarray
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicaddHubUrl(string $url) : \Zend_Feed_Pubsubhubbub_Subscriber

Add a Hub Server URL supported by Publisher

Parameters
NameTypeDescription
$urlstring
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicaddHubUrls(array $urls) : \Zend_Feed_Pubsubhubbub_Subscriber

Add an array of Hub Server URLs supported by Publisher

Parameters
NameTypeDescription
$urlsarray
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicgetAsyncHubs() : array

Return an array of Hub Server URLs who returned a response indicating operation in Asynchronous Verification Mode, i.e. they will not confirm any (un)subscription immediately but at a later time (Hubs may be doing this as a batch process when load balancing)

Returns
TypeDescription
array
methodpublicgetAuthentications() : array

Get all hub URL authentication credentials

Returns
TypeDescription
array
methodpublicgetCallbackUrl() : string

Get the callback URL to be used by Hub Servers when communicating with this Subscriber

Returns
TypeDescription
string
methodpublicgetErrors() : array

Return an array of errors met from any failures, including keys: 'response' => the Zend_Http_Response object from the failure 'hubUrl' => the URL of the Hub Server whose notification failed

Returns
TypeDescription
array
methodpublicgetHubUrls() : array

Return an array of unique Hub Server URLs currently available

Returns
TypeDescription
array
methodpublicgetLeaseSeconds() : int

Get the number of lease seconds on subscriptions

Returns
TypeDescription
int
methodpublicgetParameters() : array

Return an array of optional parameters for (un)subscribe requests

Returns
TypeDescription
array
methodpublicgetPreferredVerificationMode() : string

Get preferred verification mode (sync or async).

Returns
TypeDescription
string
methodpublicgetStorage() : \Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface

Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used to background save any verification tokens associated with a subscription or other.

methodpublicgetTopicUrl() : string

Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate

Returns
TypeDescription
string
methodpublicisSuccess() : bool

Returns a boolean indicator of whether the notifications to Hub Servers were ALL successful. If even one failed, FALSE is returned.

Returns
TypeDescription
bool
methodpublicremoveHubUrl(string $url) : \Zend_Feed_Pubsubhubbub_Subscriber

Remove a Hub Server URL

Parameters
NameTypeDescription
$urlstring
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicremoveParameter(string $name) : \Zend_Feed_Pubsubhubbub_Subscriber

Remove an optional parameter for the (un)subscribe requests

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetCallbackUrl(string $url) : \Zend_Feed_Pubsubhubbub_Subscriber

Set the callback URL to be used by Hub Servers when communicating with this Subscriber

Parameters
NameTypeDescription
$urlstring
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetConfig( $config) : \Zend_Feed_Pubsubhubbub_Subscriber

Process any injected configuration options

Parameters
NameTypeDescription
$config
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetLeaseSeconds(int $seconds) : \Zend_Feed_Pubsubhubbub_Subscriber

Set the number of seconds for which any subscription will remain valid

Parameters
NameTypeDescription
$secondsint
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetParameter(string $name, string | null $value = null) : \Zend_Feed_Pubsubhubbub_Subscriber

Add an optional parameter to the (un)subscribe requests

Parameters
NameTypeDescription
$namestring
$valuestring | null
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetParameters( $parameters) : \Zend_Feed_Pubsubhubbub_Subscriber

Add an optional parameter to the (un)subscribe requests

Parameters
NameTypeDescription
$parameters
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetPreferredVerificationMode(string $mode) : \Zend_Feed_Pubsubhubbub_Subscriber

Set preferred verification mode (sync or async). By default, this Subscriber prefers synchronous verification, but does support asynchronous if that's the Hub Server's utilised mode.

Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose order of occurance in the parameter list determines this preference.
Parameters
NameTypeDescription
$modestring

Should be 'sync' or 'async'

Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetStorage(\Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) : \Zend_Feed_Pubsubhubbub_Subscriber

Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background save any verification tokens associated with a subscription or other.

Parameters
NameTypeDescription
$storage\Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsetTestStaticToken( $token) : void
final

Parameters
NameTypeDescription
$token
methodpublicsetTopicUrl(string $url) : \Zend_Feed_Pubsubhubbub_Subscriber

Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate

Parameters
NameTypeDescription
$urlstring
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
methodpublicsubscribeAll() : void

Subscribe to one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed)

methodpublicunsubscribeAll() : void

Unsubscribe from one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed)

methodpublicusePathParameter(bool $bool = true) : \Zend_Feed_Pubsubhubbub_Subscriber

Set flag indicating whether or not to use a path parameter

Parameters
NameTypeDescription
$boolbool
Returns
TypeDescription
\Zend_Feed_Pubsubhubbub_Subscriber
Documentation was generated by phpDocumentor 2.2.0 .