-
Notifications
You must be signed in to change notification settings - Fork 36
/
blog_app_controller.php
78 lines (70 loc) · 2.45 KB
/
blog_app_controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Blog App Controller class file.
*
* The parent class that all the blog plugin controller classes extend from.
* This is used to make functionality that is needed all over the blog
* plugin.
*
* Copyright (c) 2009 Carl Sutton ( dogmatic69 )
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2009 Carl Sutton ( dogmatic69 )
* @link http://www.dogmatic.co.za
* @package blog
* @subpackage blog.controllers.blogAppController
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
class BlogAppController extends AppController
{
/**
* The helpers that the blog plugin needs to function
*/
var $helpers = array(
//cake helpers
'Time', 'Text', 'Form',
//core helpers
'Core.TagCloud',
//plugin helpers
'Blog.Blog', 'Google.Chart',
//layout helpers
'Blog.PostLayout', 'Blog.CommentLayout'
);
/**
* beforeFilter callback
*
* this method is run before any of the controllers in the blog plugin.
* It is used to set up a cache config and some other variables that are
* needed throughout the plugin.
*
* @param nothing
* @return nothing
*/
function beforeFilter()
{
parent::beforeFilter();
$this->set( 'tagCount', ClassRegistry::init( 'Blog.Tag' )->getCount() );
$this->set( 'postDates', ClassRegistry::init( 'Blog.Post' )->getDates() );
$this->set( 'postLatest', ClassRegistry::init( 'Blog.Post' )->getLatest() );
$this->set( 'postPending', ClassRegistry::init( 'Blog.Post' )->getPending() );
$this->set( 'postPopular', ClassRegistry::init( 'Blog.Post' )->getPopular() );
$this->set( 'commentCount', ClassRegistry::init( 'Core.Comment' )->getCounts( 'Blog.Post' ) );
}
/**
* afterFilter callback.
*
* used to do stuff before the code is rendered but after all the
* controllers have finnished.
*
* @param nothing
* @return nothing
*/
function afterFilter()
{
parent::afterFilter();
}
}
?>