1 | <?php |
||
27 | class ServeController extends AppController |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * Components used by this controller. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | public $components = [ |
||
36 | 'Comment.Comment', |
||
37 | 'Paginator', |
||
38 | 'RequestHandler', |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * An array containing the names of helpers controllers uses. |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | public $helpers = ['Time', 'Paginator']; |
||
47 | |||
48 | /** |
||
49 | * Paginator settings. |
||
50 | * |
||
51 | * Used by `search()` and `rss()`. |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | public $paginate = [ |
||
56 | 'limit' => 10, |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * Redirects to ServeController::home() |
||
61 | * |
||
62 | * @return void |
||
63 | */ |
||
64 | public function index() |
||
68 | |||
69 | /** |
||
70 | * Site's home page. |
||
71 | * |
||
72 | * Gets a list of all promoted contents, so themes may render them in their |
||
73 | * front-page layout. The view-variable `contents` holds all promoted contents, |
||
74 | * themes might render this contents using this variable. |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | public function home() |
||
94 | |||
95 | /** |
||
96 | * Content's detail page. |
||
97 | * |
||
98 | * @param string $contentTypeSlug Content's type-slug. e.g. `article`, `basic-page` |
||
99 | * @param string $contentSlug Content's slug. e.g. `this-is-an-article` |
||
100 | * @return \Cake\Network\Response|null |
||
101 | * @throws \Content\Error\ContentNotFoundException When content is not found |
||
102 | * @throws \Cake\Network\Exception\ForbiddenException When user can't access |
||
103 | * this content due to role restrictions |
||
104 | */ |
||
105 | public function details($contentTypeSlug, $contentSlug) |
||
146 | |||
147 | /** |
||
148 | * Contents search engine page. |
||
149 | * |
||
150 | * @param string $criteria A search criteria. e.g.: `"this phrase" -"but not this" OR -hello` |
||
151 | * @return void |
||
152 | */ |
||
153 | public function search($criteria) |
||
179 | |||
180 | /** |
||
181 | * RSS feeder. |
||
182 | * |
||
183 | * Similar to `ServeController::search()` but it uses `rss` layout instead of |
||
184 | * default layout. |
||
185 | * |
||
186 | * @param string $criteria A search criteria. e.g.: `"this phrase" -"but not this" OR -hello` |
||
187 | * @return void |
||
188 | */ |
||
189 | public function rss($criteria) |
||
206 | |||
207 | /** |
||
208 | * Calculates the URL to which visitor should be redirected according to |
||
209 | * content's & visitor's language. |
||
210 | * |
||
211 | * @param \Cake\Datasource\EntityInterface $content Content to inspect |
||
212 | * @return string Redirection URL, empty on error |
||
213 | */ |
||
214 | protected function _calculateRedirection(EntityInterface $content) |
||
223 | } |
||
224 |