Completed
Branch EDTR/master (810f49)
by
unknown
28:59 queued 20:31
created

EspressoLegacyAdmin::requestHandler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\routing\handlers\admin;
4
5
use EE_Dependency_Map;
6
use EventEspresso\core\domain\entities\routing\handlers\Route;
7
8
/**
9
 * Class EspressoLegacyAdmin
10
 * detects and executes logic that is common for all Event Espresso admin routes
11
 *
12
 * @package EventEspresso\core\domain\entities\routing\handlers\admin
13
 * @author  Brent Christensen
14
 * @since   \$VID:$
15
 */
16
class EspressoLegacyAdmin extends Route
17
{
18
19
    /**
20
     * returns true if the current request matches this route
21
     *
22
     * @return bool
23
     * @since   $VID:$
24
     */
25
    public function matchesCurrentRequest()
26
    {
27
        return $this->request->isAdmin() || $this->request->isAdminAjax();
28
    }
29
30
31
    /**
32
     * @since $VID:$
33
     */
34
    protected function registerDependencies()
35
    {
36
        $this->dependency_map->registerDependencies(
37
            'EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager',
38
            [
39
                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
40
                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
41
                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
42
            ]
43
        );
44
        $this->dependency_map->registerDependencies(
45
            'EE_Admin_Transactions_List_Table',
46
            [
47
                null,
48
                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
49
            ]
50
        );
51
        $this->dependency_map->registerDependencies(
52
            'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings',
53
            ['EE_Registration_Config' => EE_Dependency_Map::load_from_cache]
54
        );
55
        $this->dependency_map->registerDependencies(
56
            'EventEspresso\admin_pages\general_settings\OrganizationSettings',
57
            [
58
                'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
59
                'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
60
                'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
61
                'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
62
                'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
63
            ]
64
        );
65
        $this->dependency_map->registerDependencies(
66
            'EventEspresso\core\services\address\CountrySubRegionDao',
67
            [
68
                'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
69
                'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache
70
            ]
71
        );
72
        $this->dependency_map->registerDependencies(
73
            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder',
74
            [
75
                null,
76
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
77
                'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
78
            ]
79
        );
80
        $this->dependency_map->registerDependencies(
81
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader',
82
            [
83
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
84
                'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
85
            ]
86
        );
87
        $this->dependency_map->registerDependencies(
88
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader',
89
            [
90
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
91
                'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
92
            ]
93
        );
94
        $this->dependency_map->registerDependencies(
95
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader',
96
            [
97
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
98
                'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
99
            ]
100
        );
101
        $this->dependency_map->registerDependencies(
102
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader',
103
            [
104
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
105
                'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
106
            ]
107
        );
108
    }
109
110
111
    /**
112
     * implements logic required to run during request
113
     *
114
     * @return bool
115
     * @since   $VID:$
116
     */
117
    protected function requestHandler()
118
    {
119
        do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
120
        $this->loader->getShared('EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager');
121
        $this->loader->getShared('EE_Admin');
122
        return true;
123
    }
124
}
125