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. |
public function isBlog( |
| ) |
Determines whether the object represents an existing blog.
True if the blog metadata exists, false otherwise.
public function writers( |
| ) |
Set and return the list of users who can add posts to the blog.
list | an arrays or comma-delimited stringof user names. |
An array of user names.
Read and write a simple text file with the blog metadata. Format is key = data, each record is a single line, unrecognized keys are ignored. This is for internal use only.
Save the blog data to disk. This is for internal use only.
False on failure, something else on success.
public function getDay( |
| ) |
Get all the blog entries for a particular day.
year | The year you want. |
month | The month you want. |
day | The day you want. |
An array of BlogEntry objects posted on the given date, sorted in reverse chronological order by post time.
public function getDayCount( |
| ) |
Get the number of posts made on a given day.
year | The 4 digit year of the post. |
month | The month of the post. |
day | The day of the post. |
An integer representing how many posts were made that day.
public function getMonth( |
| ) |
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 | The year you want. |
month | The month you want. |
An array of BlogEntry objects posted in the given month, sorted in reverse chronological order by post date.
public function getYear( |
| ) |
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.
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.
public function getMonthList( |
| ) |
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.
public function getRecentMonthList( |
| ) |
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.
public function getURL( |
| ) |
Get the URL for the blog homepage.
full_uri | Optional boolean for whether or not to return a full URI or a root-relative one. Default is true. |
A string holding the URI to the blog root directory.
public function uri( |
| ) |
Get the URI of the designated resource.
type | The type of URI to get, e.g. permalink, edit link, etc. |
params | 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.
public function getRecent( |
| ) |
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.
public function getNextMax( |
| ) |
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.
public function getEntries( |
| ) |
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.
public function getEntriesByTag( |
| ) |
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.
Gets all the current drafts for this blog.
An array of BlogEntry objects.
public function getArticles( |
| ) |
Returns a list of all articles, in no particular order.
number | Optional number of articles to return. Default is all. |
An array of Article objects.
public function getArticleList( |
| ) |
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.
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.
Like getEntryReplies, but only returns BlogComments.
Like getEntryReplies, but only returns Trackbacks.
Like getEntryReplies, but only returns Pingbacks.
Like getEntryReplies, but returns the replies for all Articles, instead of for all BlogEntries.
Like getArticleReplies, but only returns BlogComments.
Like getArticleReplies, but only returns Trackbacks.
Like getArticleReplies, but only returns Pingbacks.
Like getEntryReplies and getArticleReplies, but combines both, returning an array of all replies for this blog.
Determine if pingbacks are on by default.
Get a list of files attached to this blog.
Returns: Array of AttachedFile objects
public function addAttachment( |
| ) |
Add an attached file to the blog.
path | The local file path to the file to attach. |
name | Optional name of the file. Default is the existing name. |
public function removeAttachment( |
| ) |
Remove a file that is attached to the blog.
name | The name of the file to remove. |
Get a list of system files that are managed by the blog and are therefore excluded from uploads.
Returns: An array of file names.
public function exportVars( |
| ) |
Export blog variables to a PHPTemplate class. This is for internal use only.
tpl | The PHPTemplate to populate. |
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 will only be modified if required. Copies of the old
It is assumed that this function will only be run from the package installation directory.
True on success, false on failure.
public function fixDirectoryPermissions( |
| ) |
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.
public function insert( |
| ) |
Creates a new weblog.
path | The path to the blog root. Defaults to the current directory. |
True on success, false otherwise.
Modify an existing weblog.
True on success, false otherwise.
public function delete( |
| ) |
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.
public function updateTagList( |
| ) |
Adds any new tags to the list of tags used in the current blog.
tags | An array of strings holding the tags to be added. Duplicates are removed. |
True on success, false on failure.