2012-05-09 14:26:29 +02:00
|
|
|
<?php
|
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
namespace SilverStripe\Control;
|
|
|
|
|
2016-06-15 06:03:16 +02:00
|
|
|
use SilverStripe\ORM\DataModel;
|
|
|
|
|
2012-05-09 14:26:29 +02: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 08:53:05 +02:00
|
|
|
|
2012-05-09 14:26:29 +02:00
|
|
|
/**
|
|
|
|
* Filter executed before a request processes
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2016-09-09 08:43:05 +02:00
|
|
|
* @param HTTPRequest $request Request container object
|
2014-03-04 05:43:17 +01: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 14:26:29 +02:00
|
|
|
*/
|
2016-09-09 08:43:05 +02:00
|
|
|
public function preRequest(HTTPRequest $request, Session $session, DataModel $model);
|
2012-05-09 14:26:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter executed AFTER a request
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2016-09-09 08:43:05 +02:00
|
|
|
* @param HTTPRequest $request Request container object
|
|
|
|
* @param HTTPResponse $response Response output object
|
2014-03-04 05:43:17 +01:00
|
|
|
* @param DataModel $model Current DataModel
|
|
|
|
* @return boolean Whether to continue processing other filters. Null or true will continue processing (optional)
|
2012-05-09 14:26:29 +02:00
|
|
|
*/
|
2016-09-09 08:43:05 +02:00
|
|
|
public function postRequest(HTTPRequest $request, HTTPResponse $response, DataModel $model);
|
2014-03-04 05:43:17 +01:00
|
|
|
}
|