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

Class: Services_Trackback

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

Class Overview


Trackback A generic class to send/receive trackbacks.


Author(s):

Version:

  • Release: 0.7.1

Copyright:

  • 2005-2006 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 56]
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 86]

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 v0.7.1'
        ),)

[line 109]

Options to influence Services_Trackback.

Type:   array


[ Top ]



Method Detail

addSpamCheck   [line 572]

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

addSpamCheck Add a spam check module to the trackback.

Parameters:

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,
  1. is assumed.
   $spamCheck   — 

[ Top ]

autodiscover   [line 294]

bool autodiscover( )

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

[ Top ]

checkSpam   [line 678]

bool checkSpam( [bool $continouse = false])

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   $continouse   —  Wether to check all spam protection modules or quit checking if one modules returns a positive result.

[ Top ]

create   [line 188]

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.

Data: Required id The ID of the trackback target. Optional title string Title of the trackback. excerpt string Abstract of the trackback. blog_name string Name of the trackback blog. url string URL of the trackback. trackback_url string URL to send trackbacks to. extra array Content of $_SERVER, captured while doing Services_Trackback::receive(). Options: strictness int The default strictness to use in 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, 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.

  • Return: The newly created Trackback.
  • Since: 0.2.0
  • Access: public

Parameters:

array   $data   —  Data for the trackback, which is obligatory.
array   $options   —  Options to set for this trackback.

[ Top ]

createSpamCheck   [line 602]

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 713]

mixed get( string $key)

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

Parameters:

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

[ Top ]

getAutodiscoveryCode   [line 434]

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

[ Top ]

getOptions   [line 278]

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:

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

[ Top ]

getResponseSuccess   [line 511]

string getResponseSuccess( )

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

[ Top ]

receive   [line 477]

object Services_Trackback receive( [mixed[] $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:

mixed[]   $data   —  An array of data, ie, from $_POST.

[ Top ]

removeSpamCheck   [line 646]

bool removeSpamCheck( $spamCheck, 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.
   $spamCheck   — 

[ Top ]

send   [line 367]

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. 'url' URL of the weblog entry. 'excerpt' Excerpt of the weblog entry. 'blog_name' Name of the weblog. 'trackback_url' URL to send the trackback to.

Services_Trackback::send() requires HTTP_Request2. The options for the HTTP_Request2 object are stored in the global options array using the key 'http_request'.

  • Return: True on success.
  • Since: 0.3.0
  • Access: public

Parameters:

string   $data   —  Additional data to complete the trackback.

[ Top ]

set   [line 737]

mixed set( string $key, string $val)

set Set data of the trackback. Saves the value of a given key, returning true on success.
  • Return: Boolean true on success.
  • 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 219]

mixed setOptions( array $options)

setOptions Set options for the trackback.

Parameters:

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

[ Top ]

_checkData   [line 862]

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 894]

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 756]

mixed _fromArray( array $data)

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

Parameters:

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

[ Top ]

_getContent   [line 777]

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 834]

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 807]

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 951]

void _interpretTrackbackResponse( string $response)

Interpret the returned XML code, when sending a trackback.

Parameters:

string   $response   —  Raw XML response

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:51:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.