Completed
Branch sideload-all-language-files (d12b05)
by
unknown
52:19 queued 43:17
created

DetectFileEditorRequest::isFileEditorRequest()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\services\request\middleware;
4
5
use EventEspresso\core\services\request\RequestInterface;
6
use EventEspresso\core\services\request\ResponseInterface;
7
8
/**
9
 * Class DetectFileEditorRequest
10
 * Detects File Editor requests and executes any logic needing set on those requests.
11
 * ported over from /core/middleware/EE_Detect_File_Editor_Request.core.php
12
 *
13
 * @package EventEspresso\core\services\request\middleware
14
 * @author  Darren Ethier
15
 * @since   4.9.59.p
16
 */
17
class DetectFileEditorRequest extends Middleware
18
{
19
20
    /**
21
     * converts a Request to a Response
22
     *
23
     * @param RequestInterface  $request
24
     * @param ResponseInterface $response
25
     * @return ResponseInterface
26
     */
27
    public function handleRequest(RequestInterface $request, ResponseInterface $response)
28
    {
29
        $this->request  = $request;
30
        $this->response = $response;
31
        // can't store user data during WP error scrapes if no user exists
32
        // so don't load the session since it's not going to work anyways
33
        if ($this->request->isWordPressScrape()) {
34
            add_filter('FHEE_load_EE_Session', '__return_false', 999);
35
        }
36
        $this->response = $this->processRequestStack($this->request, $this->response);
37
        return $this->response;
38
    }
39
}
40