diff --git a/code/BlogEntry.php b/code/BlogEntry.php index df442ea..a7596c0 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -1,5 +1,12 @@ Tags)); @@ -77,11 +87,16 @@ class BlogEntry extends Page { } } - + /** + * Get the sidebar + */ function SideBar() { return $this->getParent()->SideBar(); } + /** + * Get a bbcode parsed summary of the blog entry + */ function ParagraphSummary(){ $content = new Text('Content'); $content->value = Convert::raw2xml($this->Content); @@ -89,6 +104,9 @@ class BlogEntry extends Page { return $parser->parse(); } + /** + * Get the bbcode parsed content + */ function ParsedContent() { $parser = new BBCodeParser($this->Content); $content = new Text('Content'); @@ -96,6 +114,9 @@ class BlogEntry extends Page { return $content; } + /** + * Link for editing this blog entry + */ function EditURL(){ return $this->getParent()->Link('post')."/".$this->ID."/"; } @@ -108,6 +129,9 @@ class BlogEntry_Controller extends Page_Controller { Requirements::themedCSS("blog"); } + /** + * Gets a link to unpublish the blog entry + */ function unpublishPost(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 7c03bfa..c506f96 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -1,5 +1,13 @@ ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$start, $limit"); } + /** + * Only display the blog entries that have the specified tag + */ function Tag() { return isset($_GET['tag']) ? $_GET['tag'] : false; } + /** + * A simple form for creating blog entries + */ function BlogEntryForm(){ Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); @@ -101,14 +118,23 @@ class BlogHolder extends Page { return $form; } + /** + * Check if url has "/post" + */ function isPost(){ return Director::urlParam('Action') == 'post'; } + /** + * Link for creating a new blog entry + */ function postURL(){ return $this->Link('post'); } + /** + * Create default blog setup + */ function requireDefaultRecords() { parent::requireDefaultRecords(); @@ -157,8 +183,7 @@ class BlogHolder extends Page { class BlogHolder_Controller extends Page_Controller { function init() { - parent::init(); - + parent::init(); // This will create a tag point to the RSS feed RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog"); Requirements::themedCSS("blog"); @@ -166,6 +191,9 @@ class BlogHolder_Controller extends Page_Controller { } + /** + * Get the archived blogs for a particular month or year, in the format /year/month/ eg: /2008/10/ + */ function showarchive() { $month = addslashes($this->urlParams['ID']); return array( @@ -183,16 +211,25 @@ class BlogHolder_Controller extends Page_Controller { return $output; } + /** + * Get the rss fee for this blog holder's entries + */ function rss() { global $project; $rss = new RSSFeed($this->Children(), $this->Link(), $project . " blog", "", "Title", "ParsedContent"); $rss->outputToBrowser(); } + /** + * Return list of usable tags for help + */ function BBTags() { return BBCodeParser::usable_tags(); } + /** + * Post a new blog entry + */ function post(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, @@ -212,7 +249,9 @@ class BlogHolder_Controller extends Page_Controller { } - +/** + * Blog entry form + */ class BlogEntry_Form extends Form { function postblog($data) { Cookie::set("BlogHolder_Name", $data['Author']);