The “master” class which represents a weblog. Nearly all functions are performed through this object. This is the object that handles user security.
OnInit | Fired when a blog object is created. |
InitComplete | Fired after the constructor has run. |
OnInsert | Run when a new blog is about to be created. |
InsertComplete | Run after a new blog object has been saved. |
OnUpdate | Run when a blog is about to be updated. |
UpdateComplete | Run after a blog is successfully updated. |
OnDelete | Run before a blog is deleted. |
DeleteComplete | Run after a blog is deleted. |
OnUpgrade | Run before the wrapper upgrade process. |
UpgradeComplete | Run when the wrapper upgrade is finished. |
OnEntryPreview | Run before populating entry template for preview. |
OnArticlePreview | Fired before populating article template for preview. |
OnEntryError | Fired before populating template when on an error. |
OnArticelError | Fired before populating template when on an error. |
Blog | The “master” class which represents a weblog. |
Constants | |
ROOT_ID | Defines the magic string that denotes a blog on the server’s document root. |
RSS compatibility methods | |
Functions | |
isBlog | Determines whether the object represents an existing blog. |
writers | Set and return the list of users who can add posts to the blog. |
readBlogData | Read and write a simple text file with the blog metadata. |
writeBlogData | Save the blog data to disk. |
getDateRange | Get all blog entries posted between a given range of dates. |
getDay | Get all the blog entries for a particular day. |
getDayCount | Get the number of posts made on a given day. |
getMonth | Get a list of all entries for the specified month. |
getMonthCount | Get the number of entries in the given month. |
getYear | Like getMonth, except gets entries for an entire year. |
getYearList | Get a list of all years in the archive, sorted in reverse chronological order. |
getMonthList | Get a list of the months for the given year. |
getRecentMonthList | Get a list of recent months, starting from the current month and going backward. |
getURL | Get the URL for the blog homepage. |
uri | Get the URI of the designated resource. |
getRecent | Get the most recent entries across all months and years. |
getNextMax | Convenience function to get “previous entries”. |
getEntries | Scan entries in reverse chronological order, starting at a given offset, and get a given number of them. |
getEntriesByTag | Get a list of entries tagged with a given string. |
getDrafts | Gets all the current drafts for this blog. |
getArticles | Returns a list of all articles, in no particular order. |
getArticleList | Get a list of articles with title and permalink. |
getEntryReplies | Gets all the replies for all entries belonging to this blog, including all comments, trackbacks, and pingbacks. |
getEntryComments | Like getEntryReplies, but only returns BlogComments. |
getEntryTrackbacks | Like getEntryReplies, but only returns Trackbacks. |
getEntryPingbacks | Like getEntryReplies, but only returns Pingbacks. |
getArticleReplies | Like getEntryReplies, but returns the replies for all Articles, instead of for all BlogEntries. |
getArticleComments | Like getArticleReplies, but only returns BlogComments. |
getArticleTrackbacks | Like getArticleReplies, but only returns Trackbacks. |
getArticleArticlePingbacks | Like getArticleReplies, but only returns Pingbacks. |
getReplies | Like getEntryReplies and getArticleReplies, but combines both, returning an array of all replies for this blog. |
getComments | Like getReplies, but only for comments. |
getTrackbacks | Like getReplies, but only for comments. |
getPingbacks | Like getReplies, but only for comments. |
exportVars | Export blog variables to a PHPTemplate class. |
getWeblog | Gets the markup to display for the front page of a weblog. |
upgradeWrappers | This is an upgrade function that will create new config and wrapper scripts to upgrade a directory of blog data to the current version. |
fixDirectoryPermissions | A quick utility function to fix the borked permissions from not setting the correct umask when creating directories. |
insert | Creates a new weblog. |
update | Modify an existing weblog. |
delete | Removes an existing weblog. |
updateTagList | Adds any new tags to the list of tags used in the current blog. |
Functions | |
isBlog | Determines whether the object represents an existing blog. |
writers | Set and return the list of users who can add posts to the blog. |
readBlogData | Read and write a simple text file with the blog metadata. |
writeBlogData | Save the blog data to disk. |
getDateRange | Get all blog entries posted between a given range of dates. |
getDay | Get all the blog entries for a particular day. |
getDayCount | Get the number of posts made on a given day. |
getMonth | Get a list of all entries for the specified month. |
getMonthCount | Get the number of entries in the given month. |
getYear | Like getMonth, except gets entries for an entire year. |
getYearList | Get a list of all years in the archive, sorted in reverse chronological order. |
getMonthList | Get a list of the months for the given year. |
getRecentMonthList | Get a list of recent months, starting from the current month and going backward. |
getURL | Get the URL for the blog homepage. |
uri | Get the URI of the designated resource. |
getRecent | Get the most recent entries across all months and years. |
getNextMax | Convenience function to get “previous entries”. |
getEntries | Scan entries in reverse chronological order, starting at a given offset, and get a given number of them. |
getEntriesByTag | Get a list of entries tagged with a given string. |
getDrafts | Gets all the current drafts for this blog. |
getArticles | Returns a list of all articles, in no particular order. |
getArticleList | Get a list of articles with title and permalink. |
getEntryReplies | Gets all the replies for all entries belonging to this blog, including all comments, trackbacks, and pingbacks. |
getEntryComments | Like getEntryReplies, but only returns BlogComments. |
getEntryTrackbacks | Like getEntryReplies, but only returns Trackbacks. |
getEntryPingbacks | Like getEntryReplies, but only returns Pingbacks. |
getArticleReplies | Like getEntryReplies, but returns the replies for all Articles, instead of for all BlogEntries. |
getArticleComments | Like getArticleReplies, but only returns BlogComments. |
getArticleTrackbacks | Like getArticleReplies, but only returns Trackbacks. |
getArticleArticlePingbacks | Like getArticleReplies, but only returns Pingbacks. |
getReplies | Like getEntryReplies and getArticleReplies, but combines both, returning an array of all replies for this blog. |
getComments | Like getReplies, but only for comments. |
getTrackbacks | Like getReplies, but only for comments. |
getPingbacks | Like getReplies, but only for comments. |
exportVars | Export blog variables to a PHPTemplate class. |
getWeblog | Gets the markup to display for the front page of a weblog. |
upgradeWrappers | This is an upgrade function that will create new config and wrapper scripts to upgrade a directory of blog data to the current version. |
fixDirectoryPermissions | A quick utility function to fix the borked permissions from not setting the correct umask when creating directories. |
insert | Creates a new weblog. |
update | Modify an existing weblog. |
delete | Removes an existing weblog. |
updateTagList | Adds any new tags to the list of tags used in the current blog. |
function getDateRange( $end_date, $start_date = '' )
Get all blog entries posted between a given range of dates. Note that the range is inclusive.
end_date | A string containing end date of the range in “yyyy-mm-dd” format. This can also use “yyyy-mm” or “yyyy” format. |
start_date | The optional start date of the range. If this is omitted, the the end date will be taken as the entirity of the range, whether it is a day, month, or year. |
An array of BlogEntry objects.
function getMonth( $year = false, $month = false )
Get a list of all entries for the specified month. If you do not specify a year and month, then the routine will try to get it from the current directory and/or URL.
year | Optional year you want. |
month | Optional month you want. |
An array of BlogEntry objects posted in the given month, sorted in reverse chronological order by post date.
function getMonthCount( $year = false, $month = false )
Get the number of entries in the given month. If no month and year are given, try to get them from the current directory/URL.
year | Optional year you want. |
month | Optional month you want. |
A non-negative integer representing the number of posts in that month.
function getYear( $year = false )
Like getMonth, except gets entries for an entire year.
year | Optional year to get. If not given, the year will be auto-detected. |
An array of BlogEntry objects posted in the given year, sorted in reverse chronological order by post date.
function getYearList()
Get a list of all years in the archive, sorted in reverse chronological order.
A two-dimensional array. The first dimension has numeric indexes. The second has two elements, indexed as “year” and “link”, which hold the 4-digit year and a permalink to the archive of that year respectively.
function getMonthList( $year = false )
Get a list of the months for the given year. If no year is given, try to extract it from the current directory/URL.
year | The year you want. |
A two-dimensional array. The first dimension is numerically indexed, with elements sorted in reverse chronological order. The second dimension has three elements, indexed as “year”, “month”, and “link”. These hold, respectively, the year you specified, the 2-digit month, and a permalink to the archive for that month.
function getRecentMonthList( $nummonths = 12 )
Get a list of recent months, starting from the current month and going backward. This is essentially a wrapper around getMonthList.
nummonths | Optional number of months to return. The default is 12. If set to zero or less, then all months will be retreived. |
An array of the most recent months in the same format used by getMonthList. The total length of the first dimension of the array should be nummonths long.
function uri( $type )
Get the URI of the designated resource.
type | The type of URI to get, e.g. permalink, edit link, etc. |
data parameters | All other parameters after the first are interpreted as additional data for the URL query string. The exact meaning of each parameter depends on the URL type. |
A string with the permalink.
function getRecent( $num_entries = false )
Get the most recent entries across all months and years.
num_entries | Optional number of entries to return. The default is to use the <max_entries> property of the blog. If -1 is passed, then all entries in the blog will be returned. |
An array of BlogEntry objects.
function getNextMax( $num_entries = false )
Convenience function to get “previous entries”. Returns a list of entries starting after the the end of the blog’s <max_entires> property.
num_entries | The optional number or entries to return. The default is to use the blog’s <max_entries> property. |
An array of BlogEntry objects.
function getEntries( $number = -1, $offset = 0 )
Scan entries in reverse chronological order, starting at a given offset, and get a given number of them.
number | Optional number of entries to return. If set to a negative number, then returns all entries will be returned. The default value is -1. |
offset | Optional number of entries from the beginning of the list to skip. The default is 0, i.e. start at the beginning. |
An array of BlogEntry objects.
function getEntriesByTag( $taglist, $limit = 0, $match_all = false )
Get a list of entries tagged with a given string.
taglist | An array of tags to search for. |
limit | Maximum number of entries to return. The default is zero, which means return all matching entries. |
match_all | Optional boolean that determines whether the entry must have every tag in taglist to match. The default is false. |
An array of entry objects, in reverse chronological order by post date.
function getArticleList( $number = false, $sticky_only = true )
Get a list of articles with title and permalink.
number | Optional number of articles to return. Default is all. |
sticky_only | Optionally return only “sticky” articles. Default is true. |
A two-dimensional array. The first is numerically indexed. The second is two elements indexed as “title” and “link”. These represent the title of the article and the permalink to it respectively.
function getEntryReplies()
Gets all the replies for all entries belonging to this blog, including all comments, trackbacks, and pingbacks.
An array of objects, including BlogComment, Trackback, and Pingback objects. The sorting of this list is dependent on the data storage implementation for the blog.
function getEntryComments()
Like getEntryReplies, but only returns BlogComments.
function getEntryTrackbacks()
Like getEntryReplies, but only returns Trackbacks.
function getEntryPingbacks()
Like getEntryReplies, but only returns Pingbacks.
function getArticleReplies()
Like getEntryReplies, but returns the replies for all Articles, instead of for all BlogEntries.
function getArticleComments()
Like getArticleReplies, but only returns BlogComments.
function getArticleTrackbacks()
Like getArticleReplies, but only returns Trackbacks.
Like getArticleReplies, but only returns Pingbacks.
function getReplies()
Like getEntryReplies and getArticleReplies, but combines both, returning an array of all replies for this blog.
function getComments()
Like getReplies, but only for comments.
function getTrackbacks()
Like getReplies, but only for comments.
function getPingbacks()
Like getReplies, but only for comments.
function upgradeWrappers ()
This is an upgrade function that will create new config and wrapper scripts to upgrade a directory of blog data to the current version. The data files should always work unmodified, so they do not need to be upgraded. This should not be required too often, if all goes well.
It is assumed that this function will only be run from the package installation directory.
True on success, false on failure.
function fixDirectoryPermissions( $start_dir = false )
A quick utility function to fix the borked permissions from not setting the correct umask when creating directories. This resulted in directories that I couldn’t alter via FTP.
start_dir | The directory to fix. Defaults to the blog root. |
True on success, false otherwise.
function delete ( $keep_history = null )
Removes an existing weblog.
keep_history | If set to true, only delete the blog data file, making this a non-blog directory, rather than totally destroy the data. If not set, defaults to KEEP_EDIT_HISTORY constant. |
True on success, false on failure.
Determines whether the object represents an existing blog.
function isBlog( $blog = false )
Set and return the list of users who can add posts to the blog.
function writers( $list = false )
Read and write a simple text file with the blog metadata.
function readBlogData()
Save the blog data to disk.
function writeBlogData()
Get all blog entries posted between a given range of dates.
function getDateRange( $end_date, $start_date = '' )
Get all the blog entries for a particular day.
function getDay( $year, $month, $day )
Get the number of posts made on a given day.
function getDayCount( $year, $month, $day )
Get a list of all entries for the specified month.
function getMonth( $year = false, $month = false )
Get the number of entries in the given month.
function getMonthCount( $year = false, $month = false )
Like getMonth, except gets entries for an entire year.
function getYear( $year = false )
Get a list of all years in the archive, sorted in reverse chronological order.
function getYearList()
Get a list of the months for the given year.
function getMonthList( $year = false )
Get a list of recent months, starting from the current month and going backward.
function getRecentMonthList( $nummonths = 12 )
Get the URL for the blog homepage.
function getURL( $full_uri = true )
Get the URI of the designated resource.
function uri( $type )
Get the most recent entries across all months and years.
function getRecent( $num_entries = false )
Convenience function to get “previous entries”.
function getNextMax( $num_entries = false )
Scan entries in reverse chronological order, starting at a given offset, and get a given number of them.
function getEntries( $number = -1, $offset = 0 )
Get a list of entries tagged with a given string.
function getEntriesByTag( $taglist, $limit = 0, $match_all = false )
Gets all the current drafts for this blog.
function getDrafts()
Returns a list of all articles, in no particular order.
function getArticles()
Get a list of articles with title and permalink.
function getArticleList( $number = false, $sticky_only = true )
Gets all the replies for all entries belonging to this blog, including all comments, trackbacks, and pingbacks.
function getEntryReplies()
Like getEntryReplies, but only returns BlogComments.
function getEntryComments()
Like getEntryReplies, but only returns Trackbacks.
function getEntryTrackbacks()
Like getEntryReplies, but only returns Pingbacks.
function getEntryPingbacks()
Like getEntryReplies, but returns the replies for all Articles, instead of for all BlogEntries.
function getArticleReplies()
Like getArticleReplies, but only returns BlogComments.
function getArticleComments()
Like getArticleReplies, but only returns Trackbacks.
function getArticleTrackbacks()
Like getEntryReplies and getArticleReplies, but combines both, returning an array of all replies for this blog.
function getReplies()
Like getReplies, but only for comments.
function getComments()
Like getReplies, but only for comments.
function getTrackbacks()
Like getReplies, but only for comments.
function getPingbacks()
Export blog variables to a PHPTemplate class.
function exportVars( & $tpl )
Gets the markup to display for the front page of a weblog.
function getWeblog ()
This is an upgrade function that will create new config and wrapper scripts to upgrade a directory of blog data to the current version.
function upgradeWrappers ()
A quick utility function to fix the borked permissions from not setting the correct umask when creating directories.
function fixDirectoryPermissions( $start_dir = false )
Creates a new weblog.
function insert ( $path = false )
Modify an existing weblog.
function update ()
Removes an existing weblog.
function delete ( $keep_history = null )
Adds any new tags to the list of tags used in the current blog.
function updateTagList( $tags )