@@ -79,10 +79,10 @@ |
||
79 | 79 | $model_names = []; |
80 | 80 | if (is_array($this->_model_name_pointed_to)) { |
81 | 81 | foreach ($this->_model_name_pointed_to as $model_name) { |
82 | - $model_names[] = "EE_" . $model_name; |
|
82 | + $model_names[] = "EE_".$model_name; |
|
83 | 83 | } |
84 | 84 | } else { |
85 | - $model_names = ["EE_" . $this->_model_name_pointed_to]; |
|
85 | + $model_names = ["EE_".$this->_model_name_pointed_to]; |
|
86 | 86 | } |
87 | 87 | return $model_names; |
88 | 88 | } |
@@ -8,94 +8,94 @@ |
||
8 | 8 | */ |
9 | 9 | abstract class EE_Field_With_Model_Name extends EE_Model_Field_Base |
10 | 10 | { |
11 | - /** |
|
12 | - * Usually the name of a single model. However, as in the case for custom post types, |
|
13 | - * it can actually be an array of models |
|
14 | - * |
|
15 | - * @var string[] |
|
16 | - */ |
|
17 | - protected $_model_name_pointed_to; |
|
11 | + /** |
|
12 | + * Usually the name of a single model. However, as in the case for custom post types, |
|
13 | + * it can actually be an array of models |
|
14 | + * |
|
15 | + * @var string[] |
|
16 | + */ |
|
17 | + protected $_model_name_pointed_to; |
|
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @param string $table_column name of column for field |
|
22 | - * @param string $nicename should be internationalized with __('blah','event_espresso') |
|
23 | - * @param boolean $nullable |
|
24 | - * @param int|string $default_value data type should match field type |
|
25 | - * @param string|string[] $model_name eg 'Event','Answer','Term', etc. |
|
26 | - * Basically its the model class's name without the "EEM_" |
|
27 | - */ |
|
28 | - public function __construct($table_column, $nicename, $nullable, $default_value, $model_name) |
|
29 | - { |
|
30 | - $this->_model_name_pointed_to = (array) $model_name; |
|
31 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
32 | - } |
|
20 | + /** |
|
21 | + * @param string $table_column name of column for field |
|
22 | + * @param string $nicename should be internationalized with __('blah','event_espresso') |
|
23 | + * @param boolean $nullable |
|
24 | + * @param int|string $default_value data type should match field type |
|
25 | + * @param string|string[] $model_name eg 'Event','Answer','Term', etc. |
|
26 | + * Basically its the model class's name without the "EEM_" |
|
27 | + */ |
|
28 | + public function __construct($table_column, $nicename, $nullable, $default_value, $model_name) |
|
29 | + { |
|
30 | + $this->_model_name_pointed_to = (array) $model_name; |
|
31 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Returns the name of the model(s) pointed to |
|
37 | - * |
|
38 | - * @return string[] string or array of strings |
|
39 | - * @deprecated since version 4.6.7 |
|
40 | - */ |
|
41 | - public function get_model_name_pointed_to(): array |
|
42 | - { |
|
43 | - EE_Error::doing_it_wrong( |
|
44 | - 'get_model_name_pointed_to', |
|
45 | - __( |
|
46 | - 'This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', |
|
47 | - 'event_espresso' |
|
48 | - ), |
|
49 | - '4.6.7' |
|
50 | - ); |
|
51 | - return $this->_model_name_pointed_to; |
|
52 | - } |
|
35 | + /** |
|
36 | + * Returns the name of the model(s) pointed to |
|
37 | + * |
|
38 | + * @return string[] string or array of strings |
|
39 | + * @deprecated since version 4.6.7 |
|
40 | + */ |
|
41 | + public function get_model_name_pointed_to(): array |
|
42 | + { |
|
43 | + EE_Error::doing_it_wrong( |
|
44 | + 'get_model_name_pointed_to', |
|
45 | + __( |
|
46 | + 'This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', |
|
47 | + 'event_espresso' |
|
48 | + ), |
|
49 | + '4.6.7' |
|
50 | + ); |
|
51 | + return $this->_model_name_pointed_to; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Gets the model names pointed to by this field, always as an array |
|
57 | - * (even if there's only one) |
|
58 | - * |
|
59 | - * @return string[] of model names pointed to by this field |
|
60 | - */ |
|
61 | - public function get_model_names_pointed_to(): array |
|
62 | - { |
|
63 | - return is_array($this->_model_name_pointed_to) |
|
64 | - ? $this->_model_name_pointed_to |
|
65 | - : [$this->_model_name_pointed_to]; |
|
66 | - } |
|
55 | + /** |
|
56 | + * Gets the model names pointed to by this field, always as an array |
|
57 | + * (even if there's only one) |
|
58 | + * |
|
59 | + * @return string[] of model names pointed to by this field |
|
60 | + */ |
|
61 | + public function get_model_names_pointed_to(): array |
|
62 | + { |
|
63 | + return is_array($this->_model_name_pointed_to) |
|
64 | + ? $this->_model_name_pointed_to |
|
65 | + : [$this->_model_name_pointed_to]; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | - /** |
|
70 | - * Returns the model's classname (eg EE_Event instead of just Event) |
|
71 | - * |
|
72 | - * @return string[] |
|
73 | - */ |
|
74 | - public function get_model_class_names_pointed_to(): array |
|
75 | - { |
|
76 | - $model_names = []; |
|
77 | - if (is_array($this->_model_name_pointed_to)) { |
|
78 | - foreach ($this->_model_name_pointed_to as $model_name) { |
|
79 | - $model_names[] = "EE_" . $model_name; |
|
80 | - } |
|
81 | - } else { |
|
82 | - $model_names = ["EE_" . $this->_model_name_pointed_to]; |
|
83 | - } |
|
84 | - return $model_names; |
|
85 | - } |
|
69 | + /** |
|
70 | + * Returns the model's classname (eg EE_Event instead of just Event) |
|
71 | + * |
|
72 | + * @return string[] |
|
73 | + */ |
|
74 | + public function get_model_class_names_pointed_to(): array |
|
75 | + { |
|
76 | + $model_names = []; |
|
77 | + if (is_array($this->_model_name_pointed_to)) { |
|
78 | + foreach ($this->_model_name_pointed_to as $model_name) { |
|
79 | + $model_names[] = "EE_" . $model_name; |
|
80 | + } |
|
81 | + } else { |
|
82 | + $model_names = ["EE_" . $this->_model_name_pointed_to]; |
|
83 | + } |
|
84 | + return $model_names; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * @param int|EE_Base_Class $model_obj |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function is_model_obj_of_type_pointed_to($model_obj): bool |
|
93 | - { |
|
94 | - foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) { |
|
95 | - if ($model_obj instanceof $model_obj_classname) { |
|
96 | - return true; |
|
97 | - } |
|
98 | - } |
|
99 | - return false; |
|
100 | - } |
|
88 | + /** |
|
89 | + * @param int|EE_Base_Class $model_obj |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function is_model_obj_of_type_pointed_to($model_obj): bool |
|
93 | + { |
|
94 | + foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) { |
|
95 | + if ($model_obj instanceof $model_obj_classname) { |
|
96 | + return true; |
|
97 | + } |
|
98 | + } |
|
99 | + return false; |
|
100 | + } |
|
101 | 101 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function schema_changes_before_migration() |
59 | 59 | { |
60 | - require_once EE_HELPERS . 'EEH_Activation.helper.php'; |
|
60 | + require_once EE_HELPERS.'EEH_Activation.helper.php'; |
|
61 | 61 | |
62 | 62 | $table_name = 'esp_answer'; |
63 | 63 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -13,63 +13,63 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class EE_DMS_Core_4_12_0 extends EE_Data_Migration_Script_Base |
15 | 15 | { |
16 | - /** |
|
17 | - * |
|
18 | - * @param EE_DMS_Core_4_11_0 $dms_4_11 |
|
19 | - * @param TableManager|null $table_manager |
|
20 | - * @param TableAnalysis|null $table_analysis |
|
21 | - */ |
|
22 | - public function __construct( |
|
23 | - EE_DMS_Core_4_11_0 $dms_4_11, |
|
24 | - TableManager $table_manager = null, |
|
25 | - TableAnalysis $table_analysis = null |
|
26 | - ) { |
|
27 | - $this->previous_dms = $dms_4_11; |
|
28 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.12.0", "event_espresso"); |
|
29 | - $this->_priority = 10; |
|
30 | - $this->_migration_stages = [ |
|
31 | - |
|
32 | - ]; |
|
33 | - parent::__construct($table_manager, $table_analysis); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * Whether to migrate or not. |
|
39 | - * |
|
40 | - * @param array $version_array |
|
41 | - * @return bool |
|
42 | - */ |
|
43 | - public function can_migrate_from_version($version_array) |
|
44 | - { |
|
45 | - $version_string = $version_array['Core']; |
|
46 | - return $version_string |
|
47 | - && version_compare($version_string, '4.12.0.decaf', '<') |
|
48 | - && version_compare($version_string, '4.11.0.decaf', '>='); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @return bool |
|
54 | - * @throws EE_Error |
|
55 | - * @throws ReflectionException |
|
56 | - */ |
|
57 | - public function schema_changes_before_migration() |
|
58 | - { |
|
59 | - require_once EE_HELPERS . 'EEH_Activation.helper.php'; |
|
60 | - |
|
61 | - $table_name = 'esp_answer'; |
|
62 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
16 | + /** |
|
17 | + * |
|
18 | + * @param EE_DMS_Core_4_11_0 $dms_4_11 |
|
19 | + * @param TableManager|null $table_manager |
|
20 | + * @param TableAnalysis|null $table_analysis |
|
21 | + */ |
|
22 | + public function __construct( |
|
23 | + EE_DMS_Core_4_11_0 $dms_4_11, |
|
24 | + TableManager $table_manager = null, |
|
25 | + TableAnalysis $table_analysis = null |
|
26 | + ) { |
|
27 | + $this->previous_dms = $dms_4_11; |
|
28 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.12.0", "event_espresso"); |
|
29 | + $this->_priority = 10; |
|
30 | + $this->_migration_stages = [ |
|
31 | + |
|
32 | + ]; |
|
33 | + parent::__construct($table_manager, $table_analysis); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * Whether to migrate or not. |
|
39 | + * |
|
40 | + * @param array $version_array |
|
41 | + * @return bool |
|
42 | + */ |
|
43 | + public function can_migrate_from_version($version_array) |
|
44 | + { |
|
45 | + $version_string = $version_array['Core']; |
|
46 | + return $version_string |
|
47 | + && version_compare($version_string, '4.12.0.decaf', '<') |
|
48 | + && version_compare($version_string, '4.11.0.decaf', '>='); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @return bool |
|
54 | + * @throws EE_Error |
|
55 | + * @throws ReflectionException |
|
56 | + */ |
|
57 | + public function schema_changes_before_migration() |
|
58 | + { |
|
59 | + require_once EE_HELPERS . 'EEH_Activation.helper.php'; |
|
60 | + |
|
61 | + $table_name = 'esp_answer'; |
|
62 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
63 | 63 | REG_ID int(10) unsigned NOT NULL, |
64 | 64 | QST_ID int(10) unsigned NOT NULL, |
65 | 65 | ANS_value text NOT NULL, |
66 | 66 | PRIMARY KEY (ANS_ID), |
67 | 67 | KEY REG_ID (REG_ID), |
68 | 68 | KEY QST_ID (QST_ID)"; |
69 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
69 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
70 | 70 | |
71 | - $table_name = 'esp_attendee_meta'; |
|
72 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
71 | + $table_name = 'esp_attendee_meta'; |
|
72 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
73 | 73 | ATT_ID bigint(20) unsigned NOT NULL, |
74 | 74 | ATT_fname varchar(45) NOT NULL, |
75 | 75 | ATT_lname varchar(45) NOT NULL, |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | KEY ATT_email (ATT_email(191)), |
87 | 87 | KEY ATT_lname (ATT_lname), |
88 | 88 | KEY ATT_fname (ATT_fname)"; |
89 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
89 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
90 | 90 | |
91 | - $table_name = 'esp_checkin'; |
|
92 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
91 | + $table_name = 'esp_checkin'; |
|
92 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
93 | 93 | REG_ID int(10) unsigned NOT NULL, |
94 | 94 | DTT_ID int(10) unsigned NOT NULL, |
95 | 95 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | PRIMARY KEY (CHK_ID), |
98 | 98 | KEY REG_ID (REG_ID), |
99 | 99 | KEY DTT_ID (DTT_ID)"; |
100 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
100 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
101 | 101 | |
102 | - $table_name = 'esp_country'; |
|
103 | - $sql = "CNT_ISO varchar(2) NOT NULL, |
|
102 | + $table_name = 'esp_country'; |
|
103 | + $sql = "CNT_ISO varchar(2) NOT NULL, |
|
104 | 104 | CNT_ISO3 varchar(3) NOT NULL, |
105 | 105 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
106 | 106 | CNT_name varchar(45) NOT NULL, |
@@ -116,32 +116,32 @@ discard block |
||
116 | 116 | CNT_is_EU tinyint(1) DEFAULT '0', |
117 | 117 | CNT_active tinyint(1) DEFAULT '0', |
118 | 118 | PRIMARY KEY (CNT_ISO)"; |
119 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
119 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
120 | 120 | |
121 | - $table_name = 'esp_currency'; |
|
122 | - $sql = "CUR_code varchar(6) NOT NULL, |
|
121 | + $table_name = 'esp_currency'; |
|
122 | + $sql = "CUR_code varchar(6) NOT NULL, |
|
123 | 123 | CUR_single varchar(45) DEFAULT 'dollar', |
124 | 124 | CUR_plural varchar(45) DEFAULT 'dollars', |
125 | 125 | CUR_sign varchar(45) DEFAULT '$', |
126 | 126 | CUR_dec_plc varchar(1) NOT NULL DEFAULT '2', |
127 | 127 | CUR_active tinyint(1) DEFAULT '0', |
128 | 128 | PRIMARY KEY (CUR_code)"; |
129 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
130 | - |
|
131 | - // note: although this table is no longer in use, |
|
132 | - // it hasn't been removed because then queries to the model will have errors. |
|
133 | - // but you should expect this table and its corresponding model to be removed in |
|
134 | - // the next few months |
|
135 | - $table_name = 'esp_currency_payment_method'; |
|
136 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
129 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
130 | + |
|
131 | + // note: although this table is no longer in use, |
|
132 | + // it hasn't been removed because then queries to the model will have errors. |
|
133 | + // but you should expect this table and its corresponding model to be removed in |
|
134 | + // the next few months |
|
135 | + $table_name = 'esp_currency_payment_method'; |
|
136 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
137 | 137 | CUR_code varchar(6) NOT NULL, |
138 | 138 | PMD_ID int(11) NOT NULL, |
139 | 139 | PRIMARY KEY (CPM_ID), |
140 | 140 | KEY PMD_ID (PMD_ID)"; |
141 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
141 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
142 | 142 | |
143 | - $table_name = 'esp_datetime'; |
|
144 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
143 | + $table_name = 'esp_datetime'; |
|
144 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
145 | 145 | EVT_ID bigint(20) unsigned NOT NULL, |
146 | 146 | DTT_name varchar(255) NOT NULL DEFAULT '', |
147 | 147 | DTT_description text NOT NULL, |
@@ -158,28 +158,28 @@ discard block |
||
158 | 158 | KEY DTT_EVT_start (DTT_EVT_start), |
159 | 159 | KEY EVT_ID (EVT_ID), |
160 | 160 | KEY DTT_is_primary (DTT_is_primary)"; |
161 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | 162 | |
163 | - $table_name = "esp_datetime_ticket"; |
|
164 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
163 | + $table_name = "esp_datetime_ticket"; |
|
164 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
165 | 165 | DTT_ID int(10) unsigned NOT NULL, |
166 | 166 | TKT_ID int(10) unsigned NOT NULL, |
167 | 167 | PRIMARY KEY (DTK_ID), |
168 | 168 | KEY DTT_ID (DTT_ID), |
169 | 169 | KEY TKT_ID (TKT_ID)"; |
170 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
170 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
171 | 171 | |
172 | - $table_name = 'esp_event_message_template'; |
|
173 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
172 | + $table_name = 'esp_event_message_template'; |
|
173 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
174 | 174 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
175 | 175 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
176 | 176 | PRIMARY KEY (EMT_ID), |
177 | 177 | KEY EVT_ID (EVT_ID), |
178 | 178 | KEY GRP_ID (GRP_ID)"; |
179 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
179 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
180 | 180 | |
181 | - $table_name = 'esp_event_meta'; |
|
182 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
181 | + $table_name = 'esp_event_meta'; |
|
182 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
183 | 183 | EVT_ID bigint(20) unsigned NOT NULL, |
184 | 184 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
185 | 185 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | FSC_UUID varchar(25) DEFAULT NULL, |
196 | 196 | PRIMARY KEY (EVTM_ID), |
197 | 197 | KEY EVT_ID (EVT_ID)"; |
198 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
199 | 199 | |
200 | - $table_name = 'esp_event_question_group'; |
|
201 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
200 | + $table_name = 'esp_event_question_group'; |
|
201 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
202 | 202 | EVT_ID bigint(20) unsigned NOT NULL, |
203 | 203 | QSG_ID int(10) unsigned NOT NULL, |
204 | 204 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
@@ -206,28 +206,28 @@ discard block |
||
206 | 206 | PRIMARY KEY (EQG_ID), |
207 | 207 | KEY EVT_ID (EVT_ID), |
208 | 208 | KEY QSG_ID (QSG_ID)"; |
209 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
210 | 210 | |
211 | - $table_name = 'esp_event_venue'; |
|
212 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
211 | + $table_name = 'esp_event_venue'; |
|
212 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
213 | 213 | EVT_ID bigint(20) unsigned NOT NULL, |
214 | 214 | VNU_ID bigint(20) unsigned NOT NULL, |
215 | 215 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
216 | 216 | PRIMARY KEY (EVV_ID)"; |
217 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | 218 | |
219 | - $table_name = 'esp_extra_meta'; |
|
220 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
219 | + $table_name = 'esp_extra_meta'; |
|
220 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
221 | 221 | OBJ_ID int(11) DEFAULT NULL, |
222 | 222 | EXM_type varchar(45) DEFAULT NULL, |
223 | 223 | EXM_key varchar(45) DEFAULT NULL, |
224 | 224 | EXM_value text, |
225 | 225 | PRIMARY KEY (EXM_ID), |
226 | 226 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
227 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | 228 | |
229 | - $table_name = 'esp_extra_join'; |
|
230 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
229 | + $table_name = 'esp_extra_join'; |
|
230 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
231 | 231 | EXJ_first_model_id varchar(6) NOT NULL, |
232 | 232 | EXJ_first_model_name varchar(20) NOT NULL, |
233 | 233 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | PRIMARY KEY (EXJ_ID), |
236 | 236 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
237 | 237 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
238 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
238 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
239 | 239 | |
240 | - $table_name = 'esp_form_element'; |
|
241 | - $sql = "FIN_UUID varchar(25) NOT NULL, |
|
240 | + $table_name = 'esp_form_element'; |
|
241 | + $sql = "FIN_UUID varchar(25) NOT NULL, |
|
242 | 242 | FSC_UUID varchar(25) NOT NULL, |
243 | 243 | FIN_adminOnly tinyint(1) unsigned NOT NULL DEFAULT 0, |
244 | 244 | FIN_attributes text DEFAULT NULL, |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | KEY FSC_UUID (FSC_UUID), |
256 | 256 | KEY FIN_order (FIN_order), |
257 | 257 | KEY FIN_status (FIN_status)"; |
258 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
259 | 259 | |
260 | - $table_name = 'esp_form_section'; |
|
261 | - $sql = "FSC_UUID varchar(25) NOT NULL, |
|
260 | + $table_name = 'esp_form_section'; |
|
261 | + $sql = "FSC_UUID varchar(25) NOT NULL, |
|
262 | 262 | FSC_appliesTo tinytext NOT NULL, |
263 | 263 | FSC_attributes text DEFAULT NULL, |
264 | 264 | FSC_belongsTo varchar(25) DEFAULT NULL, |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | KEY FSC_belongsTo (FSC_belongsTo), |
271 | 271 | KEY FSC_order (FSC_order), |
272 | 272 | KEY FSC_status (FSC_status)"; |
273 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
273 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
274 | 274 | |
275 | - $table_name = 'esp_form_submission'; |
|
276 | - $sql = "FSB_UUID varchar(25) NOT NULL, |
|
275 | + $table_name = 'esp_form_submission'; |
|
276 | + $sql = "FSB_UUID varchar(25) NOT NULL, |
|
277 | 277 | FSC_UUID varchar(25) NOT NULL, |
278 | 278 | TXN_ID int(10) DEFAULT NULL, |
279 | 279 | FSB_data mediumtext DEFAULT NULL, |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | PRIMARY KEY (FSB_UUID), |
282 | 282 | KEY FSC_UUID (FSC_UUID), |
283 | 283 | KEY TXN_ID (TXN_ID)"; |
284 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
284 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | 285 | |
286 | - $table_name = 'esp_line_item'; |
|
287 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
286 | + $table_name = 'esp_line_item'; |
|
287 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
288 | 288 | LIN_code varchar(245) NOT NULL DEFAULT '', |
289 | 289 | TXN_ID int(10) DEFAULT NULL, |
290 | 290 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -305,10 +305,10 @@ discard block |
||
305 | 305 | KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp), |
306 | 306 | KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type), |
307 | 307 | KEY obj_id_obj_type (OBJ_ID,OBJ_type)"; |
308 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
308 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
309 | 309 | |
310 | - $table_name = 'esp_log'; |
|
311 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
310 | + $table_name = 'esp_log'; |
|
311 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
312 | 312 | LOG_time datetime DEFAULT NULL, |
313 | 313 | OBJ_ID varchar(45) DEFAULT NULL, |
314 | 314 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | KEY LOG_time (LOG_time), |
320 | 320 | KEY OBJ (OBJ_type,OBJ_ID), |
321 | 321 | KEY LOG_type (LOG_type)"; |
322 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
322 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
323 | 323 | |
324 | - $table_name = 'esp_message'; |
|
325 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
324 | + $table_name = 'esp_message'; |
|
325 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
326 | 326 | GRP_ID int(10) unsigned NULL, |
327 | 327 | MSG_token varchar(255) NULL, |
328 | 328 | TXN_ID int(10) unsigned NULL, |
@@ -354,20 +354,20 @@ discard block |
||
354 | 354 | KEY STS_ID (STS_ID), |
355 | 355 | KEY MSG_created (MSG_created), |
356 | 356 | KEY MSG_modified (MSG_modified)"; |
357 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
357 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | 358 | |
359 | - $table_name = 'esp_message_template'; |
|
360 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
359 | + $table_name = 'esp_message_template'; |
|
360 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
361 | 361 | GRP_ID int(10) unsigned NOT NULL, |
362 | 362 | MTP_context varchar(50) NOT NULL, |
363 | 363 | MTP_template_field varchar(30) NOT NULL, |
364 | 364 | MTP_content text NOT NULL, |
365 | 365 | PRIMARY KEY (MTP_ID), |
366 | 366 | KEY GRP_ID (GRP_ID)"; |
367 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
368 | 368 | |
369 | - $table_name = 'esp_message_template_group'; |
|
370 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
369 | + $table_name = 'esp_message_template_group'; |
|
370 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
371 | 371 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
372 | 372 | MTP_name varchar(245) NOT NULL DEFAULT '', |
373 | 373 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
380 | 380 | PRIMARY KEY (GRP_ID), |
381 | 381 | KEY MTP_user_id (MTP_user_id)"; |
382 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
382 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
383 | 383 | |
384 | - $table_name = 'esp_payment'; |
|
385 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
384 | + $table_name = 'esp_payment'; |
|
385 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
386 | 386 | TXN_ID int(10) unsigned DEFAULT NULL, |
387 | 387 | STS_ID varchar(3) DEFAULT NULL, |
388 | 388 | PAY_timestamp datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | PRIMARY KEY (PAY_ID), |
400 | 400 | KEY PAY_timestamp (PAY_timestamp), |
401 | 401 | KEY TXN_ID (TXN_ID)"; |
402 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
402 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
403 | 403 | |
404 | - $table_name = 'esp_payment_method'; |
|
405 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
404 | + $table_name = 'esp_payment_method'; |
|
405 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
406 | 406 | PMD_type varchar(124) DEFAULT NULL, |
407 | 407 | PMD_name varchar(255) DEFAULT NULL, |
408 | 408 | PMD_desc text, |
@@ -418,10 +418,10 @@ discard block |
||
418 | 418 | PRIMARY KEY (PMD_ID), |
419 | 419 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
420 | 420 | KEY PMD_type (PMD_type)"; |
421 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
421 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
422 | 422 | |
423 | - $table_name = "esp_price"; |
|
424 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
423 | + $table_name = "esp_price"; |
|
424 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
425 | 425 | PRT_ID tinyint(3) unsigned NOT NULL, |
426 | 426 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
427 | 427 | PRC_name varchar(245) NOT NULL, |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | PRC_parent int(10) unsigned DEFAULT 0, |
435 | 435 | PRIMARY KEY (PRC_ID), |
436 | 436 | KEY PRT_ID (PRT_ID)"; |
437 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
437 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
438 | 438 | |
439 | - $table_name = "esp_price_type"; |
|
440 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
439 | + $table_name = "esp_price_type"; |
|
440 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
441 | 441 | PRT_name varchar(45) NOT NULL, |
442 | 442 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
443 | 443 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -446,27 +446,27 @@ discard block |
||
446 | 446 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
447 | 447 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
448 | 448 | PRIMARY KEY (PRT_ID)"; |
449 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
449 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
450 | 450 | |
451 | - $table_name = "esp_ticket_price"; |
|
452 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
451 | + $table_name = "esp_ticket_price"; |
|
452 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
453 | 453 | TKT_ID int(10) unsigned NOT NULL, |
454 | 454 | PRC_ID int(10) unsigned NOT NULL, |
455 | 455 | PRIMARY KEY (TKP_ID), |
456 | 456 | KEY TKT_ID (TKT_ID), |
457 | 457 | KEY PRC_ID (PRC_ID)"; |
458 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
458 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
459 | 459 | |
460 | - $table_name = "esp_ticket_template"; |
|
461 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
460 | + $table_name = "esp_ticket_template"; |
|
461 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
462 | 462 | TTM_name varchar(45) NOT NULL, |
463 | 463 | TTM_description text, |
464 | 464 | TTM_file varchar(45), |
465 | 465 | PRIMARY KEY (TTM_ID)"; |
466 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
466 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
467 | 467 | |
468 | - $table_name = 'esp_question'; |
|
469 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
468 | + $table_name = 'esp_question'; |
|
469 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
470 | 470 | QST_display_text text NOT NULL, |
471 | 471 | QST_admin_label varchar(255) NOT NULL, |
472 | 472 | QST_system varchar(25) DEFAULT NULL, |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
481 | 481 | PRIMARY KEY (QST_ID), |
482 | 482 | KEY QST_order (QST_order)'; |
483 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
483 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
484 | 484 | |
485 | - $table_name = 'esp_question_group'; |
|
486 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
485 | + $table_name = 'esp_question_group'; |
|
486 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
487 | 487 | QSG_name varchar(255) NOT NULL, |
488 | 488 | QSG_identifier varchar(100) NOT NULL, |
489 | 489 | QSG_desc text NULL, |
@@ -496,20 +496,20 @@ discard block |
||
496 | 496 | PRIMARY KEY (QSG_ID), |
497 | 497 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
498 | 498 | KEY QSG_order (QSG_order)'; |
499 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
499 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | 500 | |
501 | - $table_name = 'esp_question_group_question'; |
|
502 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
501 | + $table_name = 'esp_question_group_question'; |
|
502 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
503 | 503 | QSG_ID int(10) unsigned NOT NULL, |
504 | 504 | QST_ID int(10) unsigned NOT NULL, |
505 | 505 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
506 | 506 | PRIMARY KEY (QGQ_ID), |
507 | 507 | KEY QST_ID (QST_ID), |
508 | 508 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
509 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
509 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
510 | 510 | |
511 | - $table_name = 'esp_question_option'; |
|
512 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
511 | + $table_name = 'esp_question_option'; |
|
512 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
513 | 513 | QSO_value varchar(255) NOT NULL, |
514 | 514 | QSO_desc text NOT NULL, |
515 | 515 | QST_ID int(10) unsigned NOT NULL, |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | PRIMARY KEY (QSO_ID), |
520 | 520 | KEY QST_ID (QST_ID), |
521 | 521 | KEY QSO_order (QSO_order)"; |
522 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
522 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
523 | 523 | |
524 | - $table_name = 'esp_registration'; |
|
525 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
524 | + $table_name = 'esp_registration'; |
|
525 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
526 | 526 | EVT_ID bigint(20) unsigned NOT NULL, |
527 | 527 | ATT_ID bigint(20) unsigned NOT NULL, |
528 | 528 | TXN_ID int(10) unsigned NOT NULL, |
@@ -546,20 +546,20 @@ discard block |
||
546 | 546 | KEY TKT_ID (TKT_ID), |
547 | 547 | KEY EVT_ID (EVT_ID), |
548 | 548 | KEY STS_ID (STS_ID)"; |
549 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
549 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
550 | 550 | |
551 | - $table_name = 'esp_registration_payment'; |
|
552 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
551 | + $table_name = 'esp_registration_payment'; |
|
552 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
553 | 553 | REG_ID int(10) unsigned NOT NULL, |
554 | 554 | PAY_ID int(10) unsigned NULL, |
555 | 555 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
556 | 556 | PRIMARY KEY (RPY_ID), |
557 | 557 | KEY REG_ID (REG_ID), |
558 | 558 | KEY PAY_ID (PAY_ID)"; |
559 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
559 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
560 | 560 | |
561 | - $table_name = 'esp_state'; |
|
562 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
561 | + $table_name = 'esp_state'; |
|
562 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
563 | 563 | CNT_ISO varchar(2) NOT NULL, |
564 | 564 | STA_abbrev varchar(24) NOT NULL, |
565 | 565 | STA_name varchar(100) NOT NULL, |
@@ -567,10 +567,10 @@ discard block |
||
567 | 567 | PRIMARY KEY (STA_ID), |
568 | 568 | KEY STA_abbrev (STA_abbrev), |
569 | 569 | KEY CNT_ISO (CNT_ISO)"; |
570 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
570 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
571 | 571 | |
572 | - $table_name = 'esp_status'; |
|
573 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
572 | + $table_name = 'esp_status'; |
|
573 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
574 | 574 | STS_code varchar(45) NOT NULL, |
575 | 575 | STS_type varchar(45) NOT NULL, |
576 | 576 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
579 | 579 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
580 | 580 | KEY STS_type (STS_type)"; |
581 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
581 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
582 | 582 | |
583 | - $table_name = "esp_ticket"; |
|
584 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
583 | + $table_name = "esp_ticket"; |
|
584 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
585 | 585 | TTM_ID int(10) unsigned NOT NULL, |
586 | 586 | TKT_name varchar(245) NOT NULL DEFAULT '', |
587 | 587 | TKT_description text NOT NULL, |
@@ -606,10 +606,10 @@ discard block |
||
606 | 606 | TKT_visibility smallint(6) unsigned NOT NULL DEFAULT 100, |
607 | 607 | PRIMARY KEY (TKT_ID), |
608 | 608 | KEY TKT_start_date (TKT_start_date)"; |
609 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
609 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
610 | 610 | |
611 | - $table_name = 'esp_transaction'; |
|
612 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
611 | + $table_name = 'esp_transaction'; |
|
612 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
613 | 613 | TXN_timestamp datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
614 | 614 | TXN_total decimal(12,3) DEFAULT '0.00', |
615 | 615 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -621,10 +621,10 @@ discard block |
||
621 | 621 | PRIMARY KEY (TXN_ID), |
622 | 622 | KEY TXN_timestamp (TXN_timestamp), |
623 | 623 | KEY STS_ID (STS_ID)"; |
624 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
624 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
625 | 625 | |
626 | - $table_name = 'esp_venue_meta'; |
|
627 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
626 | + $table_name = 'esp_venue_meta'; |
|
627 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
628 | 628 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
629 | 629 | VNU_address varchar(255) DEFAULT NULL, |
630 | 630 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -643,36 +643,36 @@ discard block |
||
643 | 643 | KEY VNU_ID (VNU_ID), |
644 | 644 | KEY STA_ID (STA_ID), |
645 | 645 | KEY CNT_ISO (CNT_ISO)"; |
646 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
647 | - |
|
648 | - $this->insert_default_data(); |
|
649 | - return true; |
|
650 | - } |
|
651 | - |
|
652 | - |
|
653 | - /** |
|
654 | - * Inserts default data on new installs |
|
655 | - * |
|
656 | - * @throws EE_Error |
|
657 | - * @throws ReflectionException |
|
658 | - * @since 4.10.0.p |
|
659 | - */ |
|
660 | - public function insert_default_data() |
|
661 | - { |
|
662 | - $this->previous_dms->insert_default_data(); |
|
663 | - } |
|
664 | - |
|
665 | - |
|
666 | - /** |
|
667 | - * @return boolean |
|
668 | - */ |
|
669 | - public function schema_changes_after_migration() |
|
670 | - { |
|
671 | - return true; |
|
672 | - } |
|
673 | - |
|
674 | - |
|
675 | - public function migration_page_hooks() |
|
676 | - { |
|
677 | - } |
|
646 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
647 | + |
|
648 | + $this->insert_default_data(); |
|
649 | + return true; |
|
650 | + } |
|
651 | + |
|
652 | + |
|
653 | + /** |
|
654 | + * Inserts default data on new installs |
|
655 | + * |
|
656 | + * @throws EE_Error |
|
657 | + * @throws ReflectionException |
|
658 | + * @since 4.10.0.p |
|
659 | + */ |
|
660 | + public function insert_default_data() |
|
661 | + { |
|
662 | + $this->previous_dms->insert_default_data(); |
|
663 | + } |
|
664 | + |
|
665 | + |
|
666 | + /** |
|
667 | + * @return boolean |
|
668 | + */ |
|
669 | + public function schema_changes_after_migration() |
|
670 | + { |
|
671 | + return true; |
|
672 | + } |
|
673 | + |
|
674 | + |
|
675 | + public function migration_page_hooks() |
|
676 | + { |
|
677 | + } |
|
678 | 678 | } |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | ) { |
206 | 206 | $class = trim($class, '\\'); |
207 | 207 | $registered = false; |
208 | - if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
209 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
208 | + if (empty(EE_Dependency_Map::$_instance->_dependency_map[$class])) { |
|
209 | + EE_Dependency_Map::$_instance->_dependency_map[$class] = []; |
|
210 | 210 | } |
211 | 211 | // we need to make sure that any aliases used when registering a dependency |
212 | 212 | // get resolved to the correct class name |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
215 | 215 | if ( |
216 | 216 | $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
217 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
217 | + || ! isset(EE_Dependency_Map::$_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 += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
230 | + $dependencies += EE_Dependency_Map::$_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(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
234 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[$class]); |
|
235 | 235 | // if that count is non-zero (meaning dependencies were already registered) |
236 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
236 | + EE_Dependency_Map::$_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 |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function registerClassLoader($class_name, $loader = 'load_core') |
264 | 264 | { |
265 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
265 | + if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
266 | 266 | throw new DomainException( |
267 | 267 | esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
268 | 268 | ); |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | ); |
287 | 287 | } |
288 | 288 | $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
289 | - if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
290 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
289 | + if ( ! isset(EE_Dependency_Map::$_instance->_class_loaders[$class_name])) { |
|
290 | + EE_Dependency_Map::$_instance->_class_loaders[$class_name] = $loader; |
|
291 | 291 | return true; |
292 | 292 | } |
293 | 293 | return false; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (strpos($class_name, 'EEM_') === 0) { |
316 | 316 | $class_name = 'LEGACY_MODELS'; |
317 | 317 | } |
318 | - return isset($this->_dependency_map[ $class_name ]); |
|
318 | + return isset($this->_dependency_map[$class_name]); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $class_name = 'LEGACY_MODELS'; |
334 | 334 | } |
335 | 335 | $dependency = $this->getFqnForAlias($dependency, $class_name); |
336 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
336 | + return isset($this->_dependency_map[$class_name][$dependency]); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | $dependency = $this->getFqnForAlias($dependency); |
354 | 354 | return $this->has_dependency_for_class($class_name, $dependency) |
355 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
355 | + ? $this->_dependency_map[$class_name][$dependency] |
|
356 | 356 | : EE_Dependency_Map::not_registered; |
357 | 357 | } |
358 | 358 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | return 'load_core'; |
377 | 377 | } |
378 | 378 | $class_name = $this->getFqnForAlias($class_name); |
379 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
379 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | { |
817 | 817 | $this->_class_loaders = [ |
818 | 818 | // load_core |
819 | - 'EE_Dependency_Map' => function () { |
|
819 | + 'EE_Dependency_Map' => function() { |
|
820 | 820 | return $this; |
821 | 821 | }, |
822 | 822 | 'EE_Capabilities' => 'load_core', |
@@ -824,13 +824,13 @@ discard block |
||
824 | 824 | 'EE_Front_Controller' => 'load_core', |
825 | 825 | 'EE_Module_Request_Router' => 'load_core', |
826 | 826 | 'EE_Registry' => 'load_core', |
827 | - 'EE_Request' => function () { |
|
827 | + 'EE_Request' => function() { |
|
828 | 828 | return $this->legacy_request; |
829 | 829 | }, |
830 | - 'EventEspresso\core\services\request\Request' => function () { |
|
830 | + 'EventEspresso\core\services\request\Request' => function() { |
|
831 | 831 | return $this->request; |
832 | 832 | }, |
833 | - 'EventEspresso\core\services\request\Response' => function () { |
|
833 | + 'EventEspresso\core\services\request\Response' => function() { |
|
834 | 834 | return $this->response; |
835 | 835 | }, |
836 | 836 | 'EE_Base' => 'load_core', |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | 'EE_DMS_Core_4_10_0' => 'load_dms', |
868 | 868 | 'EE_DMS_Core_4_11_0' => 'load_dms', |
869 | 869 | 'EE_DMS_Core_4_12_0' => 'load_dms', |
870 | - 'EE_Messages_Generator' => static function () { |
|
870 | + 'EE_Messages_Generator' => static function() { |
|
871 | 871 | return EE_Registry::instance()->load_lib( |
872 | 872 | 'Messages_Generator', |
873 | 873 | [], |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | false |
876 | 876 | ); |
877 | 877 | }, |
878 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
878 | + 'EE_Messages_Template_Defaults' => static function($arguments = []) { |
|
879 | 879 | return EE_Registry::instance()->load_lib( |
880 | 880 | 'Messages_Template_Defaults', |
881 | 881 | $arguments, |
@@ -884,55 +884,55 @@ discard block |
||
884 | 884 | ); |
885 | 885 | }, |
886 | 886 | // load_helper |
887 | - 'EEH_Parse_Shortcodes' => static function () { |
|
887 | + 'EEH_Parse_Shortcodes' => static function() { |
|
888 | 888 | if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
889 | 889 | return new EEH_Parse_Shortcodes(); |
890 | 890 | } |
891 | 891 | return null; |
892 | 892 | }, |
893 | - 'EE_Template_Config' => static function () { |
|
893 | + 'EE_Template_Config' => static function() { |
|
894 | 894 | return EE_Config::instance()->template_settings; |
895 | 895 | }, |
896 | - 'EE_Currency_Config' => static function () { |
|
896 | + 'EE_Currency_Config' => static function() { |
|
897 | 897 | return EE_Config::instance()->currency; |
898 | 898 | }, |
899 | - 'EE_Registration_Config' => static function () { |
|
899 | + 'EE_Registration_Config' => static function() { |
|
900 | 900 | return EE_Config::instance()->registration; |
901 | 901 | }, |
902 | - 'EE_Core_Config' => static function () { |
|
902 | + 'EE_Core_Config' => static function() { |
|
903 | 903 | return EE_Config::instance()->core; |
904 | 904 | }, |
905 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
905 | + 'EventEspresso\core\services\loaders\Loader' => static function() { |
|
906 | 906 | return LoaderFactory::getLoader(); |
907 | 907 | }, |
908 | - 'EE_Network_Config' => static function () { |
|
908 | + 'EE_Network_Config' => static function() { |
|
909 | 909 | return EE_Network_Config::instance(); |
910 | 910 | }, |
911 | - 'EE_Config' => static function () { |
|
911 | + 'EE_Config' => static function() { |
|
912 | 912 | return EE_Config::instance(); |
913 | 913 | }, |
914 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
914 | + 'EventEspresso\core\domain\Domain' => static function() { |
|
915 | 915 | return DomainFactory::getEventEspressoCoreDomain(); |
916 | 916 | }, |
917 | - 'EE_Admin_Config' => static function () { |
|
917 | + 'EE_Admin_Config' => static function() { |
|
918 | 918 | return EE_Config::instance()->admin; |
919 | 919 | }, |
920 | - 'EE_Organization_Config' => static function () { |
|
920 | + 'EE_Organization_Config' => static function() { |
|
921 | 921 | return EE_Config::instance()->organization; |
922 | 922 | }, |
923 | - 'EE_Network_Core_Config' => static function () { |
|
923 | + 'EE_Network_Core_Config' => static function() { |
|
924 | 924 | return EE_Network_Config::instance()->core; |
925 | 925 | }, |
926 | - 'EE_Environment_Config' => static function () { |
|
926 | + 'EE_Environment_Config' => static function() { |
|
927 | 927 | return EE_Config::instance()->environment; |
928 | 928 | }, |
929 | - 'EED_Core_Rest_Api' => static function () { |
|
929 | + 'EED_Core_Rest_Api' => static function() { |
|
930 | 930 | return EED_Core_Rest_Api::instance(); |
931 | 931 | }, |
932 | - 'WP_REST_Server' => static function () { |
|
932 | + 'WP_REST_Server' => static function() { |
|
933 | 933 | return rest_get_server(); |
934 | 934 | }, |
935 | - 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
935 | + 'EventEspresso\core\Psr4Autoloader' => static function() { |
|
936 | 936 | return EE_Psr4AutoloaderInit::psr4_loader(); |
937 | 937 | }, |
938 | 938 | ]; |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | } |
998 | 998 | $this->class_cache->addAlias($fqn, $alias); |
999 | 999 | } |
1000 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1000 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1001 | 1001 | $this->class_cache->addAlias( |
1002 | 1002 | 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
1003 | 1003 | 'EventEspresso\core\services\notices\NoticeConverterInterface' |
@@ -22,1061 +22,1061 @@ |
||
22 | 22 | class EE_Dependency_Map |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * This means that the requested class dependency is not present in the dependency map |
|
27 | - */ |
|
28 | - const not_registered = 0; |
|
29 | - |
|
30 | - /** |
|
31 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
32 | - */ |
|
33 | - const load_new_object = 1; |
|
34 | - |
|
35 | - /** |
|
36 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
37 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
38 | - */ |
|
39 | - const load_from_cache = 2; |
|
40 | - |
|
41 | - /** |
|
42 | - * When registering a dependency, |
|
43 | - * this indicates to keep any existing dependencies that already exist, |
|
44 | - * and simply discard any new dependencies declared in the incoming data |
|
45 | - */ |
|
46 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
47 | - |
|
48 | - /** |
|
49 | - * When registering a dependency, |
|
50 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
51 | - */ |
|
52 | - const OVERWRITE_DEPENDENCIES = 1; |
|
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 = []; |
|
88 | - |
|
89 | - /** |
|
90 | - * @type array $_class_loaders |
|
91 | - */ |
|
92 | - protected $_class_loaders = []; |
|
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 InvalidAliasException |
|
110 | - */ |
|
111 | - public function initialize() |
|
112 | - { |
|
113 | - $this->_register_core_dependencies(); |
|
114 | - $this->_register_core_class_loaders(); |
|
115 | - $this->_register_core_aliases(); |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @singleton method used to instantiate class object |
|
121 | - * @param ClassInterfaceCache|null $class_cache |
|
122 | - * @return EE_Dependency_Map |
|
123 | - */ |
|
124 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
125 | - { |
|
126 | - // check if class object is instantiated, and instantiated properly |
|
127 | - if ( |
|
128 | - ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
129 | - && $class_cache instanceof ClassInterfaceCache |
|
130 | - ) { |
|
131 | - EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
|
132 | - } |
|
133 | - return EE_Dependency_Map::$_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 EE_Dependency_Map::$_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(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
210 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
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 = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
|
216 | - if ( |
|
217 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
218 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
219 | - ) { |
|
220 | - unset($dependencies[ $dependency ]); |
|
221 | - $dependencies[ $alias ] = $load_source; |
|
222 | - $registered = true; |
|
223 | - } |
|
224 | - } |
|
225 | - // now add our two lists of dependencies together. |
|
226 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
227 | - // so $dependencies is NOT overwritten because it is listed first |
|
228 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
229 | - // Union is way faster than array_merge() but should be used with caution... |
|
230 | - // especially with numerically indexed arrays |
|
231 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
232 | - // now we need to ensure that the resulting dependencies |
|
233 | - // array only has the entries that are required for the class |
|
234 | - // so first count how many dependencies were originally registered for the class |
|
235 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
236 | - // if that count is non-zero (meaning dependencies were already registered) |
|
237 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
238 | - // then truncate the final array to match that count |
|
239 | - ? array_slice($dependencies, 0, $dependency_count) |
|
240 | - // otherwise just take the incoming array because nothing previously existed |
|
241 | - : $dependencies; |
|
242 | - return $registered; |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - /** |
|
247 | - * @param string $class_name |
|
248 | - * @param string $loader |
|
249 | - * @return bool |
|
250 | - * @throws DomainException |
|
251 | - */ |
|
252 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
253 | - { |
|
254 | - return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader); |
|
255 | - } |
|
256 | - |
|
257 | - |
|
258 | - /** |
|
259 | - * @param string $class_name |
|
260 | - * @param string $loader |
|
261 | - * @return bool |
|
262 | - * @throws DomainException |
|
263 | - */ |
|
264 | - public function registerClassLoader($class_name, $loader = 'load_core') |
|
265 | - { |
|
266 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
267 | - throw new DomainException( |
|
268 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
269 | - ); |
|
270 | - } |
|
271 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
272 | - if ( |
|
273 | - ! is_callable($loader) |
|
274 | - && ( |
|
275 | - strpos($loader, 'load_') !== 0 |
|
276 | - || ! method_exists('EE_Registry', $loader) |
|
277 | - ) |
|
278 | - ) { |
|
279 | - throw new DomainException( |
|
280 | - sprintf( |
|
281 | - esc_html__( |
|
282 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
283 | - 'event_espresso' |
|
284 | - ), |
|
285 | - $loader |
|
286 | - ) |
|
287 | - ); |
|
288 | - } |
|
289 | - $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
290 | - if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
291 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
292 | - return true; |
|
293 | - } |
|
294 | - return false; |
|
295 | - } |
|
296 | - |
|
297 | - |
|
298 | - /** |
|
299 | - * @return array |
|
300 | - */ |
|
301 | - public function dependency_map() |
|
302 | - { |
|
303 | - return $this->_dependency_map; |
|
304 | - } |
|
305 | - |
|
306 | - |
|
307 | - /** |
|
308 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
309 | - * |
|
310 | - * @param string $class_name |
|
311 | - * @return boolean |
|
312 | - */ |
|
313 | - public function has($class_name = '') |
|
314 | - { |
|
315 | - // all legacy models have the same dependencies |
|
316 | - if (strpos($class_name, 'EEM_') === 0) { |
|
317 | - $class_name = 'LEGACY_MODELS'; |
|
318 | - } |
|
319 | - return isset($this->_dependency_map[ $class_name ]); |
|
320 | - } |
|
321 | - |
|
322 | - |
|
323 | - /** |
|
324 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
325 | - * |
|
326 | - * @param string $class_name |
|
327 | - * @param string $dependency |
|
328 | - * @return bool |
|
329 | - */ |
|
330 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
331 | - { |
|
332 | - // all legacy models have the same dependencies |
|
333 | - if (strpos($class_name, 'EEM_') === 0) { |
|
334 | - $class_name = 'LEGACY_MODELS'; |
|
335 | - } |
|
336 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
337 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
338 | - } |
|
339 | - |
|
340 | - |
|
341 | - /** |
|
342 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
343 | - * |
|
344 | - * @param string $class_name |
|
345 | - * @param string $dependency |
|
346 | - * @return int |
|
347 | - */ |
|
348 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
349 | - { |
|
350 | - // all legacy models have the same dependencies |
|
351 | - if (strpos($class_name, 'EEM_') === 0) { |
|
352 | - $class_name = 'LEGACY_MODELS'; |
|
353 | - } |
|
354 | - $dependency = $this->getFqnForAlias($dependency); |
|
355 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
356 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
357 | - : EE_Dependency_Map::not_registered; |
|
358 | - } |
|
359 | - |
|
360 | - |
|
361 | - /** |
|
362 | - * @param string $class_name |
|
363 | - * @return string | Closure |
|
364 | - */ |
|
365 | - public function class_loader($class_name) |
|
366 | - { |
|
367 | - // all legacy models use load_model() |
|
368 | - if (strpos($class_name, 'EEM_') === 0) { |
|
369 | - return 'load_model'; |
|
370 | - } |
|
371 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
372 | - // perform strpos() first to avoid loading regex every time we load a class |
|
373 | - if ( |
|
374 | - strpos($class_name, 'EE_CPT_') === 0 |
|
375 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
376 | - ) { |
|
377 | - return 'load_core'; |
|
378 | - } |
|
379 | - $class_name = $this->getFqnForAlias($class_name); |
|
380 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
381 | - } |
|
382 | - |
|
383 | - |
|
384 | - /** |
|
385 | - * @return array |
|
386 | - */ |
|
387 | - public function class_loaders() |
|
388 | - { |
|
389 | - return $this->_class_loaders; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - /** |
|
394 | - * adds an alias for a classname |
|
395 | - * |
|
396 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
397 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
398 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
399 | - * @throws InvalidAliasException |
|
400 | - */ |
|
401 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
402 | - { |
|
403 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
404 | - } |
|
405 | - |
|
406 | - |
|
407 | - /** |
|
408 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
409 | - * WHY? |
|
410 | - * Because if a class is type hinting for a concretion, |
|
411 | - * then why would we need to find another class to supply it? |
|
412 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
413 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
414 | - * Don't go looking for some substitute. |
|
415 | - * Whereas if a class is type hinting for an interface... |
|
416 | - * then we need to find an actual class to use. |
|
417 | - * So the interface IS the alias for some other FQN, |
|
418 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
419 | - * represents some other class. |
|
420 | - * |
|
421 | - * @param string $fqn |
|
422 | - * @param string $for_class |
|
423 | - * @return bool |
|
424 | - */ |
|
425 | - public function isAlias($fqn = '', $for_class = '') |
|
426 | - { |
|
427 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
428 | - } |
|
429 | - |
|
430 | - |
|
431 | - /** |
|
432 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
433 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
434 | - * for example: |
|
435 | - * if the following two entries were added to the _aliases array: |
|
436 | - * array( |
|
437 | - * 'interface_alias' => 'some\namespace\interface' |
|
438 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
439 | - * ) |
|
440 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
441 | - * to load an instance of 'some\namespace\classname' |
|
442 | - * |
|
443 | - * @param string $alias |
|
444 | - * @param string $for_class |
|
445 | - * @return string |
|
446 | - */ |
|
447 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
448 | - { |
|
449 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
450 | - } |
|
451 | - |
|
452 | - |
|
453 | - /** |
|
454 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
455 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
456 | - * This is done by using the following class constants: |
|
457 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
458 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
459 | - */ |
|
460 | - protected function _register_core_dependencies() |
|
461 | - { |
|
462 | - $this->_dependency_map = [ |
|
463 | - 'EE_Request_Handler' => [ |
|
464 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
465 | - ], |
|
466 | - 'EE_System' => [ |
|
467 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
468 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
469 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
470 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
471 | - 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
472 | - ], |
|
473 | - 'EE_Admin' => [ |
|
474 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
475 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
476 | - ], |
|
477 | - 'EE_Cart' => [ |
|
478 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
479 | - ], |
|
480 | - 'EE_Messenger_Collection_Loader' => [ |
|
481 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
482 | - ], |
|
483 | - 'EE_Message_Type_Collection_Loader' => [ |
|
484 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
485 | - ], |
|
486 | - 'EE_Message_Resource_Manager' => [ |
|
487 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
488 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
489 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
490 | - ], |
|
491 | - 'EE_Message_Factory' => [ |
|
492 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
493 | - ], |
|
494 | - 'EE_messages' => [ |
|
495 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
496 | - ], |
|
497 | - 'EE_Messages_Generator' => [ |
|
498 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
499 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
500 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
501 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
502 | - ], |
|
503 | - 'EE_Messages_Processor' => [ |
|
504 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
505 | - ], |
|
506 | - 'EE_Messages_Queue' => [ |
|
507 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
508 | - ], |
|
509 | - 'EE_Messages_Template_Defaults' => [ |
|
510 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
511 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
512 | - ], |
|
513 | - 'EE_Message_To_Generate_From_Request' => [ |
|
514 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
515 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
516 | - ], |
|
517 | - 'EventEspresso\core\services\commands\CommandBus' => [ |
|
518 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
519 | - ], |
|
520 | - 'EventEspresso\services\commands\CommandHandler' => [ |
|
521 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
522 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
523 | - ], |
|
524 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
525 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
526 | - ], |
|
527 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
528 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
529 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
530 | - ], |
|
531 | - 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
532 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
533 | - ], |
|
534 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
535 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
536 | - ], |
|
537 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
538 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
539 | - ], |
|
540 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
541 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
542 | - ], |
|
543 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
544 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
545 | - ], |
|
546 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
547 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
548 | - ], |
|
549 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
550 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
551 | - ], |
|
552 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
553 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
554 | - ], |
|
555 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
556 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
557 | - ], |
|
558 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
559 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
560 | - ], |
|
561 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
562 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
563 | - ], |
|
564 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
565 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
566 | - ], |
|
567 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
568 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
569 | - ], |
|
570 | - 'EventEspresso\core\services\database\TableManager' => [ |
|
571 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
572 | - ], |
|
573 | - 'EE_Data_Migration_Class_Base' => [ |
|
574 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
575 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
576 | - ], |
|
577 | - 'EE_DMS_Core_4_1_0' => [ |
|
578 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
579 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
580 | - ], |
|
581 | - 'EE_DMS_Core_4_2_0' => [ |
|
582 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | - ], |
|
585 | - 'EE_DMS_Core_4_3_0' => [ |
|
586 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | - ], |
|
589 | - 'EE_DMS_Core_4_4_0' => [ |
|
590 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | - ], |
|
593 | - 'EE_DMS_Core_4_5_0' => [ |
|
594 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | - ], |
|
597 | - 'EE_DMS_Core_4_6_0' => [ |
|
598 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | - ], |
|
601 | - 'EE_DMS_Core_4_7_0' => [ |
|
602 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | - ], |
|
605 | - 'EE_DMS_Core_4_8_0' => [ |
|
606 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | - ], |
|
609 | - 'EE_DMS_Core_4_9_0' => [ |
|
610 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | - ], |
|
613 | - 'EE_DMS_Core_4_10_0' => [ |
|
614 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
615 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
616 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
617 | - ], |
|
618 | - 'EE_DMS_Core_4_11_0' => [ |
|
619 | - 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
620 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
621 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
622 | - ], |
|
623 | - 'EE_DMS_Core_4_12_0' => [ |
|
624 | - 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache, |
|
625 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
626 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
627 | - ], |
|
628 | - 'EventEspresso\core\services\assets\Registry' => [ |
|
629 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
630 | - 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
631 | - ], |
|
632 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
633 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
634 | - ], |
|
635 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
636 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
637 | - ], |
|
638 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
639 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
640 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
641 | - ], |
|
642 | - 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
643 | - null, |
|
644 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
645 | - ], |
|
646 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
647 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
648 | - ], |
|
649 | - 'LEGACY_MODELS' => [ |
|
650 | - null, |
|
651 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
652 | - ], |
|
653 | - 'EE_Module_Request_Router' => [ |
|
654 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
655 | - ], |
|
656 | - 'EE_Registration_Processor' => [ |
|
657 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
658 | - ], |
|
659 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
660 | - null, |
|
661 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
662 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
663 | - ], |
|
664 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
665 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
666 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
667 | - ], |
|
668 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
669 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
670 | - ], |
|
671 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
672 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
673 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
674 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
675 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
676 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
677 | - ], |
|
678 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
679 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
680 | - ], |
|
681 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
682 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
683 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
684 | - ], |
|
685 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
686 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
687 | - ], |
|
688 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
689 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
690 | - ], |
|
691 | - 'EE_CPT_Strategy' => [ |
|
692 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
693 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
694 | - ], |
|
695 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
696 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
697 | - ], |
|
698 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
699 | - null, |
|
700 | - null, |
|
701 | - null, |
|
702 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
703 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
704 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
705 | - ], |
|
706 | - 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
707 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
708 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
709 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
710 | - ], |
|
711 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
712 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
713 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
714 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
715 | - ], |
|
716 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
717 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
718 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
719 | - ], |
|
720 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
721 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
722 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
723 | - ], |
|
724 | - 'EE_URL_Validation_Strategy' => [ |
|
725 | - null, |
|
726 | - null, |
|
727 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
728 | - ], |
|
729 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
730 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
731 | - ], |
|
732 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
733 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
734 | - ], |
|
735 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
736 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
737 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
738 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
739 | - null, |
|
740 | - ], |
|
741 | - 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
742 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
743 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
744 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
745 | - 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
746 | - ], |
|
747 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
748 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
749 | - ], |
|
750 | - 'EventEspresso\core\services\routing\Router' => [ |
|
751 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
752 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
753 | - 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
754 | - ], |
|
755 | - 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
756 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
757 | - ], |
|
758 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
759 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
760 | - ], |
|
761 | - 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
762 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
763 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
764 | - ], |
|
765 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
766 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
767 | - ], |
|
768 | - 'EventEspresso\core\services\addon\AddonManager' => [ |
|
769 | - 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache, |
|
770 | - 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache, |
|
771 | - 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache, |
|
772 | - 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache, |
|
773 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache, |
|
774 | - ], |
|
775 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [ |
|
776 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
777 | - ], |
|
778 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
779 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache |
|
780 | - ], |
|
781 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
782 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache |
|
783 | - ], |
|
784 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
785 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
786 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
787 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
788 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
789 | - ], |
|
790 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
791 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
792 | - ], |
|
793 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => [ |
|
794 | - 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
795 | - ], |
|
796 | - 'EventEspresso\core\services\form\meta\InputTypes' => [ |
|
797 | - 'EventEspresso\core\services\form\meta\inputs\Block' => EE_Dependency_Map::load_from_cache, |
|
798 | - 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache, |
|
799 | - 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache, |
|
800 | - 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache, |
|
801 | - 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache, |
|
802 | - 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache, |
|
803 | - 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache, |
|
804 | - 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache, |
|
805 | - ], |
|
806 | - 'EventEspresso\core\domain\services\registration\form\v1\RegFormDependencyHandler' => [ |
|
807 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
808 | - ], |
|
809 | - ]; |
|
810 | - } |
|
811 | - |
|
812 | - |
|
813 | - /** |
|
814 | - * Registers how core classes are loaded. |
|
815 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
816 | - * 'EE_Request_Handler' => 'load_core' |
|
817 | - * 'EE_Messages_Queue' => 'load_lib' |
|
818 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
819 | - * or, if greater control is required, by providing a custom closure. For example: |
|
820 | - * 'Some_Class' => function () { |
|
821 | - * return new Some_Class(); |
|
822 | - * }, |
|
823 | - * This is required for instantiating dependencies |
|
824 | - * where an interface has been type hinted in a class constructor. For example: |
|
825 | - * 'Required_Interface' => function () { |
|
826 | - * return new A_Class_That_Implements_Required_Interface(); |
|
827 | - * }, |
|
828 | - */ |
|
829 | - protected function _register_core_class_loaders() |
|
830 | - { |
|
831 | - $this->_class_loaders = [ |
|
832 | - // load_core |
|
833 | - 'EE_Dependency_Map' => function () { |
|
834 | - return $this; |
|
835 | - }, |
|
836 | - 'EE_Capabilities' => 'load_core', |
|
837 | - 'EE_Encryption' => 'load_core', |
|
838 | - 'EE_Front_Controller' => 'load_core', |
|
839 | - 'EE_Module_Request_Router' => 'load_core', |
|
840 | - 'EE_Registry' => 'load_core', |
|
841 | - 'EE_Request' => function () { |
|
842 | - return $this->legacy_request; |
|
843 | - }, |
|
844 | - 'EventEspresso\core\services\request\Request' => function () { |
|
845 | - return $this->request; |
|
846 | - }, |
|
847 | - 'EventEspresso\core\services\request\Response' => function () { |
|
848 | - return $this->response; |
|
849 | - }, |
|
850 | - 'EE_Base' => 'load_core', |
|
851 | - 'EE_Request_Handler' => 'load_core', |
|
852 | - 'EE_Session' => 'load_core', |
|
853 | - 'EE_Cron_Tasks' => 'load_core', |
|
854 | - 'EE_System' => 'load_core', |
|
855 | - 'EE_Maintenance_Mode' => 'load_core', |
|
856 | - 'EE_Register_CPTs' => 'load_core', |
|
857 | - 'EE_Admin' => 'load_core', |
|
858 | - 'EE_CPT_Strategy' => 'load_core', |
|
859 | - // load_class |
|
860 | - 'EE_Registration_Processor' => 'load_class', |
|
861 | - // load_lib |
|
862 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
863 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
864 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
865 | - 'EE_Messenger_Collection' => 'load_lib', |
|
866 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
867 | - 'EE_Messages_Processor' => 'load_lib', |
|
868 | - 'EE_Message_Repository' => 'load_lib', |
|
869 | - 'EE_Messages_Queue' => 'load_lib', |
|
870 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
871 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
872 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
873 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
874 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
875 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
876 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
877 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
878 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
879 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
880 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
881 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
882 | - 'EE_DMS_Core_4_11_0' => 'load_dms', |
|
883 | - 'EE_DMS_Core_4_12_0' => 'load_dms', |
|
884 | - 'EE_Messages_Generator' => static function () { |
|
885 | - return EE_Registry::instance()->load_lib( |
|
886 | - 'Messages_Generator', |
|
887 | - [], |
|
888 | - false, |
|
889 | - false |
|
890 | - ); |
|
891 | - }, |
|
892 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
893 | - return EE_Registry::instance()->load_lib( |
|
894 | - 'Messages_Template_Defaults', |
|
895 | - $arguments, |
|
896 | - false, |
|
897 | - false |
|
898 | - ); |
|
899 | - }, |
|
900 | - // load_helper |
|
901 | - 'EEH_Parse_Shortcodes' => static function () { |
|
902 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
903 | - return new EEH_Parse_Shortcodes(); |
|
904 | - } |
|
905 | - return null; |
|
906 | - }, |
|
907 | - 'EE_Template_Config' => static function () { |
|
908 | - return EE_Config::instance()->template_settings; |
|
909 | - }, |
|
910 | - 'EE_Currency_Config' => static function () { |
|
911 | - return EE_Config::instance()->currency; |
|
912 | - }, |
|
913 | - 'EE_Registration_Config' => static function () { |
|
914 | - return EE_Config::instance()->registration; |
|
915 | - }, |
|
916 | - 'EE_Core_Config' => static function () { |
|
917 | - return EE_Config::instance()->core; |
|
918 | - }, |
|
919 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
920 | - return LoaderFactory::getLoader(); |
|
921 | - }, |
|
922 | - 'EE_Network_Config' => static function () { |
|
923 | - return EE_Network_Config::instance(); |
|
924 | - }, |
|
925 | - 'EE_Config' => static function () { |
|
926 | - return EE_Config::instance(); |
|
927 | - }, |
|
928 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
929 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
930 | - }, |
|
931 | - 'EE_Admin_Config' => static function () { |
|
932 | - return EE_Config::instance()->admin; |
|
933 | - }, |
|
934 | - 'EE_Organization_Config' => static function () { |
|
935 | - return EE_Config::instance()->organization; |
|
936 | - }, |
|
937 | - 'EE_Network_Core_Config' => static function () { |
|
938 | - return EE_Network_Config::instance()->core; |
|
939 | - }, |
|
940 | - 'EE_Environment_Config' => static function () { |
|
941 | - return EE_Config::instance()->environment; |
|
942 | - }, |
|
943 | - 'EED_Core_Rest_Api' => static function () { |
|
944 | - return EED_Core_Rest_Api::instance(); |
|
945 | - }, |
|
946 | - 'WP_REST_Server' => static function () { |
|
947 | - return rest_get_server(); |
|
948 | - }, |
|
949 | - 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
950 | - return EE_Psr4AutoloaderInit::psr4_loader(); |
|
951 | - }, |
|
952 | - ]; |
|
953 | - } |
|
954 | - |
|
955 | - |
|
956 | - /** |
|
957 | - * can be used for supplying alternate names for classes, |
|
958 | - * or for connecting interface names to instantiable classes |
|
959 | - * |
|
960 | - * @throws InvalidAliasException |
|
961 | - */ |
|
962 | - protected function _register_core_aliases() |
|
963 | - { |
|
964 | - $aliases = [ |
|
965 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
966 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
967 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
968 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
969 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
970 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
971 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
972 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
973 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
974 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
975 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
976 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
977 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
978 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
979 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
980 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
981 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
982 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
983 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
984 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
985 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
986 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
987 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
988 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
989 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
990 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
991 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
992 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
993 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
994 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
995 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
996 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
997 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
998 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
999 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1000 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1001 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1002 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
1003 | - 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
1004 | - ]; |
|
1005 | - foreach ($aliases as $alias => $fqn) { |
|
1006 | - if (is_array($fqn)) { |
|
1007 | - foreach ($fqn as $class => $for_class) { |
|
1008 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
1009 | - } |
|
1010 | - continue; |
|
1011 | - } |
|
1012 | - $this->class_cache->addAlias($fqn, $alias); |
|
1013 | - } |
|
1014 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1015 | - $this->class_cache->addAlias( |
|
1016 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1017 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1018 | - ); |
|
1019 | - } |
|
1020 | - } |
|
1021 | - |
|
1022 | - |
|
1023 | - /** |
|
1024 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1025 | - * request Primarily used by unit tests. |
|
1026 | - */ |
|
1027 | - public function reset() |
|
1028 | - { |
|
1029 | - $this->_register_core_class_loaders(); |
|
1030 | - $this->_register_core_dependencies(); |
|
1031 | - } |
|
1032 | - |
|
1033 | - |
|
1034 | - /** |
|
1035 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
1036 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
1037 | - * WHY? |
|
1038 | - * Because if a class is type hinting for a concretion, |
|
1039 | - * then why would we need to find another class to supply it? |
|
1040 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1041 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1042 | - * Don't go looking for some substitute. |
|
1043 | - * Whereas if a class is type hinting for an interface... |
|
1044 | - * then we need to find an actual class to use. |
|
1045 | - * So the interface IS the alias for some other FQN, |
|
1046 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1047 | - * represents some other class. |
|
1048 | - * |
|
1049 | - * @param string $fqn |
|
1050 | - * @param string $for_class |
|
1051 | - * @return bool |
|
1052 | - * @deprecated 4.9.62.p |
|
1053 | - */ |
|
1054 | - public function has_alias($fqn = '', $for_class = '') |
|
1055 | - { |
|
1056 | - return $this->isAlias($fqn, $for_class); |
|
1057 | - } |
|
1058 | - |
|
1059 | - |
|
1060 | - /** |
|
1061 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1062 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1063 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1064 | - * for example: |
|
1065 | - * if the following two entries were added to the _aliases array: |
|
1066 | - * array( |
|
1067 | - * 'interface_alias' => 'some\namespace\interface' |
|
1068 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1069 | - * ) |
|
1070 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1071 | - * to load an instance of 'some\namespace\classname' |
|
1072 | - * |
|
1073 | - * @param string $alias |
|
1074 | - * @param string $for_class |
|
1075 | - * @return string |
|
1076 | - * @deprecated 4.9.62.p |
|
1077 | - */ |
|
1078 | - public function get_alias($alias = '', $for_class = '') |
|
1079 | - { |
|
1080 | - return $this->getFqnForAlias($alias, $for_class); |
|
1081 | - } |
|
25 | + /** |
|
26 | + * This means that the requested class dependency is not present in the dependency map |
|
27 | + */ |
|
28 | + const not_registered = 0; |
|
29 | + |
|
30 | + /** |
|
31 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
32 | + */ |
|
33 | + const load_new_object = 1; |
|
34 | + |
|
35 | + /** |
|
36 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
37 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
38 | + */ |
|
39 | + const load_from_cache = 2; |
|
40 | + |
|
41 | + /** |
|
42 | + * When registering a dependency, |
|
43 | + * this indicates to keep any existing dependencies that already exist, |
|
44 | + * and simply discard any new dependencies declared in the incoming data |
|
45 | + */ |
|
46 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
47 | + |
|
48 | + /** |
|
49 | + * When registering a dependency, |
|
50 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
51 | + */ |
|
52 | + const OVERWRITE_DEPENDENCIES = 1; |
|
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 = []; |
|
88 | + |
|
89 | + /** |
|
90 | + * @type array $_class_loaders |
|
91 | + */ |
|
92 | + protected $_class_loaders = []; |
|
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 InvalidAliasException |
|
110 | + */ |
|
111 | + public function initialize() |
|
112 | + { |
|
113 | + $this->_register_core_dependencies(); |
|
114 | + $this->_register_core_class_loaders(); |
|
115 | + $this->_register_core_aliases(); |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @singleton method used to instantiate class object |
|
121 | + * @param ClassInterfaceCache|null $class_cache |
|
122 | + * @return EE_Dependency_Map |
|
123 | + */ |
|
124 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
125 | + { |
|
126 | + // check if class object is instantiated, and instantiated properly |
|
127 | + if ( |
|
128 | + ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
129 | + && $class_cache instanceof ClassInterfaceCache |
|
130 | + ) { |
|
131 | + EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
|
132 | + } |
|
133 | + return EE_Dependency_Map::$_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 EE_Dependency_Map::$_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(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
210 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
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 = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
|
216 | + if ( |
|
217 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
218 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
219 | + ) { |
|
220 | + unset($dependencies[ $dependency ]); |
|
221 | + $dependencies[ $alias ] = $load_source; |
|
222 | + $registered = true; |
|
223 | + } |
|
224 | + } |
|
225 | + // now add our two lists of dependencies together. |
|
226 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
227 | + // so $dependencies is NOT overwritten because it is listed first |
|
228 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
229 | + // Union is way faster than array_merge() but should be used with caution... |
|
230 | + // especially with numerically indexed arrays |
|
231 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
232 | + // now we need to ensure that the resulting dependencies |
|
233 | + // array only has the entries that are required for the class |
|
234 | + // so first count how many dependencies were originally registered for the class |
|
235 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
236 | + // if that count is non-zero (meaning dependencies were already registered) |
|
237 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
238 | + // then truncate the final array to match that count |
|
239 | + ? array_slice($dependencies, 0, $dependency_count) |
|
240 | + // otherwise just take the incoming array because nothing previously existed |
|
241 | + : $dependencies; |
|
242 | + return $registered; |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + /** |
|
247 | + * @param string $class_name |
|
248 | + * @param string $loader |
|
249 | + * @return bool |
|
250 | + * @throws DomainException |
|
251 | + */ |
|
252 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
253 | + { |
|
254 | + return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader); |
|
255 | + } |
|
256 | + |
|
257 | + |
|
258 | + /** |
|
259 | + * @param string $class_name |
|
260 | + * @param string $loader |
|
261 | + * @return bool |
|
262 | + * @throws DomainException |
|
263 | + */ |
|
264 | + public function registerClassLoader($class_name, $loader = 'load_core') |
|
265 | + { |
|
266 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
267 | + throw new DomainException( |
|
268 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
269 | + ); |
|
270 | + } |
|
271 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
272 | + if ( |
|
273 | + ! is_callable($loader) |
|
274 | + && ( |
|
275 | + strpos($loader, 'load_') !== 0 |
|
276 | + || ! method_exists('EE_Registry', $loader) |
|
277 | + ) |
|
278 | + ) { |
|
279 | + throw new DomainException( |
|
280 | + sprintf( |
|
281 | + esc_html__( |
|
282 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
283 | + 'event_espresso' |
|
284 | + ), |
|
285 | + $loader |
|
286 | + ) |
|
287 | + ); |
|
288 | + } |
|
289 | + $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
290 | + if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
291 | + EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
292 | + return true; |
|
293 | + } |
|
294 | + return false; |
|
295 | + } |
|
296 | + |
|
297 | + |
|
298 | + /** |
|
299 | + * @return array |
|
300 | + */ |
|
301 | + public function dependency_map() |
|
302 | + { |
|
303 | + return $this->_dependency_map; |
|
304 | + } |
|
305 | + |
|
306 | + |
|
307 | + /** |
|
308 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
309 | + * |
|
310 | + * @param string $class_name |
|
311 | + * @return boolean |
|
312 | + */ |
|
313 | + public function has($class_name = '') |
|
314 | + { |
|
315 | + // all legacy models have the same dependencies |
|
316 | + if (strpos($class_name, 'EEM_') === 0) { |
|
317 | + $class_name = 'LEGACY_MODELS'; |
|
318 | + } |
|
319 | + return isset($this->_dependency_map[ $class_name ]); |
|
320 | + } |
|
321 | + |
|
322 | + |
|
323 | + /** |
|
324 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
325 | + * |
|
326 | + * @param string $class_name |
|
327 | + * @param string $dependency |
|
328 | + * @return bool |
|
329 | + */ |
|
330 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
331 | + { |
|
332 | + // all legacy models have the same dependencies |
|
333 | + if (strpos($class_name, 'EEM_') === 0) { |
|
334 | + $class_name = 'LEGACY_MODELS'; |
|
335 | + } |
|
336 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
337 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
338 | + } |
|
339 | + |
|
340 | + |
|
341 | + /** |
|
342 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
343 | + * |
|
344 | + * @param string $class_name |
|
345 | + * @param string $dependency |
|
346 | + * @return int |
|
347 | + */ |
|
348 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
349 | + { |
|
350 | + // all legacy models have the same dependencies |
|
351 | + if (strpos($class_name, 'EEM_') === 0) { |
|
352 | + $class_name = 'LEGACY_MODELS'; |
|
353 | + } |
|
354 | + $dependency = $this->getFqnForAlias($dependency); |
|
355 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
356 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
357 | + : EE_Dependency_Map::not_registered; |
|
358 | + } |
|
359 | + |
|
360 | + |
|
361 | + /** |
|
362 | + * @param string $class_name |
|
363 | + * @return string | Closure |
|
364 | + */ |
|
365 | + public function class_loader($class_name) |
|
366 | + { |
|
367 | + // all legacy models use load_model() |
|
368 | + if (strpos($class_name, 'EEM_') === 0) { |
|
369 | + return 'load_model'; |
|
370 | + } |
|
371 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
372 | + // perform strpos() first to avoid loading regex every time we load a class |
|
373 | + if ( |
|
374 | + strpos($class_name, 'EE_CPT_') === 0 |
|
375 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
376 | + ) { |
|
377 | + return 'load_core'; |
|
378 | + } |
|
379 | + $class_name = $this->getFqnForAlias($class_name); |
|
380 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
381 | + } |
|
382 | + |
|
383 | + |
|
384 | + /** |
|
385 | + * @return array |
|
386 | + */ |
|
387 | + public function class_loaders() |
|
388 | + { |
|
389 | + return $this->_class_loaders; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + /** |
|
394 | + * adds an alias for a classname |
|
395 | + * |
|
396 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
397 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
398 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
399 | + * @throws InvalidAliasException |
|
400 | + */ |
|
401 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
402 | + { |
|
403 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
404 | + } |
|
405 | + |
|
406 | + |
|
407 | + /** |
|
408 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
409 | + * WHY? |
|
410 | + * Because if a class is type hinting for a concretion, |
|
411 | + * then why would we need to find another class to supply it? |
|
412 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
413 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
414 | + * Don't go looking for some substitute. |
|
415 | + * Whereas if a class is type hinting for an interface... |
|
416 | + * then we need to find an actual class to use. |
|
417 | + * So the interface IS the alias for some other FQN, |
|
418 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
419 | + * represents some other class. |
|
420 | + * |
|
421 | + * @param string $fqn |
|
422 | + * @param string $for_class |
|
423 | + * @return bool |
|
424 | + */ |
|
425 | + public function isAlias($fqn = '', $for_class = '') |
|
426 | + { |
|
427 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
428 | + } |
|
429 | + |
|
430 | + |
|
431 | + /** |
|
432 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
433 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
434 | + * for example: |
|
435 | + * if the following two entries were added to the _aliases array: |
|
436 | + * array( |
|
437 | + * 'interface_alias' => 'some\namespace\interface' |
|
438 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
439 | + * ) |
|
440 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
441 | + * to load an instance of 'some\namespace\classname' |
|
442 | + * |
|
443 | + * @param string $alias |
|
444 | + * @param string $for_class |
|
445 | + * @return string |
|
446 | + */ |
|
447 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
448 | + { |
|
449 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
450 | + } |
|
451 | + |
|
452 | + |
|
453 | + /** |
|
454 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
455 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
456 | + * This is done by using the following class constants: |
|
457 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
458 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
459 | + */ |
|
460 | + protected function _register_core_dependencies() |
|
461 | + { |
|
462 | + $this->_dependency_map = [ |
|
463 | + 'EE_Request_Handler' => [ |
|
464 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
465 | + ], |
|
466 | + 'EE_System' => [ |
|
467 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
468 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
469 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
470 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
471 | + 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
472 | + ], |
|
473 | + 'EE_Admin' => [ |
|
474 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
475 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
476 | + ], |
|
477 | + 'EE_Cart' => [ |
|
478 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
479 | + ], |
|
480 | + 'EE_Messenger_Collection_Loader' => [ |
|
481 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
482 | + ], |
|
483 | + 'EE_Message_Type_Collection_Loader' => [ |
|
484 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
485 | + ], |
|
486 | + 'EE_Message_Resource_Manager' => [ |
|
487 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
488 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
489 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
490 | + ], |
|
491 | + 'EE_Message_Factory' => [ |
|
492 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
493 | + ], |
|
494 | + 'EE_messages' => [ |
|
495 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
496 | + ], |
|
497 | + 'EE_Messages_Generator' => [ |
|
498 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
499 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
500 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
501 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
502 | + ], |
|
503 | + 'EE_Messages_Processor' => [ |
|
504 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
505 | + ], |
|
506 | + 'EE_Messages_Queue' => [ |
|
507 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
508 | + ], |
|
509 | + 'EE_Messages_Template_Defaults' => [ |
|
510 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
511 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
512 | + ], |
|
513 | + 'EE_Message_To_Generate_From_Request' => [ |
|
514 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
515 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
516 | + ], |
|
517 | + 'EventEspresso\core\services\commands\CommandBus' => [ |
|
518 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
519 | + ], |
|
520 | + 'EventEspresso\services\commands\CommandHandler' => [ |
|
521 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
522 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
523 | + ], |
|
524 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
525 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
526 | + ], |
|
527 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
528 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
529 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
530 | + ], |
|
531 | + 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
532 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
533 | + ], |
|
534 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
535 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
536 | + ], |
|
537 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
538 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
539 | + ], |
|
540 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
541 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
542 | + ], |
|
543 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
544 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
545 | + ], |
|
546 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
547 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
548 | + ], |
|
549 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
550 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
551 | + ], |
|
552 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
553 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
554 | + ], |
|
555 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
556 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
557 | + ], |
|
558 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
559 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
560 | + ], |
|
561 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
562 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
563 | + ], |
|
564 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
565 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
566 | + ], |
|
567 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
568 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
569 | + ], |
|
570 | + 'EventEspresso\core\services\database\TableManager' => [ |
|
571 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
572 | + ], |
|
573 | + 'EE_Data_Migration_Class_Base' => [ |
|
574 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
575 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
576 | + ], |
|
577 | + 'EE_DMS_Core_4_1_0' => [ |
|
578 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
579 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
580 | + ], |
|
581 | + 'EE_DMS_Core_4_2_0' => [ |
|
582 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | + ], |
|
585 | + 'EE_DMS_Core_4_3_0' => [ |
|
586 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | + ], |
|
589 | + 'EE_DMS_Core_4_4_0' => [ |
|
590 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | + ], |
|
593 | + 'EE_DMS_Core_4_5_0' => [ |
|
594 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | + ], |
|
597 | + 'EE_DMS_Core_4_6_0' => [ |
|
598 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | + ], |
|
601 | + 'EE_DMS_Core_4_7_0' => [ |
|
602 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | + ], |
|
605 | + 'EE_DMS_Core_4_8_0' => [ |
|
606 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | + ], |
|
609 | + 'EE_DMS_Core_4_9_0' => [ |
|
610 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | + ], |
|
613 | + 'EE_DMS_Core_4_10_0' => [ |
|
614 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
615 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
616 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
617 | + ], |
|
618 | + 'EE_DMS_Core_4_11_0' => [ |
|
619 | + 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
620 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
621 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
622 | + ], |
|
623 | + 'EE_DMS_Core_4_12_0' => [ |
|
624 | + 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache, |
|
625 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
626 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
627 | + ], |
|
628 | + 'EventEspresso\core\services\assets\Registry' => [ |
|
629 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
630 | + 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
631 | + ], |
|
632 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
633 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
634 | + ], |
|
635 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
636 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
637 | + ], |
|
638 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
639 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
640 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
641 | + ], |
|
642 | + 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
643 | + null, |
|
644 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
645 | + ], |
|
646 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
647 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
648 | + ], |
|
649 | + 'LEGACY_MODELS' => [ |
|
650 | + null, |
|
651 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
652 | + ], |
|
653 | + 'EE_Module_Request_Router' => [ |
|
654 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
655 | + ], |
|
656 | + 'EE_Registration_Processor' => [ |
|
657 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
658 | + ], |
|
659 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
660 | + null, |
|
661 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
662 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
663 | + ], |
|
664 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
665 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
666 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
667 | + ], |
|
668 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
669 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
670 | + ], |
|
671 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
672 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
673 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
674 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
675 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
676 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
677 | + ], |
|
678 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
679 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
680 | + ], |
|
681 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
682 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
683 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
684 | + ], |
|
685 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
686 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
687 | + ], |
|
688 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
689 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
690 | + ], |
|
691 | + 'EE_CPT_Strategy' => [ |
|
692 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
693 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
694 | + ], |
|
695 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
696 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
697 | + ], |
|
698 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
699 | + null, |
|
700 | + null, |
|
701 | + null, |
|
702 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
703 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
704 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
705 | + ], |
|
706 | + 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
707 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
708 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
709 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
710 | + ], |
|
711 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
712 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
713 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
714 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
715 | + ], |
|
716 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
717 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
718 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
719 | + ], |
|
720 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
721 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
722 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
723 | + ], |
|
724 | + 'EE_URL_Validation_Strategy' => [ |
|
725 | + null, |
|
726 | + null, |
|
727 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
728 | + ], |
|
729 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
730 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
731 | + ], |
|
732 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
733 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
734 | + ], |
|
735 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
736 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
737 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
738 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
739 | + null, |
|
740 | + ], |
|
741 | + 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
742 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
743 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
744 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
745 | + 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
746 | + ], |
|
747 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
748 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
749 | + ], |
|
750 | + 'EventEspresso\core\services\routing\Router' => [ |
|
751 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
752 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
753 | + 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
754 | + ], |
|
755 | + 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
756 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
757 | + ], |
|
758 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
759 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
760 | + ], |
|
761 | + 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
762 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
763 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
764 | + ], |
|
765 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
766 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
767 | + ], |
|
768 | + 'EventEspresso\core\services\addon\AddonManager' => [ |
|
769 | + 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache, |
|
770 | + 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache, |
|
771 | + 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache, |
|
772 | + 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache, |
|
773 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache, |
|
774 | + ], |
|
775 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [ |
|
776 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
777 | + ], |
|
778 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
779 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache |
|
780 | + ], |
|
781 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
782 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache |
|
783 | + ], |
|
784 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
785 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
786 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
787 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
788 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
789 | + ], |
|
790 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
791 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
792 | + ], |
|
793 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => [ |
|
794 | + 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
795 | + ], |
|
796 | + 'EventEspresso\core\services\form\meta\InputTypes' => [ |
|
797 | + 'EventEspresso\core\services\form\meta\inputs\Block' => EE_Dependency_Map::load_from_cache, |
|
798 | + 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache, |
|
799 | + 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache, |
|
800 | + 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache, |
|
801 | + 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache, |
|
802 | + 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache, |
|
803 | + 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache, |
|
804 | + 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache, |
|
805 | + ], |
|
806 | + 'EventEspresso\core\domain\services\registration\form\v1\RegFormDependencyHandler' => [ |
|
807 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
808 | + ], |
|
809 | + ]; |
|
810 | + } |
|
811 | + |
|
812 | + |
|
813 | + /** |
|
814 | + * Registers how core classes are loaded. |
|
815 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
816 | + * 'EE_Request_Handler' => 'load_core' |
|
817 | + * 'EE_Messages_Queue' => 'load_lib' |
|
818 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
819 | + * or, if greater control is required, by providing a custom closure. For example: |
|
820 | + * 'Some_Class' => function () { |
|
821 | + * return new Some_Class(); |
|
822 | + * }, |
|
823 | + * This is required for instantiating dependencies |
|
824 | + * where an interface has been type hinted in a class constructor. For example: |
|
825 | + * 'Required_Interface' => function () { |
|
826 | + * return new A_Class_That_Implements_Required_Interface(); |
|
827 | + * }, |
|
828 | + */ |
|
829 | + protected function _register_core_class_loaders() |
|
830 | + { |
|
831 | + $this->_class_loaders = [ |
|
832 | + // load_core |
|
833 | + 'EE_Dependency_Map' => function () { |
|
834 | + return $this; |
|
835 | + }, |
|
836 | + 'EE_Capabilities' => 'load_core', |
|
837 | + 'EE_Encryption' => 'load_core', |
|
838 | + 'EE_Front_Controller' => 'load_core', |
|
839 | + 'EE_Module_Request_Router' => 'load_core', |
|
840 | + 'EE_Registry' => 'load_core', |
|
841 | + 'EE_Request' => function () { |
|
842 | + return $this->legacy_request; |
|
843 | + }, |
|
844 | + 'EventEspresso\core\services\request\Request' => function () { |
|
845 | + return $this->request; |
|
846 | + }, |
|
847 | + 'EventEspresso\core\services\request\Response' => function () { |
|
848 | + return $this->response; |
|
849 | + }, |
|
850 | + 'EE_Base' => 'load_core', |
|
851 | + 'EE_Request_Handler' => 'load_core', |
|
852 | + 'EE_Session' => 'load_core', |
|
853 | + 'EE_Cron_Tasks' => 'load_core', |
|
854 | + 'EE_System' => 'load_core', |
|
855 | + 'EE_Maintenance_Mode' => 'load_core', |
|
856 | + 'EE_Register_CPTs' => 'load_core', |
|
857 | + 'EE_Admin' => 'load_core', |
|
858 | + 'EE_CPT_Strategy' => 'load_core', |
|
859 | + // load_class |
|
860 | + 'EE_Registration_Processor' => 'load_class', |
|
861 | + // load_lib |
|
862 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
863 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
864 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
865 | + 'EE_Messenger_Collection' => 'load_lib', |
|
866 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
867 | + 'EE_Messages_Processor' => 'load_lib', |
|
868 | + 'EE_Message_Repository' => 'load_lib', |
|
869 | + 'EE_Messages_Queue' => 'load_lib', |
|
870 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
871 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
872 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
873 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
874 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
875 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
876 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
877 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
878 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
879 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
880 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
881 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
882 | + 'EE_DMS_Core_4_11_0' => 'load_dms', |
|
883 | + 'EE_DMS_Core_4_12_0' => 'load_dms', |
|
884 | + 'EE_Messages_Generator' => static function () { |
|
885 | + return EE_Registry::instance()->load_lib( |
|
886 | + 'Messages_Generator', |
|
887 | + [], |
|
888 | + false, |
|
889 | + false |
|
890 | + ); |
|
891 | + }, |
|
892 | + 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
893 | + return EE_Registry::instance()->load_lib( |
|
894 | + 'Messages_Template_Defaults', |
|
895 | + $arguments, |
|
896 | + false, |
|
897 | + false |
|
898 | + ); |
|
899 | + }, |
|
900 | + // load_helper |
|
901 | + 'EEH_Parse_Shortcodes' => static function () { |
|
902 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
903 | + return new EEH_Parse_Shortcodes(); |
|
904 | + } |
|
905 | + return null; |
|
906 | + }, |
|
907 | + 'EE_Template_Config' => static function () { |
|
908 | + return EE_Config::instance()->template_settings; |
|
909 | + }, |
|
910 | + 'EE_Currency_Config' => static function () { |
|
911 | + return EE_Config::instance()->currency; |
|
912 | + }, |
|
913 | + 'EE_Registration_Config' => static function () { |
|
914 | + return EE_Config::instance()->registration; |
|
915 | + }, |
|
916 | + 'EE_Core_Config' => static function () { |
|
917 | + return EE_Config::instance()->core; |
|
918 | + }, |
|
919 | + 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
920 | + return LoaderFactory::getLoader(); |
|
921 | + }, |
|
922 | + 'EE_Network_Config' => static function () { |
|
923 | + return EE_Network_Config::instance(); |
|
924 | + }, |
|
925 | + 'EE_Config' => static function () { |
|
926 | + return EE_Config::instance(); |
|
927 | + }, |
|
928 | + 'EventEspresso\core\domain\Domain' => static function () { |
|
929 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
930 | + }, |
|
931 | + 'EE_Admin_Config' => static function () { |
|
932 | + return EE_Config::instance()->admin; |
|
933 | + }, |
|
934 | + 'EE_Organization_Config' => static function () { |
|
935 | + return EE_Config::instance()->organization; |
|
936 | + }, |
|
937 | + 'EE_Network_Core_Config' => static function () { |
|
938 | + return EE_Network_Config::instance()->core; |
|
939 | + }, |
|
940 | + 'EE_Environment_Config' => static function () { |
|
941 | + return EE_Config::instance()->environment; |
|
942 | + }, |
|
943 | + 'EED_Core_Rest_Api' => static function () { |
|
944 | + return EED_Core_Rest_Api::instance(); |
|
945 | + }, |
|
946 | + 'WP_REST_Server' => static function () { |
|
947 | + return rest_get_server(); |
|
948 | + }, |
|
949 | + 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
950 | + return EE_Psr4AutoloaderInit::psr4_loader(); |
|
951 | + }, |
|
952 | + ]; |
|
953 | + } |
|
954 | + |
|
955 | + |
|
956 | + /** |
|
957 | + * can be used for supplying alternate names for classes, |
|
958 | + * or for connecting interface names to instantiable classes |
|
959 | + * |
|
960 | + * @throws InvalidAliasException |
|
961 | + */ |
|
962 | + protected function _register_core_aliases() |
|
963 | + { |
|
964 | + $aliases = [ |
|
965 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
966 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
967 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
968 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
969 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
970 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
971 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
972 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
973 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
974 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
975 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
976 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
977 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
978 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
979 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
980 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
981 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
982 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
983 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
984 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
985 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
986 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
987 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
988 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
989 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
990 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
991 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
992 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
993 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
994 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
995 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
996 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
997 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
998 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
999 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1000 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1001 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1002 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
1003 | + 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
1004 | + ]; |
|
1005 | + foreach ($aliases as $alias => $fqn) { |
|
1006 | + if (is_array($fqn)) { |
|
1007 | + foreach ($fqn as $class => $for_class) { |
|
1008 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
1009 | + } |
|
1010 | + continue; |
|
1011 | + } |
|
1012 | + $this->class_cache->addAlias($fqn, $alias); |
|
1013 | + } |
|
1014 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1015 | + $this->class_cache->addAlias( |
|
1016 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1017 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1018 | + ); |
|
1019 | + } |
|
1020 | + } |
|
1021 | + |
|
1022 | + |
|
1023 | + /** |
|
1024 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1025 | + * request Primarily used by unit tests. |
|
1026 | + */ |
|
1027 | + public function reset() |
|
1028 | + { |
|
1029 | + $this->_register_core_class_loaders(); |
|
1030 | + $this->_register_core_dependencies(); |
|
1031 | + } |
|
1032 | + |
|
1033 | + |
|
1034 | + /** |
|
1035 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
1036 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
1037 | + * WHY? |
|
1038 | + * Because if a class is type hinting for a concretion, |
|
1039 | + * then why would we need to find another class to supply it? |
|
1040 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1041 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1042 | + * Don't go looking for some substitute. |
|
1043 | + * Whereas if a class is type hinting for an interface... |
|
1044 | + * then we need to find an actual class to use. |
|
1045 | + * So the interface IS the alias for some other FQN, |
|
1046 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1047 | + * represents some other class. |
|
1048 | + * |
|
1049 | + * @param string $fqn |
|
1050 | + * @param string $for_class |
|
1051 | + * @return bool |
|
1052 | + * @deprecated 4.9.62.p |
|
1053 | + */ |
|
1054 | + public function has_alias($fqn = '', $for_class = '') |
|
1055 | + { |
|
1056 | + return $this->isAlias($fqn, $for_class); |
|
1057 | + } |
|
1058 | + |
|
1059 | + |
|
1060 | + /** |
|
1061 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1062 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1063 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1064 | + * for example: |
|
1065 | + * if the following two entries were added to the _aliases array: |
|
1066 | + * array( |
|
1067 | + * 'interface_alias' => 'some\namespace\interface' |
|
1068 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1069 | + * ) |
|
1070 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1071 | + * to load an instance of 'some\namespace\classname' |
|
1072 | + * |
|
1073 | + * @param string $alias |
|
1074 | + * @param string $for_class |
|
1075 | + * @return string |
|
1076 | + * @deprecated 4.9.62.p |
|
1077 | + */ |
|
1078 | + public function get_alias($alias = '', $for_class = '') |
|
1079 | + { |
|
1080 | + return $this->getFqnForAlias($alias, $for_class); |
|
1081 | + } |
|
1082 | 1082 | } |
@@ -37,122 +37,122 @@ |
||
37 | 37 | * @since 4.0 |
38 | 38 | */ |
39 | 39 | if (function_exists('espresso_version')) { |
40 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | - /** |
|
42 | - * espresso_duplicate_plugin_error |
|
43 | - * displays if more than one version of EE is activated at the same time |
|
44 | - */ |
|
45 | - function espresso_duplicate_plugin_error() |
|
46 | - { |
|
47 | - ?> |
|
40 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | + /** |
|
42 | + * espresso_duplicate_plugin_error |
|
43 | + * displays if more than one version of EE is activated at the same time |
|
44 | + */ |
|
45 | + function espresso_duplicate_plugin_error() |
|
46 | + { |
|
47 | + ?> |
|
48 | 48 | <div class="error"> |
49 | 49 | <p> |
50 | 50 | <?php |
51 | - echo esc_html__( |
|
52 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
53 | - 'event_espresso' |
|
54 | - ); ?> |
|
51 | + echo esc_html__( |
|
52 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
53 | + 'event_espresso' |
|
54 | + ); ?> |
|
55 | 55 | </p> |
56 | 56 | </div> |
57 | 57 | <?php |
58 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | - } |
|
60 | - } |
|
61 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
58 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | + } |
|
60 | + } |
|
61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | 62 | } else { |
63 | - define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
|
64 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | - /** |
|
66 | - * espresso_minimum_php_version_error |
|
67 | - * |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - function espresso_minimum_php_version_error() |
|
71 | - { |
|
72 | - ?> |
|
63 | + define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
|
64 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | + /** |
|
66 | + * espresso_minimum_php_version_error |
|
67 | + * |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + function espresso_minimum_php_version_error() |
|
71 | + { |
|
72 | + ?> |
|
73 | 73 | <div class="error"> |
74 | 74 | <p> |
75 | 75 | <?php |
76 | - printf( |
|
77 | - esc_html__( |
|
78 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | - 'event_espresso' |
|
80 | - ), |
|
81 | - EE_MIN_PHP_VER_REQUIRED, |
|
82 | - PHP_VERSION, |
|
83 | - '<br/>', |
|
84 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
85 | - ); |
|
86 | - ?> |
|
76 | + printf( |
|
77 | + esc_html__( |
|
78 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | + 'event_espresso' |
|
80 | + ), |
|
81 | + EE_MIN_PHP_VER_REQUIRED, |
|
82 | + PHP_VERSION, |
|
83 | + '<br/>', |
|
84 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
85 | + ); |
|
86 | + ?> |
|
87 | 87 | </p> |
88 | 88 | </div> |
89 | 89 | <?php |
90 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | - } |
|
90 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | + } |
|
92 | 92 | |
93 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | - } else { |
|
95 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.12.0.rc.001'); |
|
105 | - } |
|
93 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | + } else { |
|
95 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.12.0.rc.001'); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * espresso_plugin_activation |
|
109 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
110 | - */ |
|
111 | - function espresso_plugin_activation() |
|
112 | - { |
|
113 | - update_option('ee_espresso_activation', true); |
|
107 | + /** |
|
108 | + * espresso_plugin_activation |
|
109 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
110 | + */ |
|
111 | + function espresso_plugin_activation() |
|
112 | + { |
|
113 | + update_option('ee_espresso_activation', true); |
|
114 | 114 | |
115 | - // Run WP GraphQL activation callback |
|
116 | - if (! class_exists('WPGraphQL')) { |
|
117 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
118 | - } |
|
119 | - graphql_activation_callback(); |
|
120 | - } |
|
115 | + // Run WP GraphQL activation callback |
|
116 | + if (! class_exists('WPGraphQL')) { |
|
117 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
118 | + } |
|
119 | + graphql_activation_callback(); |
|
120 | + } |
|
121 | 121 | |
122 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
122 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
123 | 123 | |
124 | - /** |
|
125 | - * espresso_plugin_deactivation |
|
126 | - */ |
|
127 | - function espresso_plugin_deactivation() |
|
128 | - { |
|
129 | - // Run WP GraphQL deactivation callback |
|
130 | - if (! class_exists('WPGraphQL')) { |
|
131 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
132 | - } |
|
133 | - graphql_deactivation_callback(); |
|
134 | - } |
|
135 | - register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
124 | + /** |
|
125 | + * espresso_plugin_deactivation |
|
126 | + */ |
|
127 | + function espresso_plugin_deactivation() |
|
128 | + { |
|
129 | + // Run WP GraphQL deactivation callback |
|
130 | + if (! class_exists('WPGraphQL')) { |
|
131 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
132 | + } |
|
133 | + graphql_deactivation_callback(); |
|
134 | + } |
|
135 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
136 | 136 | |
137 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
138 | - bootstrap_espresso(); |
|
139 | - } |
|
137 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
138 | + bootstrap_espresso(); |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | if (! function_exists('espresso_deactivate_plugin')) { |
142 | - /** |
|
143 | - * deactivate_plugin |
|
144 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
145 | - * |
|
146 | - * @access public |
|
147 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
151 | - { |
|
152 | - if (! function_exists('deactivate_plugins')) { |
|
153 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
154 | - } |
|
155 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
156 | - deactivate_plugins($plugin_basename); |
|
157 | - } |
|
142 | + /** |
|
143 | + * deactivate_plugin |
|
144 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
145 | + * |
|
146 | + * @access public |
|
147 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
151 | + { |
|
152 | + if (! function_exists('deactivate_plugins')) { |
|
153 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
154 | + } |
|
155 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
156 | + deactivate_plugins($plugin_basename); |
|
157 | + } |
|
158 | 158 | } |
@@ -11,93 +11,93 @@ discard block |
||
11 | 11 | class EEM_Change_Log extends EEM_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * the related object was created log type |
|
16 | - */ |
|
17 | - const type_create = 'create'; |
|
18 | - /** |
|
19 | - * the related object was updated (changed, or soft-deleted) |
|
20 | - */ |
|
21 | - const type_update = 'update'; |
|
22 | - /** |
|
23 | - * the related object was deleted permanently |
|
24 | - */ |
|
25 | - const type_delete = 'delete'; |
|
26 | - /** |
|
27 | - * the related item had something worth noting happen on it, but |
|
28 | - * only for the purposes of debugging problems |
|
29 | - */ |
|
30 | - const type_debug = 'debug'; |
|
31 | - /** |
|
32 | - * the related item had an error occur on it |
|
33 | - */ |
|
34 | - const type_error = 'error'; |
|
35 | - /** |
|
36 | - * the related item is regarding some gateway interaction, like an IPN |
|
37 | - * or request to process a payment |
|
38 | - */ |
|
39 | - const type_gateway = 'gateway'; |
|
14 | + /** |
|
15 | + * the related object was created log type |
|
16 | + */ |
|
17 | + const type_create = 'create'; |
|
18 | + /** |
|
19 | + * the related object was updated (changed, or soft-deleted) |
|
20 | + */ |
|
21 | + const type_update = 'update'; |
|
22 | + /** |
|
23 | + * the related object was deleted permanently |
|
24 | + */ |
|
25 | + const type_delete = 'delete'; |
|
26 | + /** |
|
27 | + * the related item had something worth noting happen on it, but |
|
28 | + * only for the purposes of debugging problems |
|
29 | + */ |
|
30 | + const type_debug = 'debug'; |
|
31 | + /** |
|
32 | + * the related item had an error occur on it |
|
33 | + */ |
|
34 | + const type_error = 'error'; |
|
35 | + /** |
|
36 | + * the related item is regarding some gateway interaction, like an IPN |
|
37 | + * or request to process a payment |
|
38 | + */ |
|
39 | + const type_gateway = 'gateway'; |
|
40 | 40 | |
41 | - /** |
|
42 | - * private instance of the EEM_Change_Log object |
|
43 | - * |
|
44 | - * @access private |
|
45 | - * @var EEM_Change_Log $_instance |
|
46 | - */ |
|
47 | - protected static $_instance = null; |
|
41 | + /** |
|
42 | + * private instance of the EEM_Change_Log object |
|
43 | + * |
|
44 | + * @access private |
|
45 | + * @var EEM_Change_Log $_instance |
|
46 | + */ |
|
47 | + protected static $_instance = null; |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * constructor |
|
52 | - * |
|
53 | - * @access protected |
|
54 | - * @param null $timezone |
|
55 | - * @throws EE_Error |
|
56 | - */ |
|
57 | - protected function __construct($timezone = null) |
|
58 | - { |
|
59 | - global $current_user; |
|
60 | - $this->singular_item = esc_html__('Log', 'event_espresso'); |
|
61 | - $this->plural_item = esc_html__('Logs', 'event_espresso'); |
|
62 | - $this->_tables = array( |
|
63 | - 'Log' => new EE_Primary_Table('esp_log', 'LOG_ID'), |
|
64 | - ); |
|
65 | - $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models); |
|
66 | - $this->_fields = array( |
|
67 | - 'Log' => array( |
|
68 | - 'LOG_ID' => new EE_Primary_Key_Int_Field('LOG_ID', esc_html__('Log ID', 'event_espresso')), |
|
69 | - 'LOG_time' => new EE_Datetime_Field( |
|
70 | - 'LOG_time', |
|
71 | - esc_html__("Log Time", 'event_espresso'), |
|
72 | - false, |
|
73 | - EE_Datetime_Field::now |
|
74 | - ), |
|
75 | - 'OBJ_ID' => new EE_Foreign_Key_String_Field( |
|
76 | - 'OBJ_ID', |
|
77 | - esc_html__("Object ID (int or string)", 'event_espresso'), |
|
78 | - true, |
|
79 | - null, |
|
80 | - $models_this_can_attach_to |
|
81 | - ), |
|
82 | - 'OBJ_type' => new EE_Any_Foreign_Model_Name_Field( |
|
83 | - 'OBJ_type', |
|
84 | - esc_html__("Object Type", 'event_espresso'), |
|
85 | - true, |
|
86 | - null, |
|
87 | - $models_this_can_attach_to |
|
88 | - ), |
|
89 | - 'LOG_type' => new EE_Plain_Text_Field( |
|
90 | - 'LOG_type', |
|
91 | - esc_html__("Type of log entry", "event_espresso"), |
|
92 | - false, |
|
93 | - self::type_debug |
|
94 | - ), |
|
95 | - 'LOG_message' => new EE_Maybe_Serialized_Text_Field( |
|
96 | - 'LOG_message', |
|
97 | - esc_html__("Log Message (body)", 'event_espresso'), |
|
98 | - true |
|
99 | - ), |
|
100 | - /* |
|
50 | + /** |
|
51 | + * constructor |
|
52 | + * |
|
53 | + * @access protected |
|
54 | + * @param null $timezone |
|
55 | + * @throws EE_Error |
|
56 | + */ |
|
57 | + protected function __construct($timezone = null) |
|
58 | + { |
|
59 | + global $current_user; |
|
60 | + $this->singular_item = esc_html__('Log', 'event_espresso'); |
|
61 | + $this->plural_item = esc_html__('Logs', 'event_espresso'); |
|
62 | + $this->_tables = array( |
|
63 | + 'Log' => new EE_Primary_Table('esp_log', 'LOG_ID'), |
|
64 | + ); |
|
65 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models); |
|
66 | + $this->_fields = array( |
|
67 | + 'Log' => array( |
|
68 | + 'LOG_ID' => new EE_Primary_Key_Int_Field('LOG_ID', esc_html__('Log ID', 'event_espresso')), |
|
69 | + 'LOG_time' => new EE_Datetime_Field( |
|
70 | + 'LOG_time', |
|
71 | + esc_html__("Log Time", 'event_espresso'), |
|
72 | + false, |
|
73 | + EE_Datetime_Field::now |
|
74 | + ), |
|
75 | + 'OBJ_ID' => new EE_Foreign_Key_String_Field( |
|
76 | + 'OBJ_ID', |
|
77 | + esc_html__("Object ID (int or string)", 'event_espresso'), |
|
78 | + true, |
|
79 | + null, |
|
80 | + $models_this_can_attach_to |
|
81 | + ), |
|
82 | + 'OBJ_type' => new EE_Any_Foreign_Model_Name_Field( |
|
83 | + 'OBJ_type', |
|
84 | + esc_html__("Object Type", 'event_espresso'), |
|
85 | + true, |
|
86 | + null, |
|
87 | + $models_this_can_attach_to |
|
88 | + ), |
|
89 | + 'LOG_type' => new EE_Plain_Text_Field( |
|
90 | + 'LOG_type', |
|
91 | + esc_html__("Type of log entry", "event_espresso"), |
|
92 | + false, |
|
93 | + self::type_debug |
|
94 | + ), |
|
95 | + 'LOG_message' => new EE_Maybe_Serialized_Text_Field( |
|
96 | + 'LOG_message', |
|
97 | + esc_html__("Log Message (body)", 'event_espresso'), |
|
98 | + true |
|
99 | + ), |
|
100 | + /* |
|
101 | 101 | * Note: when querying for a change log's user, the OBJ_ID and OBJ_type fields are used, |
102 | 102 | * not the LOG_wp_user field. E.g., |
103 | 103 | * `EEM_Change_Log::instance()->get_all(array(array('WP_User.ID'=>1)))` will actually return |
@@ -106,158 +106,158 @@ discard block |
||
106 | 106 | * If you want the latter, you can't use the model's magic joining. E.g, you would need to do |
107 | 107 | * `EEM_Change_Log::instance()->get_all(array(array('LOG_wp_user' => 1)))`. |
108 | 108 | */ |
109 | - 'LOG_wp_user' => new EE_WP_User_Field( |
|
110 | - 'LOG_wp_user', |
|
111 | - esc_html__("User who was logged in while this occurred", 'event_espresso'), |
|
112 | - true |
|
113 | - ), |
|
114 | - ), |
|
115 | - ); |
|
116 | - $this->_model_relations = array(); |
|
117 | - foreach ($models_this_can_attach_to as $model) { |
|
118 | - if ($model != 'Change_Log') { |
|
119 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation(); |
|
120 | - } |
|
121 | - } |
|
122 | - // use completely custom caps for this |
|
123 | - unset($this->_cap_restriction_generators); |
|
124 | - // caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing |
|
125 | - foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) { |
|
126 | - $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] |
|
127 | - = new EE_Return_None_Where_Conditions(); |
|
128 | - } |
|
129 | - parent::__construct($timezone); |
|
130 | - } |
|
109 | + 'LOG_wp_user' => new EE_WP_User_Field( |
|
110 | + 'LOG_wp_user', |
|
111 | + esc_html__("User who was logged in while this occurred", 'event_espresso'), |
|
112 | + true |
|
113 | + ), |
|
114 | + ), |
|
115 | + ); |
|
116 | + $this->_model_relations = array(); |
|
117 | + foreach ($models_this_can_attach_to as $model) { |
|
118 | + if ($model != 'Change_Log') { |
|
119 | + $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation(); |
|
120 | + } |
|
121 | + } |
|
122 | + // use completely custom caps for this |
|
123 | + unset($this->_cap_restriction_generators); |
|
124 | + // caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing |
|
125 | + foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) { |
|
126 | + $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] |
|
127 | + = new EE_Return_None_Where_Conditions(); |
|
128 | + } |
|
129 | + parent::__construct($timezone); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * @param string $log_type !see the acceptable values of LOG_type in EEM__Change_Log::__construct |
|
134 | - * @param mixed $message array|string of the message you want to record |
|
135 | - * @param EE_Base_Class $related_model_obj |
|
136 | - * @return EE_Change_Log |
|
137 | - * @throws EE_Error |
|
138 | - */ |
|
139 | - public function log($log_type, $message, $related_model_obj) |
|
140 | - { |
|
141 | - if ($related_model_obj instanceof EE_Base_Class) { |
|
142 | - $obj_id = $related_model_obj->ID(); |
|
143 | - $obj_type = $related_model_obj->get_model()->get_this_model_name(); |
|
144 | - } else { |
|
145 | - $obj_id = null; |
|
146 | - $obj_type = null; |
|
147 | - } |
|
148 | - /** @var EE_Change_Log $log */ |
|
149 | - $log = EE_Change_Log::new_instance(array( |
|
150 | - 'LOG_type' => $log_type, |
|
151 | - 'LOG_message' => $message, |
|
152 | - 'OBJ_ID' => $obj_id, |
|
153 | - 'OBJ_type' => $obj_type, |
|
154 | - )); |
|
155 | - $log->save(); |
|
156 | - return $log; |
|
157 | - } |
|
132 | + /** |
|
133 | + * @param string $log_type !see the acceptable values of LOG_type in EEM__Change_Log::__construct |
|
134 | + * @param mixed $message array|string of the message you want to record |
|
135 | + * @param EE_Base_Class $related_model_obj |
|
136 | + * @return EE_Change_Log |
|
137 | + * @throws EE_Error |
|
138 | + */ |
|
139 | + public function log($log_type, $message, $related_model_obj) |
|
140 | + { |
|
141 | + if ($related_model_obj instanceof EE_Base_Class) { |
|
142 | + $obj_id = $related_model_obj->ID(); |
|
143 | + $obj_type = $related_model_obj->get_model()->get_this_model_name(); |
|
144 | + } else { |
|
145 | + $obj_id = null; |
|
146 | + $obj_type = null; |
|
147 | + } |
|
148 | + /** @var EE_Change_Log $log */ |
|
149 | + $log = EE_Change_Log::new_instance(array( |
|
150 | + 'LOG_type' => $log_type, |
|
151 | + 'LOG_message' => $message, |
|
152 | + 'OBJ_ID' => $obj_id, |
|
153 | + 'OBJ_type' => $obj_type, |
|
154 | + )); |
|
155 | + $log->save(); |
|
156 | + return $log; |
|
157 | + } |
|
158 | 158 | |
159 | 159 | |
160 | - /** |
|
161 | - * Adds a gateway log for the specified object, given its ID and type |
|
162 | - * |
|
163 | - * @param string $message |
|
164 | - * @param mixed $related_obj_id |
|
165 | - * @param string $related_obj_type |
|
166 | - * @throws EE_Error |
|
167 | - * @return EE_Change_Log |
|
168 | - */ |
|
169 | - public function gateway_log($message, $related_obj_id, $related_obj_type) |
|
170 | - { |
|
171 | - if (! EE_Registry::instance()->is_model_name($related_obj_type)) { |
|
172 | - throw new EE_Error( |
|
173 | - sprintf( |
|
174 | - esc_html__( |
|
175 | - "'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", |
|
176 | - "event_espresso" |
|
177 | - ), |
|
178 | - $related_obj_type |
|
179 | - ) |
|
180 | - ); |
|
181 | - } |
|
182 | - /** @var EE_Change_Log $log */ |
|
183 | - $log = EE_Change_Log::new_instance(array( |
|
184 | - 'LOG_type' => EEM_Change_Log::type_gateway, |
|
185 | - 'LOG_message' => $message, |
|
186 | - 'OBJ_ID' => $related_obj_id, |
|
187 | - 'OBJ_type' => $related_obj_type, |
|
188 | - )); |
|
189 | - $log->save(); |
|
190 | - return $log; |
|
191 | - } |
|
160 | + /** |
|
161 | + * Adds a gateway log for the specified object, given its ID and type |
|
162 | + * |
|
163 | + * @param string $message |
|
164 | + * @param mixed $related_obj_id |
|
165 | + * @param string $related_obj_type |
|
166 | + * @throws EE_Error |
|
167 | + * @return EE_Change_Log |
|
168 | + */ |
|
169 | + public function gateway_log($message, $related_obj_id, $related_obj_type) |
|
170 | + { |
|
171 | + if (! EE_Registry::instance()->is_model_name($related_obj_type)) { |
|
172 | + throw new EE_Error( |
|
173 | + sprintf( |
|
174 | + esc_html__( |
|
175 | + "'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", |
|
176 | + "event_espresso" |
|
177 | + ), |
|
178 | + $related_obj_type |
|
179 | + ) |
|
180 | + ); |
|
181 | + } |
|
182 | + /** @var EE_Change_Log $log */ |
|
183 | + $log = EE_Change_Log::new_instance(array( |
|
184 | + 'LOG_type' => EEM_Change_Log::type_gateway, |
|
185 | + 'LOG_message' => $message, |
|
186 | + 'OBJ_ID' => $related_obj_id, |
|
187 | + 'OBJ_type' => $related_obj_type, |
|
188 | + )); |
|
189 | + $log->save(); |
|
190 | + return $log; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - /** |
|
195 | - * Just gets the bare-bones wpdb results as an array in cases where efficiency is essential |
|
196 | - * |
|
197 | - * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
198 | - * @return array of arrays |
|
199 | - * @throws EE_Error |
|
200 | - */ |
|
201 | - public function get_all_efficiently($query_params) |
|
202 | - { |
|
203 | - return $this->_get_all_wpdb_results($query_params); |
|
204 | - } |
|
194 | + /** |
|
195 | + * Just gets the bare-bones wpdb results as an array in cases where efficiency is essential |
|
196 | + * |
|
197 | + * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
198 | + * @return array of arrays |
|
199 | + * @throws EE_Error |
|
200 | + */ |
|
201 | + public function get_all_efficiently($query_params) |
|
202 | + { |
|
203 | + return $this->_get_all_wpdb_results($query_params); |
|
204 | + } |
|
205 | 205 | |
206 | 206 | |
207 | - /** |
|
208 | - * Executes a database query to delete gateway logs. Does not affect model objects, so if you attempt to use |
|
209 | - * models after this, they may be out-of-sync with the database |
|
210 | - * |
|
211 | - * @param DateTime $datetime |
|
212 | - * @return false|int |
|
213 | - * @throws EE_Error |
|
214 | - */ |
|
215 | - public function delete_gateway_logs_older_than(DateTime $datetime) |
|
216 | - { |
|
217 | - global $wpdb; |
|
218 | - return $wpdb->query( |
|
219 | - $wpdb->prepare( |
|
220 | - 'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s', |
|
221 | - EEM_Change_Log::type_gateway, |
|
222 | - $datetime->format(EE_Datetime_Field::mysql_timestamp_format) |
|
223 | - ) |
|
224 | - ); |
|
225 | - } |
|
207 | + /** |
|
208 | + * Executes a database query to delete gateway logs. Does not affect model objects, so if you attempt to use |
|
209 | + * models after this, they may be out-of-sync with the database |
|
210 | + * |
|
211 | + * @param DateTime $datetime |
|
212 | + * @return false|int |
|
213 | + * @throws EE_Error |
|
214 | + */ |
|
215 | + public function delete_gateway_logs_older_than(DateTime $datetime) |
|
216 | + { |
|
217 | + global $wpdb; |
|
218 | + return $wpdb->query( |
|
219 | + $wpdb->prepare( |
|
220 | + 'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s', |
|
221 | + EEM_Change_Log::type_gateway, |
|
222 | + $datetime->format(EE_Datetime_Field::mysql_timestamp_format) |
|
223 | + ) |
|
224 | + ); |
|
225 | + } |
|
226 | 226 | |
227 | 227 | |
228 | - /** |
|
229 | - * Returns the map of type to pretty label for identifiers used for `LOG_type`. Client code can register their own |
|
230 | - * map vai the given filter. |
|
231 | - * |
|
232 | - * @return array |
|
233 | - */ |
|
234 | - public static function get_pretty_label_map_for_registered_types() |
|
235 | - { |
|
236 | - return apply_filters( |
|
237 | - 'FHEE__EEM_Change_Log__get_pretty_label_map_for_registered_types', |
|
238 | - array( |
|
239 | - self::type_create => esc_html__("Create", "event_espresso"), |
|
240 | - self::type_update => esc_html__("Update", "event_espresso"), |
|
241 | - self::type_delete => esc_html__("Delete", "event_espresso"), |
|
242 | - self::type_debug => esc_html__("Debug", "event_espresso"), |
|
243 | - self::type_error => esc_html__("Error", "event_espresso"), |
|
244 | - self::type_gateway => esc_html__("Gateway Interaction (IPN or Direct Payment)", 'event_espresso') |
|
245 | - ) |
|
246 | - ); |
|
247 | - } |
|
228 | + /** |
|
229 | + * Returns the map of type to pretty label for identifiers used for `LOG_type`. Client code can register their own |
|
230 | + * map vai the given filter. |
|
231 | + * |
|
232 | + * @return array |
|
233 | + */ |
|
234 | + public static function get_pretty_label_map_for_registered_types() |
|
235 | + { |
|
236 | + return apply_filters( |
|
237 | + 'FHEE__EEM_Change_Log__get_pretty_label_map_for_registered_types', |
|
238 | + array( |
|
239 | + self::type_create => esc_html__("Create", "event_espresso"), |
|
240 | + self::type_update => esc_html__("Update", "event_espresso"), |
|
241 | + self::type_delete => esc_html__("Delete", "event_espresso"), |
|
242 | + self::type_debug => esc_html__("Debug", "event_espresso"), |
|
243 | + self::type_error => esc_html__("Error", "event_espresso"), |
|
244 | + self::type_gateway => esc_html__("Gateway Interaction (IPN or Direct Payment)", 'event_espresso') |
|
245 | + ) |
|
246 | + ); |
|
247 | + } |
|
248 | 248 | |
249 | 249 | |
250 | - /** |
|
251 | - * Return the pretty (localized) label for the given log type identifier. |
|
252 | - * @param string $type_identifier |
|
253 | - * @return string |
|
254 | - */ |
|
255 | - public static function get_pretty_label_for_type($type_identifier) |
|
256 | - { |
|
257 | - $type_identifier_map = self::get_pretty_label_map_for_registered_types(); |
|
258 | - // we fallback to the incoming type identifier if there is no localized label for it. |
|
259 | - return isset($type_identifier_map[ $type_identifier ]) |
|
260 | - ? $type_identifier_map[ $type_identifier ] |
|
261 | - : $type_identifier; |
|
262 | - } |
|
250 | + /** |
|
251 | + * Return the pretty (localized) label for the given log type identifier. |
|
252 | + * @param string $type_identifier |
|
253 | + * @return string |
|
254 | + */ |
|
255 | + public static function get_pretty_label_for_type($type_identifier) |
|
256 | + { |
|
257 | + $type_identifier_map = self::get_pretty_label_map_for_registered_types(); |
|
258 | + // we fallback to the incoming type identifier if there is no localized label for it. |
|
259 | + return isset($type_identifier_map[ $type_identifier ]) |
|
260 | + ? $type_identifier_map[ $type_identifier ] |
|
261 | + : $type_identifier; |
|
262 | + } |
|
263 | 263 | } |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | ), |
114 | 114 | ), |
115 | 115 | ); |
116 | - $this->_model_relations = array(); |
|
116 | + $this->_model_relations = array(); |
|
117 | 117 | foreach ($models_this_can_attach_to as $model) { |
118 | 118 | if ($model != 'Change_Log') { |
119 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation(); |
|
119 | + $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | // use completely custom caps for this |
123 | 123 | unset($this->_cap_restriction_generators); |
124 | 124 | // caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing |
125 | 125 | foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) { |
126 | - $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] |
|
126 | + $this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()] |
|
127 | 127 | = new EE_Return_None_Where_Conditions(); |
128 | 128 | } |
129 | 129 | parent::__construct($timezone); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function gateway_log($message, $related_obj_id, $related_obj_type) |
170 | 170 | { |
171 | - if (! EE_Registry::instance()->is_model_name($related_obj_type)) { |
|
171 | + if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) { |
|
172 | 172 | throw new EE_Error( |
173 | 173 | sprintf( |
174 | 174 | esc_html__( |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | global $wpdb; |
218 | 218 | return $wpdb->query( |
219 | 219 | $wpdb->prepare( |
220 | - 'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s', |
|
220 | + 'DELETE FROM '.$this->table().' WHERE LOG_type = %s AND LOG_time < %s', |
|
221 | 221 | EEM_Change_Log::type_gateway, |
222 | 222 | $datetime->format(EE_Datetime_Field::mysql_timestamp_format) |
223 | 223 | ) |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | { |
257 | 257 | $type_identifier_map = self::get_pretty_label_map_for_registered_types(); |
258 | 258 | // we fallback to the incoming type identifier if there is no localized label for it. |
259 | - return isset($type_identifier_map[ $type_identifier ]) |
|
260 | - ? $type_identifier_map[ $type_identifier ] |
|
259 | + return isset($type_identifier_map[$type_identifier]) |
|
260 | + ? $type_identifier_map[$type_identifier] |
|
261 | 261 | : $type_identifier; |
262 | 262 | } |
263 | 263 | } |
@@ -4,49 +4,49 @@ |
||
4 | 4 | |
5 | 5 | class Button |
6 | 6 | { |
7 | - /** |
|
8 | - * indicates that the HTML input type is 'button' |
|
9 | - */ |
|
10 | - public const TYPE_BUTTON = 'button'; |
|
11 | - |
|
12 | - /** |
|
13 | - * indicates that the HTML input type is 'reset' |
|
14 | - */ |
|
15 | - public const TYPE_BUTTON_RESET = 'reset'; |
|
16 | - |
|
17 | - /** |
|
18 | - * indicates that the HTML input type is 'submit' |
|
19 | - */ |
|
20 | - public const TYPE_BUTTON_SUBMIT = 'submit'; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - private $valid_type_options; |
|
27 | - |
|
28 | - |
|
29 | - public function __construct() |
|
30 | - { |
|
31 | - $this->valid_type_options = apply_filters( |
|
32 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_Button__valid_type_options', |
|
33 | - [ |
|
34 | - Button::TYPE_BUTTON => esc_html__('Button', 'event_espresso'), |
|
35 | - Button::TYPE_BUTTON_RESET => esc_html__('Reset Button', 'event_espresso'), |
|
36 | - Button::TYPE_BUTTON_SUBMIT => esc_html__('Submit Button', 'event_espresso'), |
|
37 | - ] |
|
38 | - ); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @param bool $constants_only |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - public function validTypeOptions(bool $constants_only = false): array |
|
47 | - { |
|
48 | - return $constants_only |
|
49 | - ? array_keys($this->valid_type_options) |
|
50 | - : $this->valid_type_options; |
|
51 | - } |
|
7 | + /** |
|
8 | + * indicates that the HTML input type is 'button' |
|
9 | + */ |
|
10 | + public const TYPE_BUTTON = 'button'; |
|
11 | + |
|
12 | + /** |
|
13 | + * indicates that the HTML input type is 'reset' |
|
14 | + */ |
|
15 | + public const TYPE_BUTTON_RESET = 'reset'; |
|
16 | + |
|
17 | + /** |
|
18 | + * indicates that the HTML input type is 'submit' |
|
19 | + */ |
|
20 | + public const TYPE_BUTTON_SUBMIT = 'submit'; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + private $valid_type_options; |
|
27 | + |
|
28 | + |
|
29 | + public function __construct() |
|
30 | + { |
|
31 | + $this->valid_type_options = apply_filters( |
|
32 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_Button__valid_type_options', |
|
33 | + [ |
|
34 | + Button::TYPE_BUTTON => esc_html__('Button', 'event_espresso'), |
|
35 | + Button::TYPE_BUTTON_RESET => esc_html__('Reset Button', 'event_espresso'), |
|
36 | + Button::TYPE_BUTTON_SUBMIT => esc_html__('Submit Button', 'event_espresso'), |
|
37 | + ] |
|
38 | + ); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @param bool $constants_only |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + public function validTypeOptions(bool $constants_only = false): array |
|
47 | + { |
|
48 | + return $constants_only |
|
49 | + ? array_keys($this->valid_type_options) |
|
50 | + : $this->valid_type_options; |
|
51 | + } |
|
52 | 52 | } |
@@ -4,61 +4,61 @@ |
||
4 | 4 | |
5 | 5 | class Text |
6 | 6 | { |
7 | - /** |
|
8 | - * indicates that the HTML input type is 'email' |
|
9 | - */ |
|
10 | - public const TYPE_EMAIL = 'email'; |
|
7 | + /** |
|
8 | + * indicates that the HTML input type is 'email' |
|
9 | + */ |
|
10 | + public const TYPE_EMAIL = 'email'; |
|
11 | 11 | |
12 | - /** |
|
13 | - * indicates that the input is used to confirm an email address |
|
14 | - */ |
|
15 | - public const TYPE_EMAIL_CONFIRM = 'email-confirmation'; |
|
12 | + /** |
|
13 | + * indicates that the input is used to confirm an email address |
|
14 | + */ |
|
15 | + public const TYPE_EMAIL_CONFIRM = 'email-confirmation'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * indicates that the HTML input type is 'text' |
|
19 | - */ |
|
20 | - public const TYPE_TEXT = 'text'; |
|
17 | + /** |
|
18 | + * indicates that the HTML input type is 'text' |
|
19 | + */ |
|
20 | + public const TYPE_TEXT = 'text'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * indicates that the input is a TEXTAREA that only allows plain text |
|
24 | - */ |
|
25 | - public const TYPE_TEXTAREA = 'textarea'; |
|
22 | + /** |
|
23 | + * indicates that the input is a TEXTAREA that only allows plain text |
|
24 | + */ |
|
25 | + public const TYPE_TEXTAREA = 'textarea'; |
|
26 | 26 | |
27 | - /** |
|
28 | - * indicates that the input is a TEXTAREA that allows simple html |
|
29 | - */ |
|
30 | - public const TYPE_TEXTAREA_HTML = 'textarea-html'; |
|
27 | + /** |
|
28 | + * indicates that the input is a TEXTAREA that allows simple html |
|
29 | + */ |
|
30 | + public const TYPE_TEXTAREA_HTML = 'textarea-html'; |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - private $valid_type_options; |
|
33 | + /** |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + private $valid_type_options; |
|
37 | 37 | |
38 | 38 | |
39 | - public function __construct() |
|
40 | - { |
|
41 | - $this->valid_type_options = apply_filters( |
|
42 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_Text__valid_type_options', |
|
43 | - [ |
|
44 | - Text::TYPE_EMAIL => esc_html__('Email', 'event_espresso'), |
|
45 | - Text::TYPE_EMAIL_CONFIRM => esc_html__('Email Confirmation', 'event_espresso'), |
|
46 | - Text::TYPE_TEXT => esc_html__('Plain Text', 'event_espresso'), |
|
47 | - Text::TYPE_TEXTAREA => esc_html__('Plain Textarea', 'event_espresso'), |
|
48 | - Text::TYPE_TEXTAREA_HTML => esc_html__('Simple HTML Textarea', 'event_espresso'), |
|
49 | - ] |
|
50 | - ); |
|
51 | - } |
|
39 | + public function __construct() |
|
40 | + { |
|
41 | + $this->valid_type_options = apply_filters( |
|
42 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_Text__valid_type_options', |
|
43 | + [ |
|
44 | + Text::TYPE_EMAIL => esc_html__('Email', 'event_espresso'), |
|
45 | + Text::TYPE_EMAIL_CONFIRM => esc_html__('Email Confirmation', 'event_espresso'), |
|
46 | + Text::TYPE_TEXT => esc_html__('Plain Text', 'event_espresso'), |
|
47 | + Text::TYPE_TEXTAREA => esc_html__('Plain Textarea', 'event_espresso'), |
|
48 | + Text::TYPE_TEXTAREA_HTML => esc_html__('Simple HTML Textarea', 'event_espresso'), |
|
49 | + ] |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * @param bool $constants_only |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function validTypeOptions(bool $constants_only = false): array |
|
59 | - { |
|
60 | - return $constants_only |
|
61 | - ? array_keys($this->valid_type_options) |
|
62 | - : $this->valid_type_options; |
|
63 | - } |
|
54 | + /** |
|
55 | + * @param bool $constants_only |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function validTypeOptions(bool $constants_only = false): array |
|
59 | + { |
|
60 | + return $constants_only |
|
61 | + ? array_keys($this->valid_type_options) |
|
62 | + : $this->valid_type_options; |
|
63 | + } |
|
64 | 64 | } |
@@ -5,81 +5,81 @@ |
||
5 | 5 | class DateTime |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * indicates that the HTML input type is 'date' |
|
10 | - */ |
|
11 | - public const TYPE_DATE = 'date'; |
|
12 | - |
|
13 | - /** |
|
14 | - * indicates that the HTML input type is 'datetime-local' |
|
15 | - */ |
|
16 | - public const TYPE_DATETIME_LOCAL = 'datetime-local'; |
|
17 | - |
|
18 | - /** |
|
19 | - * indicates that the HTML input type is 'month' |
|
20 | - */ |
|
21 | - public const TYPE_MONTH = 'month'; |
|
22 | - |
|
23 | - /** |
|
24 | - * indicates that the HTML input type is 'time' |
|
25 | - */ |
|
26 | - public const TYPE_TIME = 'time'; |
|
27 | - |
|
28 | - /** |
|
29 | - * indicates that the HTML input type is 'week' |
|
30 | - */ |
|
31 | - public const TYPE_WEEK = 'week'; |
|
32 | - |
|
33 | - // CUSTOM EE DATE TYPES |
|
34 | - |
|
35 | - /** |
|
36 | - * indicates that the input is an HTML dropdown used for selecting the day for a date |
|
37 | - */ |
|
38 | - public const TYPE_SELECT_DAY = 'day-select'; |
|
39 | - |
|
40 | - /** |
|
41 | - * indicates that the input is an HTML dropdown used for selecting the month for a date |
|
42 | - */ |
|
43 | - public const TYPE_SELECT_MONTH = 'month-select'; |
|
44 | - |
|
45 | - /** |
|
46 | - * indicates that the input is an HTML dropdown used for selecting the year for a date |
|
47 | - */ |
|
48 | - public const TYPE_SELECT_YEAR = 'year-select'; |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * @var array |
|
53 | - */ |
|
54 | - private $valid_type_options; |
|
55 | - |
|
56 | - |
|
57 | - public function __construct() |
|
58 | - { |
|
59 | - $this->valid_type_options = apply_filters( |
|
60 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_DateTime__valid_type_options', |
|
61 | - [ |
|
62 | - DateTime::TYPE_DATE => esc_html__('Date Picker', 'event_espresso'), |
|
63 | - DateTime::TYPE_DATETIME_LOCAL => esc_html__('Local Date Picker', 'event_espresso'), |
|
64 | - DateTime::TYPE_MONTH => esc_html__('Month Picker', 'event_espresso'), |
|
65 | - DateTime::TYPE_TIME => esc_html__('Time Picker', 'event_espresso'), |
|
66 | - DateTime::TYPE_WEEK => esc_html__('Week Picker', 'event_espresso'), |
|
67 | - DateTime::TYPE_SELECT_DAY => esc_html__('Day Selector', 'event_espresso'), |
|
68 | - DateTime::TYPE_SELECT_MONTH => esc_html__('Month Selector', 'event_espresso'), |
|
69 | - DateTime::TYPE_SELECT_YEAR => esc_html__('Year Selector', 'event_espresso'), |
|
70 | - ] |
|
71 | - ); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @param bool $constants_only |
|
77 | - * @return array |
|
78 | - */ |
|
79 | - public function validTypeOptions(bool $constants_only = false): array |
|
80 | - { |
|
81 | - return $constants_only |
|
82 | - ? array_keys($this->valid_type_options) |
|
83 | - : $this->valid_type_options; |
|
84 | - } |
|
8 | + /** |
|
9 | + * indicates that the HTML input type is 'date' |
|
10 | + */ |
|
11 | + public const TYPE_DATE = 'date'; |
|
12 | + |
|
13 | + /** |
|
14 | + * indicates that the HTML input type is 'datetime-local' |
|
15 | + */ |
|
16 | + public const TYPE_DATETIME_LOCAL = 'datetime-local'; |
|
17 | + |
|
18 | + /** |
|
19 | + * indicates that the HTML input type is 'month' |
|
20 | + */ |
|
21 | + public const TYPE_MONTH = 'month'; |
|
22 | + |
|
23 | + /** |
|
24 | + * indicates that the HTML input type is 'time' |
|
25 | + */ |
|
26 | + public const TYPE_TIME = 'time'; |
|
27 | + |
|
28 | + /** |
|
29 | + * indicates that the HTML input type is 'week' |
|
30 | + */ |
|
31 | + public const TYPE_WEEK = 'week'; |
|
32 | + |
|
33 | + // CUSTOM EE DATE TYPES |
|
34 | + |
|
35 | + /** |
|
36 | + * indicates that the input is an HTML dropdown used for selecting the day for a date |
|
37 | + */ |
|
38 | + public const TYPE_SELECT_DAY = 'day-select'; |
|
39 | + |
|
40 | + /** |
|
41 | + * indicates that the input is an HTML dropdown used for selecting the month for a date |
|
42 | + */ |
|
43 | + public const TYPE_SELECT_MONTH = 'month-select'; |
|
44 | + |
|
45 | + /** |
|
46 | + * indicates that the input is an HTML dropdown used for selecting the year for a date |
|
47 | + */ |
|
48 | + public const TYPE_SELECT_YEAR = 'year-select'; |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * @var array |
|
53 | + */ |
|
54 | + private $valid_type_options; |
|
55 | + |
|
56 | + |
|
57 | + public function __construct() |
|
58 | + { |
|
59 | + $this->valid_type_options = apply_filters( |
|
60 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_DateTime__valid_type_options', |
|
61 | + [ |
|
62 | + DateTime::TYPE_DATE => esc_html__('Date Picker', 'event_espresso'), |
|
63 | + DateTime::TYPE_DATETIME_LOCAL => esc_html__('Local Date Picker', 'event_espresso'), |
|
64 | + DateTime::TYPE_MONTH => esc_html__('Month Picker', 'event_espresso'), |
|
65 | + DateTime::TYPE_TIME => esc_html__('Time Picker', 'event_espresso'), |
|
66 | + DateTime::TYPE_WEEK => esc_html__('Week Picker', 'event_espresso'), |
|
67 | + DateTime::TYPE_SELECT_DAY => esc_html__('Day Selector', 'event_espresso'), |
|
68 | + DateTime::TYPE_SELECT_MONTH => esc_html__('Month Selector', 'event_espresso'), |
|
69 | + DateTime::TYPE_SELECT_YEAR => esc_html__('Year Selector', 'event_espresso'), |
|
70 | + ] |
|
71 | + ); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @param bool $constants_only |
|
77 | + * @return array |
|
78 | + */ |
|
79 | + public function validTypeOptions(bool $constants_only = false): array |
|
80 | + { |
|
81 | + return $constants_only |
|
82 | + ? array_keys($this->valid_type_options) |
|
83 | + : $this->valid_type_options; |
|
84 | + } |
|
85 | 85 | } |
@@ -5,49 +5,49 @@ |
||
5 | 5 | class Number |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * indicates that the HTML input type is 'number' whose value is a decimal (float) |
|
10 | - */ |
|
11 | - public const TYPE_FLOAT = 'decimal'; |
|
12 | - |
|
13 | - /** |
|
14 | - * indicates that the HTML input type is 'number' whose value is an integer (whole number) |
|
15 | - */ |
|
16 | - public const TYPE_INT = 'integer'; |
|
17 | - |
|
18 | - /** |
|
19 | - * indicates that the HTML input type is 'range' |
|
20 | - */ |
|
21 | - public const TYPE_RANGE = 'range'; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @var array |
|
26 | - */ |
|
27 | - private $valid_type_options; |
|
28 | - |
|
29 | - |
|
30 | - public function __construct() |
|
31 | - { |
|
32 | - $this->valid_type_options = apply_filters( |
|
33 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_Number__valid_type_options', |
|
34 | - [ |
|
35 | - Number::TYPE_FLOAT => esc_html__('Decimal Number', 'event_espresso'), |
|
36 | - Number::TYPE_INT => esc_html__('Integer (Whole) Number', 'event_espresso'), |
|
37 | - Number::TYPE_RANGE => esc_html__('Number Range', 'event_espresso'), |
|
38 | - ] |
|
39 | - ); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @param bool $constants_only |
|
45 | - * @return array |
|
46 | - */ |
|
47 | - public function validTypeOptions(bool $constants_only = false): array |
|
48 | - { |
|
49 | - return $constants_only |
|
50 | - ? array_keys($this->valid_type_options) |
|
51 | - : $this->valid_type_options; |
|
52 | - } |
|
8 | + /** |
|
9 | + * indicates that the HTML input type is 'number' whose value is a decimal (float) |
|
10 | + */ |
|
11 | + public const TYPE_FLOAT = 'decimal'; |
|
12 | + |
|
13 | + /** |
|
14 | + * indicates that the HTML input type is 'number' whose value is an integer (whole number) |
|
15 | + */ |
|
16 | + public const TYPE_INT = 'integer'; |
|
17 | + |
|
18 | + /** |
|
19 | + * indicates that the HTML input type is 'range' |
|
20 | + */ |
|
21 | + public const TYPE_RANGE = 'range'; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @var array |
|
26 | + */ |
|
27 | + private $valid_type_options; |
|
28 | + |
|
29 | + |
|
30 | + public function __construct() |
|
31 | + { |
|
32 | + $this->valid_type_options = apply_filters( |
|
33 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_Number__valid_type_options', |
|
34 | + [ |
|
35 | + Number::TYPE_FLOAT => esc_html__('Decimal Number', 'event_espresso'), |
|
36 | + Number::TYPE_INT => esc_html__('Integer (Whole) Number', 'event_espresso'), |
|
37 | + Number::TYPE_RANGE => esc_html__('Number Range', 'event_espresso'), |
|
38 | + ] |
|
39 | + ); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @param bool $constants_only |
|
45 | + * @return array |
|
46 | + */ |
|
47 | + public function validTypeOptions(bool $constants_only = false): array |
|
48 | + { |
|
49 | + return $constants_only |
|
50 | + ? array_keys($this->valid_type_options) |
|
51 | + : $this->valid_type_options; |
|
52 | + } |
|
53 | 53 | } |