Trackback
[ class tree: Trackback ] [ index: Trackback ] [ all elements ]

Class: Services_Trackback

Source Location: /Services_Trackback-0.6.0/Services/Trackback.php

Class Overview


Trackback A generic class to send/receive trackbacks.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005-2006 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 82]
Trackback A generic class to send/receive trackbacks.


[ Top ]


Class Variables

$_data = array(
        'id'            => '',
        'title'         => '',
        'excerpt'       => '',
        'blog_name'     => '',
        'url'           => '',
        'trackback_url' => '',
        'host'          => '',
        'extra'         => array(),)

[line 93]

The necessary trackback data.
  • Since: 0.1.0
  • Access: protected

Type:   array


[ Top ]

$_options = array(
        // Options for Services_Trackback directly
        'strictness'        => SERVICES_TRACKBACK_STRICTNESS_LOW,
        'timeout'           => 30,          // seconds
        'fetchlines'        => 30,
        'fetchextra'        => true,
        // Options for HTTP_Request class
        'httprequest'       => array(
            'allowRedirects'    => true,
            'maxRedirects'      => 2,
            'useragent'         => 'PEAR::Services_Trackback v@package_version@'
        ),)

[line 116]

Options to influence Services_Trackback.

Type:   array


[ Top ]



Method Detail

Services_Trackback (Constructor)   [line 147]

void Services_Trackback( )

Constructor Creates a new Trackback object. Private because of factory use.
  • Since: 0.1.0
  • Access: protected

[ Top ]

addSpamCheck   [line 564]

mixed &addSpamCheck( &$spamCheck, [int $priority = 0], object(Services_Trackback_SpamCheck) $spamCheck)

addSpamCheck Add a spam check module to the trackback.

Parameters:

object(Services_Trackback_SpamCheck)   $spamCheck   —  The spam check module to add.
int   $priority   —  A priority value for the spam check. Lower priority indices are processed earlier. If no priority level is set, 0 is assumed.
   &$spamCheck   — 

[ Top ]

autodiscover   [line 291]

bool autodiscover( )

autodiscover Checks a given URL for trackback autodiscovery code.
  • Return: True on success, otherwise PEAR_Error.
  • Since: 0.2.0
  • Access: public

[ Top ]

checkSpam   [line 660]

bool checkSpam( [ $continouse = false], bool $continouseCheck)

checkSpam Checks the given trackback against several spam protection sources such as DNSBL, SURBL, Word BL,... The sources to check are defined using Services_Trackback_SpamCheck modules.

Parameters:

bool   $continouseCheck   —  Wether to check all spam protection modules or quit checking if one modules returns a positive result.
   $continouse   — 

[ Top ]

create   [line 191]

object(Services_Trackback) &create( array $data, [array $options = null])

Factory

This static method is used to create a trackback object. (Services_Trackback::create($data)) The factory requires a data array as described below for creation. The 'id' key is obligatory for this method. Every other data is not quite necessary for the creation, but might be necessary for calling other methods afterwards. See the specific methods for further info on which data is required.

  • Return: The newly created Trackback.
  • See: HTTP_Request::HTTP_Request() for more detailed documentation. Some options for HTTP_Request are overwritten through the global settings of Services_Trackback (such as timeout). 'timeout': float THE TIMEOUT SETTING IS OVERWRITTEN BY THE GLOBAL Services_Trackback SETTING. 'allowRedirects': bool Wether to follow HTTP redirects or not. 'maxRedirects': int Maximum number of redirects. 'useragent': string The user agent to use for HTTP requests.
  • Since: 0.2.0
  • Access: public

Parameters:

array   $data   —  Data for the trackback, which is obligatory: 'id' The ID of the trackback target. Data which is optional (for construction, not for specific methods): 'title' string Title of the trackback sending/receiving blog entry. 'excerpt' string Abstract of the trackback sending/receiving blog entry. 'blog_name' string Name of the trackback sending/receiving weblog. 'url' string URL of the trackback sending/receiving blog entry. 'trackback_url' string URL to send trackbacks to. 'extra' array Content of $_SERVER, captured while doing Services_Trackback::receive().
array   $options   —  Options to set for this trackback. Valid options: 'strictness': int The default strictness to use in @see Services_Trackback::autodiscover(). 'timeout': int The default timeout for network operations in seconds. 'fetchlines': int The max number of lines to fetch over the network. 'httprequest' array The options utilized by HTTP_Request are stored here. The following options are the most commonly used for HTTP_Request in Services_Trackback. All other options are supported too,

[ Top ]

createSpamCheck   [line 591]

mixed &createSpamCheck( string $spamCheckType, [array $options = array()], [int $priority = 0])

createSpamCheck Create and add a spam check module to the trackback.

Parameters:

string   $spamCheckType   —  Name of the spamcheck module to create and add.
array   $options   —  Options for the spamcheckmodule.
int   $priority   —  A priority value for the spam check. Lower priority indices are processed earlier. If no priority level is set, 0 is assumed.

[ Top ]

get   [line 692]

mixed get( string $key)

get Get data from the trackback. Returns the value of a given key or PEAR_Error.
  • Return: A string value or a PEAR_Error on failure.
  • Since: 0.2.0
  • Access: public

Parameters:

string   $key   —  The key to fetch a value for.

[ Top ]

getAutodiscoveryCode   [line 436]

string getAutodiscoveryCode( [bool $comments = true])

getAutodiscoverCode Returns the RDF Code for a given website to let weblogs autodiscover the possibility of tracking it back.

The following data has to be set to call this method: 'id' 'title' 'url' 'trackback_url'

  • Return: RDF code
  • Since: 0.1.0
  • Access: public

Parameters:

bool   $comments   —  Whether to include HTML comments around the RDF using <!-- -->

[ Top ]

getOptions   [line 275]

array getOptions( )

getOptions Get the currently set option set.

[ Top ]

getResponseError   [line 535]

void getResponseError( string $message, int $code)

getResponseError Returns an XML response for a trackback error.
  • Since: 0.1.0
  • Access: public

Parameters:

int   $code   —  The error code
string   $message   —  The error message

[ Top ]

getResponseSuccess   [line 512]

string getResponseSuccess( )

getResponseSuccess Returns an XML response for a successful trackback.
  • Return: The XML code
  • Since: 0.1.0
  • Access: public

[ Top ]

receive   [line 476]

object Services_Trackback receive( [ $data = null])

receive

Receives a trackback. The following data has to be set in the data array to fulfill this operation: 'id'

  • Since: 0.1.0
  • Access: public

Parameters:

   $data   — 

[ Top ]

removeSpamCheck   [line 630]

bool removeSpamCheck( object(Services_Trackback_SpamCheck) &$spamCheck)

removeSpamCheck Remove a spam check module from the trackback.

Parameters:

object(Services_Trackback_SpamCheck)   &$spamCheck   —  The spam check module to remove.

[ Top ]

send   [line 364]

mixed send( [string $data = null])

send This method sends a trackback to the trackback_url saved in it. The data array of the trackback object can be completed by submitting the necessary data through the $data parameter of this method.

The following data has to be set to call this method: 'title' Title of the weblog entry sending the trackback. 'url' URL of the weblog entry sending the trackback. 'excerpt' Excerpt of the weblog entry sending the trackback. 'blog_name' Name of the weblog sending the trackback. 'trackback_url' URL to send the trackback to. Services_Trackback::send() requires PEAR::HTTP_Request. The options for the HTTP_Request object are stored in the global options array using the key 'http_request'.

  • Return: True on success, otherwise PEAR_Error.
  • Since: 0.3.0
  • Access: public

Parameters:

string   $data   —  Additional data to complete the trackback.

[ Top ]

set   [line 711]

mixed set( string $key, string $val)

set Set data of the trackback. Saves the value of a given key , returning true on success, PEAR_Error on faulure.
  • Return: Boolean true on success or a PEAR_Error on failure.
  • Since: 0.2.0
  • Access: public

Parameters:

string   $key   —  The key to set a value for.
string   $val   —  The value for the key.

[ Top ]

setOptions   [line 225]

mixed setOptions( array $options)

setOptions Set options for the trackback.

Parameters:

array   $options   —  Pairs of 'option' => 'value' as described at @see Services_Trackback::create().

[ Top ]

_checkData   [line 832]

void _checkData( array $keys, [array $data = null])

_checkData Checks a given array of keys for the validity of their data.
  • Since: 0.1.0
  • Access: protected

Parameters:

array   $keys   —  Data keys to check.
array   $data   —  Optionally the data to check (default is the object data).

[ Top ]

_checkURLs   [line 862]

mixed _checkURLs( string $url1, string $url2, constant $strictness)

_checkURLs This little method checks if 2 URLs (the URL to trackback against the trackback identifier found in the autodiscovery code) are equal.

Parameters:

string   $url1   —  The first URL.
string   $url2   —  The second URL.
constant   $strictness   —  How strict to check URLs. Use one of SERVICES_TRACKBACK_STRICTNESS_* constants.

[ Top ]

_fromArray   [line 729]

mixed _fromArray( array $data)

Create a Trackback from a $data array.
  • Return: True on success, otherwise PEAR_Error.
  • Since: 0.2.0
  • Access: protected

Parameters:

array   $data   —  The data array (@see Services_Trackback::create()).

[ Top ]

_getContent   [line 751]

string _getContent( string $url)

_getContent Receive the content from a specific URL.
  • Return: The content.
  • Since: 0.4.0
  • Access: protected

Parameters:

string   $url   —  The URL to download data from.

[ Top ]

_getDecodedData   [line 806]

void _getDecodedData( array $keys, [array $data = null])

_getDecodedData Receives a number of data from the internal data store.
  • Since: 0.1.0
  • Access: protected

Parameters:

array   $keys   —  Data keys to receive
array   $data   —  Optionally the data to check (default is the object data).

[ Top ]

_getEncodedData   [line 780]

void _getEncodedData( array $keys, [array $data = null])

_getEncodedData Receives a number of data from the internal data store, encoded for XML usage.
  • Since: 0.1.0
  • Access: protected

Parameters:

array   $keys   —  Data keys to receive
array   $data   —  Optionally the data to check (default is the object data).

[ Top ]

_interpretTrackbackResponse   [line 907]

void _interpretTrackbackResponse( $response)

Interpret the returned XML code, when sending a trackback.

Parameters:

   $response   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:36:54 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.