2012-05-09 22:26:29 +10:00
|
|
|
<?php
|
|
|
|
|
2016-08-19 10:51:35 +12:00
|
|
|
namespace SilverStripe\Control;
|
|
|
|
|
2016-06-15 16:03:16 +12:00
|
|
|
use SilverStripe\ORM\DataModel;
|
|
|
|
|
2012-05-09 22:26:29 +10:00
|
|
|
/**
|
|
|
|
* A request filter is an object that's executed before and after a
|
|
|
|
* request occurs. By returning 'false' from the preRequest method,
|
|
|
|
* request execution will be stopped from continuing
|
|
|
|
*
|
|
|
|
* @author marcus@silverstripe.com.au
|
|
|
|
* @license BSD License http://silverstripe.org/bsd-license/
|
|
|
|
*/
|
|
|
|
interface RequestFilter {
|
2014-08-15 18:53:05 +12:00
|
|
|
|
2012-05-09 22:26:29 +10:00
|
|
|
/**
|
|
|
|
* Filter executed before a request processes
|
2014-08-15 18:53:05 +12:00
|
|
|
*
|
2016-09-09 18:43:05 +12:00
|
|
|
* @param HTTPRequest $request Request container object
|
2014-03-04 17:43:17 +13:00
|
|
|
* @param Session $session Request session
|
|
|
|
* @param DataModel $model Current DataModel
|
|
|
|
* @return boolean Whether to continue processing other filters. Null or true will continue processing (optional)
|
2012-05-09 22:26:29 +10:00
|
|
|
*/
|
2016-09-09 18:43:05 +12:00
|
|
|
public function preRequest(HTTPRequest $request, Session $session, DataModel $model);
|
2012-05-09 22:26:29 +10:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter executed AFTER a request
|
2014-08-15 18:53:05 +12:00
|
|
|
*
|
2016-09-09 18:43:05 +12:00
|
|
|
* @param HTTPRequest $request Request container object
|
|
|
|
* @param HTTPResponse $response Response output object
|
2014-03-04 17:43:17 +13:00
|
|
|
* @param DataModel $model Current DataModel
|
|
|
|
* @return boolean Whether to continue processing other filters. Null or true will continue processing (optional)
|
2012-05-09 22:26:29 +10:00
|
|
|
*/
|
2016-09-09 18:43:05 +12:00
|
|
|
public function postRequest(HTTPRequest $request, HTTPResponse $response, DataModel $model);
|
2014-03-04 17:43:17 +13:00
|
|
|
}
|