Homepage | Documentation | Download
auto_discovery
PHP array auto_discovery(string $text) Search text for links, and searches links for trackback URLs.
<?php include('trackback_cls.php'); $trackback = new Trackback('BLOGish', 'Ran Aroussi', 'UTF-8'); if ($tb_array = $trackback->auto_discovery(string TEXT)) { // Found trackbacks in TEXT. Looping... foreach($tb_array as $tb_key => $tb_url) { // Attempt to ping each one... if ($trackback->ping($tb_url, string URL, [string TITLE], [string EXPERT])) { // Successful ping... echo "Trackback sent to <i>$tb_url</i>...\n"; } else { // Error pinging... echo "Trackback to <i>$tb_url</i> failed....\n"; } } } else { // No trackbacks in TEXT... echo "No trackbacks were auto-discover...\n" } ?>Arguments
- $text
Return
Trackback URLs.
cut_short
PHP string cut_short(string $string, integer $max_length) Cuts a string short (with "...") accroding to $max_length...
Arguments
- $string
- $max_length [optional, default value = 255]
fetch
PHP string fetch(boolean $success, string $response) Feteched trackback information and produces an RSS-0.91 feed.
<?php // 1 header('Content-Type: text/xml'); // MUST be the 1st line // 2 include('trackback_cls.php'); $trackback = new Trackback('BLOGish', 'Ran Aroussi', 'UTF-8'); // 3 $tb_id = $trackback->get_id; // 4 Do whatever to get trackback information by ID (search db, etc...) if (GOT_TRACKBACK_INFO) { // Successful - pass trackback info as array()... $tb_info = array('title' => string TRACKBACK_TITLE, 'expert' => string TRACKBACK_EXPERT, 'permalink' => string PERMALINK_URL, 'trackback' => string TRACKBACK_URL ); echo $trackback->fetch(true, $tb_info); } else { // Something went wrong - tell my why... echo $trackback->fetch(false, string RESPONSE); } ?>Arguments
- $success [optional, default value = false]
- $response [optional, default value = ""]
Return
XML response to the caller
ping
PHP boolean ping(string $tb, string $url, string $title, string $excerpt) Sends a trackback ping to a specified trackback URL. allowing clients to auto-discover the TrackBack Ping URL.
<?php include('trackback_cls.php'); $trackback = new Trackback('BLOGish', 'Ran Aroussi', 'UTF-8'); if ($trackback->ping('http://tracked-blog.com', 'http://your-url.com', 'Your entry title')) { echo "Trackback sent successfully..."; } else { echo "Error sending trackback...."; } ?>Arguments
- $tb
- $url
- $title [optional, default value = ""]
- $excerpt [optional, default value = ""]
rdf_autodiscover
PHP string rdf_autodiscover(string $RFC822_date, string $title, string $expert, string $permalink, string $trackback, string $author) Produces embedded RDF representing metadata about the entry, allowing clients to auto-discover the TrackBack Ping URL.
NOTE: DATE should be string in RFC822 Format - Use RFC822_from_datetime().
<?php include('trackback_cls.php'); $trackback = new Trackback('BLOGish', 'Ran Aroussi', 'UTF-8'); echo $trackback->rdf_autodiscover(string DATE, string TITLE, string EXPERT, string PERMALINK, string TRACKBACK [, string AUTHOR]); ?>Arguments
- $RFC822_date
- $title
- $expert
- $permalink
- $trackback
- $author [optional, default value = ""]
recieve
PHP boolean recieve(boolean $success, string $err_response) Produces XML response for trackbackers with ok/error message.
<?php // Set page header to XML header('Content-Type: text/xml'); // MUST be the 1st line // // Instantiate the class // include('trackback_cls.php'); $trackback = new Trackback('BLOGish', 'Ran Aroussi', 'UTF-8'); // // Get trackback information // $tb_id = $trackback->post_id; // The id of the item being trackbacked $tb_url = $trackback->url; // The URL from which we got the trackback $tb_title = $trackback->title; // Subject/title send by trackback $tb_expert = $trackback->expert; // Short text send by trackback // // Do whatever to log the trackback (save in DB, flatfile, etc...) // if (TRACKBACK_LOGGED_SUCCESSFULLY) { // Logged successfully... echo $trackback->recieve(true); } else { // Something went wrong... echo $trackback->recieve(false, 'Explain why you return error'); } ?>Arguments
- $success [optional, default value = false]
- $err_response [optional, default value = ""]
RFC822_from_datetime
PHP string RFC822_from_datetime(string $datetime) Other Useful functions used in this class
Converts MySQL datetime to a standart RFC 822 date format
Arguments
- $datetime
Return
RFC 822 date
Trackback [Constructor]
PHP Trackback(string $blog_name, string $author, string $encoding) Class Constructure
Arguments
- $blog_name
- $author
- $encoding [optional, default value = "UTF-8"]
PHP Trackback by Ran Aroussi.
A simple, portable PHP class with full TrackBack capabilites.
Documentation generated by PHPEdit - Copyright © 1999-2003 Sébastien Hordeaux