BlogComment
Entry
Reply
BlogComment

Represents a comment on a blog entry or article.

Inherits

LnBlogObject, Entry

Events
OnInit

Fired when object is first created.

InitComplete

Fired at end of constructor.

OnInsert

Fired before object is saved to persistent storage.  This is run after the insertion setup is done, but before anything is actually saved to disk.

InsertComplete

Fired after object has finished saving.

OnDelete

Fired before object is deleted.

DeleteComplete

Fired after object is deleted.

OnUpdate

Fired before changes are saved to persistent storage.

UpdateComplete

Fired after changes to object are saved.

OnOutput

Fired before output is generated.

OutputComplete

Fired after output has finished being generated.

POSTRetrieved

Fired after data has been retreived from an HTTP POST.

Functions
getPath
public function getPath(
$ts
)

Get the path to use for to store the comment.  This is specific to file-based storage and so is for internal use only.

Parameters
ts

The timestamp of the entry.

Returns

A string to use for the file name.

update
public function update()

Commit changes to a comment.

Returns

True on success, false on failure.

delete
public function delete()

Delete a comment.

Returns

True on success, false on failure.

insert
public function insert(
$entry
)

Add a new comment on an entry or article.

Parameters
Entry

The entry to which this comment will belong.  This determines where the comment is stored.

Returns

True on success, false on failure.

getPostData
public function getPostData()

Pulls data out of the HTTP POST headers and into the object.

The interface for this uses pre-defined POST field names they are as follows.  If the poster is an authenticated user, then the userid is also recorded automatically from the HTTP session.  username  - The name of the poster.  email  - The poster's e-mail address.  url  - The poster's homepage.  showemail - If not empty, show the poster's e-mail address publically.  subject  - The subject of the post.  data  - The post content.  This cannot be empty.

getAnchor
public function getAnchor()

Get text to use as the name attribute in an HTML anchor tag.

Returns

A string for anchor text based on the file name/storage ID.

getFilename
public function getFilename(
$anchor
)

The inverse of getAnchor, this converts an anchor into a file.

Parameters
anchor

An anchor string generated by getAnchor.

Returns

A string with the name of the associated file.

globalID
public function globalID()

Get the global identifier for this comment.

permalink
public function permalink()

Get the permalink to the object.  This is essentially the URI of the parent's comments page with the anchor name appended.

Returns

The full URI to the object's permalink, including page anchor.

isComment
public function isComment(
$pathfalse
)

Determines whether or not the object is an existing, saved comment.

Parameters
path

The optional path to the comment data file.  If not specified, then the file property is used.

Returns

True if the comment data file exists, false otherwise.

getParent
public function getParent()

Gets a copy of the parent object of this comment, i.e. the object which this is a comment on.

Returns

A BlogEntry.

get
public function get(
$show_edit_controlsfalse
)

Gets the markup to display the object in a web browser.

Parameters
show_edit_controls

Optional boolean that determines whether or not to display edit controls, e.g. delete link.

Returns

A string containing the markup.