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

Procedural File: lib-trackback.php

Source Location: /system/lib-trackback.php



Page Details:








TRB_SAVE_OK [line 37]

TRB_SAVE_OK = 0

[ Top ]



TRB_SAVE_REJECT [line 39]

TRB_SAVE_REJECT = -2

[ Top ]



TRB_SAVE_SPAM [line 38]

TRB_SAVE_SPAM = -1

[ Top ]




TRB_allowDelete [line 189]

boolean TRB_allowDelete( string $sid, string $type)

Check if the current user is allowed to delete trackback comments.



Tags:

return:  true = user can delete the comment, false = nope


Parameters

string   $sid   ID of the parent object of the comment
string   $type   type of the parent object ('article' = story, etc.)
[ Top ]



TRB_checkForSpam [line 227]

int TRB_checkForSpam( string $url, [string $title = ''], [string $blog = ''], [string $excerpt = ''])

Check a trackback / pingback for spam



Tags:

return:  TRB_SAVE_OK or TRB_SAVE_SPAM


Parameters

string   $url   URL of the trackback comment
string   $title   title of the comment (set to $url if empty)
string   $blog   name of the blog that sent the comment
string   $excerpt   excerpt from the comment
[ Top ]



TRB_containsBacklink [line 414]

boolean TRB_containsBacklink( string $body, string $urlToCheck)

Perform a backlink check on an HTML page



Tags:

return:  true: found a link to us; false: no link to us


Parameters

string   $body   complete HTML page to check
string   $urlToCheck   URL to find in that page
[ Top ]



TRB_deleteTrackbackComment [line 312]

void TRB_deleteTrackbackComment( int $cid)

Delete a trackback comment Note: Permission checks have to be done by the caller.



Parameters

int   $cid   ID of the trackback comment
[ Top ]



TRB_detectTrackbackUrl [line 793]

mixed TRB_detectTrackbackUrl( string $url)

Attempt to auto-detect the Trackback URL of a post.



Tags:

return:  Trackback URL, or false on error Note: The RDF, if found, is only parsed using a regular expression. Using the XML parser may be more successful on some occassions ...


Parameters

string   $url   URL of post with embedded RDF for the Trackback URL
[ Top ]



TRB_filterBlogname [line 165]

string TRB_filterBlogname( string $blogname)

Filter the blog name for a trackback comment we've received



Tags:

return:  filtered blog name


Parameters

string   $blogname   blog name for the comment
[ Top ]



TRB_filterExcerpt [line 177]

string TRB_filterExcerpt( string $excerpt)

Filter the excerpt of a trackback comment we've received Note: Does not truncate the excerpt.



Tags:

return:  filtered excerpt


Parameters

string   $excerpt   excerpt of the trackback comment
[ Top ]



TRB_filterTitle [line 154]

string TRB_filterTitle( string $title)

Filter the title for a trackback comment we've received



Tags:

return:  filtered title


Parameters

string   $title   title of the comment
[ Top ]



TRB_formatComment [line 335]

string TRB_formatComment( string $url, [string $title = ''], [string $blog = ''], [string $excerpt = ''], [timestamp $date = 0], [boolean $delete_option = false], [string $cid = ''], [string $ipaddress = ''], [string $token = ''])

Format one trackback comment for display Note: $excerpt is not truncated - this should have been done elsewhere



Tags:

return:  HTML of the formatted trackback comment


Parameters

string   $url   URL of the trackback comment
string   $title   title of the comment (set to $url if empty)
string   $blog   name of the blog that sent the comment
string   $excerpt   excerpt from the comment
timestamp   $date   date and time when the comment was sent
boolean   $delete_option   whether to display a link to delete the trackback comment
string   $cid   id of this trackback comment
string   $ipaddress   IP address the comment was sent from
string   $token   security token
[ Top ]



TRB_handleTrackbackPing [line 517]

boolean TRB_handleTrackbackPing( string $sid, [string $type = 'article'])

Handles a trackback ping for an entry.

Also takes care of the speedlimit and spam. Assumes that the caller of this function has already checked permissions! Note: Error messages are XML-formatted and echo'd out directly, as they are supposed to be processed by some sort of software.




Tags:

return:  true = success, false = an error occured P.S. "Critical" errors are rejected with a HTTP 403 Forbidden status code. According to RFC2616, this status code means "The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated." See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4


Parameters

string   $sid   ID of entry that got pinged
string   $type   type of that entry ('article' for stories, etc.)
[ Top ]



TRB_linksToUs [line 454]

boolean TRB_linksToUs( string $sid, string $type, string $urlToGet)

Check if a given web page links to us



Tags:

return:  true = links to us, false = doesn't


Parameters

string   $sid   ID of entry that got pinged
string   $type   type of that entry ('article' for stories, etc.)
string   $urlToGet   URL of the page that supposedly links to us
[ Top ]



TRB_logRejected [line 81]

void TRB_logRejected( $reason, [ $url = ''], string $logmsg)

Helper function for the curious: Log rejected trackbacks



Parameters

string   $logmsg   Message to log
   $reason  
   $url  
[ Top ]



TRB_makeTrackbackUrl [line 136]

string TRB_makeTrackbackUrl( string $id, [string $type = 'article'])

Returns the trackback URL for an entry Note: Trackback pings default to stories, so we leave off the type if it is 'article' to create shorter URLs.



Tags:

return:  trackback URL for that entry


Parameters

string   $id   the entry's ID
string   $type   type of the entry ('article' = story, etc.)
[ Top ]



TRB_renderTrackbackComments [line 646]

string TRB_renderTrackbackComments( string $sid, string $type, string $title, string $permalink, [string $trackback_url = ''])

Render all the trackback comments for a specific entry



Tags:

return:  HTML (formatted list of trackback comments)


Parameters

string   $sid   entry id
string   $type   type of entry ('article' = story, etc.)
string   $title   the entry's title
string   $permalink   link to the entry
string   $trackback_url   trackback_url trackback URL for this entry
[ Top ]



TRB_saveTrackbackComment [line 254]

int TRB_saveTrackbackComment( string $sid, string $type, string $url, [string $title = ''], [string $blog = ''], [string $excerpt = ''])

Save a trackback (or pingback) comment.

Also filters parameters and handles multiple trackbacks from the same source. Note: Spam check should have been done before calling this function.




Tags:

return:  < 0: error, > 0: ID of the trackback comment


Parameters

string   $sid   entry id
string   $type   type of entry ('article' = story, etc.)
string   $url   URL of the trackback comment
string   $title   title of the comment (set to $url if empty)
string   $blog   name of the blog that sent the comment
string   $excerpt   excerpt from the comment
[ Top ]



TRB_sendNotificationEmail [line 852]

void TRB_sendNotificationEmail( int $cid, [string $what = 'trackback'])

Send a notification email when a new trackback comment has been posted



Parameters

int   $cid   ID of the trackback comment
string   $what   type of notification: 'trackback' or 'pingback'
[ Top ]



TRB_sendTrackbackPing [line 715]

mixed TRB_sendTrackbackPing( string $targeturl, string $url, string $title, string $excerpt, [string $blog = ''])

Send a trackback ping Based on a code snippet by Jannis Hermanns, http://www.jannis.to/programming/trackback.html



Tags:

return:  true = success, otherwise: error message


Parameters

string   $targeturl   URL to ping
string   $url   URL of our entry
string   $title   title of our entry
string   $excerpt   text excerpt from our entry
string   $blog   name of our Geeklog site
[ Top ]



TRB_sendTrackbackResponse [line 54]

void TRB_sendTrackbackResponse( int $error, [string $errormsg = ''], [int $http_status = 200], [string $http_text = &quot;OK&quot;])

Send a trackback response message



Parameters

int   $error  
  1. = OK, 1 = an error occured
string   $errormsg   the error message (ignored for $error == 0)
int   $http_status   optional HTTP status code
string   $http_text   optional HTTP status code text
[ Top ]



TRB_trackbackRdf [line 108]

string TRB_trackbackRdf( string $article_url, string $title, string $trackback_url)

Creates a piece of RDF pointing out the trackback URL Note: When putting this in an HTML page, it may be advisable to enclose it in HTML comments, i.e. <!-- ... -->



Tags:

return:  RDF code with our information embedded


Parameters

string   $article_url   URL of our entry
string   $title   title of that entry
string   $trackback_url   trackback URL for our entry
[ Top ]



Documentation generated on Sun, 02 Oct 2016 07:51:44 +0000 by phpDocumentor 1.4.3