silverstripe-framework/control/RequestProcessor.php
Damian Mooyman 0433ba1642 BUG Revert some changes to ManyManyList
BUG Fix incompatibility in Member_GroupList
Fix regressions in merges from 3.1
BUG Fix Security failing on test classes
BUG Fix postgresql compatibility
Clarify sql encoding of table names
2014-07-23 12:38:41 +12:00

48 lines
1.0 KiB
PHP

<?php
/**
* Represents a request processer that delegates pre and post request handling to nested request filters
*
* @package framework
* @subpackage control
*/
class RequestProcessor implements RequestFilter {
/**
* List of currently assigned request filters
*
* @var array
*/
private $filters = array();
public function __construct($filters = array()) {
$this->filters = $filters;
}
/**
* Assign a list of request filters
*
* @param array $filters
*/
public function setFilters($filters) {
$this->filters = $filters;
}
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) {
foreach ($this->filters as $filter) {
$res = $filter->preRequest($request, $session, $model);
if ($res === false) {
return false;
}
}
}
public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model) {
foreach ($this->filters as $filter) {
$res = $filter->postRequest($request, $response, $model);
if ($res === false) {
return false;
}
}
}
}