pagelib.php

This file is a library of routines that are shared among several pages.  It is in the pages directory rather than the lib directory because the functions here are front-end code, not back-end stuff.  For example, this file contains the shared function for adding a (working) comment form to the page.

Summary
This file is a library of routines that are shared among several pages.
Handles comments posted to an entry.
Handles uploads that are sent when an entry is edited.
Handles pingbacks for an entry.
Sets variables in an entry template for display.
Sets template variables for display of a blog.
Get data from the HTTP POST and put it into the blog object.

Functions

handle_comment

function handle_comment(&$ent,  
$use_comm_link = false)

Handles comments posted to an entry.  This includes generating the form markup, setting appropriate cookies, and actually inserting the new comments.

Parameters

entThe entry we’re dealing with.
use_comm_linkOptional boolean, defaults to false.  If this is set to true, then the page will be redirected to the comments page after a successful comment post.  If not, then the redirect will be to the entry permalink.

Returns

The markup to be inserted into the page for the comment form.

handle_uploads

function handle_uploads(&$ent)

Handles uploads that are sent when an entry is edited.  It checks the file uploads and moves them to the entry directory.

Parameters

entThe entry we’re editing.

Returns

If all uploads are successful, returns true.  Otherwise, returns an array of error messages, one element for each upload error.

handle_pingback_pings

function handle_pingback_pings(&$ent)

Handles pingbacks for an entry.  Sends pingbacks to the appropriate links in the entry body, and returns an error string, if applicable.

Parameters

entThe entry in question.

Returns

An error string.  If there were no errors sending any pingbacks, then the null string is returned.

entry_set_template

function entry_set_template(&$tpl,
&$ent)

Sets variables in an entry template for display.

Parameters

tplThe template to populate.
entthe BlogEntry or Article with which to populate the template.

blog_set_template

function blog_set_template(&$tpl,
&$blog)

Sets template variables for display of a blog.

Parameters

tplThe template to populate.
entthe BlogEntry or Article with which to populate the template.

blog_get_post_data

function blog_get_post_data(&$blog)

Get data from the HTTP POST and put it into the blog object.

Parameters

blogThe blog to populate.
function handle_comment(&$ent,  
$use_comm_link = false)
Handles comments posted to an entry.
function handle_uploads(&$ent)
Handles uploads that are sent when an entry is edited.
function handle_pingback_pings(&$ent)
Handles pingbacks for an entry.
function entry_set_template(&$tpl,
&$ent)
Sets variables in an entry template for display.
function blog_set_template(&$tpl,
&$blog)
Sets template variables for display of a blog.
function blog_get_post_data(&$blog)
Get data from the HTTP POST and put it into the blog object.