[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/ -> lib-trackback.php (sommaire)

(pas de description)

Poids: 948 lignes (34 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 19 fonctions

  TRB_sendTrackbackResponse()
  TRB_logRejected()
  TRB_trackbackRdf()
  TRB_makeTrackbackUrl()
  TRB_filterTitle()
  TRB_filterBlogname()
  TRB_filterExcerpt()
  TRB_allowDelete()
  TRB_checkForSpam()
  TRB_saveTrackbackComment()
  TRB_deleteTrackbackComment()
  TRB_formatComment()
  TRB_containsBacklink()
  TRB_linksToUs()
  TRB_handleTrackbackPing()
  TRB_renderTrackbackComments()
  TRB_sendTrackbackPing()
  TRB_detectTrackbackUrl()
  TRB_sendNotificationEmail()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

TRB_sendTrackbackResponse($error, $errormsg = '', $http_status = 200, $http_text = "OK")   X-Ref
Send a trackback response message

param: int     $error          0 = OK, 1 = an error occured
param: string  $errormsg       the error message (ignored for $error == 0)
param: int     $http_status    optional HTTP status code
param: string  $http_text      optional HTTP status code text
return: void

TRB_logRejected($reason, $url = '')   X-Ref
Helper function for the curious: Log rejected trackbacks

param: string  $logmsg     Message to log
return: void

TRB_trackbackRdf($article_url, $title, $trackback_url)   X-Ref
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. <!-- ... -->

param: string  $article_url    URL of our entry
param: string  $title          title of that entry
param: string  $trackback_url  trackback URL for our entry
return: string                  RDF code with our information embedded

TRB_makeTrackbackUrl($id, $type = 'article')   X-Ref
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.

param: string  $id     the entry's ID
param: string  $type   type of the entry ('article' = story, etc.)
return: string          trackback URL for that entry

TRB_filterTitle($title)   X-Ref
Filter the title for a trackback comment we've received

param: string  $title  title of the comment
return: string          filtered title

TRB_filterBlogname($blogname)   X-Ref
Filter the blog name for a trackback comment we've received

param: string  $blogname   blog name for the comment
return: string              filtered blog name

TRB_filterExcerpt($excerpt)   X-Ref
Filter the excerpt of a trackback comment we've received

Note: Does not truncate the excerpt.

param: string  $excerpt    excerpt of the trackback comment
return: string              filtered excerpt

TRB_allowDelete($sid, $type)   X-Ref
Check if the current user is allowed to delete trackback comments.

param: string  $sid    ID of the parent object of the comment
param: string  $type   type of the parent object ('article' = story, etc.)
return: bool            true = user can delete the comment, false = nope

TRB_checkForSpam($url, $title = '', $blog = '', $excerpt = '')   X-Ref
Check a trackback / pingback for spam

param: string  $url        URL of the trackback comment
param: string  $title      title of the comment (set to $url if empty)
param: string  $blog       name of the blog that sent the comment
param: string  $excerpt    excerpt from the comment
return: int                 TRB_SAVE_OK or TRB_SAVE_SPAM

TRB_saveTrackbackComment($sid, $type, $url, $title = '', $blog = '', $excerpt = '')   X-Ref
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.

param: string  $sid        entry id
param: string  $type       type of entry ('article' = story, etc.)
param: string  $url        URL of the trackback comment
param: string  $title      title of the comment (set to $url if empty)
param: string  $blog       name of the blog that sent the comment
param: string  $excerpt    excerpt from the comment
return: int                 < 0: error, > 0: ID of the trackback comment

TRB_deleteTrackbackComment($cid)   X-Ref
Delete a trackback comment

Note: Permission checks have to be done by the caller.

param: int     $cid    ID of the trackback comment
return: void

TRB_formatComment($url, $title = '', $blog = '', $excerpt = '', $date = 0, $delete_option = false, $cid = '', $ipaddress = '')   X-Ref
Format one trackback comment for display

Note: $excerpt is not truncated - this should have been done elsewhere

param: string      $url        URL of the trackback comment
param: string      $title      title of the comment (set to $url if empty)
param: string      $blog       name of the blog that sent the comment
param: string      $excerpt    excerpt from the comment
param: timestamp   $date       date and time when the comment was sent
param: bool        $delete_option  whether to display a link to delete the trackback comment
param: string      $cid        id of this trackback comment
param: string      $ipaddress  IP address the comment was sent from
return: string                  HTML of the formatted trackback comment

TRB_containsBacklink($body, $urlToCheck)   X-Ref
Perform a backlink check on an HTML page

param: string  $body       complete HTML page to check
param: string  $urlToCheck URL to find in that page
return: boolean             true: found a link to us; false: no link to us

TRB_linksToUs($sid, $type, $urlToGet)   X-Ref
Check if a given web page links to us

param: string  $sid        ID of entry that got pinged
param: string  $type       type of that entry ('article' for stories, etc.)
return: bool                true = links to us, false = doesn't

TRB_handleTrackbackPing($sid, $type = 'article')   X-Ref
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.

param: string  $sid    ID of entry that got pinged
param: string  $type   type of that entry ('article' for stories, etc.)
return: bool            true = success, false = an error occured

TRB_renderTrackbackComments($sid, $type, $title, $permalink, $trackback_url = '')   X-Ref
Render all the trackback comments for a specific entry

param: string  $sid            entry id
param: string  $type           type of entry ('article' = story, etc.)
param: string  $title          the entry's title
param: string  $permalink      link to the entry
param: string  trackback_url   trackback URL for this entry
return: string                  HTML (formatted list of trackback comments)

TRB_sendTrackbackPing($targeturl, $url, $title, $excerpt, $blog = '')   X-Ref
Send a trackback ping

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

param: string  $targeturl  URL to ping
param: string  $url        URL of our entry
param: string  $title      title of our entry
param: string  $excerpt    text excerpt from our entry
param: string  $blog       name of our Geeklog site
return: mixed               true = success, otherwise: error message

TRB_detectTrackbackUrl($url)   X-Ref
Attempt to auto-detect the Trackback URL of a post.

param: string  $url    URL of post with embedded RDF for the Trackback URL
return: mixed           Trackback URL, or false on error

TRB_sendNotificationEmail($cid, $what = 'trackback')   X-Ref
Send a notification email when a new trackback comment has been posted

param: int     $cid    ID of the trackback comment
param: string  $what   type of notification: 'trackback' or 'pingback'
return: void



Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics