API Documentation

Feed/Pubsubhubbub/Subscriber.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Feed_Pubsubhubbub
Classes
Zend_Feed_Pubsubhubbub_Subscriber

Description

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.

Zend_Feed_Pubsubhubbub_Subscriber

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Feed_Pubsubhubbub
Properties
$_hubUrls
$_parameters
$_topicUrl
$_callbackUrl
$_leaseSeconds
$_preferredVerificationMode
$_errors
$_asyncHubs
$_storage
$_authentications
$_usePathParameter
$_testStaticToken
Methods
__construct
setConfig
setTopicUrl
getTopicUrl
setLeaseSeconds
getLeaseSeconds
setCallbackUrl
getCallbackUrl
setPreferredVerificationMode
getPreferredVerificationMode
addHubUrl
addHubUrls
removeHubUrl
getHubUrls
addAuthentication
addAuthentications
getAuthentications
usePathParameter
setParameter
setParameters
removeParameter
getParameters
setStorage
getStorage
subscribeAll
unsubscribeAll
isSuccess
getErrors
getAsyncHubs
_doRequest
_getHttpClient
_getRequestParameters
_generateVerifyToken
_generateSubscriptionKey
_urlEncode
_toByteValueOrderedString
setTestStaticToken

Description

Properties

$_asyncHubs

array $_asyncHubs = 'array'

An array of Hub Server URLs for Hubs operating at this time in asynchronous verification mode.

Details

$_asyncHubs
array
visibility
protected
default
array
final
false
static
false

$_authentications

array $_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.

Details

$_authentications
array
visibility
protected
default
array
final
false
static
false

$_callbackUrl

string $_callbackUrl = ''

The URL Hub Servers must use when communicating with this Subscriber

Details

$_callbackUrl
string
visibility
protected
default
final
false
static
false

$_errors

array $_errors = 'array'

An array of any errors including keys for 'response', 'hubUrl'.

The response is the actual Zend_Http_Response object.

Details

$_errors
array
visibility
protected
default
array
final
false
static
false

$_hubUrls

array $_hubUrls = 'array'

An array of URLs for all Hub Servers to subscribe/unsubscribe.

Details

$_hubUrls
array
visibility
protected
default
array
final
false
static
false

$_leaseSeconds

int $_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.

Details

$_leaseSeconds
int
visibility
protected
default
null
final
false
static
false

$_parameters

array $_parameters = 'array'

An array of optional parameters to be included in any (un)subscribe requests.

Details

$_parameters
array
visibility
protected
default
array
final
false
static
false

$_preferredVerificationMode

string $_preferredVerificationMode = 'Zend_Feed_Pubsubhubbub'

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.

Details

$_preferredVerificationMode
string
visibility
protected
default
Zend_Feed_Pubsubhubbub
final
false
static
false

$_storage

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.

Details

$_storage
Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
visibility
protected
default
null
final
false
static
false

$_testStaticToken

 $_testStaticToken = 'null'

This is STRICTLY for testing purposes only...

Details

visibility
protected
default
null
final
false
static
false

$_topicUrl

string $_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.

Details

$_topicUrl
string
visibility
protected
default
final
false
static
false

$_usePathParameter

string $_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.

Details

$_usePathParameter
string
visibility
protected
default
false
final
false
static
false

Methods

__construct

__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.

Arguments
$config
Details
visibility
public
final
false
static
false

_doRequest

_doRequest( string $mode ) : void

Executes an (un)subscribe request

Arguments
$mode
string
Details
visibility
protected
final
false
static
false

_generateSubscriptionKey

_generateSubscriptionKey(  $params, string $hubUrl ) : string

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

Arguments
$params
$hubUrl
string
The Hub Server URL for which this token will apply
Output
string
Details
visibility
protected
final
false
static
false

_generateVerifyToken

_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.

Output
string
Details
visibility
protected
final
false
static
false

_getHttpClient

_getHttpClient( ) : Zend_Http_Client

Get a basic prepared HTTP client for use

Details
visibility
protected
final
false
static
false

_getRequestParameters

_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

Arguments
$hubUrl
stringmode
$mode
Output
string
Details
visibility
protected
final
false
static
false

_toByteValueOrderedString

_toByteValueOrderedString( array $params ) : array

Order outgoing parameters

Arguments
$params
array
Output
array
Details
visibility
protected
final
false
static
false

_urlEncode

_urlEncode( array $params ) : array

URL Encode an array of parameters

Arguments
$params
array
Output
array
Details
visibility
protected
final
false
static
false

addAuthentication

addAuthentication( string $url, array $authentication ) : Zend_Feed_Pubsubhubbub_Subscriber

Add authentication credentials for a given URL

Arguments
$url
string
$authentication
array
Details
visibility
public
final
false
static
false

addAuthentications

addAuthentications( array $authentications ) : Zend_Feed_Pubsubhubbub_Subscriber

Add authentication credentials for hub URLs

Arguments
$authentications
array
Details
visibility
public
final
false
static
false

addHubUrl

addHubUrl( string $url ) : Zend_Feed_Pubsubhubbub_Subscriber

Add a Hub Server URL supported by Publisher

Arguments
$url
string
Details
visibility
public
final
false
static
false

addHubUrls

addHubUrls( array $urls ) : Zend_Feed_Pubsubhubbub_Subscriber

Add an array of Hub Server URLs supported by Publisher

Arguments
$urls
array
Details
visibility
public
final
false
static
false

getAsyncHubs

getAsyncHubs( ) : 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)

Output
array
Details
visibility
public
final
false
static
false

getAuthentications

getAuthentications( ) : array

Get all hub URL authentication credentials

Output
array
Details
visibility
public
final
false
static
false

getCallbackUrl

getCallbackUrl( ) : string

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

Output
string
Details
visibility
public
final
false
static
false

getErrors

getErrors( ) : 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

Output
array
Details
visibility
public
final
false
static
false

getHubUrls

getHubUrls( ) : array

Return an array of unique Hub Server URLs currently available

Output
array
Details
visibility
public
final
false
static
false

getLeaseSeconds

getLeaseSeconds( ) : int

Get the number of lease seconds on subscriptions

Output
int
Details
visibility
public
final
false
static
false

getParameters

getParameters( ) : array

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

Output
array
Details
visibility
public
final
false
static
false

getPreferredVerificationMode

getPreferredVerificationMode( ) : string

Get preferred verification mode (sync or async).

Output
string
Details
visibility
public
final
false
static
false

getStorage

getStorage( ) : 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.

Details
visibility
public
final
false
static
false

getTopicUrl

getTopicUrl( ) : string

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

Output
string
Details
visibility
public
final
false
static
false

isSuccess

isSuccess( ) : bool

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

Output
bool
Details
visibility
public
final
false
static
false

removeHubUrl

removeHubUrl( string $url ) : Zend_Feed_Pubsubhubbub_Subscriber

Remove a Hub Server URL

Arguments
$url
string
Details
visibility
public
final
false
static
false

removeParameter

removeParameter( string $name ) : Zend_Feed_Pubsubhubbub_Subscriber

Remove an optional parameter for the (un)subscribe requests

Arguments
$name
string
Details
visibility
public
final
false
static
false

setCallbackUrl

setCallbackUrl( string $url ) : Zend_Feed_Pubsubhubbub_Subscriber

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

Arguments
$url
string
Details
visibility
public
final
false
static
false

setConfig

setConfig(  $config ) : Zend_Feed_Pubsubhubbub_Subscriber

Process any injected configuration options

Arguments
$config
Details
visibility
public
final
false
static
false

setLeaseSeconds

setLeaseSeconds( int $seconds ) : Zend_Feed_Pubsubhubbub_Subscriber

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

Arguments
$seconds
int
Details
visibility
public
final
false
static
false

setParameter

setParameter( string $name, string|null $value = null ) : Zend_Feed_Pubsubhubbub_Subscriber

Add an optional parameter to the (un)subscribe requests

Arguments
$name
string
$value
stringnull
Details
visibility
public
final
false
static
false

setParameters

setParameters(  $parameters ) : Zend_Feed_Pubsubhubbub_Subscriber

Add an optional parameter to the (un)subscribe requests

Arguments
$parameters
Details
visibility
public
final
false
static
false

setPreferredVerificationMode

setPreferredVerificationMode( 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.

Arguments
$mode
string
Should be 'sync' or 'async'
Details
visibility
public
final
false
static
false

setStorage

setStorage( 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.

Arguments
$storage
Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
Details
visibility
public
final
false
static
false

setTestStaticToken

setTestStaticToken(  $token ) :
Arguments
$token
Details
visibility
public
final
true
static
false

setTopicUrl

setTopicUrl( string $url ) : Zend_Feed_Pubsubhubbub_Subscriber

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

Arguments
$url
string
Details
visibility
public
final
false
static
false

subscribeAll

subscribeAll( ) : void

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

Details
visibility
public
final
false
static
false

unsubscribeAll

unsubscribeAll( ) : void

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

Details
visibility
public
final
false
static
false

usePathParameter

usePathParameter( bool $bool = true ) : Zend_Feed_Pubsubhubbub_Subscriber

Set flag indicating whether or not to use a path parameter

Arguments
$bool
bool
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.