BlogEntry

Represents an entry in the weblog.

Inherits

LnBlogObject, Entry

Events

OnInitFired when object is first created.
InitCompleteFired at end of constructor.
OnInsertFired before object is saved to persistent storage.
InsertCompleteFired after object has finished saving.
OnDeleteFired before object is deleted.
DeleteCompleteFired after object is deleted.
OnUpdateFired before changes are saved to persistent storage.
UpdateCompleteFired after changes to object are saved.
OnOutputFired before output is generated.
OutputCompleteFired after output has finished being generated.
POSTRetrievedFired after data has been retreived from an HTTP POST.
Summary
Represents an entry in the weblog.
Get a copy of the parent of this objcet, i.e.
Gets an identifier for the current entry.
A unique ID for use with blogging APIs.
Gets an identifier for the entry’s parent blog.
Gets an array of the names of all files uploaded to this entry.
Gets the URL, file size, and media type of the file set as the enclosure for this entry, it if exists.
Returns a path to use for the entry.
Determine if the object is a blog entry or not.
Get the path to this entry’s directory on the local filesystem.
Get the permalink to the object.
Returns a link to the object’s base directory.
Get the permalink to the object.
Gets the URI of the a specified page.
Commit changes to the object.
Delete the current object.
Save the object to persistent storage.
Calculates a file name for a “pretty” permalink wrapper script.
Creates a wrapper script that makes a “pretty” permalink to the entry directory based on the subject text of the entry.
Extract data from an HTTP POST and insert it into the object.
Get the HTML to use to display the object.
Get the number of replies of a particular type.
Get an array of replies of a particular type.
Gets the HTML markup to display to list a given type of reply.
Determine the number of comments that belong to this object.
Gets all the comment objects for this entry.
Get the HTML markup to display the entire list of comments for this entry.
Get the number of TrackBacks for this object.
Get an array of Trackback objects that contains all TrackBacks for this entry.
Get some HTML that displays the TrackBacks for this entry.
Get the number of Pingbacks for this object.
Get an array of Pingback objects that contains all Pingbacks for this entry.
Get some HTML that displays the Pingbacks for this entry.
Scans the links in the current entry, determines which are pingback-enabled, and sends a pingback ping to those links.
Checks if a Pingback ping has already been recorded for the source URL.
Extracts all the hyperlinks from the entry text.

Functions

getParent

function getParent()

Get a copy of the parent of this objcet, i.e. the blog to which it belongs.

Returns

A Blog object.

entryID

function entryID()

Gets an identifier for the current entry.

Returns

For file-based storage, string containing the last part of the path.  Normally, this is in the form ##/##/##_####

globalID

function globalID()

A unique ID for use with blogging APIs.  Note that this ID embedds the parent blog’s ID, whereas the entryID method provides an ID within the current blog.

Returns

A string with the unique ID.

parentID

function parentID()

Gets an identifier for the entry’s parent blog.

Returns

For file-based storage, returns the webroot-relative path to the blog.

getUploadedFiles

function getUploadedFiles()

Gets an array of the names of all files uploaded to this entry.  Currently, this just means all files in the entry directory that were not created by LnBlog.

Returns

An array containing the file names without path.

getEnclosure

function getEnclosure()

Gets the URL, file size, and media type of the file set as the enclosure for this entry, it if exists.  The file is checkedy by converting the URL into a local path using the same rules as entry URL absolutizaiton, or simply doing a URL to localpath conversion.

Returns

If the enclosure property is set and the file is found, returns an array with elements “url”, “length”, and “type”.  If the file is not found, then checks if the enclosure matches the expected content or an enclosure tag in an RSS feed.  If so, extracts the data into an array.  Otherwise Otherwise, returns false.

getPath

function getPath($curr_ts,  
$just_name = false,
$long_format = false)

Returns a path to use for the entry.  This is only applicable for file-based storage and is for internal use only.

Parameters

curr_tsThe timestamp for this entry.
just_nameOptional boolean determining whether to return a full path or just a file name.  Default is false.
long_formatOptional boolean for whether to use a long or regular date format.  Defaults to false.

Returns

A string with the path to use for this entry.

isEntry

function isEntry ($path = false)

Determine if the object is a blog entry or not.

Parameter

pathOptional path to the entry.  If not set, use the current object.

Return

True if the object is an existing entry, false otherwise.

localpath

function localpath()

Get the path to this entry’s directory on the local filesystem.  Note that this is specific to file-based storage and so should only be c called internally.

Returns

A string representing a path to the object or false on failure.

permalink

function permalink()

Get the permalink to the object.

Returns

A string containing the full URI to this entry.

baselink

function baselink()

Returns a link to the object’s base directory.

Returns

A string with the URI.

commentlink

Get the permalink to the object.

uri

function uri($type)

Gets the URI of the a specified page.

Parameters

linkThe page for which you want the URI.  Valid values are “page”, “

Returns

A string holding the relevant URI.

update

function update ()

Commit changes to the object.

Returns

True on success, false on failure.

delete

function delete ()

Delete the current object.

Returns

True on success, false on failure.

insert

function insert (&$blog)

Save the object to persistent storage.

Parameters

blogThe blog into which the entry will be inserted.

Returns

True on success, false on failure.

calcPrettyPermalink

function calcPrettyPermalink($use_broken_regex = false)

Calculates a file name for a “pretty” permalink wrapper script.

Parameters

use_broken_regexOptional parameter to calculate the URI based on the ugly regex used in LnBlog < 0.7.  Defaults to false.

Returns

The string to be used for the file name.

makePrettyPermalink

function makePrettyPermalink()

Creates a wrapper script that makes a “pretty” permalink to the entry directory based on the subject text of the entry.

Returns

True on success, false on failure.

getPostData

function getPostData()

Extract data from an HTTP POST and insert it into the object.  The data fields in the POST are described below.

Fields

subjectThe subject of the entry, in plain text.
short_pathThe “short path” to access an article.
abstractAn abstract of the entry, with markup.
tagsA comma-delimited list of free-form tags.
bodyThe entry body, with markup.
commentsBoolean representing whether new comments can be posted.
input_modeTristate variable representing the type of markup used.  Valid values are defined by the constants MARKUP_NONE, MARKUP_BBCODE, and MARKUP_HTML.

get

function get($show_edit_controls = false)

Get the HTML to use to display the object.

Parameters

show_edit_controlsOptional boolean determining if the edit, delete, etc. links should be displayed.  Defaults to false.

Returns

A string containing the markup.

getReplyCount

function getReplyCount($params)

Get the number of replies of a particular type.

Parameters

parmsAn associative array of various parameters.  The valid array keys are “path”, which is the directory to scan, “ext”, which is the file extension of the data files, and “match_re”, which is a regular expression matching the names of the data files minus the extension (default is /[\w\d]+/)).  Note that “path” and “ext” keys are required.

Returns

An integer representing the number of replies of the given type.  If the call fails for some reason, then false is returned.

getReplyArray

function getReplyArray($params)

Get an array of replies of a particular type.

Parameters

paramsAn associative array of settings, as in getReplyCount.  In addition to the keys allowed by that function, this one also requires a “creator” key, which is the name of a function that will return the correct type of object given the data path to its storage file as a parameter.  It also accepts an optional “sort_asc” key, which will sort the files in order by filename, (which equates to date order) rather than in reverse order when set to true.

Returns

An array of BlogComment, Trackback, or Pingback objects, depending on the parameters.  Returns false on failure.

getReplies

function getReplies($params)

Gets the HTML markup to display to list a given type of reply.

Parameters

paramsAn associative array of parameters, as in getReplyArray.  In addition, it requires the ‘itemclass’ and ‘listtitle’ keys to be set.  These are the CSS class applied to each reply and the title given to the whole reply list, respectively.  There is also an optional “listclass” key that gives the CSS class to apply to the list.

Returns

A string of HTML markup to send to the client.

getCommentCount

function getCommentCount()

Determine the number of comments that belong to this object.

Returns

A non-negative integer representing the number of comments or false on failure.

getCommentArray

function getCommentArray($sort_asc = true)

Gets all the comment objects for this entry.

Parameters

sort_ascOptional boolean (true by default) determining whether the comments should be sorted in ascending order by date.

Returns

An array of BlogComment object.

getComments

function getComments($sort_asc = true)

Get the HTML markup to display the entire list of comments for this entry.

Parameters

sort_ascOptional boolean (true by default) determining whether the comments should be sorted in ascending order by date.

Returns

A string of HTML markup.

getTrackbackCount

function getTrackbackCount()

Get the number of TrackBacks for this object.

Returns

A non-negative integer representing the number of TrackBacks or false on failure.

getTrackbackArray

function getTrackbackArray($sort_asc = true)

Get an array of Trackback objects that contains all TrackBacks for this entry.

Parameters

sort_ascOptional boolean (true by default) determining whether the trackbacks should be sorted in ascending order by date.

Returns

An array of Trackback objects.

getTrackbacks

function getTrackbacks($sort_asc = true)

Get some HTML that displays the TrackBacks for this entry.

Parameters

sort_ascOptional boolean (true by default) determining whether the trackbacks should be sorted in ascending order by date.

Returns

A string of markup.

getPingbackCount

function getPingbackCount()

Get the number of Pingbacks for this object.

Returns

A non-negative integer representing the number of Pingbacks or false on failure.

getPingbackArray

function getPingbackArray($sort_asc = true)

Get an array of Pingback objects that contains all Pingbacks for this entry.

Parameters

sort_ascOptional boolean (true by default) determining whether the pingbacks should be sorted in ascending order by date.

Returns

An array of Pingback objects.

getPingbacks

function getPingbacks($sort_asc = true)

Get some HTML that displays the Pingbacks for this entry.

Parameters

sort_ascOptional boolean (true by default) determining whether the pingbacks should be sorted in ascending order by date.

Returns

A string of markup.

sendPings

function sendPings($local = false)

Scans the links in the current entry, determines which are pingback-enabled, and sends a pingback ping to those links.

Parameters

localOptional boolean that determines whether or not to send pings to posts on the same webserver.  Defaults to false.  Returns: An array of associative arrays.  Each array has ‘uri’ and a ‘response’ key, which contain the target URI and the XML-RPC response object.

pingExists

function pingExists ($uri)

Checks if a Pingback ping has already been recorded for the source URL.

Parameters

uriThe source URI to check.

Returns

True if there is already a recorded ping with the source URI, false otherwise.

extractLinks

function extractLinks($allow_local = false)

Extracts all the hyperlinks from the entry text.

Parameters

allow_localOptional boolean parameter that determines if local links, should be included.  Defaults to false.

Returns

An array of URLs containing each hyperlink in the entry.  If allow_local is false, then links without a protocol and host name are excluded.

function getParent()
Get a copy of the parent of this objcet, i.e.
function entryID()
Gets an identifier for the current entry.
function globalID()
A unique ID for use with blogging APIs.
function parentID()
Gets an identifier for the entry’s parent blog.
function getUploadedFiles()
Gets an array of the names of all files uploaded to this entry.
function getEnclosure()
Gets the URL, file size, and media type of the file set as the enclosure for this entry, it if exists.
function getPath($curr_ts,  
$just_name = false,
$long_format = false)
Returns a path to use for the entry.
function isEntry ($path = false)
Determine if the object is a blog entry or not.
function localpath()
Get the path to this entry’s directory on the local filesystem.
function permalink()
Get the permalink to the object.
function baselink()
Returns a link to the object’s base directory.
function uri($type)
Gets the URI of the a specified page.
function update ()
Commit changes to the object.
function delete ()
Delete the current object.
function insert (&$blog)
Save the object to persistent storage.
function calcPrettyPermalink($use_broken_regex = false)
Calculates a file name for a “pretty” permalink wrapper script.
function makePrettyPermalink()
Creates a wrapper script that makes a “pretty” permalink to the entry directory based on the subject text of the entry.
function getPostData()
Extract data from an HTTP POST and insert it into the object.
function get($show_edit_controls = false)
Get the HTML to use to display the object.
function getReplyCount($params)
Get the number of replies of a particular type.
function getReplyArray($params)
Get an array of replies of a particular type.
function getReplies($params)
Gets the HTML markup to display to list a given type of reply.
function getCommentCount()
Determine the number of comments that belong to this object.
function getCommentArray($sort_asc = true)
Gets all the comment objects for this entry.
function getComments($sort_asc = true)
Get the HTML markup to display the entire list of comments for this entry.
function getTrackbackCount()
Get the number of TrackBacks for this object.
function getTrackbackArray($sort_asc = true)
Get an array of Trackback objects that contains all TrackBacks for this entry.
function getTrackbacks($sort_asc = true)
Get some HTML that displays the TrackBacks for this entry.
function getPingbackCount()
Get the number of Pingbacks for this object.
function getPingbackArray($sort_asc = true)
Get an array of Pingback objects that contains all Pingbacks for this entry.
function getPingbacks($sort_asc = true)
Get some HTML that displays the Pingbacks for this entry.
function sendPings($local = false)
Scans the links in the current entry, determines which are pingback-enabled, and sends a pingback ping to those links.
function pingExists ($uri)
Checks if a Pingback ping has already been recorded for the source URL.
function extractLinks($allow_local = false)
Extracts all the hyperlinks from the entry text.
A base object which is event-aware, i.e.
An abstract class representing entries of all types in the blog database.
Use auto-markup.
Use LBCode markup, a bastardized version of BBCode.
Treat the markup as raw HTML, leaving it untouched.