@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * @return GraphQLFieldInterface[] |
|
| 39 | + * @return GraphQLField[] |
|
| 40 | 40 | * @since $VID:$ |
| 41 | 41 | */ |
| 42 | 42 | public function getFields() |
@@ -21,182 +21,182 @@ |
||
| 21 | 21 | class Venue extends TypeBase |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Venue constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Venue $venue_model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Venue $venue_model) |
|
| 30 | - { |
|
| 31 | - $this->model = $venue_model; |
|
| 32 | - $this->setName('Venue'); |
|
| 33 | - $this->setIsCustomPostType(true); |
|
| 34 | - parent::__construct(); |
|
| 35 | - } |
|
| 24 | + /** |
|
| 25 | + * Venue constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Venue $venue_model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Venue $venue_model) |
|
| 30 | + { |
|
| 31 | + $this->model = $venue_model; |
|
| 32 | + $this->setName('Venue'); |
|
| 33 | + $this->setIsCustomPostType(true); |
|
| 34 | + parent::__construct(); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return GraphQLFieldInterface[] |
|
| 40 | - * @since $VID:$ |
|
| 41 | - */ |
|
| 42 | - public function getFields() |
|
| 43 | - { |
|
| 44 | - return [ |
|
| 45 | - new GraphQLField( |
|
| 46 | - 'name', |
|
| 47 | - 'String', |
|
| 48 | - 'name', |
|
| 49 | - esc_html__('Venue Name', 'event_espresso') |
|
| 50 | - ), |
|
| 51 | - new GraphQLField( |
|
| 52 | - 'desc', |
|
| 53 | - 'String', |
|
| 54 | - 'description', |
|
| 55 | - esc_html__('Venue Description', 'event_espresso') |
|
| 56 | - ), |
|
| 57 | - new GraphQLField( |
|
| 58 | - 'shortDesc', |
|
| 59 | - 'String', |
|
| 60 | - 'excerpt', |
|
| 61 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
| 62 | - ), |
|
| 63 | - new GraphQLField( |
|
| 64 | - 'identifier', |
|
| 65 | - 'String', |
|
| 66 | - 'identifier', |
|
| 67 | - esc_html__('Venue Identifier', 'event_espresso') |
|
| 68 | - ), |
|
| 69 | - new GraphQLField( |
|
| 70 | - 'created', |
|
| 71 | - 'String', |
|
| 72 | - 'created', |
|
| 73 | - esc_html__('Date Venue Created', 'event_espresso') |
|
| 74 | - ), |
|
| 75 | - new GraphQLField( |
|
| 76 | - 'order', |
|
| 77 | - 'Int', |
|
| 78 | - 'order', |
|
| 79 | - esc_html__('Venue order', 'event_espresso') |
|
| 80 | - ), |
|
| 81 | - new GraphQLOutputField( |
|
| 82 | - 'wpUser', |
|
| 83 | - 'User', |
|
| 84 | - null, |
|
| 85 | - esc_html__('Venue Creator', 'event_espresso') |
|
| 86 | - ), |
|
| 87 | - new GraphQLInputField( |
|
| 88 | - 'wpUser', |
|
| 89 | - 'Int', |
|
| 90 | - null, |
|
| 91 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
| 92 | - ), |
|
| 93 | - new GraphQLField( |
|
| 94 | - 'address', |
|
| 95 | - 'String', |
|
| 96 | - 'address', |
|
| 97 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
| 98 | - ), |
|
| 99 | - new GraphQLField( |
|
| 100 | - 'address2', |
|
| 101 | - 'String', |
|
| 102 | - 'address2', |
|
| 103 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
| 104 | - ), |
|
| 105 | - new GraphQLField( |
|
| 106 | - 'city', |
|
| 107 | - 'String', |
|
| 108 | - 'city', |
|
| 109 | - esc_html__('Venue City', 'event_espresso') |
|
| 110 | - ), |
|
| 111 | - new GraphQLOutputField( |
|
| 112 | - 'state', |
|
| 113 | - 'State', |
|
| 114 | - null, |
|
| 115 | - esc_html__('Venue state', 'event_espresso') |
|
| 116 | - ), |
|
| 117 | - new GraphQLInputField( |
|
| 118 | - 'state', |
|
| 119 | - 'Int', |
|
| 120 | - null, |
|
| 121 | - esc_html__('State ID', 'event_espresso') |
|
| 122 | - ), |
|
| 123 | - new GraphQLOutputField( |
|
| 124 | - 'country', |
|
| 125 | - 'Country', |
|
| 126 | - null, |
|
| 127 | - esc_html__('Venue country', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLInputField( |
|
| 130 | - 'country', |
|
| 131 | - 'String', |
|
| 132 | - null, |
|
| 133 | - esc_html__('Country ISO Code', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLField( |
|
| 136 | - 'zip', |
|
| 137 | - 'String', |
|
| 138 | - 'zip', |
|
| 139 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
| 140 | - ), |
|
| 141 | - new GraphQLField( |
|
| 142 | - 'capacity', |
|
| 143 | - 'Int', |
|
| 144 | - 'capacity', |
|
| 145 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
| 146 | - [$this, 'parseInfiniteValue'] |
|
| 147 | - ), |
|
| 148 | - new GraphQLField( |
|
| 149 | - 'phone', |
|
| 150 | - 'String', |
|
| 151 | - 'phone', |
|
| 152 | - esc_html__('Venue Phone', 'event_espresso') |
|
| 153 | - ), |
|
| 154 | - new GraphQLField( |
|
| 155 | - 'virtualPhone', |
|
| 156 | - 'String', |
|
| 157 | - 'virtual_phone', |
|
| 158 | - esc_html__('Call in Number', 'event_espresso') |
|
| 159 | - ), |
|
| 160 | - new GraphQLField( |
|
| 161 | - 'url', |
|
| 162 | - 'String', |
|
| 163 | - 'venue_url', |
|
| 164 | - esc_html__('Venue Website', 'event_espresso') |
|
| 165 | - ), |
|
| 166 | - new GraphQLField( |
|
| 167 | - 'virtualUrl', |
|
| 168 | - 'String', |
|
| 169 | - 'virtual_url', |
|
| 170 | - esc_html__('Virtual URL', 'event_espresso') |
|
| 171 | - ), |
|
| 172 | - new GraphQLField( |
|
| 173 | - 'googleMapLink', |
|
| 174 | - 'String', |
|
| 175 | - 'google_map_link', |
|
| 176 | - esc_html__('Google Map Link', 'event_espresso') |
|
| 177 | - ), |
|
| 178 | - new GraphQLField( |
|
| 179 | - 'enableForGmap', |
|
| 180 | - 'String', |
|
| 181 | - 'enable_for_gmap', |
|
| 182 | - esc_html__('Show Google Map?', 'event_espresso') |
|
| 183 | - ), |
|
| 184 | - ]; |
|
| 185 | - } |
|
| 38 | + /** |
|
| 39 | + * @return GraphQLFieldInterface[] |
|
| 40 | + * @since $VID:$ |
|
| 41 | + */ |
|
| 42 | + public function getFields() |
|
| 43 | + { |
|
| 44 | + return [ |
|
| 45 | + new GraphQLField( |
|
| 46 | + 'name', |
|
| 47 | + 'String', |
|
| 48 | + 'name', |
|
| 49 | + esc_html__('Venue Name', 'event_espresso') |
|
| 50 | + ), |
|
| 51 | + new GraphQLField( |
|
| 52 | + 'desc', |
|
| 53 | + 'String', |
|
| 54 | + 'description', |
|
| 55 | + esc_html__('Venue Description', 'event_espresso') |
|
| 56 | + ), |
|
| 57 | + new GraphQLField( |
|
| 58 | + 'shortDesc', |
|
| 59 | + 'String', |
|
| 60 | + 'excerpt', |
|
| 61 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
| 62 | + ), |
|
| 63 | + new GraphQLField( |
|
| 64 | + 'identifier', |
|
| 65 | + 'String', |
|
| 66 | + 'identifier', |
|
| 67 | + esc_html__('Venue Identifier', 'event_espresso') |
|
| 68 | + ), |
|
| 69 | + new GraphQLField( |
|
| 70 | + 'created', |
|
| 71 | + 'String', |
|
| 72 | + 'created', |
|
| 73 | + esc_html__('Date Venue Created', 'event_espresso') |
|
| 74 | + ), |
|
| 75 | + new GraphQLField( |
|
| 76 | + 'order', |
|
| 77 | + 'Int', |
|
| 78 | + 'order', |
|
| 79 | + esc_html__('Venue order', 'event_espresso') |
|
| 80 | + ), |
|
| 81 | + new GraphQLOutputField( |
|
| 82 | + 'wpUser', |
|
| 83 | + 'User', |
|
| 84 | + null, |
|
| 85 | + esc_html__('Venue Creator', 'event_espresso') |
|
| 86 | + ), |
|
| 87 | + new GraphQLInputField( |
|
| 88 | + 'wpUser', |
|
| 89 | + 'Int', |
|
| 90 | + null, |
|
| 91 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
| 92 | + ), |
|
| 93 | + new GraphQLField( |
|
| 94 | + 'address', |
|
| 95 | + 'String', |
|
| 96 | + 'address', |
|
| 97 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
| 98 | + ), |
|
| 99 | + new GraphQLField( |
|
| 100 | + 'address2', |
|
| 101 | + 'String', |
|
| 102 | + 'address2', |
|
| 103 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
| 104 | + ), |
|
| 105 | + new GraphQLField( |
|
| 106 | + 'city', |
|
| 107 | + 'String', |
|
| 108 | + 'city', |
|
| 109 | + esc_html__('Venue City', 'event_espresso') |
|
| 110 | + ), |
|
| 111 | + new GraphQLOutputField( |
|
| 112 | + 'state', |
|
| 113 | + 'State', |
|
| 114 | + null, |
|
| 115 | + esc_html__('Venue state', 'event_espresso') |
|
| 116 | + ), |
|
| 117 | + new GraphQLInputField( |
|
| 118 | + 'state', |
|
| 119 | + 'Int', |
|
| 120 | + null, |
|
| 121 | + esc_html__('State ID', 'event_espresso') |
|
| 122 | + ), |
|
| 123 | + new GraphQLOutputField( |
|
| 124 | + 'country', |
|
| 125 | + 'Country', |
|
| 126 | + null, |
|
| 127 | + esc_html__('Venue country', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLInputField( |
|
| 130 | + 'country', |
|
| 131 | + 'String', |
|
| 132 | + null, |
|
| 133 | + esc_html__('Country ISO Code', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLField( |
|
| 136 | + 'zip', |
|
| 137 | + 'String', |
|
| 138 | + 'zip', |
|
| 139 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
| 140 | + ), |
|
| 141 | + new GraphQLField( |
|
| 142 | + 'capacity', |
|
| 143 | + 'Int', |
|
| 144 | + 'capacity', |
|
| 145 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
| 146 | + [$this, 'parseInfiniteValue'] |
|
| 147 | + ), |
|
| 148 | + new GraphQLField( |
|
| 149 | + 'phone', |
|
| 150 | + 'String', |
|
| 151 | + 'phone', |
|
| 152 | + esc_html__('Venue Phone', 'event_espresso') |
|
| 153 | + ), |
|
| 154 | + new GraphQLField( |
|
| 155 | + 'virtualPhone', |
|
| 156 | + 'String', |
|
| 157 | + 'virtual_phone', |
|
| 158 | + esc_html__('Call in Number', 'event_espresso') |
|
| 159 | + ), |
|
| 160 | + new GraphQLField( |
|
| 161 | + 'url', |
|
| 162 | + 'String', |
|
| 163 | + 'venue_url', |
|
| 164 | + esc_html__('Venue Website', 'event_espresso') |
|
| 165 | + ), |
|
| 166 | + new GraphQLField( |
|
| 167 | + 'virtualUrl', |
|
| 168 | + 'String', |
|
| 169 | + 'virtual_url', |
|
| 170 | + esc_html__('Virtual URL', 'event_espresso') |
|
| 171 | + ), |
|
| 172 | + new GraphQLField( |
|
| 173 | + 'googleMapLink', |
|
| 174 | + 'String', |
|
| 175 | + 'google_map_link', |
|
| 176 | + esc_html__('Google Map Link', 'event_espresso') |
|
| 177 | + ), |
|
| 178 | + new GraphQLField( |
|
| 179 | + 'enableForGmap', |
|
| 180 | + 'String', |
|
| 181 | + 'enable_for_gmap', |
|
| 182 | + esc_html__('Show Google Map?', 'event_espresso') |
|
| 183 | + ), |
|
| 184 | + ]; |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Extends the existing WP GraphQL mutations. |
|
| 190 | - * |
|
| 191 | - * @since $VID:$ |
|
| 192 | - */ |
|
| 193 | - public function extendMutations() |
|
| 194 | - { |
|
| 195 | - add_action( |
|
| 196 | - 'graphql_post_object_mutation_update_additional_data', |
|
| 197 | - VenueUpdate::mutateFields($this->model, $this), |
|
| 198 | - 10, |
|
| 199 | - 6 |
|
| 200 | - ); |
|
| 201 | - } |
|
| 188 | + /** |
|
| 189 | + * Extends the existing WP GraphQL mutations. |
|
| 190 | + * |
|
| 191 | + * @since $VID:$ |
|
| 192 | + */ |
|
| 193 | + public function extendMutations() |
|
| 194 | + { |
|
| 195 | + add_action( |
|
| 196 | + 'graphql_post_object_mutation_update_additional_data', |
|
| 197 | + VenueUpdate::mutateFields($this->model, $this), |
|
| 198 | + 10, |
|
| 199 | + 6 |
|
| 200 | + ); |
|
| 201 | + } |
|
| 202 | 202 | } |
@@ -20,65 +20,65 @@ |
||
| 20 | 20 | class State extends TypeBase |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * State constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_State $state_model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_State $state_model) |
|
| 29 | - { |
|
| 30 | - $this->model = $state_model; |
|
| 31 | - $this->setName('State'); |
|
| 32 | - $this->setDescription(__('A state', 'event_espresso')); |
|
| 33 | - $this->setIsCustomPostType(false); |
|
| 23 | + /** |
|
| 24 | + * State constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_State $state_model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_State $state_model) |
|
| 29 | + { |
|
| 30 | + $this->model = $state_model; |
|
| 31 | + $this->setName('State'); |
|
| 32 | + $this->setDescription(__('A state', 'event_espresso')); |
|
| 33 | + $this->setIsCustomPostType(false); |
|
| 34 | 34 | |
| 35 | - parent::__construct(); |
|
| 36 | - } |
|
| 35 | + parent::__construct(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return GraphQLFieldInterface[] |
|
| 41 | - * @since $VID:$ |
|
| 42 | - */ |
|
| 43 | - public function getFields() |
|
| 44 | - { |
|
| 45 | - return [ |
|
| 46 | - new GraphQLField( |
|
| 47 | - 'id', |
|
| 48 | - ['non_null' => 'Int'], |
|
| 49 | - 'ID', |
|
| 50 | - esc_html__('State ID', 'event_espresso') |
|
| 51 | - ), |
|
| 52 | - new GraphQLField( |
|
| 53 | - 'abbreviation', |
|
| 54 | - 'String', |
|
| 55 | - 'abbrev', |
|
| 56 | - esc_html__('State Abbreviation', 'event_espresso') |
|
| 57 | - ), |
|
| 58 | - new GraphQLField( |
|
| 59 | - 'name', |
|
| 60 | - 'String', |
|
| 61 | - 'name', |
|
| 62 | - esc_html__('State Name', 'event_espresso') |
|
| 63 | - ), |
|
| 64 | - new GraphQLField( |
|
| 65 | - 'isActive', |
|
| 66 | - 'Boolean', |
|
| 67 | - 'active', |
|
| 68 | - esc_html__('State Active Flag', 'event_espresso') |
|
| 69 | - ), |
|
| 70 | - new GraphQLOutputField( |
|
| 71 | - 'country', |
|
| 72 | - 'Country', |
|
| 73 | - null, |
|
| 74 | - esc_html__('Country for the state', 'event_espresso') |
|
| 75 | - ), |
|
| 76 | - new GraphQLInputField( |
|
| 77 | - 'country', |
|
| 78 | - 'String', |
|
| 79 | - null, |
|
| 80 | - esc_html__('Country ISO Code', 'event_espresso') |
|
| 81 | - ), |
|
| 82 | - ]; |
|
| 83 | - } |
|
| 39 | + /** |
|
| 40 | + * @return GraphQLFieldInterface[] |
|
| 41 | + * @since $VID:$ |
|
| 42 | + */ |
|
| 43 | + public function getFields() |
|
| 44 | + { |
|
| 45 | + return [ |
|
| 46 | + new GraphQLField( |
|
| 47 | + 'id', |
|
| 48 | + ['non_null' => 'Int'], |
|
| 49 | + 'ID', |
|
| 50 | + esc_html__('State ID', 'event_espresso') |
|
| 51 | + ), |
|
| 52 | + new GraphQLField( |
|
| 53 | + 'abbreviation', |
|
| 54 | + 'String', |
|
| 55 | + 'abbrev', |
|
| 56 | + esc_html__('State Abbreviation', 'event_espresso') |
|
| 57 | + ), |
|
| 58 | + new GraphQLField( |
|
| 59 | + 'name', |
|
| 60 | + 'String', |
|
| 61 | + 'name', |
|
| 62 | + esc_html__('State Name', 'event_espresso') |
|
| 63 | + ), |
|
| 64 | + new GraphQLField( |
|
| 65 | + 'isActive', |
|
| 66 | + 'Boolean', |
|
| 67 | + 'active', |
|
| 68 | + esc_html__('State Active Flag', 'event_espresso') |
|
| 69 | + ), |
|
| 70 | + new GraphQLOutputField( |
|
| 71 | + 'country', |
|
| 72 | + 'Country', |
|
| 73 | + null, |
|
| 74 | + esc_html__('Country for the state', 'event_espresso') |
|
| 75 | + ), |
|
| 76 | + new GraphQLInputField( |
|
| 77 | + 'country', |
|
| 78 | + 'String', |
|
| 79 | + null, |
|
| 80 | + esc_html__('Country ISO Code', 'event_espresso') |
|
| 81 | + ), |
|
| 82 | + ]; |
|
| 83 | + } |
|
| 84 | 84 | } |
@@ -17,1393 +17,1393 @@ |
||
| 17 | 17 | class Extend_Events_Admin_Page extends Events_Admin_Page |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var AdvancedEditorAdminFormSection |
|
| 22 | - */ |
|
| 23 | - protected $advanced_editor_admin_form; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var AdvancedEditorEntityData |
|
| 27 | - */ |
|
| 28 | - protected $advanced_editor_data; |
|
| 29 | - |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Extend_Events_Admin_Page constructor. |
|
| 33 | - * |
|
| 34 | - * @param bool $routing |
|
| 35 | - * @throws EE_Error |
|
| 36 | - * @throws InvalidArgumentException |
|
| 37 | - * @throws InvalidDataTypeException |
|
| 38 | - * @throws InvalidInterfaceException |
|
| 39 | - * @throws ReflectionException |
|
| 40 | - */ |
|
| 41 | - public function __construct($routing = true) |
|
| 42 | - { |
|
| 43 | - if (! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
| 44 | - define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
| 45 | - define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
| 46 | - define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
| 47 | - } |
|
| 48 | - parent::__construct($routing); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Sets routes. |
|
| 54 | - * |
|
| 55 | - * @throws EE_Error |
|
| 56 | - * @throws InvalidArgumentException |
|
| 57 | - * @throws InvalidDataTypeException |
|
| 58 | - * @throws InvalidInterfaceException |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - protected function _extend_page_config() |
|
| 62 | - { |
|
| 63 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
| 64 | - // is there a evt_id in the request? |
|
| 65 | - $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
| 66 | - ? $this->_req_data['EVT_ID'] |
|
| 67 | - : 0; |
|
| 68 | - $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
| 69 | - // tkt_id? |
|
| 70 | - $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
| 71 | - ? $this->_req_data['TKT_ID'] |
|
| 72 | - : 0; |
|
| 73 | - $new_page_routes = array( |
|
| 74 | - 'duplicate_event' => array( |
|
| 75 | - 'func' => '_duplicate_event', |
|
| 76 | - 'capability' => 'ee_edit_event', |
|
| 77 | - 'obj_id' => $evt_id, |
|
| 78 | - 'noheader' => true, |
|
| 79 | - ), |
|
| 80 | - 'ticket_list_table' => array( |
|
| 81 | - 'func' => '_tickets_overview_list_table', |
|
| 82 | - 'capability' => 'ee_read_default_tickets', |
|
| 83 | - ), |
|
| 84 | - 'trash_ticket' => array( |
|
| 85 | - 'func' => '_trash_or_restore_ticket', |
|
| 86 | - 'capability' => 'ee_delete_default_ticket', |
|
| 87 | - 'obj_id' => $tkt_id, |
|
| 88 | - 'noheader' => true, |
|
| 89 | - 'args' => array('trash' => true), |
|
| 90 | - ), |
|
| 91 | - 'trash_tickets' => array( |
|
| 92 | - 'func' => '_trash_or_restore_ticket', |
|
| 93 | - 'capability' => 'ee_delete_default_tickets', |
|
| 94 | - 'noheader' => true, |
|
| 95 | - 'args' => array('trash' => true), |
|
| 96 | - ), |
|
| 97 | - 'restore_ticket' => array( |
|
| 98 | - 'func' => '_trash_or_restore_ticket', |
|
| 99 | - 'capability' => 'ee_delete_default_ticket', |
|
| 100 | - 'obj_id' => $tkt_id, |
|
| 101 | - 'noheader' => true, |
|
| 102 | - ), |
|
| 103 | - 'restore_tickets' => array( |
|
| 104 | - 'func' => '_trash_or_restore_ticket', |
|
| 105 | - 'capability' => 'ee_delete_default_tickets', |
|
| 106 | - 'noheader' => true, |
|
| 107 | - ), |
|
| 108 | - 'delete_ticket' => array( |
|
| 109 | - 'func' => '_delete_ticket', |
|
| 110 | - 'capability' => 'ee_delete_default_ticket', |
|
| 111 | - 'obj_id' => $tkt_id, |
|
| 112 | - 'noheader' => true, |
|
| 113 | - ), |
|
| 114 | - 'delete_tickets' => array( |
|
| 115 | - 'func' => '_delete_ticket', |
|
| 116 | - 'capability' => 'ee_delete_default_tickets', |
|
| 117 | - 'noheader' => true, |
|
| 118 | - ), |
|
| 119 | - 'import_page' => array( |
|
| 120 | - 'func' => '_import_page', |
|
| 121 | - 'capability' => 'import', |
|
| 122 | - ), |
|
| 123 | - 'import' => array( |
|
| 124 | - 'func' => '_import_events', |
|
| 125 | - 'capability' => 'import', |
|
| 126 | - 'noheader' => true, |
|
| 127 | - ), |
|
| 128 | - 'import_events' => array( |
|
| 129 | - 'func' => '_import_events', |
|
| 130 | - 'capability' => 'import', |
|
| 131 | - 'noheader' => true, |
|
| 132 | - ), |
|
| 133 | - 'export_events' => array( |
|
| 134 | - 'func' => '_events_export', |
|
| 135 | - 'capability' => 'export', |
|
| 136 | - 'noheader' => true, |
|
| 137 | - ), |
|
| 138 | - 'export_categories' => array( |
|
| 139 | - 'func' => '_categories_export', |
|
| 140 | - 'capability' => 'export', |
|
| 141 | - 'noheader' => true, |
|
| 142 | - ), |
|
| 143 | - 'sample_export_file' => array( |
|
| 144 | - 'func' => '_sample_export_file', |
|
| 145 | - 'capability' => 'export', |
|
| 146 | - 'noheader' => true, |
|
| 147 | - ), |
|
| 148 | - 'update_template_settings' => array( |
|
| 149 | - 'func' => '_update_template_settings', |
|
| 150 | - 'capability' => 'manage_options', |
|
| 151 | - 'noheader' => true, |
|
| 152 | - ), |
|
| 153 | - ); |
|
| 154 | - $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
| 155 | - // partial route/config override |
|
| 156 | - $this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes; |
|
| 157 | - $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
| 158 | - $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
| 159 | - $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
| 160 | - $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
| 161 | - $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
|
| 162 | - // add tickets tab but only if there are more than one default ticket! |
|
| 163 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
| 164 | - array(array('TKT_is_default' => 1)), |
|
| 165 | - 'TKT_ID', |
|
| 166 | - true |
|
| 167 | - ); |
|
| 168 | - if ($tkt_count > 1) { |
|
| 169 | - $new_page_config = array( |
|
| 170 | - 'ticket_list_table' => array( |
|
| 171 | - 'nav' => array( |
|
| 172 | - 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
| 173 | - 'order' => 60, |
|
| 174 | - ), |
|
| 175 | - 'list_table' => 'Tickets_List_Table', |
|
| 176 | - 'require_nonce' => false, |
|
| 177 | - ), |
|
| 178 | - ); |
|
| 179 | - } |
|
| 180 | - // template settings |
|
| 181 | - $new_page_config['template_settings'] = array( |
|
| 182 | - 'nav' => array( |
|
| 183 | - 'label' => esc_html__('Templates', 'event_espresso'), |
|
| 184 | - 'order' => 30, |
|
| 185 | - ), |
|
| 186 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 187 | - 'help_tabs' => array( |
|
| 188 | - 'general_settings_templates_help_tab' => array( |
|
| 189 | - 'title' => esc_html__('Templates', 'event_espresso'), |
|
| 190 | - 'filename' => 'general_settings_templates', |
|
| 191 | - ), |
|
| 192 | - ), |
|
| 193 | - 'help_tour' => array('Templates_Help_Tour'), |
|
| 194 | - 'require_nonce' => false, |
|
| 195 | - ); |
|
| 196 | - $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
| 197 | - // add filters and actions |
|
| 198 | - // modifying _views |
|
| 199 | - add_filter( |
|
| 200 | - 'FHEE_event_datetime_metabox_add_additional_date_time_template', |
|
| 201 | - array($this, 'add_additional_datetime_button'), |
|
| 202 | - 10, |
|
| 203 | - 2 |
|
| 204 | - ); |
|
| 205 | - add_filter( |
|
| 206 | - 'FHEE_event_datetime_metabox_clone_button_template', |
|
| 207 | - array($this, 'add_datetime_clone_button'), |
|
| 208 | - 10, |
|
| 209 | - 2 |
|
| 210 | - ); |
|
| 211 | - add_filter( |
|
| 212 | - 'FHEE_event_datetime_metabox_timezones_template', |
|
| 213 | - array($this, 'datetime_timezones_template'), |
|
| 214 | - 10, |
|
| 215 | - 2 |
|
| 216 | - ); |
|
| 217 | - // filters for event list table |
|
| 218 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
| 219 | - add_filter( |
|
| 220 | - 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
| 221 | - array($this, 'extra_list_table_actions'), |
|
| 222 | - 10, |
|
| 223 | - 2 |
|
| 224 | - ); |
|
| 225 | - // legend item |
|
| 226 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
| 227 | - add_action('admin_init', array($this, 'admin_init')); |
|
| 228 | - // setup Advanced Editor ??? |
|
| 229 | - $admin_config = $this->loader->getShared('EE_Admin_Config'); |
|
| 230 | - if ($admin_config instanceof EE_Admin_Config && $admin_config->useAdvancedEditor()) { |
|
| 231 | - if (isset($this->_req_data['action']) |
|
| 232 | - && ( |
|
| 233 | - $this->_req_data['action'] === 'default_event_settings' |
|
| 234 | - || $this->_req_data['action'] === 'update_default_event_settings' |
|
| 235 | - ) |
|
| 236 | - ) { |
|
| 237 | - $this->advanced_editor_admin_form = $this->loader->getShared( |
|
| 238 | - 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' |
|
| 239 | - ); |
|
| 240 | - } |
|
| 241 | - if (isset($this->_req_data['action']) |
|
| 242 | - && ($this->_req_data['action'] === 'edit' || $this->_req_data['action'] === 'create_new') |
|
| 243 | - ) { |
|
| 244 | - $this->advanced_editor_data = $this->loader->getShared( |
|
| 245 | - 'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorEntityData', |
|
| 246 | - [$this->_cpt_model_obj] |
|
| 247 | - ); |
|
| 248 | - } |
|
| 249 | - } |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * admin_init |
|
| 255 | - */ |
|
| 256 | - public function admin_init() |
|
| 257 | - { |
|
| 258 | - EE_Registry::$i18n_js_strings = array_merge( |
|
| 259 | - EE_Registry::$i18n_js_strings, |
|
| 260 | - array( |
|
| 261 | - 'image_confirm' => esc_html__( |
|
| 262 | - 'Do you really want to delete this image? Please remember to update your event to complete the removal.', |
|
| 263 | - 'event_espresso' |
|
| 264 | - ), |
|
| 265 | - 'event_starts_on' => esc_html__('Event Starts on', 'event_espresso'), |
|
| 266 | - 'event_ends_on' => esc_html__('Event Ends on', 'event_espresso'), |
|
| 267 | - 'event_datetime_actions' => esc_html__('Actions', 'event_espresso'), |
|
| 268 | - 'event_clone_dt_msg' => esc_html__('Clone this Event Date and Time', 'event_espresso'), |
|
| 269 | - 'remove_event_dt_msg' => esc_html__('Remove this Event Time', 'event_espresso'), |
|
| 270 | - ) |
|
| 271 | - ); |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * Add per page screen options to the default ticket list table view. |
|
| 277 | - * |
|
| 278 | - * @throws InvalidArgumentException |
|
| 279 | - * @throws InvalidDataTypeException |
|
| 280 | - * @throws InvalidInterfaceException |
|
| 281 | - */ |
|
| 282 | - protected function _add_screen_options_ticket_list_table() |
|
| 283 | - { |
|
| 284 | - $this->_per_page_screen_option(); |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * @param string $return |
|
| 290 | - * @param int $id |
|
| 291 | - * @param string $new_title |
|
| 292 | - * @param string $new_slug |
|
| 293 | - * @return string |
|
| 294 | - */ |
|
| 295 | - public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) |
|
| 296 | - { |
|
| 297 | - $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
| 298 | - // make sure this is only when editing |
|
| 299 | - if (! empty($id)) { |
|
| 300 | - $href = EE_Admin_Page::add_query_args_and_nonce( |
|
| 301 | - array('action' => 'duplicate_event', 'EVT_ID' => $id), |
|
| 302 | - $this->_admin_base_url |
|
| 303 | - ); |
|
| 304 | - $title = esc_attr__('Duplicate Event', 'event_espresso'); |
|
| 305 | - $return .= '<a href="' |
|
| 306 | - . $href |
|
| 307 | - . '" title="' |
|
| 308 | - . $title |
|
| 309 | - . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' |
|
| 310 | - . $title |
|
| 311 | - . '</a>'; |
|
| 312 | - } |
|
| 313 | - return $return; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * Set the list table views for the default ticket list table view. |
|
| 319 | - */ |
|
| 320 | - public function _set_list_table_views_ticket_list_table() |
|
| 321 | - { |
|
| 322 | - $this->_views = array( |
|
| 323 | - 'all' => array( |
|
| 324 | - 'slug' => 'all', |
|
| 325 | - 'label' => esc_html__('All', 'event_espresso'), |
|
| 326 | - 'count' => 0, |
|
| 327 | - 'bulk_action' => array( |
|
| 328 | - 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 329 | - ), |
|
| 330 | - ), |
|
| 331 | - 'trashed' => array( |
|
| 332 | - 'slug' => 'trashed', |
|
| 333 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
| 334 | - 'count' => 0, |
|
| 335 | - 'bulk_action' => array( |
|
| 336 | - 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
| 337 | - 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
| 338 | - ), |
|
| 339 | - ), |
|
| 340 | - ); |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * Enqueue scripts and styles for the event editor. |
|
| 346 | - */ |
|
| 347 | - public function load_scripts_styles_edit() |
|
| 348 | - { |
|
| 349 | - wp_register_script( |
|
| 350 | - 'ee-event-editor-heartbeat', |
|
| 351 | - EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', |
|
| 352 | - array('ee_admin_js', 'heartbeat'), |
|
| 353 | - EVENT_ESPRESSO_VERSION, |
|
| 354 | - true |
|
| 355 | - ); |
|
| 356 | - wp_enqueue_script('ee-accounting'); |
|
| 357 | - // styles |
|
| 358 | - wp_enqueue_style('espresso-ui-theme'); |
|
| 359 | - wp_enqueue_script('event_editor_js'); |
|
| 360 | - wp_enqueue_script('ee-event-editor-heartbeat'); |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - |
|
| 364 | - /** |
|
| 365 | - * Returns template for the additional datetime. |
|
| 366 | - * |
|
| 367 | - * @param $template |
|
| 368 | - * @param $template_args |
|
| 369 | - * @return mixed |
|
| 370 | - * @throws DomainException |
|
| 371 | - */ |
|
| 372 | - public function add_additional_datetime_button($template, $template_args) |
|
| 373 | - { |
|
| 374 | - return EEH_Template::display_template( |
|
| 375 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', |
|
| 376 | - $template_args, |
|
| 377 | - true |
|
| 378 | - ); |
|
| 379 | - } |
|
| 380 | - |
|
| 381 | - |
|
| 382 | - /** |
|
| 383 | - * Returns the template for cloning a datetime. |
|
| 384 | - * |
|
| 385 | - * @param $template |
|
| 386 | - * @param $template_args |
|
| 387 | - * @return mixed |
|
| 388 | - * @throws DomainException |
|
| 389 | - */ |
|
| 390 | - public function add_datetime_clone_button($template, $template_args) |
|
| 391 | - { |
|
| 392 | - return EEH_Template::display_template( |
|
| 393 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', |
|
| 394 | - $template_args, |
|
| 395 | - true |
|
| 396 | - ); |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - |
|
| 400 | - /** |
|
| 401 | - * Returns the template for datetime timezones. |
|
| 402 | - * |
|
| 403 | - * @param $template |
|
| 404 | - * @param $template_args |
|
| 405 | - * @return mixed |
|
| 406 | - * @throws DomainException |
|
| 407 | - */ |
|
| 408 | - public function datetime_timezones_template($template, $template_args) |
|
| 409 | - { |
|
| 410 | - return EEH_Template::display_template( |
|
| 411 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', |
|
| 412 | - $template_args, |
|
| 413 | - true |
|
| 414 | - ); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - |
|
| 418 | - /** |
|
| 419 | - * Sets the views for the default list table view. |
|
| 420 | - */ |
|
| 421 | - protected function _set_list_table_views_default() |
|
| 422 | - { |
|
| 423 | - parent::_set_list_table_views_default(); |
|
| 424 | - $new_views = array( |
|
| 425 | - 'today' => array( |
|
| 426 | - 'slug' => 'today', |
|
| 427 | - 'label' => esc_html__('Today', 'event_espresso'), |
|
| 428 | - 'count' => $this->total_events_today(), |
|
| 429 | - 'bulk_action' => array( |
|
| 430 | - 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 431 | - ), |
|
| 432 | - ), |
|
| 433 | - 'month' => array( |
|
| 434 | - 'slug' => 'month', |
|
| 435 | - 'label' => esc_html__('This Month', 'event_espresso'), |
|
| 436 | - 'count' => $this->total_events_this_month(), |
|
| 437 | - 'bulk_action' => array( |
|
| 438 | - 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 439 | - ), |
|
| 440 | - ), |
|
| 441 | - ); |
|
| 442 | - $this->_views = array_merge($this->_views, $new_views); |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - |
|
| 446 | - /** |
|
| 447 | - * Returns the extra action links for the default list table view. |
|
| 448 | - * |
|
| 449 | - * @param array $action_links |
|
| 450 | - * @param EE_Event $event |
|
| 451 | - * @return array |
|
| 452 | - * @throws EE_Error |
|
| 453 | - * @throws InvalidArgumentException |
|
| 454 | - * @throws InvalidDataTypeException |
|
| 455 | - * @throws InvalidInterfaceException |
|
| 456 | - * @throws ReflectionException |
|
| 457 | - */ |
|
| 458 | - public function extra_list_table_actions(array $action_links, EE_Event $event) |
|
| 459 | - { |
|
| 460 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
| 461 | - 'ee_read_registrations', |
|
| 462 | - 'espresso_registrations_reports', |
|
| 463 | - $event->ID() |
|
| 464 | - ) |
|
| 465 | - ) { |
|
| 466 | - $reports_query_args = array( |
|
| 467 | - 'action' => 'reports', |
|
| 468 | - 'EVT_ID' => $event->ID(), |
|
| 469 | - ); |
|
| 470 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
| 471 | - $action_links[] = '<a href="' |
|
| 472 | - . $reports_link |
|
| 473 | - . '" title="' |
|
| 474 | - . esc_attr__('View Report', 'event_espresso') |
|
| 475 | - . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
|
| 476 | - . "\n\t"; |
|
| 477 | - } |
|
| 478 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 479 | - EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 480 | - $action_links[] = EEH_MSG_Template::get_message_action_link( |
|
| 481 | - 'see_notifications_for', |
|
| 482 | - null, |
|
| 483 | - array('EVT_ID' => $event->ID()) |
|
| 484 | - ); |
|
| 485 | - } |
|
| 486 | - return $action_links; |
|
| 487 | - } |
|
| 488 | - |
|
| 489 | - |
|
| 490 | - /** |
|
| 491 | - * @param $items |
|
| 492 | - * @return mixed |
|
| 493 | - */ |
|
| 494 | - public function additional_legend_items($items) |
|
| 495 | - { |
|
| 496 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
| 497 | - 'ee_read_registrations', |
|
| 498 | - 'espresso_registrations_reports' |
|
| 499 | - ) |
|
| 500 | - ) { |
|
| 501 | - $items['reports'] = array( |
|
| 502 | - 'class' => 'dashicons dashicons-chart-bar', |
|
| 503 | - 'desc' => esc_html__('Event Reports', 'event_espresso'), |
|
| 504 | - ); |
|
| 505 | - } |
|
| 506 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 507 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
| 508 | - // $related_for_icon can sometimes be a string so 'css_class' would be an illegal offset |
|
| 509 | - // (can only use numeric offsets when treating strings as arrays) |
|
| 510 | - if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) { |
|
| 511 | - $items['view_related_messages'] = array( |
|
| 512 | - 'class' => $related_for_icon['css_class'], |
|
| 513 | - 'desc' => $related_for_icon['label'], |
|
| 514 | - ); |
|
| 515 | - } |
|
| 516 | - } |
|
| 517 | - return $items; |
|
| 518 | - } |
|
| 519 | - |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * This is the callback method for the duplicate event route |
|
| 523 | - * Method looks for 'EVT_ID' in the request and retrieves that event and its details and duplicates them |
|
| 524 | - * into a new event. We add a hook so that any plugins that add extra event details can hook into this |
|
| 525 | - * action. Note that the dupe will have **DUPLICATE** as its title and slug. |
|
| 526 | - * After duplication the redirect is to the new event edit page. |
|
| 527 | - * |
|
| 528 | - * @return void |
|
| 529 | - * @throws EE_Error If EE_Event is not available with given ID |
|
| 530 | - * @throws InvalidArgumentException |
|
| 531 | - * @throws InvalidDataTypeException |
|
| 532 | - * @throws InvalidInterfaceException |
|
| 533 | - * @throws ReflectionException |
|
| 534 | - * @access protected |
|
| 535 | - */ |
|
| 536 | - protected function _duplicate_event() |
|
| 537 | - { |
|
| 538 | - // first make sure the ID for the event is in the request. |
|
| 539 | - // If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?) |
|
| 540 | - if (! isset($this->_req_data['EVT_ID'])) { |
|
| 541 | - EE_Error::add_error( |
|
| 542 | - esc_html__( |
|
| 543 | - 'In order to duplicate an event an Event ID is required. None was given.', |
|
| 544 | - 'event_espresso' |
|
| 545 | - ), |
|
| 546 | - __FILE__, |
|
| 547 | - __FUNCTION__, |
|
| 548 | - __LINE__ |
|
| 549 | - ); |
|
| 550 | - $this->_redirect_after_action(false, '', '', array(), true); |
|
| 551 | - return; |
|
| 552 | - } |
|
| 553 | - // k we've got EVT_ID so let's use that to get the event we'll duplicate |
|
| 554 | - $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
| 555 | - if (! $orig_event instanceof EE_Event) { |
|
| 556 | - throw new EE_Error( |
|
| 557 | - sprintf( |
|
| 558 | - esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), |
|
| 559 | - $this->_req_data['EVT_ID'] |
|
| 560 | - ) |
|
| 561 | - ); |
|
| 562 | - } |
|
| 563 | - // k now let's clone the $orig_event before getting relations |
|
| 564 | - $new_event = clone $orig_event; |
|
| 565 | - // original datetimes |
|
| 566 | - $orig_datetimes = $orig_event->get_many_related('Datetime'); |
|
| 567 | - // other original relations |
|
| 568 | - $orig_ven = $orig_event->get_many_related('Venue'); |
|
| 569 | - // reset the ID and modify other details to make it clear this is a dupe |
|
| 570 | - $new_event->set('EVT_ID', 0); |
|
| 571 | - $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso'); |
|
| 572 | - $new_event->set('EVT_name', $new_name); |
|
| 573 | - $new_event->set( |
|
| 574 | - 'EVT_slug', |
|
| 575 | - wp_unique_post_slug( |
|
| 576 | - sanitize_title($orig_event->name()), |
|
| 577 | - 0, |
|
| 578 | - 'publish', |
|
| 579 | - 'espresso_events', |
|
| 580 | - 0 |
|
| 581 | - ) |
|
| 582 | - ); |
|
| 583 | - $new_event->set('status', 'draft'); |
|
| 584 | - // duplicate discussion settings |
|
| 585 | - $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
| 586 | - $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
| 587 | - // save the new event |
|
| 588 | - $new_event->save(); |
|
| 589 | - // venues |
|
| 590 | - foreach ($orig_ven as $ven) { |
|
| 591 | - $new_event->_add_relation_to($ven, 'Venue'); |
|
| 592 | - } |
|
| 593 | - $new_event->save(); |
|
| 594 | - // now we need to get the question group relations and handle that |
|
| 595 | - // first primary question groups |
|
| 596 | - $orig_primary_qgs = $orig_event->get_many_related( |
|
| 597 | - 'Question_Group', |
|
| 598 | - [['Event_Question_Group.EQG_primary' => true]] |
|
| 599 | - ); |
|
| 600 | - if (! empty($orig_primary_qgs)) { |
|
| 601 | - foreach ($orig_primary_qgs as $id => $obj) { |
|
| 602 | - if ($obj instanceof EE_Question_Group) { |
|
| 603 | - $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]); |
|
| 604 | - } |
|
| 605 | - } |
|
| 606 | - } |
|
| 607 | - // next additional attendee question groups |
|
| 608 | - $orig_additional_qgs = $orig_event->get_many_related( |
|
| 609 | - 'Question_Group', |
|
| 610 | - [['Event_Question_Group.EQG_additional' => true]] |
|
| 611 | - ); |
|
| 612 | - if (! empty($orig_additional_qgs)) { |
|
| 613 | - foreach ($orig_additional_qgs as $id => $obj) { |
|
| 614 | - if ($obj instanceof EE_Question_Group) { |
|
| 615 | - $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]); |
|
| 616 | - } |
|
| 617 | - } |
|
| 618 | - } |
|
| 619 | - |
|
| 620 | - $new_event->save(); |
|
| 621 | - |
|
| 622 | - // k now that we have the new event saved we can loop through the datetimes and start adding relations. |
|
| 623 | - $cloned_tickets = array(); |
|
| 624 | - foreach ($orig_datetimes as $orig_dtt) { |
|
| 625 | - if (! $orig_dtt instanceof EE_Datetime) { |
|
| 626 | - continue; |
|
| 627 | - } |
|
| 628 | - $new_dtt = clone $orig_dtt; |
|
| 629 | - $orig_tkts = $orig_dtt->tickets(); |
|
| 630 | - // save new dtt then add to event |
|
| 631 | - $new_dtt->set('DTT_ID', 0); |
|
| 632 | - $new_dtt->set('DTT_sold', 0); |
|
| 633 | - $new_dtt->set_reserved(0); |
|
| 634 | - $new_dtt->save(); |
|
| 635 | - $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
| 636 | - $new_event->save(); |
|
| 637 | - // now let's get the ticket relations setup. |
|
| 638 | - foreach ((array) $orig_tkts as $orig_tkt) { |
|
| 639 | - // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
|
| 640 | - if (! $orig_tkt instanceof EE_Ticket) { |
|
| 641 | - continue; |
|
| 642 | - } |
|
| 643 | - // is this ticket archived? If it is then let's skip |
|
| 644 | - if ($orig_tkt->get('TKT_deleted')) { |
|
| 645 | - continue; |
|
| 646 | - } |
|
| 647 | - // does this original ticket already exist in the clone_tickets cache? |
|
| 648 | - // If so we'll just use the new ticket from it. |
|
| 649 | - if (isset($cloned_tickets[ $orig_tkt->ID() ])) { |
|
| 650 | - $new_tkt = $cloned_tickets[ $orig_tkt->ID() ]; |
|
| 651 | - } else { |
|
| 652 | - $new_tkt = clone $orig_tkt; |
|
| 653 | - // get relations on the $orig_tkt that we need to setup. |
|
| 654 | - $orig_prices = $orig_tkt->prices(); |
|
| 655 | - $new_tkt->set('TKT_ID', 0); |
|
| 656 | - $new_tkt->set('TKT_sold', 0); |
|
| 657 | - $new_tkt->set('TKT_reserved', 0); |
|
| 658 | - $new_tkt->save(); // make sure new ticket has ID. |
|
| 659 | - // price relations on new ticket need to be setup. |
|
| 660 | - foreach ($orig_prices as $orig_price) { |
|
| 661 | - $new_price = clone $orig_price; |
|
| 662 | - $new_price->set('PRC_ID', 0); |
|
| 663 | - $new_price->save(); |
|
| 664 | - $new_tkt->_add_relation_to($new_price, 'Price'); |
|
| 665 | - $new_tkt->save(); |
|
| 666 | - } |
|
| 667 | - |
|
| 668 | - do_action( |
|
| 669 | - 'AHEE__Extend_Events_Admin_Page___duplicate_event__duplicate_ticket__after', |
|
| 670 | - $orig_tkt, |
|
| 671 | - $new_tkt, |
|
| 672 | - $orig_prices, |
|
| 673 | - $orig_event, |
|
| 674 | - $orig_dtt, |
|
| 675 | - $new_dtt |
|
| 676 | - ); |
|
| 677 | - } |
|
| 678 | - // k now we can add the new ticket as a relation to the new datetime |
|
| 679 | - // and make sure its added to our cached $cloned_tickets array |
|
| 680 | - // for use with later datetimes that have the same ticket. |
|
| 681 | - $new_dtt->_add_relation_to($new_tkt, 'Ticket'); |
|
| 682 | - $new_dtt->save(); |
|
| 683 | - $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt; |
|
| 684 | - } |
|
| 685 | - } |
|
| 686 | - // clone taxonomy information |
|
| 687 | - $taxonomies_to_clone_with = apply_filters( |
|
| 688 | - 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', |
|
| 689 | - array('espresso_event_categories', 'espresso_event_type', 'post_tag') |
|
| 690 | - ); |
|
| 691 | - // get terms for original event (notice) |
|
| 692 | - $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
| 693 | - // loop through terms and add them to new event. |
|
| 694 | - foreach ($orig_terms as $term) { |
|
| 695 | - wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
| 696 | - } |
|
| 697 | - |
|
| 698 | - // duplicate other core WP_Post items for this event. |
|
| 699 | - // post thumbnail (feature image). |
|
| 700 | - $feature_image_id = get_post_thumbnail_id($orig_event->ID()); |
|
| 701 | - if ($feature_image_id) { |
|
| 702 | - update_post_meta($new_event->ID(), '_thumbnail_id', $feature_image_id); |
|
| 703 | - } |
|
| 704 | - |
|
| 705 | - // duplicate page_template setting |
|
| 706 | - $page_template = get_post_meta($orig_event->ID(), '_wp_page_template', true); |
|
| 707 | - if ($page_template) { |
|
| 708 | - update_post_meta($new_event->ID(), '_wp_page_template', $page_template); |
|
| 709 | - } |
|
| 710 | - |
|
| 711 | - do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
| 712 | - // now let's redirect to the edit page for this duplicated event if we have a new event id. |
|
| 713 | - if ($new_event->ID()) { |
|
| 714 | - $redirect_args = array( |
|
| 715 | - 'post' => $new_event->ID(), |
|
| 716 | - 'action' => 'edit', |
|
| 717 | - ); |
|
| 718 | - EE_Error::add_success( |
|
| 719 | - esc_html__( |
|
| 720 | - 'Event successfully duplicated. Please review the details below and make any necessary edits', |
|
| 721 | - 'event_espresso' |
|
| 722 | - ) |
|
| 723 | - ); |
|
| 724 | - } else { |
|
| 725 | - $redirect_args = array( |
|
| 726 | - 'action' => 'default', |
|
| 727 | - ); |
|
| 728 | - EE_Error::add_error( |
|
| 729 | - esc_html__('Not able to duplicate event. Something went wrong.', 'event_espresso'), |
|
| 730 | - __FILE__, |
|
| 731 | - __FUNCTION__, |
|
| 732 | - __LINE__ |
|
| 733 | - ); |
|
| 734 | - } |
|
| 735 | - $this->_redirect_after_action(false, '', '', $redirect_args, true); |
|
| 736 | - } |
|
| 737 | - |
|
| 738 | - |
|
| 739 | - /** |
|
| 740 | - * Generates output for the import page. |
|
| 741 | - * |
|
| 742 | - * @throws DomainException |
|
| 743 | - * @throws EE_Error |
|
| 744 | - * @throws InvalidArgumentException |
|
| 745 | - * @throws InvalidDataTypeException |
|
| 746 | - * @throws InvalidInterfaceException |
|
| 747 | - */ |
|
| 748 | - protected function _import_page() |
|
| 749 | - { |
|
| 750 | - $title = esc_html__('Import', 'event_espresso'); |
|
| 751 | - $intro = esc_html__( |
|
| 752 | - 'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', |
|
| 753 | - 'event_espresso' |
|
| 754 | - ); |
|
| 755 | - $form_url = EVENTS_ADMIN_URL; |
|
| 756 | - $action = 'import_events'; |
|
| 757 | - $type = 'csv'; |
|
| 758 | - $this->_template_args['form'] = EE_Import::instance()->upload_form( |
|
| 759 | - $title, |
|
| 760 | - $intro, |
|
| 761 | - $form_url, |
|
| 762 | - $action, |
|
| 763 | - $type |
|
| 764 | - ); |
|
| 765 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 766 | - array('action' => 'sample_export_file'), |
|
| 767 | - $this->_admin_base_url |
|
| 768 | - ); |
|
| 769 | - $content = EEH_Template::display_template( |
|
| 770 | - EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php', |
|
| 771 | - $this->_template_args, |
|
| 772 | - true |
|
| 773 | - ); |
|
| 774 | - $this->_template_args['admin_page_content'] = $content; |
|
| 775 | - $this->display_admin_page_with_sidebar(); |
|
| 776 | - } |
|
| 777 | - |
|
| 778 | - |
|
| 779 | - /** |
|
| 780 | - * _import_events |
|
| 781 | - * This handles displaying the screen and running imports for importing events. |
|
| 782 | - * |
|
| 783 | - * @return void |
|
| 784 | - * @throws EE_Error |
|
| 785 | - * @throws InvalidArgumentException |
|
| 786 | - * @throws InvalidDataTypeException |
|
| 787 | - * @throws InvalidInterfaceException |
|
| 788 | - */ |
|
| 789 | - protected function _import_events() |
|
| 790 | - { |
|
| 791 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
| 792 | - $success = EE_Import::instance()->import(); |
|
| 793 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * _events_export |
|
| 799 | - * Will export all (or just the given event) to a Excel compatible file. |
|
| 800 | - * |
|
| 801 | - * @access protected |
|
| 802 | - * @return void |
|
| 803 | - */ |
|
| 804 | - protected function _events_export() |
|
| 805 | - { |
|
| 806 | - if (isset($this->_req_data['EVT_ID'])) { |
|
| 807 | - $event_ids = $this->_req_data['EVT_ID']; |
|
| 808 | - } elseif (isset($this->_req_data['EVT_IDs'])) { |
|
| 809 | - $event_ids = $this->_req_data['EVT_IDs']; |
|
| 810 | - } else { |
|
| 811 | - $event_ids = null; |
|
| 812 | - } |
|
| 813 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
| 814 | - $new_request_args = array( |
|
| 815 | - 'export' => 'report', |
|
| 816 | - 'action' => 'all_event_data', |
|
| 817 | - 'EVT_ID' => $event_ids, |
|
| 818 | - ); |
|
| 819 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
| 820 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 821 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 822 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
| 823 | - $EE_Export->export(); |
|
| 824 | - } |
|
| 825 | - } |
|
| 826 | - |
|
| 827 | - |
|
| 828 | - /** |
|
| 829 | - * handle category exports() |
|
| 830 | - * |
|
| 831 | - * @return void |
|
| 832 | - */ |
|
| 833 | - protected function _categories_export() |
|
| 834 | - { |
|
| 835 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
| 836 | - $new_request_args = array( |
|
| 837 | - 'export' => 'report', |
|
| 838 | - 'action' => 'categories', |
|
| 839 | - 'category_ids' => $this->_req_data['EVT_CAT_ID'], |
|
| 840 | - ); |
|
| 841 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
| 842 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 843 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 844 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
| 845 | - $EE_Export->export(); |
|
| 846 | - } |
|
| 847 | - } |
|
| 848 | - |
|
| 849 | - |
|
| 850 | - /** |
|
| 851 | - * Creates a sample CSV file for importing |
|
| 852 | - */ |
|
| 853 | - protected function _sample_export_file() |
|
| 854 | - { |
|
| 855 | - // require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 856 | - EE_Export::instance()->export_sample(); |
|
| 857 | - } |
|
| 858 | - |
|
| 859 | - |
|
| 860 | - /************* Template Settings *************/ |
|
| 861 | - /** |
|
| 862 | - * Generates template settings page output |
|
| 863 | - * |
|
| 864 | - * @throws DomainException |
|
| 865 | - * @throws EE_Error |
|
| 866 | - * @throws InvalidArgumentException |
|
| 867 | - * @throws InvalidDataTypeException |
|
| 868 | - * @throws InvalidInterfaceException |
|
| 869 | - */ |
|
| 870 | - protected function _template_settings() |
|
| 871 | - { |
|
| 872 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
| 873 | - /** |
|
| 874 | - * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
| 875 | - * from General_Settings_Admin_Page to here. |
|
| 876 | - */ |
|
| 877 | - $this->_template_args = apply_filters( |
|
| 878 | - 'FHEE__General_Settings_Admin_Page__template_settings__template_args', |
|
| 879 | - $this->_template_args |
|
| 880 | - ); |
|
| 881 | - $this->_set_add_edit_form_tags('update_template_settings'); |
|
| 882 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
| 883 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
| 884 | - EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', |
|
| 885 | - $this->_template_args, |
|
| 886 | - true |
|
| 887 | - ); |
|
| 888 | - $this->display_admin_page_with_sidebar(); |
|
| 889 | - } |
|
| 890 | - |
|
| 891 | - |
|
| 892 | - /** |
|
| 893 | - * Handler for updating template settings. |
|
| 894 | - * |
|
| 895 | - * @throws EE_Error |
|
| 896 | - * @throws InvalidArgumentException |
|
| 897 | - * @throws InvalidDataTypeException |
|
| 898 | - * @throws InvalidInterfaceException |
|
| 899 | - */ |
|
| 900 | - protected function _update_template_settings() |
|
| 901 | - { |
|
| 902 | - /** |
|
| 903 | - * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
| 904 | - * from General_Settings_Admin_Page to here. |
|
| 905 | - */ |
|
| 906 | - EE_Registry::instance()->CFG->template_settings = apply_filters( |
|
| 907 | - 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
| 908 | - EE_Registry::instance()->CFG->template_settings, |
|
| 909 | - $this->_req_data |
|
| 910 | - ); |
|
| 911 | - // update custom post type slugs and detect if we need to flush rewrite rules |
|
| 912 | - $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
|
| 913 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) |
|
| 914 | - ? EE_Registry::instance()->CFG->core->event_cpt_slug |
|
| 915 | - : EEH_URL::slugify($this->_req_data['event_cpt_slug'], 'events'); |
|
| 916 | - $what = 'Template Settings'; |
|
| 917 | - $success = $this->_update_espresso_configuration( |
|
| 918 | - $what, |
|
| 919 | - EE_Registry::instance()->CFG->template_settings, |
|
| 920 | - __FILE__, |
|
| 921 | - __FUNCTION__, |
|
| 922 | - __LINE__ |
|
| 923 | - ); |
|
| 924 | - if (EE_Registry::instance()->CFG->core->event_cpt_slug !== $old_slug) { |
|
| 925 | - /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
| 926 | - $rewrite_rules = LoaderFactory::getLoader()->getShared( |
|
| 927 | - 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
| 928 | - ); |
|
| 929 | - $rewrite_rules->flush(); |
|
| 930 | - } |
|
| 931 | - $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
| 932 | - } |
|
| 933 | - |
|
| 934 | - |
|
| 935 | - /** |
|
| 936 | - * _premium_event_editor_meta_boxes |
|
| 937 | - * add all metaboxes related to the event_editor |
|
| 938 | - * |
|
| 939 | - * @access protected |
|
| 940 | - * @return void |
|
| 941 | - * @throws EE_Error |
|
| 942 | - * @throws InvalidArgumentException |
|
| 943 | - * @throws InvalidDataTypeException |
|
| 944 | - * @throws InvalidInterfaceException |
|
| 945 | - * @throws ReflectionException |
|
| 946 | - */ |
|
| 947 | - protected function _premium_event_editor_meta_boxes() |
|
| 948 | - { |
|
| 949 | - $this->verify_cpt_object(); |
|
| 950 | - add_meta_box( |
|
| 951 | - 'espresso_event_editor_event_options', |
|
| 952 | - esc_html__('Event Registration Options', 'event_espresso'), |
|
| 953 | - array($this, 'registration_options_meta_box'), |
|
| 954 | - $this->page_slug, |
|
| 955 | - 'side', |
|
| 956 | - 'core' |
|
| 957 | - ); |
|
| 958 | - } |
|
| 959 | - |
|
| 960 | - |
|
| 961 | - /** |
|
| 962 | - * override caf metabox |
|
| 963 | - * |
|
| 964 | - * @return void |
|
| 965 | - * @throws DomainException |
|
| 966 | - * @throws EE_Error |
|
| 967 | - */ |
|
| 968 | - public function registration_options_meta_box() |
|
| 969 | - { |
|
| 970 | - $yes_no_values = array( |
|
| 971 | - array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
| 972 | - array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
| 973 | - ); |
|
| 974 | - $default_reg_status_values = EEM_Registration::reg_status_array( |
|
| 975 | - array( |
|
| 976 | - EEM_Registration::status_id_cancelled, |
|
| 977 | - EEM_Registration::status_id_declined, |
|
| 978 | - EEM_Registration::status_id_incomplete, |
|
| 979 | - EEM_Registration::status_id_wait_list, |
|
| 980 | - ), |
|
| 981 | - true |
|
| 982 | - ); |
|
| 983 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
| 984 | - $template_args['_event'] = $this->_cpt_model_obj; |
|
| 985 | - $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
|
| 986 | - $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
|
| 987 | - 'default_reg_status', |
|
| 988 | - $default_reg_status_values, |
|
| 989 | - $this->_cpt_model_obj->default_registration_status() |
|
| 990 | - ); |
|
| 991 | - $template_args['display_description'] = EEH_Form_Fields::select_input( |
|
| 992 | - 'display_desc', |
|
| 993 | - $yes_no_values, |
|
| 994 | - $this->_cpt_model_obj->display_description() |
|
| 995 | - ); |
|
| 996 | - $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input( |
|
| 997 | - 'display_ticket_selector', |
|
| 998 | - $yes_no_values, |
|
| 999 | - $this->_cpt_model_obj->display_ticket_selector(), |
|
| 1000 | - '', |
|
| 1001 | - '', |
|
| 1002 | - false |
|
| 1003 | - ); |
|
| 1004 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input( |
|
| 1005 | - 'EVT_default_registration_status', |
|
| 1006 | - $default_reg_status_values, |
|
| 1007 | - $this->_cpt_model_obj->default_registration_status() |
|
| 1008 | - ); |
|
| 1009 | - $template_args['additional_registration_options'] = apply_filters( |
|
| 1010 | - 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', |
|
| 1011 | - '', |
|
| 1012 | - $template_args, |
|
| 1013 | - $yes_no_values, |
|
| 1014 | - $default_reg_status_values |
|
| 1015 | - ); |
|
| 1016 | - EEH_Template::display_template( |
|
| 1017 | - EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
| 1018 | - $template_args |
|
| 1019 | - ); |
|
| 1020 | - } |
|
| 1021 | - |
|
| 1022 | - |
|
| 1023 | - |
|
| 1024 | - /** |
|
| 1025 | - * wp_list_table_mods for caf |
|
| 1026 | - * ============================ |
|
| 1027 | - */ |
|
| 1028 | - /** |
|
| 1029 | - * hook into list table filters and provide filters for caffeinated list table |
|
| 1030 | - * |
|
| 1031 | - * @param array $old_filters any existing filters present |
|
| 1032 | - * @param array $list_table_obj the list table object |
|
| 1033 | - * @return array new filters |
|
| 1034 | - * @throws EE_Error |
|
| 1035 | - * @throws InvalidArgumentException |
|
| 1036 | - * @throws InvalidDataTypeException |
|
| 1037 | - * @throws InvalidInterfaceException |
|
| 1038 | - * @throws ReflectionException |
|
| 1039 | - */ |
|
| 1040 | - public function list_table_filters($old_filters, $list_table_obj) |
|
| 1041 | - { |
|
| 1042 | - $filters = array(); |
|
| 1043 | - // first month/year filters |
|
| 1044 | - $filters[] = $this->espresso_event_months_dropdown(); |
|
| 1045 | - $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
| 1046 | - // active status dropdown |
|
| 1047 | - if ($status !== 'draft') { |
|
| 1048 | - $filters[] = $this->active_status_dropdown( |
|
| 1049 | - isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '' |
|
| 1050 | - ); |
|
| 1051 | - $filters[] = $this->venuesDropdown( |
|
| 1052 | - isset($this->_req_data['venue']) ? $this->_req_data['venue'] : '' |
|
| 1053 | - ); |
|
| 1054 | - } |
|
| 1055 | - // category filter |
|
| 1056 | - $filters[] = $this->category_dropdown(); |
|
| 1057 | - return array_merge($old_filters, $filters); |
|
| 1058 | - } |
|
| 1059 | - |
|
| 1060 | - |
|
| 1061 | - /** |
|
| 1062 | - * espresso_event_months_dropdown |
|
| 1063 | - * |
|
| 1064 | - * @access public |
|
| 1065 | - * @return string dropdown listing month/year selections for events. |
|
| 1066 | - */ |
|
| 1067 | - public function espresso_event_months_dropdown() |
|
| 1068 | - { |
|
| 1069 | - // what we need to do is get all PRIMARY datetimes for all events to filter on. |
|
| 1070 | - // Note we need to include any other filters that are set! |
|
| 1071 | - $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
| 1072 | - // categories? |
|
| 1073 | - $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
| 1074 | - ? $this->_req_data['EVT_CAT'] |
|
| 1075 | - : null; |
|
| 1076 | - // active status? |
|
| 1077 | - $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null; |
|
| 1078 | - $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
| 1079 | - return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
| 1080 | - } |
|
| 1081 | - |
|
| 1082 | - |
|
| 1083 | - /** |
|
| 1084 | - * returns a list of "active" statuses on the event |
|
| 1085 | - * |
|
| 1086 | - * @param string $current_value whatever the current active status is |
|
| 1087 | - * @return string |
|
| 1088 | - */ |
|
| 1089 | - public function active_status_dropdown($current_value = '') |
|
| 1090 | - { |
|
| 1091 | - $select_name = 'active_status'; |
|
| 1092 | - $values = array( |
|
| 1093 | - 'none' => esc_html__('Show Active/Inactive', 'event_espresso'), |
|
| 1094 | - 'active' => esc_html__('Active', 'event_espresso'), |
|
| 1095 | - 'upcoming' => esc_html__('Upcoming', 'event_espresso'), |
|
| 1096 | - 'expired' => esc_html__('Expired', 'event_espresso'), |
|
| 1097 | - 'inactive' => esc_html__('Inactive', 'event_espresso'), |
|
| 1098 | - ); |
|
| 1099 | - |
|
| 1100 | - return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
| 1101 | - } |
|
| 1102 | - |
|
| 1103 | - |
|
| 1104 | - /** |
|
| 1105 | - * returns a list of "venues" |
|
| 1106 | - * |
|
| 1107 | - * @param string $current_value whatever the current active status is |
|
| 1108 | - * @return string |
|
| 1109 | - * @throws EE_Error |
|
| 1110 | - * @throws InvalidArgumentException |
|
| 1111 | - * @throws InvalidDataTypeException |
|
| 1112 | - * @throws InvalidInterfaceException |
|
| 1113 | - * @throws ReflectionException |
|
| 1114 | - */ |
|
| 1115 | - protected function venuesDropdown($current_value = '') |
|
| 1116 | - { |
|
| 1117 | - $select_name = 'venue'; |
|
| 1118 | - $values = array( |
|
| 1119 | - '' => esc_html__('All Venues', 'event_espresso'), |
|
| 1120 | - ); |
|
| 1121 | - // populate the list of venues. |
|
| 1122 | - $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
| 1123 | - $venues = $venue_model->get_all(array('order_by' => array('VNU_name' => 'ASC'))); |
|
| 1124 | - |
|
| 1125 | - foreach ($venues as $venue) { |
|
| 1126 | - $values[ $venue->ID() ] = $venue->name(); |
|
| 1127 | - } |
|
| 1128 | - |
|
| 1129 | - return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
| 1130 | - } |
|
| 1131 | - |
|
| 1132 | - |
|
| 1133 | - /** |
|
| 1134 | - * output a dropdown of the categories for the category filter on the event admin list table |
|
| 1135 | - * |
|
| 1136 | - * @access public |
|
| 1137 | - * @return string html |
|
| 1138 | - */ |
|
| 1139 | - public function category_dropdown() |
|
| 1140 | - { |
|
| 1141 | - $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 1142 | - return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
| 1143 | - } |
|
| 1144 | - |
|
| 1145 | - |
|
| 1146 | - /** |
|
| 1147 | - * get total number of events today |
|
| 1148 | - * |
|
| 1149 | - * @access public |
|
| 1150 | - * @return int |
|
| 1151 | - * @throws EE_Error |
|
| 1152 | - * @throws InvalidArgumentException |
|
| 1153 | - * @throws InvalidDataTypeException |
|
| 1154 | - * @throws InvalidInterfaceException |
|
| 1155 | - */ |
|
| 1156 | - public function total_events_today() |
|
| 1157 | - { |
|
| 1158 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1159 | - 'DTT_EVT_start', |
|
| 1160 | - date('Y-m-d') . ' 00:00:00', |
|
| 1161 | - 'Y-m-d H:i:s', |
|
| 1162 | - 'UTC' |
|
| 1163 | - ); |
|
| 1164 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1165 | - 'DTT_EVT_start', |
|
| 1166 | - date('Y-m-d') . ' 23:59:59', |
|
| 1167 | - 'Y-m-d H:i:s', |
|
| 1168 | - 'UTC' |
|
| 1169 | - ); |
|
| 1170 | - $where = array( |
|
| 1171 | - 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)), |
|
| 1172 | - ); |
|
| 1173 | - $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
| 1174 | - return $count; |
|
| 1175 | - } |
|
| 1176 | - |
|
| 1177 | - |
|
| 1178 | - /** |
|
| 1179 | - * get total number of events this month |
|
| 1180 | - * |
|
| 1181 | - * @access public |
|
| 1182 | - * @return int |
|
| 1183 | - * @throws EE_Error |
|
| 1184 | - * @throws InvalidArgumentException |
|
| 1185 | - * @throws InvalidDataTypeException |
|
| 1186 | - * @throws InvalidInterfaceException |
|
| 1187 | - */ |
|
| 1188 | - public function total_events_this_month() |
|
| 1189 | - { |
|
| 1190 | - // Dates |
|
| 1191 | - $this_year_r = date('Y'); |
|
| 1192 | - $this_month_r = date('m'); |
|
| 1193 | - $days_this_month = date('t'); |
|
| 1194 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1195 | - 'DTT_EVT_start', |
|
| 1196 | - $this_year_r . '-' . $this_month_r . '-01 00:00:00', |
|
| 1197 | - 'Y-m-d H:i:s', |
|
| 1198 | - 'UTC' |
|
| 1199 | - ); |
|
| 1200 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1201 | - 'DTT_EVT_start', |
|
| 1202 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', |
|
| 1203 | - 'Y-m-d H:i:s', |
|
| 1204 | - 'UTC' |
|
| 1205 | - ); |
|
| 1206 | - $where = array( |
|
| 1207 | - 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)), |
|
| 1208 | - ); |
|
| 1209 | - $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
| 1210 | - return $count; |
|
| 1211 | - } |
|
| 1212 | - |
|
| 1213 | - |
|
| 1214 | - /** DEFAULT TICKETS STUFF **/ |
|
| 1215 | - |
|
| 1216 | - /** |
|
| 1217 | - * Output default tickets list table view. |
|
| 1218 | - * |
|
| 1219 | - * @throws DomainException |
|
| 1220 | - * @throws EE_Error |
|
| 1221 | - * @throws InvalidArgumentException |
|
| 1222 | - * @throws InvalidDataTypeException |
|
| 1223 | - * @throws InvalidInterfaceException |
|
| 1224 | - */ |
|
| 1225 | - public function _tickets_overview_list_table() |
|
| 1226 | - { |
|
| 1227 | - $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
| 1228 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
| 1229 | - } |
|
| 1230 | - |
|
| 1231 | - |
|
| 1232 | - /** |
|
| 1233 | - * @param int $per_page |
|
| 1234 | - * @param bool $count |
|
| 1235 | - * @param bool $trashed |
|
| 1236 | - * @return EE_Soft_Delete_Base_Class[]|int |
|
| 1237 | - * @throws EE_Error |
|
| 1238 | - * @throws InvalidArgumentException |
|
| 1239 | - * @throws InvalidDataTypeException |
|
| 1240 | - * @throws InvalidInterfaceException |
|
| 1241 | - */ |
|
| 1242 | - public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
| 1243 | - { |
|
| 1244 | - $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
| 1245 | - $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
| 1246 | - switch ($orderby) { |
|
| 1247 | - case 'TKT_name': |
|
| 1248 | - $orderby = array('TKT_name' => $order); |
|
| 1249 | - break; |
|
| 1250 | - case 'TKT_price': |
|
| 1251 | - $orderby = array('TKT_price' => $order); |
|
| 1252 | - break; |
|
| 1253 | - case 'TKT_uses': |
|
| 1254 | - $orderby = array('TKT_uses' => $order); |
|
| 1255 | - break; |
|
| 1256 | - case 'TKT_min': |
|
| 1257 | - $orderby = array('TKT_min' => $order); |
|
| 1258 | - break; |
|
| 1259 | - case 'TKT_max': |
|
| 1260 | - $orderby = array('TKT_max' => $order); |
|
| 1261 | - break; |
|
| 1262 | - case 'TKT_qty': |
|
| 1263 | - $orderby = array('TKT_qty' => $order); |
|
| 1264 | - break; |
|
| 1265 | - } |
|
| 1266 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
| 1267 | - ? $this->_req_data['paged'] |
|
| 1268 | - : 1; |
|
| 1269 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
| 1270 | - ? $this->_req_data['perpage'] |
|
| 1271 | - : $per_page; |
|
| 1272 | - $_where = array( |
|
| 1273 | - 'TKT_is_default' => 1, |
|
| 1274 | - 'TKT_deleted' => $trashed, |
|
| 1275 | - ); |
|
| 1276 | - $offset = ($current_page - 1) * $per_page; |
|
| 1277 | - $limit = array($offset, $per_page); |
|
| 1278 | - if (isset($this->_req_data['s'])) { |
|
| 1279 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
| 1280 | - $_where['OR'] = array( |
|
| 1281 | - 'TKT_name' => array('LIKE', $sstr), |
|
| 1282 | - 'TKT_description' => array('LIKE', $sstr), |
|
| 1283 | - ); |
|
| 1284 | - } |
|
| 1285 | - $query_params = array( |
|
| 1286 | - $_where, |
|
| 1287 | - 'order_by' => $orderby, |
|
| 1288 | - 'limit' => $limit, |
|
| 1289 | - 'group_by' => 'TKT_ID', |
|
| 1290 | - ); |
|
| 1291 | - if ($count) { |
|
| 1292 | - return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
| 1293 | - } else { |
|
| 1294 | - return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
| 1295 | - } |
|
| 1296 | - } |
|
| 1297 | - |
|
| 1298 | - |
|
| 1299 | - /** |
|
| 1300 | - * @param bool $trash |
|
| 1301 | - * @throws EE_Error |
|
| 1302 | - * @throws InvalidArgumentException |
|
| 1303 | - * @throws InvalidDataTypeException |
|
| 1304 | - * @throws InvalidInterfaceException |
|
| 1305 | - */ |
|
| 1306 | - protected function _trash_or_restore_ticket($trash = false) |
|
| 1307 | - { |
|
| 1308 | - $success = 1; |
|
| 1309 | - $TKT = EEM_Ticket::instance(); |
|
| 1310 | - // checkboxes? |
|
| 1311 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 1312 | - // if array has more than one element then success message should be plural |
|
| 1313 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 1314 | - // cycle thru the boxes |
|
| 1315 | - foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
| 1316 | - if ($trash) { |
|
| 1317 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1318 | - $success = 0; |
|
| 1319 | - } |
|
| 1320 | - } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1321 | - $success = 0; |
|
| 1322 | - } |
|
| 1323 | - } |
|
| 1324 | - } else { |
|
| 1325 | - // grab single id and trash |
|
| 1326 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 1327 | - if ($trash) { |
|
| 1328 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1329 | - $success = 0; |
|
| 1330 | - } |
|
| 1331 | - } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1332 | - $success = 0; |
|
| 1333 | - } |
|
| 1334 | - } |
|
| 1335 | - $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
| 1336 | - $query_args = array( |
|
| 1337 | - 'action' => 'ticket_list_table', |
|
| 1338 | - 'status' => $trash ? '' : 'trashed', |
|
| 1339 | - ); |
|
| 1340 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
| 1341 | - } |
|
| 1342 | - |
|
| 1343 | - |
|
| 1344 | - /** |
|
| 1345 | - * Handles trashing default ticket. |
|
| 1346 | - * |
|
| 1347 | - * @throws EE_Error |
|
| 1348 | - * @throws InvalidArgumentException |
|
| 1349 | - * @throws InvalidDataTypeException |
|
| 1350 | - * @throws InvalidInterfaceException |
|
| 1351 | - * @throws ReflectionException |
|
| 1352 | - */ |
|
| 1353 | - protected function _delete_ticket() |
|
| 1354 | - { |
|
| 1355 | - $success = 1; |
|
| 1356 | - // checkboxes? |
|
| 1357 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 1358 | - // if array has more than one element then success message should be plural |
|
| 1359 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 1360 | - // cycle thru the boxes |
|
| 1361 | - foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
| 1362 | - // delete |
|
| 1363 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
| 1364 | - $success = 0; |
|
| 1365 | - } |
|
| 1366 | - } |
|
| 1367 | - } else { |
|
| 1368 | - // grab single id and trash |
|
| 1369 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 1370 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
| 1371 | - $success = 0; |
|
| 1372 | - } |
|
| 1373 | - } |
|
| 1374 | - $action_desc = 'deleted'; |
|
| 1375 | - $query_args = array( |
|
| 1376 | - 'action' => 'ticket_list_table', |
|
| 1377 | - 'status' => 'trashed', |
|
| 1378 | - ); |
|
| 1379 | - // fail safe. If the default ticket count === 1 then we need to redirect to event overview. |
|
| 1380 | - if (EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
| 1381 | - array(array('TKT_is_default' => 1)), |
|
| 1382 | - 'TKT_ID', |
|
| 1383 | - true |
|
| 1384 | - ) |
|
| 1385 | - ) { |
|
| 1386 | - $query_args = array(); |
|
| 1387 | - } |
|
| 1388 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
| 1389 | - } |
|
| 1390 | - |
|
| 1391 | - |
|
| 1392 | - /** |
|
| 1393 | - * @param int $TKT_ID |
|
| 1394 | - * @return bool|int |
|
| 1395 | - * @throws EE_Error |
|
| 1396 | - * @throws InvalidArgumentException |
|
| 1397 | - * @throws InvalidDataTypeException |
|
| 1398 | - * @throws InvalidInterfaceException |
|
| 1399 | - * @throws ReflectionException |
|
| 1400 | - */ |
|
| 1401 | - protected function _delete_the_ticket($TKT_ID) |
|
| 1402 | - { |
|
| 1403 | - $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
| 1404 | - $tkt->_remove_relations('Datetime'); |
|
| 1405 | - // delete all related prices first |
|
| 1406 | - $tkt->delete_related_permanently('Price'); |
|
| 1407 | - return $tkt->delete_permanently(); |
|
| 1408 | - } |
|
| 20 | + /** |
|
| 21 | + * @var AdvancedEditorAdminFormSection |
|
| 22 | + */ |
|
| 23 | + protected $advanced_editor_admin_form; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var AdvancedEditorEntityData |
|
| 27 | + */ |
|
| 28 | + protected $advanced_editor_data; |
|
| 29 | + |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Extend_Events_Admin_Page constructor. |
|
| 33 | + * |
|
| 34 | + * @param bool $routing |
|
| 35 | + * @throws EE_Error |
|
| 36 | + * @throws InvalidArgumentException |
|
| 37 | + * @throws InvalidDataTypeException |
|
| 38 | + * @throws InvalidInterfaceException |
|
| 39 | + * @throws ReflectionException |
|
| 40 | + */ |
|
| 41 | + public function __construct($routing = true) |
|
| 42 | + { |
|
| 43 | + if (! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
| 44 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
| 45 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
| 46 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
| 47 | + } |
|
| 48 | + parent::__construct($routing); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Sets routes. |
|
| 54 | + * |
|
| 55 | + * @throws EE_Error |
|
| 56 | + * @throws InvalidArgumentException |
|
| 57 | + * @throws InvalidDataTypeException |
|
| 58 | + * @throws InvalidInterfaceException |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + protected function _extend_page_config() |
|
| 62 | + { |
|
| 63 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
| 64 | + // is there a evt_id in the request? |
|
| 65 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
| 66 | + ? $this->_req_data['EVT_ID'] |
|
| 67 | + : 0; |
|
| 68 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
| 69 | + // tkt_id? |
|
| 70 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
| 71 | + ? $this->_req_data['TKT_ID'] |
|
| 72 | + : 0; |
|
| 73 | + $new_page_routes = array( |
|
| 74 | + 'duplicate_event' => array( |
|
| 75 | + 'func' => '_duplicate_event', |
|
| 76 | + 'capability' => 'ee_edit_event', |
|
| 77 | + 'obj_id' => $evt_id, |
|
| 78 | + 'noheader' => true, |
|
| 79 | + ), |
|
| 80 | + 'ticket_list_table' => array( |
|
| 81 | + 'func' => '_tickets_overview_list_table', |
|
| 82 | + 'capability' => 'ee_read_default_tickets', |
|
| 83 | + ), |
|
| 84 | + 'trash_ticket' => array( |
|
| 85 | + 'func' => '_trash_or_restore_ticket', |
|
| 86 | + 'capability' => 'ee_delete_default_ticket', |
|
| 87 | + 'obj_id' => $tkt_id, |
|
| 88 | + 'noheader' => true, |
|
| 89 | + 'args' => array('trash' => true), |
|
| 90 | + ), |
|
| 91 | + 'trash_tickets' => array( |
|
| 92 | + 'func' => '_trash_or_restore_ticket', |
|
| 93 | + 'capability' => 'ee_delete_default_tickets', |
|
| 94 | + 'noheader' => true, |
|
| 95 | + 'args' => array('trash' => true), |
|
| 96 | + ), |
|
| 97 | + 'restore_ticket' => array( |
|
| 98 | + 'func' => '_trash_or_restore_ticket', |
|
| 99 | + 'capability' => 'ee_delete_default_ticket', |
|
| 100 | + 'obj_id' => $tkt_id, |
|
| 101 | + 'noheader' => true, |
|
| 102 | + ), |
|
| 103 | + 'restore_tickets' => array( |
|
| 104 | + 'func' => '_trash_or_restore_ticket', |
|
| 105 | + 'capability' => 'ee_delete_default_tickets', |
|
| 106 | + 'noheader' => true, |
|
| 107 | + ), |
|
| 108 | + 'delete_ticket' => array( |
|
| 109 | + 'func' => '_delete_ticket', |
|
| 110 | + 'capability' => 'ee_delete_default_ticket', |
|
| 111 | + 'obj_id' => $tkt_id, |
|
| 112 | + 'noheader' => true, |
|
| 113 | + ), |
|
| 114 | + 'delete_tickets' => array( |
|
| 115 | + 'func' => '_delete_ticket', |
|
| 116 | + 'capability' => 'ee_delete_default_tickets', |
|
| 117 | + 'noheader' => true, |
|
| 118 | + ), |
|
| 119 | + 'import_page' => array( |
|
| 120 | + 'func' => '_import_page', |
|
| 121 | + 'capability' => 'import', |
|
| 122 | + ), |
|
| 123 | + 'import' => array( |
|
| 124 | + 'func' => '_import_events', |
|
| 125 | + 'capability' => 'import', |
|
| 126 | + 'noheader' => true, |
|
| 127 | + ), |
|
| 128 | + 'import_events' => array( |
|
| 129 | + 'func' => '_import_events', |
|
| 130 | + 'capability' => 'import', |
|
| 131 | + 'noheader' => true, |
|
| 132 | + ), |
|
| 133 | + 'export_events' => array( |
|
| 134 | + 'func' => '_events_export', |
|
| 135 | + 'capability' => 'export', |
|
| 136 | + 'noheader' => true, |
|
| 137 | + ), |
|
| 138 | + 'export_categories' => array( |
|
| 139 | + 'func' => '_categories_export', |
|
| 140 | + 'capability' => 'export', |
|
| 141 | + 'noheader' => true, |
|
| 142 | + ), |
|
| 143 | + 'sample_export_file' => array( |
|
| 144 | + 'func' => '_sample_export_file', |
|
| 145 | + 'capability' => 'export', |
|
| 146 | + 'noheader' => true, |
|
| 147 | + ), |
|
| 148 | + 'update_template_settings' => array( |
|
| 149 | + 'func' => '_update_template_settings', |
|
| 150 | + 'capability' => 'manage_options', |
|
| 151 | + 'noheader' => true, |
|
| 152 | + ), |
|
| 153 | + ); |
|
| 154 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
| 155 | + // partial route/config override |
|
| 156 | + $this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes; |
|
| 157 | + $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
| 158 | + $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
| 159 | + $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
| 160 | + $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
| 161 | + $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
|
| 162 | + // add tickets tab but only if there are more than one default ticket! |
|
| 163 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
| 164 | + array(array('TKT_is_default' => 1)), |
|
| 165 | + 'TKT_ID', |
|
| 166 | + true |
|
| 167 | + ); |
|
| 168 | + if ($tkt_count > 1) { |
|
| 169 | + $new_page_config = array( |
|
| 170 | + 'ticket_list_table' => array( |
|
| 171 | + 'nav' => array( |
|
| 172 | + 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
| 173 | + 'order' => 60, |
|
| 174 | + ), |
|
| 175 | + 'list_table' => 'Tickets_List_Table', |
|
| 176 | + 'require_nonce' => false, |
|
| 177 | + ), |
|
| 178 | + ); |
|
| 179 | + } |
|
| 180 | + // template settings |
|
| 181 | + $new_page_config['template_settings'] = array( |
|
| 182 | + 'nav' => array( |
|
| 183 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
| 184 | + 'order' => 30, |
|
| 185 | + ), |
|
| 186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 187 | + 'help_tabs' => array( |
|
| 188 | + 'general_settings_templates_help_tab' => array( |
|
| 189 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
| 190 | + 'filename' => 'general_settings_templates', |
|
| 191 | + ), |
|
| 192 | + ), |
|
| 193 | + 'help_tour' => array('Templates_Help_Tour'), |
|
| 194 | + 'require_nonce' => false, |
|
| 195 | + ); |
|
| 196 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
| 197 | + // add filters and actions |
|
| 198 | + // modifying _views |
|
| 199 | + add_filter( |
|
| 200 | + 'FHEE_event_datetime_metabox_add_additional_date_time_template', |
|
| 201 | + array($this, 'add_additional_datetime_button'), |
|
| 202 | + 10, |
|
| 203 | + 2 |
|
| 204 | + ); |
|
| 205 | + add_filter( |
|
| 206 | + 'FHEE_event_datetime_metabox_clone_button_template', |
|
| 207 | + array($this, 'add_datetime_clone_button'), |
|
| 208 | + 10, |
|
| 209 | + 2 |
|
| 210 | + ); |
|
| 211 | + add_filter( |
|
| 212 | + 'FHEE_event_datetime_metabox_timezones_template', |
|
| 213 | + array($this, 'datetime_timezones_template'), |
|
| 214 | + 10, |
|
| 215 | + 2 |
|
| 216 | + ); |
|
| 217 | + // filters for event list table |
|
| 218 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
| 219 | + add_filter( |
|
| 220 | + 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
| 221 | + array($this, 'extra_list_table_actions'), |
|
| 222 | + 10, |
|
| 223 | + 2 |
|
| 224 | + ); |
|
| 225 | + // legend item |
|
| 226 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
| 227 | + add_action('admin_init', array($this, 'admin_init')); |
|
| 228 | + // setup Advanced Editor ??? |
|
| 229 | + $admin_config = $this->loader->getShared('EE_Admin_Config'); |
|
| 230 | + if ($admin_config instanceof EE_Admin_Config && $admin_config->useAdvancedEditor()) { |
|
| 231 | + if (isset($this->_req_data['action']) |
|
| 232 | + && ( |
|
| 233 | + $this->_req_data['action'] === 'default_event_settings' |
|
| 234 | + || $this->_req_data['action'] === 'update_default_event_settings' |
|
| 235 | + ) |
|
| 236 | + ) { |
|
| 237 | + $this->advanced_editor_admin_form = $this->loader->getShared( |
|
| 238 | + 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' |
|
| 239 | + ); |
|
| 240 | + } |
|
| 241 | + if (isset($this->_req_data['action']) |
|
| 242 | + && ($this->_req_data['action'] === 'edit' || $this->_req_data['action'] === 'create_new') |
|
| 243 | + ) { |
|
| 244 | + $this->advanced_editor_data = $this->loader->getShared( |
|
| 245 | + 'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorEntityData', |
|
| 246 | + [$this->_cpt_model_obj] |
|
| 247 | + ); |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * admin_init |
|
| 255 | + */ |
|
| 256 | + public function admin_init() |
|
| 257 | + { |
|
| 258 | + EE_Registry::$i18n_js_strings = array_merge( |
|
| 259 | + EE_Registry::$i18n_js_strings, |
|
| 260 | + array( |
|
| 261 | + 'image_confirm' => esc_html__( |
|
| 262 | + 'Do you really want to delete this image? Please remember to update your event to complete the removal.', |
|
| 263 | + 'event_espresso' |
|
| 264 | + ), |
|
| 265 | + 'event_starts_on' => esc_html__('Event Starts on', 'event_espresso'), |
|
| 266 | + 'event_ends_on' => esc_html__('Event Ends on', 'event_espresso'), |
|
| 267 | + 'event_datetime_actions' => esc_html__('Actions', 'event_espresso'), |
|
| 268 | + 'event_clone_dt_msg' => esc_html__('Clone this Event Date and Time', 'event_espresso'), |
|
| 269 | + 'remove_event_dt_msg' => esc_html__('Remove this Event Time', 'event_espresso'), |
|
| 270 | + ) |
|
| 271 | + ); |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * Add per page screen options to the default ticket list table view. |
|
| 277 | + * |
|
| 278 | + * @throws InvalidArgumentException |
|
| 279 | + * @throws InvalidDataTypeException |
|
| 280 | + * @throws InvalidInterfaceException |
|
| 281 | + */ |
|
| 282 | + protected function _add_screen_options_ticket_list_table() |
|
| 283 | + { |
|
| 284 | + $this->_per_page_screen_option(); |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * @param string $return |
|
| 290 | + * @param int $id |
|
| 291 | + * @param string $new_title |
|
| 292 | + * @param string $new_slug |
|
| 293 | + * @return string |
|
| 294 | + */ |
|
| 295 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) |
|
| 296 | + { |
|
| 297 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
| 298 | + // make sure this is only when editing |
|
| 299 | + if (! empty($id)) { |
|
| 300 | + $href = EE_Admin_Page::add_query_args_and_nonce( |
|
| 301 | + array('action' => 'duplicate_event', 'EVT_ID' => $id), |
|
| 302 | + $this->_admin_base_url |
|
| 303 | + ); |
|
| 304 | + $title = esc_attr__('Duplicate Event', 'event_espresso'); |
|
| 305 | + $return .= '<a href="' |
|
| 306 | + . $href |
|
| 307 | + . '" title="' |
|
| 308 | + . $title |
|
| 309 | + . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' |
|
| 310 | + . $title |
|
| 311 | + . '</a>'; |
|
| 312 | + } |
|
| 313 | + return $return; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * Set the list table views for the default ticket list table view. |
|
| 319 | + */ |
|
| 320 | + public function _set_list_table_views_ticket_list_table() |
|
| 321 | + { |
|
| 322 | + $this->_views = array( |
|
| 323 | + 'all' => array( |
|
| 324 | + 'slug' => 'all', |
|
| 325 | + 'label' => esc_html__('All', 'event_espresso'), |
|
| 326 | + 'count' => 0, |
|
| 327 | + 'bulk_action' => array( |
|
| 328 | + 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 329 | + ), |
|
| 330 | + ), |
|
| 331 | + 'trashed' => array( |
|
| 332 | + 'slug' => 'trashed', |
|
| 333 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
| 334 | + 'count' => 0, |
|
| 335 | + 'bulk_action' => array( |
|
| 336 | + 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
| 337 | + 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
| 338 | + ), |
|
| 339 | + ), |
|
| 340 | + ); |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * Enqueue scripts and styles for the event editor. |
|
| 346 | + */ |
|
| 347 | + public function load_scripts_styles_edit() |
|
| 348 | + { |
|
| 349 | + wp_register_script( |
|
| 350 | + 'ee-event-editor-heartbeat', |
|
| 351 | + EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', |
|
| 352 | + array('ee_admin_js', 'heartbeat'), |
|
| 353 | + EVENT_ESPRESSO_VERSION, |
|
| 354 | + true |
|
| 355 | + ); |
|
| 356 | + wp_enqueue_script('ee-accounting'); |
|
| 357 | + // styles |
|
| 358 | + wp_enqueue_style('espresso-ui-theme'); |
|
| 359 | + wp_enqueue_script('event_editor_js'); |
|
| 360 | + wp_enqueue_script('ee-event-editor-heartbeat'); |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + |
|
| 364 | + /** |
|
| 365 | + * Returns template for the additional datetime. |
|
| 366 | + * |
|
| 367 | + * @param $template |
|
| 368 | + * @param $template_args |
|
| 369 | + * @return mixed |
|
| 370 | + * @throws DomainException |
|
| 371 | + */ |
|
| 372 | + public function add_additional_datetime_button($template, $template_args) |
|
| 373 | + { |
|
| 374 | + return EEH_Template::display_template( |
|
| 375 | + EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', |
|
| 376 | + $template_args, |
|
| 377 | + true |
|
| 378 | + ); |
|
| 379 | + } |
|
| 380 | + |
|
| 381 | + |
|
| 382 | + /** |
|
| 383 | + * Returns the template for cloning a datetime. |
|
| 384 | + * |
|
| 385 | + * @param $template |
|
| 386 | + * @param $template_args |
|
| 387 | + * @return mixed |
|
| 388 | + * @throws DomainException |
|
| 389 | + */ |
|
| 390 | + public function add_datetime_clone_button($template, $template_args) |
|
| 391 | + { |
|
| 392 | + return EEH_Template::display_template( |
|
| 393 | + EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', |
|
| 394 | + $template_args, |
|
| 395 | + true |
|
| 396 | + ); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + |
|
| 400 | + /** |
|
| 401 | + * Returns the template for datetime timezones. |
|
| 402 | + * |
|
| 403 | + * @param $template |
|
| 404 | + * @param $template_args |
|
| 405 | + * @return mixed |
|
| 406 | + * @throws DomainException |
|
| 407 | + */ |
|
| 408 | + public function datetime_timezones_template($template, $template_args) |
|
| 409 | + { |
|
| 410 | + return EEH_Template::display_template( |
|
| 411 | + EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', |
|
| 412 | + $template_args, |
|
| 413 | + true |
|
| 414 | + ); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + |
|
| 418 | + /** |
|
| 419 | + * Sets the views for the default list table view. |
|
| 420 | + */ |
|
| 421 | + protected function _set_list_table_views_default() |
|
| 422 | + { |
|
| 423 | + parent::_set_list_table_views_default(); |
|
| 424 | + $new_views = array( |
|
| 425 | + 'today' => array( |
|
| 426 | + 'slug' => 'today', |
|
| 427 | + 'label' => esc_html__('Today', 'event_espresso'), |
|
| 428 | + 'count' => $this->total_events_today(), |
|
| 429 | + 'bulk_action' => array( |
|
| 430 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 431 | + ), |
|
| 432 | + ), |
|
| 433 | + 'month' => array( |
|
| 434 | + 'slug' => 'month', |
|
| 435 | + 'label' => esc_html__('This Month', 'event_espresso'), |
|
| 436 | + 'count' => $this->total_events_this_month(), |
|
| 437 | + 'bulk_action' => array( |
|
| 438 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 439 | + ), |
|
| 440 | + ), |
|
| 441 | + ); |
|
| 442 | + $this->_views = array_merge($this->_views, $new_views); |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + |
|
| 446 | + /** |
|
| 447 | + * Returns the extra action links for the default list table view. |
|
| 448 | + * |
|
| 449 | + * @param array $action_links |
|
| 450 | + * @param EE_Event $event |
|
| 451 | + * @return array |
|
| 452 | + * @throws EE_Error |
|
| 453 | + * @throws InvalidArgumentException |
|
| 454 | + * @throws InvalidDataTypeException |
|
| 455 | + * @throws InvalidInterfaceException |
|
| 456 | + * @throws ReflectionException |
|
| 457 | + */ |
|
| 458 | + public function extra_list_table_actions(array $action_links, EE_Event $event) |
|
| 459 | + { |
|
| 460 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
| 461 | + 'ee_read_registrations', |
|
| 462 | + 'espresso_registrations_reports', |
|
| 463 | + $event->ID() |
|
| 464 | + ) |
|
| 465 | + ) { |
|
| 466 | + $reports_query_args = array( |
|
| 467 | + 'action' => 'reports', |
|
| 468 | + 'EVT_ID' => $event->ID(), |
|
| 469 | + ); |
|
| 470 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
| 471 | + $action_links[] = '<a href="' |
|
| 472 | + . $reports_link |
|
| 473 | + . '" title="' |
|
| 474 | + . esc_attr__('View Report', 'event_espresso') |
|
| 475 | + . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
|
| 476 | + . "\n\t"; |
|
| 477 | + } |
|
| 478 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 479 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 480 | + $action_links[] = EEH_MSG_Template::get_message_action_link( |
|
| 481 | + 'see_notifications_for', |
|
| 482 | + null, |
|
| 483 | + array('EVT_ID' => $event->ID()) |
|
| 484 | + ); |
|
| 485 | + } |
|
| 486 | + return $action_links; |
|
| 487 | + } |
|
| 488 | + |
|
| 489 | + |
|
| 490 | + /** |
|
| 491 | + * @param $items |
|
| 492 | + * @return mixed |
|
| 493 | + */ |
|
| 494 | + public function additional_legend_items($items) |
|
| 495 | + { |
|
| 496 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
| 497 | + 'ee_read_registrations', |
|
| 498 | + 'espresso_registrations_reports' |
|
| 499 | + ) |
|
| 500 | + ) { |
|
| 501 | + $items['reports'] = array( |
|
| 502 | + 'class' => 'dashicons dashicons-chart-bar', |
|
| 503 | + 'desc' => esc_html__('Event Reports', 'event_espresso'), |
|
| 504 | + ); |
|
| 505 | + } |
|
| 506 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 507 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
| 508 | + // $related_for_icon can sometimes be a string so 'css_class' would be an illegal offset |
|
| 509 | + // (can only use numeric offsets when treating strings as arrays) |
|
| 510 | + if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) { |
|
| 511 | + $items['view_related_messages'] = array( |
|
| 512 | + 'class' => $related_for_icon['css_class'], |
|
| 513 | + 'desc' => $related_for_icon['label'], |
|
| 514 | + ); |
|
| 515 | + } |
|
| 516 | + } |
|
| 517 | + return $items; |
|
| 518 | + } |
|
| 519 | + |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * This is the callback method for the duplicate event route |
|
| 523 | + * Method looks for 'EVT_ID' in the request and retrieves that event and its details and duplicates them |
|
| 524 | + * into a new event. We add a hook so that any plugins that add extra event details can hook into this |
|
| 525 | + * action. Note that the dupe will have **DUPLICATE** as its title and slug. |
|
| 526 | + * After duplication the redirect is to the new event edit page. |
|
| 527 | + * |
|
| 528 | + * @return void |
|
| 529 | + * @throws EE_Error If EE_Event is not available with given ID |
|
| 530 | + * @throws InvalidArgumentException |
|
| 531 | + * @throws InvalidDataTypeException |
|
| 532 | + * @throws InvalidInterfaceException |
|
| 533 | + * @throws ReflectionException |
|
| 534 | + * @access protected |
|
| 535 | + */ |
|
| 536 | + protected function _duplicate_event() |
|
| 537 | + { |
|
| 538 | + // first make sure the ID for the event is in the request. |
|
| 539 | + // If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?) |
|
| 540 | + if (! isset($this->_req_data['EVT_ID'])) { |
|
| 541 | + EE_Error::add_error( |
|
| 542 | + esc_html__( |
|
| 543 | + 'In order to duplicate an event an Event ID is required. None was given.', |
|
| 544 | + 'event_espresso' |
|
| 545 | + ), |
|
| 546 | + __FILE__, |
|
| 547 | + __FUNCTION__, |
|
| 548 | + __LINE__ |
|
| 549 | + ); |
|
| 550 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
| 551 | + return; |
|
| 552 | + } |
|
| 553 | + // k we've got EVT_ID so let's use that to get the event we'll duplicate |
|
| 554 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
| 555 | + if (! $orig_event instanceof EE_Event) { |
|
| 556 | + throw new EE_Error( |
|
| 557 | + sprintf( |
|
| 558 | + esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), |
|
| 559 | + $this->_req_data['EVT_ID'] |
|
| 560 | + ) |
|
| 561 | + ); |
|
| 562 | + } |
|
| 563 | + // k now let's clone the $orig_event before getting relations |
|
| 564 | + $new_event = clone $orig_event; |
|
| 565 | + // original datetimes |
|
| 566 | + $orig_datetimes = $orig_event->get_many_related('Datetime'); |
|
| 567 | + // other original relations |
|
| 568 | + $orig_ven = $orig_event->get_many_related('Venue'); |
|
| 569 | + // reset the ID and modify other details to make it clear this is a dupe |
|
| 570 | + $new_event->set('EVT_ID', 0); |
|
| 571 | + $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso'); |
|
| 572 | + $new_event->set('EVT_name', $new_name); |
|
| 573 | + $new_event->set( |
|
| 574 | + 'EVT_slug', |
|
| 575 | + wp_unique_post_slug( |
|
| 576 | + sanitize_title($orig_event->name()), |
|
| 577 | + 0, |
|
| 578 | + 'publish', |
|
| 579 | + 'espresso_events', |
|
| 580 | + 0 |
|
| 581 | + ) |
|
| 582 | + ); |
|
| 583 | + $new_event->set('status', 'draft'); |
|
| 584 | + // duplicate discussion settings |
|
| 585 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
| 586 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
| 587 | + // save the new event |
|
| 588 | + $new_event->save(); |
|
| 589 | + // venues |
|
| 590 | + foreach ($orig_ven as $ven) { |
|
| 591 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
| 592 | + } |
|
| 593 | + $new_event->save(); |
|
| 594 | + // now we need to get the question group relations and handle that |
|
| 595 | + // first primary question groups |
|
| 596 | + $orig_primary_qgs = $orig_event->get_many_related( |
|
| 597 | + 'Question_Group', |
|
| 598 | + [['Event_Question_Group.EQG_primary' => true]] |
|
| 599 | + ); |
|
| 600 | + if (! empty($orig_primary_qgs)) { |
|
| 601 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
| 602 | + if ($obj instanceof EE_Question_Group) { |
|
| 603 | + $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]); |
|
| 604 | + } |
|
| 605 | + } |
|
| 606 | + } |
|
| 607 | + // next additional attendee question groups |
|
| 608 | + $orig_additional_qgs = $orig_event->get_many_related( |
|
| 609 | + 'Question_Group', |
|
| 610 | + [['Event_Question_Group.EQG_additional' => true]] |
|
| 611 | + ); |
|
| 612 | + if (! empty($orig_additional_qgs)) { |
|
| 613 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
| 614 | + if ($obj instanceof EE_Question_Group) { |
|
| 615 | + $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]); |
|
| 616 | + } |
|
| 617 | + } |
|
| 618 | + } |
|
| 619 | + |
|
| 620 | + $new_event->save(); |
|
| 621 | + |
|
| 622 | + // k now that we have the new event saved we can loop through the datetimes and start adding relations. |
|
| 623 | + $cloned_tickets = array(); |
|
| 624 | + foreach ($orig_datetimes as $orig_dtt) { |
|
| 625 | + if (! $orig_dtt instanceof EE_Datetime) { |
|
| 626 | + continue; |
|
| 627 | + } |
|
| 628 | + $new_dtt = clone $orig_dtt; |
|
| 629 | + $orig_tkts = $orig_dtt->tickets(); |
|
| 630 | + // save new dtt then add to event |
|
| 631 | + $new_dtt->set('DTT_ID', 0); |
|
| 632 | + $new_dtt->set('DTT_sold', 0); |
|
| 633 | + $new_dtt->set_reserved(0); |
|
| 634 | + $new_dtt->save(); |
|
| 635 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
| 636 | + $new_event->save(); |
|
| 637 | + // now let's get the ticket relations setup. |
|
| 638 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
| 639 | + // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
|
| 640 | + if (! $orig_tkt instanceof EE_Ticket) { |
|
| 641 | + continue; |
|
| 642 | + } |
|
| 643 | + // is this ticket archived? If it is then let's skip |
|
| 644 | + if ($orig_tkt->get('TKT_deleted')) { |
|
| 645 | + continue; |
|
| 646 | + } |
|
| 647 | + // does this original ticket already exist in the clone_tickets cache? |
|
| 648 | + // If so we'll just use the new ticket from it. |
|
| 649 | + if (isset($cloned_tickets[ $orig_tkt->ID() ])) { |
|
| 650 | + $new_tkt = $cloned_tickets[ $orig_tkt->ID() ]; |
|
| 651 | + } else { |
|
| 652 | + $new_tkt = clone $orig_tkt; |
|
| 653 | + // get relations on the $orig_tkt that we need to setup. |
|
| 654 | + $orig_prices = $orig_tkt->prices(); |
|
| 655 | + $new_tkt->set('TKT_ID', 0); |
|
| 656 | + $new_tkt->set('TKT_sold', 0); |
|
| 657 | + $new_tkt->set('TKT_reserved', 0); |
|
| 658 | + $new_tkt->save(); // make sure new ticket has ID. |
|
| 659 | + // price relations on new ticket need to be setup. |
|
| 660 | + foreach ($orig_prices as $orig_price) { |
|
| 661 | + $new_price = clone $orig_price; |
|
| 662 | + $new_price->set('PRC_ID', 0); |
|
| 663 | + $new_price->save(); |
|
| 664 | + $new_tkt->_add_relation_to($new_price, 'Price'); |
|
| 665 | + $new_tkt->save(); |
|
| 666 | + } |
|
| 667 | + |
|
| 668 | + do_action( |
|
| 669 | + 'AHEE__Extend_Events_Admin_Page___duplicate_event__duplicate_ticket__after', |
|
| 670 | + $orig_tkt, |
|
| 671 | + $new_tkt, |
|
| 672 | + $orig_prices, |
|
| 673 | + $orig_event, |
|
| 674 | + $orig_dtt, |
|
| 675 | + $new_dtt |
|
| 676 | + ); |
|
| 677 | + } |
|
| 678 | + // k now we can add the new ticket as a relation to the new datetime |
|
| 679 | + // and make sure its added to our cached $cloned_tickets array |
|
| 680 | + // for use with later datetimes that have the same ticket. |
|
| 681 | + $new_dtt->_add_relation_to($new_tkt, 'Ticket'); |
|
| 682 | + $new_dtt->save(); |
|
| 683 | + $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt; |
|
| 684 | + } |
|
| 685 | + } |
|
| 686 | + // clone taxonomy information |
|
| 687 | + $taxonomies_to_clone_with = apply_filters( |
|
| 688 | + 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', |
|
| 689 | + array('espresso_event_categories', 'espresso_event_type', 'post_tag') |
|
| 690 | + ); |
|
| 691 | + // get terms for original event (notice) |
|
| 692 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
| 693 | + // loop through terms and add them to new event. |
|
| 694 | + foreach ($orig_terms as $term) { |
|
| 695 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
| 696 | + } |
|
| 697 | + |
|
| 698 | + // duplicate other core WP_Post items for this event. |
|
| 699 | + // post thumbnail (feature image). |
|
| 700 | + $feature_image_id = get_post_thumbnail_id($orig_event->ID()); |
|
| 701 | + if ($feature_image_id) { |
|
| 702 | + update_post_meta($new_event->ID(), '_thumbnail_id', $feature_image_id); |
|
| 703 | + } |
|
| 704 | + |
|
| 705 | + // duplicate page_template setting |
|
| 706 | + $page_template = get_post_meta($orig_event->ID(), '_wp_page_template', true); |
|
| 707 | + if ($page_template) { |
|
| 708 | + update_post_meta($new_event->ID(), '_wp_page_template', $page_template); |
|
| 709 | + } |
|
| 710 | + |
|
| 711 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
| 712 | + // now let's redirect to the edit page for this duplicated event if we have a new event id. |
|
| 713 | + if ($new_event->ID()) { |
|
| 714 | + $redirect_args = array( |
|
| 715 | + 'post' => $new_event->ID(), |
|
| 716 | + 'action' => 'edit', |
|
| 717 | + ); |
|
| 718 | + EE_Error::add_success( |
|
| 719 | + esc_html__( |
|
| 720 | + 'Event successfully duplicated. Please review the details below and make any necessary edits', |
|
| 721 | + 'event_espresso' |
|
| 722 | + ) |
|
| 723 | + ); |
|
| 724 | + } else { |
|
| 725 | + $redirect_args = array( |
|
| 726 | + 'action' => 'default', |
|
| 727 | + ); |
|
| 728 | + EE_Error::add_error( |
|
| 729 | + esc_html__('Not able to duplicate event. Something went wrong.', 'event_espresso'), |
|
| 730 | + __FILE__, |
|
| 731 | + __FUNCTION__, |
|
| 732 | + __LINE__ |
|
| 733 | + ); |
|
| 734 | + } |
|
| 735 | + $this->_redirect_after_action(false, '', '', $redirect_args, true); |
|
| 736 | + } |
|
| 737 | + |
|
| 738 | + |
|
| 739 | + /** |
|
| 740 | + * Generates output for the import page. |
|
| 741 | + * |
|
| 742 | + * @throws DomainException |
|
| 743 | + * @throws EE_Error |
|
| 744 | + * @throws InvalidArgumentException |
|
| 745 | + * @throws InvalidDataTypeException |
|
| 746 | + * @throws InvalidInterfaceException |
|
| 747 | + */ |
|
| 748 | + protected function _import_page() |
|
| 749 | + { |
|
| 750 | + $title = esc_html__('Import', 'event_espresso'); |
|
| 751 | + $intro = esc_html__( |
|
| 752 | + 'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', |
|
| 753 | + 'event_espresso' |
|
| 754 | + ); |
|
| 755 | + $form_url = EVENTS_ADMIN_URL; |
|
| 756 | + $action = 'import_events'; |
|
| 757 | + $type = 'csv'; |
|
| 758 | + $this->_template_args['form'] = EE_Import::instance()->upload_form( |
|
| 759 | + $title, |
|
| 760 | + $intro, |
|
| 761 | + $form_url, |
|
| 762 | + $action, |
|
| 763 | + $type |
|
| 764 | + ); |
|
| 765 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 766 | + array('action' => 'sample_export_file'), |
|
| 767 | + $this->_admin_base_url |
|
| 768 | + ); |
|
| 769 | + $content = EEH_Template::display_template( |
|
| 770 | + EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php', |
|
| 771 | + $this->_template_args, |
|
| 772 | + true |
|
| 773 | + ); |
|
| 774 | + $this->_template_args['admin_page_content'] = $content; |
|
| 775 | + $this->display_admin_page_with_sidebar(); |
|
| 776 | + } |
|
| 777 | + |
|
| 778 | + |
|
| 779 | + /** |
|
| 780 | + * _import_events |
|
| 781 | + * This handles displaying the screen and running imports for importing events. |
|
| 782 | + * |
|
| 783 | + * @return void |
|
| 784 | + * @throws EE_Error |
|
| 785 | + * @throws InvalidArgumentException |
|
| 786 | + * @throws InvalidDataTypeException |
|
| 787 | + * @throws InvalidInterfaceException |
|
| 788 | + */ |
|
| 789 | + protected function _import_events() |
|
| 790 | + { |
|
| 791 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
| 792 | + $success = EE_Import::instance()->import(); |
|
| 793 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * _events_export |
|
| 799 | + * Will export all (or just the given event) to a Excel compatible file. |
|
| 800 | + * |
|
| 801 | + * @access protected |
|
| 802 | + * @return void |
|
| 803 | + */ |
|
| 804 | + protected function _events_export() |
|
| 805 | + { |
|
| 806 | + if (isset($this->_req_data['EVT_ID'])) { |
|
| 807 | + $event_ids = $this->_req_data['EVT_ID']; |
|
| 808 | + } elseif (isset($this->_req_data['EVT_IDs'])) { |
|
| 809 | + $event_ids = $this->_req_data['EVT_IDs']; |
|
| 810 | + } else { |
|
| 811 | + $event_ids = null; |
|
| 812 | + } |
|
| 813 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
| 814 | + $new_request_args = array( |
|
| 815 | + 'export' => 'report', |
|
| 816 | + 'action' => 'all_event_data', |
|
| 817 | + 'EVT_ID' => $event_ids, |
|
| 818 | + ); |
|
| 819 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
| 820 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 821 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 822 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
| 823 | + $EE_Export->export(); |
|
| 824 | + } |
|
| 825 | + } |
|
| 826 | + |
|
| 827 | + |
|
| 828 | + /** |
|
| 829 | + * handle category exports() |
|
| 830 | + * |
|
| 831 | + * @return void |
|
| 832 | + */ |
|
| 833 | + protected function _categories_export() |
|
| 834 | + { |
|
| 835 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
| 836 | + $new_request_args = array( |
|
| 837 | + 'export' => 'report', |
|
| 838 | + 'action' => 'categories', |
|
| 839 | + 'category_ids' => $this->_req_data['EVT_CAT_ID'], |
|
| 840 | + ); |
|
| 841 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
| 842 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 843 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 844 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
| 845 | + $EE_Export->export(); |
|
| 846 | + } |
|
| 847 | + } |
|
| 848 | + |
|
| 849 | + |
|
| 850 | + /** |
|
| 851 | + * Creates a sample CSV file for importing |
|
| 852 | + */ |
|
| 853 | + protected function _sample_export_file() |
|
| 854 | + { |
|
| 855 | + // require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 856 | + EE_Export::instance()->export_sample(); |
|
| 857 | + } |
|
| 858 | + |
|
| 859 | + |
|
| 860 | + /************* Template Settings *************/ |
|
| 861 | + /** |
|
| 862 | + * Generates template settings page output |
|
| 863 | + * |
|
| 864 | + * @throws DomainException |
|
| 865 | + * @throws EE_Error |
|
| 866 | + * @throws InvalidArgumentException |
|
| 867 | + * @throws InvalidDataTypeException |
|
| 868 | + * @throws InvalidInterfaceException |
|
| 869 | + */ |
|
| 870 | + protected function _template_settings() |
|
| 871 | + { |
|
| 872 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
| 873 | + /** |
|
| 874 | + * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
| 875 | + * from General_Settings_Admin_Page to here. |
|
| 876 | + */ |
|
| 877 | + $this->_template_args = apply_filters( |
|
| 878 | + 'FHEE__General_Settings_Admin_Page__template_settings__template_args', |
|
| 879 | + $this->_template_args |
|
| 880 | + ); |
|
| 881 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
| 882 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
| 883 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
| 884 | + EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', |
|
| 885 | + $this->_template_args, |
|
| 886 | + true |
|
| 887 | + ); |
|
| 888 | + $this->display_admin_page_with_sidebar(); |
|
| 889 | + } |
|
| 890 | + |
|
| 891 | + |
|
| 892 | + /** |
|
| 893 | + * Handler for updating template settings. |
|
| 894 | + * |
|
| 895 | + * @throws EE_Error |
|
| 896 | + * @throws InvalidArgumentException |
|
| 897 | + * @throws InvalidDataTypeException |
|
| 898 | + * @throws InvalidInterfaceException |
|
| 899 | + */ |
|
| 900 | + protected function _update_template_settings() |
|
| 901 | + { |
|
| 902 | + /** |
|
| 903 | + * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
| 904 | + * from General_Settings_Admin_Page to here. |
|
| 905 | + */ |
|
| 906 | + EE_Registry::instance()->CFG->template_settings = apply_filters( |
|
| 907 | + 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
| 908 | + EE_Registry::instance()->CFG->template_settings, |
|
| 909 | + $this->_req_data |
|
| 910 | + ); |
|
| 911 | + // update custom post type slugs and detect if we need to flush rewrite rules |
|
| 912 | + $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
|
| 913 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) |
|
| 914 | + ? EE_Registry::instance()->CFG->core->event_cpt_slug |
|
| 915 | + : EEH_URL::slugify($this->_req_data['event_cpt_slug'], 'events'); |
|
| 916 | + $what = 'Template Settings'; |
|
| 917 | + $success = $this->_update_espresso_configuration( |
|
| 918 | + $what, |
|
| 919 | + EE_Registry::instance()->CFG->template_settings, |
|
| 920 | + __FILE__, |
|
| 921 | + __FUNCTION__, |
|
| 922 | + __LINE__ |
|
| 923 | + ); |
|
| 924 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug !== $old_slug) { |
|
| 925 | + /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
| 926 | + $rewrite_rules = LoaderFactory::getLoader()->getShared( |
|
| 927 | + 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
| 928 | + ); |
|
| 929 | + $rewrite_rules->flush(); |
|
| 930 | + } |
|
| 931 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
| 932 | + } |
|
| 933 | + |
|
| 934 | + |
|
| 935 | + /** |
|
| 936 | + * _premium_event_editor_meta_boxes |
|
| 937 | + * add all metaboxes related to the event_editor |
|
| 938 | + * |
|
| 939 | + * @access protected |
|
| 940 | + * @return void |
|
| 941 | + * @throws EE_Error |
|
| 942 | + * @throws InvalidArgumentException |
|
| 943 | + * @throws InvalidDataTypeException |
|
| 944 | + * @throws InvalidInterfaceException |
|
| 945 | + * @throws ReflectionException |
|
| 946 | + */ |
|
| 947 | + protected function _premium_event_editor_meta_boxes() |
|
| 948 | + { |
|
| 949 | + $this->verify_cpt_object(); |
|
| 950 | + add_meta_box( |
|
| 951 | + 'espresso_event_editor_event_options', |
|
| 952 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
| 953 | + array($this, 'registration_options_meta_box'), |
|
| 954 | + $this->page_slug, |
|
| 955 | + 'side', |
|
| 956 | + 'core' |
|
| 957 | + ); |
|
| 958 | + } |
|
| 959 | + |
|
| 960 | + |
|
| 961 | + /** |
|
| 962 | + * override caf metabox |
|
| 963 | + * |
|
| 964 | + * @return void |
|
| 965 | + * @throws DomainException |
|
| 966 | + * @throws EE_Error |
|
| 967 | + */ |
|
| 968 | + public function registration_options_meta_box() |
|
| 969 | + { |
|
| 970 | + $yes_no_values = array( |
|
| 971 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
| 972 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
| 973 | + ); |
|
| 974 | + $default_reg_status_values = EEM_Registration::reg_status_array( |
|
| 975 | + array( |
|
| 976 | + EEM_Registration::status_id_cancelled, |
|
| 977 | + EEM_Registration::status_id_declined, |
|
| 978 | + EEM_Registration::status_id_incomplete, |
|
| 979 | + EEM_Registration::status_id_wait_list, |
|
| 980 | + ), |
|
| 981 | + true |
|
| 982 | + ); |
|
| 983 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
| 984 | + $template_args['_event'] = $this->_cpt_model_obj; |
|
| 985 | + $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
|
| 986 | + $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
|
| 987 | + 'default_reg_status', |
|
| 988 | + $default_reg_status_values, |
|
| 989 | + $this->_cpt_model_obj->default_registration_status() |
|
| 990 | + ); |
|
| 991 | + $template_args['display_description'] = EEH_Form_Fields::select_input( |
|
| 992 | + 'display_desc', |
|
| 993 | + $yes_no_values, |
|
| 994 | + $this->_cpt_model_obj->display_description() |
|
| 995 | + ); |
|
| 996 | + $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input( |
|
| 997 | + 'display_ticket_selector', |
|
| 998 | + $yes_no_values, |
|
| 999 | + $this->_cpt_model_obj->display_ticket_selector(), |
|
| 1000 | + '', |
|
| 1001 | + '', |
|
| 1002 | + false |
|
| 1003 | + ); |
|
| 1004 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input( |
|
| 1005 | + 'EVT_default_registration_status', |
|
| 1006 | + $default_reg_status_values, |
|
| 1007 | + $this->_cpt_model_obj->default_registration_status() |
|
| 1008 | + ); |
|
| 1009 | + $template_args['additional_registration_options'] = apply_filters( |
|
| 1010 | + 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', |
|
| 1011 | + '', |
|
| 1012 | + $template_args, |
|
| 1013 | + $yes_no_values, |
|
| 1014 | + $default_reg_status_values |
|
| 1015 | + ); |
|
| 1016 | + EEH_Template::display_template( |
|
| 1017 | + EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
| 1018 | + $template_args |
|
| 1019 | + ); |
|
| 1020 | + } |
|
| 1021 | + |
|
| 1022 | + |
|
| 1023 | + |
|
| 1024 | + /** |
|
| 1025 | + * wp_list_table_mods for caf |
|
| 1026 | + * ============================ |
|
| 1027 | + */ |
|
| 1028 | + /** |
|
| 1029 | + * hook into list table filters and provide filters for caffeinated list table |
|
| 1030 | + * |
|
| 1031 | + * @param array $old_filters any existing filters present |
|
| 1032 | + * @param array $list_table_obj the list table object |
|
| 1033 | + * @return array new filters |
|
| 1034 | + * @throws EE_Error |
|
| 1035 | + * @throws InvalidArgumentException |
|
| 1036 | + * @throws InvalidDataTypeException |
|
| 1037 | + * @throws InvalidInterfaceException |
|
| 1038 | + * @throws ReflectionException |
|
| 1039 | + */ |
|
| 1040 | + public function list_table_filters($old_filters, $list_table_obj) |
|
| 1041 | + { |
|
| 1042 | + $filters = array(); |
|
| 1043 | + // first month/year filters |
|
| 1044 | + $filters[] = $this->espresso_event_months_dropdown(); |
|
| 1045 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
| 1046 | + // active status dropdown |
|
| 1047 | + if ($status !== 'draft') { |
|
| 1048 | + $filters[] = $this->active_status_dropdown( |
|
| 1049 | + isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '' |
|
| 1050 | + ); |
|
| 1051 | + $filters[] = $this->venuesDropdown( |
|
| 1052 | + isset($this->_req_data['venue']) ? $this->_req_data['venue'] : '' |
|
| 1053 | + ); |
|
| 1054 | + } |
|
| 1055 | + // category filter |
|
| 1056 | + $filters[] = $this->category_dropdown(); |
|
| 1057 | + return array_merge($old_filters, $filters); |
|
| 1058 | + } |
|
| 1059 | + |
|
| 1060 | + |
|
| 1061 | + /** |
|
| 1062 | + * espresso_event_months_dropdown |
|
| 1063 | + * |
|
| 1064 | + * @access public |
|
| 1065 | + * @return string dropdown listing month/year selections for events. |
|
| 1066 | + */ |
|
| 1067 | + public function espresso_event_months_dropdown() |
|
| 1068 | + { |
|
| 1069 | + // what we need to do is get all PRIMARY datetimes for all events to filter on. |
|
| 1070 | + // Note we need to include any other filters that are set! |
|
| 1071 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
| 1072 | + // categories? |
|
| 1073 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
| 1074 | + ? $this->_req_data['EVT_CAT'] |
|
| 1075 | + : null; |
|
| 1076 | + // active status? |
|
| 1077 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null; |
|
| 1078 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
| 1079 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
| 1080 | + } |
|
| 1081 | + |
|
| 1082 | + |
|
| 1083 | + /** |
|
| 1084 | + * returns a list of "active" statuses on the event |
|
| 1085 | + * |
|
| 1086 | + * @param string $current_value whatever the current active status is |
|
| 1087 | + * @return string |
|
| 1088 | + */ |
|
| 1089 | + public function active_status_dropdown($current_value = '') |
|
| 1090 | + { |
|
| 1091 | + $select_name = 'active_status'; |
|
| 1092 | + $values = array( |
|
| 1093 | + 'none' => esc_html__('Show Active/Inactive', 'event_espresso'), |
|
| 1094 | + 'active' => esc_html__('Active', 'event_espresso'), |
|
| 1095 | + 'upcoming' => esc_html__('Upcoming', 'event_espresso'), |
|
| 1096 | + 'expired' => esc_html__('Expired', 'event_espresso'), |
|
| 1097 | + 'inactive' => esc_html__('Inactive', 'event_espresso'), |
|
| 1098 | + ); |
|
| 1099 | + |
|
| 1100 | + return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
| 1101 | + } |
|
| 1102 | + |
|
| 1103 | + |
|
| 1104 | + /** |
|
| 1105 | + * returns a list of "venues" |
|
| 1106 | + * |
|
| 1107 | + * @param string $current_value whatever the current active status is |
|
| 1108 | + * @return string |
|
| 1109 | + * @throws EE_Error |
|
| 1110 | + * @throws InvalidArgumentException |
|
| 1111 | + * @throws InvalidDataTypeException |
|
| 1112 | + * @throws InvalidInterfaceException |
|
| 1113 | + * @throws ReflectionException |
|
| 1114 | + */ |
|
| 1115 | + protected function venuesDropdown($current_value = '') |
|
| 1116 | + { |
|
| 1117 | + $select_name = 'venue'; |
|
| 1118 | + $values = array( |
|
| 1119 | + '' => esc_html__('All Venues', 'event_espresso'), |
|
| 1120 | + ); |
|
| 1121 | + // populate the list of venues. |
|
| 1122 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
| 1123 | + $venues = $venue_model->get_all(array('order_by' => array('VNU_name' => 'ASC'))); |
|
| 1124 | + |
|
| 1125 | + foreach ($venues as $venue) { |
|
| 1126 | + $values[ $venue->ID() ] = $venue->name(); |
|
| 1127 | + } |
|
| 1128 | + |
|
| 1129 | + return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
| 1130 | + } |
|
| 1131 | + |
|
| 1132 | + |
|
| 1133 | + /** |
|
| 1134 | + * output a dropdown of the categories for the category filter on the event admin list table |
|
| 1135 | + * |
|
| 1136 | + * @access public |
|
| 1137 | + * @return string html |
|
| 1138 | + */ |
|
| 1139 | + public function category_dropdown() |
|
| 1140 | + { |
|
| 1141 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 1142 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
| 1143 | + } |
|
| 1144 | + |
|
| 1145 | + |
|
| 1146 | + /** |
|
| 1147 | + * get total number of events today |
|
| 1148 | + * |
|
| 1149 | + * @access public |
|
| 1150 | + * @return int |
|
| 1151 | + * @throws EE_Error |
|
| 1152 | + * @throws InvalidArgumentException |
|
| 1153 | + * @throws InvalidDataTypeException |
|
| 1154 | + * @throws InvalidInterfaceException |
|
| 1155 | + */ |
|
| 1156 | + public function total_events_today() |
|
| 1157 | + { |
|
| 1158 | + $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1159 | + 'DTT_EVT_start', |
|
| 1160 | + date('Y-m-d') . ' 00:00:00', |
|
| 1161 | + 'Y-m-d H:i:s', |
|
| 1162 | + 'UTC' |
|
| 1163 | + ); |
|
| 1164 | + $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1165 | + 'DTT_EVT_start', |
|
| 1166 | + date('Y-m-d') . ' 23:59:59', |
|
| 1167 | + 'Y-m-d H:i:s', |
|
| 1168 | + 'UTC' |
|
| 1169 | + ); |
|
| 1170 | + $where = array( |
|
| 1171 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)), |
|
| 1172 | + ); |
|
| 1173 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
| 1174 | + return $count; |
|
| 1175 | + } |
|
| 1176 | + |
|
| 1177 | + |
|
| 1178 | + /** |
|
| 1179 | + * get total number of events this month |
|
| 1180 | + * |
|
| 1181 | + * @access public |
|
| 1182 | + * @return int |
|
| 1183 | + * @throws EE_Error |
|
| 1184 | + * @throws InvalidArgumentException |
|
| 1185 | + * @throws InvalidDataTypeException |
|
| 1186 | + * @throws InvalidInterfaceException |
|
| 1187 | + */ |
|
| 1188 | + public function total_events_this_month() |
|
| 1189 | + { |
|
| 1190 | + // Dates |
|
| 1191 | + $this_year_r = date('Y'); |
|
| 1192 | + $this_month_r = date('m'); |
|
| 1193 | + $days_this_month = date('t'); |
|
| 1194 | + $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1195 | + 'DTT_EVT_start', |
|
| 1196 | + $this_year_r . '-' . $this_month_r . '-01 00:00:00', |
|
| 1197 | + 'Y-m-d H:i:s', |
|
| 1198 | + 'UTC' |
|
| 1199 | + ); |
|
| 1200 | + $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
| 1201 | + 'DTT_EVT_start', |
|
| 1202 | + $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', |
|
| 1203 | + 'Y-m-d H:i:s', |
|
| 1204 | + 'UTC' |
|
| 1205 | + ); |
|
| 1206 | + $where = array( |
|
| 1207 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)), |
|
| 1208 | + ); |
|
| 1209 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
| 1210 | + return $count; |
|
| 1211 | + } |
|
| 1212 | + |
|
| 1213 | + |
|
| 1214 | + /** DEFAULT TICKETS STUFF **/ |
|
| 1215 | + |
|
| 1216 | + /** |
|
| 1217 | + * Output default tickets list table view. |
|
| 1218 | + * |
|
| 1219 | + * @throws DomainException |
|
| 1220 | + * @throws EE_Error |
|
| 1221 | + * @throws InvalidArgumentException |
|
| 1222 | + * @throws InvalidDataTypeException |
|
| 1223 | + * @throws InvalidInterfaceException |
|
| 1224 | + */ |
|
| 1225 | + public function _tickets_overview_list_table() |
|
| 1226 | + { |
|
| 1227 | + $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
| 1228 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
| 1229 | + } |
|
| 1230 | + |
|
| 1231 | + |
|
| 1232 | + /** |
|
| 1233 | + * @param int $per_page |
|
| 1234 | + * @param bool $count |
|
| 1235 | + * @param bool $trashed |
|
| 1236 | + * @return EE_Soft_Delete_Base_Class[]|int |
|
| 1237 | + * @throws EE_Error |
|
| 1238 | + * @throws InvalidArgumentException |
|
| 1239 | + * @throws InvalidDataTypeException |
|
| 1240 | + * @throws InvalidInterfaceException |
|
| 1241 | + */ |
|
| 1242 | + public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
| 1243 | + { |
|
| 1244 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
| 1245 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
| 1246 | + switch ($orderby) { |
|
| 1247 | + case 'TKT_name': |
|
| 1248 | + $orderby = array('TKT_name' => $order); |
|
| 1249 | + break; |
|
| 1250 | + case 'TKT_price': |
|
| 1251 | + $orderby = array('TKT_price' => $order); |
|
| 1252 | + break; |
|
| 1253 | + case 'TKT_uses': |
|
| 1254 | + $orderby = array('TKT_uses' => $order); |
|
| 1255 | + break; |
|
| 1256 | + case 'TKT_min': |
|
| 1257 | + $orderby = array('TKT_min' => $order); |
|
| 1258 | + break; |
|
| 1259 | + case 'TKT_max': |
|
| 1260 | + $orderby = array('TKT_max' => $order); |
|
| 1261 | + break; |
|
| 1262 | + case 'TKT_qty': |
|
| 1263 | + $orderby = array('TKT_qty' => $order); |
|
| 1264 | + break; |
|
| 1265 | + } |
|
| 1266 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
| 1267 | + ? $this->_req_data['paged'] |
|
| 1268 | + : 1; |
|
| 1269 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
| 1270 | + ? $this->_req_data['perpage'] |
|
| 1271 | + : $per_page; |
|
| 1272 | + $_where = array( |
|
| 1273 | + 'TKT_is_default' => 1, |
|
| 1274 | + 'TKT_deleted' => $trashed, |
|
| 1275 | + ); |
|
| 1276 | + $offset = ($current_page - 1) * $per_page; |
|
| 1277 | + $limit = array($offset, $per_page); |
|
| 1278 | + if (isset($this->_req_data['s'])) { |
|
| 1279 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
| 1280 | + $_where['OR'] = array( |
|
| 1281 | + 'TKT_name' => array('LIKE', $sstr), |
|
| 1282 | + 'TKT_description' => array('LIKE', $sstr), |
|
| 1283 | + ); |
|
| 1284 | + } |
|
| 1285 | + $query_params = array( |
|
| 1286 | + $_where, |
|
| 1287 | + 'order_by' => $orderby, |
|
| 1288 | + 'limit' => $limit, |
|
| 1289 | + 'group_by' => 'TKT_ID', |
|
| 1290 | + ); |
|
| 1291 | + if ($count) { |
|
| 1292 | + return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
| 1293 | + } else { |
|
| 1294 | + return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
| 1295 | + } |
|
| 1296 | + } |
|
| 1297 | + |
|
| 1298 | + |
|
| 1299 | + /** |
|
| 1300 | + * @param bool $trash |
|
| 1301 | + * @throws EE_Error |
|
| 1302 | + * @throws InvalidArgumentException |
|
| 1303 | + * @throws InvalidDataTypeException |
|
| 1304 | + * @throws InvalidInterfaceException |
|
| 1305 | + */ |
|
| 1306 | + protected function _trash_or_restore_ticket($trash = false) |
|
| 1307 | + { |
|
| 1308 | + $success = 1; |
|
| 1309 | + $TKT = EEM_Ticket::instance(); |
|
| 1310 | + // checkboxes? |
|
| 1311 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 1312 | + // if array has more than one element then success message should be plural |
|
| 1313 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 1314 | + // cycle thru the boxes |
|
| 1315 | + foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
| 1316 | + if ($trash) { |
|
| 1317 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1318 | + $success = 0; |
|
| 1319 | + } |
|
| 1320 | + } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1321 | + $success = 0; |
|
| 1322 | + } |
|
| 1323 | + } |
|
| 1324 | + } else { |
|
| 1325 | + // grab single id and trash |
|
| 1326 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 1327 | + if ($trash) { |
|
| 1328 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1329 | + $success = 0; |
|
| 1330 | + } |
|
| 1331 | + } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1332 | + $success = 0; |
|
| 1333 | + } |
|
| 1334 | + } |
|
| 1335 | + $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
| 1336 | + $query_args = array( |
|
| 1337 | + 'action' => 'ticket_list_table', |
|
| 1338 | + 'status' => $trash ? '' : 'trashed', |
|
| 1339 | + ); |
|
| 1340 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
| 1341 | + } |
|
| 1342 | + |
|
| 1343 | + |
|
| 1344 | + /** |
|
| 1345 | + * Handles trashing default ticket. |
|
| 1346 | + * |
|
| 1347 | + * @throws EE_Error |
|
| 1348 | + * @throws InvalidArgumentException |
|
| 1349 | + * @throws InvalidDataTypeException |
|
| 1350 | + * @throws InvalidInterfaceException |
|
| 1351 | + * @throws ReflectionException |
|
| 1352 | + */ |
|
| 1353 | + protected function _delete_ticket() |
|
| 1354 | + { |
|
| 1355 | + $success = 1; |
|
| 1356 | + // checkboxes? |
|
| 1357 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 1358 | + // if array has more than one element then success message should be plural |
|
| 1359 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 1360 | + // cycle thru the boxes |
|
| 1361 | + foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
| 1362 | + // delete |
|
| 1363 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
| 1364 | + $success = 0; |
|
| 1365 | + } |
|
| 1366 | + } |
|
| 1367 | + } else { |
|
| 1368 | + // grab single id and trash |
|
| 1369 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 1370 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
| 1371 | + $success = 0; |
|
| 1372 | + } |
|
| 1373 | + } |
|
| 1374 | + $action_desc = 'deleted'; |
|
| 1375 | + $query_args = array( |
|
| 1376 | + 'action' => 'ticket_list_table', |
|
| 1377 | + 'status' => 'trashed', |
|
| 1378 | + ); |
|
| 1379 | + // fail safe. If the default ticket count === 1 then we need to redirect to event overview. |
|
| 1380 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
| 1381 | + array(array('TKT_is_default' => 1)), |
|
| 1382 | + 'TKT_ID', |
|
| 1383 | + true |
|
| 1384 | + ) |
|
| 1385 | + ) { |
|
| 1386 | + $query_args = array(); |
|
| 1387 | + } |
|
| 1388 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
| 1389 | + } |
|
| 1390 | + |
|
| 1391 | + |
|
| 1392 | + /** |
|
| 1393 | + * @param int $TKT_ID |
|
| 1394 | + * @return bool|int |
|
| 1395 | + * @throws EE_Error |
|
| 1396 | + * @throws InvalidArgumentException |
|
| 1397 | + * @throws InvalidDataTypeException |
|
| 1398 | + * @throws InvalidInterfaceException |
|
| 1399 | + * @throws ReflectionException |
|
| 1400 | + */ |
|
| 1401 | + protected function _delete_the_ticket($TKT_ID) |
|
| 1402 | + { |
|
| 1403 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
| 1404 | + $tkt->_remove_relations('Datetime'); |
|
| 1405 | + // delete all related prices first |
|
| 1406 | + $tkt->delete_related_permanently('Price'); |
|
| 1407 | + return $tkt->delete_permanently(); |
|
| 1408 | + } |
|
| 1409 | 1409 | } |
@@ -21,1199 +21,1199 @@ |
||
| 21 | 21 | class EE_Dependency_Map |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * This means that the requested class dependency is not present in the dependency map |
|
| 26 | - */ |
|
| 27 | - const not_registered = 0; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
| 31 | - */ |
|
| 32 | - const load_new_object = 1; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
| 36 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
| 37 | - */ |
|
| 38 | - const load_from_cache = 2; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * When registering a dependency, |
|
| 42 | - * this indicates to keep any existing dependencies that already exist, |
|
| 43 | - * and simply discard any new dependencies declared in the incoming data |
|
| 44 | - */ |
|
| 45 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * When registering a dependency, |
|
| 49 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
| 50 | - */ |
|
| 51 | - const OVERWRITE_DEPENDENCIES = 1; |
|
| 52 | - |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @type EE_Dependency_Map $_instance |
|
| 56 | - */ |
|
| 57 | - protected static $_instance; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @var ClassInterfaceCache $class_cache |
|
| 61 | - */ |
|
| 62 | - private $class_cache; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @type RequestInterface $request |
|
| 66 | - */ |
|
| 67 | - protected $request; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @type LegacyRequestInterface $legacy_request |
|
| 71 | - */ |
|
| 72 | - protected $legacy_request; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @type ResponseInterface $response |
|
| 76 | - */ |
|
| 77 | - protected $response; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @type LoaderInterface $loader |
|
| 81 | - */ |
|
| 82 | - protected $loader; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @type array $_dependency_map |
|
| 86 | - */ |
|
| 87 | - protected $_dependency_map = array(); |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @type array $_class_loaders |
|
| 91 | - */ |
|
| 92 | - protected $_class_loaders = array(); |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * EE_Dependency_Map constructor. |
|
| 97 | - * |
|
| 98 | - * @param ClassInterfaceCache $class_cache |
|
| 99 | - */ |
|
| 100 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
| 101 | - { |
|
| 102 | - $this->class_cache = $class_cache; |
|
| 103 | - do_action('EE_Dependency_Map____construct', $this); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @return void |
|
| 109 | - * @throws EE_Error |
|
| 110 | - * @throws InvalidAliasException |
|
| 111 | - */ |
|
| 112 | - public function initialize() |
|
| 113 | - { |
|
| 114 | - $this->_register_core_dependencies(); |
|
| 115 | - $this->_register_core_class_loaders(); |
|
| 116 | - $this->_register_core_aliases(); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @singleton method used to instantiate class object |
|
| 122 | - * @param ClassInterfaceCache|null $class_cache |
|
| 123 | - * @return EE_Dependency_Map |
|
| 124 | - */ |
|
| 125 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
| 126 | - { |
|
| 127 | - // check if class object is instantiated, and instantiated properly |
|
| 128 | - if (! self::$_instance instanceof EE_Dependency_Map |
|
| 129 | - && $class_cache instanceof ClassInterfaceCache |
|
| 130 | - ) { |
|
| 131 | - self::$_instance = new EE_Dependency_Map($class_cache); |
|
| 132 | - } |
|
| 133 | - return self::$_instance; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * @param RequestInterface $request |
|
| 139 | - */ |
|
| 140 | - public function setRequest(RequestInterface $request) |
|
| 141 | - { |
|
| 142 | - $this->request = $request; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * @param LegacyRequestInterface $legacy_request |
|
| 148 | - */ |
|
| 149 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
| 150 | - { |
|
| 151 | - $this->legacy_request = $legacy_request; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * @param ResponseInterface $response |
|
| 157 | - */ |
|
| 158 | - public function setResponse(ResponseInterface $response) |
|
| 159 | - { |
|
| 160 | - $this->response = $response; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * @param LoaderInterface $loader |
|
| 166 | - */ |
|
| 167 | - public function setLoader(LoaderInterface $loader) |
|
| 168 | - { |
|
| 169 | - $this->loader = $loader; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param string $class |
|
| 175 | - * @param array $dependencies |
|
| 176 | - * @param int $overwrite |
|
| 177 | - * @return bool |
|
| 178 | - */ |
|
| 179 | - public static function register_dependencies( |
|
| 180 | - $class, |
|
| 181 | - array $dependencies, |
|
| 182 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 183 | - ) { |
|
| 184 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
| 190 | - * to the class specified by the first parameter. |
|
| 191 | - * IMPORTANT !!! |
|
| 192 | - * The order of elements in the incoming $dependencies array MUST match |
|
| 193 | - * the order of the constructor parameters for the class in question. |
|
| 194 | - * This is especially important when overriding any existing dependencies that are registered. |
|
| 195 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
| 196 | - * |
|
| 197 | - * @param string $class |
|
| 198 | - * @param array $dependencies |
|
| 199 | - * @param int $overwrite |
|
| 200 | - * @return bool |
|
| 201 | - */ |
|
| 202 | - public function registerDependencies( |
|
| 203 | - $class, |
|
| 204 | - array $dependencies, |
|
| 205 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 206 | - ) { |
|
| 207 | - $class = trim($class, '\\'); |
|
| 208 | - $registered = false; |
|
| 209 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 210 | - self::$_instance->_dependency_map[ $class ] = array(); |
|
| 211 | - } |
|
| 212 | - // we need to make sure that any aliases used when registering a dependency |
|
| 213 | - // get resolved to the correct class name |
|
| 214 | - foreach ($dependencies as $dependency => $load_source) { |
|
| 215 | - $alias = self::$_instance->getFqnForAlias($dependency); |
|
| 216 | - if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
| 217 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 218 | - ) { |
|
| 219 | - unset($dependencies[ $dependency ]); |
|
| 220 | - $dependencies[ $alias ] = $load_source; |
|
| 221 | - $registered = true; |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - // now add our two lists of dependencies together. |
|
| 225 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
| 226 | - // so $dependencies is NOT overwritten because it is listed first |
|
| 227 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
| 228 | - // Union is way faster than array_merge() but should be used with caution... |
|
| 229 | - // especially with numerically indexed arrays |
|
| 230 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 231 | - // now we need to ensure that the resulting dependencies |
|
| 232 | - // array only has the entries that are required for the class |
|
| 233 | - // so first count how many dependencies were originally registered for the class |
|
| 234 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 235 | - // if that count is non-zero (meaning dependencies were already registered) |
|
| 236 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 237 | - // then truncate the final array to match that count |
|
| 238 | - ? array_slice($dependencies, 0, $dependency_count) |
|
| 239 | - // otherwise just take the incoming array because nothing previously existed |
|
| 240 | - : $dependencies; |
|
| 241 | - return $registered; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * @param string $class_name |
|
| 247 | - * @param string $loader |
|
| 248 | - * @return bool |
|
| 249 | - * @throws DomainException |
|
| 250 | - */ |
|
| 251 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
| 252 | - { |
|
| 253 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 254 | - throw new DomainException( |
|
| 255 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
| 256 | - ); |
|
| 257 | - } |
|
| 258 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
| 259 | - if (! is_callable($loader) |
|
| 260 | - && ( |
|
| 261 | - strpos($loader, 'load_') !== 0 |
|
| 262 | - || ! method_exists('EE_Registry', $loader) |
|
| 263 | - ) |
|
| 264 | - ) { |
|
| 265 | - throw new DomainException( |
|
| 266 | - sprintf( |
|
| 267 | - esc_html__( |
|
| 268 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
| 269 | - 'event_espresso' |
|
| 270 | - ), |
|
| 271 | - $loader |
|
| 272 | - ) |
|
| 273 | - ); |
|
| 274 | - } |
|
| 275 | - $class_name = self::$_instance->getFqnForAlias($class_name); |
|
| 276 | - if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 277 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 278 | - return true; |
|
| 279 | - } |
|
| 280 | - return false; |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * @return array |
|
| 286 | - */ |
|
| 287 | - public function dependency_map() |
|
| 288 | - { |
|
| 289 | - return $this->_dependency_map; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
| 295 | - * |
|
| 296 | - * @param string $class_name |
|
| 297 | - * @return boolean |
|
| 298 | - */ |
|
| 299 | - public function has($class_name = '') |
|
| 300 | - { |
|
| 301 | - // all legacy models have the same dependencies |
|
| 302 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 303 | - $class_name = 'LEGACY_MODELS'; |
|
| 304 | - } |
|
| 305 | - return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - |
|
| 309 | - /** |
|
| 310 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
| 311 | - * |
|
| 312 | - * @param string $class_name |
|
| 313 | - * @param string $dependency |
|
| 314 | - * @return bool |
|
| 315 | - */ |
|
| 316 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
| 317 | - { |
|
| 318 | - // all legacy models have the same dependencies |
|
| 319 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 320 | - $class_name = 'LEGACY_MODELS'; |
|
| 321 | - } |
|
| 322 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
| 323 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 324 | - ? true |
|
| 325 | - : false; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
| 331 | - * |
|
| 332 | - * @param string $class_name |
|
| 333 | - * @param string $dependency |
|
| 334 | - * @return int |
|
| 335 | - */ |
|
| 336 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
| 337 | - { |
|
| 338 | - // all legacy models have the same dependencies |
|
| 339 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 340 | - $class_name = 'LEGACY_MODELS'; |
|
| 341 | - } |
|
| 342 | - $dependency = $this->getFqnForAlias($dependency); |
|
| 343 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
| 344 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 345 | - : EE_Dependency_Map::not_registered; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - |
|
| 349 | - /** |
|
| 350 | - * @param string $class_name |
|
| 351 | - * @return string | Closure |
|
| 352 | - */ |
|
| 353 | - public function class_loader($class_name) |
|
| 354 | - { |
|
| 355 | - // all legacy models use load_model() |
|
| 356 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 357 | - return 'load_model'; |
|
| 358 | - } |
|
| 359 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
| 360 | - // perform strpos() first to avoid loading regex every time we load a class |
|
| 361 | - if (strpos($class_name, 'EE_CPT_') === 0 |
|
| 362 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
| 363 | - ) { |
|
| 364 | - return 'load_core'; |
|
| 365 | - } |
|
| 366 | - $class_name = $this->getFqnForAlias($class_name); |
|
| 367 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 368 | - } |
|
| 369 | - |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * @return array |
|
| 373 | - */ |
|
| 374 | - public function class_loaders() |
|
| 375 | - { |
|
| 376 | - return $this->_class_loaders; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * adds an alias for a classname |
|
| 382 | - * |
|
| 383 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
| 384 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
| 385 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
| 386 | - * @throws InvalidAliasException |
|
| 387 | - */ |
|
| 388 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
| 389 | - { |
|
| 390 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
| 391 | - } |
|
| 392 | - |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
| 396 | - * WHY? |
|
| 397 | - * Because if a class is type hinting for a concretion, |
|
| 398 | - * then why would we need to find another class to supply it? |
|
| 399 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 400 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 401 | - * Don't go looking for some substitute. |
|
| 402 | - * Whereas if a class is type hinting for an interface... |
|
| 403 | - * then we need to find an actual class to use. |
|
| 404 | - * So the interface IS the alias for some other FQN, |
|
| 405 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 406 | - * represents some other class. |
|
| 407 | - * |
|
| 408 | - * @param string $fqn |
|
| 409 | - * @param string $for_class |
|
| 410 | - * @return bool |
|
| 411 | - */ |
|
| 412 | - public function isAlias($fqn = '', $for_class = '') |
|
| 413 | - { |
|
| 414 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - |
|
| 418 | - /** |
|
| 419 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 420 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 421 | - * for example: |
|
| 422 | - * if the following two entries were added to the _aliases array: |
|
| 423 | - * array( |
|
| 424 | - * 'interface_alias' => 'some\namespace\interface' |
|
| 425 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 426 | - * ) |
|
| 427 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 428 | - * to load an instance of 'some\namespace\classname' |
|
| 429 | - * |
|
| 430 | - * @param string $alias |
|
| 431 | - * @param string $for_class |
|
| 432 | - * @return string |
|
| 433 | - */ |
|
| 434 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
| 435 | - { |
|
| 436 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
| 442 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
| 443 | - * This is done by using the following class constants: |
|
| 444 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
| 445 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
| 446 | - */ |
|
| 447 | - protected function _register_core_dependencies() |
|
| 448 | - { |
|
| 449 | - $this->_dependency_map = array( |
|
| 450 | - 'EE_Request_Handler' => array( |
|
| 451 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 452 | - ), |
|
| 453 | - 'EE_System' => array( |
|
| 454 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 455 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 456 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 457 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 458 | - ), |
|
| 459 | - 'EE_Session' => array( |
|
| 460 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 461 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 462 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 463 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 464 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 465 | - ), |
|
| 466 | - 'EE_Cart' => array( |
|
| 467 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 468 | - ), |
|
| 469 | - 'EE_Front_Controller' => array( |
|
| 470 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 471 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 472 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
| 473 | - ), |
|
| 474 | - 'EE_Messenger_Collection_Loader' => array( |
|
| 475 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
| 476 | - ), |
|
| 477 | - 'EE_Message_Type_Collection_Loader' => array( |
|
| 478 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
| 479 | - ), |
|
| 480 | - 'EE_Message_Resource_Manager' => array( |
|
| 481 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 482 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 483 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 484 | - ), |
|
| 485 | - 'EE_Message_Factory' => array( |
|
| 486 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 487 | - ), |
|
| 488 | - 'EE_messages' => array( |
|
| 489 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 490 | - ), |
|
| 491 | - 'EE_Messages_Generator' => array( |
|
| 492 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
| 493 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
| 494 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
| 495 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
| 496 | - ), |
|
| 497 | - 'EE_Messages_Processor' => array( |
|
| 498 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 499 | - ), |
|
| 500 | - 'EE_Messages_Queue' => array( |
|
| 501 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
| 502 | - ), |
|
| 503 | - 'EE_Messages_Template_Defaults' => array( |
|
| 504 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 505 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
| 506 | - ), |
|
| 507 | - 'EE_Message_To_Generate_From_Request' => array( |
|
| 508 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 509 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 510 | - ), |
|
| 511 | - 'EventEspresso\core\services\commands\CommandBus' => array( |
|
| 512 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
| 513 | - ), |
|
| 514 | - 'EventEspresso\services\commands\CommandHandler' => array( |
|
| 515 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 516 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
| 517 | - ), |
|
| 518 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
| 519 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 520 | - ), |
|
| 521 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
| 522 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
| 523 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
| 524 | - ), |
|
| 525 | - 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
| 526 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 527 | - ), |
|
| 528 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
| 529 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 530 | - ), |
|
| 531 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
| 532 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 533 | - ), |
|
| 534 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
| 535 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 536 | - ), |
|
| 537 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
| 538 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 539 | - ), |
|
| 540 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
| 541 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 542 | - ), |
|
| 543 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
| 544 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 545 | - ), |
|
| 546 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
| 547 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 548 | - ), |
|
| 549 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
| 550 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 551 | - ), |
|
| 552 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
| 553 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 554 | - ), |
|
| 555 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
| 556 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 557 | - ), |
|
| 558 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
| 559 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 560 | - ), |
|
| 561 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
| 562 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 563 | - ), |
|
| 564 | - 'EventEspresso\core\services\database\TableManager' => array( |
|
| 565 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 566 | - ), |
|
| 567 | - 'EE_Data_Migration_Class_Base' => array( |
|
| 568 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 569 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 570 | - ), |
|
| 571 | - 'EE_DMS_Core_4_1_0' => array( |
|
| 572 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 573 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 574 | - ), |
|
| 575 | - 'EE_DMS_Core_4_2_0' => array( |
|
| 576 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 577 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 578 | - ), |
|
| 579 | - 'EE_DMS_Core_4_3_0' => array( |
|
| 580 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 581 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 582 | - ), |
|
| 583 | - 'EE_DMS_Core_4_4_0' => array( |
|
| 584 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 585 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 586 | - ), |
|
| 587 | - 'EE_DMS_Core_4_5_0' => array( |
|
| 588 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 589 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 590 | - ), |
|
| 591 | - 'EE_DMS_Core_4_6_0' => array( |
|
| 592 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 593 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 594 | - ), |
|
| 595 | - 'EE_DMS_Core_4_7_0' => array( |
|
| 596 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 597 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 598 | - ), |
|
| 599 | - 'EE_DMS_Core_4_8_0' => array( |
|
| 600 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 601 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 602 | - ), |
|
| 603 | - 'EE_DMS_Core_4_9_0' => array( |
|
| 604 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 605 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 606 | - ), |
|
| 607 | - 'EE_DMS_Core_4_10_0' => array( |
|
| 608 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 609 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 610 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
| 611 | - ), |
|
| 612 | - 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
| 613 | - array(), |
|
| 614 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 615 | - ), |
|
| 616 | - 'EventEspresso\core\services\assets\Registry' => array( |
|
| 617 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 618 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
| 619 | - ), |
|
| 620 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
| 621 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 622 | - ), |
|
| 623 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
| 624 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 625 | - ), |
|
| 626 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
| 627 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 628 | - ), |
|
| 629 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
| 630 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 631 | - ), |
|
| 632 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
| 633 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 634 | - ), |
|
| 635 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
| 636 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 637 | - ), |
|
| 638 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
| 639 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 640 | - ), |
|
| 641 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
| 642 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 643 | - ), |
|
| 644 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
| 645 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 646 | - ), |
|
| 647 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
| 648 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 649 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 650 | - ), |
|
| 651 | - 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
| 652 | - null, |
|
| 653 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
| 654 | - ), |
|
| 655 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
| 656 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 657 | - ), |
|
| 658 | - 'LEGACY_MODELS' => array( |
|
| 659 | - null, |
|
| 660 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
| 661 | - ), |
|
| 662 | - 'EE_Module_Request_Router' => array( |
|
| 663 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 664 | - ), |
|
| 665 | - 'EE_Registration_Processor' => array( |
|
| 666 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 667 | - ), |
|
| 668 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
| 669 | - null, |
|
| 670 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 671 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 672 | - ), |
|
| 673 | - 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
| 674 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
| 675 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 676 | - ), |
|
| 677 | - 'EE_Admin_Transactions_List_Table' => array( |
|
| 678 | - null, |
|
| 679 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 680 | - ), |
|
| 681 | - 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
| 682 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 683 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 684 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
| 685 | - ), |
|
| 686 | - 'EventEspresso\core\domain\services\pue\Config' => array( |
|
| 687 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
| 688 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 689 | - ), |
|
| 690 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
| 691 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 692 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 693 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 694 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 695 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 696 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 697 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 698 | - ), |
|
| 699 | - 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
| 700 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 701 | - ), |
|
| 702 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
| 703 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 704 | - ), |
|
| 705 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
| 706 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 707 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 708 | - ), |
|
| 709 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
| 710 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 711 | - ), |
|
| 712 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
| 713 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 714 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 715 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 716 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 717 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
| 718 | - ), |
|
| 719 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
| 720 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 721 | - ), |
|
| 722 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
| 723 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 724 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 725 | - ), |
|
| 726 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
| 727 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 728 | - ), |
|
| 729 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
| 730 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 731 | - ), |
|
| 732 | - 'EE_CPT_Strategy' => array( |
|
| 733 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 734 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 735 | - ), |
|
| 736 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
| 737 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 738 | - ), |
|
| 739 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager' => array( |
|
| 740 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 741 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 742 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 743 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 744 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 745 | - ), |
|
| 746 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
| 747 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 748 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
| 749 | - ), |
|
| 750 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array( |
|
| 751 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 752 | - ), |
|
| 753 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array( |
|
| 754 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 755 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache |
|
| 756 | - ), |
|
| 757 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array( |
|
| 758 | - 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
| 759 | - ), |
|
| 760 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array( |
|
| 761 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 762 | - ), |
|
| 763 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array( |
|
| 764 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 765 | - ), |
|
| 766 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array( |
|
| 767 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 768 | - ), |
|
| 769 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array( |
|
| 770 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
| 771 | - 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
| 772 | - ), |
|
| 773 | - 'EventEspresso\core\CPTs\CptQueryModifier' => array( |
|
| 774 | - null, |
|
| 775 | - null, |
|
| 776 | - null, |
|
| 777 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 778 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 779 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 780 | - ), |
|
| 781 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array( |
|
| 782 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 783 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
| 784 | - ), |
|
| 785 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
| 786 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 787 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 788 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 789 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 790 | - ), |
|
| 791 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array( |
|
| 792 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 793 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 794 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 795 | - ), |
|
| 796 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array( |
|
| 797 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 798 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 799 | - ), |
|
| 800 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array( |
|
| 801 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
| 802 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 803 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
| 804 | - ), |
|
| 805 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array( |
|
| 806 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
| 807 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 808 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 809 | - ), |
|
| 810 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array( |
|
| 811 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
| 812 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 813 | - ), |
|
| 814 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array( |
|
| 815 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
| 816 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
| 817 | - ), |
|
| 818 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array( |
|
| 819 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 820 | - ), |
|
| 821 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array( |
|
| 822 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 823 | - ), |
|
| 824 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array( |
|
| 825 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache |
|
| 826 | - ), |
|
| 827 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array( |
|
| 828 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 829 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 830 | - ), |
|
| 831 | - 'EventEspresso\core\libraries\rest_api\calculations\Event' => array( |
|
| 832 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 833 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 834 | - ), |
|
| 835 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration' => array( |
|
| 836 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 837 | - ), |
|
| 838 | - 'EventEspresso\core\services\session\SessionStartHandler' => array( |
|
| 839 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 840 | - ), |
|
| 841 | - 'EE_URL_Validation_Strategy' => array( |
|
| 842 | - null, |
|
| 843 | - null, |
|
| 844 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache |
|
| 845 | - ), |
|
| 846 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array( |
|
| 847 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 848 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
| 849 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 850 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 851 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
| 852 | - ), |
|
| 853 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => array( |
|
| 854 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 855 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache |
|
| 856 | - ), |
|
| 857 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array( |
|
| 858 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 859 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 860 | - ), |
|
| 861 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array( |
|
| 862 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 863 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 864 | - ), |
|
| 865 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => array( |
|
| 866 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 867 | - ), |
|
| 868 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
| 869 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 870 | - ], |
|
| 871 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
| 872 | - null, |
|
| 873 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 874 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 875 | - ], |
|
| 876 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
| 877 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 878 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 879 | - ], |
|
| 880 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
| 881 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 882 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 883 | - ], |
|
| 884 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
| 885 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 886 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 887 | - ], |
|
| 888 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
| 889 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 890 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 891 | - ], |
|
| 892 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
| 893 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
| 894 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
| 895 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
| 896 | - null |
|
| 897 | - ], |
|
| 898 | - 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' => [ |
|
| 899 | - 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache |
|
| 900 | - ], |
|
| 901 | - 'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorEntityData' => [ |
|
| 902 | - 'EE_Event' => EE_Dependency_Map::not_registered, |
|
| 903 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => EE_Dependency_Map::load_from_cache, |
|
| 904 | - 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
| 905 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 906 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 907 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 908 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 909 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 910 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 911 | - ], |
|
| 912 | - 'EventEspresso\core\services\graphql\GraphQLManager' => [ |
|
| 913 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 914 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 915 | - ], |
|
| 916 | - 'EventEspresso\core\services\graphql\TypesManager' => [ |
|
| 917 | - 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 918 | - ], |
|
| 919 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => [ |
|
| 920 | - 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 921 | - ], |
|
| 922 | - 'EventEspresso\core\domain\services\graphql\types\Datetime' => [ |
|
| 923 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 924 | - ], |
|
| 925 | - 'EventEspresso\core\domain\services\graphql\types\Event' => [ |
|
| 926 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 927 | - ], |
|
| 928 | - 'EventEspresso\core\domain\services\graphql\types\Ticket' => [ |
|
| 929 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 930 | - ], |
|
| 931 | - 'EventEspresso\core\domain\services\graphql\types\Venue' => [ |
|
| 932 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 933 | - ], |
|
| 934 | - 'EventEspresso\core\domain\services\graphql\types\State' => [ |
|
| 935 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 936 | - ], |
|
| 937 | - 'EventEspresso\core\domain\services\graphql\types\Country' => [ |
|
| 938 | - 'EEM_Country' => EE_Dependency_Map::load_from_cache, |
|
| 939 | - ], |
|
| 940 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [ |
|
| 941 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 942 | - ], |
|
| 943 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [ |
|
| 944 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 945 | - ], |
|
| 946 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [ |
|
| 947 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 948 | - ], |
|
| 949 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [ |
|
| 950 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 951 | - ], |
|
| 952 | - ); |
|
| 953 | - } |
|
| 954 | - |
|
| 955 | - |
|
| 956 | - /** |
|
| 957 | - * Registers how core classes are loaded. |
|
| 958 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
| 959 | - * 'EE_Request_Handler' => 'load_core' |
|
| 960 | - * 'EE_Messages_Queue' => 'load_lib' |
|
| 961 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
| 962 | - * or, if greater control is required, by providing a custom closure. For example: |
|
| 963 | - * 'Some_Class' => function () { |
|
| 964 | - * return new Some_Class(); |
|
| 965 | - * }, |
|
| 966 | - * This is required for instantiating dependencies |
|
| 967 | - * where an interface has been type hinted in a class constructor. For example: |
|
| 968 | - * 'Required_Interface' => function () { |
|
| 969 | - * return new A_Class_That_Implements_Required_Interface(); |
|
| 970 | - * }, |
|
| 971 | - */ |
|
| 972 | - protected function _register_core_class_loaders() |
|
| 973 | - { |
|
| 974 | - $this->_class_loaders = array( |
|
| 975 | - // load_core |
|
| 976 | - 'EE_Dependency_Map' => function () { |
|
| 977 | - return $this; |
|
| 978 | - }, |
|
| 979 | - 'EE_Capabilities' => 'load_core', |
|
| 980 | - 'EE_Encryption' => 'load_core', |
|
| 981 | - 'EE_Front_Controller' => 'load_core', |
|
| 982 | - 'EE_Module_Request_Router' => 'load_core', |
|
| 983 | - 'EE_Registry' => 'load_core', |
|
| 984 | - 'EE_Request' => function () { |
|
| 985 | - return $this->legacy_request; |
|
| 986 | - }, |
|
| 987 | - 'EventEspresso\core\services\request\Request' => function () { |
|
| 988 | - return $this->request; |
|
| 989 | - }, |
|
| 990 | - 'EventEspresso\core\services\request\Response' => function () { |
|
| 991 | - return $this->response; |
|
| 992 | - }, |
|
| 993 | - 'EE_Base' => 'load_core', |
|
| 994 | - 'EE_Request_Handler' => 'load_core', |
|
| 995 | - 'EE_Session' => 'load_core', |
|
| 996 | - 'EE_Cron_Tasks' => 'load_core', |
|
| 997 | - 'EE_System' => 'load_core', |
|
| 998 | - 'EE_Maintenance_Mode' => 'load_core', |
|
| 999 | - 'EE_Register_CPTs' => 'load_core', |
|
| 1000 | - 'EE_Admin' => 'load_core', |
|
| 1001 | - 'EE_CPT_Strategy' => 'load_core', |
|
| 1002 | - // load_class |
|
| 1003 | - 'EE_Registration_Processor' => 'load_class', |
|
| 1004 | - // load_lib |
|
| 1005 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
| 1006 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
| 1007 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
| 1008 | - 'EE_Messenger_Collection' => 'load_lib', |
|
| 1009 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
| 1010 | - 'EE_Messages_Processor' => 'load_lib', |
|
| 1011 | - 'EE_Message_Repository' => 'load_lib', |
|
| 1012 | - 'EE_Messages_Queue' => 'load_lib', |
|
| 1013 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
| 1014 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
| 1015 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
| 1016 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
| 1017 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
| 1018 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
| 1019 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
| 1020 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
| 1021 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
| 1022 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
| 1023 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
| 1024 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
| 1025 | - 'EE_Messages_Generator' => static function () { |
|
| 1026 | - return EE_Registry::instance()->load_lib( |
|
| 1027 | - 'Messages_Generator', |
|
| 1028 | - array(), |
|
| 1029 | - false, |
|
| 1030 | - false |
|
| 1031 | - ); |
|
| 1032 | - }, |
|
| 1033 | - 'EE_Messages_Template_Defaults' => static function ($arguments = array()) { |
|
| 1034 | - return EE_Registry::instance()->load_lib( |
|
| 1035 | - 'Messages_Template_Defaults', |
|
| 1036 | - $arguments, |
|
| 1037 | - false, |
|
| 1038 | - false |
|
| 1039 | - ); |
|
| 1040 | - }, |
|
| 1041 | - // load_helper |
|
| 1042 | - 'EEH_Parse_Shortcodes' => static function () { |
|
| 1043 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 1044 | - return new EEH_Parse_Shortcodes(); |
|
| 1045 | - } |
|
| 1046 | - return null; |
|
| 1047 | - }, |
|
| 1048 | - 'EE_Template_Config' => static function () { |
|
| 1049 | - return EE_Config::instance()->template_settings; |
|
| 1050 | - }, |
|
| 1051 | - 'EE_Currency_Config' => static function () { |
|
| 1052 | - return EE_Config::instance()->currency; |
|
| 1053 | - }, |
|
| 1054 | - 'EE_Registration_Config' => static function () { |
|
| 1055 | - return EE_Config::instance()->registration; |
|
| 1056 | - }, |
|
| 1057 | - 'EE_Core_Config' => static function () { |
|
| 1058 | - return EE_Config::instance()->core; |
|
| 1059 | - }, |
|
| 1060 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
| 1061 | - return LoaderFactory::getLoader(); |
|
| 1062 | - }, |
|
| 1063 | - 'EE_Network_Config' => static function () { |
|
| 1064 | - return EE_Network_Config::instance(); |
|
| 1065 | - }, |
|
| 1066 | - 'EE_Config' => static function () { |
|
| 1067 | - return EE_Config::instance(); |
|
| 1068 | - }, |
|
| 1069 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
| 1070 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
| 1071 | - }, |
|
| 1072 | - 'EE_Admin_Config' => static function () { |
|
| 1073 | - return EE_Config::instance()->admin; |
|
| 1074 | - }, |
|
| 1075 | - 'EE_Organization_Config' => static function () { |
|
| 1076 | - return EE_Config::instance()->organization; |
|
| 1077 | - }, |
|
| 1078 | - 'EE_Network_Core_Config' => static function () { |
|
| 1079 | - return EE_Network_Config::instance()->core; |
|
| 1080 | - }, |
|
| 1081 | - 'EE_Environment_Config' => static function () { |
|
| 1082 | - return EE_Config::instance()->environment; |
|
| 1083 | - }, |
|
| 1084 | - 'EED_Core_Rest_Api' => static function () { |
|
| 1085 | - return EED_Core_Rest_Api::instance(); |
|
| 1086 | - }, |
|
| 1087 | - 'WP_REST_Server' => static function () { |
|
| 1088 | - return rest_get_server(); |
|
| 1089 | - }, |
|
| 1090 | - ); |
|
| 1091 | - } |
|
| 1092 | - |
|
| 1093 | - |
|
| 1094 | - /** |
|
| 1095 | - * can be used for supplying alternate names for classes, |
|
| 1096 | - * or for connecting interface names to instantiable classes |
|
| 1097 | - * |
|
| 1098 | - * @throws InvalidAliasException |
|
| 1099 | - */ |
|
| 1100 | - protected function _register_core_aliases() |
|
| 1101 | - { |
|
| 1102 | - $aliases = array( |
|
| 1103 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 1104 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
| 1105 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 1106 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 1107 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
| 1108 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
| 1109 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1110 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
| 1111 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1112 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
| 1113 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
| 1114 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
| 1115 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
| 1116 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
| 1117 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
| 1118 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
| 1119 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
| 1120 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
| 1121 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
| 1122 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
| 1123 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1124 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
| 1125 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1126 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
| 1127 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
| 1128 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
| 1129 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
| 1130 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
| 1131 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
| 1132 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
| 1133 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
| 1134 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
| 1135 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
| 1136 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
| 1137 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
| 1138 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
| 1139 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
| 1140 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
| 1141 | - ); |
|
| 1142 | - foreach ($aliases as $alias => $fqn) { |
|
| 1143 | - if (is_array($fqn)) { |
|
| 1144 | - foreach ($fqn as $class => $for_class) { |
|
| 1145 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
| 1146 | - } |
|
| 1147 | - continue; |
|
| 1148 | - } |
|
| 1149 | - $this->class_cache->addAlias($fqn, $alias); |
|
| 1150 | - } |
|
| 1151 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1152 | - $this->class_cache->addAlias( |
|
| 1153 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
| 1154 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
| 1155 | - ); |
|
| 1156 | - } |
|
| 1157 | - } |
|
| 1158 | - |
|
| 1159 | - |
|
| 1160 | - /** |
|
| 1161 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
| 1162 | - * request Primarily used by unit tests. |
|
| 1163 | - */ |
|
| 1164 | - public function reset() |
|
| 1165 | - { |
|
| 1166 | - $this->_register_core_class_loaders(); |
|
| 1167 | - $this->_register_core_dependencies(); |
|
| 1168 | - } |
|
| 1169 | - |
|
| 1170 | - |
|
| 1171 | - /** |
|
| 1172 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
| 1173 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
| 1174 | - * WHY? |
|
| 1175 | - * Because if a class is type hinting for a concretion, |
|
| 1176 | - * then why would we need to find another class to supply it? |
|
| 1177 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 1178 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 1179 | - * Don't go looking for some substitute. |
|
| 1180 | - * Whereas if a class is type hinting for an interface... |
|
| 1181 | - * then we need to find an actual class to use. |
|
| 1182 | - * So the interface IS the alias for some other FQN, |
|
| 1183 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 1184 | - * represents some other class. |
|
| 1185 | - * |
|
| 1186 | - * @deprecated 4.9.62.p |
|
| 1187 | - * @param string $fqn |
|
| 1188 | - * @param string $for_class |
|
| 1189 | - * @return bool |
|
| 1190 | - */ |
|
| 1191 | - public function has_alias($fqn = '', $for_class = '') |
|
| 1192 | - { |
|
| 1193 | - return $this->isAlias($fqn, $for_class); |
|
| 1194 | - } |
|
| 1195 | - |
|
| 1196 | - |
|
| 1197 | - /** |
|
| 1198 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
| 1199 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 1200 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 1201 | - * for example: |
|
| 1202 | - * if the following two entries were added to the _aliases array: |
|
| 1203 | - * array( |
|
| 1204 | - * 'interface_alias' => 'some\namespace\interface' |
|
| 1205 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 1206 | - * ) |
|
| 1207 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 1208 | - * to load an instance of 'some\namespace\classname' |
|
| 1209 | - * |
|
| 1210 | - * @deprecated 4.9.62.p |
|
| 1211 | - * @param string $alias |
|
| 1212 | - * @param string $for_class |
|
| 1213 | - * @return string |
|
| 1214 | - */ |
|
| 1215 | - public function get_alias($alias = '', $for_class = '') |
|
| 1216 | - { |
|
| 1217 | - return $this->getFqnForAlias($alias, $for_class); |
|
| 1218 | - } |
|
| 24 | + /** |
|
| 25 | + * This means that the requested class dependency is not present in the dependency map |
|
| 26 | + */ |
|
| 27 | + const not_registered = 0; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
| 31 | + */ |
|
| 32 | + const load_new_object = 1; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
| 36 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
| 37 | + */ |
|
| 38 | + const load_from_cache = 2; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * When registering a dependency, |
|
| 42 | + * this indicates to keep any existing dependencies that already exist, |
|
| 43 | + * and simply discard any new dependencies declared in the incoming data |
|
| 44 | + */ |
|
| 45 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * When registering a dependency, |
|
| 49 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
| 50 | + */ |
|
| 51 | + const OVERWRITE_DEPENDENCIES = 1; |
|
| 52 | + |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @type EE_Dependency_Map $_instance |
|
| 56 | + */ |
|
| 57 | + protected static $_instance; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @var ClassInterfaceCache $class_cache |
|
| 61 | + */ |
|
| 62 | + private $class_cache; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @type RequestInterface $request |
|
| 66 | + */ |
|
| 67 | + protected $request; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @type LegacyRequestInterface $legacy_request |
|
| 71 | + */ |
|
| 72 | + protected $legacy_request; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @type ResponseInterface $response |
|
| 76 | + */ |
|
| 77 | + protected $response; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @type LoaderInterface $loader |
|
| 81 | + */ |
|
| 82 | + protected $loader; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @type array $_dependency_map |
|
| 86 | + */ |
|
| 87 | + protected $_dependency_map = array(); |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @type array $_class_loaders |
|
| 91 | + */ |
|
| 92 | + protected $_class_loaders = array(); |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * EE_Dependency_Map constructor. |
|
| 97 | + * |
|
| 98 | + * @param ClassInterfaceCache $class_cache |
|
| 99 | + */ |
|
| 100 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
| 101 | + { |
|
| 102 | + $this->class_cache = $class_cache; |
|
| 103 | + do_action('EE_Dependency_Map____construct', $this); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @return void |
|
| 109 | + * @throws EE_Error |
|
| 110 | + * @throws InvalidAliasException |
|
| 111 | + */ |
|
| 112 | + public function initialize() |
|
| 113 | + { |
|
| 114 | + $this->_register_core_dependencies(); |
|
| 115 | + $this->_register_core_class_loaders(); |
|
| 116 | + $this->_register_core_aliases(); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @singleton method used to instantiate class object |
|
| 122 | + * @param ClassInterfaceCache|null $class_cache |
|
| 123 | + * @return EE_Dependency_Map |
|
| 124 | + */ |
|
| 125 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
| 126 | + { |
|
| 127 | + // check if class object is instantiated, and instantiated properly |
|
| 128 | + if (! self::$_instance instanceof EE_Dependency_Map |
|
| 129 | + && $class_cache instanceof ClassInterfaceCache |
|
| 130 | + ) { |
|
| 131 | + self::$_instance = new EE_Dependency_Map($class_cache); |
|
| 132 | + } |
|
| 133 | + return self::$_instance; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @param RequestInterface $request |
|
| 139 | + */ |
|
| 140 | + public function setRequest(RequestInterface $request) |
|
| 141 | + { |
|
| 142 | + $this->request = $request; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * @param LegacyRequestInterface $legacy_request |
|
| 148 | + */ |
|
| 149 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
| 150 | + { |
|
| 151 | + $this->legacy_request = $legacy_request; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * @param ResponseInterface $response |
|
| 157 | + */ |
|
| 158 | + public function setResponse(ResponseInterface $response) |
|
| 159 | + { |
|
| 160 | + $this->response = $response; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * @param LoaderInterface $loader |
|
| 166 | + */ |
|
| 167 | + public function setLoader(LoaderInterface $loader) |
|
| 168 | + { |
|
| 169 | + $this->loader = $loader; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param string $class |
|
| 175 | + * @param array $dependencies |
|
| 176 | + * @param int $overwrite |
|
| 177 | + * @return bool |
|
| 178 | + */ |
|
| 179 | + public static function register_dependencies( |
|
| 180 | + $class, |
|
| 181 | + array $dependencies, |
|
| 182 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 183 | + ) { |
|
| 184 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
| 190 | + * to the class specified by the first parameter. |
|
| 191 | + * IMPORTANT !!! |
|
| 192 | + * The order of elements in the incoming $dependencies array MUST match |
|
| 193 | + * the order of the constructor parameters for the class in question. |
|
| 194 | + * This is especially important when overriding any existing dependencies that are registered. |
|
| 195 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
| 196 | + * |
|
| 197 | + * @param string $class |
|
| 198 | + * @param array $dependencies |
|
| 199 | + * @param int $overwrite |
|
| 200 | + * @return bool |
|
| 201 | + */ |
|
| 202 | + public function registerDependencies( |
|
| 203 | + $class, |
|
| 204 | + array $dependencies, |
|
| 205 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 206 | + ) { |
|
| 207 | + $class = trim($class, '\\'); |
|
| 208 | + $registered = false; |
|
| 209 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 210 | + self::$_instance->_dependency_map[ $class ] = array(); |
|
| 211 | + } |
|
| 212 | + // we need to make sure that any aliases used when registering a dependency |
|
| 213 | + // get resolved to the correct class name |
|
| 214 | + foreach ($dependencies as $dependency => $load_source) { |
|
| 215 | + $alias = self::$_instance->getFqnForAlias($dependency); |
|
| 216 | + if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
| 217 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 218 | + ) { |
|
| 219 | + unset($dependencies[ $dependency ]); |
|
| 220 | + $dependencies[ $alias ] = $load_source; |
|
| 221 | + $registered = true; |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + // now add our two lists of dependencies together. |
|
| 225 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
| 226 | + // so $dependencies is NOT overwritten because it is listed first |
|
| 227 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
| 228 | + // Union is way faster than array_merge() but should be used with caution... |
|
| 229 | + // especially with numerically indexed arrays |
|
| 230 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 231 | + // now we need to ensure that the resulting dependencies |
|
| 232 | + // array only has the entries that are required for the class |
|
| 233 | + // so first count how many dependencies were originally registered for the class |
|
| 234 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 235 | + // if that count is non-zero (meaning dependencies were already registered) |
|
| 236 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 237 | + // then truncate the final array to match that count |
|
| 238 | + ? array_slice($dependencies, 0, $dependency_count) |
|
| 239 | + // otherwise just take the incoming array because nothing previously existed |
|
| 240 | + : $dependencies; |
|
| 241 | + return $registered; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * @param string $class_name |
|
| 247 | + * @param string $loader |
|
| 248 | + * @return bool |
|
| 249 | + * @throws DomainException |
|
| 250 | + */ |
|
| 251 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
| 252 | + { |
|
| 253 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 254 | + throw new DomainException( |
|
| 255 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
| 256 | + ); |
|
| 257 | + } |
|
| 258 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
| 259 | + if (! is_callable($loader) |
|
| 260 | + && ( |
|
| 261 | + strpos($loader, 'load_') !== 0 |
|
| 262 | + || ! method_exists('EE_Registry', $loader) |
|
| 263 | + ) |
|
| 264 | + ) { |
|
| 265 | + throw new DomainException( |
|
| 266 | + sprintf( |
|
| 267 | + esc_html__( |
|
| 268 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
| 269 | + 'event_espresso' |
|
| 270 | + ), |
|
| 271 | + $loader |
|
| 272 | + ) |
|
| 273 | + ); |
|
| 274 | + } |
|
| 275 | + $class_name = self::$_instance->getFqnForAlias($class_name); |
|
| 276 | + if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 277 | + self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 278 | + return true; |
|
| 279 | + } |
|
| 280 | + return false; |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * @return array |
|
| 286 | + */ |
|
| 287 | + public function dependency_map() |
|
| 288 | + { |
|
| 289 | + return $this->_dependency_map; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
| 295 | + * |
|
| 296 | + * @param string $class_name |
|
| 297 | + * @return boolean |
|
| 298 | + */ |
|
| 299 | + public function has($class_name = '') |
|
| 300 | + { |
|
| 301 | + // all legacy models have the same dependencies |
|
| 302 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 303 | + $class_name = 'LEGACY_MODELS'; |
|
| 304 | + } |
|
| 305 | + return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + |
|
| 309 | + /** |
|
| 310 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
| 311 | + * |
|
| 312 | + * @param string $class_name |
|
| 313 | + * @param string $dependency |
|
| 314 | + * @return bool |
|
| 315 | + */ |
|
| 316 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
| 317 | + { |
|
| 318 | + // all legacy models have the same dependencies |
|
| 319 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 320 | + $class_name = 'LEGACY_MODELS'; |
|
| 321 | + } |
|
| 322 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
| 323 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 324 | + ? true |
|
| 325 | + : false; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
| 331 | + * |
|
| 332 | + * @param string $class_name |
|
| 333 | + * @param string $dependency |
|
| 334 | + * @return int |
|
| 335 | + */ |
|
| 336 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
| 337 | + { |
|
| 338 | + // all legacy models have the same dependencies |
|
| 339 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 340 | + $class_name = 'LEGACY_MODELS'; |
|
| 341 | + } |
|
| 342 | + $dependency = $this->getFqnForAlias($dependency); |
|
| 343 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
| 344 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 345 | + : EE_Dependency_Map::not_registered; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + |
|
| 349 | + /** |
|
| 350 | + * @param string $class_name |
|
| 351 | + * @return string | Closure |
|
| 352 | + */ |
|
| 353 | + public function class_loader($class_name) |
|
| 354 | + { |
|
| 355 | + // all legacy models use load_model() |
|
| 356 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 357 | + return 'load_model'; |
|
| 358 | + } |
|
| 359 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
| 360 | + // perform strpos() first to avoid loading regex every time we load a class |
|
| 361 | + if (strpos($class_name, 'EE_CPT_') === 0 |
|
| 362 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
| 363 | + ) { |
|
| 364 | + return 'load_core'; |
|
| 365 | + } |
|
| 366 | + $class_name = $this->getFqnForAlias($class_name); |
|
| 367 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 368 | + } |
|
| 369 | + |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * @return array |
|
| 373 | + */ |
|
| 374 | + public function class_loaders() |
|
| 375 | + { |
|
| 376 | + return $this->_class_loaders; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * adds an alias for a classname |
|
| 382 | + * |
|
| 383 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
| 384 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
| 385 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
| 386 | + * @throws InvalidAliasException |
|
| 387 | + */ |
|
| 388 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
| 389 | + { |
|
| 390 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
| 391 | + } |
|
| 392 | + |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
| 396 | + * WHY? |
|
| 397 | + * Because if a class is type hinting for a concretion, |
|
| 398 | + * then why would we need to find another class to supply it? |
|
| 399 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 400 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 401 | + * Don't go looking for some substitute. |
|
| 402 | + * Whereas if a class is type hinting for an interface... |
|
| 403 | + * then we need to find an actual class to use. |
|
| 404 | + * So the interface IS the alias for some other FQN, |
|
| 405 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 406 | + * represents some other class. |
|
| 407 | + * |
|
| 408 | + * @param string $fqn |
|
| 409 | + * @param string $for_class |
|
| 410 | + * @return bool |
|
| 411 | + */ |
|
| 412 | + public function isAlias($fqn = '', $for_class = '') |
|
| 413 | + { |
|
| 414 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + |
|
| 418 | + /** |
|
| 419 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 420 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 421 | + * for example: |
|
| 422 | + * if the following two entries were added to the _aliases array: |
|
| 423 | + * array( |
|
| 424 | + * 'interface_alias' => 'some\namespace\interface' |
|
| 425 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 426 | + * ) |
|
| 427 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 428 | + * to load an instance of 'some\namespace\classname' |
|
| 429 | + * |
|
| 430 | + * @param string $alias |
|
| 431 | + * @param string $for_class |
|
| 432 | + * @return string |
|
| 433 | + */ |
|
| 434 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
| 435 | + { |
|
| 436 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
| 442 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
| 443 | + * This is done by using the following class constants: |
|
| 444 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
| 445 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
| 446 | + */ |
|
| 447 | + protected function _register_core_dependencies() |
|
| 448 | + { |
|
| 449 | + $this->_dependency_map = array( |
|
| 450 | + 'EE_Request_Handler' => array( |
|
| 451 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 452 | + ), |
|
| 453 | + 'EE_System' => array( |
|
| 454 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 455 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 456 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 457 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 458 | + ), |
|
| 459 | + 'EE_Session' => array( |
|
| 460 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 461 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 462 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 463 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 464 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 465 | + ), |
|
| 466 | + 'EE_Cart' => array( |
|
| 467 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 468 | + ), |
|
| 469 | + 'EE_Front_Controller' => array( |
|
| 470 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 471 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 472 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
| 473 | + ), |
|
| 474 | + 'EE_Messenger_Collection_Loader' => array( |
|
| 475 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
| 476 | + ), |
|
| 477 | + 'EE_Message_Type_Collection_Loader' => array( |
|
| 478 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
| 479 | + ), |
|
| 480 | + 'EE_Message_Resource_Manager' => array( |
|
| 481 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 482 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 483 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 484 | + ), |
|
| 485 | + 'EE_Message_Factory' => array( |
|
| 486 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 487 | + ), |
|
| 488 | + 'EE_messages' => array( |
|
| 489 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 490 | + ), |
|
| 491 | + 'EE_Messages_Generator' => array( |
|
| 492 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
| 493 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
| 494 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
| 495 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
| 496 | + ), |
|
| 497 | + 'EE_Messages_Processor' => array( |
|
| 498 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 499 | + ), |
|
| 500 | + 'EE_Messages_Queue' => array( |
|
| 501 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
| 502 | + ), |
|
| 503 | + 'EE_Messages_Template_Defaults' => array( |
|
| 504 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 505 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
| 506 | + ), |
|
| 507 | + 'EE_Message_To_Generate_From_Request' => array( |
|
| 508 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 509 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 510 | + ), |
|
| 511 | + 'EventEspresso\core\services\commands\CommandBus' => array( |
|
| 512 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
| 513 | + ), |
|
| 514 | + 'EventEspresso\services\commands\CommandHandler' => array( |
|
| 515 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 516 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
| 517 | + ), |
|
| 518 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
| 519 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 520 | + ), |
|
| 521 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
| 522 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
| 523 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
| 524 | + ), |
|
| 525 | + 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
| 526 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 527 | + ), |
|
| 528 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
| 529 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 530 | + ), |
|
| 531 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
| 532 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 533 | + ), |
|
| 534 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
| 535 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 536 | + ), |
|
| 537 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
| 538 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 539 | + ), |
|
| 540 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
| 541 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 542 | + ), |
|
| 543 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
| 544 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 545 | + ), |
|
| 546 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
| 547 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 548 | + ), |
|
| 549 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
| 550 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 551 | + ), |
|
| 552 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
| 553 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 554 | + ), |
|
| 555 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
| 556 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 557 | + ), |
|
| 558 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
| 559 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 560 | + ), |
|
| 561 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
| 562 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 563 | + ), |
|
| 564 | + 'EventEspresso\core\services\database\TableManager' => array( |
|
| 565 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 566 | + ), |
|
| 567 | + 'EE_Data_Migration_Class_Base' => array( |
|
| 568 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 569 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 570 | + ), |
|
| 571 | + 'EE_DMS_Core_4_1_0' => array( |
|
| 572 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 573 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 574 | + ), |
|
| 575 | + 'EE_DMS_Core_4_2_0' => array( |
|
| 576 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 577 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 578 | + ), |
|
| 579 | + 'EE_DMS_Core_4_3_0' => array( |
|
| 580 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 581 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 582 | + ), |
|
| 583 | + 'EE_DMS_Core_4_4_0' => array( |
|
| 584 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 585 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 586 | + ), |
|
| 587 | + 'EE_DMS_Core_4_5_0' => array( |
|
| 588 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 589 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 590 | + ), |
|
| 591 | + 'EE_DMS_Core_4_6_0' => array( |
|
| 592 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 593 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 594 | + ), |
|
| 595 | + 'EE_DMS_Core_4_7_0' => array( |
|
| 596 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 597 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 598 | + ), |
|
| 599 | + 'EE_DMS_Core_4_8_0' => array( |
|
| 600 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 601 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 602 | + ), |
|
| 603 | + 'EE_DMS_Core_4_9_0' => array( |
|
| 604 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 605 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 606 | + ), |
|
| 607 | + 'EE_DMS_Core_4_10_0' => array( |
|
| 608 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 609 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 610 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
| 611 | + ), |
|
| 612 | + 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
| 613 | + array(), |
|
| 614 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 615 | + ), |
|
| 616 | + 'EventEspresso\core\services\assets\Registry' => array( |
|
| 617 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 618 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
| 619 | + ), |
|
| 620 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
| 621 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 622 | + ), |
|
| 623 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
| 624 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 625 | + ), |
|
| 626 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
| 627 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 628 | + ), |
|
| 629 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
| 630 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 631 | + ), |
|
| 632 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
| 633 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 634 | + ), |
|
| 635 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
| 636 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 637 | + ), |
|
| 638 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
| 639 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 640 | + ), |
|
| 641 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
| 642 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 643 | + ), |
|
| 644 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
| 645 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 646 | + ), |
|
| 647 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
| 648 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 649 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 650 | + ), |
|
| 651 | + 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
| 652 | + null, |
|
| 653 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
| 654 | + ), |
|
| 655 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
| 656 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 657 | + ), |
|
| 658 | + 'LEGACY_MODELS' => array( |
|
| 659 | + null, |
|
| 660 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
| 661 | + ), |
|
| 662 | + 'EE_Module_Request_Router' => array( |
|
| 663 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 664 | + ), |
|
| 665 | + 'EE_Registration_Processor' => array( |
|
| 666 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 667 | + ), |
|
| 668 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
| 669 | + null, |
|
| 670 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 671 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 672 | + ), |
|
| 673 | + 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
| 674 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
| 675 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 676 | + ), |
|
| 677 | + 'EE_Admin_Transactions_List_Table' => array( |
|
| 678 | + null, |
|
| 679 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 680 | + ), |
|
| 681 | + 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
| 682 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 683 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 684 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
| 685 | + ), |
|
| 686 | + 'EventEspresso\core\domain\services\pue\Config' => array( |
|
| 687 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
| 688 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 689 | + ), |
|
| 690 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
| 691 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 692 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 693 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 694 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 695 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 696 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 697 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 698 | + ), |
|
| 699 | + 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
| 700 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 701 | + ), |
|
| 702 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
| 703 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 704 | + ), |
|
| 705 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
| 706 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 707 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 708 | + ), |
|
| 709 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
| 710 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 711 | + ), |
|
| 712 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
| 713 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 714 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 715 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 716 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 717 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
| 718 | + ), |
|
| 719 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
| 720 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 721 | + ), |
|
| 722 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
| 723 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 724 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 725 | + ), |
|
| 726 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
| 727 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 728 | + ), |
|
| 729 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
| 730 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 731 | + ), |
|
| 732 | + 'EE_CPT_Strategy' => array( |
|
| 733 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 734 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 735 | + ), |
|
| 736 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
| 737 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 738 | + ), |
|
| 739 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager' => array( |
|
| 740 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 741 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 742 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 743 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 744 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 745 | + ), |
|
| 746 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
| 747 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 748 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
| 749 | + ), |
|
| 750 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array( |
|
| 751 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 752 | + ), |
|
| 753 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array( |
|
| 754 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 755 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache |
|
| 756 | + ), |
|
| 757 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array( |
|
| 758 | + 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
| 759 | + ), |
|
| 760 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array( |
|
| 761 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 762 | + ), |
|
| 763 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array( |
|
| 764 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 765 | + ), |
|
| 766 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array( |
|
| 767 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 768 | + ), |
|
| 769 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array( |
|
| 770 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
| 771 | + 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
| 772 | + ), |
|
| 773 | + 'EventEspresso\core\CPTs\CptQueryModifier' => array( |
|
| 774 | + null, |
|
| 775 | + null, |
|
| 776 | + null, |
|
| 777 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 778 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 779 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 780 | + ), |
|
| 781 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array( |
|
| 782 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 783 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
| 784 | + ), |
|
| 785 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
| 786 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 787 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 788 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 789 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 790 | + ), |
|
| 791 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array( |
|
| 792 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 793 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 794 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 795 | + ), |
|
| 796 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array( |
|
| 797 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 798 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 799 | + ), |
|
| 800 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array( |
|
| 801 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
| 802 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 803 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
| 804 | + ), |
|
| 805 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array( |
|
| 806 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
| 807 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 808 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 809 | + ), |
|
| 810 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array( |
|
| 811 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
| 812 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 813 | + ), |
|
| 814 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array( |
|
| 815 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
| 816 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
| 817 | + ), |
|
| 818 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array( |
|
| 819 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 820 | + ), |
|
| 821 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array( |
|
| 822 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 823 | + ), |
|
| 824 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array( |
|
| 825 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache |
|
| 826 | + ), |
|
| 827 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array( |
|
| 828 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 829 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 830 | + ), |
|
| 831 | + 'EventEspresso\core\libraries\rest_api\calculations\Event' => array( |
|
| 832 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 833 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 834 | + ), |
|
| 835 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration' => array( |
|
| 836 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 837 | + ), |
|
| 838 | + 'EventEspresso\core\services\session\SessionStartHandler' => array( |
|
| 839 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 840 | + ), |
|
| 841 | + 'EE_URL_Validation_Strategy' => array( |
|
| 842 | + null, |
|
| 843 | + null, |
|
| 844 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache |
|
| 845 | + ), |
|
| 846 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array( |
|
| 847 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 848 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
| 849 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 850 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 851 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
| 852 | + ), |
|
| 853 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => array( |
|
| 854 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 855 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache |
|
| 856 | + ), |
|
| 857 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array( |
|
| 858 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 859 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 860 | + ), |
|
| 861 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array( |
|
| 862 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 863 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 864 | + ), |
|
| 865 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => array( |
|
| 866 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 867 | + ), |
|
| 868 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
| 869 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 870 | + ], |
|
| 871 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
| 872 | + null, |
|
| 873 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 874 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 875 | + ], |
|
| 876 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
| 877 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 878 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 879 | + ], |
|
| 880 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
| 881 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 882 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 883 | + ], |
|
| 884 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
| 885 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 886 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 887 | + ], |
|
| 888 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
| 889 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 890 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 891 | + ], |
|
| 892 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
| 893 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
| 894 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
| 895 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
| 896 | + null |
|
| 897 | + ], |
|
| 898 | + 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' => [ |
|
| 899 | + 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache |
|
| 900 | + ], |
|
| 901 | + 'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorEntityData' => [ |
|
| 902 | + 'EE_Event' => EE_Dependency_Map::not_registered, |
|
| 903 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => EE_Dependency_Map::load_from_cache, |
|
| 904 | + 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
| 905 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 906 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 907 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 908 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 909 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 910 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 911 | + ], |
|
| 912 | + 'EventEspresso\core\services\graphql\GraphQLManager' => [ |
|
| 913 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 914 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 915 | + ], |
|
| 916 | + 'EventEspresso\core\services\graphql\TypesManager' => [ |
|
| 917 | + 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 918 | + ], |
|
| 919 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => [ |
|
| 920 | + 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 921 | + ], |
|
| 922 | + 'EventEspresso\core\domain\services\graphql\types\Datetime' => [ |
|
| 923 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 924 | + ], |
|
| 925 | + 'EventEspresso\core\domain\services\graphql\types\Event' => [ |
|
| 926 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 927 | + ], |
|
| 928 | + 'EventEspresso\core\domain\services\graphql\types\Ticket' => [ |
|
| 929 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 930 | + ], |
|
| 931 | + 'EventEspresso\core\domain\services\graphql\types\Venue' => [ |
|
| 932 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 933 | + ], |
|
| 934 | + 'EventEspresso\core\domain\services\graphql\types\State' => [ |
|
| 935 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 936 | + ], |
|
| 937 | + 'EventEspresso\core\domain\services\graphql\types\Country' => [ |
|
| 938 | + 'EEM_Country' => EE_Dependency_Map::load_from_cache, |
|
| 939 | + ], |
|
| 940 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [ |
|
| 941 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 942 | + ], |
|
| 943 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [ |
|
| 944 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 945 | + ], |
|
| 946 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [ |
|
| 947 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 948 | + ], |
|
| 949 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [ |
|
| 950 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 951 | + ], |
|
| 952 | + ); |
|
| 953 | + } |
|
| 954 | + |
|
| 955 | + |
|
| 956 | + /** |
|
| 957 | + * Registers how core classes are loaded. |
|
| 958 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
| 959 | + * 'EE_Request_Handler' => 'load_core' |
|
| 960 | + * 'EE_Messages_Queue' => 'load_lib' |
|
| 961 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
| 962 | + * or, if greater control is required, by providing a custom closure. For example: |
|
| 963 | + * 'Some_Class' => function () { |
|
| 964 | + * return new Some_Class(); |
|
| 965 | + * }, |
|
| 966 | + * This is required for instantiating dependencies |
|
| 967 | + * where an interface has been type hinted in a class constructor. For example: |
|
| 968 | + * 'Required_Interface' => function () { |
|
| 969 | + * return new A_Class_That_Implements_Required_Interface(); |
|
| 970 | + * }, |
|
| 971 | + */ |
|
| 972 | + protected function _register_core_class_loaders() |
|
| 973 | + { |
|
| 974 | + $this->_class_loaders = array( |
|
| 975 | + // load_core |
|
| 976 | + 'EE_Dependency_Map' => function () { |
|
| 977 | + return $this; |
|
| 978 | + }, |
|
| 979 | + 'EE_Capabilities' => 'load_core', |
|
| 980 | + 'EE_Encryption' => 'load_core', |
|
| 981 | + 'EE_Front_Controller' => 'load_core', |
|
| 982 | + 'EE_Module_Request_Router' => 'load_core', |
|
| 983 | + 'EE_Registry' => 'load_core', |
|
| 984 | + 'EE_Request' => function () { |
|
| 985 | + return $this->legacy_request; |
|
| 986 | + }, |
|
| 987 | + 'EventEspresso\core\services\request\Request' => function () { |
|
| 988 | + return $this->request; |
|
| 989 | + }, |
|
| 990 | + 'EventEspresso\core\services\request\Response' => function () { |
|
| 991 | + return $this->response; |
|
| 992 | + }, |
|
| 993 | + 'EE_Base' => 'load_core', |
|
| 994 | + 'EE_Request_Handler' => 'load_core', |
|
| 995 | + 'EE_Session' => 'load_core', |
|
| 996 | + 'EE_Cron_Tasks' => 'load_core', |
|
| 997 | + 'EE_System' => 'load_core', |
|
| 998 | + 'EE_Maintenance_Mode' => 'load_core', |
|
| 999 | + 'EE_Register_CPTs' => 'load_core', |
|
| 1000 | + 'EE_Admin' => 'load_core', |
|
| 1001 | + 'EE_CPT_Strategy' => 'load_core', |
|
| 1002 | + // load_class |
|
| 1003 | + 'EE_Registration_Processor' => 'load_class', |
|
| 1004 | + // load_lib |
|
| 1005 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
| 1006 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
| 1007 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
| 1008 | + 'EE_Messenger_Collection' => 'load_lib', |
|
| 1009 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
| 1010 | + 'EE_Messages_Processor' => 'load_lib', |
|
| 1011 | + 'EE_Message_Repository' => 'load_lib', |
|
| 1012 | + 'EE_Messages_Queue' => 'load_lib', |
|
| 1013 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
| 1014 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
| 1015 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
| 1016 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
| 1017 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
| 1018 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
| 1019 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
| 1020 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
| 1021 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
| 1022 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
| 1023 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
| 1024 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
| 1025 | + 'EE_Messages_Generator' => static function () { |
|
| 1026 | + return EE_Registry::instance()->load_lib( |
|
| 1027 | + 'Messages_Generator', |
|
| 1028 | + array(), |
|
| 1029 | + false, |
|
| 1030 | + false |
|
| 1031 | + ); |
|
| 1032 | + }, |
|
| 1033 | + 'EE_Messages_Template_Defaults' => static function ($arguments = array()) { |
|
| 1034 | + return EE_Registry::instance()->load_lib( |
|
| 1035 | + 'Messages_Template_Defaults', |
|
| 1036 | + $arguments, |
|
| 1037 | + false, |
|
| 1038 | + false |
|
| 1039 | + ); |
|
| 1040 | + }, |
|
| 1041 | + // load_helper |
|
| 1042 | + 'EEH_Parse_Shortcodes' => static function () { |
|
| 1043 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 1044 | + return new EEH_Parse_Shortcodes(); |
|
| 1045 | + } |
|
| 1046 | + return null; |
|
| 1047 | + }, |
|
| 1048 | + 'EE_Template_Config' => static function () { |
|
| 1049 | + return EE_Config::instance()->template_settings; |
|
| 1050 | + }, |
|
| 1051 | + 'EE_Currency_Config' => static function () { |
|
| 1052 | + return EE_Config::instance()->currency; |
|
| 1053 | + }, |
|
| 1054 | + 'EE_Registration_Config' => static function () { |
|
| 1055 | + return EE_Config::instance()->registration; |
|
| 1056 | + }, |
|
| 1057 | + 'EE_Core_Config' => static function () { |
|
| 1058 | + return EE_Config::instance()->core; |
|
| 1059 | + }, |
|
| 1060 | + 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
| 1061 | + return LoaderFactory::getLoader(); |
|
| 1062 | + }, |
|
| 1063 | + 'EE_Network_Config' => static function () { |
|
| 1064 | + return EE_Network_Config::instance(); |
|
| 1065 | + }, |
|
| 1066 | + 'EE_Config' => static function () { |
|
| 1067 | + return EE_Config::instance(); |
|
| 1068 | + }, |
|
| 1069 | + 'EventEspresso\core\domain\Domain' => static function () { |
|
| 1070 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
| 1071 | + }, |
|
| 1072 | + 'EE_Admin_Config' => static function () { |
|
| 1073 | + return EE_Config::instance()->admin; |
|
| 1074 | + }, |
|
| 1075 | + 'EE_Organization_Config' => static function () { |
|
| 1076 | + return EE_Config::instance()->organization; |
|
| 1077 | + }, |
|
| 1078 | + 'EE_Network_Core_Config' => static function () { |
|
| 1079 | + return EE_Network_Config::instance()->core; |
|
| 1080 | + }, |
|
| 1081 | + 'EE_Environment_Config' => static function () { |
|
| 1082 | + return EE_Config::instance()->environment; |
|
| 1083 | + }, |
|
| 1084 | + 'EED_Core_Rest_Api' => static function () { |
|
| 1085 | + return EED_Core_Rest_Api::instance(); |
|
| 1086 | + }, |
|
| 1087 | + 'WP_REST_Server' => static function () { |
|
| 1088 | + return rest_get_server(); |
|
| 1089 | + }, |
|
| 1090 | + ); |
|
| 1091 | + } |
|
| 1092 | + |
|
| 1093 | + |
|
| 1094 | + /** |
|
| 1095 | + * can be used for supplying alternate names for classes, |
|
| 1096 | + * or for connecting interface names to instantiable classes |
|
| 1097 | + * |
|
| 1098 | + * @throws InvalidAliasException |
|
| 1099 | + */ |
|
| 1100 | + protected function _register_core_aliases() |
|
| 1101 | + { |
|
| 1102 | + $aliases = array( |
|
| 1103 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 1104 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
| 1105 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 1106 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 1107 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
| 1108 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
| 1109 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1110 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
| 1111 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1112 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
| 1113 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
| 1114 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
| 1115 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
| 1116 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
| 1117 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
| 1118 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
| 1119 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
| 1120 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
| 1121 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
| 1122 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
| 1123 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1124 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
| 1125 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1126 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
| 1127 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
| 1128 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
| 1129 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
| 1130 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
| 1131 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
| 1132 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
| 1133 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
| 1134 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
| 1135 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
| 1136 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
| 1137 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
| 1138 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
| 1139 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
| 1140 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
| 1141 | + ); |
|
| 1142 | + foreach ($aliases as $alias => $fqn) { |
|
| 1143 | + if (is_array($fqn)) { |
|
| 1144 | + foreach ($fqn as $class => $for_class) { |
|
| 1145 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
| 1146 | + } |
|
| 1147 | + continue; |
|
| 1148 | + } |
|
| 1149 | + $this->class_cache->addAlias($fqn, $alias); |
|
| 1150 | + } |
|
| 1151 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1152 | + $this->class_cache->addAlias( |
|
| 1153 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
| 1154 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
| 1155 | + ); |
|
| 1156 | + } |
|
| 1157 | + } |
|
| 1158 | + |
|
| 1159 | + |
|
| 1160 | + /** |
|
| 1161 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
| 1162 | + * request Primarily used by unit tests. |
|
| 1163 | + */ |
|
| 1164 | + public function reset() |
|
| 1165 | + { |
|
| 1166 | + $this->_register_core_class_loaders(); |
|
| 1167 | + $this->_register_core_dependencies(); |
|
| 1168 | + } |
|
| 1169 | + |
|
| 1170 | + |
|
| 1171 | + /** |
|
| 1172 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
| 1173 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
| 1174 | + * WHY? |
|
| 1175 | + * Because if a class is type hinting for a concretion, |
|
| 1176 | + * then why would we need to find another class to supply it? |
|
| 1177 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 1178 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 1179 | + * Don't go looking for some substitute. |
|
| 1180 | + * Whereas if a class is type hinting for an interface... |
|
| 1181 | + * then we need to find an actual class to use. |
|
| 1182 | + * So the interface IS the alias for some other FQN, |
|
| 1183 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 1184 | + * represents some other class. |
|
| 1185 | + * |
|
| 1186 | + * @deprecated 4.9.62.p |
|
| 1187 | + * @param string $fqn |
|
| 1188 | + * @param string $for_class |
|
| 1189 | + * @return bool |
|
| 1190 | + */ |
|
| 1191 | + public function has_alias($fqn = '', $for_class = '') |
|
| 1192 | + { |
|
| 1193 | + return $this->isAlias($fqn, $for_class); |
|
| 1194 | + } |
|
| 1195 | + |
|
| 1196 | + |
|
| 1197 | + /** |
|
| 1198 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
| 1199 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 1200 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 1201 | + * for example: |
|
| 1202 | + * if the following two entries were added to the _aliases array: |
|
| 1203 | + * array( |
|
| 1204 | + * 'interface_alias' => 'some\namespace\interface' |
|
| 1205 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 1206 | + * ) |
|
| 1207 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 1208 | + * to load an instance of 'some\namespace\classname' |
|
| 1209 | + * |
|
| 1210 | + * @deprecated 4.9.62.p |
|
| 1211 | + * @param string $alias |
|
| 1212 | + * @param string $for_class |
|
| 1213 | + * @return string |
|
| 1214 | + */ |
|
| 1215 | + public function get_alias($alias = '', $for_class = '') |
|
| 1216 | + { |
|
| 1217 | + return $this->getFqnForAlias($alias, $for_class); |
|
| 1218 | + } |
|
| 1219 | 1219 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public static function instance(ClassInterfaceCache $class_cache = null) |
| 126 | 126 | { |
| 127 | 127 | // check if class object is instantiated, and instantiated properly |
| 128 | - if (! self::$_instance instanceof EE_Dependency_Map |
|
| 128 | + if ( ! self::$_instance instanceof EE_Dependency_Map |
|
| 129 | 129 | && $class_cache instanceof ClassInterfaceCache |
| 130 | 130 | ) { |
| 131 | 131 | self::$_instance = new EE_Dependency_Map($class_cache); |
@@ -206,18 +206,18 @@ discard block |
||
| 206 | 206 | ) { |
| 207 | 207 | $class = trim($class, '\\'); |
| 208 | 208 | $registered = false; |
| 209 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 210 | - self::$_instance->_dependency_map[ $class ] = array(); |
|
| 209 | + if (empty(self::$_instance->_dependency_map[$class])) { |
|
| 210 | + self::$_instance->_dependency_map[$class] = array(); |
|
| 211 | 211 | } |
| 212 | 212 | // we need to make sure that any aliases used when registering a dependency |
| 213 | 213 | // get resolved to the correct class name |
| 214 | 214 | foreach ($dependencies as $dependency => $load_source) { |
| 215 | 215 | $alias = self::$_instance->getFqnForAlias($dependency); |
| 216 | 216 | if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
| 217 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 217 | + || ! isset(self::$_instance->_dependency_map[$class][$alias]) |
|
| 218 | 218 | ) { |
| 219 | - unset($dependencies[ $dependency ]); |
|
| 220 | - $dependencies[ $alias ] = $load_source; |
|
| 219 | + unset($dependencies[$dependency]); |
|
| 220 | + $dependencies[$alias] = $load_source; |
|
| 221 | 221 | $registered = true; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
| 228 | 228 | // Union is way faster than array_merge() but should be used with caution... |
| 229 | 229 | // especially with numerically indexed arrays |
| 230 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 230 | + $dependencies += self::$_instance->_dependency_map[$class]; |
|
| 231 | 231 | // now we need to ensure that the resulting dependencies |
| 232 | 232 | // array only has the entries that are required for the class |
| 233 | 233 | // so first count how many dependencies were originally registered for the class |
| 234 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 234 | + $dependency_count = count(self::$_instance->_dependency_map[$class]); |
|
| 235 | 235 | // if that count is non-zero (meaning dependencies were already registered) |
| 236 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 236 | + self::$_instance->_dependency_map[$class] = $dependency_count |
|
| 237 | 237 | // then truncate the final array to match that count |
| 238 | 238 | ? array_slice($dependencies, 0, $dependency_count) |
| 239 | 239 | // otherwise just take the incoming array because nothing previously existed |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public static function register_class_loader($class_name, $loader = 'load_core') |
| 252 | 252 | { |
| 253 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 253 | + if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 254 | 254 | throw new DomainException( |
| 255 | 255 | esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | // check that loader is callable or method starts with "load_" and exists in EE_Registry |
| 259 | - if (! is_callable($loader) |
|
| 259 | + if ( ! is_callable($loader) |
|
| 260 | 260 | && ( |
| 261 | 261 | strpos($loader, 'load_') !== 0 |
| 262 | 262 | || ! method_exists('EE_Registry', $loader) |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | ); |
| 274 | 274 | } |
| 275 | 275 | $class_name = self::$_instance->getFqnForAlias($class_name); |
| 276 | - if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 277 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 276 | + if ( ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
| 277 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
| 278 | 278 | return true; |
| 279 | 279 | } |
| 280 | 280 | return false; |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | if (strpos($class_name, 'EEM_') === 0) { |
| 303 | 303 | $class_name = 'LEGACY_MODELS'; |
| 304 | 304 | } |
| 305 | - return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 305 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $class_name = 'LEGACY_MODELS'; |
| 321 | 321 | } |
| 322 | 322 | $dependency = $this->getFqnForAlias($dependency, $class_name); |
| 323 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 323 | + return isset($this->_dependency_map[$class_name][$dependency]) |
|
| 324 | 324 | ? true |
| 325 | 325 | : false; |
| 326 | 326 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | $dependency = $this->getFqnForAlias($dependency); |
| 343 | 343 | return $this->has_dependency_for_class($class_name, $dependency) |
| 344 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 344 | + ? $this->_dependency_map[$class_name][$dependency] |
|
| 345 | 345 | : EE_Dependency_Map::not_registered; |
| 346 | 346 | } |
| 347 | 347 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | return 'load_core'; |
| 365 | 365 | } |
| 366 | 366 | $class_name = $this->getFqnForAlias($class_name); |
| 367 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 367 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | { |
| 974 | 974 | $this->_class_loaders = array( |
| 975 | 975 | // load_core |
| 976 | - 'EE_Dependency_Map' => function () { |
|
| 976 | + 'EE_Dependency_Map' => function() { |
|
| 977 | 977 | return $this; |
| 978 | 978 | }, |
| 979 | 979 | 'EE_Capabilities' => 'load_core', |
@@ -981,13 +981,13 @@ discard block |
||
| 981 | 981 | 'EE_Front_Controller' => 'load_core', |
| 982 | 982 | 'EE_Module_Request_Router' => 'load_core', |
| 983 | 983 | 'EE_Registry' => 'load_core', |
| 984 | - 'EE_Request' => function () { |
|
| 984 | + 'EE_Request' => function() { |
|
| 985 | 985 | return $this->legacy_request; |
| 986 | 986 | }, |
| 987 | - 'EventEspresso\core\services\request\Request' => function () { |
|
| 987 | + 'EventEspresso\core\services\request\Request' => function() { |
|
| 988 | 988 | return $this->request; |
| 989 | 989 | }, |
| 990 | - 'EventEspresso\core\services\request\Response' => function () { |
|
| 990 | + 'EventEspresso\core\services\request\Response' => function() { |
|
| 991 | 991 | return $this->response; |
| 992 | 992 | }, |
| 993 | 993 | 'EE_Base' => 'load_core', |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | 'EE_DMS_Core_4_8_0' => 'load_dms', |
| 1023 | 1023 | 'EE_DMS_Core_4_9_0' => 'load_dms', |
| 1024 | 1024 | 'EE_DMS_Core_4_10_0' => 'load_dms', |
| 1025 | - 'EE_Messages_Generator' => static function () { |
|
| 1025 | + 'EE_Messages_Generator' => static function() { |
|
| 1026 | 1026 | return EE_Registry::instance()->load_lib( |
| 1027 | 1027 | 'Messages_Generator', |
| 1028 | 1028 | array(), |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | false |
| 1031 | 1031 | ); |
| 1032 | 1032 | }, |
| 1033 | - 'EE_Messages_Template_Defaults' => static function ($arguments = array()) { |
|
| 1033 | + 'EE_Messages_Template_Defaults' => static function($arguments = array()) { |
|
| 1034 | 1034 | return EE_Registry::instance()->load_lib( |
| 1035 | 1035 | 'Messages_Template_Defaults', |
| 1036 | 1036 | $arguments, |
@@ -1039,52 +1039,52 @@ discard block |
||
| 1039 | 1039 | ); |
| 1040 | 1040 | }, |
| 1041 | 1041 | // load_helper |
| 1042 | - 'EEH_Parse_Shortcodes' => static function () { |
|
| 1042 | + 'EEH_Parse_Shortcodes' => static function() { |
|
| 1043 | 1043 | if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
| 1044 | 1044 | return new EEH_Parse_Shortcodes(); |
| 1045 | 1045 | } |
| 1046 | 1046 | return null; |
| 1047 | 1047 | }, |
| 1048 | - 'EE_Template_Config' => static function () { |
|
| 1048 | + 'EE_Template_Config' => static function() { |
|
| 1049 | 1049 | return EE_Config::instance()->template_settings; |
| 1050 | 1050 | }, |
| 1051 | - 'EE_Currency_Config' => static function () { |
|
| 1051 | + 'EE_Currency_Config' => static function() { |
|
| 1052 | 1052 | return EE_Config::instance()->currency; |
| 1053 | 1053 | }, |
| 1054 | - 'EE_Registration_Config' => static function () { |
|
| 1054 | + 'EE_Registration_Config' => static function() { |
|
| 1055 | 1055 | return EE_Config::instance()->registration; |
| 1056 | 1056 | }, |
| 1057 | - 'EE_Core_Config' => static function () { |
|
| 1057 | + 'EE_Core_Config' => static function() { |
|
| 1058 | 1058 | return EE_Config::instance()->core; |
| 1059 | 1059 | }, |
| 1060 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
| 1060 | + 'EventEspresso\core\services\loaders\Loader' => static function() { |
|
| 1061 | 1061 | return LoaderFactory::getLoader(); |
| 1062 | 1062 | }, |
| 1063 | - 'EE_Network_Config' => static function () { |
|
| 1063 | + 'EE_Network_Config' => static function() { |
|
| 1064 | 1064 | return EE_Network_Config::instance(); |
| 1065 | 1065 | }, |
| 1066 | - 'EE_Config' => static function () { |
|
| 1066 | + 'EE_Config' => static function() { |
|
| 1067 | 1067 | return EE_Config::instance(); |
| 1068 | 1068 | }, |
| 1069 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
| 1069 | + 'EventEspresso\core\domain\Domain' => static function() { |
|
| 1070 | 1070 | return DomainFactory::getEventEspressoCoreDomain(); |
| 1071 | 1071 | }, |
| 1072 | - 'EE_Admin_Config' => static function () { |
|
| 1072 | + 'EE_Admin_Config' => static function() { |
|
| 1073 | 1073 | return EE_Config::instance()->admin; |
| 1074 | 1074 | }, |
| 1075 | - 'EE_Organization_Config' => static function () { |
|
| 1075 | + 'EE_Organization_Config' => static function() { |
|
| 1076 | 1076 | return EE_Config::instance()->organization; |
| 1077 | 1077 | }, |
| 1078 | - 'EE_Network_Core_Config' => static function () { |
|
| 1078 | + 'EE_Network_Core_Config' => static function() { |
|
| 1079 | 1079 | return EE_Network_Config::instance()->core; |
| 1080 | 1080 | }, |
| 1081 | - 'EE_Environment_Config' => static function () { |
|
| 1081 | + 'EE_Environment_Config' => static function() { |
|
| 1082 | 1082 | return EE_Config::instance()->environment; |
| 1083 | 1083 | }, |
| 1084 | - 'EED_Core_Rest_Api' => static function () { |
|
| 1084 | + 'EED_Core_Rest_Api' => static function() { |
|
| 1085 | 1085 | return EED_Core_Rest_Api::instance(); |
| 1086 | 1086 | }, |
| 1087 | - 'WP_REST_Server' => static function () { |
|
| 1087 | + 'WP_REST_Server' => static function() { |
|
| 1088 | 1088 | return rest_get_server(); |
| 1089 | 1089 | }, |
| 1090 | 1090 | ); |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | } |
| 1149 | 1149 | $this->class_cache->addAlias($fqn, $alias); |
| 1150 | 1150 | } |
| 1151 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1151 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1152 | 1152 | $this->class_cache->addAlias( |
| 1153 | 1153 | 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
| 1154 | 1154 | 'EventEspresso\core\services\notices\NoticeConverterInterface' |