Completed
Branch EDTR/master (50dd13)
by
unknown
25:34 queued 17:04
created

EspressoLegacyAdmin::enqueueLegacyAccountingAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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